From cf9792ed531e08e4fa54a2e646556c351fc3dc94 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Sep 2010 06:53:40 +0000 Subject: [PATCH] - fixed: The order of items in the main menu was wrong. Doom is supposed to have 'Options' in second place. Many vanilla-compatible mods with special one-patch menus would not work correctly due to this. Fortunately the only mod I could find that relied on ZDoom's order was Action Doom 2, which as an IWAD can easily be handled by a simple configuration option. - added 'else' blocks to MENUDEF parser. SVN r2854 (trunk) --- src/d_iwad.cpp | 2 +- src/gi.cpp | 1 + src/gi.h | 1 + src/menu/menudef.cpp | 9 +++++++-- wadsrc/static/mapinfo/urbanbrawl.txt | 7 +++++++ wadsrc/static/menudef.txt | 15 ++++++++++++--- 6 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 wadsrc/static/mapinfo/urbanbrawl.txt diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index ae208e25a..119d85b74 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -80,7 +80,7 @@ const IWADInfo IWADInfos[NUM_IWAD_TYPES] = { "Blasphemer", "Blasphemer",MAKERGB(115,0,0), MAKERGB(0,0,0), GAME_Heretic, "mapinfo/heretic.txt" }, { "Chex(R) Quest", "Chex1", MAKERGB(255,255,0), MAKERGB(0,192,0), GAME_Chex, "mapinfo/chex.txt" }, { "Chex(R) Quest 3", "Chex3", MAKERGB(255,255,0), MAKERGB(0,192,0), GAME_Chex, "mapinfo/chex3.txt", GI_NOTEXTCOLOR }, - { "Action Doom 2: Urban Brawl", "UrbanBrawl",MAKERGB(168,168,0), MAKERGB(168,0,0), GAME_Doom, "mapinfo/doom2.txt", GI_MAPxx }, + { "Action Doom 2: Urban Brawl", "UrbanBrawl",MAKERGB(168,168,0), MAKERGB(168,0,0), GAME_Doom, "mapinfo/urbanbrawl.txt", GI_MAPxx }, { "Harmony", "Harmony", MAKERGB(110,180,230), MAKERGB(69,79,126), GAME_Doom, "mapinfo/doom2.txt", GI_MAPxx }, //{ "ZDoom Engine", NULL, MAKERGB(168,0,0), MAKERGB(168,168,168) }, }; diff --git a/src/gi.cpp b/src/gi.cpp index 712638ace..c8ca25b89 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -277,6 +277,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_STRING(CursorPic, "CursorPic") GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic") GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis") + GAMEINFOKEY_BOOL(swapmenu, "swapmenu") GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter") GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast") GAMEINFOKEY_COLOR(dimcolor, "dimcolor") diff --git a/src/gi.h b/src/gi.h index cb26a058d..40ddfb9ad 100644 --- a/src/gi.h +++ b/src/gi.h @@ -76,6 +76,7 @@ struct gameinfo_t bool noloopfinalemusic; bool intermissioncounter; bool nightmarefast; + bool swapmenu; TArray creditPages; TArray finalePages; TArray infoPages; diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 66145bff6..d30e35ee7 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -147,6 +147,7 @@ static bool CheckSkipOptionBlock(FScanner &sc) { sc.MustGetString(); if (sc.Compare("ReadThis")) filter |= gameinfo.drawreadthis; + else if (sc.Compare("Swapmenu")) filter |= gameinfo.swapmenu; else if (sc.Compare("Windows")) { #ifdef _WIN32 @@ -171,7 +172,7 @@ static bool CheckSkipOptionBlock(FScanner &sc) if (!filter) { SkipSubBlock(sc); - return true; + return !sc.CheckString("else"); } return false; } @@ -188,7 +189,11 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc) while (!sc.CheckString("}")) { sc.MustGetString(); - if (sc.Compare("ifgame")) + if (sc.Compare("else")) + { + SkipSubBlock(sc); + } + else if (sc.Compare("ifgame")) { if (!CheckSkipGameBlock(sc)) { diff --git a/wadsrc/static/mapinfo/urbanbrawl.txt b/wadsrc/static/mapinfo/urbanbrawl.txt new file mode 100644 index 000000000..094975bf5 --- /dev/null +++ b/wadsrc/static/mapinfo/urbanbrawl.txt @@ -0,0 +1,7 @@ +include "mapinfo/doom2.txt" + +gameinfo +{ + swapmenu = true +} + diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index edbeecb6a..c3f9ef144 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -69,9 +69,18 @@ LISTMENU "MainMenu" IfGame(Doom, Strife, Chex) { PatchItem "M_NGAME", "n", "PlayerclassMenu" - PatchItem "M_LOADG", "l", "LoadGameMenu" - PatchItem "M_SAVEG", "s", "SaveGameMenu" - PatchItem "M_OPTION","o", "OptionsMenu" + ifOption(SwapMenu) + { + PatchItem "M_LOADG", "l", "LoadGameMenu" + PatchItem "M_SAVEG", "s", "SaveGameMenu" + PatchItem "M_OPTION","o", "OptionsMenu" + } + else + { + PatchItem "M_OPTION","o", "OptionsMenu" + PatchItem "M_LOADG", "l", "LoadGameMenu" + PatchItem "M_SAVEG", "s", "SaveGameMenu" + } ifOption(ReadThis) { PatchItem "M_RDTHIS","r", "ReadThisMenu"