From 6aee7d38f3f3dcbfea7ce6d6d5ddecce740f9ee9 Mon Sep 17 00:00:00 2001 From: PokeCodec Date: Sun, 23 Aug 2020 18:50:57 -0400 Subject: sizeOf data type, not pointer value --- src/pokemon_storage_system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 5f2f5516b..905bbca9a 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -2157,7 +2157,7 @@ static void Cb2_EnterPSS(u8 boxOption) { ResetTasks(); sCurrentBoxOption = boxOption; - sPSSData = Alloc(sizeof(*sPSSData)); + sPSSData = Alloc(sizeof(struct PokemonStorageSystemData)); if (sPSSData == NULL) { SetMainCallback2(Cb2_ExitPSS); @@ -2177,7 +2177,7 @@ static void Cb2_EnterPSS(u8 boxOption) static void Cb2_ReturnToPSS(void) { ResetTasks(); - sPSSData = Alloc(sizeof(*sPSSData)); + sPSSData = Alloc(sizeof(struct PokemonStorageSystemData)); if (sPSSData == NULL) { SetMainCallback2(Cb2_ExitPSS); -- cgit v1.2.3 From 28ef2fb774bf596a3e7f81055453304e0d2ce066 Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Fri, 4 Sep 2020 21:11:55 -0400 Subject: Switch to button macros --- src/pokemon_storage_system.c | 163 ++++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 81 deletions(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index fcca744c2..ae334504e 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1756,10 +1756,10 @@ static void Task_PokemonStorageSystemPC(u8 taskId) { case MENU_NOTHING_CHOSEN: task->data[3] = task->data[1]; - if (gMain.newKeys & DPAD_UP && --task->data[3] < 0) + if (JOY_NEW(DPAD_UP) && --task->data[3] < 0) task->data[3] = 4; - if (gMain.newKeys & DPAD_DOWN && ++task->data[3] > 4) + if (JOY_NEW(DPAD_DOWN) && ++task->data[3] > 4) task->data[3] = 0; if (task->data[1] != task->data[3]) { @@ -1798,13 +1798,13 @@ static void Task_PokemonStorageSystemPC(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { FillWindowPixelBuffer(0, PIXEL_FILL(1)); AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { if (--task->data[1] < 0) task->data[1] = 4; @@ -1814,7 +1814,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId) AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (++task->data[1] > 3) task->data[1] = 0; @@ -1976,22 +1976,22 @@ static void sub_80C78E4(void) static u8 HandleBoxChooseSelectionInput(void) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); return 201; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); return gUnknown_02039D04->curBox; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { PlaySE(SE_SELECT); sub_80C7BB4(); } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { PlaySE(SE_SELECT); sub_80C7B80(); @@ -2393,7 +2393,7 @@ static void Cb_ReshowPSS(u8 taskId) } break; case 2: - if (!IsDma3ManagerBusyWithBgCopy() && gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (!IsDma3ManagerBusyWithBgCopy() && JOY_NEW(A_BUTTON | B_BUTTON)) { ClearBottomWindow(); sPSSData->state++; @@ -2615,7 +2615,7 @@ static void Cb_MainPSS(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state = 0; @@ -2632,7 +2632,7 @@ static void Cb_MainPSS(u8 taskId) sPSSData->state = 6; break; case 6: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -2858,7 +2858,7 @@ static void Cb_OnSelectedMon(u8 taskId) sPSSData->state = 6; break; case 6: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -2943,7 +2943,7 @@ static void Cb_WithdrawMon(u8 taskId) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3034,7 +3034,7 @@ static void Cb_DepositMenu(u8 taskId) } break; case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); sPSSData->state = 1; @@ -3095,14 +3095,14 @@ static void Cb_ReleaseMon(u8 taskId) sPSSData->state++; break; case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_BYE_BYE); sPSSData->state++; } break; case 5: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); if (sInPartyMenu) @@ -3134,14 +3134,14 @@ static void Cb_ReleaseMon(u8 taskId) sPSSData->state++; break; case 9: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_SURPRISE); sPSSData->state++; } break; case 10: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sub_80CC064(); @@ -3157,14 +3157,14 @@ static void Cb_ReleaseMon(u8 taskId) } break; case 12: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_WORRIED); sPSSData->state++; } break; case 13: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3257,7 +3257,7 @@ static void Cb_GiveMovingItemToMon(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3296,7 +3296,7 @@ static void Cb_ItemToBag(u8 taskId) } break; case 2: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sub_80CE00C(); @@ -3309,7 +3309,7 @@ static void Cb_ItemToBag(u8 taskId) SetPSSCallback(Cb_MainPSS); break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3349,7 +3349,7 @@ static void Cb_SwitchSelectedItem(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3388,7 +3388,7 @@ static void Cb_ShowItemInfo(u8 taskId) sPSSData->state++; break; case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PlaySE(SE_WIN_OPEN); sPSSData->state++; @@ -3438,7 +3438,7 @@ static void Cb_CloseBoxWhileHoldingItem(u8 taskId) } break; case 2: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state = 5; @@ -3494,7 +3494,7 @@ static void Cb_PrintCantStoreMail(u8 taskId) sPSSData->state++; break; case 2: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3759,7 +3759,7 @@ static void Cb_OnCloseBoxPressed(u8 taskId) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3820,7 +3820,7 @@ static void Cb_OnBPressed(u8 taskId) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -5462,7 +5462,7 @@ static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) if (direction == 0) return; - else if (direction > 0) + if (direction > 0) x *= 1, x += 0x14; // x * 1 is needed to match, but can be safely removed as it makes no functional difference else x -= 4; @@ -6940,7 +6940,7 @@ static u8 InBoxInput_Normal(void) sPSSData->field_CD3 = 0; sPSSData->field_CD7 = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { retVal = TRUE; if (sBoxCursorPosition >= IN_BOX_ROWS) @@ -6954,7 +6954,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { retVal = TRUE; cursorPosition += IN_BOX_ROWS; @@ -6968,7 +6968,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPEAT(DPAD_LEFT)) { retVal = TRUE; if (sBoxCursorPosition % IN_BOX_ROWS != 0) @@ -6982,7 +6982,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { retVal = TRUE; if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) @@ -6996,7 +6996,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { retVal = TRUE; cursorArea = CURSOR_AREA_BOX; @@ -7004,7 +7004,7 @@ static u8 InBoxInput_Normal(void) break; } - if ((gMain.newKeys & A_BUTTON) && sub_80CFA5C()) + if ((JOY_NEW(A_BUTTON)) && sub_80CFA5C()) { if (!sCanOnlyMove) return 8; @@ -7038,18 +7038,18 @@ static u8 InBoxInput_Normal(void) } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) return 19; if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.heldKeys & L_BUTTON) + if (JOY_HELD(L_BUTTON)) return 10; - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) return 9; } - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { sub_80CFDC4(); return 0; @@ -7067,9 +7067,9 @@ static u8 InBoxInput_Normal(void) static u8 InBoxInput_GrabbingMultiple(void) { - if (gMain.heldKeys & A_BUTTON) + if (JOY_HELD(A_BUTTON)) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { if (sBoxCursorPosition / IN_BOX_ROWS != 0) { @@ -7081,7 +7081,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { if (sBoxCursorPosition + IN_BOX_ROWS < IN_BOX_COUNT) { @@ -7093,7 +7093,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPEAT(DPAD_LEFT)) { if (sBoxCursorPosition % IN_BOX_ROWS != 0) { @@ -7105,7 +7105,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) { @@ -7142,7 +7142,7 @@ static u8 InBoxInput_GrabbingMultiple(void) static u8 InBoxInput_MovingMultiple(void) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { if (sub_80D0580(0)) { @@ -7154,7 +7154,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { if (sub_80D0580(1)) { @@ -7166,7 +7166,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPEAT(DPAD_LEFT)) { if (sub_80D0580(2)) { @@ -7178,7 +7178,7 @@ static u8 InBoxInput_MovingMultiple(void) return 10; } } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { if (sub_80D0580(3)) { @@ -7190,7 +7190,7 @@ static u8 InBoxInput_MovingMultiple(void) return 9; } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { if (sub_80D0BC0()) { @@ -7203,7 +7203,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { return 24; } @@ -7211,9 +7211,9 @@ static u8 InBoxInput_MovingMultiple(void) { if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.heldKeys & L_BUTTON) + if (JOY_HELD(L_BUTTON)) return 10; - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) return 9; } @@ -7238,7 +7238,7 @@ static u8 HandleInput_InParty(void) gotoBox = FALSE; retVal = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { if (--cursorPosition < 0) cursorPosition = PARTY_SIZE; @@ -7246,7 +7246,7 @@ static u8 HandleInput_InParty(void) retVal = 1; break; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { if (++cursorPosition > PARTY_SIZE) cursorPosition = 0; @@ -7254,14 +7254,14 @@ static u8 HandleInput_InParty(void) retVal = 1; break; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT && sBoxCursorPosition != 0) + else if (JOY_REPEAT(DPAD_LEFT) && sBoxCursorPosition != 0) { retVal = 1; sPSSData->field_CD6 = sBoxCursorPosition; cursorPosition = 0; break; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { if (sBoxCursorPosition == 0) { @@ -7277,7 +7277,7 @@ static u8 HandleInput_InParty(void) break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (sBoxCursorPosition == PARTY_SIZE) { @@ -7313,7 +7313,7 @@ static u8 HandleInput_InParty(void) } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { if (sPSSData->boxOption == BOX_OPTION_DEPOSIT) return 19; @@ -7327,7 +7327,7 @@ static u8 HandleInput_InParty(void) cursorArea = CURSOR_AREA_IN_BOX; cursorPosition = 0; } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { sub_80CFDC4(); return 0; @@ -7356,7 +7356,7 @@ static u8 HandleInput_OnBox(void) sPSSData->field_CD2 = 0; sPSSData->field_CD7 = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { retVal = 1; cursorArea = CURSOR_AREA_BUTTONS; @@ -7364,7 +7364,7 @@ static u8 HandleInput_OnBox(void) sPSSData->field_CD7 = 1; break; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { retVal = 1; cursorArea = CURSOR_AREA_IN_BOX; @@ -7372,30 +7372,30 @@ static u8 HandleInput_OnBox(void) break; } - if (gMain.heldKeys & DPAD_LEFT) + if (JOY_HELD(DPAD_LEFT)) return 10; - if (gMain.heldKeys & DPAD_RIGHT) + if (JOY_HELD(DPAD_RIGHT)) return 9; if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.heldKeys & L_BUTTON) + if (JOY_HELD(L_BUTTON)) return 10; - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) return 9; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { sub_80CD1A8(FALSE); AddBoxMenu(); return 7; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) return 19; - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { sub_80CFDC4(); return 0; @@ -7429,7 +7429,7 @@ static u8 HandleInput_OnButtons(void) sPSSData->field_CD2 = 0; sPSSData->field_CD7 = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { retVal = 1; cursorArea = CURSOR_AREA_IN_BOX; @@ -7441,7 +7441,8 @@ static u8 HandleInput_OnButtons(void) sPSSData->field_CD7 = 1; break; } - else if (gMain.newAndRepeatedKeys & (DPAD_DOWN | START_BUTTON)) + + if (JOY_REPEAT(DPAD_DOWN | START_BUTTON)) { retVal = 1; cursorArea = CURSOR_AREA_BOX; @@ -7450,14 +7451,14 @@ static u8 HandleInput_OnButtons(void) break; } - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPEAT(DPAD_LEFT)) { retVal = 1; if (--cursorPosition < 0) cursorPosition = 1; break; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { retVal = 1; if (++cursorPosition > 1) @@ -7465,12 +7466,12 @@ static u8 HandleInput_OnButtons(void) break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) return (cursorPosition == 0) ? 5 : 4; - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) return 19; - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { sub_80CFDC4(); return 0; @@ -7919,23 +7920,23 @@ static s16 sub_80D00AC(void) do { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { textId = Menu_GetCursorPos(); break; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); textId = -1; } - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); -- cgit v1.2.3 From 7dc95a0103af08c95c9093b6efa6c77af77a2538 Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Sun, 13 Sep 2020 04:22:50 -0300 Subject: Undo PokeCodec's PRs This commit undoes most of PokeCodec's PRs after the debate in chat. Some harmless or completely superseded PRs have been left alone, as there is not much benefit in attempting to undo them. Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136, #1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179, #1180, #1181, #1182 and #1183. --- src/pokemon_storage_system.c | 167 +++++++++++++++++++++---------------------- 1 file changed, 83 insertions(+), 84 deletions(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index ae334504e..546f50dce 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1756,10 +1756,10 @@ static void Task_PokemonStorageSystemPC(u8 taskId) { case MENU_NOTHING_CHOSEN: task->data[3] = task->data[1]; - if (JOY_NEW(DPAD_UP) && --task->data[3] < 0) + if (gMain.newKeys & DPAD_UP && --task->data[3] < 0) task->data[3] = 4; - if (JOY_NEW(DPAD_DOWN) && ++task->data[3] > 4) + if (gMain.newKeys & DPAD_DOWN && ++task->data[3] > 4) task->data[3] = 0; if (task->data[1] != task->data[3]) { @@ -1798,13 +1798,13 @@ static void Task_PokemonStorageSystemPC(u8 taskId) } break; case 3: - if (JOY_NEW(A_BUTTON | B_BUTTON)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { FillWindowPixelBuffer(0, PIXEL_FILL(1)); AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; } - else if (JOY_NEW(DPAD_UP)) + else if (gMain.newKeys & DPAD_UP) { if (--task->data[1] < 0) task->data[1] = 4; @@ -1814,7 +1814,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId) AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; } - else if (JOY_NEW(DPAD_DOWN)) + else if (gMain.newKeys & DPAD_DOWN) { if (++task->data[1] > 3) task->data[1] = 0; @@ -1976,22 +1976,22 @@ static void sub_80C78E4(void) static u8 HandleBoxChooseSelectionInput(void) { - if (JOY_NEW(B_BUTTON)) + if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); return 201; } - if (JOY_NEW(A_BUTTON)) + if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); return gUnknown_02039D04->curBox; } - if (JOY_NEW(DPAD_LEFT)) + if (gMain.newKeys & DPAD_LEFT) { PlaySE(SE_SELECT); sub_80C7BB4(); } - else if (JOY_NEW(DPAD_RIGHT)) + else if (gMain.newKeys & DPAD_RIGHT) { PlaySE(SE_SELECT); sub_80C7B80(); @@ -2157,7 +2157,7 @@ static void Cb2_EnterPSS(u8 boxOption) { ResetTasks(); sCurrentBoxOption = boxOption; - sPSSData = Alloc(sizeof(struct PokemonStorageSystemData)); + sPSSData = Alloc(sizeof(*sPSSData)); if (sPSSData == NULL) { SetMainCallback2(Cb2_ExitPSS); @@ -2177,7 +2177,7 @@ static void Cb2_EnterPSS(u8 boxOption) static void Cb2_ReturnToPSS(void) { ResetTasks(); - sPSSData = Alloc(sizeof(struct PokemonStorageSystemData)); + sPSSData = Alloc(sizeof(*sPSSData)); if (sPSSData == NULL) { SetMainCallback2(Cb2_ExitPSS); @@ -2393,7 +2393,7 @@ static void Cb_ReshowPSS(u8 taskId) } break; case 2: - if (!IsDma3ManagerBusyWithBgCopy() && JOY_NEW(A_BUTTON | B_BUTTON)) + if (!IsDma3ManagerBusyWithBgCopy() && gMain.newKeys & (A_BUTTON | B_BUTTON)) { ClearBottomWindow(); sPSSData->state++; @@ -2615,7 +2615,7 @@ static void Cb_MainPSS(u8 taskId) } break; case 3: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state = 0; @@ -2632,7 +2632,7 @@ static void Cb_MainPSS(u8 taskId) sPSSData->state = 6; break; case 6: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -2858,7 +2858,7 @@ static void Cb_OnSelectedMon(u8 taskId) sPSSData->state = 6; break; case 6: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -2943,7 +2943,7 @@ static void Cb_WithdrawMon(u8 taskId) } break; case 1: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3034,7 +3034,7 @@ static void Cb_DepositMenu(u8 taskId) } break; case 4: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); sPSSData->state = 1; @@ -3095,14 +3095,14 @@ static void Cb_ReleaseMon(u8 taskId) sPSSData->state++; break; case 4: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_BYE_BYE); sPSSData->state++; } break; case 5: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); if (sInPartyMenu) @@ -3134,14 +3134,14 @@ static void Cb_ReleaseMon(u8 taskId) sPSSData->state++; break; case 9: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_SURPRISE); sPSSData->state++; } break; case 10: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sub_80CC064(); @@ -3157,14 +3157,14 @@ static void Cb_ReleaseMon(u8 taskId) } break; case 12: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_WORRIED); sPSSData->state++; } break; case 13: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3257,7 +3257,7 @@ static void Cb_GiveMovingItemToMon(u8 taskId) } break; case 3: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3296,7 +3296,7 @@ static void Cb_ItemToBag(u8 taskId) } break; case 2: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sub_80CE00C(); @@ -3309,7 +3309,7 @@ static void Cb_ItemToBag(u8 taskId) SetPSSCallback(Cb_MainPSS); break; case 3: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3349,7 +3349,7 @@ static void Cb_SwitchSelectedItem(u8 taskId) } break; case 3: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3388,7 +3388,7 @@ static void Cb_ShowItemInfo(u8 taskId) sPSSData->state++; break; case 4: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PlaySE(SE_WIN_OPEN); sPSSData->state++; @@ -3438,7 +3438,7 @@ static void Cb_CloseBoxWhileHoldingItem(u8 taskId) } break; case 2: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state = 5; @@ -3494,7 +3494,7 @@ static void Cb_PrintCantStoreMail(u8 taskId) sPSSData->state++; break; case 2: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3759,7 +3759,7 @@ static void Cb_OnCloseBoxPressed(u8 taskId) } break; case 1: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3820,7 +3820,7 @@ static void Cb_OnBPressed(u8 taskId) } break; case 1: - if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -5462,7 +5462,7 @@ static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) if (direction == 0) return; - if (direction > 0) + else if (direction > 0) x *= 1, x += 0x14; // x * 1 is needed to match, but can be safely removed as it makes no functional difference else x -= 4; @@ -6940,7 +6940,7 @@ static u8 InBoxInput_Normal(void) sPSSData->field_CD3 = 0; sPSSData->field_CD7 = 0; - if (JOY_REPEAT(DPAD_UP)) + if (gMain.newAndRepeatedKeys & DPAD_UP) { retVal = TRUE; if (sBoxCursorPosition >= IN_BOX_ROWS) @@ -6954,7 +6954,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (JOY_REPEAT(DPAD_DOWN)) + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) { retVal = TRUE; cursorPosition += IN_BOX_ROWS; @@ -6968,7 +6968,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (JOY_REPEAT(DPAD_LEFT)) + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) { retVal = TRUE; if (sBoxCursorPosition % IN_BOX_ROWS != 0) @@ -6982,7 +6982,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (JOY_REPEAT(DPAD_RIGHT)) + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) { retVal = TRUE; if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) @@ -6996,7 +6996,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (JOY_NEW(START_BUTTON)) + else if (gMain.newKeys & START_BUTTON) { retVal = TRUE; cursorArea = CURSOR_AREA_BOX; @@ -7004,7 +7004,7 @@ static u8 InBoxInput_Normal(void) break; } - if ((JOY_NEW(A_BUTTON)) && sub_80CFA5C()) + if ((gMain.newKeys & A_BUTTON) && sub_80CFA5C()) { if (!sCanOnlyMove) return 8; @@ -7038,18 +7038,18 @@ static u8 InBoxInput_Normal(void) } } - if (JOY_NEW(B_BUTTON)) + if (gMain.newKeys & B_BUTTON) return 19; if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (JOY_HELD(L_BUTTON)) + if (gMain.heldKeys & L_BUTTON) return 10; - if (JOY_HELD(R_BUTTON)) + if (gMain.heldKeys & R_BUTTON) return 9; } - if (JOY_NEW(SELECT_BUTTON)) + if (gMain.newKeys & SELECT_BUTTON) { sub_80CFDC4(); return 0; @@ -7067,9 +7067,9 @@ static u8 InBoxInput_Normal(void) static u8 InBoxInput_GrabbingMultiple(void) { - if (JOY_HELD(A_BUTTON)) + if (gMain.heldKeys & A_BUTTON) { - if (JOY_REPEAT(DPAD_UP)) + if (gMain.newAndRepeatedKeys & DPAD_UP) { if (sBoxCursorPosition / IN_BOX_ROWS != 0) { @@ -7081,7 +7081,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (JOY_REPEAT(DPAD_DOWN)) + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) { if (sBoxCursorPosition + IN_BOX_ROWS < IN_BOX_COUNT) { @@ -7093,7 +7093,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (JOY_REPEAT(DPAD_LEFT)) + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) { if (sBoxCursorPosition % IN_BOX_ROWS != 0) { @@ -7105,7 +7105,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (JOY_REPEAT(DPAD_RIGHT)) + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) { if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) { @@ -7142,7 +7142,7 @@ static u8 InBoxInput_GrabbingMultiple(void) static u8 InBoxInput_MovingMultiple(void) { - if (JOY_REPEAT(DPAD_UP)) + if (gMain.newAndRepeatedKeys & DPAD_UP) { if (sub_80D0580(0)) { @@ -7154,7 +7154,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (JOY_REPEAT(DPAD_DOWN)) + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) { if (sub_80D0580(1)) { @@ -7166,7 +7166,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (JOY_REPEAT(DPAD_LEFT)) + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) { if (sub_80D0580(2)) { @@ -7178,7 +7178,7 @@ static u8 InBoxInput_MovingMultiple(void) return 10; } } - else if (JOY_REPEAT(DPAD_RIGHT)) + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) { if (sub_80D0580(3)) { @@ -7190,7 +7190,7 @@ static u8 InBoxInput_MovingMultiple(void) return 9; } } - else if (JOY_NEW(A_BUTTON)) + else if (gMain.newKeys & A_BUTTON) { if (sub_80D0BC0()) { @@ -7203,7 +7203,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (JOY_NEW(B_BUTTON)) + else if (gMain.newKeys & B_BUTTON) { return 24; } @@ -7211,9 +7211,9 @@ static u8 InBoxInput_MovingMultiple(void) { if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (JOY_HELD(L_BUTTON)) + if (gMain.heldKeys & L_BUTTON) return 10; - if (JOY_HELD(R_BUTTON)) + if (gMain.heldKeys & R_BUTTON) return 9; } @@ -7238,7 +7238,7 @@ static u8 HandleInput_InParty(void) gotoBox = FALSE; retVal = 0; - if (JOY_REPEAT(DPAD_UP)) + if (gMain.newAndRepeatedKeys & DPAD_UP) { if (--cursorPosition < 0) cursorPosition = PARTY_SIZE; @@ -7246,7 +7246,7 @@ static u8 HandleInput_InParty(void) retVal = 1; break; } - else if (JOY_REPEAT(DPAD_DOWN)) + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) { if (++cursorPosition > PARTY_SIZE) cursorPosition = 0; @@ -7254,14 +7254,14 @@ static u8 HandleInput_InParty(void) retVal = 1; break; } - else if (JOY_REPEAT(DPAD_LEFT) && sBoxCursorPosition != 0) + else if (gMain.newAndRepeatedKeys & DPAD_LEFT && sBoxCursorPosition != 0) { retVal = 1; sPSSData->field_CD6 = sBoxCursorPosition; cursorPosition = 0; break; } - else if (JOY_REPEAT(DPAD_RIGHT)) + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) { if (sBoxCursorPosition == 0) { @@ -7277,7 +7277,7 @@ static u8 HandleInput_InParty(void) break; } - if (JOY_NEW(A_BUTTON)) + if (gMain.newKeys & A_BUTTON) { if (sBoxCursorPosition == PARTY_SIZE) { @@ -7313,7 +7313,7 @@ static u8 HandleInput_InParty(void) } } - if (JOY_NEW(B_BUTTON)) + if (gMain.newKeys & B_BUTTON) { if (sPSSData->boxOption == BOX_OPTION_DEPOSIT) return 19; @@ -7327,7 +7327,7 @@ static u8 HandleInput_InParty(void) cursorArea = CURSOR_AREA_IN_BOX; cursorPosition = 0; } - else if (JOY_NEW(SELECT_BUTTON)) + else if (gMain.newKeys & SELECT_BUTTON) { sub_80CFDC4(); return 0; @@ -7356,7 +7356,7 @@ static u8 HandleInput_OnBox(void) sPSSData->field_CD2 = 0; sPSSData->field_CD7 = 0; - if (JOY_REPEAT(DPAD_UP)) + if (gMain.newAndRepeatedKeys & DPAD_UP) { retVal = 1; cursorArea = CURSOR_AREA_BUTTONS; @@ -7364,7 +7364,7 @@ static u8 HandleInput_OnBox(void) sPSSData->field_CD7 = 1; break; } - else if (JOY_REPEAT(DPAD_DOWN)) + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) { retVal = 1; cursorArea = CURSOR_AREA_IN_BOX; @@ -7372,30 +7372,30 @@ static u8 HandleInput_OnBox(void) break; } - if (JOY_HELD(DPAD_LEFT)) + if (gMain.heldKeys & DPAD_LEFT) return 10; - if (JOY_HELD(DPAD_RIGHT)) + if (gMain.heldKeys & DPAD_RIGHT) return 9; if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (JOY_HELD(L_BUTTON)) + if (gMain.heldKeys & L_BUTTON) return 10; - if (JOY_HELD(R_BUTTON)) + if (gMain.heldKeys & R_BUTTON) return 9; } - if (JOY_NEW(A_BUTTON)) + if (gMain.newKeys & A_BUTTON) { sub_80CD1A8(FALSE); AddBoxMenu(); return 7; } - if (JOY_NEW(B_BUTTON)) + if (gMain.newKeys & B_BUTTON) return 19; - if (JOY_NEW(SELECT_BUTTON)) + if (gMain.newKeys & SELECT_BUTTON) { sub_80CFDC4(); return 0; @@ -7429,7 +7429,7 @@ static u8 HandleInput_OnButtons(void) sPSSData->field_CD2 = 0; sPSSData->field_CD7 = 0; - if (JOY_REPEAT(DPAD_UP)) + if (gMain.newAndRepeatedKeys & DPAD_UP) { retVal = 1; cursorArea = CURSOR_AREA_IN_BOX; @@ -7441,8 +7441,7 @@ static u8 HandleInput_OnButtons(void) sPSSData->field_CD7 = 1; break; } - - if (JOY_REPEAT(DPAD_DOWN | START_BUTTON)) + else if (gMain.newAndRepeatedKeys & (DPAD_DOWN | START_BUTTON)) { retVal = 1; cursorArea = CURSOR_AREA_BOX; @@ -7451,14 +7450,14 @@ static u8 HandleInput_OnButtons(void) break; } - if (JOY_REPEAT(DPAD_LEFT)) + if (gMain.newAndRepeatedKeys & DPAD_LEFT) { retVal = 1; if (--cursorPosition < 0) cursorPosition = 1; break; } - else if (JOY_REPEAT(DPAD_RIGHT)) + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) { retVal = 1; if (++cursorPosition > 1) @@ -7466,12 +7465,12 @@ static u8 HandleInput_OnButtons(void) break; } - if (JOY_NEW(A_BUTTON)) + if (gMain.newKeys & A_BUTTON) return (cursorPosition == 0) ? 5 : 4; - if (JOY_NEW(B_BUTTON)) + if (gMain.newKeys & B_BUTTON) return 19; - if (JOY_NEW(SELECT_BUTTON)) + if (gMain.newKeys & SELECT_BUTTON) { sub_80CFDC4(); return 0; @@ -7920,23 +7919,23 @@ static s16 sub_80D00AC(void) do { - if (JOY_NEW(A_BUTTON)) + if (gMain.newKeys & A_BUTTON) { textId = Menu_GetCursorPos(); break; } - else if (JOY_NEW(B_BUTTON)) + else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); textId = -1; } - if (JOY_NEW(DPAD_UP)) + if (gMain.newKeys & DPAD_UP) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } - else if (JOY_NEW(DPAD_DOWN)) + else if (gMain.newKeys & DPAD_DOWN) { PlaySE(SE_SELECT); Menu_MoveCursor(1); -- cgit v1.2.3 From 52598983250fd8ad7b66ff2b9d77046859f169c8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 1 Oct 2020 17:20:38 -0400 Subject: Replace POKEMON_SLOTS_NUMBER --- src/pokemon_storage_system.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index ae334504e..b61aff350 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -41,7 +41,6 @@ #include "constants/moves.h" #include "constants/rgb.h" #include "constants/songs.h" -#include "constants/species.h" struct WallpaperTable { -- cgit v1.2.3 From 2b2be90a5266e294342e1759dddfe8af4d6f39f2 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 10 Oct 2020 16:17:34 -0600 Subject: start pokenav documentation --- src/pokemon_storage_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index b61aff350..4db9fbf92 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -3183,7 +3183,7 @@ static void Cb_ShowMarkMenu(u8 taskId) sPSSData->state++; break; case 1: - if (!sub_811FBA4()) + if (!MonMarkingsMenuHandleInput()) { sub_811FAF8(); ClearBottomWindow(); -- cgit v1.2.3 From bacc831aa91d059936bd7c852bf0a0fb44d8f27a Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Mon, 2 Nov 2020 22:02:39 -0300 Subject: Re-apply joypad macros (minus merge conflicts) --- src/pokemon_storage_system.c | 163 ++++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 81 deletions(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 11c56706a..6efca2562 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1755,10 +1755,10 @@ static void Task_PokemonStorageSystemPC(u8 taskId) { case MENU_NOTHING_CHOSEN: task->data[3] = task->data[1]; - if (gMain.newKeys & DPAD_UP && --task->data[3] < 0) + if (JOY_NEW(DPAD_UP) && --task->data[3] < 0) task->data[3] = 4; - if (gMain.newKeys & DPAD_DOWN && ++task->data[3] > 4) + if (JOY_NEW(DPAD_DOWN) && ++task->data[3] > 4) task->data[3] = 0; if (task->data[1] != task->data[3]) { @@ -1797,13 +1797,13 @@ static void Task_PokemonStorageSystemPC(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { FillWindowPixelBuffer(0, PIXEL_FILL(1)); AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; } - else if (gMain.newKeys & DPAD_UP) + else if (JOY_NEW(DPAD_UP)) { if (--task->data[1] < 0) task->data[1] = 4; @@ -1813,7 +1813,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId) AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { if (++task->data[1] > 3) task->data[1] = 0; @@ -1975,22 +1975,22 @@ static void sub_80C78E4(void) static u8 HandleBoxChooseSelectionInput(void) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); return 201; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); return gUnknown_02039D04->curBox; } - if (gMain.newKeys & DPAD_LEFT) + if (JOY_NEW(DPAD_LEFT)) { PlaySE(SE_SELECT); sub_80C7BB4(); } - else if (gMain.newKeys & DPAD_RIGHT) + else if (JOY_NEW(DPAD_RIGHT)) { PlaySE(SE_SELECT); sub_80C7B80(); @@ -2392,7 +2392,7 @@ static void Cb_ReshowPSS(u8 taskId) } break; case 2: - if (!IsDma3ManagerBusyWithBgCopy() && gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (!IsDma3ManagerBusyWithBgCopy() && JOY_NEW(A_BUTTON | B_BUTTON)) { ClearBottomWindow(); sPSSData->state++; @@ -2614,7 +2614,7 @@ static void Cb_MainPSS(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state = 0; @@ -2631,7 +2631,7 @@ static void Cb_MainPSS(u8 taskId) sPSSData->state = 6; break; case 6: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -2857,7 +2857,7 @@ static void Cb_OnSelectedMon(u8 taskId) sPSSData->state = 6; break; case 6: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -2942,7 +2942,7 @@ static void Cb_WithdrawMon(u8 taskId) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3033,7 +3033,7 @@ static void Cb_DepositMenu(u8 taskId) } break; case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); sPSSData->state = 1; @@ -3094,14 +3094,14 @@ static void Cb_ReleaseMon(u8 taskId) sPSSData->state++; break; case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_BYE_BYE); sPSSData->state++; } break; case 5: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); if (sInPartyMenu) @@ -3133,14 +3133,14 @@ static void Cb_ReleaseMon(u8 taskId) sPSSData->state++; break; case 9: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_SURPRISE); sPSSData->state++; } break; case 10: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sub_80CC064(); @@ -3156,14 +3156,14 @@ static void Cb_ReleaseMon(u8 taskId) } break; case 12: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_WORRIED); sPSSData->state++; } break; case 13: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3256,7 +3256,7 @@ static void Cb_GiveMovingItemToMon(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3295,7 +3295,7 @@ static void Cb_ItemToBag(u8 taskId) } break; case 2: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sub_80CE00C(); @@ -3308,7 +3308,7 @@ static void Cb_ItemToBag(u8 taskId) SetPSSCallback(Cb_MainPSS); break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3348,7 +3348,7 @@ static void Cb_SwitchSelectedItem(u8 taskId) } break; case 3: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3387,7 +3387,7 @@ static void Cb_ShowItemInfo(u8 taskId) sPSSData->state++; break; case 4: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { PlaySE(SE_WIN_OPEN); sPSSData->state++; @@ -3437,7 +3437,7 @@ static void Cb_CloseBoxWhileHoldingItem(u8 taskId) } break; case 2: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state = 5; @@ -3493,7 +3493,7 @@ static void Cb_PrintCantStoreMail(u8 taskId) sPSSData->state++; break; case 2: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); sPSSData->state++; @@ -3758,7 +3758,7 @@ static void Cb_OnCloseBoxPressed(u8 taskId) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3819,7 +3819,7 @@ static void Cb_OnBPressed(u8 taskId) } break; case 1: - if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -5461,7 +5461,7 @@ static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) if (direction == 0) return; - else if (direction > 0) + if (direction > 0) x *= 1, x += 0x14; // x * 1 is needed to match, but can be safely removed as it makes no functional difference else x -= 4; @@ -6939,7 +6939,7 @@ static u8 InBoxInput_Normal(void) sPSSData->field_CD3 = 0; sPSSData->field_CD7 = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { retVal = TRUE; if (sBoxCursorPosition >= IN_BOX_ROWS) @@ -6953,7 +6953,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { retVal = TRUE; cursorPosition += IN_BOX_ROWS; @@ -6967,7 +6967,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPEAT(DPAD_LEFT)) { retVal = TRUE; if (sBoxCursorPosition % IN_BOX_ROWS != 0) @@ -6981,7 +6981,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { retVal = TRUE; if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) @@ -6995,7 +6995,7 @@ static u8 InBoxInput_Normal(void) } break; } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { retVal = TRUE; cursorArea = CURSOR_AREA_BOX; @@ -7003,7 +7003,7 @@ static u8 InBoxInput_Normal(void) break; } - if ((gMain.newKeys & A_BUTTON) && sub_80CFA5C()) + if ((JOY_NEW(A_BUTTON)) && sub_80CFA5C()) { if (!sCanOnlyMove) return 8; @@ -7037,18 +7037,18 @@ static u8 InBoxInput_Normal(void) } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) return 19; if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.heldKeys & L_BUTTON) + if (JOY_HELD(L_BUTTON)) return 10; - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) return 9; } - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { sub_80CFDC4(); return 0; @@ -7066,9 +7066,9 @@ static u8 InBoxInput_Normal(void) static u8 InBoxInput_GrabbingMultiple(void) { - if (gMain.heldKeys & A_BUTTON) + if (JOY_HELD(A_BUTTON)) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { if (sBoxCursorPosition / IN_BOX_ROWS != 0) { @@ -7080,7 +7080,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { if (sBoxCursorPosition + IN_BOX_ROWS < IN_BOX_COUNT) { @@ -7092,7 +7092,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPEAT(DPAD_LEFT)) { if (sBoxCursorPosition % IN_BOX_ROWS != 0) { @@ -7104,7 +7104,7 @@ static u8 InBoxInput_GrabbingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) { @@ -7141,7 +7141,7 @@ static u8 InBoxInput_GrabbingMultiple(void) static u8 InBoxInput_MovingMultiple(void) { - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { if (sub_80D0580(0)) { @@ -7153,7 +7153,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { if (sub_80D0580(1)) { @@ -7165,7 +7165,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + else if (JOY_REPEAT(DPAD_LEFT)) { if (sub_80D0580(2)) { @@ -7177,7 +7177,7 @@ static u8 InBoxInput_MovingMultiple(void) return 10; } } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { if (sub_80D0580(3)) { @@ -7189,7 +7189,7 @@ static u8 InBoxInput_MovingMultiple(void) return 9; } } - else if (gMain.newKeys & A_BUTTON) + else if (JOY_NEW(A_BUTTON)) { if (sub_80D0BC0()) { @@ -7202,7 +7202,7 @@ static u8 InBoxInput_MovingMultiple(void) return 24; } } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { return 24; } @@ -7210,9 +7210,9 @@ static u8 InBoxInput_MovingMultiple(void) { if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.heldKeys & L_BUTTON) + if (JOY_HELD(L_BUTTON)) return 10; - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) return 9; } @@ -7237,7 +7237,7 @@ static u8 HandleInput_InParty(void) gotoBox = FALSE; retVal = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { if (--cursorPosition < 0) cursorPosition = PARTY_SIZE; @@ -7245,7 +7245,7 @@ static u8 HandleInput_InParty(void) retVal = 1; break; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { if (++cursorPosition > PARTY_SIZE) cursorPosition = 0; @@ -7253,14 +7253,14 @@ static u8 HandleInput_InParty(void) retVal = 1; break; } - else if (gMain.newAndRepeatedKeys & DPAD_LEFT && sBoxCursorPosition != 0) + else if (JOY_REPEAT(DPAD_LEFT) && sBoxCursorPosition != 0) { retVal = 1; sPSSData->field_CD6 = sBoxCursorPosition; cursorPosition = 0; break; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { if (sBoxCursorPosition == 0) { @@ -7276,7 +7276,7 @@ static u8 HandleInput_InParty(void) break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (sBoxCursorPosition == PARTY_SIZE) { @@ -7312,7 +7312,7 @@ static u8 HandleInput_InParty(void) } } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { if (sPSSData->boxOption == BOX_OPTION_DEPOSIT) return 19; @@ -7326,7 +7326,7 @@ static u8 HandleInput_InParty(void) cursorArea = CURSOR_AREA_IN_BOX; cursorPosition = 0; } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { sub_80CFDC4(); return 0; @@ -7355,7 +7355,7 @@ static u8 HandleInput_OnBox(void) sPSSData->field_CD2 = 0; sPSSData->field_CD7 = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { retVal = 1; cursorArea = CURSOR_AREA_BUTTONS; @@ -7363,7 +7363,7 @@ static u8 HandleInput_OnBox(void) sPSSData->field_CD7 = 1; break; } - else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + else if (JOY_REPEAT(DPAD_DOWN)) { retVal = 1; cursorArea = CURSOR_AREA_IN_BOX; @@ -7371,30 +7371,30 @@ static u8 HandleInput_OnBox(void) break; } - if (gMain.heldKeys & DPAD_LEFT) + if (JOY_HELD(DPAD_LEFT)) return 10; - if (gMain.heldKeys & DPAD_RIGHT) + if (JOY_HELD(DPAD_RIGHT)) return 9; if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) { - if (gMain.heldKeys & L_BUTTON) + if (JOY_HELD(L_BUTTON)) return 10; - if (gMain.heldKeys & R_BUTTON) + if (JOY_HELD(R_BUTTON)) return 9; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { sub_80CD1A8(FALSE); AddBoxMenu(); return 7; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) return 19; - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { sub_80CFDC4(); return 0; @@ -7428,7 +7428,7 @@ static u8 HandleInput_OnButtons(void) sPSSData->field_CD2 = 0; sPSSData->field_CD7 = 0; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { retVal = 1; cursorArea = CURSOR_AREA_IN_BOX; @@ -7440,7 +7440,8 @@ static u8 HandleInput_OnButtons(void) sPSSData->field_CD7 = 1; break; } - else if (gMain.newAndRepeatedKeys & (DPAD_DOWN | START_BUTTON)) + + if (JOY_REPEAT(DPAD_DOWN | START_BUTTON)) { retVal = 1; cursorArea = CURSOR_AREA_BOX; @@ -7449,14 +7450,14 @@ static u8 HandleInput_OnButtons(void) break; } - if (gMain.newAndRepeatedKeys & DPAD_LEFT) + if (JOY_REPEAT(DPAD_LEFT)) { retVal = 1; if (--cursorPosition < 0) cursorPosition = 1; break; } - else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_RIGHT)) { retVal = 1; if (++cursorPosition > 1) @@ -7464,12 +7465,12 @@ static u8 HandleInput_OnButtons(void) break; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) return (cursorPosition == 0) ? 5 : 4; - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) return 19; - if (gMain.newKeys & SELECT_BUTTON) + if (JOY_NEW(SELECT_BUTTON)) { sub_80CFDC4(); return 0; @@ -7918,23 +7919,23 @@ static s16 sub_80D00AC(void) do { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { textId = Menu_GetCursorPos(); break; } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); textId = -1; } - if (gMain.newKeys & DPAD_UP) + if (JOY_NEW(DPAD_UP)) { PlaySE(SE_SELECT); Menu_MoveCursor(-1); } - else if (gMain.newKeys & DPAD_DOWN) + else if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); Menu_MoveCursor(1); -- cgit v1.2.3 From cad5b57b42b400a7fee048a36a324947b0a12988 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 16 Nov 2020 15:36:38 -0300 Subject: sanityIsBagEgg -> sanityIsBadEgg Fixed a typo. Lunos#4026 --- src/pokemon_storage_system.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 6efca2562..eb288c978 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -6777,11 +6777,11 @@ static void SetCursorMonData(void *pokemon, u8 mode) { u8 *txtPtr; u16 gender; - bool8 sanityIsBagEgg; + bool8 sanityIsBadEgg; sPSSData->cursorMonItem = 0; gender = MON_MALE; - sanityIsBagEgg = FALSE; + sanityIsBadEgg = FALSE; if (mode == MODE_PARTY) { struct Pokemon *mon = (struct Pokemon *)pokemon; @@ -6789,8 +6789,8 @@ static void SetCursorMonData(void *pokemon, u8 mode) sPSSData->cursorMonSpecies = GetMonData(mon, MON_DATA_SPECIES2); if (sPSSData->cursorMonSpecies != SPECIES_NONE) { - sanityIsBagEgg = GetMonData(mon, MON_DATA_SANITY_IS_BAD_EGG); - if (sanityIsBagEgg) + sanityIsBadEgg = GetMonData(mon, MON_DATA_SANITY_IS_BAD_EGG); + if (sanityIsBadEgg) sPSSData->cursorMonIsEgg = TRUE; else sPSSData->cursorMonIsEgg = GetMonData(mon, MON_DATA_IS_EGG); @@ -6813,8 +6813,8 @@ static void SetCursorMonData(void *pokemon, u8 mode) if (sPSSData->cursorMonSpecies != SPECIES_NONE) { u32 otId = GetBoxMonData(boxMon, MON_DATA_OT_ID); - sanityIsBagEgg = GetBoxMonData(boxMon, MON_DATA_SANITY_IS_BAD_EGG); - if (sanityIsBagEgg) + sanityIsBadEgg = GetBoxMonData(boxMon, MON_DATA_SANITY_IS_BAD_EGG); + if (sanityIsBadEgg) sPSSData->cursorMonIsEgg = TRUE; else sPSSData->cursorMonIsEgg = GetBoxMonData(boxMon, MON_DATA_IS_EGG); @@ -6846,7 +6846,7 @@ static void SetCursorMonData(void *pokemon, u8 mode) } else if (sPSSData->cursorMonIsEgg) { - if (sanityIsBagEgg) + if (sanityIsBadEgg) StringCopyPadded(sPSSData->cursorMonNickText, sPSSData->cursorMonNick, CHAR_SPACE, 5); else StringCopyPadded(sPSSData->cursorMonNickText, gText_EggNickname, CHAR_SPACE, 8); -- cgit v1.2.3 From 81d95b9325ed2526ce638744408f453a8169abb4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 12 Dec 2020 23:28:01 -0500 Subject: Use BUGFIX for some inline fixes --- src/pokemon_storage_system.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index eb288c978..db8f3d2bb 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -9329,10 +9329,11 @@ u32 GetBoxMonLevelAt(u8 boxId, u8 boxPosition) { u32 lvl; - // BUG: Missed 'else' statement. if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT && GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) lvl = GetLevelFromBoxMonExp(&gPokemonStoragePtr->boxes[boxId][boxPosition]); - // else + #ifdef BUGFIX + else + #endif lvl = 0; return lvl; -- cgit v1.2.3 From bafbf9240d0f91ee3c38ca4652e3c54b9c503c9b Mon Sep 17 00:00:00 2001 From: Sierraffinity Date: Sat, 26 Dec 2020 17:47:36 -0800 Subject: Add UBFIX for null deref in sub_80D08CC --- src/pokemon_storage_system.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/pokemon_storage_system.c') diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index db8f3d2bb..4be1cf729 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -8408,8 +8408,13 @@ static void sub_80D08CC(void) for (j = sMoveMonsPtr->minRow; j < rowCount; j++) { struct BoxPokemon *boxMon = GetBoxedMonPtr(boxId, boxPosition); - + // UB: possible null dereference +#ifdef UBFIX + if (boxMon != NULL) + sMoveMonsPtr->boxMons[monArrayId] = *boxMon; +#else sMoveMonsPtr->boxMons[monArrayId] = *boxMon; +#endif monArrayId++; boxPosition++; } -- cgit v1.2.3