summaryrefslogtreecommitdiff
path: root/src/pokedex.c
diff options
context:
space:
mode:
authoraaaaaa123456789 <aaaaaa123456789@acidch.at>2020-11-02 22:02:39 -0300
committeraaaaaa123456789 <aaaaaa123456789@acidch.at>2020-11-02 22:02:39 -0300
commitbacc831aa91d059936bd7c852bf0a0fb44d8f27a (patch)
tree660080b3d0dd091d8827c679f489ffbfb337d3c3 /src/pokedex.c
parent6545745e5997f48e0c853b30b144a10244e7ba20 (diff)
Re-apply joypad macros (minus merge conflicts)
Diffstat (limited to 'src/pokedex.c')
-rw-r--r--src/pokedex.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/pokedex.c b/src/pokedex.c
index 4390f47cb..516cef6a7 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -1672,7 +1672,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);
@@ -1681,7 +1681,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;
@@ -1689,7 +1689,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);
@@ -1703,7 +1703,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;
@@ -1736,7 +1736,7 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId)
}
else
{
- if (gMain.newKeys & A_BUTTON)
+ if (JOY_NEW(A_BUTTON))
{
switch (sPokedexView->menuCursorPos)
{
@@ -1767,18 +1767,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);
@@ -1872,7 +1872,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;
@@ -1884,7 +1884,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;
@@ -1892,7 +1892,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();
@@ -1901,7 +1901,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;
@@ -1933,7 +1933,7 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId)
}
else
{
- if (gMain.newKeys & A_BUTTON)
+ if (JOY_NEW(A_BUTTON))
{
switch (sPokedexView->menuCursorPos)
{
@@ -1969,18 +1969,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);
@@ -2589,7 +2589,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);
@@ -2597,7 +2597,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);
@@ -2605,7 +2605,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;
@@ -2616,7 +2616,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++)
@@ -2665,7 +2665,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)
@@ -2688,7 +2688,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)
@@ -3355,14 +3355,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)
{
@@ -3399,8 +3399,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--;
@@ -3408,8 +3408,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++;
@@ -3629,7 +3629,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));
@@ -3637,7 +3637,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);
@@ -3646,8 +3646,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);
@@ -3656,8 +3656,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)
{
@@ -3809,15 +3809,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;
@@ -4009,7 +4009,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;
@@ -4898,13 +4898,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)
{
@@ -4925,7 +4925,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--;
@@ -4933,7 +4933,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++;
@@ -4972,14 +4972,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)
{
@@ -5014,7 +5014,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];
@@ -5022,7 +5022,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];
@@ -5030,7 +5030,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];
@@ -5038,7 +5038,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];
@@ -5082,7 +5082,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)
{
@@ -5135,7 +5135,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();
@@ -5145,7 +5145,7 @@ static void Task_HandleSearchParameterInput(u8 taskId)
CopyBgTilemapBufferToVram(3);
return;
}
- if (gMain.newKeys & B_BUTTON)
+ if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_BALL);
ClearSearchParameterBoxText();
@@ -5158,7 +5158,7 @@ static void Task_HandleSearchParameterInput(u8 taskId)
return;
}
moved = FALSE;
- if (gMain.newAndRepeatedKeys & DPAD_UP)
+ if (JOY_REPEAT(DPAD_UP))
{
if (*cursorPos != 0)
{
@@ -5184,7 +5184,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)
{