summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-05-09 00:08:23 +0200
committerTreeki <treeki@gmail.com>2011-05-09 00:08:23 +0200
commit8cfccc45e0e28bdb22392cc9a6742806a947391c (patch)
tree86a0e977bb32d097204dc47df81109c3c9c69d9b
parent8b66ac99b819e4e17cbfb1586232e5542caf532e (diff)
downloadkamek-8cfccc45e0e28bdb22392cc9a6742806a947391c.tar.gz
kamek-8cfccc45e0e28bdb22392cc9a6742806a947391c.zip
switch settings on Level Select
-rw-r--r--src/worldmap.cpp23
-rw-r--r--src/worldmap.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/src/worldmap.cpp b/src/worldmap.cpp
index d254226..d7f73d0 100644
--- a/src/worldmap.cpp
+++ b/src/worldmap.cpp
@@ -71,6 +71,14 @@ dScNewerWorldMap_c *dScNewerWorldMap_c::build() {
#define CONT_DONE(cont) (*((bool*)(((u32)(cont))+0x2D7)))
#define CONT_UNK3(cont) (*((bool*)(((u32)(cont))+0x2E0)))
+inline u8 GetSwitchStatus() {
+ return *((u8*)(((u32)GameMgr)+0x380));
+}
+
+inline void SetSwitchStatus(u8 stat) {
+ *((u8*)(((u32)GameMgr)+0x380)) = stat;
+}
+
#define STATE_START_DVD 0
#define STATE_LOAD_RES 1
#define STATE_END_DVD 2
@@ -171,6 +179,16 @@ void dScNewerWorldMap_c::SetTitle(const char *text) {
TextBox_SetString(textBox, conv_buf, 0);
}
+void dScNewerWorldMap_c::GenSBTitle() {
+ char buf[0x100];
+ sprintf(buf, "Switches: R:%s; G:%s; Y:%s; B:%s",
+ ((GetSwitchStatus() & 1) != 0) ? "On" : "Off",
+ ((GetSwitchStatus() & 2) != 0) ? "On" : "Off",
+ ((GetSwitchStatus() & 4) != 0) ? "On" : "Off",
+ ((GetSwitchStatus() & 8) != 0) ? "On" : "Off");
+ this->SetTitle(buf);
+}
+
void dScNewerWorldMap_c::GenText() {
char buf[0x1FF];
char paneNameBuf[0x20];
@@ -340,6 +358,7 @@ int dScNewerWorldMap_c::onCreate() {
OSReport("23:Make text\n");
this->GenText();
+ this->GenSBTitle();
OSReport("24:onCreate complete\n");
return true;
@@ -498,6 +517,10 @@ int dScNewerWorldMap_c::onExecute() {
this->state = STATE_CSMENU;
}
+ if (nowPressed & WPAD_B) {
+ SetSwitchStatus((GetSwitchStatus() + 1) & 15);
+ this->GenSBTitle();
+ }
// Change the current level
if ((nowPressed & WPAD_UP) && currentSelection > 0) {
diff --git a/src/worldmap.h b/src/worldmap.h
index 5966352..0cf567e 100644
--- a/src/worldmap.h
+++ b/src/worldmap.h
@@ -49,6 +49,7 @@ public:
void StartLevel();
void GenText();
+ void GenSBTitle();
void SetTitle(const char *text);
int onCreate();