mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Port back improvements from later commits
This commit is contained in:
parent
1c3d75f673
commit
00db69a302
@ -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)
|
||||
|
@ -32,53 +32,53 @@ static u32 (*GetMainMenuInputHandler(void))(struct Pokenav1Struct*);
|
||||
static void SetMenuInputHandler(struct Pokenav1Struct *state);
|
||||
|
||||
// Number of entries - 1 for that menu type
|
||||
static const u8 sLastCursorPositions[] =
|
||||
static const u8 sLastCursorPositions[] =
|
||||
{
|
||||
[POKENAV_MENU_TYPE_DEFAULT] = 2,
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC] = 3,
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS] = 4,
|
||||
[POKENAV_MENU_TYPE_CONDITION] = 2,
|
||||
[POKENAV_MENU_TYPE_DEFAULT] = 2,
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC] = 3,
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS] = 4,
|
||||
[POKENAV_MENU_TYPE_CONDITION] = 2,
|
||||
[POKENAV_MENU_TYPE_CONDITION_SEARCH] = 5
|
||||
};
|
||||
|
||||
static const u8 sMenuItems[][6] =
|
||||
{
|
||||
[POKENAV_MENU_TYPE_DEFAULT] =
|
||||
{
|
||||
POKENAV_MENUITEM_MAP,
|
||||
POKENAV_MENUITEM_CONDITION,
|
||||
[POKENAV_MENU_TYPE_DEFAULT] =
|
||||
{
|
||||
POKENAV_MENUITEM_MAP,
|
||||
POKENAV_MENUITEM_CONDITION,
|
||||
[2 ... 5] = POKENAV_MENUITEM_SWITCH_OFF
|
||||
},
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC] =
|
||||
{
|
||||
POKENAV_MENUITEM_MAP,
|
||||
POKENAV_MENUITEM_CONDITION,
|
||||
POKENAV_MENUITEM_MATCH_CALL,
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC] =
|
||||
{
|
||||
POKENAV_MENUITEM_MAP,
|
||||
POKENAV_MENUITEM_CONDITION,
|
||||
POKENAV_MENUITEM_MATCH_CALL,
|
||||
[3 ... 5] = POKENAV_MENUITEM_SWITCH_OFF
|
||||
},
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS] =
|
||||
{
|
||||
POKENAV_MENUITEM_MAP,
|
||||
POKENAV_MENUITEM_CONDITION,
|
||||
POKENAV_MENUITEM_MATCH_CALL,
|
||||
POKENAV_MENUITEM_RIBBONS,
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS] =
|
||||
{
|
||||
POKENAV_MENUITEM_MAP,
|
||||
POKENAV_MENUITEM_CONDITION,
|
||||
POKENAV_MENUITEM_MATCH_CALL,
|
||||
POKENAV_MENUITEM_RIBBONS,
|
||||
[4 ... 5] = POKENAV_MENUITEM_SWITCH_OFF
|
||||
},
|
||||
[POKENAV_MENU_TYPE_CONDITION] =
|
||||
{
|
||||
POKENAV_MENUITEM_CONDITION_PARTY,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH,
|
||||
POKENAV_MENUITEM_CONDITION_CANCEL,
|
||||
[POKENAV_MENU_TYPE_CONDITION] =
|
||||
{
|
||||
POKENAV_MENUITEM_CONDITION_PARTY,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH,
|
||||
POKENAV_MENUITEM_CONDITION_CANCEL,
|
||||
[3 ... 5] = POKENAV_MENUITEM_SWITCH_OFF
|
||||
},
|
||||
[POKENAV_MENU_TYPE_CONDITION_SEARCH] =
|
||||
{
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_COOL,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_BEAUTY,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_CUTE,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_SMART,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_TOUGH,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_CANCEL
|
||||
[POKENAV_MENU_TYPE_CONDITION_SEARCH] =
|
||||
{
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_COOL,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_BEAUTY,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_CUTE,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_SMART,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_TOUGH,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH_CANCEL
|
||||
},
|
||||
};
|
||||
|
||||
@ -87,13 +87,13 @@ static u8 GetPokenavMainMenuType(void)
|
||||
u8 menuType = POKENAV_MENU_TYPE_DEFAULT;
|
||||
|
||||
if (FlagGet(FLAG_ADDED_MATCH_CALL_TO_POKENAV))
|
||||
{
|
||||
{
|
||||
menuType = POKENAV_MENU_TYPE_UNLOCK_MC;
|
||||
|
||||
if (FlagGet(FLAG_SYS_RIBBON_GET))
|
||||
menuType = POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS;
|
||||
}
|
||||
|
||||
|
||||
return menuType;
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ bool32 PokenavCallback_Init_MainMenuCursorOnMap(void)
|
||||
struct Pokenav1Struct *state = AllocSubstruct(POKENAV_SUBSTRUCT_MAIN_MENU_HANDLER, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = POKENAV_MENUITEM_MAP;
|
||||
state->currMenuItem = POKENAV_MENUITEM_MAP;
|
||||
@ -116,7 +116,7 @@ bool32 PokenavCallback_Init_MainMenuCursorOnMatchCall(void)
|
||||
struct Pokenav1Struct *state = AllocSubstruct(POKENAV_SUBSTRUCT_MAIN_MENU_HANDLER, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = POKENAV_MENUITEM_MATCH_CALL;
|
||||
state->currMenuItem = POKENAV_MENUITEM_MATCH_CALL;
|
||||
@ -130,7 +130,7 @@ bool32 PokenavCallback_Init_MainMenuCursorOnRibbons(void)
|
||||
struct Pokenav1Struct *state = AllocSubstruct(POKENAV_SUBSTRUCT_MAIN_MENU_HANDLER, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = POKENAV_MENUITEM_RIBBONS;
|
||||
state->currMenuItem = POKENAV_MENUITEM_RIBBONS;
|
||||
@ -143,7 +143,7 @@ bool32 PokenavCallback_Init_ConditionMenu(void)
|
||||
struct Pokenav1Struct *state = AllocSubstruct(POKENAV_SUBSTRUCT_MAIN_MENU_HANDLER, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
|
||||
state->menuType = POKENAV_MENU_TYPE_CONDITION;
|
||||
state->cursorPos = 0; //party
|
||||
state->currMenuItem = POKENAV_MENUITEM_CONDITION_PARTY;
|
||||
@ -157,7 +157,7 @@ bool32 PokenavCallback_Init_ConditionSearchMenu(void)
|
||||
struct Pokenav1Struct *state = AllocSubstruct(POKENAV_SUBSTRUCT_MAIN_MENU_HANDLER, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
|
||||
state->menuType = POKENAV_MENU_TYPE_CONDITION_SEARCH;
|
||||
state->cursorPos = GetSelectedConditionSearch();
|
||||
state->currMenuItem = state->cursorPos + POKENAV_MENUITEM_CONDITION_SEARCH_COOL;
|
||||
@ -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;
|
||||
}
|
||||
@ -277,13 +277,13 @@ static u32 HandleMainMenuInputTutorial(struct Pokenav1Struct *state)
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
PlaySE(SE_FAILURE);
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ static u32 HandleMainMenuInputEndTutorial(struct Pokenav1Struct *state)
|
||||
{
|
||||
if (UpdateMenuCursorPos(state))
|
||||
return POKENAV_MENU_FUNC_MOVE_CURSOR;
|
||||
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
u32 menuItem = sMenuItems[state->menuType][state->cursorPos];
|
||||
@ -342,7 +342,7 @@ static u32 HandleConditionMenuInput(struct Pokenav1Struct *state)
|
||||
{
|
||||
if (UpdateMenuCursorPos(state))
|
||||
return POKENAV_MENU_FUNC_MOVE_CURSOR;
|
||||
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
switch (sMenuItems[state->menuType][state->cursorPos])
|
||||
@ -386,7 +386,7 @@ static u32 HandleConditionSearchMenuInput(struct Pokenav1Struct *state)
|
||||
{
|
||||
if (UpdateMenuCursorPos(state))
|
||||
return POKENAV_MENU_FUNC_MOVE_CURSOR;
|
||||
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
u8 menuItem = sMenuItems[state->menuType][state->cursorPos];
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user