From aa86e62693983a573290de01dce3ac1ee44af456 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 31 Mar 2010 03:48:16 +0000 Subject: [PATCH] - Added DefaultEnvironment MAPINFO option to set the default sound environment for the whole map. SVN r2261 (trunk) --- src/g_level.cpp | 2 ++ src/g_level.h | 2 ++ src/g_mapinfo.cpp | 15 +++++++++++++++ src/p_setup.cpp | 9 ++++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 478a01491..1fd0130dc 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1319,6 +1319,8 @@ void G_InitLevelLocals () compatflags.Callback(); NormalLight.ChangeFade (level.fadeto); + + level.DefaultEnvironment = info->DefaultEnvironment; } //========================================================================== diff --git a/src/g_level.h b/src/g_level.h index 0e17b02b1..58ddf9d5c 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -279,6 +279,7 @@ struct level_info_t DWORD compatflags; DWORD compatmask; FString Translator; // for converting Doom-format linedef and sector types. + int DefaultEnvironment; // Default sound environment for the map. // Redirection: If any player is carrying the specified item, then // you go to the RedirectMap instead of this one. @@ -391,6 +392,7 @@ struct FLevelLocals fixed_t aircontrol; fixed_t airfriction; int airsupply; + int DefaultEnvironment; // Default sound environment. FSectorScrollValues *Scrolls; // NULL if no DScrollers in this level diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 09e8eb96a..6131c7017 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -265,6 +265,7 @@ void level_info_t::Reset() bordertexture[0] = 0; teamdamage = 0.f; specialactions.Clear(); + DefaultEnvironment = 0; } @@ -1250,6 +1251,20 @@ DEFINE_MAP_OPTION(mapbackground, true) parse.ParseLumpOrTextureName(info->mapbg); } +DEFINE_MAP_OPTION(defaultenvironment, false) +{ + int id; + + parse.ParseAssign(); + parse.sc.MustGetNumber(); + id = parse.sc.Number << 8; + if (parse.CheckNumber()) + { + id |= parse.sc.Number; + } + info->DefaultEnvironment = id; +} + //========================================================================== // diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 3f55dbe23..c27da8e56 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -729,6 +729,7 @@ void P_FloodZone (sector_t *sec, int zonenum) void P_FloodZones () { int z = 0, i; + ReverbContainer *reverb; for (i = 0; i < numsectors; ++i) { @@ -739,9 +740,15 @@ void P_FloodZones () } numzones = z; zones = new zone_t[z]; + reverb = S_FindEnvironment(level.DefaultEnvironment); + if (reverb == NULL) + { + Printf("Sound environment %d, %d not found\n", level.DefaultEnvironment >> 8, level.DefaultEnvironment & 255); + reverb = DefaultEnvironments[0]; + } for (i = 0; i < z; ++i) { - zones[i].Environment = DefaultEnvironments[0]; + zones[i].Environment = reverb; } }