Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameclient): stop the score screen music before the menu loads

Olcay Seygan9fe529b26613
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2fa27f84a..e0972e198 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1586,6 +1586,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
- A death cry plays to the end. So does "construction complete", and the tail of a gun. Telling a sound to stop used to cut it off that frame, where the 2003 game let it finish and only kept it from repeating; our own fix for the audio thread broke that, and it is put back. A looping sound caught in the pause between two plays can be stopped too, instead of carrying on after whatever made it is gone.
- A sound on the right of the screen comes out of the right speaker. Since the game went 64-bit its sound library worked left and right out the wrong way round, so a tank firing off to the right was heard on the left. Only a sound well off to one side swings far enough to notice, which is why it seemed to come and go.
- Your units answer you over the battle. A reply plays at whichever of the effects and voice sliders is higher, lifted again on top of that, so "Moving out" is heard in the middle of an artillery duel. Nothing else is turned down to make room for it. EVA and briefings stay where the voice slider puts them.
+- Leaving the score screen no longer plays its music over the main menu theme. The score music was told to fade out over two seconds, but a fade only moves while the game updates its sound, and the menu's background battle was loading in that time with no sound update at all. The music came out of the load at full volume and faded on top of the menu's own track. It stops the moment you click now.
- Movies follow the voice volume slider. The volume was handed to the video before it was ready to take it, so every movie played at full level, and moving the slider while one was playing changed nothing.
- A sound at the edge of its range can fade out instead of stopping dead. The volume curve never
actually reaches zero, so a sound you are walking away from was cut off mid-note at the maximum
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp
index 1e93111dc..dc7b08f3e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp
@@ -410,7 +410,12 @@ void ScoreScreenShutdown( WindowLayout *layout, void *userData )
// our shutdown is complete
TheShell->shutdownComplete( layout );
- TheAudio->removeAudioEvent( AHSV_StopTheMusicFade );
+ // Stopped, not faded. A fade steps once per audio update, and what comes next is a map load
+ // (the shell map, or the next mission) that runs no audio update until it is done. The score
+ // music held its volume through the whole load and did all two seconds of its fade on top of
+ // the track the shell map's first script frame starts, so both played at once.
+ TheAudio->removeAudioEvent( AHSV_StopTheMusic );
+ TheAudio->update(); // so the stop lands at the click, before the load rather than after it
}