- Added DefaultEnvironment MAPINFO option to set the default sound environment for the whole map.

SVN r2261 (trunk)
This commit is contained in:
Randy Heit 2010-03-31 03:48:16 +00:00
parent ba29ffd405
commit aa86e62693
4 changed files with 27 additions and 1 deletions

View file

@ -1319,6 +1319,8 @@ void G_InitLevelLocals ()
compatflags.Callback(); compatflags.Callback();
NormalLight.ChangeFade (level.fadeto); NormalLight.ChangeFade (level.fadeto);
level.DefaultEnvironment = info->DefaultEnvironment;
} }
//========================================================================== //==========================================================================

View file

@ -279,6 +279,7 @@ struct level_info_t
DWORD compatflags; DWORD compatflags;
DWORD compatmask; DWORD compatmask;
FString Translator; // for converting Doom-format linedef and sector types. 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 // Redirection: If any player is carrying the specified item, then
// you go to the RedirectMap instead of this one. // you go to the RedirectMap instead of this one.
@ -391,6 +392,7 @@ struct FLevelLocals
fixed_t aircontrol; fixed_t aircontrol;
fixed_t airfriction; fixed_t airfriction;
int airsupply; int airsupply;
int DefaultEnvironment; // Default sound environment.
FSectorScrollValues *Scrolls; // NULL if no DScrollers in this level FSectorScrollValues *Scrolls; // NULL if no DScrollers in this level

View file

@ -265,6 +265,7 @@ void level_info_t::Reset()
bordertexture[0] = 0; bordertexture[0] = 0;
teamdamage = 0.f; teamdamage = 0.f;
specialactions.Clear(); specialactions.Clear();
DefaultEnvironment = 0;
} }
@ -1250,6 +1251,20 @@ DEFINE_MAP_OPTION(mapbackground, true)
parse.ParseLumpOrTextureName(info->mapbg); 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;
}
//========================================================================== //==========================================================================
// //

View file

@ -729,6 +729,7 @@ void P_FloodZone (sector_t *sec, int zonenum)
void P_FloodZones () void P_FloodZones ()
{ {
int z = 0, i; int z = 0, i;
ReverbContainer *reverb;
for (i = 0; i < numsectors; ++i) for (i = 0; i < numsectors; ++i)
{ {
@ -739,9 +740,15 @@ void P_FloodZones ()
} }
numzones = z; numzones = z;
zones = new zone_t[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) for (i = 0; i < z; ++i)
{ {
zones[i].Environment = DefaultEnvironments[0]; zones[i].Environment = reverb;
} }
} }