diff options
Diffstat (limited to 'src/koopatlas/pathmanager.cpp')
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 110 |
1 files changed, 90 insertions, 20 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index b555b41..162084d 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -154,25 +154,28 @@ void dWMPathManager_c::setup() { SpammyReport("OK %p\n", currentNode); } + int findW = -1, findL = -1; + bool storeIt = true; + if (wm->isAfterKamekCutscene) { - // look for the 8-1 node - for (int i = 0; i < pathLayer->nodeCount; i++) { - dKPNode_s *node = pathLayer->nodes[i]; - if (node->type == dKPNode_s::LEVEL && node->levelNumber[0] == 8 && node->levelNumber[1] == 1) { - currentNode = node; - save->current_path_node = i; - break; - } - } + findW = 8; + findL = 1; + } else if (wm->isAfter8Castle) { + findW = 8; + findL = 5; + } else if (wm->isEndingScene) { + findW = 80; + findL = 80; + storeIt = false; } - - if (wm->isAfter8Castle) { - // warp to 8-L + if (findW > -1) { + // look for the 8-1 node for (int i = 0; i < pathLayer->nodeCount; i++) { dKPNode_s *node = pathLayer->nodes[i]; - if (node->type == dKPNode_s::LEVEL && node->levelNumber[0] == 8 && node->levelNumber[1] == 5) { + if (node->type == dKPNode_s::LEVEL && node->levelNumber[0] == findW && node->levelNumber[1] == findL) { currentNode = node; - save->current_path_node = i; + if (storeIt) + save->current_path_node = i; break; } } @@ -261,7 +264,7 @@ void dWMPathManager_c::setup() { ResetAllCompletionCandidates(); - if (wm->isAfterKamekCutscene) + if (wm->isAfterKamekCutscene || wm->isEndingScene) copyWorldDefToSave(wm->mapData.findWorldDef(1)); finalisePathUnlocks(); @@ -507,7 +510,7 @@ void dWMPathManager_c::unlockPaths() { dScKoopatlas_c *wm = dScKoopatlas_c::instance; bool forceFlag = (wm->isAfter8Castle || wm->isAfterKamekCutscene); - if (oldPathAvData || forceFlag) { + if (!wm->isEndingScene && (oldPathAvData || forceFlag)) { for (int i = 0; i < pathLayer->pathCount; i++) { if ((PathAvailabilityData[i] > 0) && (forceFlag || oldPathAvData[i] == 0)) { if (forceFlag && PathAvailabilityData[i] == dKPPath_s::ALWAYS_AVAILABLE) @@ -530,10 +533,55 @@ void dWMPathManager_c::unlockPaths() { newlyAvailableNodes++; } } + } + + if (oldPathAvData) { + delete[] oldPathAvData; + delete[] oldNodeAvData; + } + + if (wm->isEndingScene) { + dKPNode_s *yoshiHouse = 0; + for (int i = 0; i < pathLayer->nodeCount; i++) { + dKPNode_s *node = pathLayer->nodes[i]; + + if (node->type != dKPNode_s::LEVEL) + continue; + if (node->levelNumber[0] != 1) + continue; + if (node->levelNumber[1] != 41) + continue; + + yoshiHouse = node; + break; + } - if (oldPathAvData) { - delete[] oldPathAvData; - delete[] oldNodeAvData; + if (yoshiHouse) { + dKPNode_s *currentNode = yoshiHouse; + dKPPath_s *nextPath = yoshiHouse->rightExit; + + while (true) { + if (nextPath->isAvailable == dKPPath_s::AVAILABLE) { + nextPath->isAvailable = dKPPath_s::NEWLY_AVAILABLE; + newlyAvailablePaths++; + nextPath->setLayerAlpha(0); + } + + dKPNode_s *nextNode = nextPath->getOtherNodeTo(currentNode); + if (!nextNode) + break; + + if (nextNode->isUnlocked()) { + nextNode->isNew = true; + newlyAvailableNodes++; + } + + currentNode = nextNode; + nextPath = nextNode->getOppositeExitTo(nextPath); + + if (!nextPath) + break; + } } } @@ -636,7 +684,8 @@ bool dWMPathManager_c::doingThings() { (waitAtStart > 0) || (waitAfterInitialPlayerAnim > 0) || panningCameraToPaths || panningCameraFromPaths || (waitBeforePanBack > 0) || !initialLoading || - (countdownToFadeIn > 0) || (unlockingAlpha != -1)) + (countdownToFadeIn > 0) || (unlockingAlpha != -1) || + dScKoopatlas_c::instance->isEndingScene) return true; if (isMoving) @@ -827,6 +876,27 @@ void dWMPathManager_c::execute() { return; } + if (dScKoopatlas_c::instance->isEndingScene) { + // WE GO NO FURTHER + if (!waitingForEndingTransition) { + if (!savingForEnding) { + savingForEnding = true; + + SaveBlock *save = GetSaveFile()->GetBlock(-1); + save->titleScreenWorld = 3; + save->titleScreenLevel = 9; + + SaveGame(0, false); + } else { + if (!GetSaveFile()->CheckIfWriting()) { + StartTitleScreenStage(false, 0); + waitingForEndingTransition = true; + } + } + } + return; + } + if (shouldRequestSave) { dScKoopatlas_c::instance->showSaveWindow(); shouldRequestSave = false; |