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(milesaudio): Ambient volume slider, ambience down to 40%

Olcay Seyganfecd3e715a5b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5dd71a93..4f543fc6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1711,6 +1711,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
- A game set to a language it has no files for starts in English. A player whose Windows still said German, with only the English game installed, saw it close as it started: the game went looking for German menus and fonts, found none and closed. It now notices before it loads any text and plays in English.
- 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.
- Birdsong no longer drowns out the battle. Every sound on the map played at full volume all the way out to the edge of its range, because the game handed the sound library its near and far distances the wrong way round. A sound that carries a long way, like the birds and the wind, came through at full strength from across the map, while a gun firing just off screen had already been cut. Sounds get quieter with distance now, at the same rate the game uses to decide when one is too faint to keep playing, so what is close to the camera is what you hear.
+- The world around the battle has its own volume. Birds, wind, waves, crickets and the murmur of a town, 148 looping background sounds in the game's data, played on the Sound FX slider at the same level as the guns, and on a forest or harbour map they covered the replies and the shots. They now answer to an Ambient slider on the Audio page, beside Music, Sound FX and Voice, and it starts at 40%, half of where Sound FX starts. Moving Sound FX leaves them alone. Unit engines, weapons, voices and explosions stay on Sound FX.
- 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.
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index b5112bc3e..d5f0c589c 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -881,6 +881,14 @@ TOOLTIP:DragTolerance
"How many pixels the mouse may move with a button held before a click becomes a drag. Raise it if selection boxes start by accident, lower it if drags read as clicks."
END
+GUI:AmbientVolume
+"Ambient Volume"
+END
+
+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:IsometricCamera
"Isometric Camera"
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 0d3d8527a..8b74c8cb4 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15369,6 +15369,14 @@ TOOLTIP:DragTolerance
"Bir tuş basılıyken fare kaç piksel oynarsa tıklamanın sürüklemeye döneceği. Seçim kutuları yanlışlıkla açılıyorsa yükseltin, sürüklemeler tıklama sayılıyorsa düşürün."
END
+GUI:AmbientVolume
+"Ortam Sesi"
+END
+
+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:IsometricCamera
"İzometrik Kamera"
END
diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd
index 264287b71..b9ce7310b 100644
--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd
@@ -6786,6 +6786,174 @@ 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: 34 350, BOTTOMRIGHT: 258 374, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:LabelAmbientVolume";
+ TOOLTIPTEXT = "TOOLTIP:AmbientVolume";
+ STATUS = ENABLED;
+ STYLE = STATICTEXT+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:AmbientVolume";
+ 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: 178 374, BOTTOMRIGHT: 258 398, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:ValueAmbientVolume";
+ 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: 40 374, BOTTOMRIGHT: 176 398, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:SliderAmbientVolume";
+ 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 = "TOOLTIP:AmbientVolume";
+ TOOLTIPDELAY = -1;
+ 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,
+ 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
ENDALLCHILDREN
END
CHILD
diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
index bc212c852..f0611c3e1 100644
--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
@@ -6739,6 +6739,174 @@ 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: 34 350, BOTTOMRIGHT: 258 374, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:LabelAmbientVolume";
+ TOOLTIPTEXT = "TOOLTIP:AmbientVolume";
+ STATUS = ENABLED;
+ STYLE = STATICTEXT+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:AmbientVolume";
+ 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: 178 374, BOTTOMRIGHT: 258 398, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:ValueAmbientVolume";
+ 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: 40 374, BOTTOMRIGHT: 176 398, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:SliderAmbientVolume";
+ 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 = "TOOLTIP:AmbientVolume";
+ TOOLTIPDELAY = -1;
+ 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,
+ 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
ENDALLCHILDREN
END
CHILD
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AudioAffect.h b/GeneralsMD/Code/GameEngine/Include/Common/AudioAffect.h
index 2306822a2..18fe4d232 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/AudioAffect.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/AudioAffect.h
@@ -39,7 +39,8 @@ enum AudioAffect : int
AudioAffect_Sound = 0x02,
AudioAffect_Sound3D = 0x04,
AudioAffect_Speech = 0x08,
- AudioAffect_All = (AudioAffect_Music | AudioAffect_Sound | AudioAffect_Sound3D | AudioAffect_Speech),
+ AudioAffect_Ambient = 0x20, ///< looping world ambience (AudioManager::isAmbientSound); system setting only
+ AudioAffect_All = (AudioAffect_Music | AudioAffect_Sound | AudioAffect_Sound3D | AudioAffect_Speech | AudioAffect_Ambient),
AudioAffect_SystemSetting = 0x10,
};
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h b/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
index d310047fd..38553fb82 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
@@ -303,6 +303,12 @@ class AudioManager : public SubsystemInterface
virtual const AudioEventInfoHash & getAllAudioEvents() const { return m_allAudioEventInfo; }
Real getZoomVolume() const { return m_zoomVolume; }
+
+ // Birds, wind, water, a town's murmur: a looping world sound effect at the lowest priority that
+ // is not hidden by the shroud. These answer to the Ambient slider instead of the effects one.
+ static Bool isAmbientSound( const AudioEventInfo *info );
+ // The Ambient slider with the script and zoom factors the effects slider would have carried.
+ Real getAmbientVolume( Bool positional ) const;
protected:
// Is the currently selected provider actually HW accelerated?
@@ -353,12 +359,13 @@ class AudioManager : public SubsystemInterface
Real m_systemSoundVolume;
Real m_systemSound3DVolume;
Real m_systemSpeechVolume;
+ Real m_systemAmbientVolume;
Real m_zoomVolume;
-
+
AudioEventRTS *m_silentAudioEvent;
-
- enum { NUM_VOLUME_TYPES = 4 };
+
+ enum { NUM_VOLUME_TYPES = 5 };
Real *m_savedValues;
// Group of 8
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index 24117ddad..db6cb77cc 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -523,6 +523,7 @@ public:
Real m_musicVolumeFactor; ///< Factor applied to loudness of music volume
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
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 939190c1f..41292df97 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
@@ -58,6 +58,7 @@
#include "Common/GameEngine.h"
#include "Common/GameMusic.h"
#include "Common/GameSounds.h"
+#include "Common/GlobalData.h"
#include "Common/MiscAudio.h"
#include "Common/OSDisplay.h"
#include "Common/Player.h"
@@ -172,6 +173,8 @@ AudioManager::AudioManager() :
m_systemSound3DVolume = 0.0f;
m_systemSoundVolume = 0.0f;
m_systemSpeechVolume = 0.0f;
+ m_systemAmbientVolume = 0.0f;
+ m_zoomVolume = 1.0f;
m_volumeHasChanged = FALSE;
//
@@ -263,6 +266,7 @@ void AudioManager::init()
m_systemSoundVolume = getAudioSettings() ? getAudioSettings()->m_preferredSoundVolume : 0.75f;
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_scriptMusicVolume = 1.0f;
m_scriptSoundVolume = 1.0f;
@@ -745,6 +749,12 @@ void AudioManager::setVolume( Real volume, AudioAffect whichToAffect )
m_speechVolume = m_scriptSpeechVolume * m_systemSpeechVolume;
}
+ // No script volume of its own: a script that turns the effects down turns ambience down with them,
+ // through the effects' script factor in getAmbientVolume.
+ if ((whichToAffect & AudioAffect_Ambient) && (whichToAffect & AudioAffect_SystemSetting)) {
+ m_systemAmbientVolume = volume;
+ }
+
m_volumeHasChanged = true;
}
@@ -757,15 +767,37 @@ Real AudioManager::getVolume( AudioAffect whichToGet )
return m_soundVolume;
} else if (whichToGet & AudioAffect_Sound3D) {
return m_sound3DVolume;
+ } else if (whichToGet & AudioAffect_Ambient) {
+ return m_systemAmbientVolume;
}
// Speech
return m_speechVolume;
}
+//-------------------------------------------------------------------------------------------------
+Bool AudioManager::isAmbientSound( const AudioEventInfo *info )
+{
+ return info != NULL
+ && info->m_soundType == AT_SoundEffect
+ && BitTest( info->m_type, ST_WORLD )
+ && !BitTest( info->m_type, ST_UI | ST_VOICE | ST_SHROUDED )
+ && BitTest( info->m_control, AC_LOOP )
+ && info->m_priority == AP_LOWEST;
+}
+
+//-------------------------------------------------------------------------------------------------
+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 ) );
+}
+
//-------------------------------------------------------------------------------------------------
void AudioManager::set3DVolumeAdjustment( Real volumeAdjustment )
{
+ m_zoomVolume = volumeAdjustment;
m_sound3DVolume = volumeAdjustment * m_scriptSound3DVolume * m_systemSound3DVolume;
// clamp
@@ -1211,6 +1243,7 @@ void AudioManager::loseFocus( void )
m_savedValues[1] = m_systemSoundVolume;
m_savedValues[2] = m_systemSound3DVolume;
m_savedValues[3] = m_systemSpeechVolume;
+ m_savedValues[4] = m_systemAmbientVolume;
// Now, set them all to 0.
setVolume(0.0f, (AudioAffect) (AudioAffect_All | AudioAffect_SystemSetting));
@@ -1228,6 +1261,7 @@ void AudioManager::regainFocus( void )
setVolume(m_savedValues[1], (AudioAffect) (AudioAffect_Sound | AudioAffect_SystemSetting));
setVolume(m_savedValues[2], (AudioAffect) (AudioAffect_Sound3D | AudioAffect_SystemSetting));
setVolume(m_savedValues[3], (AudioAffect) (AudioAffect_Speech | AudioAffect_SystemSetting));
+ setVolume(m_savedValues[4], (AudioAffect) (AudioAffect_Ambient | AudioAffect_SystemSetting));
// Now, blow away the old volumes.
delete [] m_savedValues;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 686abebc2..e994b6b53 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -1124,6 +1124,9 @@ GlobalData::GlobalData()
m_musicVolumeFactor = 0.5f;
m_SFXVolumeFactor = 0.5f;
m_voiceVolumeFactor = 0.5f;
+ // 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_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 ee29c1118..5f0a40751 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
@@ -24,6 +24,8 @@
#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine
#include "Common/OptionsCatalog.h"
+#include "Common/AudioAffect.h"
+#include "Common/GameAudio.h"
#include "Common/GlobalData.h"
#include "Common/UserPreferences.h"
#include "GameClient/Mouse.h"
@@ -76,6 +78,15 @@ static void set_m_dragTolerance( Int value )
if (TheMouse)
TheMouse->m_dragTolerance = (UnsignedInt)value;
}
+// The catalog loads before there is an audio manager, which takes the value from GlobalData in its
+// init; the menu's Accept pushes it in from here.
+static Int get_m_ambientVolume( void ) { return TheGlobalData->m_ambientVolume; }
+static void set_m_ambientVolume( Int value )
+{
+ TheWritableGlobalData->m_ambientVolume = value;
+ if (TheAudio)
+ TheAudio->setVolume( value / 100.0f, (AudioAffect)(AudioAffect_Ambient | AudioAffect_SystemSetting) );
+}
OPTION_BOOL_ACCESSORS( m_formationDrag )
OPTION_BOOL_ACCESSORS( m_showAllyCursors )
OPTION_BOOL_ACCESSORS( m_chromaLighting )
@@ -305,6 +316,12 @@ const OptionDef TheOptionCatalog[] =
OPTION_INT, APPLY_LIVE, 2, 50,
get_m_dragTolerance, set_m_dragTolerance },
+ // Looping world ambience - birds, wind, water, a town - on a slider of its own beside Sound FX,
+ // which no longer reaches it. AudioManager::isAmbientSound says what counts. On Options > Audio.
+ { "AmbientVolume", OPT_WND( "SliderAmbientVolume" ), "GUI:AmbientVolume",
+ OPTION_INT, APPLY_LIVE, 0, 100,
+ get_m_ambientVolume, set_m_ambientVolume },
+
// 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.
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 df7718439..527bd809b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
@@ -2039,6 +2039,7 @@ static const SliderReadout TheSliderReadouts[] =
{ "OptionsMenu.wnd:SliderMusicVolume", "OptionsMenu.wnd:ValueMusicVolume", READOUT_PERCENT },
{ "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:SliderScrollSpeed", "OptionsMenu.wnd:ValueScrollSpeed", READOUT_NUMBER },
{ "OptionsMenu.wnd:SliderDragTolerance", "OptionsMenu.wnd:ValueDragTolerance", READOUT_NUMBER },
};
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
index dae84a94b..60096cf4f 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
@@ -2291,6 +2291,11 @@ Real MilesAudioManager::getVoiceMixedVolume( const AudioEventRTS *event, Real sl
return min( 1.0f, eventVolume * max( sliderVolume, m_speechVolume ) * VOICE_BOOST );
}
+ // Ambience answers to its own slider, whichever effects slider the caller passed.
+ if (isAmbientSound( info )) {
+ return eventVolume * getAmbientVolume( event->isPositionalAudio() );
+ }
+
return eventVolume * sliderVolume;
}
@@ -2624,7 +2629,9 @@ void MilesAudioManager::processPlayingList( void )
else
{
Real volForConsideration = getEffectiveVolume(playing->m_audioEventRTS);
- volForConsideration /= (m_sound3DVolume > 0.0f ? m_sound3DVolume : 1.0f);
+ // the slider is taken back out: a sound is culled by distance, not by how far a slider is down
+ const Real slider = isAmbientSound( playing->m_audioEventRTS->getAudioEventInfo() ) ? getAmbientVolume( TRUE ) : m_sound3DVolume;
+ volForConsideration /= (slider > 0.0f ? slider : 1.0f);
Bool playAnyways = BitTest( playing->m_audioEventRTS->getAudioEventInfo()->m_type, ST_GLOBAL) || playing->m_audioEventRTS->getAudioEventInfo()->m_priority == AP_CRITICAL;
if( volForConsideration < m_audioSettings->m_minVolume && !playAnyways )
{
@@ -2980,9 +2987,10 @@ Real MilesAudioManager::getEffectiveVolume(AudioEventRTS *event) const
}
else
{
- if (event->isPositionalAudio())
+ const Bool ambient = isAmbientSound( event->getAudioEventInfo() );
+ if (event->isPositionalAudio())
{
- volume *= m_sound3DVolume;
+ volume *= ambient ? getAmbientVolume( TRUE ) : m_sound3DVolume;
Coord3D distance = m_listenerPosition;
const Coord3D *pos = event->getCurrentPosition();
if (pos)
@@ -3015,9 +3023,9 @@ Real MilesAudioManager::getEffectiveVolume(AudioEventRTS *event) const
TheAudio->getAudioSettings()->m_rangeVolumeFade );
}
}
- else
+ else
{
- volume *= m_soundVolume;
+ volume *= ambient ? getAmbientVolume( FALSE ) : m_soundVolume;
}
}
diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.py
index 66ef029a9..8b7c773a1 100644
--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py
+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py
@@ -183,6 +183,8 @@ NEW_CONTROLS = [
(COMBO, "ComboBoxSmoke", None),
(CHECK, "CheckParticleBounce", "GUI:ParticleBounce"),
(CHECK, "CheckChromaLighting", "GUI:ChromaLighting"),
+ (LABEL, "LabelAmbientVolume", "GUI:AmbientVolume"),
+ (SLIDER, "SliderAmbientVolume", None),
]
# A slider on its own says nothing about where it stands, so each one has a readout beside it that
@@ -190,7 +192,7 @@ NEW_CONTROLS = [
READOUTS = [
"ValueGamma", "ValueTextureResolution", "ValueParticleCap", "ValueAnisotropy",
"ValueMusicVolume", "ValueSFXVolume", "ValueVoiceVolume", "ValueScrollSpeed",
- "ValueDragTolerance",
+ "ValueDragTolerance", "ValueAmbientVolume",
]
# Lines of small grey text under a control that say what its current choice does, written by
@@ -206,7 +208,8 @@ NOTE_COLOR = ("ENABLED: 192 192 192 255, ENABLEDBORDER: 0 0 0 255, "
# a cloned slider keeps its template's range unless it is given one; selfcheck holds these to the
# catalog row's own bounds
-SLIDER_RANGES = [("SliderAnisotropy", 0, 16), ("SliderDragTolerance", 2, 50)]
+SLIDER_RANGES = [("SliderAnisotropy", 0, 16), ("SliderDragTolerance", 2, 50),
+ ("SliderAmbientVolume", 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.
@@ -298,7 +301,8 @@ GROUP_LAYOUT = [
("GUI:OptionsGroupVolume", [
setting("MusicVolumeLabel", "SliderMusicVolume", "ValueMusicVolume"),
setting("SFXVolumeLabel", "SliderSFXVolume", "ValueSFXVolume"),
- setting("VoiceVolumeLabel", "SliderVoiceVolume", "ValueVoiceVolume")])]),
+ setting("VoiceVolumeLabel", "SliderVoiceVolume", "ValueVoiceVolume"),
+ setting("LabelAmbientVolume", "SliderAmbientVolume", "ValueAmbientVolume")])]),
("PageControls", [
("GUI:OptionsGroupCamera", [