diff options
Diffstat (limited to '')
-rw-r--r-- | src/worldmap.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 7bfa461..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
@@ -157,7 +165,7 @@ void dScNewerWorldMap_c::StartLevel(LevelInfo_Entry *entry) { }
void dScNewerWorldMap_c::SetTitle(const char *text) {
- unsigned short conv_buf[0x1FF];
+ unsigned short conv_buf[0x200];
int length = strlen(text);
if (length > 0x1FF)
length = 0x1FF;
@@ -165,11 +173,22 @@ void dScNewerWorldMap_c::SetTitle(const char *text) { for (int i = 0; i < length; i++) {
conv_buf[i] = text[i];
}
+ conv_buf[length] = 0;
void *textBox = EmbeddedLayout_FindTextBoxByName(this->layout, "ScreenTitle");
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];
@@ -339,6 +358,7 @@ int dScNewerWorldMap_c::onCreate() { OSReport("23:Make text\n");
this->GenText();
+ this->GenSBTitle();
OSReport("24:onCreate complete\n");
return true;
@@ -497,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) {
|