From ba8dc788fe89578f6035b5df905c65810acf4ad1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 30 Aug 2020 21:45:21 +0200 Subject: [PATCH] - hotfixing some Exhumed map transition issues. This avoids crashing on LEV20, but the whole thing is simply too poorly implemented to actually work - this needs to be redone so that the map transition does not occur in the middle of the game ticker. --- source/exhumed/src/gameloop.cpp | 3 ++- source/exhumed/src/init.cpp | 2 +- source/exhumed/src/osdcmds.cpp | 9 +++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/exhumed/src/gameloop.cpp b/source/exhumed/src/gameloop.cpp index 3021838dc..339b8c1f1 100644 --- a/source/exhumed/src/gameloop.cpp +++ b/source/exhumed/src/gameloop.cpp @@ -117,7 +117,7 @@ static void GameDisplay(void) drawtime.Reset(); drawtime.Clock(); - if (currentLevel->levelNumber == kMap20) + if (currentLevel && currentLevel->levelNumber == kMap20) { DoEnergyTile(); DrawClock(); @@ -191,6 +191,7 @@ void CheckProgression() // start a new game on the given level currentLevel = nullptr; mylevelnew = GameAction; + currentLevel = FindMapByLevelNum(mylevelnew); GameAction = -1; InitNewGame(); if (mylevelnew > 0) STAT_StartNewGame("Exhumed", 1); diff --git a/source/exhumed/src/init.cpp b/source/exhumed/src/init.cpp index 0304d103d..2102d7e7e 100644 --- a/source/exhumed/src/init.cpp +++ b/source/exhumed/src/init.cpp @@ -77,7 +77,7 @@ uint8_t LoadLevel(int nMap) initspritelists(); - currentLevel = &mapList[nMap]; + currentLevel = FindMapByLevelNum(nMap); // init stuff { diff --git a/source/exhumed/src/osdcmds.cpp b/source/exhumed/src/osdcmds.cpp index df5469429..f528c6be0 100644 --- a/source/exhumed/src/osdcmds.cpp +++ b/source/exhumed/src/osdcmds.cpp @@ -79,13 +79,10 @@ static int osdcmd_map(CCmdFuncPtr parm) } // Check if the map is already defined. - for (int i = 0; i <= ISDEMOVER? 4 : 32; i++) + auto map = FindMapByName(mapname); + if (map) { - if (mapList[i].labelName.CompareNoCase(mapname) == 0) - { - GameAction = i; - return CCMD_OK; - } + GameAction = map->levelNumber; } return CCMD_OK; }