From 1813612ed36ee857ce9a5f324c1a9a748ffa00cd Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 30 Apr 2013 21:07:29 +0200 Subject: fix bugs involving the After Fortress Mode in KP --- src/koopatlas/pathmanager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/koopatlas/pathmanager.cpp') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 9741c4b..dd08a3a 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -20,7 +20,7 @@ bool CanFinishEverything = false; void ResetAllCompletionCandidates() { // This is called by File Select, btw MaybeFinishingLevel[0] = 0xFF; - LastLevelPlayed[0] = 0xFF; + LastLevelPlayed[0] |= 0x80; CanFinishCoins = false; CanFinishExits = false; CanFinishWorld = false; @@ -40,6 +40,8 @@ void dWMPathManager_c::setup() { currentPath = 0; reverseThroughPath = false; + shouldRequestSave = ((wm->settings & 0x80000) != 0); + pathLayer = wm->mapData.pathLayer; SpammyReport("setting up PathManager\n"); @@ -57,7 +59,7 @@ void dWMPathManager_c::setup() { mustPlayAfterDeathAnim = true; daWMPlayer_c::instance->visible = false; LastPowerupStoreType = BEAT_LEVEL; - } else if (LastPowerupStoreType == BEAT_LEVEL && LastLevelPlayed[0] != 0xFF) { + } else if (LastPowerupStoreType == BEAT_LEVEL && LastLevelPlayed[0] < 0x80) { mustPlayAfterWinAnim = true; daWMPlayer_c::instance->visible = false; } @@ -195,7 +197,7 @@ void dWMPathManager_c::setup() { } // have we got any completions? - if (LastLevelPlayed[0] != 0xFF) { + if (LastLevelPlayed[0] < 0x80) { u32 conds = save->GetLevelCondition(LastLevelPlayed[0], LastLevelPlayed[1]); dLevelInfo_c::entry_s *whatEntry = dLevelInfo_c::s_info.searchBySlot(LastLevelPlayed[0], LastLevelPlayed[1]); @@ -926,7 +928,7 @@ void dWMPathManager_c::execute() { {10, 25, 1}, // SC right }; - int w = LastLevelPlayed[0] + 1; + int w = (LastLevelPlayed[0] & 0x7F) + 1; int l = LastLevelPlayed[1] + 1; for (int i = 0; i < 11; i++) { @@ -943,6 +945,7 @@ void dWMPathManager_c::execute() { moveThroughPath(-1); else afterFortressMode = false; + return; } if (shouldRequestSave) { @@ -1417,7 +1420,8 @@ void dWMPathManager_c::moveThroughPath(int pressedDir) { dScKoopatlas_c::instance->keepMusicPlaying = true; ActivateWipe(to->transition); - DoSceneChange(WORLD_MAP, 0x10000000 | (to->foreignID << 20), 0); + u32 saveFlag = (shouldRequestSave ? 0x80000 : 0); + DoSceneChange(WORLD_MAP, 0x10000000 | (to->foreignID << 20) | saveFlag, 0); } else if (reallyStop) { // Stop here -- cgit v1.2.3