mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-14 15:43:43 +01:00
Merge with master
This commit is contained in:
commit
834b7b52d3
12
gflib/text.h
12
gflib/text.h
@ -91,6 +91,18 @@
|
||||
#define CHAR_NEWLINE 0xFE
|
||||
#define EOS 0xFF // end of string
|
||||
|
||||
// Special F9 chars
|
||||
#define CHAR_UP_ARROW_2 0x00
|
||||
#define CHAR_DOWN_ARROW_2 0x01
|
||||
#define CHAR_LEFT_ARROW_2 0x02
|
||||
#define CHAR_RIGHT_ARROW_2 0x03
|
||||
#define CHAR_PLUS_2 0x04
|
||||
#define CHAR_LV_2 0x05
|
||||
#define CHAR_PP 0x06
|
||||
#define CHAR_ID 0x07
|
||||
#define CHAR_NO 0x08
|
||||
#define CHAR_UNDERSCORE 0x09
|
||||
|
||||
#define EXT_CTRL_CODE_COLOR 0x1
|
||||
#define EXT_CTRL_CODE_HIGHLIGHT 0x2
|
||||
#define EXT_CTRL_CODE_SHADOW 0x3
|
||||
|
@ -233,15 +233,16 @@
|
||||
#define MON_FEMALE 0xFE
|
||||
#define MON_GENDERLESS 0xFF
|
||||
|
||||
// Constants for AdjustFriendship
|
||||
#define FRIENDSHIP_EVENT_GROW_LEVEL 0
|
||||
#define FRIENDSHIP_EVENT_VITAMIN 1 // unused
|
||||
#define FRIENDSHIP_EVENT_BATTLE_ITEM 2 // unused
|
||||
#define FRIENDSHIP_EVENT_VITAMIN 1 // unused, handled by PokemonUseItemEffects
|
||||
#define FRIENDSHIP_EVENT_BATTLE_ITEM 2 // unused, handled by PokemonUseItemEffects
|
||||
#define FRIENDSHIP_EVENT_LEAGUE_BATTLE 3
|
||||
#define FRIENDSHIP_EVENT_LEARN_TMHM 4
|
||||
#define FRIENDSHIP_EVENT_WALKING 5
|
||||
#define FRIENDSHIP_EVENT_FAINT_SMALL 6
|
||||
#define FRIENDSHIP_EVENT_FAINT_OUTSIDE_BATTLE 7
|
||||
#define FRIENDSHIP_EVENT_FAINT_LARGE 8
|
||||
#define FRIENDSHIP_EVENT_FAINT_FIELD_PSN 7
|
||||
#define FRIENDSHIP_EVENT_FAINT_LARGE 8 // If opponent was >= 30 levels higher. See AdjustFriendshipOnBattleFaint
|
||||
|
||||
#define MAX_FRIENDSHIP 0xFF
|
||||
|
||||
|
@ -414,7 +414,6 @@ void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
|
||||
const u8 *GetTrainerClassNameFromId(u16 trainerId);
|
||||
const u8 *GetTrainerNameFromId(u16 trainerId);
|
||||
bool8 HasTwoFramesAnimation(u16 species);
|
||||
bool8 sub_806F104(void);
|
||||
struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1);
|
||||
void sub_806F47C(u8 id);
|
||||
u8 *sub_806F4F8(u8 id, u8 arg1);
|
||||
|
@ -85,6 +85,39 @@ enum
|
||||
POKENAV_MENU_E,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
POKENAV_MENU_TYPE_DEFAULT,
|
||||
POKENAV_MENU_TYPE_UNLOCK_MC,
|
||||
POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS,
|
||||
POKENAV_MENU_TYPE_CONDITION,
|
||||
POKENAV_MENU_TYPE_CONDITION_SEARCH,
|
||||
POKENAV_MENU_TYPE_COUNT
|
||||
};
|
||||
|
||||
// Global IDs for menu selections
|
||||
// As opposed to the cursor position, which is only relative to the number of options for the current menu
|
||||
enum
|
||||
{
|
||||
POKENAV_MENUITEM_MAP,
|
||||
POKENAV_MENUITEM_CONDITION,
|
||||
POKENAV_MENUITEM_MATCH_CALL,
|
||||
POKENAV_MENUITEM_RIBBONS,
|
||||
POKENAV_MENUITEM_SWITCH_OFF,
|
||||
POKENAV_MENUITEM_CONDITION_PARTY,
|
||||
POKENAV_MENUITEM_CONDITION_SEARCH,
|
||||
POKENAV_MENUITEM_CONDITION_CANCEL,
|
||||
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,
|
||||
};
|
||||
|
||||
// Max menu options (condition search uses 6)
|
||||
#define MAX_POKENAV_MENUITEMS 6
|
||||
|
||||
enum
|
||||
{
|
||||
HELPBAR_NONE,
|
||||
@ -150,6 +183,23 @@ enum
|
||||
[CHECK_PAGE_INTRO_1] = gText_MatchCall##name##_Intro1, \
|
||||
[CHECK_PAGE_INTRO_2] = gText_MatchCall##name##_Intro2}
|
||||
|
||||
|
||||
// Pokenav Function IDs
|
||||
// Indices into the LoopedTask tables for each of the main Pokenav features
|
||||
|
||||
enum
|
||||
{
|
||||
POKENAV_MENU_FUNC_NONE,
|
||||
POKENAV_MENU_FUNC_MOVE_CURSOR,
|
||||
POKENAV_MENU_FUNC_OPEN_CONDITION,
|
||||
POKENAV_MENU_FUNC_RETURN_TO_MAIN,
|
||||
POKENAV_MENU_FUNC_OPEN_CONDITION_SEARCH,
|
||||
POKENAV_MENU_FUNC_RETURN_TO_CONDITION,
|
||||
POKENAV_MENU_FUNC_NO_RIBBON_WINNERS,
|
||||
POKENAV_MENU_FUNC_RESHOW_DESCRIPTION,
|
||||
POKENAV_MENU_FUNC_OPEN_FEATURE,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
POKENAV_MC_FUNC_NONE,
|
||||
@ -171,8 +221,8 @@ enum
|
||||
};
|
||||
|
||||
// pokenav.c
|
||||
void sub_81C7694(u32);
|
||||
u32 sub_81C76AC(void);
|
||||
void SetSelectedConditionSearch(u32);
|
||||
u32 GetSelectedConditionSearch(void);
|
||||
|
||||
void CB2_InitPokeNav(void);
|
||||
u32 CreateLoopedTask(LoopedTask loopedTask, u32 priority);
|
||||
@ -247,7 +297,7 @@ bool32 WaitForPokenavShutdownFade(void);
|
||||
void sub_81C7834(void *func1, void *func2);
|
||||
void ShutdownPokenav(void);
|
||||
|
||||
// pokenav_unk_1.c
|
||||
// pokenav_menu_handler_1.c
|
||||
bool32 PokenavCallback_Init_0(void);
|
||||
bool32 PokenavCallback_Init_4(void);
|
||||
bool32 PokenavCallback_Init_5(void);
|
||||
@ -255,20 +305,20 @@ bool32 PokenavCallback_Init_2(void);
|
||||
bool32 PokenavCallback_Init_3(void);
|
||||
u32 sub_81C941C(void);
|
||||
void sub_81C9430(void);
|
||||
int sub_81C9894(void);
|
||||
int sub_81C98A4(void);
|
||||
int sub_81C98B4(void);
|
||||
int GetPokenavMenuType(void);
|
||||
int GetPokenavCursorPos(void);
|
||||
int GetCurrentMenuItemId(void);
|
||||
u16 GetHelpBarTextId(void);
|
||||
|
||||
// pokenav_unk_2.c
|
||||
// pokenav_menu_handler_2.c
|
||||
bool32 sub_81C9924(void);
|
||||
bool32 sub_81C9940(void);
|
||||
void sub_81C9990(s32 ltIdx);
|
||||
void CreateMenuHandlerLoopedTask(s32 ltIdx);
|
||||
bool32 sub_81C99C0(void);
|
||||
void sub_81C99D4(void);
|
||||
void sub_81CAADC(void);
|
||||
|
||||
// pokenav_unk_3.c
|
||||
// pokenav_match_call_1.c
|
||||
bool32 PokenavCallback_Init_11(void);
|
||||
u32 sub_81CAB24(void);
|
||||
void sub_81CAB38(void);
|
||||
@ -290,13 +340,13 @@ int GetIndexDeltaOfNextCheckPageDown(int index);
|
||||
int GetIndexDeltaOfNextCheckPageUp(int index);
|
||||
bool32 IsRematchEntryRegistered(int index);
|
||||
|
||||
// pokenav_unk_4.c
|
||||
// pokenav_match_call_2.c
|
||||
bool32 sub_81CB260(void);
|
||||
void sub_81CB29C(s32 index);
|
||||
void CreateMatchCallLoopedTask(s32 index);
|
||||
u32 sub_81CB2CC(void);
|
||||
void sub_81CB2E0(void);
|
||||
|
||||
// pokenav_unk_5.c
|
||||
// pokenav_region_map.c
|
||||
u32 PokenavCallback_Init_6(void);
|
||||
void sub_81CC524(void);
|
||||
u32 sub_81CC554(void);
|
||||
@ -305,7 +355,7 @@ void sub_81CC62C(s32);
|
||||
u32 sub_81CC65C(void);
|
||||
void sub_81CC670(void);
|
||||
|
||||
// pokenav_unk_6.c
|
||||
// pokenav_conditions_1.c
|
||||
u32 PokenavCallback_Init_7(void);
|
||||
u32 PokenavCallback_Init_9(void);
|
||||
u32 sub_81CD070(void);
|
||||
@ -324,14 +374,14 @@ u16 sub_81CDD48(void);
|
||||
void *sub_81CDCB4(u8 id);
|
||||
void *sub_81CDCD4(u8 id);
|
||||
|
||||
// pokenav_unk_7.c
|
||||
// pokenav_conditions_2.c
|
||||
bool32 sub_81CDDD4(void);
|
||||
void sub_81CDE2C(s32);
|
||||
u32 sub_81CDE64(void);
|
||||
void sub_81CECA0(void);
|
||||
u8 sub_81CEF14(void);
|
||||
|
||||
// pokenav_unk_8.c
|
||||
// pokenav_conditions_3.c
|
||||
u32 PokenavCallback_Init_8(void);
|
||||
u32 PokenavCallback_Init_10(void);
|
||||
u32 sub_81CEFDC(void);
|
||||
@ -342,7 +392,7 @@ void sub_81CF3A0(s32);
|
||||
u32 sub_81CF3D0(void);
|
||||
void sub_81CF3F8(void);
|
||||
|
||||
// pokenav_unk_9.c
|
||||
// pokenav_ribbons_1.c
|
||||
u32 PokenavCallback_Init_12(void);
|
||||
u32 PokenavCallback_Init_14(void);
|
||||
u32 sub_81CFA34(void);
|
||||
@ -353,7 +403,7 @@ void sub_81CFE40(s32);
|
||||
u32 sub_81CFE70(void);
|
||||
void sub_81CFE98(void);
|
||||
|
||||
// pokenav_unk_10.c
|
||||
// pokenav_ribbons_2.c
|
||||
u32 PokenavCallback_Init_13(void);
|
||||
u32 sub_81D04A0(void);
|
||||
void sub_81D04B8(void);
|
||||
|
@ -2914,8 +2914,11 @@ extern const u8 gText_NumberRegistered[];
|
||||
extern const u8 gText_NumberOfBattles[];
|
||||
extern const u8 gText_Unknown[];
|
||||
extern const u8 gText_TrainerCloseBy[];
|
||||
extern const u8 gText_Call[];
|
||||
extern const u8 gText_Check[];
|
||||
extern const u8 gText_Cancel6[];
|
||||
|
||||
// pokenav_unk_2
|
||||
// Pokenav Menu Handler
|
||||
extern const u8 gText_CheckMapOfHoenn[];
|
||||
extern const u8 gText_CheckPokemonInDetail[];
|
||||
extern const u8 gText_CallRegisteredTrainer[];
|
||||
@ -2932,15 +2935,8 @@ extern const u8 gText_FindToughPokemon[];
|
||||
extern const u8 gText_ReturnToConditionMenu[];
|
||||
extern const u8 gText_NoRibbonWinners[];
|
||||
|
||||
// pokenav_unk_4
|
||||
extern const u8 gText_Call[];
|
||||
extern const u8 gText_Check[];
|
||||
extern const u8 gText_Cancel6[];
|
||||
|
||||
// pokenav_unk_8
|
||||
// Pokenav Ribbons
|
||||
extern const u8 gText_NumberF700[];
|
||||
|
||||
// pokenav_unk_10
|
||||
extern const u8 gText_RibbonsF700[];
|
||||
|
||||
// use_pokeblock
|
||||
|
@ -308,16 +308,16 @@ SECTIONS {
|
||||
src/pokenav.o(.text);
|
||||
src/pokenav_main_menu.o(.text);
|
||||
src/pokenav_match_call_ui.o(.text);
|
||||
src/pokenav_unk_1.o(.text);
|
||||
src/pokenav_unk_2.o(.text);
|
||||
src/pokenav_unk_3.o(.text);
|
||||
src/pokenav_unk_4.o(.text);
|
||||
src/pokenav_unk_5.o(.text);
|
||||
src/pokenav_unk_6.o(.text);
|
||||
src/pokenav_unk_7.o(.text);
|
||||
src/pokenav_unk_8.o(.text);
|
||||
src/pokenav_unk_9.o(.text);
|
||||
src/pokenav_unk_10.o(.text);
|
||||
src/pokenav_menu_handler_1.o(.text);
|
||||
src/pokenav_menu_handler_2.o(.text);
|
||||
src/pokenav_match_call_1.o(.text);
|
||||
src/pokenav_match_call_2.o(.text);
|
||||
src/pokenav_region_map.o(.text);
|
||||
src/pokenav_conditions_1.o(.text);
|
||||
src/pokenav_conditions_2.o(.text);
|
||||
src/pokenav_conditions_3.o(.text);
|
||||
src/pokenav_ribbons_1.o(.text);
|
||||
src/pokenav_ribbons_2.o(.text);
|
||||
src/pokenav_match_call_data.o(.text);
|
||||
src/menu_specialized.o(.text);
|
||||
src/ereader_helpers.o(.text);
|
||||
@ -666,15 +666,15 @@ SECTIONS {
|
||||
src/pokenav.o(.rodata);
|
||||
src/pokenav_main_menu.o(.rodata);
|
||||
src/pokenav_match_call_ui.o(.rodata);
|
||||
src/pokenav_unk_1.o(.rodata);
|
||||
src/pokenav_unk_2.o(.rodata);
|
||||
src/pokenav_unk_3.o(.rodata);
|
||||
src/pokenav_unk_4.o(.rodata);
|
||||
src/pokenav_unk_5.o(.rodata);
|
||||
src/pokenav_unk_7.o(.rodata);
|
||||
src/pokenav_unk_8.o(.rodata);
|
||||
src/pokenav_unk_9.o(.rodata);
|
||||
src/pokenav_unk_10.o(.rodata);
|
||||
src/pokenav_menu_handler_1.o(.rodata);
|
||||
src/pokenav_menu_handler_2.o(.rodata);
|
||||
src/pokenav_match_call_1.o(.rodata);
|
||||
src/pokenav_match_call_2.o(.rodata);
|
||||
src/pokenav_region_map.o(.rodata);
|
||||
src/pokenav_conditions_2.o(.rodata);
|
||||
src/pokenav_conditions_3.o(.rodata);
|
||||
src/pokenav_ribbons_1.o(.rodata);
|
||||
src/pokenav_ribbons_2.o(.rodata);
|
||||
src/pokenav_match_call_data.o(.rodata);
|
||||
src/menu_specialized.o(.rodata);
|
||||
src/ereader_helpers.o(.rodata);
|
||||
|
@ -581,7 +581,7 @@ static void CB2_InitBattleInternal(void)
|
||||
gSaveBlock2Ptr->frontier.disableRecordBattle = FALSE;
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
AdjustFriendship(&gPlayerParty[i], 3);
|
||||
AdjustFriendship(&gPlayerParty[i], FRIENDSHIP_EVENT_LEAGUE_BATTLE);
|
||||
|
||||
gBattleCommunication[MULTIUSE_STATE] = 0;
|
||||
}
|
||||
|
@ -3596,7 +3596,7 @@ static void Cmd_getexp(void)
|
||||
gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterMonId];
|
||||
gBattlescriptCurrInstr = BattleScript_LevelUp;
|
||||
gBattleMoveDamage = (gBattleResources->bufferB[gActiveBattler][2] | (gBattleResources->bufferB[gActiveBattler][3] << 8));
|
||||
AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterMonId], 0);
|
||||
AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterMonId], FRIENDSHIP_EVENT_GROW_LEVEL);
|
||||
|
||||
// update battle mon structure after level up
|
||||
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId && gBattleMons[0].hp)
|
||||
@ -6367,7 +6367,7 @@ static void PutLevelAndGenderOnLvlUpBox(void)
|
||||
txtPtr = gStringVar4;
|
||||
gStringVar4[0] = CHAR_SPECIAL_F9;
|
||||
txtPtr++;
|
||||
txtPtr[0] = 5;
|
||||
txtPtr[0] = CHAR_LV_2;
|
||||
txtPtr++;
|
||||
|
||||
var = (u32)(txtPtr);
|
||||
|
@ -90,13 +90,13 @@ void AdjustFriendshipOnBattleFaint(u8 battlerId)
|
||||
if (gBattleMons[opposingBattlerId].level > gBattleMons[battlerId].level)
|
||||
{
|
||||
if (gBattleMons[opposingBattlerId].level - gBattleMons[battlerId].level > 29)
|
||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 8);
|
||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_LARGE);
|
||||
else
|
||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 6);
|
||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_SMALL);
|
||||
}
|
||||
else
|
||||
{
|
||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 6);
|
||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_SMALL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ static void FaintFromFieldPoison(u8 partyIdx)
|
||||
struct Pokemon *pokemon = gPlayerParty + partyIdx;
|
||||
u32 status = STATUS1_NONE;
|
||||
|
||||
AdjustFriendship(pokemon, 0x07);
|
||||
AdjustFriendship(pokemon, FRIENDSHIP_EVENT_FAINT_FIELD_PSN);
|
||||
SetMonData(pokemon, MON_DATA_STATUS, &status);
|
||||
GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1);
|
||||
StringGetEnd10(gStringVar1);
|
||||
|
@ -432,8 +432,8 @@ struct ListBuffer2 {
|
||||
};
|
||||
|
||||
struct TempWallyStruct {
|
||||
struct ItemSlot bagPocket_Items[30];
|
||||
struct ItemSlot bagPocket_PokeBalls[16];
|
||||
struct ItemSlot bagPocket_Items[BAG_ITEMS_COUNT];
|
||||
struct ItemSlot bagPocket_PokeBalls[BAG_POKEBALLS_COUNT];
|
||||
u16 cursorPosition[POCKETS_COUNT];
|
||||
u16 scrollPosition[POCKETS_COUNT];
|
||||
u8 filler[0x2];
|
||||
@ -445,7 +445,7 @@ EWRAM_DATA struct BagStruct gBagPositionStruct = {0};
|
||||
static EWRAM_DATA struct ListBuffer1 *sListBuffer1 = 0;
|
||||
static EWRAM_DATA struct ListBuffer2 *sListBuffer2 = 0;
|
||||
EWRAM_DATA u16 gSpecialVar_ItemId = 0;
|
||||
static EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0;
|
||||
static EWRAM_DATA struct TempWallyStruct *sTempWallyBag = 0;
|
||||
|
||||
extern u8 *const gPocketNamesStringsTable[];
|
||||
extern u8* gReturnToXStringsTable[];
|
||||
@ -2130,17 +2130,17 @@ void PrepareBagForWallyTutorial(void)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
gUnknown_0203CE80 = AllocZeroed(sizeof(struct TempWallyStruct));
|
||||
memcpy(gUnknown_0203CE80->bagPocket_Items, gSaveBlock1Ptr->bagPocket_Items, sizeof(gSaveBlock1Ptr->bagPocket_Items));
|
||||
memcpy(gUnknown_0203CE80->bagPocket_PokeBalls, gSaveBlock1Ptr->bagPocket_PokeBalls, sizeof(gSaveBlock1Ptr->bagPocket_PokeBalls));
|
||||
gUnknown_0203CE80->pocket = gBagPositionStruct.pocket;
|
||||
sTempWallyBag = AllocZeroed(sizeof(struct TempWallyStruct));
|
||||
memcpy(sTempWallyBag->bagPocket_Items, gSaveBlock1Ptr->bagPocket_Items, sizeof(gSaveBlock1Ptr->bagPocket_Items));
|
||||
memcpy(sTempWallyBag->bagPocket_PokeBalls, gSaveBlock1Ptr->bagPocket_PokeBalls, sizeof(gSaveBlock1Ptr->bagPocket_PokeBalls));
|
||||
sTempWallyBag->pocket = gBagPositionStruct.pocket;
|
||||
for (i = 0; i <= 4; i++)
|
||||
{
|
||||
gUnknown_0203CE80->cursorPosition[i] = gBagPositionStruct.cursorPosition[i];
|
||||
gUnknown_0203CE80->scrollPosition[i] = gBagPositionStruct.scrollPosition[i];
|
||||
sTempWallyBag->cursorPosition[i] = gBagPositionStruct.cursorPosition[i];
|
||||
sTempWallyBag->scrollPosition[i] = gBagPositionStruct.scrollPosition[i];
|
||||
}
|
||||
ClearItemSlots(gSaveBlock1Ptr->bagPocket_Items, 30);
|
||||
ClearItemSlots(gSaveBlock1Ptr->bagPocket_PokeBalls, 16);
|
||||
ClearItemSlots(gSaveBlock1Ptr->bagPocket_Items, BAG_ITEMS_COUNT);
|
||||
ClearItemSlots(gSaveBlock1Ptr->bagPocket_PokeBalls, BAG_POKEBALLS_COUNT);
|
||||
ResetBagScrollPositions();
|
||||
}
|
||||
|
||||
@ -2148,15 +2148,15 @@ void RestoreBagAfterWallyTutorial(void)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
memcpy(gSaveBlock1Ptr->bagPocket_Items, gUnknown_0203CE80->bagPocket_Items, sizeof(gUnknown_0203CE80->bagPocket_Items));
|
||||
memcpy(gSaveBlock1Ptr->bagPocket_PokeBalls, gUnknown_0203CE80->bagPocket_PokeBalls, sizeof(gUnknown_0203CE80->bagPocket_PokeBalls));
|
||||
gBagPositionStruct.pocket = gUnknown_0203CE80->pocket;
|
||||
memcpy(gSaveBlock1Ptr->bagPocket_Items, sTempWallyBag->bagPocket_Items, sizeof(sTempWallyBag->bagPocket_Items));
|
||||
memcpy(gSaveBlock1Ptr->bagPocket_PokeBalls, sTempWallyBag->bagPocket_PokeBalls, sizeof(sTempWallyBag->bagPocket_PokeBalls));
|
||||
gBagPositionStruct.pocket = sTempWallyBag->pocket;
|
||||
for (i = 0; i <= 4; i++)
|
||||
{
|
||||
gBagPositionStruct.cursorPosition[i] = gUnknown_0203CE80->cursorPosition[i];
|
||||
gBagPositionStruct.scrollPosition[i] = gUnknown_0203CE80->scrollPosition[i];
|
||||
gBagPositionStruct.cursorPosition[i] = sTempWallyBag->cursorPosition[i];
|
||||
gBagPositionStruct.scrollPosition[i] = sTempWallyBag->scrollPosition[i];
|
||||
}
|
||||
Free(gUnknown_0203CE80);
|
||||
Free(sTempWallyBag);
|
||||
}
|
||||
|
||||
void DoWallyTutorialBagMenu(void)
|
||||
|
@ -955,7 +955,7 @@ static u8 *sub_81D2CD0(u8 *dst, u16 boxId, u16 monId)
|
||||
*(str++) = 9;
|
||||
*(str++) = CHAR_SLASH;
|
||||
*(str++) = CHAR_SPECIAL_F9;
|
||||
*(str++) = 5;
|
||||
*(str++) = CHAR_LV_2;
|
||||
str = ConvertIntToDecimalStringN(str, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
*(str++) = CHAR_SPACE;
|
||||
*str = EOS;
|
||||
|
@ -4701,7 +4701,7 @@ static void Task_LearnedMove(u8 taskId)
|
||||
|
||||
if (move[1] == 0)
|
||||
{
|
||||
AdjustFriendship(mon, 4);
|
||||
AdjustFriendship(mon, FRIENDSHIP_EVENT_LEARN_TMHM);
|
||||
if (item < ITEM_HM01_CUT)
|
||||
RemoveBagItem(item, 1);
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ static void DecryptBoxMon(struct BoxPokemon *boxMon);
|
||||
static void sub_806E6CC(u8 taskId);
|
||||
static bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId);
|
||||
static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
|
||||
static bool8 ShouldSkipFriendshipChange(void);
|
||||
|
||||
// EWRAM vars
|
||||
EWRAM_DATA static u8 sLearningMoveTableID = 0;
|
||||
@ -73,7 +74,21 @@ EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL};
|
||||
|
||||
// const rom data
|
||||
#include "data/battle_moves.h"
|
||||
static const u8 sUnreferencedData[] = {0x34, 0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00};
|
||||
|
||||
// Used in an unreferenced function in RS.
|
||||
// Unreferenced here and in FRLG.
|
||||
struct CombinedMove
|
||||
{
|
||||
u16 move1;
|
||||
u16 move2;
|
||||
u16 newMove;
|
||||
};
|
||||
|
||||
static const struct CombinedMove sCombinedMoves[2] =
|
||||
{
|
||||
{MOVE_EMBER, MOVE_GUST, MOVE_HEAT_WAVE},
|
||||
{0xFFFF, 0xFFFF, 0xFFFF}
|
||||
};
|
||||
|
||||
#define SPECIES_TO_HOENN(name) [SPECIES_##name - 1] = HOENN_DEX_##name
|
||||
#define SPECIES_TO_NATIONAL(name) [SPECIES_##name - 1] = NATIONAL_DEX_##name
|
||||
@ -1872,12 +1887,12 @@ const u8 gStatStageRatios[][2] =
|
||||
|
||||
static const u8 sDeoxysBaseStats[] =
|
||||
{
|
||||
50, // Hp
|
||||
95, // Attack
|
||||
90, // Defense
|
||||
180, // Speed
|
||||
95, // Sp.Attack
|
||||
90, // Sp.Defense
|
||||
[STAT_HP] = 50,
|
||||
[STAT_ATK] = 95,
|
||||
[STAT_DEF] = 90,
|
||||
[STAT_SPEED] = 180,
|
||||
[STAT_SPATK] = 95,
|
||||
[STAT_SPDEF] = 90,
|
||||
};
|
||||
|
||||
const u16 gLinkPlayerFacilityClasses[] =
|
||||
@ -2028,17 +2043,19 @@ static const u8 sStatsToRaise[] =
|
||||
STAT_ATK, STAT_ATK, STAT_SPEED, STAT_DEF, STAT_SPATK, STAT_ACC
|
||||
};
|
||||
|
||||
static const s8 gUnknown_08329ECE[][3] =
|
||||
// 3 modifiers each for how much to change friendship for different ranges
|
||||
// 0-99, 100-199, 200+
|
||||
static const s8 sFriendshipEventModifiers[][3] =
|
||||
{
|
||||
{ 5, 3, 2},
|
||||
{ 5, 3, 2},
|
||||
{ 1, 1, 0},
|
||||
{ 3, 2, 1},
|
||||
{ 1, 1, 0},
|
||||
{ 1, 1, 1},
|
||||
{-1, -1, -1},
|
||||
{-5, -5, -10},
|
||||
{-5, -5, -10},
|
||||
[FRIENDSHIP_EVENT_GROW_LEVEL] = { 5, 3, 2},
|
||||
[FRIENDSHIP_EVENT_VITAMIN] = { 5, 3, 2},
|
||||
[FRIENDSHIP_EVENT_BATTLE_ITEM] = { 1, 1, 0},
|
||||
[FRIENDSHIP_EVENT_LEAGUE_BATTLE] = { 3, 2, 1},
|
||||
[FRIENDSHIP_EVENT_LEARN_TMHM] = { 1, 1, 0},
|
||||
[FRIENDSHIP_EVENT_WALKING] = { 1, 1, 1},
|
||||
[FRIENDSHIP_EVENT_FAINT_SMALL] = {-1, -1, -1},
|
||||
[FRIENDSHIP_EVENT_FAINT_FIELD_PSN] = {-5, -5, -10},
|
||||
[FRIENDSHIP_EVENT_FAINT_LARGE] = {-5, -5, -10},
|
||||
};
|
||||
|
||||
static const u16 sHMMoves[] =
|
||||
@ -4785,7 +4802,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100 && (retVal == 0 || var_28 != 0) && !sub_806F104() && var_34 == 0)
|
||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100 && (retVal == 0 || var_28 != 0) && !ShouldSkipFriendshipChange() && var_34 == 0)
|
||||
{
|
||||
var_34 = itemEffect[var_3C];
|
||||
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
|
||||
@ -4811,7 +4828,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
break;
|
||||
case 6:
|
||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 100 && GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 200
|
||||
&& (retVal == 0 || var_28 != 0) && !sub_806F104() && var_34 == 0)
|
||||
&& (retVal == 0 || var_28 != 0) && !ShouldSkipFriendshipChange() && var_34 == 0)
|
||||
{
|
||||
var_34 = itemEffect[var_3C];
|
||||
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
|
||||
@ -4836,7 +4853,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
var_3C++;
|
||||
break;
|
||||
case 7:
|
||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200 && (retVal == 0 || var_28 != 0) && !sub_806F104() && var_34 == 0)
|
||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200 && (retVal == 0 || var_28 != 0) && !ShouldSkipFriendshipChange() && var_34 == 0)
|
||||
{
|
||||
var_34 = itemEffect[var_3C];
|
||||
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
|
||||
@ -5454,12 +5471,18 @@ u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
|
||||
return n;
|
||||
}
|
||||
|
||||
#define IS_LEAGUE_BATTLE \
|
||||
((gBattleTypeFlags & BATTLE_TYPE_TRAINER) \
|
||||
&& (gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR \
|
||||
|| gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_LEADER \
|
||||
|| gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_CHAMPION)) \
|
||||
|
||||
void AdjustFriendship(struct Pokemon *mon, u8 event)
|
||||
{
|
||||
u16 species, heldItem;
|
||||
u8 holdEffect;
|
||||
|
||||
if (sub_806F104())
|
||||
if (ShouldSkipFriendshipChange())
|
||||
return;
|
||||
|
||||
species = GetMonData(mon, MON_DATA_SPECIES2, 0);
|
||||
@ -5481,18 +5504,16 @@ void AdjustFriendship(struct Pokemon *mon, u8 event)
|
||||
{
|
||||
u8 friendshipLevel = 0;
|
||||
s16 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, 0);
|
||||
|
||||
if (friendship > 99)
|
||||
friendshipLevel++;
|
||||
if (friendship > 199)
|
||||
friendshipLevel++;
|
||||
if ((event != 5 || !(Random() & 1))
|
||||
&& (event != 3
|
||||
|| ((gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
&& (gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR
|
||||
|| gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_LEADER
|
||||
|| gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_CHAMPION))))
|
||||
|
||||
if ((event != FRIENDSHIP_EVENT_WALKING || !(Random() & 1))
|
||||
&& (event != FRIENDSHIP_EVENT_LEAGUE_BATTLE || IS_LEAGUE_BATTLE))
|
||||
{
|
||||
s8 mod = gUnknown_08329ECE[event][friendshipLevel];
|
||||
s8 mod = sFriendshipEventModifiers[event][friendshipLevel];
|
||||
if (mod > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP)
|
||||
mod = (150 * mod) / 100;
|
||||
friendship += mod;
|
||||
@ -6493,7 +6514,7 @@ bool8 HasTwoFramesAnimation(u16 species)
|
||||
&& species != SPECIES_UNOWN);
|
||||
}
|
||||
|
||||
bool8 sub_806F104(void)
|
||||
static bool8 ShouldSkipFriendshipChange(void)
|
||||
{
|
||||
if (gMain.inBattle && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER))
|
||||
return TRUE;
|
||||
|
@ -6898,7 +6898,7 @@ static void SetCursorMonData(void *pokemon, u8 mode)
|
||||
*(txtPtr++) = 3;
|
||||
*(txtPtr++) = 0;
|
||||
*(txtPtr++) = CHAR_SPECIAL_F9;
|
||||
*(txtPtr++) = 5;
|
||||
*(txtPtr++) = CHAR_LV_2;
|
||||
|
||||
txtPtr = ConvertIntToDecimalStringN(txtPtr, sPSSData->cursorMonLevel, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
txtPtr[0] = CHAR_SPACE;
|
||||
|
@ -21,7 +21,7 @@ struct PokenavResources
|
||||
u32 (*currentMenuCb1)(void);
|
||||
u32 currentMenuIndex;
|
||||
u16 mode;
|
||||
u16 fieldA;
|
||||
u16 conditionSearchId;
|
||||
bool32 hasAnyRibbons;
|
||||
void *field10[SUBSTRUCT_COUNT];
|
||||
};
|
||||
@ -57,7 +57,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
|
||||
.unk0 = PokenavCallback_Init_0,
|
||||
.unk4 = sub_81C941C,
|
||||
.unk8 = sub_81C9924,
|
||||
.unkC = sub_81C9990,
|
||||
.unkC = CreateMenuHandlerLoopedTask,
|
||||
.unk10 = sub_81C99C0,
|
||||
.unk14 = sub_81C9430,
|
||||
.unk18 = sub_81C99D4,
|
||||
@ -66,7 +66,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
|
||||
.unk0 = PokenavCallback_Init_0,
|
||||
.unk4 = sub_81C941C,
|
||||
.unk8 = sub_81C9940,
|
||||
.unkC = sub_81C9990,
|
||||
.unkC = CreateMenuHandlerLoopedTask,
|
||||
.unk10 = sub_81C99C0,
|
||||
.unk14 = sub_81C9430,
|
||||
.unk18 = sub_81C99D4,
|
||||
@ -75,7 +75,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
|
||||
.unk0 = PokenavCallback_Init_2,
|
||||
.unk4 = sub_81C941C,
|
||||
.unk8 = sub_81C9940,
|
||||
.unkC = sub_81C9990,
|
||||
.unkC = CreateMenuHandlerLoopedTask,
|
||||
.unk10 = sub_81C99C0,
|
||||
.unk14 = sub_81C9430,
|
||||
.unk18 = sub_81C99D4,
|
||||
@ -84,7 +84,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
|
||||
.unk0 = PokenavCallback_Init_3,
|
||||
.unk4 = sub_81C941C,
|
||||
.unk8 = sub_81C9940,
|
||||
.unkC = sub_81C9990,
|
||||
.unkC = CreateMenuHandlerLoopedTask,
|
||||
.unk10 = sub_81C99C0,
|
||||
.unk14 = sub_81C9430,
|
||||
.unk18 = sub_81C99D4,
|
||||
@ -93,7 +93,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
|
||||
.unk0 = PokenavCallback_Init_4,
|
||||
.unk4 = sub_81C941C,
|
||||
.unk8 = sub_81C9940,
|
||||
.unkC = sub_81C9990,
|
||||
.unkC = CreateMenuHandlerLoopedTask,
|
||||
.unk10 = sub_81C99C0,
|
||||
.unk14 = sub_81C9430,
|
||||
.unk18 = sub_81C99D4,
|
||||
@ -102,7 +102,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
|
||||
.unk0 = PokenavCallback_Init_5,
|
||||
.unk4 = sub_81C941C,
|
||||
.unk8 = sub_81C9940,
|
||||
.unkC = sub_81C9990,
|
||||
.unkC = CreateMenuHandlerLoopedTask,
|
||||
.unk10 = sub_81C99C0,
|
||||
.unk14 = sub_81C9430,
|
||||
.unk18 = sub_81C99D4,
|
||||
@ -156,7 +156,7 @@ const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
|
||||
.unk0 = PokenavCallback_Init_11,
|
||||
.unk4 = sub_81CAB24,
|
||||
.unk8 = sub_81CB260,
|
||||
.unkC = sub_81CB29C,
|
||||
.unkC = CreateMatchCallLoopedTask,
|
||||
.unk10 = sub_81CB2CC,
|
||||
.unk14 = sub_81CAB38,
|
||||
.unk18 = sub_81CB2E0,
|
||||
@ -554,18 +554,18 @@ void SetPokenavMode(u16 mode)
|
||||
gPokenavResources->mode = mode;
|
||||
}
|
||||
|
||||
void sub_81C7694(u32 a0)
|
||||
void SetSelectedConditionSearch(u32 cursorPos)
|
||||
{
|
||||
u32 value = a0;
|
||||
u32 searchId = cursorPos;
|
||||
|
||||
if (value > 4)
|
||||
value = 0;
|
||||
gPokenavResources->fieldA = value;
|
||||
if (searchId > POKENAV_MENUITEM_CONDITION_SEARCH_TOUGH - POKENAV_MENUITEM_CONDITION_SEARCH_COOL)
|
||||
searchId = 0;
|
||||
gPokenavResources->conditionSearchId = searchId;
|
||||
}
|
||||
|
||||
u32 sub_81C76AC(void)
|
||||
u32 GetSelectedConditionSearch(void)
|
||||
{
|
||||
return gPokenavResources->fieldA;
|
||||
return gPokenavResources->conditionSearchId;
|
||||
}
|
||||
|
||||
bool32 CanViewRibbonsMenu(void)
|
||||
|
@ -147,9 +147,9 @@ u32 sub_81CD110(struct PokenavSub11 *structPtr)
|
||||
u32 sub_81CD19C(struct PokenavSub11 *structPtr)
|
||||
{
|
||||
if (structPtr->unk6300 == 0)
|
||||
return 100002;
|
||||
return POKENAV_MENU_2;
|
||||
else
|
||||
return 100010;
|
||||
return POKENAV_MENU_A;
|
||||
}
|
||||
|
||||
void sub_81CD1C0(void)
|
||||
@ -402,7 +402,7 @@ u8 *sub_81CD624(u8 *str, u16 id, bool8 arg3)
|
||||
*(str_++) = 9;
|
||||
*(str_++) = CHAR_SLASH;
|
||||
*(str_++) = CHAR_SPECIAL_F9;
|
||||
*(str_++) = 5;
|
||||
*(str_++) = CHAR_LV_2;
|
||||
txtPtr = str_;
|
||||
str_ = ConvertIntToDecimalStringN(str_, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
lvlDigits = str_ - txtPtr;
|
@ -113,9 +113,9 @@ static const struct WindowTemplate gUnknown_086235B4 =
|
||||
.baseBlock = 20
|
||||
};
|
||||
|
||||
static const u8 gUnknown_086235BC[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GREEN}♂{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
static const u8 gUnknown_086235C8[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
static const u8 gUnknown_086235D4[] = _("{UNK_SPACER}");
|
||||
static const u8 sText_MaleSymbol[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GREEN}♂{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
static const u8 sText_FemaleSymbol[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
static const u8 sText_NoGenderSymbol[] = _("{UNK_SPACER}");
|
||||
|
||||
bool32 PokenavCallback_Init_8(void)
|
||||
{
|
||||
@ -130,7 +130,7 @@ bool32 PokenavCallback_Init_8(void)
|
||||
structPtr->unk0 = sub_81CF010;
|
||||
structPtr->loopedTaskId = CreateLoopedTask(sub_81CF11C, 1);
|
||||
structPtr->unk18 = 0;
|
||||
structPtr->unk14 = gUnknown_086233A0[sub_81C76AC()];
|
||||
structPtr->unk14 = gUnknown_086233A0[GetSelectedConditionSearch()];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ bool32 PokenavCallback_Init_10(void)
|
||||
structPtr->unkPtr = GetSubstructPtr(18);
|
||||
structPtr->unk0 = sub_81CF030;
|
||||
structPtr->unk18 = 1;
|
||||
structPtr->unk14 = gUnknown_086233A0[sub_81C76AC()];
|
||||
structPtr->unk14 = gUnknown_086233A0[GetSelectedConditionSearch()];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ static u32 sub_81CF418(s32 state)
|
||||
HideBg(3);
|
||||
if (!unk->unkC)
|
||||
{
|
||||
u8 r4 = sub_81C76AC() + 8;
|
||||
u8 r4 = GetSelectedConditionSearch() + POKENAV_MENUITEM_CONDITION_SEARCH_COOL;
|
||||
LoadLeftHeaderGfxForIndex(r4);
|
||||
sub_81C7FA0(r4, 1, 0);
|
||||
sub_81C7FA0(1, 1, 0);
|
||||
@ -673,13 +673,16 @@ static void sub_81CF8E4(struct PokenavMonList * item, u8 * dest)
|
||||
u8 level;
|
||||
u8 * s;
|
||||
const u8 * genderStr;
|
||||
if (item->boxId == 14)
|
||||
|
||||
// Mon is in party
|
||||
if (item->boxId == TOTAL_BOXES_COUNT)
|
||||
{
|
||||
struct Pokemon * mon = &gPlayerParty[item->monId];
|
||||
gender = GetMonGender(mon);
|
||||
level = GetLevelFromMonExp(mon);
|
||||
GetMonData(mon, MON_DATA_NICKNAME, gStringVar3);
|
||||
}
|
||||
// Mon is in PC
|
||||
else
|
||||
{
|
||||
struct BoxPokemon * mon = GetBoxedMonPtr(item->boxId, item->monId);
|
||||
@ -687,24 +690,25 @@ static void sub_81CF8E4(struct PokenavMonList * item, u8 * dest)
|
||||
level = GetLevelFromBoxMonExp(mon);
|
||||
GetBoxMonData(mon, MON_DATA_NICKNAME, gStringVar3);
|
||||
}
|
||||
|
||||
StringGetEnd10(gStringVar3);
|
||||
dest = sub_81DB494(dest, 1, gStringVar3, 60);
|
||||
switch (gender)
|
||||
{
|
||||
default:
|
||||
genderStr = gUnknown_086235D4;
|
||||
genderStr = sText_NoGenderSymbol;
|
||||
break;
|
||||
case MON_MALE:
|
||||
genderStr = gUnknown_086235BC;
|
||||
genderStr = sText_MaleSymbol;
|
||||
break;
|
||||
case MON_FEMALE:
|
||||
genderStr = gUnknown_086235C8;
|
||||
genderStr = sText_FemaleSymbol;
|
||||
break;
|
||||
}
|
||||
s = StringCopy(gStringVar1, genderStr);
|
||||
*s++ = CHAR_SLASH;
|
||||
*s++ = CHAR_SPECIAL_F9;
|
||||
*s++ = 5; // LV
|
||||
*s++ = CHAR_LV_2;
|
||||
ConvertIntToDecimalStringN(s, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
sub_81DB494(dest, 1, gStringVar1, 40);
|
||||
}
|
@ -286,7 +286,7 @@ bool32 sub_81CB260(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_81CB29C(s32 index)
|
||||
void CreateMatchCallLoopedTask(s32 index)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
state->unk4 = CreateLoopedTask(sMatchCallLoopTaskFuncs[index], 1);
|
513
src/pokenav_menu_handler_1.c
Normal file
513
src/pokenav_menu_handler_1.c
Normal file
@ -0,0 +1,513 @@
|
||||
#include "global.h"
|
||||
#include "pokenav.h"
|
||||
#include "event_data.h"
|
||||
#include "main.h"
|
||||
#include "sound.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
struct Pokenav1Struct
|
||||
{
|
||||
u16 menuType;
|
||||
s16 cursorPos;
|
||||
u16 currMenuItem;
|
||||
u16 helpBarIndex;
|
||||
u32 unk8;
|
||||
u32 (*callback)(struct Pokenav1Struct*);
|
||||
};
|
||||
|
||||
static bool32 UpdateMenuCursorPos(struct Pokenav1Struct *state);
|
||||
static void ReturnToConditionMenu(struct Pokenav1Struct *state);
|
||||
static void ReturnToMainMenu(struct Pokenav1Struct *state);
|
||||
static u32 sub_81C97BC(struct Pokenav1Struct *state);
|
||||
static void sub_81C97B0(struct Pokenav1Struct *state, u32 a1);
|
||||
static u32 CB2_ReturnToConditionMenu(struct Pokenav1Struct *state);
|
||||
static u32 CB2_ReturnToMainMenu(struct Pokenav1Struct *state);
|
||||
static u32 HandleConditionSearchMenuInput(struct Pokenav1Struct *state);
|
||||
static u32 HandleConditionMenuInput(struct Pokenav1Struct *state);
|
||||
static u32 HandleCantOpenRibbonsInput(struct Pokenav1Struct *state);
|
||||
static u32 HandleMainMenuInputEndTutorial(struct Pokenav1Struct *state);
|
||||
static u32 HandleMainMenuInputTutorial(struct Pokenav1Struct *state);
|
||||
static u32 HandleMainMenuInput(struct Pokenav1Struct *state);
|
||||
static u32 (*GetMainMenuInputHandler(void))(struct Pokenav1Struct*);
|
||||
static void SetMenuInputHandler(struct Pokenav1Struct *state);
|
||||
|
||||
// Number of entries - 1 for that menu type
|
||||
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_CONDITION_SEARCH] = 5
|
||||
};
|
||||
|
||||
static const u8 sMenuItems[][6] =
|
||||
{
|
||||
[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,
|
||||
[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,
|
||||
[4 ... 5] = POKENAV_MENUITEM_SWITCH_OFF
|
||||
},
|
||||
[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
|
||||
},
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_0(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = 0;
|
||||
state->currMenuItem = POKENAV_MENUITEM_MAP;
|
||||
state->helpBarIndex = HELPBAR_NONE;
|
||||
SetMenuInputHandler(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_4(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = 2;
|
||||
state->currMenuItem = POKENAV_MENUITEM_MATCH_CALL;
|
||||
state->helpBarIndex = HELPBAR_NONE;
|
||||
SetMenuInputHandler(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_5(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = 3;
|
||||
state->currMenuItem = POKENAV_MENUITEM_RIBBONS;
|
||||
SetMenuInputHandler(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_2(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = POKENAV_MENU_TYPE_CONDITION;
|
||||
state->cursorPos = 0;
|
||||
state->currMenuItem = POKENAV_MENUITEM_CONDITION_PARTY;
|
||||
state->helpBarIndex = HELPBAR_NONE;
|
||||
SetMenuInputHandler(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_3(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, 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;
|
||||
state->helpBarIndex = HELPBAR_NONE;
|
||||
SetMenuInputHandler(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void SetMenuInputHandler(struct Pokenav1Struct *state)
|
||||
{
|
||||
switch (state->menuType)
|
||||
{
|
||||
case POKENAV_MENU_TYPE_DEFAULT:
|
||||
SetPokenavMode(POKENAV_MODE_NORMAL);
|
||||
// fallthrough
|
||||
case POKENAV_MENU_TYPE_UNLOCK_MC:
|
||||
case POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS:
|
||||
state->callback = GetMainMenuInputHandler();
|
||||
break;
|
||||
case POKENAV_MENU_TYPE_CONDITION:
|
||||
state->callback = HandleConditionMenuInput;
|
||||
break;
|
||||
case POKENAV_MENU_TYPE_CONDITION_SEARCH:
|
||||
state->callback = HandleConditionSearchMenuInput;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 (*GetMainMenuInputHandler(void))(struct Pokenav1Struct*)
|
||||
{
|
||||
switch (GetPokenavMode())
|
||||
{
|
||||
default:
|
||||
case POKENAV_MODE_NORMAL:
|
||||
return HandleMainMenuInput;
|
||||
case POKENAV_MODE_FORCE_CALL_READY:
|
||||
return HandleMainMenuInputTutorial;
|
||||
case POKENAV_MODE_FORCE_CALL_EXIT:
|
||||
return HandleMainMenuInputEndTutorial;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_81C941C(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->callback(state);
|
||||
}
|
||||
|
||||
void sub_81C9430(void)
|
||||
{
|
||||
FreePokenavSubstruct(1);
|
||||
}
|
||||
|
||||
static u32 HandleMainMenuInput(struct Pokenav1Struct *state)
|
||||
{
|
||||
if (UpdateMenuCursorPos(state))
|
||||
return POKENAV_MENU_FUNC_MOVE_CURSOR;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
switch (sMenuItems[state->menuType][state->cursorPos])
|
||||
{
|
||||
case POKENAV_MENUITEM_MAP:
|
||||
state->helpBarIndex = gSaveBlock2Ptr->regionMapZoom ? HELPBAR_MAP_ZOOMED_IN : HELPBAR_MAP_ZOOMED_OUT;
|
||||
sub_81C97B0(state, POKENAV_MENU_6);
|
||||
return POKENAV_MENU_FUNC_OPEN_FEATURE;
|
||||
case POKENAV_MENUITEM_CONDITION:
|
||||
state->menuType = POKENAV_MENU_TYPE_CONDITION;
|
||||
state->cursorPos = 0;
|
||||
state->currMenuItem = sMenuItems[POKENAV_MENU_TYPE_CONDITION][0];
|
||||
state->callback = HandleConditionMenuInput;
|
||||
return POKENAV_MENU_FUNC_OPEN_CONDITION;
|
||||
case POKENAV_MENUITEM_MATCH_CALL:
|
||||
state->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
|
||||
sub_81C97B0(state, POKENAV_MENU_B);
|
||||
return POKENAV_MENU_FUNC_OPEN_FEATURE;
|
||||
case POKENAV_MENUITEM_RIBBONS:
|
||||
if (CanViewRibbonsMenu())
|
||||
{
|
||||
state->helpBarIndex = HELPBAR_RIBBONS_MON_LIST;
|
||||
sub_81C97B0(state, POKENAV_MENU_C);
|
||||
return POKENAV_MENU_FUNC_OPEN_FEATURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->callback = HandleCantOpenRibbonsInput;
|
||||
return POKENAV_MENU_FUNC_NO_RIBBON_WINNERS;
|
||||
}
|
||||
case POKENAV_MENUITEM_SWITCH_OFF:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
return -1;
|
||||
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
// Force the player to select Match Call during the call Mr. Stone pokenav tutorial
|
||||
static u32 HandleMainMenuInputTutorial(struct Pokenav1Struct *state)
|
||||
{
|
||||
if (UpdateMenuCursorPos(state))
|
||||
return POKENAV_MENU_FUNC_MOVE_CURSOR;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
if (sMenuItems[state->menuType][state->cursorPos] == POKENAV_MENUITEM_MATCH_CALL)
|
||||
{
|
||||
state->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
|
||||
sub_81C97B0(state, POKENAV_MENU_B);
|
||||
return POKENAV_MENU_FUNC_OPEN_FEATURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_HAZURE);
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
PlaySE(SE_HAZURE);
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
// After calling Mr. Stone during the pokenav tutorial, force player to exit or use Match Call again
|
||||
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];
|
||||
if (menuItem != POKENAV_MENUITEM_MATCH_CALL && menuItem != POKENAV_MENUITEM_SWITCH_OFF)
|
||||
{
|
||||
PlaySE(SE_HAZURE);
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
else if (menuItem == POKENAV_MENUITEM_MATCH_CALL)
|
||||
{
|
||||
state->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
|
||||
sub_81C97B0(state, POKENAV_MENU_B);
|
||||
return POKENAV_MENU_FUNC_OPEN_FEATURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
// Handles input after selecting Ribbons when there are no ribbon winners left
|
||||
// Selecting it again just reprints the Ribbon description to replace the "No Ribbon winners" message
|
||||
static u32 HandleCantOpenRibbonsInput(struct Pokenav1Struct *state)
|
||||
{
|
||||
if (UpdateMenuCursorPos(state))
|
||||
{
|
||||
state->callback = GetMainMenuInputHandler();
|
||||
return POKENAV_MENU_FUNC_MOVE_CURSOR;
|
||||
}
|
||||
|
||||
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
{
|
||||
state->callback = GetMainMenuInputHandler();
|
||||
return POKENAV_MENU_FUNC_RESHOW_DESCRIPTION;
|
||||
}
|
||||
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
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])
|
||||
{
|
||||
case POKENAV_MENUITEM_CONDITION_SEARCH:
|
||||
state->menuType = POKENAV_MENU_TYPE_CONDITION_SEARCH;
|
||||
state->cursorPos = 0;
|
||||
state->currMenuItem = sMenuItems[POKENAV_MENU_TYPE_CONDITION_SEARCH][0];
|
||||
state->callback = HandleConditionSearchMenuInput;
|
||||
return POKENAV_MENU_FUNC_OPEN_CONDITION_SEARCH;
|
||||
case POKENAV_MENUITEM_CONDITION_PARTY:
|
||||
state->helpBarIndex = 0;
|
||||
sub_81C97B0(state, POKENAV_MENU_7);
|
||||
return POKENAV_MENU_FUNC_OPEN_FEATURE;
|
||||
case POKENAV_MENUITEM_CONDITION_CANCEL:
|
||||
PlaySE(SE_SELECT);
|
||||
ReturnToMainMenu(state);
|
||||
return POKENAV_MENU_FUNC_RETURN_TO_MAIN;
|
||||
}
|
||||
}
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
if (state->cursorPos != sLastCursorPositions[state->menuType])
|
||||
{
|
||||
state->cursorPos = sLastCursorPositions[state->menuType];
|
||||
state->callback = CB2_ReturnToMainMenu;
|
||||
return POKENAV_MENU_FUNC_MOVE_CURSOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ReturnToMainMenu(state);
|
||||
return POKENAV_MENU_FUNC_RETURN_TO_MAIN;
|
||||
}
|
||||
}
|
||||
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
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];
|
||||
if (menuItem != POKENAV_MENUITEM_CONDITION_SEARCH_CANCEL)
|
||||
{
|
||||
SetSelectedConditionSearch(menuItem - POKENAV_MENUITEM_CONDITION_SEARCH_COOL);
|
||||
sub_81C97B0(state, POKENAV_MENU_8);
|
||||
state->helpBarIndex = HELPBAR_CONDITION_MON_LIST;
|
||||
return POKENAV_MENU_FUNC_OPEN_FEATURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ReturnToConditionMenu(state);
|
||||
return POKENAV_MENU_FUNC_RETURN_TO_CONDITION;
|
||||
}
|
||||
}
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
if (state->cursorPos != sLastCursorPositions[state->menuType])
|
||||
{
|
||||
state->cursorPos = sLastCursorPositions[state->menuType];
|
||||
state->callback = CB2_ReturnToConditionMenu;
|
||||
return POKENAV_MENU_FUNC_MOVE_CURSOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ReturnToConditionMenu(state);
|
||||
return POKENAV_MENU_FUNC_RETURN_TO_CONDITION;
|
||||
}
|
||||
}
|
||||
return POKENAV_MENU_FUNC_NONE;
|
||||
}
|
||||
|
||||
static u32 CB2_ReturnToMainMenu(struct Pokenav1Struct *state)
|
||||
{
|
||||
ReturnToMainMenu(state);
|
||||
return POKENAV_MENU_FUNC_RETURN_TO_MAIN;
|
||||
}
|
||||
|
||||
static u32 CB2_ReturnToConditionMenu(struct Pokenav1Struct *state)
|
||||
{
|
||||
ReturnToConditionMenu(state);
|
||||
return POKENAV_MENU_FUNC_RETURN_TO_CONDITION;
|
||||
}
|
||||
|
||||
static void sub_81C97B0(struct Pokenav1Struct *state, u32 a1)
|
||||
{
|
||||
state->unk8 = a1;
|
||||
state->callback = sub_81C97BC;
|
||||
}
|
||||
|
||||
static u32 sub_81C97BC(struct Pokenav1Struct *state)
|
||||
{
|
||||
return state->unk8;
|
||||
}
|
||||
|
||||
static void ReturnToMainMenu(struct Pokenav1Struct *state)
|
||||
{
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = 1;
|
||||
state->currMenuItem = sMenuItems[state->menuType][state->cursorPos];
|
||||
state->callback = HandleMainMenuInput;
|
||||
}
|
||||
|
||||
static void ReturnToConditionMenu(struct Pokenav1Struct *state)
|
||||
{
|
||||
state->menuType = POKENAV_MENU_TYPE_CONDITION;
|
||||
state->cursorPos = 1;
|
||||
state->currMenuItem = sMenuItems[POKENAV_MENU_TYPE_CONDITION][1];
|
||||
state->callback = HandleConditionMenuInput;
|
||||
}
|
||||
|
||||
static bool32 UpdateMenuCursorPos(struct Pokenav1Struct *state)
|
||||
{
|
||||
if (gMain.newKeys & DPAD_UP)
|
||||
{
|
||||
if (--state->cursorPos < 0)
|
||||
state->cursorPos = sLastCursorPositions[state->menuType];
|
||||
|
||||
state->currMenuItem = sMenuItems[state->menuType][state->cursorPos];
|
||||
return TRUE;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_DOWN)
|
||||
{
|
||||
state->cursorPos++;
|
||||
if (state->cursorPos > sLastCursorPositions[state->menuType])
|
||||
state->cursorPos = 0;
|
||||
|
||||
state->currMenuItem = sMenuItems[state->menuType][state->cursorPos];
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int GetPokenavMenuType(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->menuType;
|
||||
}
|
||||
|
||||
// Position of cursor relative to number of current menu options
|
||||
int GetPokenavCursorPos(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->cursorPos;
|
||||
}
|
||||
|
||||
// ID of menu item the cursor is currently on
|
||||
int GetCurrentMenuItemId(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->currMenuItem;
|
||||
}
|
||||
|
||||
u16 GetHelpBarTextId(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->helpBarIndex;
|
||||
}
|
@ -23,31 +23,31 @@ struct Pokenav2Struct
|
||||
{
|
||||
bool32 (*callback)(void);
|
||||
u32 loopedTaskId;
|
||||
u16 optionDescriptionWindowId;
|
||||
u16 optionDescWindowId;
|
||||
u8 bg3ScrollTaskId;
|
||||
u8 cursorPos;
|
||||
bool8 otherIconsInMotion;
|
||||
u8 field_00d;
|
||||
bool32 iconVisible[6];
|
||||
bool32 iconVisible[MAX_POKENAV_MENUITEMS];
|
||||
struct Sprite * field_028;
|
||||
struct Sprite * iconSprites[6][4];
|
||||
struct Sprite * iconSprites[MAX_POKENAV_MENUITEMS][4];
|
||||
u16 bg1TilemapBuffer[0x400];
|
||||
};
|
||||
|
||||
static struct Pokenav2Struct * sub_81C9958(void);
|
||||
static bool32 sub_81C99FC(void);
|
||||
static u32 sub_81C9A10(s32 state);
|
||||
static u32 sub_81C9C6C(s32 state);
|
||||
static u32 sub_81C9CA8(s32 state);
|
||||
static u32 sub_81C9D44(s32 state);
|
||||
static u32 sub_81C9DD8(s32 state);
|
||||
static u32 sub_81C9E58(s32 state);
|
||||
static u32 sub_81C9EC8(s32 state);
|
||||
static u32 sub_81C9EF8(s32 state);
|
||||
static u32 sub_81C9F28(s32 state);
|
||||
static u32 LoopedTask_MoveMenuCursor(s32 state);
|
||||
static u32 LoopedTask_OpenConditionMenu(s32 state);
|
||||
static u32 LoopedTask_ReturnToMainMenu(s32 state);
|
||||
static u32 LoopedTask_OpenConditionSearchMenu(s32 state);
|
||||
static u32 LoopedTask_ReturnToConditionMenu(s32 state);
|
||||
static u32 LoopedTask_SelectRibbonsNoWinners(s32 state);
|
||||
static u32 LoopedTask_ReShowDescription(s32 state);
|
||||
static u32 LoopedTask_OpenPokenavFeature(s32 state);
|
||||
static void sub_81C9FC4(void);
|
||||
static void sub_81C9FEC(void);
|
||||
static void sub_81CA02C(void);
|
||||
static void CreateMenuOptionSprites(void);
|
||||
static void sub_81CA094(void);
|
||||
static void sub_81CA0C8(void);
|
||||
static void sub_81CA0EC(const u16 *const * a0, s32 a1, s32 a2);
|
||||
@ -56,7 +56,7 @@ static void sub_81CA278(void);
|
||||
static void sub_81CA35C(struct Sprite ** sprites, s32 a1, s32 a2, s32 a3);
|
||||
static void sub_81CA3B4(struct Sprite ** sprites);
|
||||
static void sub_81CA2DC(void);
|
||||
static bool32 sub_81CA324(void);
|
||||
static bool32 AreMenuOptionSpritesMoving(void);
|
||||
static void sub_81CA448(struct Sprite ** sprites, bool32 a1);
|
||||
static void sub_81CA474(struct Sprite * sprite);
|
||||
static void sub_81CA4AC(struct Sprite * sprite);
|
||||
@ -64,9 +64,9 @@ static void sub_81CA580(u8 taskId);
|
||||
static void sub_81CA640(void);
|
||||
static void sub_81CA6AC(struct Sprite * sprite);
|
||||
static void sub_81CA698(void);
|
||||
static void sub_81CA6E0(void);
|
||||
static void sub_81CA714(void);
|
||||
static void sub_81CA770(void);
|
||||
static void AddOptionDescriptionWindow(void);
|
||||
static void PrintCurrentOptionDescription(void);
|
||||
static void PrintNoRibbonWinners(void);
|
||||
static bool32 sub_81CA7C4(void);
|
||||
static void sub_81CA7D4(void);
|
||||
static void sub_81CA7F4(void);
|
||||
@ -120,16 +120,16 @@ static const struct BgTemplate gUnknown_08620194[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static const LoopedTask gUnknown_086201A0[] = {
|
||||
NULL,
|
||||
sub_81C9C6C,
|
||||
sub_81C9CA8,
|
||||
sub_81C9D44,
|
||||
sub_81C9DD8,
|
||||
sub_81C9E58,
|
||||
sub_81C9EC8,
|
||||
sub_81C9EF8,
|
||||
sub_81C9F28
|
||||
static const LoopedTask sMenuHandlerLoopTaskFuncs[] = {
|
||||
[POKENAV_MENU_FUNC_NONE] = NULL,
|
||||
[POKENAV_MENU_FUNC_MOVE_CURSOR] = LoopedTask_MoveMenuCursor,
|
||||
[POKENAV_MENU_FUNC_OPEN_CONDITION] = LoopedTask_OpenConditionMenu,
|
||||
[POKENAV_MENU_FUNC_RETURN_TO_MAIN] = LoopedTask_ReturnToMainMenu,
|
||||
[POKENAV_MENU_FUNC_OPEN_CONDITION_SEARCH] = LoopedTask_OpenConditionSearchMenu,
|
||||
[POKENAV_MENU_FUNC_RETURN_TO_CONDITION] = LoopedTask_ReturnToConditionMenu,
|
||||
[POKENAV_MENU_FUNC_NO_RIBBON_WINNERS] = LoopedTask_SelectRibbonsNoWinners,
|
||||
[POKENAV_MENU_FUNC_RESHOW_DESCRIPTION] = LoopedTask_ReShowDescription,
|
||||
[POKENAV_MENU_FUNC_OPEN_FEATURE] = LoopedTask_OpenPokenavFeature
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet gUnknown_086201C4[] =
|
||||
@ -175,31 +175,37 @@ struct UnkStruct_08620240
|
||||
{
|
||||
u16 unk0;
|
||||
u16 unk2;
|
||||
const u16 *unk4[6];
|
||||
const u16 *unk4[MAX_POKENAV_MENUITEMS];
|
||||
};
|
||||
|
||||
static const struct UnkStruct_08620240 gUnknown_08620240[5] =
|
||||
// TODO
|
||||
static const struct UnkStruct_08620240 gUnknown_08620240[POKENAV_MENU_TYPE_COUNT] =
|
||||
{
|
||||
[POKENAV_MENU_TYPE_DEFAULT] =
|
||||
{
|
||||
0x2A,
|
||||
0x14,
|
||||
{gUnknown_0862020C, gUnknown_08620210, gUnknown_0862021C}
|
||||
},
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC] =
|
||||
{
|
||||
0x2A,
|
||||
0x14,
|
||||
{gUnknown_0862020C, gUnknown_08620210, gUnknown_08620214, gUnknown_0862021C}
|
||||
},
|
||||
[POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS] =
|
||||
{
|
||||
0x2A,
|
||||
0x14,
|
||||
{gUnknown_0862020C, gUnknown_08620210, gUnknown_08620214, gUnknown_08620218, gUnknown_0862021C}
|
||||
},
|
||||
[POKENAV_MENU_TYPE_CONDITION] =
|
||||
{
|
||||
0x38,
|
||||
0x14,
|
||||
{gUnknown_08620220, gUnknown_08620224, gUnknown_0862023C}
|
||||
},
|
||||
[POKENAV_MENU_TYPE_CONDITION_SEARCH] =
|
||||
{
|
||||
0x28,
|
||||
0x10,
|
||||
@ -207,7 +213,7 @@ static const struct UnkStruct_08620240 gUnknown_08620240[5] =
|
||||
},
|
||||
};
|
||||
|
||||
static const struct WindowTemplate gUnknown_086202CC =
|
||||
static const struct WindowTemplate sOptionDescWindowTemplate =
|
||||
{
|
||||
.bg = 1,
|
||||
.tilemapLeft = 3,
|
||||
@ -218,28 +224,28 @@ static const struct WindowTemplate gUnknown_086202CC =
|
||||
.baseBlock = 8
|
||||
};
|
||||
|
||||
static const u8 *const gUnknown_086202D4[] =
|
||||
static const u8 *const sPageDescriptions[] =
|
||||
{
|
||||
gText_CheckMapOfHoenn,
|
||||
gText_CheckPokemonInDetail,
|
||||
gText_CallRegisteredTrainer,
|
||||
gText_CheckObtainedRibbons,
|
||||
gText_PutAwayPokenav,
|
||||
gText_CheckPartyPokemonInDetail,
|
||||
gText_CheckAllPokemonInDetail,
|
||||
gText_ReturnToPokenavMenu,
|
||||
gText_FindCoolPokemon,
|
||||
gText_FindBeautifulPokemon,
|
||||
gText_FindCutePokemon,
|
||||
gText_FindSmartPokemon,
|
||||
gText_FindToughPokemon,
|
||||
gText_ReturnToConditionMenu
|
||||
[POKENAV_MENUITEM_MAP] = gText_CheckMapOfHoenn,
|
||||
[POKENAV_MENUITEM_CONDITION] = gText_CheckPokemonInDetail,
|
||||
[POKENAV_MENUITEM_MATCH_CALL] = gText_CallRegisteredTrainer,
|
||||
[POKENAV_MENUITEM_RIBBONS] = gText_CheckObtainedRibbons,
|
||||
[POKENAV_MENUITEM_SWITCH_OFF] = gText_PutAwayPokenav,
|
||||
[POKENAV_MENUITEM_CONDITION_PARTY] = gText_CheckPartyPokemonInDetail,
|
||||
[POKENAV_MENUITEM_CONDITION_SEARCH] = gText_CheckAllPokemonInDetail,
|
||||
[POKENAV_MENUITEM_CONDITION_CANCEL] = gText_ReturnToPokenavMenu,
|
||||
[POKENAV_MENUITEM_CONDITION_SEARCH_COOL] = gText_FindCoolPokemon,
|
||||
[POKENAV_MENUITEM_CONDITION_SEARCH_BEAUTY] = gText_FindBeautifulPokemon,
|
||||
[POKENAV_MENUITEM_CONDITION_SEARCH_CUTE] = gText_FindCutePokemon,
|
||||
[POKENAV_MENUITEM_CONDITION_SEARCH_SMART] = gText_FindSmartPokemon,
|
||||
[POKENAV_MENUITEM_CONDITION_SEARCH_TOUGH] = gText_FindToughPokemon,
|
||||
[POKENAV_MENUITEM_CONDITION_SEARCH_CANCEL] = gText_ReturnToConditionMenu
|
||||
};
|
||||
|
||||
static const u8 sOptionDescTextColors[] = {TEXT_COLOR_GREEN, TEXT_COLOR_BLUE, TEXT_COLOR_LIGHT_GREEN};
|
||||
static const u8 sOptionDescTextColors2[] = {TEXT_COLOR_GREEN, TEXT_COLOR_BLUE, TEXT_COLOR_LIGHT_GREEN};
|
||||
|
||||
static const struct OamData gUnknown_08620314 =
|
||||
static const struct OamData sOamData_MenuOption =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = ST_OAM_AFFINE_OFF,
|
||||
@ -266,20 +272,20 @@ static const union AffineAnimCmd gUnknown_0862032C[] =
|
||||
AFFINEANIMCMD_END,
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd *const gUnknown_08620344[] =
|
||||
static const union AffineAnimCmd *const sSpriteAnims_MenuOption[] =
|
||||
{
|
||||
gUnknown_0862031C,
|
||||
gUnknown_0862032C
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_0862034C =
|
||||
static const struct SpriteTemplate sMenuOptionSpriteTemplate =
|
||||
{
|
||||
.tileTag = 3,
|
||||
.paletteTag = 4,
|
||||
.oam = &gUnknown_08620314,
|
||||
.oam = &sOamData_MenuOption,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gUnknown_08620344,
|
||||
.affineAnims = sSpriteAnims_MenuOption,
|
||||
.callback = SpriteCallbackDummy,
|
||||
};
|
||||
|
||||
@ -368,11 +374,11 @@ static struct Pokenav2Struct * sub_81C9958(void)
|
||||
}
|
||||
|
||||
|
||||
void sub_81C9990(s32 ltIdx)
|
||||
void CreateMenuHandlerLoopedTask(s32 ltIdx)
|
||||
{
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
|
||||
unk->loopedTaskId = CreateLoopedTask(gUnknown_086201A0[ltIdx], 1);
|
||||
unk->loopedTaskId = CreateLoopedTask(sMenuHandlerLoopTaskFuncs[ltIdx], 1);
|
||||
unk->callback = sub_81C99FC;
|
||||
}
|
||||
|
||||
@ -388,7 +394,7 @@ void sub_81C99D4(void)
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
|
||||
sub_81CA7F4();
|
||||
RemoveWindow(unk->optionDescriptionWindowId);
|
||||
RemoveWindow(unk->optionDescWindowId);
|
||||
sub_81C9FEC();
|
||||
sub_81CA994();
|
||||
FreePokenavSubstruct(2);
|
||||
@ -434,21 +440,21 @@ static u32 sub_81C9A10(s32 state)
|
||||
decompress_and_copy_tile_data_to_vram(3, gUnknown_0861FC98, 0, 0, 0);
|
||||
decompress_and_copy_tile_data_to_vram(3, gUnknown_0861FCAC, 0, 0, 1);
|
||||
CopyPaletteIntoBufferUnfaded(gUnknown_0861FC78, 0x30, 0x20);
|
||||
if (sub_81C9894() == 3 || sub_81C9894() == 4)
|
||||
if (GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION || GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION_SEARCH)
|
||||
sub_81CA850();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (free_temp_tile_data_buffers_if_possible())
|
||||
return LT_PAUSE;
|
||||
sub_81CA6E0();
|
||||
AddOptionDescriptionWindow();
|
||||
sub_81CA7D4();
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 4:
|
||||
sub_81C9FC4();
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 5:
|
||||
sub_81CA714();
|
||||
sub_81CA02C();
|
||||
PrintCurrentOptionDescription();
|
||||
CreateMenuOptionSprites();
|
||||
sub_81CA640();
|
||||
sub_81CA0C8();
|
||||
return LT_INC_AND_PAUSE;
|
||||
@ -467,12 +473,12 @@ static u32 sub_81C9A10(s32 state)
|
||||
PlaySE(SE_PN_ON);
|
||||
sub_81C7AC0(3);
|
||||
}
|
||||
switch (sub_81C9894())
|
||||
switch (GetPokenavMenuType())
|
||||
{
|
||||
case 4:
|
||||
case POKENAV_MENU_TYPE_CONDITION_SEARCH:
|
||||
LoadLeftHeaderGfxForIndex(7);
|
||||
// fallthrough
|
||||
case 3:
|
||||
case POKENAV_MENU_TYPE_CONDITION:
|
||||
LoadLeftHeaderGfxForIndex(1);
|
||||
break;
|
||||
default:
|
||||
@ -483,12 +489,12 @@ static u32 sub_81C9A10(s32 state)
|
||||
case 8:
|
||||
if (IsPaletteFadeActive())
|
||||
return LT_PAUSE;
|
||||
switch (sub_81C9894())
|
||||
switch (GetPokenavMenuType())
|
||||
{
|
||||
case 4:
|
||||
case POKENAV_MENU_TYPE_CONDITION_SEARCH:
|
||||
sub_81C7FA0(7, FALSE, FALSE);
|
||||
// fallthrough
|
||||
case 3:
|
||||
case POKENAV_MENU_TYPE_CONDITION:
|
||||
sub_81C7FA0(1, FALSE, FALSE);
|
||||
break;
|
||||
default:
|
||||
@ -499,7 +505,7 @@ static u32 sub_81C9A10(s32 state)
|
||||
sub_81CA92C();
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 9:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81C8010())
|
||||
return LT_PAUSE;
|
||||
@ -508,18 +514,18 @@ static u32 sub_81C9A10(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 sub_81C9C6C(s32 state)
|
||||
static u32 LoopedTask_MoveMenuCursor(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
sub_81CAA3C();
|
||||
sub_81CA278();
|
||||
sub_81CA714();
|
||||
PrintCurrentOptionDescription();
|
||||
PlaySE(SE_SELECT);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 1:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81CA7C4())
|
||||
return LT_PAUSE;
|
||||
@ -528,7 +534,7 @@ static u32 sub_81C9C6C(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 sub_81C9CA8(s32 state)
|
||||
static u32 LoopedTask_OpenConditionMenu(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
@ -539,7 +545,7 @@ static u32 sub_81C9CA8(s32 state)
|
||||
PlaySE(SE_SELECT);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 1:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81C8010())
|
||||
return LT_PAUSE;
|
||||
@ -550,10 +556,10 @@ static u32 sub_81C9CA8(s32 state)
|
||||
sub_81CA20C();
|
||||
sub_81C7FA0(1, FALSE, FALSE);
|
||||
sub_81CA818();
|
||||
sub_81CA714();
|
||||
PrintCurrentOptionDescription();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81C8010())
|
||||
return LT_PAUSE;
|
||||
@ -567,7 +573,7 @@ static u32 sub_81C9CA8(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 sub_81C9D44(s32 state)
|
||||
static u32 LoopedTask_ReturnToMainMenu(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
@ -577,7 +583,7 @@ static u32 sub_81C9D44(s32 state)
|
||||
sub_81C7FC4(1, 0);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 1:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81C8010())
|
||||
return LT_PAUSE;
|
||||
@ -588,10 +594,10 @@ static u32 sub_81C9D44(s32 state)
|
||||
sub_81CA20C();
|
||||
sub_81C7FA0(0, FALSE, FALSE);
|
||||
sub_81CA864();
|
||||
sub_81CA714();
|
||||
PrintCurrentOptionDescription();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81C8010())
|
||||
return LT_PAUSE;
|
||||
@ -605,7 +611,7 @@ static u32 sub_81C9D44(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 sub_81C9DD8(s32 state)
|
||||
static u32 LoopedTask_OpenConditionSearchMenu(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
@ -615,7 +621,7 @@ static u32 sub_81C9DD8(s32 state)
|
||||
PlaySE(SE_SELECT);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 1:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
LoadLeftHeaderGfxForIndex(7);
|
||||
sub_81CA0C8();
|
||||
@ -623,10 +629,10 @@ static u32 sub_81C9DD8(s32 state)
|
||||
case 2:
|
||||
sub_81CA20C();
|
||||
sub_81C7FA0(7, FALSE, FALSE);
|
||||
sub_81CA714();
|
||||
PrintCurrentOptionDescription();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81C8010())
|
||||
return LT_PAUSE;
|
||||
@ -638,7 +644,7 @@ static u32 sub_81C9DD8(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 sub_81C9E58(s32 state)
|
||||
static u32 LoopedTask_ReturnToConditionMenu(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
@ -648,7 +654,7 @@ static u32 sub_81C9E58(s32 state)
|
||||
sub_81C7FC4(7, 0);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 1:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81C8010())
|
||||
return LT_PAUSE;
|
||||
@ -656,10 +662,10 @@ static u32 sub_81C9E58(s32 state)
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 2:
|
||||
sub_81CA20C();
|
||||
sub_81CA714();
|
||||
PrintCurrentOptionDescription();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81CA89C())
|
||||
return LT_PAUSE;
|
||||
@ -669,13 +675,13 @@ static u32 sub_81C9E58(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 sub_81C9EC8(s32 state)
|
||||
static u32 LoopedTask_SelectRibbonsNoWinners(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_HAZURE);
|
||||
sub_81CA770();
|
||||
PrintNoRibbonWinners();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 1:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
@ -685,13 +691,14 @@ static u32 sub_81C9EC8(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 sub_81C9EF8(s32 state)
|
||||
// For redisplaying the Ribbons description to replace the No Ribbon Winners message
|
||||
static u32 LoopedTask_ReShowDescription(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81CA714();
|
||||
PrintCurrentOptionDescription();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 1:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
@ -701,7 +708,8 @@ static u32 sub_81C9EF8(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 sub_81C9F28(s32 state)
|
||||
// For selecting a feature option from a menu, e.g. the Map, Match Call, Beauty search, etc.
|
||||
static u32 LoopedTask_OpenPokenavFeature(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
@ -714,12 +722,12 @@ static u32 sub_81C9F28(s32 state)
|
||||
sub_81C7880();
|
||||
sub_81CA9C8();
|
||||
sub_81CA2DC();
|
||||
switch (sub_81C9894())
|
||||
switch (GetPokenavMenuType())
|
||||
{
|
||||
case 4:
|
||||
case POKENAV_MENU_TYPE_CONDITION_SEARCH:
|
||||
sub_81C7FC4(7, FALSE);
|
||||
// fallthrough
|
||||
case 3:
|
||||
case POKENAV_MENU_TYPE_CONDITION:
|
||||
sub_81C7FC4(1, FALSE);
|
||||
break;
|
||||
default:
|
||||
@ -729,7 +737,7 @@ static u32 sub_81C9F28(s32 state)
|
||||
PlaySE(SE_SELECT);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 2:
|
||||
if (sub_81CA324())
|
||||
if (AreMenuOptionSpritesMoving())
|
||||
return LT_PAUSE;
|
||||
if (sub_81C8010())
|
||||
return LT_PAUSE;
|
||||
@ -766,16 +774,17 @@ static void sub_81C9FEC(void)
|
||||
sub_81CA698();
|
||||
}
|
||||
|
||||
static void sub_81CA02C(void)
|
||||
static void CreateMenuOptionSprites(void)
|
||||
{
|
||||
s32 i, j;
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < MAX_POKENAV_MENUITEMS; i++)
|
||||
{
|
||||
// Each menu option is 4 subsprites
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
u8 spriteId = CreateSprite(&gUnknown_0862034C, 0x8c, 20 * i + 40, 3);
|
||||
u8 spriteId = CreateSprite(&sMenuOptionSpriteTemplate, 0x8c, 20 * i + 40, 3);
|
||||
unk->iconSprites[i][j] = &gSprites[spriteId];
|
||||
gSprites[spriteId].pos2.x = 32 * j;
|
||||
}
|
||||
@ -787,7 +796,7 @@ static void sub_81CA094(void)
|
||||
s32 i, j;
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < MAX_POKENAV_MENUITEMS; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
@ -799,8 +808,8 @@ static void sub_81CA094(void)
|
||||
|
||||
static void sub_81CA0C8(void)
|
||||
{
|
||||
s32 r0 = sub_81C9894();
|
||||
sub_81CA0EC(gUnknown_08620240[r0].unk4, gUnknown_08620240[r0].unk0, gUnknown_08620240[r0].unk2);
|
||||
s32 menuType = GetPokenavMenuType();
|
||||
sub_81CA0EC(gUnknown_08620240[menuType].unk4, gUnknown_08620240[menuType].unk0, gUnknown_08620240[menuType].unk2);
|
||||
}
|
||||
|
||||
static void sub_81CA0EC(const u16 *const *a0, s32 a1, s32 a2)
|
||||
@ -809,7 +818,7 @@ static void sub_81CA0EC(const u16 *const *a0, s32 a1, s32 a2)
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
s32 sp04 = GetSpriteTileStartByTag(3);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < MAX_POKENAV_MENUITEMS; i++)
|
||||
{
|
||||
if (*a0 != NULL)
|
||||
{
|
||||
@ -841,11 +850,11 @@ static void sub_81CA20C(void)
|
||||
{
|
||||
s32 i;
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
s32 r8 = sub_81C98A4();
|
||||
s32 r8 = GetPokenavCursorPos();
|
||||
s32 r7 = 0;
|
||||
s32 r2;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < MAX_POKENAV_MENUITEMS; i++)
|
||||
{
|
||||
if (unk->iconVisible[i])
|
||||
{
|
||||
@ -868,10 +877,10 @@ static void sub_81CA278(void)
|
||||
{
|
||||
s32 i;
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
s32 r3 = sub_81C98A4();
|
||||
s32 r3 = GetPokenavCursorPos();
|
||||
s32 r5;
|
||||
|
||||
for (i = 0, r5 = 0; i < 6; i++)
|
||||
for (i = 0, r5 = 0; i < MAX_POKENAV_MENUITEMS; i++)
|
||||
{
|
||||
if (unk->iconVisible[i])
|
||||
{
|
||||
@ -894,7 +903,7 @@ static void sub_81CA2DC(void)
|
||||
s32 i;
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < MAX_POKENAV_MENUITEMS; i++)
|
||||
{
|
||||
if (unk->iconVisible[i])
|
||||
{
|
||||
@ -906,12 +915,12 @@ static void sub_81CA2DC(void)
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 sub_81CA324(void)
|
||||
static bool32 AreMenuOptionSpritesMoving(void)
|
||||
{
|
||||
s32 i;
|
||||
struct Pokenav2Struct * unk = GetSubstructPtr(2);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < MAX_POKENAV_MENUITEMS; i++)
|
||||
{
|
||||
if (unk->iconSprites[i][0]->callback != SpriteCallbackDummy)
|
||||
return TRUE;
|
||||
@ -1112,34 +1121,35 @@ static void sub_81CA6AC(struct Sprite * sprite)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81CA6E0(void)
|
||||
static void AddOptionDescriptionWindow(void)
|
||||
{
|
||||
struct Pokenav2Struct * ptr = GetSubstructPtr(2);
|
||||
|
||||
ptr->optionDescriptionWindowId = AddWindow(&gUnknown_086202CC);
|
||||
PutWindowTilemap(ptr->optionDescriptionWindowId);
|
||||
FillWindowPixelBuffer(ptr->optionDescriptionWindowId, PIXEL_FILL(6));
|
||||
CopyWindowToVram(ptr->optionDescriptionWindowId, 3);
|
||||
ptr->optionDescWindowId = AddWindow(&sOptionDescWindowTemplate);
|
||||
PutWindowTilemap(ptr->optionDescWindowId);
|
||||
FillWindowPixelBuffer(ptr->optionDescWindowId, PIXEL_FILL(6));
|
||||
CopyWindowToVram(ptr->optionDescWindowId, 3);
|
||||
}
|
||||
|
||||
static void sub_81CA714(void)
|
||||
static void PrintCurrentOptionDescription(void)
|
||||
{
|
||||
struct Pokenav2Struct * ptr = GetSubstructPtr(2);
|
||||
int i = sub_81C98B4();
|
||||
const u8 * s = gUnknown_086202D4[i];
|
||||
int menuItem = GetCurrentMenuItemId();
|
||||
const u8 * s = sPageDescriptions[menuItem];
|
||||
u32 width = GetStringWidth(1, s, -1);
|
||||
FillWindowPixelBuffer(ptr->optionDescriptionWindowId, PIXEL_FILL(6));
|
||||
AddTextPrinterParameterized3(ptr->optionDescriptionWindowId, 1, (192 - width) / 2, 1, sOptionDescTextColors, 0, s);
|
||||
FillWindowPixelBuffer(ptr->optionDescWindowId, PIXEL_FILL(6));
|
||||
AddTextPrinterParameterized3(ptr->optionDescWindowId, 1, (192 - width) / 2, 1, sOptionDescTextColors, 0, s);
|
||||
}
|
||||
|
||||
|
||||
static void sub_81CA770(void)
|
||||
// Printed when Ribbons is selected if no PC/party mons have ribbons
|
||||
// Can occur by obtaining a mon with a ribbon and then releasing all ribbon winners
|
||||
static void PrintNoRibbonWinners(void)
|
||||
{
|
||||
struct Pokenav2Struct * ptr = GetSubstructPtr(2);
|
||||
const u8 * s = gText_NoRibbonWinners;
|
||||
u32 width = GetStringWidth(1, s, -1);
|
||||
FillWindowPixelBuffer(ptr->optionDescriptionWindowId, PIXEL_FILL(6));
|
||||
AddTextPrinterParameterized3(ptr->optionDescriptionWindowId, 1, (192 - width) / 2, 1, sOptionDescTextColors2, 0, s);
|
||||
FillWindowPixelBuffer(ptr->optionDescWindowId, PIXEL_FILL(6));
|
||||
AddTextPrinterParameterized3(ptr->optionDescWindowId, 1, (192 - width) / 2, 1, sOptionDescTextColors2, 0, s);
|
||||
}
|
||||
|
||||
static bool32 sub_81CA7C4(void)
|
||||
@ -1259,9 +1269,9 @@ static void sub_81CA9EC(u8 taskId)
|
||||
|
||||
static void sub_81CAA3C(void)
|
||||
{
|
||||
int i = sub_81C9894();
|
||||
int j = sub_81C98A4();
|
||||
int r4 = gUnknown_08620240[i].unk2 * j + gUnknown_08620240[i].unk0 - 8;
|
||||
int menuType = GetPokenavMenuType();
|
||||
int cursorPos = GetPokenavCursorPos();
|
||||
int r4 = gUnknown_08620240[menuType].unk2 * cursorPos + gUnknown_08620240[menuType].unk0 - 8;
|
||||
CpuFill16(0, gScanlineEffectRegBuffers[0], 0x140);
|
||||
CpuFill16(0, gScanlineEffectRegBuffers[1], 0x140);
|
||||
CpuFill16(RGB(16, 23, 28), &gScanlineEffectRegBuffers[0][r4], 0x20);
|
@ -50,7 +50,7 @@ static void sub_81D02B0(s32 windowId, s32 val1, s32 val2);
|
||||
static void sub_81D024C(struct PokenavSub10 *ptr);
|
||||
static void sub_81D0288(struct PokenavSub10 *ptr);
|
||||
static void sub_81D0304(void);
|
||||
static void sub_81D035C(struct PokenavMonList *, u8 *);
|
||||
static void BufferRibbonMonInfoText(struct PokenavMonList *, u8 *);
|
||||
|
||||
static const LoopedTask gUnknown_086235D8[] =
|
||||
{
|
||||
@ -107,9 +107,9 @@ static const struct WindowTemplate gUnknown_086237D4 =
|
||||
.baseBlock = 20
|
||||
};
|
||||
|
||||
static const u8 gUnknown_086237DC[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GREEN}♂{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
static const u8 gUnknown_086237E8[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
static const u8 gUnknown_086237F4[] = _("{UNK_SPACER}");
|
||||
static const u8 sText_MaleSymbol[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GREEN}♂{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
static const u8 sText_FemaleSymbol[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
static const u8 sText_NoGenderSymbol[] = _("{UNK_SPACER}");
|
||||
|
||||
bool32 PokenavCallback_Init_12(void)
|
||||
{
|
||||
@ -188,12 +188,12 @@ static u32 sub_81CFA88(struct PokenavSub9 *structPtr)
|
||||
|
||||
static u32 sub_81CFB08(struct PokenavSub9 *structPtr)
|
||||
{
|
||||
return 100005;
|
||||
return POKENAV_MENU_5;
|
||||
}
|
||||
|
||||
static u32 sub_81CFB10(struct PokenavSub9 *structPtr)
|
||||
{
|
||||
return 100013;
|
||||
return POKENAV_MENU_D;
|
||||
}
|
||||
|
||||
static u32 sub_81CFB18(void)
|
||||
@ -660,7 +660,7 @@ static void sub_81D02B0(s32 windowId, s32 val1, s32 val2)
|
||||
*ptr++ = CHAR_SLASH;
|
||||
ConvertIntToDecimalStringN(ptr, val2, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
x = GetStringCenterAlignXOffset(1, strbuf, 56);
|
||||
AddTextPrinterParameterized(windowId, 1, strbuf,x, 1, 0xFF, NULL);
|
||||
AddTextPrinterParameterized(windowId, 1, strbuf, x, 1, 0xFF, NULL);
|
||||
}
|
||||
|
||||
static void sub_81D0304(void)
|
||||
@ -676,18 +676,21 @@ static void sub_81D0304(void)
|
||||
template.unkC = 8;
|
||||
template.unkD = 2;
|
||||
template.unkE = 1;
|
||||
template.listFunc.unk10_1 = sub_81D035C;
|
||||
template.listFunc.unk10_1 = BufferRibbonMonInfoText;
|
||||
template.unk14 = NULL;
|
||||
sub_81C81D4(&gUnknown_086237B0[1], &template, 0);
|
||||
}
|
||||
|
||||
static void sub_81D035C(struct PokenavMonList * item0, u8 * dest)
|
||||
// Buffers the "Nickname gender/level" text for the ribbon mon list
|
||||
static void BufferRibbonMonInfoText(struct PokenavMonList * item0, u8 * dest)
|
||||
{
|
||||
u8 gender;
|
||||
u8 level;
|
||||
u8 * s;
|
||||
const u8 * genderStr;
|
||||
struct PokenavMonList * item = item0;
|
||||
|
||||
// Mon is in party
|
||||
if (item->boxId == TOTAL_BOXES_COUNT)
|
||||
{
|
||||
struct Pokemon * mon = &gPlayerParty[item->monId];
|
||||
@ -695,6 +698,7 @@ static void sub_81D035C(struct PokenavMonList * item0, u8 * dest)
|
||||
level = GetLevelFromMonExp(mon);
|
||||
GetMonData(mon, MON_DATA_NICKNAME, gStringVar3);
|
||||
}
|
||||
// Mon is in PC
|
||||
else
|
||||
{
|
||||
struct BoxPokemon * mon = GetBoxedMonPtr(item->boxId, item->monId);
|
||||
@ -702,24 +706,26 @@ static void sub_81D035C(struct PokenavMonList * item0, u8 * dest)
|
||||
level = GetLevelFromBoxMonExp(mon);
|
||||
GetBoxMonData(mon, MON_DATA_NICKNAME, gStringVar3);
|
||||
}
|
||||
|
||||
StringGetEnd10(gStringVar3);
|
||||
dest = sub_81DB494(dest, 1, gStringVar3, 60);
|
||||
switch (gender)
|
||||
{
|
||||
default:
|
||||
genderStr = gUnknown_086237F4;
|
||||
genderStr = sText_NoGenderSymbol;
|
||||
break;
|
||||
case MON_MALE:
|
||||
genderStr = gUnknown_086237DC;
|
||||
genderStr = sText_MaleSymbol;
|
||||
break;
|
||||
case MON_FEMALE:
|
||||
genderStr = gUnknown_086237E8;
|
||||
genderStr = sText_FemaleSymbol;
|
||||
break;
|
||||
}
|
||||
|
||||
s = StringCopy(gStringVar1, genderStr);
|
||||
*s++ = CHAR_SLASH;
|
||||
*s++ = CHAR_SPECIAL_F9;
|
||||
*s++ = 5; // LV
|
||||
*s++ = CHAR_LV_2;
|
||||
ConvertIntToDecimalStringN(s, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
dest = sub_81DB494(dest, 1, gStringVar1, 54);
|
||||
ConvertIntToDecimalStringN(dest, item->data, STR_CONV_MODE_RIGHT_ALIGN, 2);
|
@ -122,8 +122,8 @@ static const u16 gUnknown_08624038[] = INCBIN_U16("graphics/pokenav/ribbons_icon
|
||||
static const u16 gUnknown_08624058[] = INCBIN_U16("graphics/pokenav/ribbons_icon4.gbapal");
|
||||
static const u16 gUnknown_08624078[] = INCBIN_U16("graphics/pokenav/ribbons_icon5.gbapal");
|
||||
static const u16 gUnknown_08624098[] = INCBIN_U16("graphics/pokenav/8624098.gbapal");
|
||||
static const u32 gUnknown_086240B8[] = INCBIN_U32("graphics/pokenav/ribbons_icon.4bpp.lz");
|
||||
static const u32 gUnknown_08624280[] = INCBIN_U32("graphics/pokenav/ribbons_icon_big.4bpp.lz");
|
||||
static const u32 sRibbonIconsSmall_Gfx[] = INCBIN_U32("graphics/pokenav/ribbons_icon.4bpp.lz");
|
||||
static const u32 sRibbonIconsBig_Gfx[] = INCBIN_U32("graphics/pokenav/ribbons_icon_big.4bpp.lz");
|
||||
|
||||
static const struct BgTemplate gUnknown_08624B98[] =
|
||||
{
|
||||
@ -235,7 +235,7 @@ u32 sub_81D0548(struct PokenavSub13 *structPtr)
|
||||
|
||||
u32 sub_81D05D4(struct PokenavSub13 *structPtr)
|
||||
{
|
||||
return 100014;
|
||||
return POKENAV_MENU_E;
|
||||
}
|
||||
|
||||
bool32 sub_81D05DC(struct PokenavSub13 *structPtr)
|
||||
@ -527,7 +527,7 @@ u32 sub_81D0A6C(s32 state)
|
||||
if (!free_temp_tile_data_buffers_if_possible())
|
||||
{
|
||||
sub_8199DF0(1, 0, 0, 1);
|
||||
decompress_and_copy_tile_data_to_vram(1, gUnknown_086240B8, 0, 1, 0);
|
||||
decompress_and_copy_tile_data_to_vram(1, sRibbonIconsSmall_Gfx, 0, 1, 0);
|
||||
SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]);
|
||||
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20);
|
||||
CopyPaletteIntoBufferUnfaded(gUnknown_08623FF8, 0x20, 0xA0);
|
||||
@ -837,7 +837,7 @@ void sub_81D0FF0(struct PokenavSub14 *structPtr)
|
||||
txtPtr = StringCopy(gStringVar1, genderTxt);
|
||||
*(txtPtr++) = CHAR_SLASH;
|
||||
*(txtPtr++) = CHAR_SPECIAL_F9;
|
||||
*(txtPtr++) = 5;
|
||||
*(txtPtr++) = CHAR_LV_2;
|
||||
ConvertIntToDecimalStringN(txtPtr, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
AddTextPrinterParameterized(windowId, 1, gStringVar1, 60, 1, TEXT_SPEED_FF, NULL);
|
||||
CopyWindowToVram(windowId, 2);
|
||||
@ -1041,7 +1041,7 @@ void sub_81D13BC(u16 *dst, u32 id)
|
||||
|
||||
static const struct CompressedSpriteSheet gUnknown_08624C78 =
|
||||
{
|
||||
gUnknown_08624280, 0x1800, 9
|
||||
sRibbonIconsBig_Gfx, 0x1800, 9
|
||||
};
|
||||
|
||||
static const struct SpritePalette gUnknown_08624C80[] =
|
@ -1,466 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "pokenav.h"
|
||||
#include "event_data.h"
|
||||
#include "main.h"
|
||||
#include "sound.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
struct Pokenav1Struct
|
||||
{
|
||||
u16 menuType;
|
||||
s16 cursorPos;
|
||||
u16 descriptionId;
|
||||
u16 helpBarIndex;
|
||||
u32 unk8;
|
||||
u32 (*callback)(struct Pokenav1Struct*);
|
||||
};
|
||||
|
||||
static bool32 sub_81C9814(struct Pokenav1Struct *a0);
|
||||
static void sub_81C97F8(struct Pokenav1Struct *a0);
|
||||
static void sub_81C97C0(struct Pokenav1Struct *a0);
|
||||
static u32 sub_81C97BC(struct Pokenav1Struct *a0);
|
||||
static void sub_81C97B0(struct Pokenav1Struct *a0, u32 a1);
|
||||
static u32 sub_81C97A4(struct Pokenav1Struct *a0);
|
||||
static u32 sub_81C9798(struct Pokenav1Struct *a0);
|
||||
static u32 sub_81C96FC(struct Pokenav1Struct *a0);
|
||||
static u32 sub_81C963C(struct Pokenav1Struct *a0);
|
||||
static u32 sub_81C9600(struct Pokenav1Struct *a0);
|
||||
static u32 sub_81C9588(struct Pokenav1Struct *a0);
|
||||
static u32 sub_81C9520(struct Pokenav1Struct *a0);
|
||||
static u32 sub_81C943C(struct Pokenav1Struct *a0);
|
||||
static u32 (*sub_81C93EC(void))(struct Pokenav1Struct*);
|
||||
static void sub_81C939C(struct Pokenav1Struct *state);
|
||||
|
||||
static const u8 sLastCursorPositions[] = {2, 3, 4, 2, 5};
|
||||
|
||||
static const u8 sDescriptionIds[][6] =
|
||||
{
|
||||
{ 0, 1, 4, 4, 4, 4 },
|
||||
{ 0, 1, 2, 4, 4, 4 },
|
||||
{ 0, 1, 2, 3, 4, 4 },
|
||||
{ 5, 6, 7, 4, 4, 4 },
|
||||
{ 8, 9, 10, 11, 12, 13 },
|
||||
};
|
||||
|
||||
static u8 GetPokenavMainMenuType(void)
|
||||
{
|
||||
u8 retVal = 0;
|
||||
if (FlagGet(FLAG_ADDED_MATCH_CALL_TO_POKENAV))
|
||||
{
|
||||
retVal = 1;
|
||||
if (FlagGet(FLAG_SYS_RIBBON_GET))
|
||||
retVal = 2;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_0(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = 0;
|
||||
state->descriptionId = 0;
|
||||
state->helpBarIndex = HELPBAR_NONE;
|
||||
sub_81C939C(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_4(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = 2;
|
||||
state->descriptionId = 2;
|
||||
state->helpBarIndex = HELPBAR_NONE;
|
||||
sub_81C939C(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_5(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = GetPokenavMainMenuType();
|
||||
state->cursorPos = 3;
|
||||
state->descriptionId = 3;
|
||||
sub_81C939C(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_2(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = 3;
|
||||
state->cursorPos = 0;
|
||||
state->descriptionId = 5;
|
||||
state->helpBarIndex = HELPBAR_NONE;
|
||||
sub_81C939C(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_3(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->menuType = 4;
|
||||
state->cursorPos = sub_81C76AC();
|
||||
state->descriptionId = state->cursorPos + 8;
|
||||
state->helpBarIndex = HELPBAR_NONE;
|
||||
sub_81C939C(state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void sub_81C939C(struct Pokenav1Struct *state)
|
||||
{
|
||||
switch (state->menuType)
|
||||
{
|
||||
case 0:
|
||||
SetPokenavMode(POKENAV_MODE_NORMAL);
|
||||
// fallthrough
|
||||
case 1:
|
||||
case 2:
|
||||
state->callback = sub_81C93EC();
|
||||
break;
|
||||
case 3:
|
||||
state->callback = sub_81C963C;
|
||||
break;
|
||||
case 4:
|
||||
state->callback = sub_81C96FC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 (*sub_81C93EC(void))(struct Pokenav1Struct*)
|
||||
{
|
||||
switch (GetPokenavMode())
|
||||
{
|
||||
default:
|
||||
case POKENAV_MODE_NORMAL:
|
||||
return sub_81C943C;
|
||||
case POKENAV_MODE_FORCE_CALL_READY:
|
||||
return sub_81C9520;
|
||||
case POKENAV_MODE_FORCE_CALL_EXIT:
|
||||
return sub_81C9588;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_81C941C(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->callback(state);
|
||||
}
|
||||
|
||||
void sub_81C9430(void)
|
||||
{
|
||||
FreePokenavSubstruct(1);
|
||||
}
|
||||
|
||||
static u32 sub_81C943C(struct Pokenav1Struct *a0)
|
||||
{
|
||||
if (sub_81C9814(a0))
|
||||
return 1;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
switch (sDescriptionIds[a0->menuType][a0->cursorPos])
|
||||
{
|
||||
case 0:
|
||||
a0->helpBarIndex = gSaveBlock2Ptr->regionMapZoom ? HELPBAR_MAP_ZOOMED_IN : HELPBAR_MAP_ZOOMED_OUT;
|
||||
sub_81C97B0(a0, POKENAV_MENU_6);
|
||||
return 8;
|
||||
case 1:
|
||||
a0->menuType = 3;
|
||||
a0->cursorPos = 0;
|
||||
a0->descriptionId = sDescriptionIds[3][0];
|
||||
a0->callback = sub_81C963C;
|
||||
return 2;
|
||||
case 2:
|
||||
a0->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
|
||||
sub_81C97B0(a0, POKENAV_MENU_B);
|
||||
return 8;
|
||||
case 3:
|
||||
if (CanViewRibbonsMenu())
|
||||
{
|
||||
a0->helpBarIndex = HELPBAR_RIBBONS_MON_LIST;
|
||||
sub_81C97B0(a0, POKENAV_MENU_C);
|
||||
return 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
a0->callback = sub_81C9600;
|
||||
return 6;
|
||||
}
|
||||
case 4:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sub_81C9520(struct Pokenav1Struct *a0)
|
||||
{
|
||||
if (sub_81C9814(a0))
|
||||
return 1;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
if (sDescriptionIds[a0->menuType][a0->cursorPos] == 2)
|
||||
{
|
||||
a0->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
|
||||
sub_81C97B0(a0, POKENAV_MENU_B);
|
||||
return 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_HAZURE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
PlaySE(SE_HAZURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sub_81C9588(struct Pokenav1Struct *a0)
|
||||
{
|
||||
if (sub_81C9814(a0))
|
||||
return 1;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
u32 v0 = sDescriptionIds[a0->menuType][a0->cursorPos];
|
||||
if (v0 != 2 && v0 != 4)
|
||||
{
|
||||
PlaySE(SE_HAZURE);
|
||||
return 0;
|
||||
}
|
||||
else if (v0 == 2)
|
||||
{
|
||||
a0->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
|
||||
sub_81C97B0(a0, POKENAV_MENU_B);
|
||||
return 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sub_81C9600(struct Pokenav1Struct *a0)
|
||||
{
|
||||
if (sub_81C9814(a0))
|
||||
{
|
||||
a0->callback = sub_81C93EC();
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
{
|
||||
a0->callback = sub_81C93EC();
|
||||
return 7;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sub_81C963C(struct Pokenav1Struct *a0)
|
||||
{
|
||||
u32 v0 = sub_81C9814(a0);
|
||||
if (v0)
|
||||
return 1;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
switch (sDescriptionIds[a0->menuType][a0->cursorPos])
|
||||
{
|
||||
case 6:
|
||||
a0->menuType = 4;
|
||||
a0->cursorPos = v0;
|
||||
a0->descriptionId = sDescriptionIds[4][0];
|
||||
a0->callback = sub_81C96FC;
|
||||
return 4;
|
||||
case 5:
|
||||
a0->helpBarIndex = v0;
|
||||
sub_81C97B0(a0, POKENAV_MENU_7);
|
||||
return 8;
|
||||
case 7:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81C97C0(a0);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
if (a0->cursorPos != sLastCursorPositions[a0->menuType])
|
||||
{
|
||||
a0->cursorPos = sLastCursorPositions[a0->menuType];
|
||||
a0->callback = sub_81C9798;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81C97C0(a0);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sub_81C96FC(struct Pokenav1Struct *a0)
|
||||
{
|
||||
if (sub_81C9814(a0))
|
||||
return 1;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
u8 v0 = sDescriptionIds[a0->menuType][a0->cursorPos];
|
||||
if (v0 != 13)
|
||||
{
|
||||
sub_81C7694(v0 - 8);
|
||||
sub_81C97B0(a0, POKENAV_MENU_8);
|
||||
a0->helpBarIndex = HELPBAR_CONDITION_MON_LIST;
|
||||
return 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81C97F8(a0);
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
if (a0->cursorPos != sLastCursorPositions[a0->menuType])
|
||||
{
|
||||
a0->cursorPos = sLastCursorPositions[a0->menuType];
|
||||
a0->callback = sub_81C97A4;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81C97F8(a0);
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sub_81C9798(struct Pokenav1Struct *a0)
|
||||
{
|
||||
sub_81C97C0(a0);
|
||||
return 3;
|
||||
}
|
||||
|
||||
static u32 sub_81C97A4(struct Pokenav1Struct *a0)
|
||||
{
|
||||
sub_81C97F8(a0);
|
||||
return 5;
|
||||
}
|
||||
|
||||
static void sub_81C97B0(struct Pokenav1Struct *a0, u32 a1)
|
||||
{
|
||||
a0->unk8 = a1;
|
||||
a0->callback = sub_81C97BC;
|
||||
}
|
||||
|
||||
static u32 sub_81C97BC(struct Pokenav1Struct *a0)
|
||||
{
|
||||
return a0->unk8;
|
||||
}
|
||||
|
||||
static void sub_81C97C0(struct Pokenav1Struct *a0)
|
||||
{
|
||||
a0->menuType = GetPokenavMainMenuType();
|
||||
a0->cursorPos = 1;
|
||||
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
|
||||
a0->callback = sub_81C943C;
|
||||
}
|
||||
|
||||
static void sub_81C97F8(struct Pokenav1Struct *a0)
|
||||
{
|
||||
a0->menuType = 3;
|
||||
a0->cursorPos = 1;
|
||||
a0->descriptionId = sDescriptionIds[3][1];
|
||||
a0->callback = sub_81C963C;
|
||||
}
|
||||
|
||||
static bool32 sub_81C9814(struct Pokenav1Struct *a0)
|
||||
{
|
||||
if (gMain.newKeys & DPAD_UP)
|
||||
{
|
||||
if (--a0->cursorPos < 0)
|
||||
a0->cursorPos = sLastCursorPositions[a0->menuType];
|
||||
|
||||
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
|
||||
return TRUE;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_DOWN)
|
||||
{
|
||||
a0->cursorPos++;
|
||||
if (a0->cursorPos > sLastCursorPositions[a0->menuType])
|
||||
a0->cursorPos = 0;
|
||||
|
||||
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int sub_81C9894(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->menuType;
|
||||
}
|
||||
|
||||
int sub_81C98A4(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->cursorPos;
|
||||
}
|
||||
|
||||
int sub_81C98B4(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->descriptionId;
|
||||
}
|
||||
|
||||
u16 GetHelpBarTextId(void)
|
||||
{
|
||||
struct Pokenav1Struct *state = GetSubstructPtr(1);
|
||||
return state->helpBarIndex;
|
||||
}
|
@ -47,8 +47,8 @@
|
||||
.include "src/multiboot.o"
|
||||
.include "src/mirage_tower.o"
|
||||
.include "src/berry_fix_program.o"
|
||||
.include "src/pokenav_unk_7.o"
|
||||
.include "src/pokenav_unk_10.o"
|
||||
.include "src/pokenav_conditions_2.o"
|
||||
.include "src/pokenav_ribbons_2.o"
|
||||
.include "src/ereader_helpers.o"
|
||||
.include "src/faraway_island.o"
|
||||
.include "src/m4a_1.o"
|
||||
|
Loading…
x
Reference in New Issue
Block a user