mirror of
https://github.com/zeldaret/mm.git
synced 2025-02-24 15:31:00 +00:00
Controller Macros Update (#852)
* macros * Format, I will remember 1 day
This commit is contained in:
parent
d318b1f285
commit
9682995b04
@ -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)
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user