diff options
author | PokeCodec <67983839+PokeCodec@users.noreply.github.com> | 2020-09-04 21:11:55 -0400 |
---|---|---|
committer | PokeCodec <67983839+PokeCodec@users.noreply.github.com> | 2020-09-04 21:11:55 -0400 |
commit | 28ef2fb774bf596a3e7f81055453304e0d2ce066 (patch) | |
tree | 4a67ad17888cac15c7cb33fa8aced60a2e3bf6dc /src/pokedex.c | |
parent | da582d5258703eb52d8cadb4cbaef4ee7031b833 (diff) |
Switch to button macros
Diffstat (limited to 'src/pokedex.c')
-rw-r--r-- | src/pokedex.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/pokedex.c b/src/pokedex.c index c9fa2f691..e21048ce6 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1673,7 +1673,7 @@ static void Task_HandlePokedexInput(u8 taskId) } else { - if ((gMain.newKeys & A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) + if ((JOY_NEW(A_BUTTON)) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) { UpdateSelectedMonSpriteId(); BeginNormalPaletteFade(~(1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)), 0, 0, 0x10, RGB_BLACK); @@ -1682,7 +1682,7 @@ static void Task_HandlePokedexInput(u8 taskId) PlaySE(SE_PIN); FreeWindowAndBgBuffers(); } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { sPokedexView->menuY = 0; sPokedexView->menuIsOpen = TRUE; @@ -1690,7 +1690,7 @@ static void Task_HandlePokedexInput(u8 taskId) gTasks[taskId].func = Task_HandlePokedexStartMenuInput; PlaySE(SE_SELECT); } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); @@ -1704,7 +1704,7 @@ static void Task_HandlePokedexInput(u8 taskId) PlaySE(SE_PC_LOGIN); FreeWindowAndBgBuffers(); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedex; @@ -1737,7 +1737,7 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId) } else { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { switch (sPokedexView->menuCursorPos) { @@ -1768,18 +1768,18 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId) } //Exit menu when Start or B is pressed - if (gMain.newKeys & (START_BUTTON | B_BUTTON)) + if (JOY_NEW(START_BUTTON | B_BUTTON)) { sPokedexView->menuIsOpen = FALSE; gTasks[taskId].func = Task_HandlePokedexInput; PlaySE(SE_SELECT); } - else if ((gMain.newAndRepeatedKeys & DPAD_UP) && sPokedexView->menuCursorPos != 0) + else if ((JOY_REPEAT(DPAD_UP)) && sPokedexView->menuCursorPos != 0) { sPokedexView->menuCursorPos--; PlaySE(SE_SELECT); } - else if ((gMain.newAndRepeatedKeys & DPAD_DOWN) && sPokedexView->menuCursorPos < 3) + else if ((JOY_REPEAT(DPAD_DOWN)) && sPokedexView->menuCursorPos < 3) { sPokedexView->menuCursorPos++; PlaySE(SE_SELECT); @@ -1873,7 +1873,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else { - if ((gMain.newKeys & A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) + if ((JOY_NEW(A_BUTTON)) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen) { u32 a; @@ -1885,7 +1885,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) PlaySE(SE_PIN); FreeWindowAndBgBuffers(); } - else if (gMain.newKeys & START_BUTTON) + else if (JOY_NEW(START_BUTTON)) { sPokedexView->menuY = 0; sPokedexView->menuIsOpen = TRUE; @@ -1893,7 +1893,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) gTasks[taskId].func = Task_HandleSearchResultsStartMenuInput; PlaySE(SE_SELECT); } - else if (gMain.newKeys & SELECT_BUTTON) + else if (JOY_NEW(SELECT_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tTaskId = LoadSearchMenu(); @@ -1902,7 +1902,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) PlaySE(SE_PC_LOGIN); FreeWindowAndBgBuffers(); } - else if (gMain.newKeys & B_BUTTON) + else if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; @@ -1934,7 +1934,7 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId) } else { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { switch (sPokedexView->menuCursorPos) { @@ -1970,18 +1970,18 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId) } //Exit menu when Start or B is pressed - if (gMain.newKeys & (START_BUTTON | B_BUTTON)) + if (JOY_NEW(START_BUTTON | B_BUTTON)) { sPokedexView->menuIsOpen = FALSE; gTasks[taskId].func = Task_HandleSearchResultsInput; PlaySE(SE_SELECT); } - else if ((gMain.newAndRepeatedKeys & DPAD_UP) && sPokedexView->menuCursorPos) + else if ((JOY_REPEAT(DPAD_UP)) && sPokedexView->menuCursorPos) { sPokedexView->menuCursorPos--; PlaySE(SE_SELECT); } - else if ((gMain.newAndRepeatedKeys & DPAD_DOWN) && sPokedexView->menuCursorPos < 4) + else if ((JOY_REPEAT(DPAD_DOWN)) && sPokedexView->menuCursorPos < 4) { sPokedexView->menuCursorPos++; PlaySE(SE_SELECT); @@ -2590,7 +2590,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) u16 startingPos; u8 scrollDir = 0; - if ((gMain.heldKeys & DPAD_UP) && (selectedMon > 0)) + if ((JOY_HELD(DPAD_UP)) && (selectedMon > 0)) { scrollDir = 1; selectedMon = GetNextPosition(1, selectedMon, 0, sPokedexView->pokemonListCount - 1); @@ -2598,7 +2598,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) CreateMonListEntry(1, selectedMon, ignored); PlaySE(SE_DEX_SCROLL); } - else if ((gMain.heldKeys & DPAD_DOWN) && (selectedMon < sPokedexView->pokemonListCount - 1)) + else if ((JOY_HELD(DPAD_DOWN)) && (selectedMon < sPokedexView->pokemonListCount - 1)) { scrollDir = 2; selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1); @@ -2606,7 +2606,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) CreateMonListEntry(2, selectedMon, ignored); PlaySE(SE_DEX_SCROLL); } - else if ((gMain.newKeys & DPAD_LEFT) && (selectedMon > 0)) + else if ((JOY_NEW(DPAD_LEFT)) && (selectedMon > 0)) { startingPos = selectedMon; @@ -2617,7 +2617,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored) CreateMonSpritesAtPos(selectedMon, 0xE); PlaySE(SE_DEX_PAGE); } - else if ((gMain.newKeys & DPAD_RIGHT) && (selectedMon < sPokedexView->pokemonListCount - 1)) + else if ((JOY_NEW(DPAD_RIGHT)) && (selectedMon < sPokedexView->pokemonListCount - 1)) { startingPos = selectedMon; for (i = 0; i < 7; i++) @@ -2666,7 +2666,7 @@ static bool8 TryDoInfoScreenScroll(void) u16 nextPokemon; u16 selectedPokemon = sPokedexView->selectedPokemon; - if ((gMain.newKeys & DPAD_UP) && selectedPokemon) + if ((JOY_NEW(DPAD_UP)) && selectedPokemon) { nextPokemon = selectedPokemon; while (nextPokemon != 0) @@ -2689,7 +2689,7 @@ static bool8 TryDoInfoScreenScroll(void) return TRUE; } } - else if ((gMain.newKeys & DPAD_DOWN) && selectedPokemon < sPokedexView->pokemonListCount - 1) + else if ((JOY_NEW(DPAD_DOWN)) && selectedPokemon < sPokedexView->pokemonListCount - 1) { nextPokemon = selectedPokemon; while (nextPokemon < sPokedexView->pokemonListCount - 1) @@ -3356,14 +3356,14 @@ static void Task_HandleInfoScreenInput(u8 taskId) PlaySE(SE_DEX_SCROLL); return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_ExitInfoScreen; PlaySE(SE_PC_OFF); return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { switch (sPokedexView->selectedScreen) { @@ -3400,8 +3400,8 @@ static void Task_HandleInfoScreenInput(u8 taskId) } return; } - if (((gMain.newKeys & DPAD_LEFT) - || ((gMain.newKeys & L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + if (((JOY_NEW(DPAD_LEFT)) + || ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) && sPokedexView->selectedScreen > 0) { sPokedexView->selectedScreen--; @@ -3409,8 +3409,8 @@ static void Task_HandleInfoScreenInput(u8 taskId) PlaySE(SE_DEX_PAGE); return; } - if (((gMain.newKeys & DPAD_RIGHT) - || ((gMain.newKeys & R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + if (((JOY_NEW(DPAD_RIGHT)) + || ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) && sPokedexView->selectedScreen < CANCEL_SCREEN) { sPokedexView->selectedScreen++; @@ -3630,7 +3630,7 @@ static void Task_HandleCryScreenInput(u8 taskId) else LoadPlayArrowPalette(FALSE); - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { LoadPlayArrowPalette(TRUE); CryScreenPlayButton(NationalPokedexNumToSpecies(sPokedexListItem->dexNum)); @@ -3638,7 +3638,7 @@ static void Task_HandleCryScreenInput(u8 taskId) } else if (!gPaletteFade.active) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); m4aMPlayContinue(&gMPlayInfo_BGM); @@ -3647,8 +3647,8 @@ static void Task_HandleCryScreenInput(u8 taskId) PlaySE(SE_PC_OFF); return; } - if ((gMain.newKeys & DPAD_LEFT) - || ((gMain.newKeys & L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + if ((JOY_NEW(DPAD_LEFT)) + || ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); m4aMPlayContinue(&gMPlayInfo_BGM); @@ -3657,8 +3657,8 @@ static void Task_HandleCryScreenInput(u8 taskId) PlaySE(SE_DEX_PAGE); return; } - if ((gMain.newKeys & DPAD_RIGHT) - || ((gMain.newKeys & R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + if ((JOY_NEW(DPAD_RIGHT)) + || ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { if (!sPokedexListItem->owned) { @@ -3810,15 +3810,15 @@ static void Task_LoadSizeScreen(u8 taskId) static void Task_HandleSizeScreenInput(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); sPokedexView->screenSwitchState = 1; gTasks[taskId].func = Task_SwitchScreensFromSizeScreen; PlaySE(SE_PC_OFF); } - else if ((gMain.newKeys & DPAD_LEFT) - || ((gMain.newKeys & L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) + else if ((JOY_NEW(DPAD_LEFT)) + || ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); sPokedexView->screenSwitchState = 2; @@ -4010,7 +4010,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) static void Task_HandleCaughtMonPageInput(u8 taskId) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { BeginNormalPaletteFade(0x0000FFFF, 0, 0, 16, RGB_BLACK); gSprites[gTasks[taskId].tMonSpriteId].callback = SpriteCB_SlideCaughtMonToCenter; @@ -4907,13 +4907,13 @@ static void Task_SwitchToSearchMenuTopBar(u8 taskId) static void Task_HandleSearchTopBarInput(u8 taskId) { - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_PC_OFF); gTasks[taskId].func = Task_ExitSearch; return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { switch (gTasks[taskId].tTopBarItem) { @@ -4934,7 +4934,7 @@ static void Task_HandleSearchTopBarInput(u8 taskId) } return; } - if ((gMain.newKeys & DPAD_LEFT) && gTasks[taskId].tTopBarItem > SEARCH_TOPBAR_SEARCH) + if ((JOY_NEW(DPAD_LEFT)) && gTasks[taskId].tTopBarItem > SEARCH_TOPBAR_SEARCH) { PlaySE(SE_DEX_PAGE); gTasks[taskId].tTopBarItem--; @@ -4942,7 +4942,7 @@ static void Task_HandleSearchTopBarInput(u8 taskId) CopyWindowToVram(0, 2); CopyBgTilemapBufferToVram(3); } - if ((gMain.newKeys & DPAD_RIGHT) && gTasks[taskId].tTopBarItem < SEARCH_TOPBAR_CANCEL) + if ((JOY_NEW(DPAD_RIGHT)) && gTasks[taskId].tTopBarItem < SEARCH_TOPBAR_CANCEL) { PlaySE(SE_DEX_PAGE); gTasks[taskId].tTopBarItem++; @@ -4981,14 +4981,14 @@ static void Task_HandleSearchMenuInput(u8 taskId) movementMap = sSearchMovementMap_SearchNatDex; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_BALL); SetDefaultSearchModeAndOrder(taskId); gTasks[taskId].func = Task_SwitchToSearchMenuTopBar; return; } - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (gTasks[taskId].tMenuItem == SEARCH_OK) { @@ -5023,7 +5023,7 @@ static void Task_HandleSearchMenuInput(u8 taskId) return; } - if ((gMain.newKeys & DPAD_LEFT) && movementMap[gTasks[taskId].tMenuItem][0] != 0xFF) + if ((JOY_NEW(DPAD_LEFT)) && movementMap[gTasks[taskId].tMenuItem][0] != 0xFF) { PlaySE(SE_SELECT); gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][0]; @@ -5031,7 +5031,7 @@ static void Task_HandleSearchMenuInput(u8 taskId) CopyWindowToVram(0, 2); CopyBgTilemapBufferToVram(3); } - if ((gMain.newKeys & DPAD_RIGHT) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF) + if ((JOY_NEW(DPAD_RIGHT)) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF) { PlaySE(SE_SELECT); gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][1]; @@ -5039,7 +5039,7 @@ static void Task_HandleSearchMenuInput(u8 taskId) CopyWindowToVram(0, 2); CopyBgTilemapBufferToVram(3); } - if ((gMain.newKeys & DPAD_UP) && movementMap[gTasks[taskId].tMenuItem][2] != 0xFF) + if ((JOY_NEW(DPAD_UP)) && movementMap[gTasks[taskId].tMenuItem][2] != 0xFF) { PlaySE(SE_SELECT); gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][2]; @@ -5047,7 +5047,7 @@ static void Task_HandleSearchMenuInput(u8 taskId) CopyWindowToVram(0, 2); CopyBgTilemapBufferToVram(3); } - if ((gMain.newKeys & DPAD_DOWN) && movementMap[gTasks[taskId].tMenuItem][3] != 0xFF) + if ((JOY_NEW(DPAD_DOWN)) && movementMap[gTasks[taskId].tMenuItem][3] != 0xFF) { PlaySE(SE_SELECT); gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][3]; @@ -5091,7 +5091,7 @@ static void Task_WaitAndCompleteSearch(u8 taskId) static void Task_SearchCompleteWaitForInput(u8 taskId) { - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (sPokedexView->pokemonListCount != 0) { @@ -5144,7 +5144,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) cursorPos = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataCursorPos]; scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset]; maxOption = sSearchOptions[menuItem].numOptions - 1; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_PIN); ClearSearchParameterBoxText(); @@ -5154,7 +5154,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) CopyBgTilemapBufferToVram(3); return; } - if (gMain.newKeys & B_BUTTON) + if (JOY_NEW(B_BUTTON)) { PlaySE(SE_BALL); ClearSearchParameterBoxText(); @@ -5167,7 +5167,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) return; } moved = FALSE; - if (gMain.newAndRepeatedKeys & DPAD_UP) + if (JOY_REPEAT(DPAD_UP)) { if (*cursorPos != 0) { @@ -5193,7 +5193,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) } return; } - if (gMain.newAndRepeatedKeys & DPAD_DOWN) + if (JOY_REPEAT(DPAD_DOWN)) { if (*cursorPos < MAX_SEARCH_PARAM_CURSOR_POS && *cursorPos < maxOption) { |