From 40cefe6107c8dfeddf0f9084a2c0c8599298c326 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 28 Aug 2012 03:21:13 +0000 Subject: [PATCH] - Fixed: When r3837 moved SNDINFO parsing before MAPINFO parsing, it broke support for Hexen's $map SNDINFO command. Removed LEVEL2_MUSICDEFINED, since it's no longer needed by the new implementation for this command. SVN r3856 (trunk) --- src/g_level.h | 2 +- src/g_mapinfo.cpp | 13 ++++++++++--- src/s_advsound.cpp | 16 ++++++++-------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/g_level.h b/src/g_level.h index 488cb3eaf..105b07100 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -181,7 +181,7 @@ enum ELevelFlags LEVEL2_KEEPFULLINVENTORY = 0x00000040, // doesn't reduce the amount of inventory items to 1 - LEVEL2_MUSICDEFINED = 0x00000080, // a marker to disable the $map command in SNDINFO for this map + /* = 0x00000080, */ LEVEL2_MONSTERFALLINGDAMAGE = 0x00000100, LEVEL2_CLIPMIDTEX = 0x00000200, LEVEL2_WRAPMIDTEX = 0x00000400, diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 4614afd3d..7836c4377 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -61,6 +61,8 @@ static cluster_info_t TheDefaultClusterInfo; TArray AllEpisodes; +extern TMap HexenMusic; + //========================================================================== // // @@ -918,8 +920,6 @@ DEFINE_MAP_OPTION(music, true) { parse.ParseAssign(); parse.ParseMusic(info->Music, info->musicorder); - // Flag the level so that the $MAP command doesn't override this. - info->flags2 |= LEVEL2_MUSICDEFINED; } DEFINE_MAP_OPTION(intermusic, true) @@ -1538,6 +1538,14 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo) // to teleport to maps with standard names without needing a levelnum. levelinfo->levelnum = GetDefaultLevelNum(levelinfo->mapname); + // Does this map have a song defined via SNDINFO's $map command? + // Set that as this map's default music if it does. + FString *song; + if ((song = HexenMusic.CheckKey(levelinfo->levelnum)) != NULL) + { + levelinfo->Music = *song; + } + return levelinfo; } @@ -1832,7 +1840,6 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i } } - //========================================================================== // // diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index f5b268348..f4c343fac 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -220,6 +220,7 @@ extern int sfx_empty; // PUBLIC DATA DEFINITIONS ------------------------------------------------- TArray S_sfx (128); +TMap HexenMusic; // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -886,6 +887,7 @@ static void S_ClearSoundData() DefPlayerClassName = ""; MusicAliases.Clear(); MidiDevices.Clear(); + HexenMusic.Clear(); } //========================================================================== @@ -1084,16 +1086,14 @@ static void S_AddSNDINFO (int lump) case SI_Map: { // Hexen-style $MAP command - level_info_t *info; - char temp[16]; + int mapnum; - sc.MustGetNumber (); - mysnprintf (temp, countof(temp), "MAP%02d", sc.Number); - info = FindLevelInfo (temp); - sc.MustGetString (); - if (info->mapname[0] && (!(info->flags2 & LEVEL2_MUSICDEFINED))) + sc.MustGetNumber(); + mapnum = sc.Number; + sc.MustGetString(); + if (mapnum != 0) { - info->Music = sc.String; + HexenMusic[mapnum] = sc.String; } } break;