Document some pokenav menu handlers

This commit is contained in:
GriffinR 2020-02-01 00:25:50 -05:00 committed by huderlem
parent 0cf84d13ef
commit be5d417236
13 changed files with 504 additions and 375 deletions

View File

@ -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_UNDERSCROE 0x09
#define EXT_CTRL_CODE_COLOR 0x1
#define EXT_CTRL_CODE_HIGHLIGHT 0x2
#define EXT_CTRL_CODE_SHADOW 0x3

View File

@ -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);
@ -255,15 +305,15 @@ 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
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);
@ -292,7 +342,7 @@ bool32 IsRematchEntryRegistered(int index);
// pokenav_unk_4.c
bool32 sub_81CB260(void);
void sub_81CB29C(s32 index);
void CreateMatchCallLoopedTask(s32 index);
u32 sub_81CB2CC(void);
void sub_81CB2E0(void);

View File

@ -6351,7 +6351,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);

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -9,50 +9,92 @@ struct Pokenav1Struct
{
u16 menuType;
s16 cursorPos;
u16 descriptionId;
u16 currMenuItem;
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 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);
static const u8 sLastCursorPositions[] = {2, 3, 4, 2, 5};
static const u8 sDescriptionIds[][6] =
// Number of entries - 1 for that menu type
static const u8 sLastCursorPositions[] =
{
{ 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 },
[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 retVal = 0;
u8 menuType = POKENAV_MENU_TYPE_DEFAULT;
if (FlagGet(FLAG_ADDED_MATCH_CALL_TO_POKENAV))
{
retVal = 1;
menuType = POKENAV_MENU_TYPE_UNLOCK_MC;
if (FlagGet(FLAG_SYS_RIBBON_GET))
retVal = 2;
menuType = POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS;
}
return retVal;
return menuType;
}
bool32 PokenavCallback_Init_0(void)
@ -63,9 +105,9 @@ bool32 PokenavCallback_Init_0(void)
state->menuType = GetPokenavMainMenuType();
state->cursorPos = 0;
state->descriptionId = 0;
state->currMenuItem = POKENAV_MENUITEM_MAP;
state->helpBarIndex = HELPBAR_NONE;
sub_81C939C(state);
SetMenuInputHandler(state);
return TRUE;
}
@ -77,9 +119,9 @@ bool32 PokenavCallback_Init_4(void)
state->menuType = GetPokenavMainMenuType();
state->cursorPos = 2;
state->descriptionId = 2;
state->currMenuItem = POKENAV_MENUITEM_MATCH_CALL;
state->helpBarIndex = HELPBAR_NONE;
sub_81C939C(state);
SetMenuInputHandler(state);
return TRUE;
}
@ -91,8 +133,8 @@ bool32 PokenavCallback_Init_5(void)
state->menuType = GetPokenavMainMenuType();
state->cursorPos = 3;
state->descriptionId = 3;
sub_81C939C(state);
state->currMenuItem = POKENAV_MENUITEM_RIBBONS;
SetMenuInputHandler(state);
return TRUE;
}
@ -102,11 +144,11 @@ bool32 PokenavCallback_Init_2(void)
if (!state)
return FALSE;
state->menuType = 3;
state->menuType = POKENAV_MENU_TYPE_CONDITION;
state->cursorPos = 0;
state->descriptionId = 5;
state->currMenuItem = POKENAV_MENUITEM_CONDITION_PARTY;
state->helpBarIndex = HELPBAR_NONE;
sub_81C939C(state);
SetMenuInputHandler(state);
return TRUE;
}
@ -116,45 +158,45 @@ bool32 PokenavCallback_Init_3(void)
if (!state)
return FALSE;
state->menuType = 4;
state->cursorPos = sub_81C76AC();
state->descriptionId = state->cursorPos + 8;
state->menuType = POKENAV_MENU_TYPE_CONDITION_SEARCH;
state->cursorPos = GetSelectedConditionSearch();
state->currMenuItem = state->cursorPos + POKENAV_MENUITEM_CONDITION_SEARCH_COOL;
state->helpBarIndex = HELPBAR_NONE;
sub_81C939C(state);
SetMenuInputHandler(state);
return TRUE;
}
static void sub_81C939C(struct Pokenav1Struct *state)
static void SetMenuInputHandler(struct Pokenav1Struct *state)
{
switch (state->menuType)
{
case 0:
case POKENAV_MENU_TYPE_DEFAULT:
SetPokenavMode(POKENAV_MODE_NORMAL);
// fallthrough
case 1:
case 2:
state->callback = sub_81C93EC();
case POKENAV_MENU_TYPE_UNLOCK_MC:
case POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS:
state->callback = GetMainMenuInputHandler();
break;
case 3:
state->callback = sub_81C963C;
case POKENAV_MENU_TYPE_CONDITION:
state->callback = HandleConditionMenuInput;
break;
case 4:
state->callback = sub_81C96FC;
case POKENAV_MENU_TYPE_CONDITION_SEARCH:
state->callback = HandleConditionSearchMenuInput;
break;
}
}
static u32 (*sub_81C93EC(void))(struct Pokenav1Struct*)
static u32 (*GetMainMenuInputHandler(void))(struct Pokenav1Struct*)
{
switch (GetPokenavMode())
{
default:
case POKENAV_MODE_NORMAL:
return sub_81C943C;
return HandleMainMenuInput;
case POKENAV_MODE_FORCE_CALL_READY:
return sub_81C9520;
return HandleMainMenuInputTutorial;
case POKENAV_MODE_FORCE_CALL_EXIT:
return sub_81C9588;
return HandleMainMenuInputEndTutorial;
}
}
@ -169,42 +211,42 @@ void sub_81C9430(void)
FreePokenavSubstruct(1);
}
static u32 sub_81C943C(struct Pokenav1Struct *a0)
static u32 HandleMainMenuInput(struct Pokenav1Struct *state)
{
if (sub_81C9814(a0))
return 1;
if (UpdateMenuCursorPos(state))
return POKENAV_MENU_FUNC_MOVE_CURSOR;
if (gMain.newKeys & A_BUTTON)
{
switch (sDescriptionIds[a0->menuType][a0->cursorPos])
switch (sMenuItems[state->menuType][state->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:
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())
{
a0->helpBarIndex = HELPBAR_RIBBONS_MON_LIST;
sub_81C97B0(a0, POKENAV_MENU_C);
return 8;
state->helpBarIndex = HELPBAR_RIBBONS_MON_LIST;
sub_81C97B0(state, POKENAV_MENU_C);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
}
else
{
a0->callback = sub_81C9600;
return 6;
state->callback = HandleCantOpenRibbonsInput;
return POKENAV_MENU_FUNC_NO_RIBBON_WINNERS;
}
case 4:
case POKENAV_MENUITEM_SWITCH_OFF:
return -1;
}
}
@ -212,56 +254,58 @@ static u32 sub_81C943C(struct Pokenav1Struct *a0)
if (gMain.newKeys & B_BUTTON)
return -1;
return 0;
return POKENAV_MENU_FUNC_NONE;
}
static u32 sub_81C9520(struct Pokenav1Struct *a0)
// Force the player to select Match Call during the call Mr. Stone pokenav tutorial
static u32 HandleMainMenuInputTutorial(struct Pokenav1Struct *state)
{
if (sub_81C9814(a0))
return 1;
if (UpdateMenuCursorPos(state))
return POKENAV_MENU_FUNC_MOVE_CURSOR;
if (gMain.newKeys & A_BUTTON)
{
if (sDescriptionIds[a0->menuType][a0->cursorPos] == 2)
if (sMenuItems[state->menuType][state->cursorPos] == POKENAV_MENUITEM_MATCH_CALL)
{
a0->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
sub_81C97B0(a0, POKENAV_MENU_B);
return 8;
state->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
sub_81C97B0(state, POKENAV_MENU_B);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
}
else
{
PlaySE(SE_HAZURE);
return 0;
return POKENAV_MENU_FUNC_NONE;
}
}
if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_HAZURE);
return 0;
return POKENAV_MENU_FUNC_NONE;
}
return 0;
return POKENAV_MENU_FUNC_NONE;
}
static u32 sub_81C9588(struct Pokenav1Struct *a0)
// After calling Mr. Stone during the pokenav tutorial, force player to exit or use Match Call again
static u32 HandleMainMenuInputEndTutorial(struct Pokenav1Struct *state)
{
if (sub_81C9814(a0))
return 1;
if (UpdateMenuCursorPos(state))
return POKENAV_MENU_FUNC_MOVE_CURSOR;
if (gMain.newKeys & A_BUTTON)
{
u32 v0 = sDescriptionIds[a0->menuType][a0->cursorPos];
if (v0 != 2 && v0 != 4)
u32 menuItem = sMenuItems[state->menuType][state->cursorPos];
if (menuItem != POKENAV_MENUITEM_MATCH_CALL && menuItem != POKENAV_MENUITEM_SWITCH_OFF)
{
PlaySE(SE_HAZURE);
return 0;
return POKENAV_MENU_FUNC_NONE;
}
else if (v0 == 2)
else if (menuItem == POKENAV_MENUITEM_MATCH_CALL)
{
a0->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
sub_81C97B0(a0, POKENAV_MENU_B);
return 8;
state->helpBarIndex = HELPBAR_MC_TRAINER_LIST;
sub_81C97B0(state, POKENAV_MENU_B);
return POKENAV_MENU_FUNC_OPEN_FEATURE;
}
else
{
@ -272,167 +316,168 @@ static u32 sub_81C9588(struct Pokenav1Struct *a0)
{
return -1;
}
return 0;
return POKENAV_MENU_FUNC_NONE;
}
static u32 sub_81C9600(struct Pokenav1Struct *a0)
// 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 (sub_81C9814(a0))
if (UpdateMenuCursorPos(state))
{
a0->callback = sub_81C93EC();
return 1;
state->callback = GetMainMenuInputHandler();
return POKENAV_MENU_FUNC_MOVE_CURSOR;
}
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
a0->callback = sub_81C93EC();
return 7;
state->callback = GetMainMenuInputHandler();
return POKENAV_MENU_FUNC_RESHOW_DESCRIPTION;
}
return 0;
return POKENAV_MENU_FUNC_NONE;
}
static u32 sub_81C963C(struct Pokenav1Struct *a0)
static u32 HandleConditionMenuInput(struct Pokenav1Struct *state)
{
u32 v0 = sub_81C9814(a0);
if (v0)
return 1;
if (UpdateMenuCursorPos(state))
return POKENAV_MENU_FUNC_MOVE_CURSOR;
if (gMain.newKeys & A_BUTTON)
{
switch (sDescriptionIds[a0->menuType][a0->cursorPos])
switch (sMenuItems[state->menuType][state->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:
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);
sub_81C97C0(a0);
return 3;
ReturnToMainMenu(state);
return POKENAV_MENU_FUNC_RETURN_TO_MAIN;
}
}
if (gMain.newKeys & B_BUTTON)
{
if (a0->cursorPos != sLastCursorPositions[a0->menuType])
if (state->cursorPos != sLastCursorPositions[state->menuType])
{
a0->cursorPos = sLastCursorPositions[a0->menuType];
a0->callback = sub_81C9798;
return 1;
state->cursorPos = sLastCursorPositions[state->menuType];
state->callback = CB2_ReturnToMainMenu;
return POKENAV_MENU_FUNC_MOVE_CURSOR;
}
else
{
PlaySE(SE_SELECT);
sub_81C97C0(a0);
return 3;
ReturnToMainMenu(state);
return POKENAV_MENU_FUNC_RETURN_TO_MAIN;
}
}
return 0;
return POKENAV_MENU_FUNC_NONE;
}
static u32 sub_81C96FC(struct Pokenav1Struct *a0)
static u32 HandleConditionSearchMenuInput(struct Pokenav1Struct *state)
{
if (sub_81C9814(a0))
return 1;
if (UpdateMenuCursorPos(state))
return POKENAV_MENU_FUNC_MOVE_CURSOR;
if (gMain.newKeys & A_BUTTON)
{
u8 v0 = sDescriptionIds[a0->menuType][a0->cursorPos];
if (v0 != 13)
u8 menuItem = sMenuItems[state->menuType][state->cursorPos];
if (menuItem != POKENAV_MENUITEM_CONDITION_SEARCH_CANCEL)
{
sub_81C7694(v0 - 8);
sub_81C97B0(a0, POKENAV_MENU_8);
a0->helpBarIndex = HELPBAR_CONDITION_MON_LIST;
return 8;
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);
sub_81C97F8(a0);
return 5;
ReturnToConditionMenu(state);
return POKENAV_MENU_FUNC_RETURN_TO_CONDITION;
}
}
if (gMain.newKeys & B_BUTTON)
{
if (a0->cursorPos != sLastCursorPositions[a0->menuType])
if (state->cursorPos != sLastCursorPositions[state->menuType])
{
a0->cursorPos = sLastCursorPositions[a0->menuType];
a0->callback = sub_81C97A4;
return 1;
state->cursorPos = sLastCursorPositions[state->menuType];
state->callback = CB2_ReturnToConditionMenu;
return POKENAV_MENU_FUNC_MOVE_CURSOR;
}
else
{
PlaySE(SE_SELECT);
sub_81C97F8(a0);
return 5;
ReturnToConditionMenu(state);
return POKENAV_MENU_FUNC_RETURN_TO_CONDITION;
}
}
return 0;
return POKENAV_MENU_FUNC_NONE;
}
static u32 sub_81C9798(struct Pokenav1Struct *a0)
static u32 CB2_ReturnToMainMenu(struct Pokenav1Struct *state)
{
sub_81C97C0(a0);
return 3;
ReturnToMainMenu(state);
return POKENAV_MENU_FUNC_RETURN_TO_MAIN;
}
static u32 sub_81C97A4(struct Pokenav1Struct *a0)
static u32 CB2_ReturnToConditionMenu(struct Pokenav1Struct *state)
{
sub_81C97F8(a0);
return 5;
ReturnToConditionMenu(state);
return POKENAV_MENU_FUNC_RETURN_TO_CONDITION;
}
static void sub_81C97B0(struct Pokenav1Struct *a0, u32 a1)
static void sub_81C97B0(struct Pokenav1Struct *state, u32 a1)
{
a0->unk8 = a1;
a0->callback = sub_81C97BC;
state->unk8 = a1;
state->callback = sub_81C97BC;
}
static u32 sub_81C97BC(struct Pokenav1Struct *a0)
static u32 sub_81C97BC(struct Pokenav1Struct *state)
{
return a0->unk8;
return state->unk8;
}
static void sub_81C97C0(struct Pokenav1Struct *a0)
static void ReturnToMainMenu(struct Pokenav1Struct *state)
{
a0->menuType = GetPokenavMainMenuType();
a0->cursorPos = 1;
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
a0->callback = sub_81C943C;
state->menuType = GetPokenavMainMenuType();
state->cursorPos = 1;
state->currMenuItem = sMenuItems[state->menuType][state->cursorPos];
state->callback = HandleMainMenuInput;
}
static void sub_81C97F8(struct Pokenav1Struct *a0)
static void ReturnToConditionMenu(struct Pokenav1Struct *state)
{
a0->menuType = 3;
a0->cursorPos = 1;
a0->descriptionId = sDescriptionIds[3][1];
a0->callback = sub_81C963C;
state->menuType = POKENAV_MENU_TYPE_CONDITION;
state->cursorPos = 1;
state->currMenuItem = sMenuItems[POKENAV_MENU_TYPE_CONDITION][1];
state->callback = HandleConditionMenuInput;
}
static bool32 sub_81C9814(struct Pokenav1Struct *a0)
static bool32 UpdateMenuCursorPos(struct Pokenav1Struct *state)
{
if (gMain.newKeys & DPAD_UP)
{
if (--a0->cursorPos < 0)
a0->cursorPos = sLastCursorPositions[a0->menuType];
if (--state->cursorPos < 0)
state->cursorPos = sLastCursorPositions[state->menuType];
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
state->currMenuItem = sMenuItems[state->menuType][state->cursorPos];
return TRUE;
}
else if (gMain.newKeys & DPAD_DOWN)
{
a0->cursorPos++;
if (a0->cursorPos > sLastCursorPositions[a0->menuType])
a0->cursorPos = 0;
state->cursorPos++;
if (state->cursorPos > sLastCursorPositions[state->menuType])
state->cursorPos = 0;
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
state->currMenuItem = sMenuItems[state->menuType][state->cursorPos];
return TRUE;
}
else
@ -441,22 +486,24 @@ static bool32 sub_81C9814(struct Pokenav1Struct *a0)
}
}
int sub_81C9894(void)
int GetPokenavMenuType(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->menuType;
}
int sub_81C98A4(void)
// Position of cursor relative to number of current menu options
int GetPokenavCursorPos(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->cursorPos;
}
int sub_81C98B4(void)
// ID of menu item the cursor is currently on
int GetCurrentMenuItemId(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->descriptionId;
return state->currMenuItem;
}
u16 GetHelpBarTextId(void)

View File

@ -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[] =

View File

@ -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,39 +175,45 @@ 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}
0x14,
{gUnknown_0862020C, gUnknown_08620210, gUnknown_0862021C}
},
[POKENAV_MENU_TYPE_UNLOCK_MC] =
{
0x2A,
0x14,
{gUnknown_0862020C, gUnknown_08620210, gUnknown_08620214, gUnknown_0862021C}
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}
0x14,
{gUnknown_0862020C, gUnknown_08620210, gUnknown_08620214, gUnknown_08620218, gUnknown_0862021C}
},
[POKENAV_MENU_TYPE_CONDITION] =
{
0x38,
0x14,
{gUnknown_08620220, gUnknown_08620224, gUnknown_0862023C}
0x14,
{gUnknown_08620220, gUnknown_08620224, gUnknown_0862023C}
},
[POKENAV_MENU_TYPE_CONDITION_SEARCH] =
{
0x28,
0x10,
{gUnknown_08620228, gUnknown_0862022C, gUnknown_08620230, gUnknown_08620234, gUnknown_08620238, gUnknown_0862023C}
0x10,
{gUnknown_08620228, gUnknown_0862022C, gUnknown_08620230, gUnknown_08620234, gUnknown_08620238, gUnknown_0862023C}
},
};
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 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
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);

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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);