#include #include #include "msgbox.h" const char *PalaceDudeFileList[] = {"OpeningScene", 0}; class dPalaceDude_c : public dStageActor_c { public: static dPalaceDude_c *build(); bool hasBeenActivated; bool hasExitedStage; int onExecute(); }; /*****************************************************************************/ // Glue Code dPalaceDude_c *dPalaceDude_c::build() { void *buffer = AllocFromGameHeap1(sizeof(dPalaceDude_c)); dPalaceDude_c *c = new(buffer) dPalaceDude_c; return c; } int dPalaceDude_c::onExecute() { if (dFlagMgr_c::instance->flags & spriteFlagMask) { if (!hasBeenActivated) { // OSReport("Activating Palace Dude\n"); hasBeenActivated = true; int delay; if (!(settings & 0xF000000)) { delay = 270; StopBGMMusic(); } else { delay = 1020; } dMsgBoxManager_c::instance->showMessage( settings & 0xFFFFFF, // message ID false, // cannot cancel delay // delay ); SaveBlock *save = GetSaveFile()->GetBlock(-1); GameMgrP->switchPalaceFlag |= (1 << (settings >> 28)); } } if (hasBeenActivated) { if (hasExitedStage) return true; // OSReport("Palace Dude is activated, %d\n", dMsgBoxManager_c::instance->visible); if (!dMsgBoxManager_c::instance->visible) { // OSReport("Exiting\n"); if (settings & 0xF000000) SaveGame(0, false); ExitStage(WORLD_MAP, 0x80000000, BEAT_LEVEL, MARIO_WIPE); hasExitedStage = true; } } return true; }