diff options
-rw-r--r-- | cutScene.yaml | 7 | ||||
-rw-r--r-- | kamek_pal.x | 1 | ||||
-rw-r--r-- | src/cutScene.cpp | 21 | ||||
-rw-r--r-- | src/koopatlas/core.cpp | 8 | ||||
-rw-r--r-- | src/koopatlas/core.h | 1 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 14 | ||||
-rw-r--r-- | src/randomcrap.S | 6 | ||||
-rw-r--r-- | src/sceneGlue.cpp | 22 |
8 files changed, 73 insertions, 7 deletions
diff --git a/cutScene.yaml b/cutScene.yaml index e900d15..a5b0484 100644 --- a/cutScene.yaml +++ b/cutScene.yaml @@ -1,5 +1,5 @@ --- -source_files: [../src/cutScene.cpp] +source_files: [../src/cutScene.cpp, ../src/sceneGlue.cpp] hooks: - name: BuildCutScene type: add_func_pointer @@ -11,4 +11,9 @@ hooks: addr_pal: 0x80124DDC data: '28001234' + - name: WrapExitStage + type: branch_insn + src_addr_pal: 0x80102370 + branch_type: b + target_func: 'ExitStageWrapper' diff --git a/kamek_pal.x b/kamek_pal.x index 15661d4..7e96206 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -273,6 +273,7 @@ SECTIONS { instance2__17SoundPlayingClass = 0x8042A040; ExitStage__Fiiii = 0x80102370; + ExitStageRealRest = 0x80102374; LastPowerupStoreType = 0x8042931C; diff --git a/src/cutScene.cpp b/src/cutScene.cpp index c872dd7..6cb1e3b 100644 --- a/src/cutScene.cpp +++ b/src/cutScene.cpp @@ -94,13 +94,26 @@ int dScCutScene_c::onExecute() { // we're TOTALLY done! OSReport("playback complete\n"); int nsmbwMovieType = settings & 3; - switch (nsmbwMovieType) { + int newerMovieType = settings >> 28; + + switch (newerMovieType) { case 0: - SaveGame(0, false); - DoSceneChange(WORLD_MAP, 0x80000000, 0); + // OPENING + switch (nsmbwMovieType) { + case 0: + SaveGame(0, false); + DoSceneChange(WORLD_MAP, 0x80000000, 0); + break; + case 1: + StartTitleScreenStage(false, 0); + break; + } break; + case 1: - StartTitleScreenStage(false, 0); + // KAMEK (W7 => W8) + ActivateWipe(WIPE_MARIO); + DoSceneChange(WORLD_MAP, 0x40000000, 0); break; } } else { diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index 98c329d..9a24f82 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -405,9 +405,15 @@ int dScKoopatlas_c::onCreate() { // Prepare this first SaveBlock *save = GetSaveFile()->GetBlock(-1); currentMapID = save->current_world; - isFirstPlay = (currentMapID == 0) && (settings & 0x80000000); + // Are we coming from Kamek cutscene? If so, then do.. some stuff! + isAfterKamekCutscene = (settings & 0x40000000); + if (isAfterKamekCutscene) { + currentMapID = 6; // KoopaPlanet + save->current_world = 6; + } + somethingAboutSound(_8042A788); return true; diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index a55624d..ce72d64 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -113,6 +113,7 @@ class dScKoopatlas_c : public dScene_c { dDvdLoader_c mapListLoader; bool isFirstPlay; + bool isAfterKamekCutscene; void startMusic(); bool warpZoneHacks; diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 0ef89fc..dd291cb 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -7,7 +7,7 @@ extern "C" void PlaySoundWithFunctionB4(void *spc, nw4r::snd::SoundHandle *handle, int id, int unk); -static u8 MaybeFinishingLevel[2] = {0xFF,0xFF}; +u8 MaybeFinishingLevel[2] = {0xFF,0xFF}; void dWMPathManager_c::setup() { dScKoopatlas_c *wm = dScKoopatlas_c::instance; @@ -127,6 +127,18 @@ void dWMPathManager_c::setup() { currentNode = pathLayer->nodes[save->current_path_node]; SpammyReport("OK %p\n", currentNode); } + + 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; + } + } + } } for (int i = 0; i < pathLayer->nodeCount; i++) diff --git a/src/randomcrap.S b/src/randomcrap.S index 2842d12..0dbb4ef 100644 --- a/src/randomcrap.S +++ b/src/randomcrap.S @@ -281,6 +281,12 @@ NoBGScale: addi r1, r1, 0x60 blr +.global ExitStageReal +.extern ExitStageRealRest +ExitStageReal: + stwu r1, -0x20(r1) + b ExitStageRealRest + .data .global BGScaleFront, BGScaleBack, BGScaleEnabled BGScale: diff --git a/src/sceneGlue.cpp b/src/sceneGlue.cpp new file mode 100644 index 0000000..3e2167a --- /dev/null +++ b/src/sceneGlue.cpp @@ -0,0 +1,22 @@ +#include <game.h> +#include <stage.h> + +extern char CurrentLevel, CurrentWorld; +extern u8 MaybeFinishingLevel[2]; +extern "C" void ExitStageReal(int scene, int sceneParams, int powerupStoreType, int wipe); + +extern "C" void ExitStageWrapper(int scene, int sceneParams, int powerupStoreType, int wipe) { + if (scene == WORLD_MAP && powerupStoreType == BEAT_LEVEL) { + if (CurrentWorld == 6 && CurrentLevel == STAGE_DOOMSHIP) { + if (MaybeFinishingLevel[0] == 6 && MaybeFinishingLevel[1] == STAGE_DOOMSHIP) { + // We're done with 7-38 + ExitStage(MOVIE, 0x10000000, powerupStoreType, wipe); + return; + } + } + } + + ExitStageReal(scene, sceneParams, powerupStoreType, wipe); +} + + |