blob: bb8ec202f5b0864c7cfed45f6355568d3592883b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include <game.h>
#include <stage.h>
#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();
SaveBlock *save = GetSaveFile()->GetBlock(-1);
GameMgrP->switchPalaceFlag |= (1 << (settings >> 28));
} else {
delay = 1020;
}
dMsgBoxManager_c::instance->showMessage(
settings & 0xFFFFFF, // message ID
false, // cannot cancel
delay // delay
);
}
}
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");
u32 wmsettings = 0;
if (settings & 0xF000000) {
SaveGame(0, false);
wmsettings = 0x80000000;
}
ExitStage(WORLD_MAP, wmsettings, BEAT_LEVEL, MARIO_WIPE);
hasExitedStage = true;
}
}
return true;
}
|