From 46b65dfd76411bec6f8356c581f337f8a1944013 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 25 Sep 2012 23:03:30 +0200 Subject: added Remocon and GameMgr definitions, and made map HUD buttons work --- src/koopatlas/hud.cpp | 18 ++++++++++++++++++ src/koopatlas/hud.h | 4 +++- src/palaceDude.cpp | 2 +- src/replay.S | 6 +++--- src/switchblock.S | 6 +++--- 5 files changed, 28 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index b7effce..c9124d2 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -14,6 +14,7 @@ dWMHud_c *dWMHud_c::build() { dWMHud_c::dWMHud_c() { layoutLoaded = false; + displayedControllerType = -1; } enum WMHudAnimation { @@ -112,6 +113,8 @@ int dWMHud_c::onExecute() { playShowHeaderAnim(); } + updatePressableButtonThingies(); + layout.execAnimations(); layout.update(); @@ -278,4 +281,19 @@ void dWMHud_c::setupLives() { N_IconPosXP_00[playerCount - 1]->SetVisible(true); } +void dWMHud_c::updatePressableButtonThingies() { + int cntType = RemoconMng->controllers[0]->controllerType; + + if (cntType != displayedControllerType) { + displayedControllerType = cntType; + + int beef = (cntType == 0) ? 0 : 1; + GameMgrP->currentControllerType = beef; + + WriteBMGToTextBox( + layout.findTextBoxByName("ItemsButtonInfo"), + GetBMG(), 4, 15, 0); + } +} + diff --git a/src/koopatlas/hud.h b/src/koopatlas/hud.h index 07dde77..e507aea 100644 --- a/src/koopatlas/hud.h +++ b/src/koopatlas/hud.h @@ -18,7 +18,6 @@ class dWMHud_c : public dBase_c { static dWMHud_c *build(); static dWMHud_c *instance; - void enteredNode(dKPNode_s *node = 0); void leftNode(); @@ -32,6 +31,9 @@ class dWMHud_c : public dBase_c { bool willShowHeader; dKPNode_s *nodeForHeader; + int displayedControllerType; + void updatePressableButtonThingies(); + nw4r::lyt::Pane *N_IconPosXP_00[4]; diff --git a/src/palaceDude.cpp b/src/palaceDude.cpp index 6a8d7ff..8eb4a99 100644 --- a/src/palaceDude.cpp +++ b/src/palaceDude.cpp @@ -29,7 +29,7 @@ int dPalaceDude_c::onExecute() { dMsgBoxManager_c::instance->showMessage(settings & 0xFFFFFFF); SaveBlock *save = GetSaveFile()->GetBlock(-1); - *((u8*)(((u32)GameMgr)+0x380)) |= (1 << (settings >> 28)); + GameMgrP->switchPalaceFlag|= (1 << (settings >> 28)); } } diff --git a/src/replay.S b/src/replay.S index 8c3f6c7..89868cf 100644 --- a/src/replay.S +++ b/src/replay.S @@ -27,7 +27,7 @@ .extern EGG__Heap__free__FPvPv .extern GameHeap2 .extern EggControllerClassPtrMaybe -.extern GameMgr +.extern GameMgrP .extern StrangeReplayValue1 .extern StrangeReplayValue2 .extern StrangeReplayValue3 @@ -192,8 +192,8 @@ replayStartLoop: lwzx r3, r3, r6 stw r3, 0x18(r4) - lis r3, GameMgr@h - ori r3, r3, GameMgr@l + lis r3, GameMgrP@h + ori r3, r3, GameMgrP@l lwz r3, 0(r3) lbz r3, 0x380(r3) stb r3, 0x21(r4) diff --git a/src/switchblock.S b/src/switchblock.S index b86d5e2..4df2433 100644 --- a/src/switchblock.S +++ b/src/switchblock.S @@ -11,14 +11,14 @@ #endif .align 4 -.extern GameMgr +.extern GameMgrP .extern BG_GM_ptr .extern _restgpr_27 .global BG_GM_InitRedSwitchFlag_Patch BG_GM_InitRedSwitchFlag_Patch: - lis r5, GameMgr@h - ori r5, r5, GameMgr@l + lis r5, GameMgrP@h + ori r5, r5, GameMgrP@l lwz r5, 0(r5) addis r4, r3, 9 -- cgit v1.2.3