From 69c777df4c83279417d3bc2919f73b4d93347379 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 31 Mar 2010 23:33:18 +0000 Subject: [PATCH] - Allow defaultenvironment to take names as well as numeric IDs. SVN r2262 (trunk) --- src/d_main.cpp | 4 +++- src/g_mapinfo.cpp | 26 +++++++++++++++++++++----- src/s_sound.cpp | 1 - 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 4a3d631ca..61e76da0d 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2027,6 +2027,9 @@ void D_DoomMain (void) StartScreen->AppendStatusLine(temp); } + // [RH] Load sound environments + S_ParseReverbDef (); + // [RH] Parse through all loaded mapinfo lumps Printf ("G_ParseMapInfo: Load map definitions.\n"); G_ParseMapInfo (iwad_info->MapInfo); @@ -2035,7 +2038,6 @@ void D_DoomMain (void) Printf ("S_InitData: Load sound definitions.\n"); S_InitData (); - Printf ("Texman.Init: Init texture manager.\n"); TexMan.Init(); diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 6131c7017..f8c087459 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1256,11 +1256,27 @@ DEFINE_MAP_OPTION(defaultenvironment, false) int id; parse.ParseAssign(); - parse.sc.MustGetNumber(); - id = parse.sc.Number << 8; - if (parse.CheckNumber()) - { - id |= parse.sc.Number; + if (parse.sc.CheckNumber()) + { // Numeric ID XXX [, YYY] + id = parse.sc.Number << 8; + if (parse.CheckNumber()) + { + id |= parse.sc.Number; + } + } + else + { // Named environment + parse.sc.MustGetString(); + ReverbContainer *reverb = S_FindEnvironment(parse.sc.String); + if (reverb == NULL) + { + parse.sc.ScriptMessage("Unknown sound environment '%s'\n", parse.sc.String); + id = 0; + } + else + { + id = reverb->ID; + } } info->DefaultEnvironment = id; } diff --git a/src/s_sound.cpp b/src/s_sound.cpp index d65cbaf0b..f31f1c2da 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -323,7 +323,6 @@ void S_InitData () LastLocalSndInfo = LastLocalSndSeq = ""; S_ParseSndInfo (); S_ParseSndSeq (-1); - S_ParseReverbDef (); } //==========================================================================