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.

feat(gameengine): master volume and music that follows the fight

Olcay Seygan788957f81f46
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b478d0c52..4bc7a2dc7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,13 @@ found and fixed — EA's own, not port damage.**
- In a LAN or online room the other players do not download anything: the map's name carries its recipe, and their own game builds the same map from it and checks it against yours. A room that records stats keeps to the official list.
- Random maps used to be reachable only by a hidden command-line switch that added five rows to the skirmish list.
+## Music that follows the fight
+
+- In a skirmish or an online match the music now answers the battle. While nothing happens one of your side's calmer tracks plays; once guns open up near the camera or on your own forces it crossfades to a harder one, and to the hardest when the fight is big. Six Crusaders against six Scorpions and four Technicals: the first shots brought in a tense track, the battle track followed four seconds later, and twelve seconds after the shooting died down a calm one was back. Two Rangers against three Rebels only gets the middle one.
+- The tracks are the game's own: each side's ten or eleven skirmish pieces were measured for loudness and pace and sorted three calm, three or four tense and four for battle. One track plays at a time, a change is a three-second crossfade, and a track keeps the floor for at least twenty seconds, so a skirmish that flares and dies does not make the music lurch.
+- Music Follows the Fight is on by default and sits under Music Volume on the Audio page. Off, the music plays as the original game had it.
+- A Master Volume slider heads the Audio page and turns the whole game down at once: music, effects, voices, ambience and movies. At half it put the music exactly 6.0 decibels lower. Unit replies keep their lift over the battle and are turned down with everything else, and at full volume the loudest moment of a tank fight still stops at the limiter's ceiling.
+
## Sound that travels
- Sound takes time to cross the battlefield now. An explosion at the edge of the screen is heard about a quarter of a second after it is seen, one at the far end of a long view half a second after, at the speed of sound on the scale the units are drawn at. The wait never runs past a second. A sound also ends as late as it started: a missile's roar carries on until its boom arrives, instead of cutting out at the visible impact and leaving a hole seven decibels deep before the boom. Unit replies, the interface, music, speech and every sound a mission script waits on still play the moment they are asked for.
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index e8ba9c03e..274ca2c80 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -604,6 +604,26 @@ TOOLTIP:AmbientVolume
"Birds, wind, water and the hum of a town. Sound FX no longer moves these, so the battle can stay loud while the world around it stays quiet."
END
+GUI:MasterVolume
+"Master Volume"
+END
+
+TOOLTIP:MasterVolume
+"Turns the whole game up or down: music, effects, voices, ambience and movies. The other sliders keep the mix, this one sets how loud the mix is."
+END
+
+GUI:OptionsGroupMusic
+"Music"
+END
+
+GUI:DynamicMusic
+"Music Follows the Fight"
+END
+
+TOOLTIP:DynamicMusic
+"In a skirmish or online match the music answers the battle: one of your side's calmer tracks while nothing happens, a harder one once guns fire near the camera or at your forces, and back to calm a few seconds after the fight ends. Off leaves the music as the original game played it."
+END
+
GUI:IsometricCamera
"Isometric Camera"
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 99102d3b1..8a2f45f14 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15093,6 +15093,26 @@ TOOLTIP:AmbientVolume
"Kuşlar, rüzgâr, su ve kasabanın uğultusu. Efekt Sesi artık bunları değiştirmez; çatışma yüksek kalırken çevresi sessiz kalabilir."
END
+GUI:MasterVolume
+"Genel Ses"
+END
+
+TOOLTIP:MasterVolume
+"Oyunun tamamını açar ya da kısar: müzik, efektler, konuşmalar, ortam ve videolar. Öteki sürgüler karışımı ayarlar, bu sürgü karışımın ne kadar yüksek çalacağını."
+END
+
+GUI:OptionsGroupMusic
+"Müzik"
+END
+
+GUI:DynamicMusic
+"Müzik Çatışmayı İzlesin"
+END
+
+TOOLTIP:DynamicMusic
+"Çatışma ya da çevrim içi maçta müzik savaşa göre değişir: ortalık sakinken tarafının sakin parçalarından biri, kameranın yakınında ya da birliklerine ateş açılınca daha sert bir parça çalar, çarpışma bittikten birkaç saniye sonra sakin müziğe döner. Kapalıyken müzik özgün oyundaki gibi çalar."
+END
+
GUI:IsometricCamera
"İzometrik Kamera"
END
diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
index f2aab67b8..b7d88f7c9 100644
--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
@@ -7566,7 +7566,8 @@ WINDOW
WINDOW
WINDOWTYPE = STATICTEXT;
SCREENRECT = UPPERLEFT: 34 182, BOTTOMRIGHT: 258 206, CREATIONRESOLUTION: 800 600;
- NAME = "OptionsMenu.wnd:MusicVolumeLabel";
+ NAME = "OptionsMenu.wnd:LabelMasterVolume";
+ TOOLTIPTEXT = "TOOLTIP:MasterVolume";
STATUS = ENABLED;
STYLE = STATICTEXT+MOUSETRACK;
SYSTEMCALLBACK = "[None]";
@@ -7575,9 +7576,8 @@ WINDOW
DRAWCALLBACK = "[None]";
FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
HEADERTEMPLATE = "MinorTitle";
- TOOLTIPTEXT = "GUI:MusicVolume";
TOOLTIPDELAY = -1;
- TEXT = "GUI:MusicVolume";
+ TEXT = "GUI:MasterVolume";
TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
@@ -7614,7 +7614,7 @@ WINDOW
WINDOW
WINDOWTYPE = STATICTEXT;
SCREENRECT = UPPERLEFT: 178 206, BOTTOMRIGHT: 258 230, CREATIONRESOLUTION: 800 600;
- NAME = "OptionsMenu.wnd:ValueMusicVolume";
+ NAME = "OptionsMenu.wnd:ValueMasterVolume";
STATUS = ENABLED;
STYLE = STATICTEXT+MOUSETRACK;
SYSTEMCALLBACK = "[None]";
@@ -7660,7 +7660,7 @@ WINDOW
WINDOW
WINDOWTYPE = HORZSLIDER;
SCREENRECT = UPPERLEFT: 40 206, BOTTOMRIGHT: 176 230, CREATIONRESOLUTION: 800 600;
- NAME = "OptionsMenu.wnd:SliderMusicVolume";
+ NAME = "OptionsMenu.wnd:SliderMasterVolume";
STATUS = ENABLED+IMAGE+TABSTOP;
STYLE = HORZSLIDER+MOUSETRACK;
SYSTEMCALLBACK = "[None]";
@@ -7669,11 +7669,11 @@ WINDOW
DRAWCALLBACK = "[None]";
FONT = NAME: "Times New Roman", SIZE: 14, BOLD: 0;
HEADERTEMPLATE = "[None]";
- TOOLTIPTEXT = "GUI:MusicVolume";
+ TOOLTIPTEXT = "TOOLTIP:MasterVolume";
TOOLTIPDELAY = -1;
- TEXTCOLOR = ENABLED: 0 0 0 0, ENABLEDBORDER: 0 0 0 0,
- DISABLED: 0 0 0 0, DISABLEDBORDER: 0 0 0 0,
- HILITE: 0 0 0 0, HILITEBORDER: 0 0 0 0;
+ TEXTCOLOR = ENABLED: 254 254 254 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
@@ -7701,8 +7701,7 @@ WINDOW
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
- SLIDERDATA = MINVALUE: 0,
- MAXVALUE: 100;
+ SLIDERDATA = MINVALUE: 0, MAXVALUE: 100;
SLIDERTHUMBENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 128 128 255, BORDERCOLOR: 255 0 0 255,
IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
@@ -8237,6 +8236,267 @@ WINDOW
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
END
+ CHILD
+ WINDOW
+ WINDOWTYPE = STATICTEXT;
+ SCREENRECT = UPPERLEFT: 282 150, BOTTOMRIGHT: 506 174, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:GroupHeadingAudio1";
+ STATUS = ENABLED;
+ STYLE = STATICTEXT+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Generals", SIZE: 15, BOLD: 0;
+ HEADERTEMPLATE = "MainButton";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:OptionsGroupMusic";
+ TEXTCOLOR = ENABLED: 186 255 12 255, ENABLEDBORDER: 0 2 0 255, DISABLED: 186 255 12 255, DISABLEDBORDER: 0 2 0 255, HILITE: 186 255 12 255, HILITEBORDER: 0 2 0 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 128 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ STATICTEXTDATA = CENTERED: 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = STATICTEXT;
+ SCREENRECT = UPPERLEFT: 282 182, BOTTOMRIGHT: 506 206, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:MusicVolumeLabel";
+ STATUS = ENABLED;
+ STYLE = STATICTEXT+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPTEXT = "GUI:MusicVolume";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:MusicVolume";
+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 128 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ STATICTEXTDATA = CENTERED: 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = STATICTEXT;
+ SCREENRECT = UPPERLEFT: 426 206, BOTTOMRIGHT: 506 230, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:ValueMusicVolume";
+ STATUS = ENABLED;
+ STYLE = STATICTEXT+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPDELAY = -1;
+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 128 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ STATICTEXTDATA = CENTERED: 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = HORZSLIDER;
+ SCREENRECT = UPPERLEFT: 288 206, BOTTOMRIGHT: 424 230, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:SliderMusicVolume";
+ STATUS = ENABLED+IMAGE+TABSTOP;
+ STYLE = HORZSLIDER+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Times New Roman", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "[None]";
+ TOOLTIPTEXT = "GUI:MusicVolume";
+ TOOLTIPDELAY = -1;
+ TEXTCOLOR = ENABLED: 0 0 0 0, ENABLEDBORDER: 0 0 0 0,
+ DISABLED: 0 0 0 0, DISABLEDBORDER: 0 0 0 0,
+ HILITE: 0 0 0 0, HILITEBORDER: 0 0 0 0;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: hilightedbox, COLOR: 128 128 128 255, BORDERCOLOR: 64 64 64 255,
+ IMAGE: dehilightedbox, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: linebox, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: arrow, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ SLIDERDATA = MINVALUE: 0,
+ MAXVALUE: 100;
+ SLIDERTHUMBENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 128 128 255, BORDERCOLOR: 255 0 0 255,
+ IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ SLIDERTHUMBDISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 128 128 128 255,
+ IMAGE: NoImage, COLOR: 0 0 0 255, BORDERCOLOR: 64 64 64 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ SLIDERTHUMBHILITEDRAWDATA = IMAGE: arrow, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: arrow, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = CHECKBOX;
+ SCREENRECT = UPPERLEFT: 288 238, BOTTOMRIGHT: 512 262, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:CheckDynamicMusic";
+ STATUS = ENABLED+IMAGE+BORDER;
+ STYLE = CHECKBOX+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPTEXT = "TOOLTIP:DynamicMusic";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:DynamicMusic";
+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,
+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ END
ENDALLCHILDREN
END
CHILD
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AudioAffect.h b/GeneralsMD/Code/GameEngine/Include/Common/AudioAffect.h
index 18fe4d232..3fcfdfa22 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/AudioAffect.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/AudioAffect.h
@@ -43,6 +43,10 @@ enum AudioAffect : int
AudioAffect_All = (AudioAffect_Music | AudioAffect_Sound | AudioAffect_Sound3D | AudioAffect_Speech | AudioAffect_Ambient),
AudioAffect_SystemSetting = 0x10,
+
+ /// the Master slider, a factor on every other volume; system setting only, and outside All, so
+ /// losing focus mutes through the others and leaves it where the player put it
+ AudioAffect_Master = 0x40,
};
#endif // _AUDIOAFFECT_H_
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h b/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
index e00124ddd..e06a8b2a9 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
@@ -350,6 +350,9 @@ class AudioManager : public SubsystemInterface
/// a handle a tick minted for a sound still waiting for the end of the tick counts as playing
Bool isQueuedFromTick( AudioHandle handle ) const;
+ /// m_musicVolume and the other three products from the script, system and Master volumes
+ void recomputeVolumes( void );
+
protected:
AudioSettings *m_audioSettings;
MiscAudio *m_miscAudio;
@@ -381,6 +384,7 @@ class AudioManager : public SubsystemInterface
Real m_systemSound3DVolume;
Real m_systemSpeechVolume;
Real m_systemAmbientVolume;
+ Real m_systemMasterVolume; ///< the Master slider, folded into the four products by recomputeVolumes
Real m_zoomVolume;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h b/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
index f94e94be5..2962e42b9 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
@@ -52,6 +52,8 @@
#include "Common/GameAudio.h"
#include "Common/GameMemory.h"
+#include <map>
+
//----------------------------------------------------------------------------
// Forward References
@@ -100,6 +102,19 @@ public:
};
+/** Plays and stops the music the request list is handed, and, in a skirmish or multiplayer match
+ * with DynamicMusic on, makes it follow the fight.
+ *
+ * The fight is measured from the sounds the game asks for (noteSound): a weapon firing, a unit
+ * reaching a worse damage state or crying out under fire, weighted by how near the camera it is,
+ * or by half when it is the local player's own unit wherever it stands. Those add to an intensity
+ * that halves about every three and a half seconds, so it reads roughly as weighted shots a second.
+ * Above a threshold the music moves from calm to tense to battle, each a crossfade to a track of
+ * the side's own playlist chosen by a hand table (TheDynamicTracks), and comes back down once the
+ * fight has been over for a few seconds and the track has had its minimum time. While tense or
+ * battle music plays, the skirmish scripts' own track changes are held; back at calm, they choose
+ * when the music changes again and a calm track of the side plays whichever they named. Nothing
+ * here is read by the logic, so nothing in it reaches a CRC. */
class MusicManager
{
public:
@@ -113,6 +128,40 @@ class MusicManager
virtual void removeAudioEvent( AudioHandle eventToRemove );
void setVolume( Real m_volume );
+
+ /// once each audio update: the intensity's decay, the mood it asks for and the crossfade
+ void update( void );
+ /// every sound the game asks for, before the options or the shroud can drop it
+ void noteSound( const AudioEventRTS *event );
+
+ enum Mood { MOOD_CALM, MOOD_TENSE, MOOD_BATTLE, MOOD_COUNT };
+
+ private:
+ Bool engaged( void ) const;
+ void startMatch( void );
+ void releaseHeldStop( void );
+ AsciiString pickTrack( Mood mood );
+ void changeTrack( Mood mood );
+ void buildCombatSounds( void );
+
+ std::map<const AudioEventInfo *, Real> m_combatWeight; ///< weapon fire, damage and fear sounds, built once
+ Real m_intensity;
+ UnsignedInt m_lastFrame;
+ Mood m_mood; ///< what plays now; calm also while the scripts have the music
+ UnsignedInt m_moodSince; ///< frame the music last changed
+ UnsignedInt m_lowerSince; ///< frame the intensity first asked for less than m_mood, 0 while it does not
+ Bool m_inControl; ///< tense or battle music of ours plays and the scripts' changes are held
+ Bool m_issuing; ///< our own stop and play are going through
+ Bool m_stopHeld;
+ AudioHandle m_heldStop; ///< a script's stop, kept until the play after it says whose track it was
+ AsciiString m_side; ///< "USA", "CHI" or "GLA": whose playlist
+ AsciiString m_track; ///< the track we last started
+ AudioEventRTS *m_fadeEvent; ///< the device's own copy of the track fading in, NULL when none
+ AudioHandle m_fadeHandle; ///< its handle: the copy is only touched while the device still has it
+ UnsignedInt m_fadeStart;
+ Real m_fadeTarget;
+ Int m_pick[MOOD_COUNT]; ///< steps through each mood's tracks in turn
+ UnsignedInt m_lastLogFrame;
};
#endif // __COMMON_GAMEMUSIC_H_
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index 003fecaae..d076b8f5b 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -695,6 +695,8 @@ public:
Real m_SFXVolumeFactor; ///< Factor applied to loudness of SFX volume
Real m_voiceVolumeFactor; ///< Factor applied to loudness of voice volume
Int m_ambientVolume; ///< "AmbientVolume" in Options.ini: percent for looping world ambience, in place of the effects slider
+ Int m_masterVolume; ///< "MasterVolume" in Options.ini: percent every other slider is multiplied by, music and speech included
+ Bool m_dynamicMusic; ///< "DynamicMusic" in Options.ini: a skirmish's music follows the fight (MusicManager::update)
Bool m_3DSoundPref; ///< Whether user wants to use 3DSound or not
Bool m_animateWindows; ///< Should we animate window transitions?
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
index 78a88a203..ea70419a1 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
@@ -201,6 +201,7 @@ AudioManager::AudioManager() :
m_systemSoundVolume = 0.0f;
m_systemSpeechVolume = 0.0f;
m_systemAmbientVolume = 0.0f;
+ m_systemMasterVolume = 1.0f;
m_zoomVolume = 1.0f;
m_volumeHasChanged = FALSE;
//
@@ -300,16 +301,14 @@ void AudioManager::init()
m_systemSound3DVolume = getAudioSettings() ? getAudioSettings()->m_preferred3DSoundVolume: 0.75f;
m_systemSpeechVolume = getAudioSettings() ? getAudioSettings()->m_preferredSpeechVolume : 0.55f;
m_systemAmbientVolume = TheGlobalData->m_ambientVolume / 100.0f; // the catalog loaded it from Options.ini
+ m_systemMasterVolume = TheGlobalData->m_masterVolume / 100.0f;
m_scriptMusicVolume = 1.0f;
m_scriptSoundVolume = 1.0f;
m_scriptSound3DVolume = 1.0f;
m_scriptSpeechVolume = 1.0f;
-
- m_musicVolume = m_systemMusicVolume;
- m_soundVolume = m_systemSoundVolume;
- m_sound3DVolume = m_systemSound3DVolume;
- m_speechVolume = m_systemSpeechVolume;
+
+ recomputeVolumes();
}
//-------------------------------------------------------------------------------------------------
@@ -342,11 +341,7 @@ void AudioManager::reset()
m_scriptSound3DVolume = 1.0f;
m_scriptSpeechVolume = 1.0f;
- // restore the final values to the
- m_musicVolume = m_systemMusicVolume;
- m_soundVolume = m_systemSoundVolume;
- m_sound3DVolume = m_systemSound3DVolume;
- m_speechVolume = m_systemSpeechVolume;
+ recomputeVolumes();
m_disallowSpeech = FALSE;
m_handlesQueuedFromTick.clear();
@@ -436,6 +431,7 @@ void AudioManager::update()
set3DVolumeAdjustment( m_zoomVolume );
+ m_music->update();
}
//-------------------------------------------------------------------------------------------------
@@ -543,6 +539,9 @@ AudioHandle AudioManager::addAudioEventNow(const AudioEventRTS *eventToAdd, Audi
}
}
+ // the fight the music listens to is heard even with the effects switched off
+ m_music->noteSound(eventToAdd);
+
switch (eventToAdd->getAudioEventInfo()->m_soundType)
{
case AT_Music:
@@ -865,8 +864,6 @@ void AudioManager::setVolume( Real volume, AudioAffect whichToAffect )
} else {
m_scriptMusicVolume = volume;
}
-
- m_musicVolume = m_scriptMusicVolume * m_systemMusicVolume;
}
if (whichToAffect & AudioAffect_Sound) {
@@ -875,8 +872,6 @@ void AudioManager::setVolume( Real volume, AudioAffect whichToAffect )
} else {
m_scriptSoundVolume = volume;
}
-
- m_soundVolume = m_scriptSoundVolume * m_systemSoundVolume;
}
if (whichToAffect & AudioAffect_Sound3D) {
@@ -885,7 +880,6 @@ void AudioManager::setVolume( Real volume, AudioAffect whichToAffect )
} else {
m_scriptSound3DVolume = volume;
}
- m_sound3DVolume = m_scriptSound3DVolume * m_systemSound3DVolume;
}
if (whichToAffect & AudioAffect_Speech) {
@@ -894,7 +888,6 @@ void AudioManager::setVolume( Real volume, AudioAffect whichToAffect )
} else {
m_scriptSpeechVolume = volume;
}
- m_speechVolume = m_scriptSpeechVolume * m_systemSpeechVolume;
}
// No script volume of its own: a script that turns the effects down turns ambience down with them,
@@ -903,7 +896,30 @@ void AudioManager::setVolume( Real volume, AudioAffect whichToAffect )
m_systemAmbientVolume = volume;
}
- m_volumeHasChanged = true;
+ if ((whichToAffect & AudioAffect_Master) && (whichToAffect & AudioAffect_SystemSetting)) {
+ m_systemMasterVolume = volume;
+ }
+
+ recomputeVolumes();
+}
+
+//-------------------------------------------------------------------------------------------------
+/** What the device reads: script times slider for each kind, the camera's zoom on 3D sound, and the
+ * Master slider on all of it. Nothing reaches a sample without passing one of these four or
+ * getAmbientVolume, so a unit's reply, whose boost is taken on top of the louder of the effects and
+ * voice volumes and clamped to full scale, is turned down by Master like the rest. */
+void AudioManager::recomputeVolumes( void )
+{
+ m_musicVolume = m_scriptMusicVolume * m_systemMusicVolume * m_systemMasterVolume;
+ m_soundVolume = m_scriptSoundVolume * m_systemSoundVolume * m_systemMasterVolume;
+ m_sound3DVolume = MIN( 1.0f, MAX( 0.0f, m_zoomVolume * m_scriptSound3DVolume * m_systemSound3DVolume * m_systemMasterVolume ) );
+ m_speechVolume = m_scriptSpeechVolume * m_systemSpeechVolume * m_systemMasterVolume;
+
+ // Flagged every frame, changed or not: MilesAudioManager::getEffectiveVolume folds the listener's
+ // distance into a 3D sound's volume, so a playing sound needs it recomputed as the camera moves.
+ // EA skipped this while any speech stream played, against a hang inside the Miles DLL that the
+ // XAudio2 implementation does not have, and 3D volumes froze for as long as an EVA line lasted.
+ m_volumeHasChanged = TRUE;
}
//-------------------------------------------------------------------------------------------------
@@ -939,27 +955,14 @@ Real AudioManager::getAmbientVolume( Bool positional ) const
{
const Real volume = positional ? m_zoomVolume * m_scriptSound3DVolume * m_systemAmbientVolume
: m_scriptSoundVolume * m_systemAmbientVolume;
- return MIN( 1.0f, MAX( 0.0f, volume ) );
+ return MIN( 1.0f, MAX( 0.0f, volume * m_systemMasterVolume ) );
}
//-------------------------------------------------------------------------------------------------
void AudioManager::set3DVolumeAdjustment( Real volumeAdjustment )
{
m_zoomVolume = volumeAdjustment;
- m_sound3DVolume = volumeAdjustment * m_scriptSound3DVolume * m_systemSound3DVolume;
-
- // clamp
- if (m_sound3DVolume < 0.0f)
- m_sound3DVolume = 0.0f;
-
- if (m_sound3DVolume > 1.0f)
- m_sound3DVolume = 1.0f;
-
- // Flagged every frame, changed or not: MilesAudioManager::getEffectiveVolume folds the listener's
- // distance into a 3D sound's volume, so a playing sound needs it recomputed as the camera moves.
- // EA skipped this while any speech stream played, against a hang inside the Miles DLL that the
- // XAudio2 implementation does not have, and 3D volumes froze for as long as an EVA line lasted.
- m_volumeHasChanged = TRUE;
+ recomputeVolumes();
}
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
index 423c27527..7ef9c16ea 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
@@ -47,10 +47,24 @@
#include "Common/GameMusic.h"
+#include "Common/AudioEventInfo.h"
#include "Common/AudioEventRTS.h"
+#include "Common/AudioHandleSpecialValues.h"
#include "Common/AudioRequest.h"
#include "Common/GameAudio.h"
+#include "Common/GlobalData.h"
#include "Common/INI.h"
+#include "Common/Player.h"
+#include "Common/PlayerList.h"
+#include "Common/PlayerTemplate.h"
+#include "Common/ThingFactory.h"
+#include "Common/ThingTemplate.h"
+#include "GameLogic/GameLogic.h"
+#include "GameLogic/Object.h"
+#include "GameLogic/Weapon.h"
+#include "GameLogic/WeaponSet.h"
+
+#include <math.h>
#ifdef _INTERNAL
//#pragma optimize("", off)
@@ -87,9 +101,95 @@ const FieldParse MusicTrack::m_musicTrackFieldParseTable[] =
//-------------------------------------------------------------------------------------------------
-MusicManager::MusicManager()
-{
+/** The skirmish playlists by mood. Every track of Music.ini's Game_<side>_NN was measured for
+ * loudness, onsets a second, spectral flux and the share of quiet passages, and ranked against the
+ * rest of its own side's list: the three lowest calm, the four highest battle, the rest tense
+ * (experiments/proofs/2026-10-25/audio-music/classify.py in the wrapper). Game_Silent is the sixty
+ * seconds the scripts leave between two tracks; it has no side and is never picked, but while our
+ * music plays it is held like the tracks are. A mod's own tracks are not here, so its music stays
+ * the scripts'. */
+struct DynamicTrack
+{
+ const char *name;
+ const char *side;
+ Int mood;
+};
+
+static const DynamicTrack TheDynamicTracks[] =
+{
+ { "Game_USA_06", "USA", MusicManager::MOOD_CALM },
+ { "Game_USA_01", "USA", MusicManager::MOOD_CALM },
+ { "Game_USA_02", "USA", MusicManager::MOOD_CALM },
+ { "Game_USA_07", "USA", MusicManager::MOOD_TENSE },
+ { "Game_USA_11", "USA", MusicManager::MOOD_TENSE },
+ { "Game_USA_10", "USA", MusicManager::MOOD_TENSE },
+ { "Game_USA_03", "USA", MusicManager::MOOD_TENSE },
+ { "Game_USA_09", "USA", MusicManager::MOOD_BATTLE },
+ { "Game_USA_08", "USA", MusicManager::MOOD_BATTLE },
+ { "Game_USA_05", "USA", MusicManager::MOOD_BATTLE },
+ { "Game_USA_04", "USA", MusicManager::MOOD_BATTLE },
+
+ { "Game_CHI_07", "CHI", MusicManager::MOOD_CALM },
+ { "Game_CHI_02", "CHI", MusicManager::MOOD_CALM },
+ { "Game_CHI_03", "CHI", MusicManager::MOOD_CALM },
+ { "Game_CHI_08", "CHI", MusicManager::MOOD_TENSE },
+ { "Game_CHI_10", "CHI", MusicManager::MOOD_TENSE },
+ { "Game_CHI_06", "CHI", MusicManager::MOOD_TENSE },
+ { "Game_CHI_09", "CHI", MusicManager::MOOD_BATTLE },
+ { "Game_CHI_04", "CHI", MusicManager::MOOD_BATTLE },
+ { "Game_CHI_01", "CHI", MusicManager::MOOD_BATTLE },
+ { "Game_CHI_05", "CHI", MusicManager::MOOD_BATTLE },
+
+ { "Game_GLA_11", "GLA", MusicManager::MOOD_CALM },
+ { "Game_GLA_03", "GLA", MusicManager::MOOD_CALM },
+ { "Game_GLA_10", "GLA", MusicManager::MOOD_CALM },
+ { "Game_GLA_05", "GLA", MusicManager::MOOD_TENSE },
+ { "Game_GLA_04", "GLA", MusicManager::MOOD_TENSE },
+ { "Game_GLA_06", "GLA", MusicManager::MOOD_TENSE },
+ { "Game_GLA_08", "GLA", MusicManager::MOOD_TENSE },
+ { "Game_GLA_09", "GLA", MusicManager::MOOD_BATTLE },
+ { "Game_GLA_02", "GLA", MusicManager::MOOD_BATTLE },
+ { "Game_GLA_07", "GLA", MusicManager::MOOD_BATTLE },
+ { "Game_GLA_01", "GLA", MusicManager::MOOD_BATTLE },
+
+ { "Game_Silent", "", MusicManager::MOOD_CALM },
+};
+
+static const char *const TheMoodNames[] = { "calm", "tense", "battle" };
+
+// The fight, in weighted sounds a second. Up at the first figure of each pair, down only below the
+// second, so a fight that hovers on a line does not swap the music back and forth. Measured on
+// musicfight.txt: six Crusaders against six Scorpions and four Technicals on the camera peak at 12,
+// two Rangers against three Rebels at 5.
+static const Real TENSE_ON = 1.0f;
+static const Real TENSE_OFF = 0.4f;
+static const Real BATTLE_ON = 6.0f;
+static const Real BATTLE_OFF = 3.0f;
+
+static const Real INTENSITY_SECONDS = 5.0f; ///< the decay's time constant: half gone in 3.5 seconds
+static const Real NEAR_RANGE = 500.0f; ///< a sound this far from the microphone on the ground counts for nothing
+static const Real OWN_SHARE = 0.5f; ///< the least a sound of the local player's own unit counts, wherever it is
+static const Real FEAR_WEIGHT = 3.0f; ///< a unit hit into a worse state or crying out counts as three shots
+
+static const UnsignedInt UP_AFTER = 4 * LOGICFRAMES_PER_SECOND; ///< a crossfade's length: no change cuts one short
+static const UnsignedInt DOWN_HOLD = 12 * LOGICFRAMES_PER_SECOND; ///< quieter this long before the music comes down: from battle, past tense to calm
+static const UnsignedInt MIN_TRACK = 20 * LOGICFRAMES_PER_SECOND; ///< and never before a track has had this long
+static const UnsignedInt FADE_IN = 3 * LOGICFRAMES_PER_SECOND; ///< the new track's rise; the old one falls over TimeToFadeAudio
+static const Real FADE_FLOOR = 0.05f; ///< where it rises from, above MinSampleVolume's cull
+
+static const DynamicTrack *findDynamicTrack( const AsciiString& name )
+{
+ for (Int i = 0; i < ARRAY_SIZE( TheDynamicTracks ); ++i)
+ if (name.compareNoCase( TheDynamicTracks[i].name ) == 0)
+ return &TheDynamicTracks[i];
+ return NULL;
+}
+//-------------------------------------------------------------------------------------------------
+MusicManager::MusicManager()
+{
+ startMatch();
+ m_lastFrame = 0;
}
//-------------------------------------------------------------------------------------------------
@@ -119,12 +219,287 @@ void MusicManager::stopTrack( AudioHandle eventToRemove )
//-------------------------------------------------------------------------------------------------
void MusicManager::addAudioEvent( AudioEventRTS *eventToAdd )
{
+ const DynamicTrack *track = findDynamicTrack( eventToAdd->getEventName() );
+ if (track != NULL && track->side[0] != '\0')
+ m_side = track->side;
+
+ if (m_inControl && !m_issuing && engaged())
+ {
+ // The scripts' cycle goes on underneath; the fight keeps its music.
+ if (track != NULL)
+ {
+ m_stopHeld = FALSE;
+ TheAudio->releaseAudioEventRTS( eventToAdd );
+ return;
+ }
+ // Anything else, a map's own cue, takes the music back until the cycle plays a table track again.
+ releaseHeldStop();
+ }
+ if (track == NULL)
+ m_side.clear();
+
+ // At calm the cycle's own next track is swapped for a calm one of its side, or a fight's music
+ // would play over a quiet base. The scripts' sixty seconds of silence stay as they are.
+ if (!m_issuing && !m_inControl && track != NULL && track->side[0] != '\0' && track->mood != MOOD_CALM && engaged())
+ {
+ m_track = pickTrack( MOOD_CALM );
+ DEBUG_LOG(("MUSIC: frame %u the scripts' %s plays as %s\n", TheGameLogic->getFrame(),
+ eventToAdd->getEventName().str(), m_track.str()));
+ eventToAdd->setEventName( m_track );
+ TheAudio->getInfoForAudioEvent( eventToAdd );
+ eventToAdd->generateFilename();
+ eventToAdd->generatePlayInfo();
+ }
+
+ if (m_issuing)
+ {
+ m_fadeEvent = eventToAdd;
+ m_fadeHandle = eventToAdd->getPlayingHandle();
+ }
playTrack( eventToAdd );
}
//-------------------------------------------------------------------------------------------------
void MusicManager::removeAudioEvent( AudioHandle eventToRemove )
{
+ if (m_inControl && !m_issuing && engaged())
+ {
+ m_stopHeld = TRUE;
+ m_heldStop = eventToRemove;
+ return;
+ }
stopTrack( eventToRemove );
}
+//-------------------------------------------------------------------------------------------------
+/** A stop with no table track after it was not the cycle's: let it through and give the music up. */
+void MusicManager::releaseHeldStop( void )
+{
+ if (m_stopHeld)
+ stopTrack( m_heldStop );
+ m_stopHeld = FALSE;
+ m_inControl = FALSE;
+ m_mood = MOOD_CALM;
+}
+
+//-------------------------------------------------------------------------------------------------
+void MusicManager::startMatch( void )
+{
+ m_intensity = 0.0f;
+ m_mood = MOOD_CALM;
+ m_moodSince = 0;
+ m_lowerSince = 0;
+ m_inControl = FALSE;
+ m_issuing = FALSE;
+ m_stopHeld = FALSE;
+ m_heldStop = AHSV_Error;
+ m_side.clear();
+ m_track.clear();
+ m_fadeEvent = NULL;
+ m_fadeHandle = AHSV_Error;
+ m_fadeStart = 0;
+ m_fadeTarget = 1.0f;
+ m_lastLogFrame = 0;
+ for (Int i = 0; i < MOOD_COUNT; ++i)
+ m_pick[i] = 0;
+}
+
+//-------------------------------------------------------------------------------------------------
+/** A skirmish or multiplayer match the local player still plays in, with the option on. Read on the
+ * main thread outside the tick, where the audio already reads the player and the objects. */
+Bool MusicManager::engaged( void ) const
+{
+ if (!TheGlobalData->m_dynamicMusic || TheGameLogic == NULL || !TheGameLogic->isInGame()
+ || TheGameLogic->isLoadingMap() || TheGameLogic->isInShellGame()
+ || !(TheGameLogic->isInSkirmishGame() || TheGameLogic->isInMultiplayerGame()))
+ return FALSE;
+ const Player *me = ThePlayerList->getLocalPlayer();
+ return me != NULL && me->isPlayerActive();
+}
+
+//-------------------------------------------------------------------------------------------------
+void MusicManager::buildCombatSounds( void )
+{
+ for (const ThingTemplate *tmpl = TheThingFactory->firstTemplate(); tmpl; tmpl = tmpl->friend_getNextTemplate())
+ {
+ const WeaponTemplateSetVector& sets = tmpl->getWeaponTemplateSets();
+ for (size_t s = 0; s < sets.size(); ++s)
+ {
+ for (Int slot = 0; slot < WEAPONSLOT_COUNT; ++slot)
+ {
+ const WeaponTemplate *weapon = sets[s].getNth( (WeaponSlotType)slot );
+ const AudioEventInfo *info = weapon ? TheAudio->findAudioEventInfo( weapon->getFireSound().getEventName() ) : NULL;
+ if (info != NULL && m_combatWeight.find( info ) == m_combatWeight.end())
+ m_combatWeight[info] = 1.0f;
+ }
+ }
+ const AudioEventRTS *hurt[] = { tmpl->getSoundOnDamaged(), tmpl->getSoundOnReallyDamaged(), tmpl->getVoiceFear() };
+ for (Int i = 0; i < ARRAY_SIZE( hurt ); ++i)
+ {
+ const AudioEventInfo *info = TheAudio->findAudioEventInfo( hurt[i]->getEventName() );
+ if (info != NULL)
+ m_combatWeight[info] = FEAR_WEIGHT;
+ }
+ }
+ DEBUG_LOG(("MUSIC: %d sounds count as fighting\n", (Int)m_combatWeight.size()));
+}
+
+//-------------------------------------------------------------------------------------------------
+void MusicManager::noteSound( const AudioEventRTS *event )
+{
+ if (!engaged())
+ return;
+ if (m_combatWeight.empty())
+ buildCombatSounds();
+
+ std::map<const AudioEventInfo *, Real>::const_iterator it = m_combatWeight.find( event->getAudioEventInfo() );
+ if (it == m_combatWeight.end())
+ return;
+
+ // The getters are not const; they only read.
+ AudioEventRTS *sound = const_cast<AudioEventRTS *>( event );
+ Coord3D pos;
+ Bool mine = FALSE;
+ const Object *obj = TheGameLogic->findObjectByID( sound->getObjectID() );
+ if (obj != NULL)
+ {
+ pos = *obj->getPosition();
+ mine = obj->getControllingPlayer() == ThePlayerList->getLocalPlayer();
+ }
+ else if (sound->getPosition() != NULL)
+ pos = *sound->getPosition();
+ else
+ return;
+
+ const Coord3D *mic = TheAudio->getListenerPosition();
+ const Real dx = pos.x - mic->x;
+ const Real dy = pos.y - mic->y;
+ const Real nearness = MAX( 0.0f, 1.0f - sqrtf( dx * dx + dy * dy ) / NEAR_RANGE );
+ m_intensity += it->second * MAX( nearness, mine ? OWN_SHARE : 0.0f ) / INTENSITY_SECONDS;
+}
+
+//-------------------------------------------------------------------------------------------------
+/** The side's tracks of this mood in turn, never the one we started last; empty for an unknown side. */
+AsciiString MusicManager::pickTrack( Mood mood )
+{
+ AsciiString pick;
+ Int count = 0;
+ for (Int i = 0; i < ARRAY_SIZE( TheDynamicTracks ); ++i)
+ if (TheDynamicTracks[i].mood == mood && m_side == TheDynamicTracks[i].side)
+ ++count;
+ for (Int tries = 0; tries < count && (pick.isEmpty() || pick == m_track); ++tries)
+ {
+ const Int want = m_pick[mood]++ % count;
+ for (Int i = 0, n = 0; i < ARRAY_SIZE( TheDynamicTracks ); ++i)
+ if (TheDynamicTracks[i].mood == mood && m_side == TheDynamicTracks[i].side && n++ == want)
+ pick = TheDynamicTracks[i].name;
+ }
+ return pick;
+}
+
+//-------------------------------------------------------------------------------------------------
+/** Fades out whatever music plays, over TimeToFadeAudio, and brings a track of this mood up from
+ * nearly nothing over FADE_IN. The fading track is marked as such, so the one-track rule in the
+ * device leaves it alone until it has gone. */
+void MusicManager::changeTrack( Mood mood )
+{
+ const UnsignedInt now = TheGameLogic->getFrame();
+ const AsciiString pick = pickTrack( mood );
+
+ DEBUG_LOG(("MUSIC: frame %u intensity %.2f %s -> %s, %s\n", now, m_intensity, TheMoodNames[m_mood],
+ TheMoodNames[mood], pick.str()));
+ m_mood = mood;
+ m_moodSince = now;
+ m_lowerSince = 0;
+ if (pick.isEmpty())
+ return;
+
+ m_issuing = TRUE;
+ TheAudio->removeAudioEvent( AHSV_StopTheMusicFade );
+ AudioEventRTS track( pick );
+ track.setVolume( FADE_FLOOR );
+ TheAudio->addAudioEvent( &track );
+ m_issuing = FALSE;
+
+ m_track = pick;
+ m_fadeStart = now;
+ m_fadeTarget = TheAudio->findAudioEventInfo( pick )->m_volume;
+}
+
+//-------------------------------------------------------------------------------------------------
+void MusicManager::update( void )
+{
+ if (m_stopHeld)
+ releaseHeldStop();
+
+ const Bool match = TheGameLogic != NULL && TheGameLogic->isInGame() && !TheGameLogic->isLoadingMap();
+ const UnsignedInt now = match ? TheGameLogic->getFrame() : 0;
+ if (!match || now < m_lastFrame)
+ {
+ if (m_lastFrame != 0)
+ startMatch();
+ m_lastFrame = now;
+ return;
+ }
+
+ // one step of the decay a logic frame, e^(-1/300) to five places without a runtime exp
+ // (simulation_uses_no_runtime_trig scans this folder); a jump of more than ten seconds counts as ten
+ for (UnsignedInt f = m_lastFrame; f < now && f < m_lastFrame + 10 * LOGICFRAMES_PER_SECOND; ++f)
+ m_intensity *= 1.0f - 1.0f / (INTENSITY_SECONDS * LOGICFRAMES_PER_SECOND);
+ m_lastFrame = now;
+
+ // The rise is the device's own copy of the event, which the device frees when the stream ends, so
+ // it is written only while the device still answers for its handle. The device reads the volume
+ // back on its next pass, with the music slider on it, in the same update.
+ if (m_fadeEvent != NULL)
+ {
+ const Real t = MIN( 1.0f, (Real)(now - m_fadeStart) / FADE_IN );
+ if (TheAudio->isCurrentlyPlaying( m_fadeHandle ))
+ m_fadeEvent->setVolume( FADE_FLOOR + (m_fadeTarget - FADE_FLOOR) * t );
+ if (t >= 1.0f || !TheAudio->isCurrentlyPlaying( m_fadeHandle ))
+ m_fadeEvent = NULL;
+ }
+
+ if (!engaged())
+ {
+ m_inControl = FALSE;
+ m_mood = MOOD_CALM;
+ return;
+ }
+
+ // Every two seconds only while -wav records, to lay beside the recorded mix; the changes always.
+ if (TheGlobalData->m_wavEndFrame > 0 && now - m_lastLogFrame >= 2 * LOGICFRAMES_PER_SECOND)
+ {
+ m_lastLogFrame = now;
+ DEBUG_LOG(("MUSIC: frame %u intensity %.2f %s %s\n", now, m_intensity, TheMoodNames[m_mood], m_side.str()));
+ }
+ // Until the scripts play a track of the table there is no playlist to choose from.
+ if (m_side.isEmpty())
+ return;
+
+ Mood wanted = MOOD_CALM;
+ if (m_intensity >= BATTLE_ON || (m_mood == MOOD_BATTLE && m_intensity >= BATTLE_OFF))
+ wanted = MOOD_BATTLE;
+ else if (m_intensity >= TENSE_ON || (m_mood != MOOD_CALM && m_intensity >= TENSE_OFF))
+ wanted = MOOD_TENSE;
+
+ if (wanted > m_mood && now - m_moodSince >= UP_AFTER)
+ {
+ m_inControl = TRUE;
+ changeTrack( wanted );
+ }
+ else if (wanted < m_mood)
+ {
+ if (m_lowerSince == 0)
+ m_lowerSince = now;
+ if (now - m_lowerSince >= DOWN_HOLD && now - m_moodSince >= MIN_TRACK)
+ {
+ changeTrack( wanted );
+ // back at calm the scripts have the music again, from their next change on
+ m_inControl = wanted != MOOD_CALM;
+ }
+ }
+ else
+ m_lowerSince = 0;
+}
+
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 0a95718d7..be3d37f30 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -1447,6 +1447,8 @@ GlobalData::GlobalData()
// Half the effects slider's 80: birds, wind and water used to play at the battle's volume and
// covered the replies and the guns.
m_ambientVolume = 40;
+ m_masterVolume = 100;
+ m_dynamicMusic = TRUE;
m_3DSoundPref = false;
m_keyboardDefaultScrollFactor = m_keyboardScrollFactor = 0.5f;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
index 5338779fa..484f4ba8c 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
@@ -87,6 +87,14 @@ static void set_m_ambientVolume( Int value )
if (TheAudio)
TheAudio->setVolume( value / 100.0f, (AudioAffect)(AudioAffect_Ambient | AudioAffect_SystemSetting) );
}
+static Int get_m_masterVolume( void ) { return TheGlobalData->m_masterVolume; }
+static void set_m_masterVolume( Int value )
+{
+ TheWritableGlobalData->m_masterVolume = value;
+ if (TheAudio)
+ TheAudio->setVolume( value / 100.0f, (AudioAffect)(AudioAffect_Master | AudioAffect_SystemSetting) );
+}
+OPTION_BOOL_ACCESSORS( m_dynamicMusic )
// The catalog loads before there is a game; the menu's Accept during a mission changes its speed
// on the spot, which only the pacing reads.
static Int get_m_turboMode( void ) { return TheGlobalData->m_turboMode ? 1 : 0; }
@@ -326,6 +334,19 @@ const OptionDef TheOptionCatalog[] =
OPTION_INT, APPLY_LIVE, 0, 100,
get_m_ambientVolume, set_m_ambientVolume },
+ // One slider over the other four: music, effects, voices and ambience are each multiplied by it,
+ // a unit's reply with its boost included. Movies follow it through the voice volume.
+ { "MasterVolume", OPT_WND( "SliderMasterVolume" ), "GUI:MasterVolume",
+ OPTION_INT, APPLY_LIVE, 0, 100,
+ get_m_masterVolume, set_m_masterVolume },
+
+ // A skirmish or multiplayer match's music answers the fight: a calmer track of the side's own
+ // playlist while nothing happens, a harder one when guns fire near the camera or at your forces
+ // (MusicManager::update). Off leaves the music to the map's scripts, as retail had it.
+ { "DynamicMusic", OPT_WND( "CheckDynamicMusic" ), "GUI:DynamicMusic",
+ OPTION_BOOL, APPLY_LIVE, 0, 1,
+ get_m_dynamicMusic, set_m_dynamicMusic },
+
// With the move, attack move or guard key armed, a left drag over the ground spreads the
// selection along the line drawn instead of sending everyone to one point. On by default, and
// here for anyone who would rather that drag did nothing at all. On Options > Controls.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
index 777163210..cd176205b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
@@ -2199,6 +2199,7 @@ static const SliderReadout TheSliderReadouts[] =
{ "OptionsMenu.wnd:SliderSFXVolume", "OptionsMenu.wnd:ValueSFXVolume", READOUT_PERCENT },
{ "OptionsMenu.wnd:SliderVoiceVolume", "OptionsMenu.wnd:ValueVoiceVolume", READOUT_PERCENT },
{ "OptionsMenu.wnd:SliderAmbientVolume", "OptionsMenu.wnd:ValueAmbientVolume", READOUT_PERCENT },
+ { "OptionsMenu.wnd:SliderMasterVolume", "OptionsMenu.wnd:ValueMasterVolume", READOUT_PERCENT },
{ "OptionsMenu.wnd:SliderScrollSpeed", "OptionsMenu.wnd:ValueScrollSpeed", READOUT_NUMBER },
{ "OptionsMenu.wnd:SliderZoomSpeed", "OptionsMenu.wnd:ValueZoomSpeed", READOUT_PERCENT },
{ "OptionsMenu.wnd:SliderDragTolerance", "OptionsMenu.wnd:ValueDragTolerance", READOUT_NUMBER },
diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.py
index 7d4d4e6fc..f7d3c0ac3 100644
--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py
+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py
@@ -207,6 +207,9 @@ NEW_CONTROLS = [
(CHECK, "CheckChromaLighting", "GUI:ChromaLighting"),
(LABEL, "LabelAmbientVolume", "GUI:AmbientVolume"),
(SLIDER, "SliderAmbientVolume", None),
+ (LABEL, "LabelMasterVolume", "GUI:MasterVolume"),
+ (SLIDER, "SliderMasterVolume", None),
+ (CHECK, "CheckDynamicMusic", "GUI:DynamicMusic"),
(LABEL, "LabelZoomSpeed", "GUI:ZoomSpeed"),
(SLIDER, "SliderZoomSpeed", None),
(LABEL, "LabelShadowQuality", "GUI:ShadowQuality"),
@@ -246,6 +249,7 @@ READOUTS = [
"ValueGamma", "ValueTextureResolution", "ValueParticleCap", "ValueAnisotropy",
"ValueMusicVolume", "ValueSFXVolume", "ValueVoiceVolume", "ValueScrollSpeed",
"ValueDragTolerance", "ValueAmbientVolume", "ValueZoomSpeed", "ValueMenuTransitionSpeed",
+ "ValueMasterVolume",
]
# Lines of small grey text under a control that say what its current choice does, written by
@@ -270,7 +274,7 @@ NOTE_COLOR = ("ENABLED: 164 170 190 255, ENABLEDBORDER: 0 0 0 255, "
# catalog row's own bounds
SLIDER_RANGES = [("SliderAnisotropy", 0, 16), ("SliderDragTolerance", 2, 50),
("SliderAmbientVolume", 0, 100), ("SliderZoomSpeed", 25, 300),
- ("SliderMenuTransitionSpeed", 25, 400)]
+ ("SliderMenuTransitionSpeed", 25, 400), ("SliderMasterVolume", 0, 100)]
# EA's captions that do not fit the page: two popup headings written in capitals, and a check box
# caption that ran 20 pixels past the panel's right edge once it stood in a 268 pixel column.
@@ -372,10 +376,13 @@ GROUP_LAYOUT = [
("PageAudio", [
("GUI:OptionsGroupVolume", [
- setting("MusicVolumeLabel", "SliderMusicVolume", "ValueMusicVolume"),
+ setting("LabelMasterVolume", "SliderMasterVolume", "ValueMasterVolume"),
setting("SFXVolumeLabel", "SliderSFXVolume", "ValueSFXVolume"),
setting("VoiceVolumeLabel", "SliderVoiceVolume", "ValueVoiceVolume"),
- setting("LabelAmbientVolume", "SliderAmbientVolume", "ValueAmbientVolume")])]),
+ setting("LabelAmbientVolume", "SliderAmbientVolume", "ValueAmbientVolume")]),
+ ("GUI:OptionsGroupMusic", [
+ setting("MusicVolumeLabel", "SliderMusicVolume", "ValueMusicVolume"),
+ ("check", "CheckDynamicMusic")])]),
("PageControls", [
("GUI:OptionsGroupCamera", [