From 2ba72be9e2973ebd68543087a473aa3f10bdb9bb Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 3 Mar 2013 02:54:37 +0100 Subject: fix a couple of bugs with the path unlocking and congratulations messages --- src/koopatlas/pathmanager.cpp | 105 ++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 48590f9..d55ad12 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -174,66 +174,68 @@ void dWMPathManager_c::setup() { } // have we got any completions? - u32 conds = save->GetLevelCondition(LastLevelPlayed[0], LastLevelPlayed[1]); - dLevelInfo_c::entry_s *whatEntry = - dLevelInfo_c::s_info.searchBySlot(LastLevelPlayed[0], LastLevelPlayed[1]); - - // how many exits? - int exits = 0, maxExits = 0; - if (whatEntry->flags & 0x10) { - maxExits++; - if (conds & COND_NORMAL) - exits++; - } - if (whatEntry->flags & 0x20) { - maxExits++; - if (conds & COND_SECRET) - exits++; - } + if (LastLevelPlayed[0] != 0xFF) { + u32 conds = save->GetLevelCondition(LastLevelPlayed[0], LastLevelPlayed[1]); + dLevelInfo_c::entry_s *whatEntry = + dLevelInfo_c::s_info.searchBySlot(LastLevelPlayed[0], LastLevelPlayed[1]); + + // how many exits? + int exits = 0, maxExits = 0; + if (whatEntry->flags & 0x10) { + maxExits++; + if (conds & COND_NORMAL) + exits++; + } + if (whatEntry->flags & 0x20) { + maxExits++; + if (conds & COND_SECRET) + exits++; + } - completionMessageWorldNum = whatEntry->displayWorld; + completionMessageWorldNum = whatEntry->displayWorld; - // now do all the message checks - int flag = 0, totalFlag = 0; - if (CanFinishCoins) { - totalFlag |= 1; - if ((conds & COND_COIN_ALL) == COND_COIN_ALL) { - flag |= 1; - completionMessageType = CMP_MSG_COINS; + // now do all the message checks + int flag = 0, totalFlag = 0; + if (CanFinishCoins) { + totalFlag |= 1; + if ((conds & COND_COIN_ALL) == COND_COIN_ALL) { + flag |= 1; + completionMessageType = CMP_MSG_COINS; + } } - } - if (CanFinishExits) { - totalFlag |= 2; - if (exits == maxExits) { - flag |= 2; - completionMessageType = CMP_MSG_EXITS; + if (CanFinishExits) { + totalFlag |= 2; + if (exits == maxExits) { + flag |= 2; + completionMessageType = CMP_MSG_EXITS; + } } - } - if (CanFinishWorld && flag == totalFlag) - completionMessageType = CMP_MSG_WORLD; + if (CanFinishWorld && flag == totalFlag) + completionMessageType = CMP_MSG_WORLD; - if (CanFinishAlmostAllCoins) { - if ((conds & COND_COIN_ALL) == COND_COIN_ALL) - completionMessageType = CMP_MSG_GLOBAL_COINS_EXC_W9; - } + if (CanFinishAlmostAllCoins) { + if ((conds & COND_COIN_ALL) == COND_COIN_ALL) + completionMessageType = CMP_MSG_GLOBAL_COINS_EXC_W9; + } - int gFlag = 0, gTotalFlag = 0; - if (CanFinishAllCoins) { - gTotalFlag |= 1; - if ((conds & COND_COIN_ALL) == COND_COIN_ALL) { - gFlag |= 1; - completionMessageType = CMP_MSG_GLOBAL_COINS; + int gFlag = 0, gTotalFlag = 0; + if (CanFinishAllCoins) { + gTotalFlag |= 1; + if ((conds & COND_COIN_ALL) == COND_COIN_ALL) { + gFlag |= 1; + completionMessageType = CMP_MSG_GLOBAL_COINS; + } } - } - if (CanFinishAllExits) { - gTotalFlag |= 2; - if (exits == maxExits) { - gFlag |= 2; - completionMessageType = CMP_MSG_GLOBAL_EXITS; + if (CanFinishAllExits) { + gTotalFlag |= 2; + if (exits == maxExits) { + gFlag |= 2; + completionMessageType = CMP_MSG_GLOBAL_EXITS; + } } + if (CanFinishEverything && gFlag == gTotalFlag) + completionMessageType = CMP_MSG_EVERYTHING; } - if (CanFinishEverything && gFlag == gTotalFlag) - completionMessageType = CMP_MSG_EVERYTHING; ResetAllCompletionCandidates(); @@ -738,6 +740,7 @@ void dWMPathManager_c::execute() { STD_ZOOM); panningCameraFromPaths = true; } + return; } if (panningCameraFromPaths) { -- cgit v1.2.3