From a9d6e00e80065676a243c9a3033e47009488059d Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 13 Feb 2013 06:04:52 +0100 Subject: add W7 to W8 cutscene --- src/cutScene.cpp | 21 +++++++++++++++++---- src/koopatlas/core.cpp | 8 +++++++- src/koopatlas/core.h | 1 + src/koopatlas/pathmanager.cpp | 14 +++++++++++++- src/randomcrap.S | 6 ++++++ src/sceneGlue.cpp | 22 ++++++++++++++++++++++ 6 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 src/sceneGlue.cpp (limited to 'src') 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 +#include + +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); +} + + -- cgit v1.2.3