From 46f7334790a5cef5fb167698e2d11c8bb680b6e9 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 30 Apr 2013 17:34:09 +0200 Subject: changes to palace dude and message box, and removal of cutscenes --- src/msgbox.cpp | 27 ++++++++++++++++++++++----- src/msgbox.h | 5 ++++- src/palaceDude.cpp | 17 +++++++++++++---- src/sceneGlue.cpp | 33 ++++++++++++++++++++++++--------- 4 files changed, 63 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/msgbox.cpp b/src/msgbox.cpp index 30ee66e..ed75f83 100644 --- a/src/msgbox.cpp +++ b/src/msgbox.cpp @@ -101,7 +101,12 @@ void dMsgBoxManager_c::executeState_Wait() { /*****************************************************************************/ // Show Box -void dMsgBoxManager_c::showMessage(int id) { +void dMsgBoxManager_c::showMessage(int id, bool canCancel, int delay) { + if (!this) { + OSReport("ADD A MESSAGE BOX MANAGER YOU MORON\n"); + return; + } + // get the data file header_s *data = (header_s*)msgDataLoader.buffer; @@ -116,12 +121,17 @@ void dMsgBoxManager_c::showMessage(int id) { } if (title == 0) { + OSReport("Message Box: Message %08x not found\n", id); return; } layout.findTextBoxByName("T_title")->SetString(title); layout.findTextBoxByName("T_msg")->SetString(msg); + this->canCancel = canCancel; + this->delay = delay; + layout.findPictureByName("button")->SetVisible(canCancel); + state.setState(&StateID_BoxAppearWait); } @@ -151,10 +161,17 @@ CREATE_STATE(dMsgBoxManager_c, ShownWait); void dMsgBoxManager_c::beginState_ShownWait() { } void dMsgBoxManager_c::executeState_ShownWait() { - int nowPressed = Remocon_GetPressed(GetActiveRemocon()); - - if (nowPressed & WPAD_TWO) { - state.setState(&StateID_BoxDisappearWait); + if (canCancel) { + int nowPressed = Remocon_GetPressed(GetActiveRemocon()); + + if (nowPressed & WPAD_TWO) + state.setState(&StateID_BoxDisappearWait); + } + + if (delay > 0) { + delay--; + if (delay == 0) + state.setState(&StateID_BoxDisappearWait); } } void dMsgBoxManager_c::endState_ShownWait() { } diff --git a/src/msgbox.h b/src/msgbox.h index f71749d..22ae812 100644 --- a/src/msgbox.h +++ b/src/msgbox.h @@ -5,7 +5,7 @@ class dMsgBoxManager_c : public dStageActor_c { public: - void showMessage(int id); + void showMessage(int id, bool canCancel=true, int delay=-1); dMsgBoxManager_c() : state(this, &StateID_LoadRes) { } @@ -25,6 +25,9 @@ class dMsgBoxManager_c : public dStageActor_c { bool layoutLoaded; bool visible; + bool canCancel; + int delay; + dStateWrapper_c state; USING_STATES(dMsgBoxManager_c); diff --git a/src/palaceDude.cpp b/src/palaceDude.cpp index 19f7255..7aa0ccc 100644 --- a/src/palaceDude.cpp +++ b/src/palaceDude.cpp @@ -2,6 +2,8 @@ #include #include "msgbox.h" +const char *PalaceDudeFileList[] = {"OpeningScene", 0}; + class dPalaceDude_c : public dStageActor_c { public: static dPalaceDude_c *build(); @@ -26,12 +28,17 @@ int dPalaceDude_c::onExecute() { // OSReport("Activating Palace Dude\n"); hasBeenActivated = true; - StopBGMMusic(); + if (!(settings & 0xF000000)) + StopBGMMusic(); - dMsgBoxManager_c::instance->showMessage(settings & 0xFFFFFFF); + dMsgBoxManager_c::instance->showMessage( + settings & 0xFFFFFF, // message ID + false, // cannot cancel + (settings & 0xF000000) ? 270 : 840 // delay + ); SaveBlock *save = GetSaveFile()->GetBlock(-1); - GameMgrP->switchPalaceFlag|= (1 << (settings >> 28)); + GameMgrP->switchPalaceFlag |= (1 << (settings >> 28)); } } @@ -41,7 +48,9 @@ int dPalaceDude_c::onExecute() { // OSReport("Palace Dude is activated, %d\n", dMsgBoxManager_c::instance->visible); if (!dMsgBoxManager_c::instance->visible) { // OSReport("Exiting\n"); - ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); + if (settings & 0xF000000) + SaveGame(0, false); + ExitStage(WORLD_MAP, 0x80000000, BEAT_LEVEL, MARIO_WIPE); hasExitedStage = true; } } diff --git a/src/sceneGlue.cpp b/src/sceneGlue.cpp index 3e2167a..fef5ad9 100644 --- a/src/sceneGlue.cpp +++ b/src/sceneGlue.cpp @@ -5,18 +5,33 @@ 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; - } - } - } + // TO RE-ENABLE CUTSCENES, UNCOMMENT THIS + // 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); } +extern "C" void EnterOpeningLevel() { + DontShowPreGame = true; + RESTART_CRSIN_LevelStartStruct.purpose = 0; + RESTART_CRSIN_LevelStartStruct.world1 = 1; + RESTART_CRSIN_LevelStartStruct.world2 = 1; + RESTART_CRSIN_LevelStartStruct.level1 = 40; + RESTART_CRSIN_LevelStartStruct.level2 = 40; + RESTART_CRSIN_LevelStartStruct.areaMaybe = 0; + RESTART_CRSIN_LevelStartStruct.entrance = 0xFF; + RESTART_CRSIN_LevelStartStruct.unk4 = 0; // load replay + DoSceneChange(RESTART_CRSIN, 0, 0); +} + -- cgit v1.2.3