diff --git a/include/macros.h b/include/macros.h index bb7315b3df..ddf3dcc87c 100644 --- a/include/macros.h +++ b/include/macros.h @@ -111,10 +111,10 @@ #define CAPACITY(upg, value) gUpgradeCapacities[upg][value] #define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg)) -#define CONTROLLER1(globalCtx) (&(globalCtx)->state.input[0]) -#define CONTROLLER2(globalCtx) (&(globalCtx)->state.input[1]) -#define CONTROLLER3(globalCtx) (&(globalCtx)->state.input[2]) -#define CONTROLLER4(globalCtx) (&(globalCtx)->state.input[3]) +#define CONTROLLER1(gameState) (&(gameState)->input[0]) +#define CONTROLLER2(gameState) (&(gameState)->input[1]) +#define CONTROLLER3(gameState) (&(gameState)->input[2]) +#define CONTROLLER4(gameState) (&(gameState)->input[3]) #define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0) #define CHECK_BTN_ANY(state, combo) (((state) & (combo)) != 0) diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 53be7b68de..715d3756f4 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -135,7 +135,7 @@ static s32 sTimer = 0; void FlagSet_Update(GameState* gameState) { GlobalContext* globalCtx = (GlobalContext*)gameState; - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); /* Intra-byte navigation */ diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 5a234ea442..5ed36d5518 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -60,7 +60,7 @@ void func_800F4A10(GlobalContext* globalCtx) { } void KaleidoSetup_Update(GlobalContext* globalCtx) { - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); MessageContext* msgCtx = &globalCtx->msgCtx; Player* player = GET_PLAYER(globalCtx); PauseContext* pauseCtx = &globalCtx->pauseCtx; diff --git a/src/code/z_message.c b/src/code/z_message.c index 2a90f38ca7..d8e2d5c8a7 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -67,7 +67,7 @@ void func_80147564(GlobalContext* globalCtx) { s32 Message_ShouldAdvance(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; - Input* controller = CONTROLLER1(globalCtx); + Input* controller = CONTROLLER1(&globalCtx->state); if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) { if (CHECK_BTN_ALL(controller->press.button, BTN_A)) { @@ -86,7 +86,7 @@ s32 Message_ShouldAdvance(GlobalContext* globalCtx) { s32 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; - Input* controller = CONTROLLER1(globalCtx); + Input* controller = CONTROLLER1(&globalCtx->state); if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { return CHECK_BTN_ALL(controller->press.button, BTN_A); @@ -117,7 +117,7 @@ void func_801477B4(GlobalContext* globalCtx) { void func_80148B98(GlobalContext* globalCtx, u8 arg1) { static s16 held = 0; MessageContext* msgCtx = &globalCtx->msgCtx; - Input* curInput = CONTROLLER1(globalCtx); + Input* curInput = CONTROLLER1(&globalCtx->state); if ((curInput->rel.stick_y > 29) && held == 0) { held = 1; diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 16aa93bd96..18d5792d6c 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -271,7 +271,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_REFLECT); } } else { - if (CHECK_BTN_ANY(CONTROLLER1(globalCtx)->press.button, + if (CHECK_BTN_ANY(CONTROLLER1(&globalCtx->state)->press.button, BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { s32 pad; this->timer = 1; diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index bad5f7383a..900ca2a7d7 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -1664,7 +1664,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { case 1: if ((this->unk_1D14 < 80U) && (D_809E0420 != 0) && - CHECK_BTN_ANY(CONTROLLER1(globalCtx)->press.button, + CHECK_BTN_ANY(CONTROLLER1(&globalCtx->state)->press.button, BTN_A | BTN_B | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT)) { this->unk_1D18++; this->unk_1D78 = 1; @@ -1713,7 +1713,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { case 10: if ((this->unk_1D14 < 30U) && (D_809E0421 != 0) && - CHECK_BTN_ANY(CONTROLLER1(globalCtx)->press.button, + CHECK_BTN_ANY(CONTROLLER1(&globalCtx->state)->press.button, BTN_A | BTN_B | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT)) { this->unk_1D18++; this->unk_1D78 = 1; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 1959ba26b4..9691940d1e 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -848,7 +848,7 @@ void Boss03_SetupChewPlayer(Boss03* this, GlobalContext* globalCtx) { void Boss03_ChewPlayer(Boss03* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); f32 jawZRotTarget; f32 xDiff; f32 yDiff; diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 668033cd65..dfd978d103 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -1923,7 +1923,7 @@ void EnFishing_DrawRod(GlobalContext* globalCtx) { f32 spC8; f32 spC4; f32 spC0; - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); Player* player = GET_PLAYER(globalCtx); s32 pad; @@ -2075,7 +2075,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { Vec3f spA8; Vec3f sp9C; Vec3f sp90; - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); D_809171FE++; @@ -2864,7 +2864,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { EnFishing* this = THIS; GlobalContext* globalCtx = globalCtx2; Player* player = GET_PLAYER(globalCtx); - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); f32 spD8; f32 phi_f0; f32 phi_f2; @@ -5052,7 +5052,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { f32 lureDistXZ; Camera* camera; Player* player = GET_PLAYER(globalCtx); - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); playerShadowAlpha = player->actor.shape.shadowAlpha; @@ -5621,7 +5621,7 @@ TexturePtr sFishingOwnerEyeTexs[] = { void EnFishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnFishing* this = THIS; - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); OPEN_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index bfeca2143f..233c0fe610 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -127,11 +127,11 @@ s32 EnFsn_TestItemSelected(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { - return CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A); + return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A); } - return CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_CUP); + return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_CUP); } u16 EnFsn_GetWelcome(GlobalContext* globalCtx) { @@ -483,8 +483,8 @@ s32 EnFsn_HasPlayerSelectedItem(EnFsn* this, GlobalContext* globalCtx, Input* in } void EnFsn_UpdateJoystickInputState(EnFsn* this, GlobalContext* globalCtx) { - s8 stickX = CONTROLLER1(globalCtx)->rel.stick_x; - s8 stickY = CONTROLLER1(globalCtx)->rel.stick_y; + s8 stickX = CONTROLLER1(&globalCtx->state)->rel.stick_x; + s8 stickY = CONTROLLER1(&globalCtx->state)->rel.stick_y; if (this->stickAccumX == 0) { if (stickX > 30 || stickX < -30) { @@ -882,7 +882,8 @@ void EnFsn_AskBuyOrSell(EnFsn* this, GlobalContext* globalCtx) { } } else if (talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnFsn_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx)) && Message_ShouldAdvance(globalCtx)) { + if (!EnFsn_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state)) && + Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: func_8019F208(); @@ -1108,7 +1109,7 @@ void EnFsn_BrowseShelf(EnFsn* this, GlobalContext* globalCtx) { EnFsn_UpdateCursorPos(this, globalCtx); if (talkstate == 5) { func_8011552C(globalCtx, 6); - if (!EnFsn_HasPlayerSelectedItem(this, globalCtx, CONTROLLER1(globalCtx))) { + if (!EnFsn_HasPlayerSelectedItem(this, globalCtx, CONTROLLER1(&globalCtx->state))) { EnFsn_CursorLeftRight(this); if (this->cursorIdx != prevCursorIdx) { play_sound(NA_SE_SY_CURSOR); @@ -1210,7 +1211,8 @@ void EnFsn_SelectItem(EnFsn* this, GlobalContext* globalCtx) { if (EnFsn_TakeItemOffShelf(this) && talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnFsn_TestCancelOption(this, globalCtx, CONTROLLER1(globalCtx)) && Message_ShouldAdvance(globalCtx)) { + if (!EnFsn_TestCancelOption(this, globalCtx, CONTROLLER1(&globalCtx->state)) && + Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: EnFsn_HandleCanPlayerBuyItem(this, globalCtx); @@ -1330,7 +1332,7 @@ void EnFsn_FaceShopkeeperSelling(EnFsn* this, GlobalContext* globalCtx) { if (talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnFsn_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx)) && + if (!EnFsn_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state)) && (!Message_ShouldAdvance(globalCtx) || !EnFsn_FacingShopkeeperDialogResult(this, globalCtx)) && this->stickAccumX > 0) { cursorIdx = EnFsn_SetCursorIndexFromNeutral(this); diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 907ba619b1..ae10224136 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -235,9 +235,9 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.fileNum != 0xFEDC) { if (this->state == MAG_STATE_INITIAL) { - if (CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_START) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_B)) { + if (CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_START) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B)) { if (!EnvFlags_Get(globalCtx, 4)) { play_sound(NA_SE_SY_PIECE_OF_HEART); @@ -378,9 +378,9 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { EnMag_UpdateDisplayEffectColors(&this->actor); if (sInputDelayTimer == 0) { - if (CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_START) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_B)) { + if (CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_START) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B)) { if (globalCtx->sceneLoadFlag != 0x14) { Audio_SetCutsceneFlag(false); D_801BB12C++; @@ -427,9 +427,9 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { // Appear fully immediately if called during fade-in states. if ((this->state > MAG_STATE_INITIAL) && (this->state < MAG_STATE_CALLED)) { - if (CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_START) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_B)) { + if (CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_START) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B)) { play_sound(NA_SE_SY_PIECE_OF_HEART); this->state = MAG_STATE_CALLED; } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index ff85b7625d..be1def2644 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -199,11 +199,11 @@ s32 EnOssan_TestItemSelected(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { - return CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A); + return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A); } - return CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_CUP); + return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_CUP); } void EnOssan_CheckValidSpawn(EnOssan* this) { @@ -453,8 +453,8 @@ void EnOssan_BeginInteraction(EnOssan* this, GlobalContext* globalCtx) { } void EnOssan_UpdateJoystickInputState(GlobalContext* globalCtx, EnOssan* this) { - s8 stickX = CONTROLLER1(globalCtx)->rel.stick_x; - s8 stickY = CONTROLLER1(globalCtx)->rel.stick_y; + s8 stickX = CONTROLLER1(&globalCtx->state)->rel.stick_x; + s8 stickY = CONTROLLER1(&globalCtx->state)->rel.stick_y; this->moveHorizontal = this->moveVertical = false; @@ -574,7 +574,7 @@ void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx) { } else if (this->flags & END_INTERACTION) { this->flags &= ~END_INTERACTION; EnOssan_EndInteraction(globalCtx, this); - } else if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx))) { + } else if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { EnOssan_StartShopping(globalCtx, this); } else { return; @@ -631,7 +631,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx) { } else { if (talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx)) && + if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state)) && (!Message_ShouldAdvance(globalCtx) || !EnOssan_FacingShopkeeperDialogResult(this, globalCtx))) { if (this->stickAccumX < 0) { cursorIdx = EnOssan_SetCursorIndexFromNeutral(this, 4); @@ -854,7 +854,7 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx) { EnOssan_UpdateCursorPos(globalCtx, this); if (talkState == 5) { func_8011552C(globalCtx, 6); - if (!EnOssan_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(globalCtx))) { + if (!EnOssan_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(&globalCtx->state))) { if (this->moveHorizontal) { if (this->stickAccumX > 0) { cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 4); @@ -912,7 +912,7 @@ void EnOssan_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx) { EnOssan_UpdateCursorPos(globalCtx, this); if (talkState == 5) { func_8011552C(globalCtx, 6); - if (!EnOssan_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(globalCtx))) { + if (!EnOssan_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(&globalCtx->state))) { if (this->moveHorizontal != 0) { if (this->stickAccumX < 0) { cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 0); @@ -1053,7 +1053,8 @@ void EnOssan_SelectItem(EnOssan* this, GlobalContext* globalCtx) { if (EnOssan_TakeItemOffShelf(this) && talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnOssan_TestCancelOption(this, globalCtx, CONTROLLER1(globalCtx)) && Message_ShouldAdvance(globalCtx)) { + if (!EnOssan_TestCancelOption(this, globalCtx, CONTROLLER1(&globalCtx->state)) && + Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: EnOssan_HandleCanBuyItem(globalCtx, this); @@ -1124,7 +1125,7 @@ void EnOssan_ContinueShopping(EnOssan* this, GlobalContext* globalCtx) { EnOssan_ResetItemPosition(this); item = this->items[this->cursorIdx]; item->restockFunc(globalCtx, item); - if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx))) { + if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { switch (globalCtx->msgCtx.choiceIndex) { case 0: func_8019F208(); diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index a20556a316..ef47146b98 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -177,11 +177,11 @@ s32 EnSob1_TestItemSelected(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { - return CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A); + return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A); } - return CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_CUP); + return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_CUP); } u16 EnSob1_GetTalkOption(EnSob1* this, GlobalContext* globalCtx) { @@ -555,8 +555,8 @@ void EnSob1_Idle(EnSob1* this, GlobalContext* globalCtx) { } void EnSob1_UpdateJoystickInputState(GlobalContext* globalCtx, EnSob1* this) { - s8 stickX = CONTROLLER1(globalCtx)->rel.stick_x; - s8 stickY = CONTROLLER1(globalCtx)->rel.stick_y; + s8 stickX = CONTROLLER1(&globalCtx->state)->rel.stick_x; + s8 stickY = CONTROLLER1(&globalCtx->state)->rel.stick_y; if (this->stickAccumX == 0) { if (stickX > 30 || stickX < -30) { @@ -611,7 +611,7 @@ void EnSob1_Hello(EnSob1* this, GlobalContext* globalCtx) { } } if ((talkState == 5) && Message_ShouldAdvance(globalCtx) && - !EnSob1_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx))) { + !EnSob1_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { if (this->welcomeTextId == 0x68A) { // Welcome text when wearing Kafei's mask EnSob1_EndInteraction(globalCtx, this); } else { @@ -661,7 +661,7 @@ void EnSob1_FaceShopkeeper(EnSob1* this, GlobalContext* globalCtx) { } else { if (talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnSob1_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx))) { + if (!EnSob1_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { if (!Message_ShouldAdvance(globalCtx) || !EnSob1_FacingShopkeeperDialogResult(this, globalCtx)) { if (this->stickAccumX > 0) { cursorIndex = EnSob1_SetCursorIndexFromNeutral(this, 2); @@ -913,7 +913,7 @@ void EnSob1_BrowseShelf(EnSob1* this, GlobalContext* globalCtx) { EnSob1_UpdateCursorPos(globalCtx, this); if (talkState == 5) { func_8011552C(globalCtx, 6); - if (!EnSob1_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(globalCtx))) { + if (!EnSob1_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(&globalCtx->state))) { EnSob1_CursorLeftRight(globalCtx, this); cursorIndex = this->cursorIndex; if (cursorIndex != prevCursorIndex) { @@ -1021,7 +1021,8 @@ void EnSob1_SelectItem(EnSob1* this, GlobalContext* globalCtx) { if (EnSob1_TakeItemOffShelf(this) && talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnSob1_TestCancelOption(this, globalCtx, CONTROLLER1(globalCtx)) && Message_ShouldAdvance(globalCtx)) { + if (!EnSob1_TestCancelOption(this, globalCtx, CONTROLLER1(&globalCtx->state)) && + Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: EnSob1_HandleCanBuyItem(globalCtx, this); diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index 66ee6080eb..6f52cfed74 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -564,7 +564,7 @@ void EnTanron2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_159 = 1; } - input = CONTROLLER3(globalCtx); + input = CONTROLLER3(&globalCtx->state); if (CHECK_BTN_ALL(input->press.button, BTN_L)) { this->unk_158 = 1; } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 2efb3eb6b1..5cca94ff07 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -407,7 +407,7 @@ void func_80A916F0(EnTest6* this, GlobalContext* globalCtx) { } void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); s16 temp_s0; Player* player = GET_PLAYER(globalCtx); Camera* sp78; @@ -628,7 +628,7 @@ void func_80A92118(EnTest6* this, GlobalContext* globalCtx) { } void func_80A92188(EnTest6* this, GlobalContext* globalCtx) { - Input* input = CONTROLLER1(globalCtx); + Input* input = CONTROLLER1(&globalCtx->state); Player* player = GET_PLAYER(globalCtx); Camera* camera; s32 pad; diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index 470f4908a0..17094ac7fa 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -114,11 +114,11 @@ s32 EnTrt_TestItemSelected(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { - return CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A); + return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A); } - return CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(globalCtx)->press.button, BTN_CUP); + return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_CUP); } void EnTrt_SpawnShopItems(EnTrt* this, GlobalContext* globalCtx, ShopItem* shopItem) { @@ -257,8 +257,8 @@ void EnTrt_StartShopping(GlobalContext* globalCtx, EnTrt* this) { } void EnTrt_UpdateJoystickInputState(GlobalContext* globalCtx, EnTrt* this) { - s8 stickX = CONTROLLER1(globalCtx)->rel.stick_x; - s8 stickY = CONTROLLER1(globalCtx)->rel.stick_y; + s8 stickX = CONTROLLER1(&globalCtx->state)->rel.stick_x; + s8 stickY = CONTROLLER1(&globalCtx->state)->rel.stick_y; if (this->stickAccumX == 0) { if (stickX > 30 || stickX < -30) { @@ -314,7 +314,7 @@ void EnTrt_Hello(EnTrt* this, GlobalContext* globalCtx) { } if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { play_sound(NA_SE_SY_MESSAGE_PASS); - if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx))) { + if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { EnTrt_StartShopping(globalCtx, this); } } @@ -520,7 +520,7 @@ void EnTrt_FaceShopkeeper(EnTrt* this, GlobalContext* globalCtx) { this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } else if (talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx))) { + if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { if ((!Message_ShouldAdvance(globalCtx) || !EnTrt_FacingShopkeeperDialogResult(this, globalCtx)) && (this->stickAccumX > 0)) { cursorIdx = EnTrt_SetCursorIndexFromNeutral(this, 2); @@ -622,7 +622,7 @@ void EnTrt_BrowseShelf(EnTrt* this, GlobalContext* globalCtx) { EnTrt_UpdateCursorPos(globalCtx, this); if (talkState == 5) { func_8011552C(globalCtx, 6); - if (!EnTrt_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(globalCtx))) { + if (!EnTrt_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(&globalCtx->state))) { EnTrt_CursorLeftRight(globalCtx, this); if (this->cursorIdx != prevCursorIdx) { func_80151938(globalCtx, EnTrt_GetItemTextId(this)); @@ -707,7 +707,8 @@ void EnTrt_SelectItem(EnTrt* this, GlobalContext* globalCtx) { if (EnTrt_TakeItemOffShelf(this)) { if (talkState == 4) { func_8011552C(globalCtx, 6); - if (!EnTrt_TestCancelOption(this, globalCtx, CONTROLLER1(globalCtx)) && Message_ShouldAdvance(globalCtx)) { + if (!EnTrt_TestCancelOption(this, globalCtx, CONTROLLER1(&globalCtx->state)) && + Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: EnTrt_HandleCanBuyItem(globalCtx, this); @@ -1098,7 +1099,7 @@ void EnTrt_ContinueShopping(EnTrt* this, GlobalContext* globalCtx) { EnTrt_ResetItemPosition(this); item = this->items[this->cursorIdx]; item->restockFunc(globalCtx, item); - if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(globalCtx))) { + if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { switch (globalCtx->msgCtx.choiceIndex) { case 0: func_8019F208(); diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 53dbc266ff..ea650803e5 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -357,7 +357,7 @@ static SceneSelectEntry sScenes[] = { void Select_UpdateMenu(SelectContext* this) { s32 playerForm; - Input* controller1 = CONTROLLER1(this); + Input* controller1 = CONTROLLER1(&this->state); s32 stickY; s32 pad[2]; s16 i;