diff options
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/core.cpp | 7 | ||||
-rw-r--r-- | src/koopatlas/core.h | 1 | ||||
-rw-r--r-- | src/koopatlas/map.cpp | 3 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 110 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.h | 3 | ||||
-rw-r--r-- | src/koopatlas/player.cpp | 2 |
6 files changed, 106 insertions, 20 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index c86c696..810c25d 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -414,6 +414,13 @@ int dScKoopatlas_c::onCreate() { isAfter8Castle = true; } + isEndingScene = (settings & 0x20000000); + if (isEndingScene) { + currentMapID = 0; + save->current_world = 0; + save->current_path_node = 0; + } + somethingAboutSound(_8042A788); return true; diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index a48e96c..8fbbf5d 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -119,6 +119,7 @@ class dScKoopatlas_c : public dScene_c { bool isFirstPlay; bool isAfterKamekCutscene; bool isAfter8Castle; + bool isEndingScene; void startMusic(); bool warpZoneHacks; diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index e12767e..84c7c45 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -505,6 +505,9 @@ void dWMMap_c::renderPathLayer(dKPLayer_s *layer) { dKPNode_s *node = layer->nodes[i]; if (node->type == dKPNode_s::LEVEL) { + if (node->levelNumber[0] == 80) + continue; + short rz = 0x6000; short rx = 0x4000; short ry = 0x8000; 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; diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h index 27fcfd6..afd8103 100644 --- a/src/koopatlas/pathmanager.h +++ b/src/koopatlas/pathmanager.h @@ -81,6 +81,9 @@ class dWMPathManager_c { int waitAfterUnlock; int waitBeforePanBack; + bool savingForEnding; + bool waitingForEndingTransition; + private: void unlockPaths(); void finalisePathUnlocks(); diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index 1c68222..6bd4371 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -114,6 +114,8 @@ int daWMPlayer_c::onExecute() { int daWMPlayer_c::onDraw() { if (!visible) return true; + if (dScKoopatlas_c::instance->isEndingScene) + return true; this->modelHandler->draw(); hammerSuit.draw(); |