Port back improvements from later commits

This commit is contained in:
aaaaaa123456789 2020-10-26 12:31:07 -03:00
parent 1c3d75f673
commit 00db69a302
5 changed files with 83 additions and 83 deletions

View File

@ -182,15 +182,15 @@ static bool32 HandleConditionSearchInput_WaitSetup(struct PokenavSub7 *structPtr
static u32 HandleConditionSearchInput(struct PokenavSub7 *structPtr)
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
return 1;
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
return 2;
else if (gMain.newKeys & DPAD_LEFT)
return 3;
else if (gMain.newKeys & DPAD_RIGHT)
return 4;
else if (gMain.newKeys & B_BUTTON)
if (JOY_REPEAT(DPAD_UP))
return CONDITION_SEARCH_FUNC_MOVE_UP;
else if (JOY_REPEAT(DPAD_DOWN))
return CONDITION_SEARCH_FUNC_MOVE_DOWN;
else if (JOY_NEW(DPAD_LEFT))
return CONDITION_SEARCH_FUNC_PAGE_UP;
else if (JOY_NEW(DPAD_RIGHT))
return CONDITION_SEARCH_FUNC_PAGE_DOWN;
else if (JOY_NEW(B_BUTTON))
{
structPtr->isPartyCondition = 0;
structPtr->callback = ReturnToConditionSearchList;
@ -204,7 +204,7 @@ static u32 HandleConditionSearchInput(struct PokenavSub7 *structPtr)
return CONDITION_SEARCH_FUNC_SELECT_MON;
}
else
return 0;
return CONDITION_SEARCH_FUNC_NONE;
}
static u32 ReturnToConditionSearchList(struct PokenavSub7 *structPtr)

View File

@ -251,8 +251,8 @@ static u32 HandleMainMenuInput(struct Pokenav1Struct *state)
}
}
if (gMain.newKeys & B_BUTTON)
return -1;
if (JOY_NEW(B_BUTTON))
return POKENAV_MENU_FUNC_EXIT;
return POKENAV_MENU_FUNC_NONE;
}

View File

@ -174,21 +174,21 @@ static u32 HandleRibbonsMonListInput_WaitListInit(struct PokenavSub9 *structPtr)
static u32 HandleRibbonsMonListInput(struct PokenavSub9 *structPtr)
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
return 1;
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
return 2;
if (gMain.newKeys & DPAD_LEFT)
return 3;
if (gMain.newKeys & DPAD_RIGHT)
return 4;
if (gMain.newKeys & B_BUTTON)
if (JOY_REPEAT(DPAD_UP))
return RIBBONS_MON_LIST_FUNC_MOVE_UP;
if (JOY_REPEAT(DPAD_DOWN))
return RIBBONS_MON_LIST_FUNC_MOVE_DOWN;
if (JOY_NEW(DPAD_LEFT))
return RIBBONS_MON_LIST_FUNC_PAGE_UP;
if (JOY_NEW(DPAD_RIGHT))
return RIBBONS_MON_LIST_FUNC_PAGE_DOWN;
if (JOY_NEW(B_BUTTON))
{
structPtr->saveMonList = 0;
structPtr->callback = RibbonsMonMenu_ReturnToMainMenu;
return RIBBONS_MON_LIST_FUNC_EXIT;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
structPtr->monList->currIndex = GetSelectedPokenavListIndex();
structPtr->saveMonList = 1;

View File

@ -198,26 +198,26 @@ void FreeRibbonsSummaryScreen1(void)
u32 RibbonsSummaryHandleInput(struct PokenavSub13 *structPtr)
{
if (gMain.newAndRepeatedKeys & DPAD_UP && structPtr->monList->currIndex != 0)
if (JOY_REPEAT(DPAD_UP) && structPtr->monList->currIndex != 0)
{
structPtr->monList->currIndex--;
structPtr->field_C = 0;
sub_81D0814(structPtr);
return RIBBONS_SUMMARY_FUNC_MOVED_CURSOR;
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN && structPtr->monList->currIndex < structPtr->monList->listCount - 1)
if (JOY_REPEAT(DPAD_DOWN) && structPtr->monList->currIndex < structPtr->monList->listCount - 1)
{
structPtr->monList->currIndex++;
structPtr->field_C = 0;
sub_81D0814(structPtr);
return RIBBONS_SUMMARY_FUNC_MOVED_CURSOR;
}
else if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
structPtr->callback = HandleExpandedRibbonInput;
return RIBBONS_SUMMARY_FUNC_SELECT_RIBBON;
}
else if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
structPtr->callback = ReturnToRibbonsListFromSummary;
return RIBBONS_SUMMARY_FUNC_EXIT;
@ -227,15 +227,15 @@ u32 RibbonsSummaryHandleInput(struct PokenavSub13 *structPtr)
u32 HandleExpandedRibbonInput(struct PokenavSub13 *structPtr)
{
if (gMain.newAndRepeatedKeys & DPAD_UP && sub_81D05DC(structPtr))
return 3;
else if (gMain.newAndRepeatedKeys & DPAD_DOWN && sub_81D061C(structPtr))
return 3;
else if (gMain.newAndRepeatedKeys & DPAD_LEFT && sub_81D0664(structPtr))
return 3;
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT && sub_81D0688(structPtr))
return 3;
else if (gMain.newKeys & B_BUTTON)
if (JOY_REPEAT(DPAD_UP) && sub_81D05DC(structPtr))
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
if (JOY_REPEAT(DPAD_DOWN) && sub_81D061C(structPtr))
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
if (JOY_REPEAT(DPAD_LEFT) && sub_81D0664(structPtr))
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
if (JOY_REPEAT(DPAD_RIGHT) && sub_81D0688(structPtr))
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
if (JOY_NEW(B_BUTTON))
{
structPtr->callback = RibbonsSummaryHandleInput;
return RIBBONS_SUMMARY_FUNC_EXPANDED_CANCEL;

View File

@ -671,14 +671,14 @@ bool32 LoadTrainerHillFloorObjectEventScripts(void)
return TRUE;
}
static u32 GetMetatileForFloor(u8 floorId, u32 bit, u32 arg2, u32 arg3)
static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 stride) // stride is always 16
{
bool8 impassable;
u16 metatile;
u16 elevation;
impassable = (sHillData->floors[floorId].display.collisionData[arg2] >> (15 - bit)) & 1;
metatile = sHillData->floors[floorId].display.metatileData[arg2 * arg3 + bit] + 0x200;
impassable = (sHillData->floors[floorId].display.collisionData[y] >> (15 - x) & 1);
metatile = sHillData->floors[floorId].display.metatileData[stride * y + x] + 0x200;
elevation = 0x3000;
return (((impassable << 10) & METATILE_COLLISION_MASK) | elevation) | (metatile & METATILE_ID_MASK);