From 8cfccc45e0e28bdb22392cc9a6742806a947391c Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 9 May 2011 00:08:23 +0200 Subject: switch settings on Level Select --- src/worldmap.cpp | 23 +++++++++++++++++++++++ src/worldmap.h | 1 + 2 files changed, 24 insertions(+) (limited to 'src') 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(); -- cgit v1.2.3