summaryrefslogtreecommitdiff
path: root/src/palaceDude.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-09-21 20:43:21 -0500
committerColin Noga <Tempus@chronometry.ca>2012-09-21 20:43:21 -0500
commitd47a9ed57a826d60c37bfa8a4ae00ccaba0ed806 (patch)
treec3f6657118d71abcd1ce3b4584b3e0472841e53f /src/palaceDude.cpp
parent8d0a306f0a526a76182c8d2b513d7a0441d6f466 (diff)
parent5654d5c0a056f9cfc99ac608d16aa0a601b997f5 (diff)
downloadkamek-d47a9ed57a826d60c37bfa8a4ae00ccaba0ed806.tar.gz
kamek-d47a9ed57a826d60c37bfa8a4ae00ccaba0ed806.zip
Merge branch 'level-select' of ssh://treeki.rustedlogic.net:30000/Kamek into level-select
Diffstat (limited to 'src/palaceDude.cpp')
-rw-r--r--src/palaceDude.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/palaceDude.cpp b/src/palaceDude.cpp
new file mode 100644
index 0000000..6a8d7ff
--- /dev/null
+++ b/src/palaceDude.cpp
@@ -0,0 +1,51 @@
+#include <game.h>
+#include <stage.h>
+#include "msgbox.h"
+
+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;
+
+ dMsgBoxManager_c::instance->showMessage(settings & 0xFFFFFFF);
+
+ SaveBlock *save = GetSaveFile()->GetBlock(-1);
+ *((u8*)(((u32)GameMgr)+0x380)) |= (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");
+ ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE);
+ hasExitedStage = true;
+ }
+ }
+
+ return true;
+
+}
+
+