summaryrefslogtreecommitdiff
path: root/src/koopatlas/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/core.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index e9ae989..f0a57af 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -109,14 +109,6 @@ dScKoopatlas_c::dScKoopatlas_c() : state(this) {
#define NPCHG_CCI(npc,idx) (((void**)(((u32)(npc))+0xA4))[(idx)])
#define NPCHG_2DPLAYER(npc,idx) (((void**)(((u32)(npc))+0x64C))[(idx)])
-#define STKI_SETUP_DONE(si) (*((bool*)(((u32)(si))+0x310)))
-#define STKI_SHADOW(si) (*((void**)(((u32)(si))+0x310)))
-#define STKI_2DPLAYER(si,idx) (((void**)(((u32)(si))+0x2E4))[(idx)])
-#define STKI_ITEM(si,idx) (((void**)(((u32)(si))+0x2F4))[(idx)])
-#define STKI_SHOW(si) (*((bool*)(((u32)(si))+0x8DD)))
-
-#define SIS_SETUP_DONE(sis) (*((bool*)(((u32)(sis))+0x260)))
-
#define CCSB_ACTIVE(ccsb) (*((bool*)(((u32)(ccsb))+0x29C)))
#define CCSC_ACTIVE(ccsc) (*((bool*)(((u32)(ccsc))+0x2A1)))
@@ -218,8 +210,8 @@ bool WMInit_SetupWait(void *ptr) {
success &= NPCHG_SETUP_DONE(wm->numPeopleChange);
success &= YESNO_SETUP_DONE(wm->yesNoWindow);
success &= CONT_SETUP_DONE(wm->continueObj);
- success &= STKI_SETUP_DONE(wm->stockItem);
- success &= SIS_SETUP_DONE(wm->stockItemShadow);
+ success &= wm->stockItem->layoutLoaded;
+ success &= wm->stockItemShadow->layoutLoaded;
success &= EASYP_SETUP_DONE(wm->easyPairing);
return success;
@@ -243,14 +235,14 @@ bool WMInit_SetupExtra(void *ptr) {
// first up: player models for Stocked Items
for (int i = 0; i < 4; i++) {
void *obj = CreateChildObject(WM_2D_PLAYER, wm, i, 0, 0);
- STKI_2DPLAYER(wm->stockItem,i) = obj;
+ wm->stockItem->player2d[i] = obj;
NPCHG_2DPLAYER(wm->numPeopleChange,i) = obj;
}
// next: items for the Powerup screen
- for (int i = 0; i < 7; i++) {
- void *obj = CreateChildObject(WM_ITEM, wm, i, 0, 0);
- STKI_ITEM(wm->stockItem,i) = obj;
+ for (int i = 0; i < 8; i++) {
+ void *obj = CreateChildObject(WM_ITEM, wm, i==7?6:i, 0, 0);
+ wm->stockItem->newItemPtr[i] = obj;
}
// need Player before we can set up paths
@@ -398,10 +390,10 @@ int dScKoopatlas_c::onCreate() {
this->continueObj = CreateParentedObject(CONTINUE, this, 0, 0);
SpammyReport("stock item\n");
- this->stockItem = CreateParentedObject(STOCK_ITEM, this, 0, 0);
+ this->stockItem = (dStockItem_c*)CreateParentedObject(STOCK_ITEM, this, 0, 0);
SpammyReport("stock item shadow\n");
- this->stockItemShadow = CreateParentedObject(STOCK_ITEM_SHADOW, this, 0, 0);
- STKI_SHADOW(this->stockItem) = this->stockItemShadow;
+ this->stockItemShadow = (dStockItemShadow_c*)CreateParentedObject(STOCK_ITEM_SHADOW, this, 0, 0);
+ stockItem->shadow = stockItemShadow;
SpammyReport("easy pairing\n");
this->easyPairing = CreateParentedObject(EASY_PAIRING, this, 0, 0);
@@ -516,11 +508,13 @@ void dScKoopatlas_c::executeState_Normal() {
// Nothing related to the menu is going on
if (nowPressed & WPAD_ONE) {
- STKI_SHOW(this->stockItem) = true;
+ stockItem->show = true;
state.setState(&StateID_PowerupsWait);
+ hud->hideAll();
} else if (nowPressed & WPAD_PLUS) {
CSMENU_ACTIVE(this->csMenu) = true;
state.setState(&StateID_CSMenu);
+ hud->hideAll();
} else if (nowPressed & WPAD_MINUS) {
pathManager.unlockAllPaths(2);
} else if (nowPressed & WPAD_A) {
@@ -582,6 +576,7 @@ void dScKoopatlas_c::executeState_CSMenu() {
} else {
// Ok, change back to STATE_Normal
+ hud->unhideAll();
state.setState(&StateID_Normal);
}
}
@@ -637,6 +632,7 @@ void dScKoopatlas_c::executeState_TitleConfirmHitWait() {
if (!YESNO_OPENING(this->yesNoWindow)) {
if (YESNO_CURRENT(this->yesNoWindow) == 1) {
state.setState(&StateID_Normal);
+ hud->unhideAll();
} else {
state.setState(&StateID_Limbo);
StartTitleScreenStage(false, 0);
@@ -680,6 +676,7 @@ void dScKoopatlas_c::executeState_PlayerChangeWait() {
}
state.setState(&StateID_Normal);
+ hud->unhideAll();
}
}
@@ -712,10 +709,11 @@ void dScKoopatlas_c::executeState_EasyPairingWait() {
// STATE_PowerupsWait : Wait for the user to exit the Powerups screen.
void dScKoopatlas_c::executeState_PowerupsWait() {
- if (!STKI_SHOW(this->stockItem)) {
+ if (!stockItem->show) {
player->modelHandler->mdlClass->setPowerup(Player_Powerup[0]);
state.setState(&StateID_Normal);
+ hud->unhideAll();
}
}
@@ -727,6 +725,7 @@ void dScKoopatlas_c::executeState_ShopWait() {
if (!shop->visible) {
state.setState(&StateID_Normal);
+ hud->unhideAll();
}
}
@@ -738,6 +737,7 @@ void dScKoopatlas_c::executeState_CoinsWait() {
if (!coins->visible) {
state.setState(&StateID_Normal);
+ hud->unhideAll();
}
}
@@ -793,6 +793,7 @@ void dScKoopatlas_c::executeState_SaveWindowClose() {
if (!YESNO_VISIBLE(this->yesNoWindow)) {
if (YESNO_CURRENT(this->yesNoWindow) == 1) {
state.setState(&StateID_Normal);
+ hud->unhideAll();
} else {
state.setState(&StateID_SaveDo);
SaveGame(0, false);
@@ -836,6 +837,7 @@ void dScKoopatlas_c::executeState_SaveEndCloseWait() {
if (!YESNO_OPENING(this->yesNoWindow)) {
state.setState(&StateID_Normal);
+ hud->unhideAll();
}
}
@@ -891,6 +893,7 @@ void dScKoopatlas_c::executeState_QuickSaveWindowClose() {
if (!YESNO_VISIBLE(this->yesNoWindow)) {
if (YESNO_CURRENT(this->yesNoWindow) == 1) {
state.setState(&StateID_Normal);
+ hud->unhideAll();
} else {
state.setState(&StateID_QuickSaveDo);
SaveGame(0, true);
@@ -934,6 +937,7 @@ void dScKoopatlas_c::executeState_QuickSaveEndCloseWait() {
if (!YESNO_OPENING(this->yesNoWindow)) {
if (YESNO_CURRENT(this->yesNoWindow) == 1) {
state.setState(&StateID_Normal);
+ hud->unhideAll();
} else {
state.setState(&StateID_Limbo);
StartTitleScreenStage(false, 0);