From dbd179be5ca18e0cd66ca18ebe551926696f7c4b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 May 2021 10:55:22 +0200 Subject: [PATCH] - RR progression fixes. * E1L7 abuses an 'end the game' command to progress to E2L1, this needs special treatment. * handle ENDGAME.MAP more cleanly by injecting an 'engine.con' into the compilation chain to define its map record. The main issue with this is that it needs to be defined before the regular CONs run. * check the already defined 'clearinventory' and 'clearweapons' flags that are exposed through RMAPINFO (Duke/RR only so far.) --- source/core/mapinfo.h | 1 + source/games/duke/src/gamedef.cpp | 32 ++++++------------- source/games/duke/src/premap.cpp | 7 ++-- .../filter/redneck.redneck/engine/engine.con | 1 + 4 files changed, 15 insertions(+), 26 deletions(-) create mode 100644 wadsrc/static/filter/redneck.redneck/engine/engine.con diff --git a/source/core/mapinfo.h b/source/core/mapinfo.h index 765354d19..64cf1ae0b 100644 --- a/source/core/mapinfo.h +++ b/source/core/mapinfo.h @@ -29,6 +29,7 @@ enum EMapFlags LEVEL_SECRETEXITOVERRIDE = 2, // when given an explicit level number, override with secret exit in the map, mainly for compiling episodes out of single levels. LEVEL_CLEARINVENTORY = 4, LEVEL_CLEARWEAPONS = 8, + LEVEL_FORCENOEOG = 16, // RR E1L7 needs this to override its boss's death ending the game. }; enum EMapGameFlags diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 962148442..9d018b8fb 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -3239,8 +3239,15 @@ void FixMapinfo() { if (isRR() && map->cluster == 1) { - auto nextmap = FindMapByIndexOnly(map->cluster + 1, 1); - if (nextmap) map->NextMap = nextmap->labelName; + if (!FindMapByIndexOnly(map->cluster, map->mapindex + 1)) + { + auto nextmap = FindMapByIndexOnly(map->cluster + 1, 1); + if (nextmap) + { + map->NextMap = nextmap->labelName; + map->flags |= LEVEL_FORCENOEOG; + } + } } } @@ -3256,27 +3263,6 @@ void FixMapinfo() if (maprec) maprec->NextMap = "e1l5"; } } - else if (isRR()) - { - if (!isRRRA()) - { - // RR does not define its final level and crudely hacked it into the progression. This puts it into the E2L8 slot so that the game can naturally progress there. - auto maprec1 = FindMapByLevelNum(makelevelnum(1, 6)); // E2L7 must exist - auto maprec2 = FindMapByLevelNum(makelevelnum(1, 7)); // E2L8 must not exist - auto maprec3 = FindMapByName("endgame"); // endgame must not have a map record already - int num3 = fileSystem.FindFile("endgame.map"); // endgame.map must exist. - if (maprec1 && !maprec2 && !maprec3 && num3 >= 0) - { - auto maprec = AllocateMap(); - maprec->designerTime = 0; - maprec->parTime = 0; - maprec->SetFileName("endgame.map"); - maprec->SetName("$TXT_CLOSEENCOUNTERS"); - maprec->levelNumber = makelevelnum(1, 7); - maprec->cluster = 2; - } - } - } } END_DUKE_NS diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index b1fd228e9..698b9351e 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -911,7 +911,7 @@ void enterlevel(MapRecord *mi, int gamemode) for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - bool clearweapon = false; + bool clearweapon = !!(currentLevel->flags & LEVEL_CLEARWEAPONS); int pn = sector[ps[i].GetActor()->s->sectnum].floorpicnum; if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA) { @@ -928,6 +928,7 @@ void enterlevel(MapRecord *mi, int gamemode) ps[i].kickback_pic = 0; ps[i].okickback_pic = ps[i].kickback_pic = 0; } + if (currentLevel->flags & LEVEL_CLEARINVENTORY) resetinventory(i); } resetmys(); @@ -992,10 +993,10 @@ void GameInterface::NewGame(MapRecord* map, int skill, bool) bool setnextmap(bool checksecretexit) { - MapRecord* map = nullptr;; + MapRecord* map = nullptr; MapRecord* from_bonus = nullptr; - if (ud.eog) + if (ud.eog && !(currentLevel->flags & LEVEL_FORCENOEOG)) { } else if (checksecretexit && ud.from_bonus == 0) diff --git a/wadsrc/static/filter/redneck.redneck/engine/engine.con b/wadsrc/static/filter/redneck.redneck/engine/engine.con new file mode 100644 index 000000000..1910065e9 --- /dev/null +++ b/wadsrc/static/filter/redneck.redneck/engine/engine.con @@ -0,0 +1 @@ +definelevelname 1 7 endgame.map 02:00 02:00 $TXT_CLOSEENCOUNTERS