mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 13:53:52 +01:00
more documentation in match_call_data
Documents everything related to UnkStruct_08625388, names HasCheckPage functions, fixes mislabeled Brendan/May headers, and adds header count to pokenav_unk_3
This commit is contained in:
parent
5b8d0f1c33
commit
4228750e38
@ -56,6 +56,32 @@ enum
|
||||
POKENAV_MENU_E,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MC_HEADER_MR_STONE,
|
||||
MC_HEADER_PROF_BIRCH,
|
||||
MC_HEADER_BRENDAN,
|
||||
MC_HEADER_MAY,
|
||||
MC_HEADER_WALLY,
|
||||
MC_HEADER_NORMAN,
|
||||
MC_HEADER_MOM,
|
||||
MC_HEADER_STEVEN,
|
||||
MC_HEADER_SCOTT,
|
||||
MC_HEADER_ROXANNE,
|
||||
MC_HEADER_BRAWLY,
|
||||
MC_HEADER_WATTSON,
|
||||
MC_HEADER_FLANNERY,
|
||||
MC_HEADER_WINONA,
|
||||
MC_HEADER_TATE_LIZA,
|
||||
MC_HEADER_JUAN,
|
||||
MC_HEADER_SIDNEY,
|
||||
MC_HEADER_PHOEBE,
|
||||
MC_HEADER_GLACIA,
|
||||
MC_HEADER_DRAKE,
|
||||
MC_HEADER_WALLACE,
|
||||
MC_HEADER_COUNT
|
||||
};
|
||||
|
||||
// pokenav.c
|
||||
void sub_81C7694(u32);
|
||||
u32 sub_81C76AC(void);
|
||||
@ -109,15 +135,15 @@ bool32 sub_81C81D4(const struct BgTemplate *arg0, struct MatchCallListTemplate *
|
||||
void sub_81C8234(void);
|
||||
|
||||
// pokenav_match_call_data.c
|
||||
bool32 sub_81D17E8(u32 idx);
|
||||
bool32 MatchCall_HasCheckPage(u32 idx);
|
||||
u8 MatchCallMapSecGetByIndex(u32 idx);
|
||||
bool32 sub_81D1BF8(u32 idx);
|
||||
bool32 MatchCallFlagGetByIndex(u32 idx);
|
||||
u32 MatchCall_GetRematchTableIdx(u32 idx);
|
||||
u32 GetTrainerIdxByRematchIdx(u32 rematchIdx);
|
||||
int sub_81D1BD0(u32 idx);
|
||||
int MatchCall_GetOverrideFacilityClass(u32 idx);
|
||||
void MatchCall_GetMessage(u32 idx, u8 *dest);
|
||||
const u8 *sub_81D1B40(u32 idx, u32 offset);
|
||||
const u8 *MatchCall_GetOverrideFlavorText(u32 idx, u32 offset);
|
||||
void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name);
|
||||
|
||||
// pokenav_main_menu.c
|
||||
|
@ -6,7 +6,9 @@
|
||||
#include "battle.h"
|
||||
#include "gym_leader_rematch.h"
|
||||
#include "match_call.h"
|
||||
#include "pokenav.h"
|
||||
#include "constants/region_map_sections.h"
|
||||
#include "constants/trainers.h"
|
||||
|
||||
// Static type declarations
|
||||
|
||||
@ -94,11 +96,11 @@ typedef union {
|
||||
const struct MatchCallStruct5 *type5;
|
||||
} match_call_t;
|
||||
|
||||
struct UnkStruct_08625388 {
|
||||
struct MatchCallOverride {
|
||||
u16 idx;
|
||||
u16 v2;
|
||||
u32 v4;
|
||||
const u8 *v8[4];
|
||||
u16 facilityClass;
|
||||
u32 flag;
|
||||
const u8 *flavorTexts[4];
|
||||
};
|
||||
|
||||
// Static RAM declarations
|
||||
@ -123,11 +125,11 @@ static bool32 MatchCall_IsRematchable_Type2(match_call_t);
|
||||
static bool32 MatchCall_IsRematchable_Type3(match_call_t);
|
||||
static bool32 MatchCall_IsRematchable_Type4(match_call_t);
|
||||
|
||||
static bool32 sub_81D1840(match_call_t);
|
||||
static bool32 sub_81D1844(match_call_t);
|
||||
static bool32 sub_81D1848(match_call_t);
|
||||
static bool32 sub_81D184C(match_call_t);
|
||||
static bool32 sub_81D1850(match_call_t);
|
||||
static bool32 MatchCall_HasCheckPage_Type0(match_call_t);
|
||||
static bool32 MatchCall_HasCheckPage_Type1(match_call_t);
|
||||
static bool32 MatchCall_HasCheckPage_Type2(match_call_t);
|
||||
static bool32 MatchCall_HasCheckPage_Type3(match_call_t);
|
||||
static bool32 MatchCall_HasCheckPage_Type4(match_call_t);
|
||||
|
||||
static u32 MatchCall_GetRematchTableIdx_Type0(match_call_t);
|
||||
static u32 MatchCall_GetRematchTableIdx_Type1(match_call_t);
|
||||
@ -423,10 +425,10 @@ static const match_call_text_data_t sMayTextScripts[] = {
|
||||
{ NULL, 0xFFFF, 0xFFFF }
|
||||
};
|
||||
|
||||
static const struct MatchCallStruct4 sBrendanMatchCallHeader =
|
||||
static const struct MatchCallStruct4 sMayMatchCallHeader =
|
||||
{
|
||||
.type = 4,
|
||||
.gender = MALE,
|
||||
.gender = MALE, //Gender of player
|
||||
.flag = FLAG_ENABLE_RIVAL_MATCH_CALL,
|
||||
.desc = gMayBrendanMatchCallDesc,
|
||||
.name = gExpandedPlaceholder_May,
|
||||
@ -452,10 +454,10 @@ static const match_call_text_data_t sBrendanTextScripts[] = {
|
||||
{ NULL, 0xFFFF, 0xFFFF }
|
||||
};
|
||||
|
||||
static const struct MatchCallStruct4 sMayMatchCallHeader =
|
||||
static const struct MatchCallStruct4 sBrendanMatchCallHeader =
|
||||
{
|
||||
.type = 4,
|
||||
.gender = FEMALE,
|
||||
.gender = FEMALE, //Gender of player
|
||||
.flag = FLAG_ENABLE_RIVAL_MATCH_CALL,
|
||||
.desc = gMayBrendanMatchCallDesc,
|
||||
.name = gExpandedPlaceholder_Brendan,
|
||||
@ -727,27 +729,27 @@ static const struct MatchCallStruct5 sWallaceMatchCallHeader =
|
||||
};
|
||||
|
||||
static const match_call_t sMatchCallHeaders[] = {
|
||||
{.type0 = &sMrStoneMatchCallHeader},
|
||||
{.type3 = &sProfBirchMatchCallHeader},
|
||||
{.type4 = &sMayMatchCallHeader},
|
||||
{.type4 = &sBrendanMatchCallHeader},
|
||||
{.type2 = &sWallyMatchCallHeader},
|
||||
{.type5 = &sNormanMatchCallHeader},
|
||||
{.type0 = &sMomMatchCallHeader},
|
||||
{.type0 = &sStevenMatchCallHeader},
|
||||
{.type0 = &sScottMatchCallHeader},
|
||||
{.type5 = &sRoxanneMatchCallHeader},
|
||||
{.type5 = &sBrawlyMatchCallHeader},
|
||||
{.type5 = &sWattsonMatchCallHeader},
|
||||
{.type5 = &sFlanneryMatchCallHeader},
|
||||
{.type5 = &sWinonaMatchCallHeader},
|
||||
{.type5 = &sTateLizaMatchCallHeader},
|
||||
{.type5 = &sJuanMatchCallHeader},
|
||||
{.type5 = &sSidneyMatchCallHeader},
|
||||
{.type5 = &sPhoebeMatchCallHeader},
|
||||
{.type5 = &sGlaciaMatchCallHeader},
|
||||
{.type5 = &sDrakeMatchCallHeader},
|
||||
{.type5 = &sWallaceMatchCallHeader}
|
||||
[MC_HEADER_MR_STONE] = {.type0 = &sMrStoneMatchCallHeader},
|
||||
[MC_HEADER_PROF_BIRCH] = {.type3 = &sProfBirchMatchCallHeader},
|
||||
[MC_HEADER_BRENDAN] = {.type4 = &sBrendanMatchCallHeader},
|
||||
[MC_HEADER_MAY] = {.type4 = &sMayMatchCallHeader},
|
||||
[MC_HEADER_WALLY] = {.type2 = &sWallyMatchCallHeader},
|
||||
[MC_HEADER_NORMAN] = {.type5 = &sNormanMatchCallHeader},
|
||||
[MC_HEADER_MOM] = {.type0 = &sMomMatchCallHeader},
|
||||
[MC_HEADER_STEVEN] = {.type0 = &sStevenMatchCallHeader},
|
||||
[MC_HEADER_SCOTT] = {.type0 = &sScottMatchCallHeader},
|
||||
[MC_HEADER_ROXANNE] = {.type5 = &sRoxanneMatchCallHeader},
|
||||
[MC_HEADER_BRAWLY] = {.type5 = &sBrawlyMatchCallHeader},
|
||||
[MC_HEADER_WATTSON] = {.type5 = &sWattsonMatchCallHeader},
|
||||
[MC_HEADER_FLANNERY] = {.type5 = &sFlanneryMatchCallHeader},
|
||||
[MC_HEADER_WINONA] = {.type5 = &sWinonaMatchCallHeader},
|
||||
[MC_HEADER_TATE_LIZA] = {.type5 = &sTateLizaMatchCallHeader},
|
||||
[MC_HEADER_JUAN] = {.type5 = &sJuanMatchCallHeader},
|
||||
[MC_HEADER_SIDNEY] = {.type5 = &sSidneyMatchCallHeader},
|
||||
[MC_HEADER_PHOEBE] = {.type5 = &sPhoebeMatchCallHeader},
|
||||
[MC_HEADER_GLACIA] = {.type5 = &sGlaciaMatchCallHeader},
|
||||
[MC_HEADER_DRAKE] = {.type5 = &sDrakeMatchCallHeader},
|
||||
[MC_HEADER_WALLACE] = {.type5 = &sWallaceMatchCallHeader}
|
||||
};
|
||||
|
||||
static bool32 (*const sMatchCallGetFlagFuncs[])(match_call_t) = {
|
||||
@ -774,12 +776,12 @@ static bool32 (*const sMatchCall_IsRematchableFunctions[])(match_call_t) = {
|
||||
MatchCall_IsRematchable_Type3
|
||||
};
|
||||
|
||||
static bool32 (*const gUnknown_08625338[])(match_call_t) = {
|
||||
sub_81D1840,
|
||||
sub_81D1844,
|
||||
sub_81D1848,
|
||||
sub_81D184C,
|
||||
sub_81D1850
|
||||
static bool32 (*const sMatchCall_HasCheckPageFunctions[])(match_call_t) = {
|
||||
MatchCall_HasCheckPage_Type0,
|
||||
MatchCall_HasCheckPage_Type1,
|
||||
MatchCall_HasCheckPage_Type2,
|
||||
MatchCall_HasCheckPage_Type4,
|
||||
MatchCall_HasCheckPage_Type3
|
||||
};
|
||||
|
||||
static u32 (*const sMatchCall_GetRematchTableIdxFunctions[])(match_call_t) = {
|
||||
@ -806,11 +808,11 @@ static void (*const sMatchCall_GetNameAndDescFunctions[])(match_call_t, const u8
|
||||
MatchCall_GetNameAndDesc_Type3
|
||||
};
|
||||
|
||||
static const struct UnkStruct_08625388 sMatchCallCheckPageOverrides[] = {
|
||||
{ 7, 0x4B, 0xffff, { gMatchCallStevenStrategyText, gMatchCall_StevenTrainersPokemonText, gMatchCall_StevenSelfIntroductionText_Line1_BeforeMeteorFallsBattle, gMatchCall_StevenSelfIntroductionText_Line2_BeforeMeteorFallsBattle } }, // STEVEN
|
||||
{ 7, 0x4B, FLAG_DEFEATED_MOSSDEEP_GYM, { gMatchCallStevenStrategyText, gMatchCall_StevenTrainersPokemonText, gMatchCall_StevenSelfIntroductionText_Line1_AfterMeteorFallsBattle, gMatchCall_StevenSelfIntroductionText_Line2_AfterMeteorFallsBattle } }, // STEVEN
|
||||
{ 2, 0x3c, 0xffff, { gMatchCall_BrendanStrategyText, gMatchCall_BrendanTrainersPokemonText, gMatchCall_BrendanSelfIntroductionText_Line1, gMatchCall_BrendanSelfIntroductionText_Line2 } }, // Brendan
|
||||
{ 3, 0x3f, 0xffff, { gMatchCall_MayStrategyText, gMatchCall_MayTrainersPokemonText, gMatchCall_MaySelfIntroductionText_Line1, gMatchCall_MaySelfIntroductionText_Line2 } } // May
|
||||
static const struct MatchCallOverride sMatchCallCheckPageOverrides[] = {
|
||||
{ MC_HEADER_STEVEN, FACILITY_CLASS_STEVEN, 0xFFFF, { gMatchCallStevenStrategyText, gMatchCall_StevenTrainersPokemonText, gMatchCall_StevenSelfIntroductionText_Line1_BeforeMeteorFallsBattle, gMatchCall_StevenSelfIntroductionText_Line2_BeforeMeteorFallsBattle } }, // STEVEN
|
||||
{ MC_HEADER_STEVEN, FACILITY_CLASS_STEVEN, FLAG_DEFEATED_MOSSDEEP_GYM, { gMatchCallStevenStrategyText, gMatchCall_StevenTrainersPokemonText, gMatchCall_StevenSelfIntroductionText_Line1_AfterMeteorFallsBattle, gMatchCall_StevenSelfIntroductionText_Line2_AfterMeteorFallsBattle } }, // STEVEN
|
||||
{ MC_HEADER_BRENDAN, FACILITY_CLASS_BRENDAN, 0xFFFF, { gMatchCall_BrendanStrategyText, gMatchCall_BrendanTrainersPokemonText, gMatchCall_BrendanSelfIntroductionText_Line1, gMatchCall_BrendanSelfIntroductionText_Line2 } }, // Brendan
|
||||
{ MC_HEADER_MAY, FACILITY_CLASS_MAY, 0xFFFF, { gMatchCall_MayStrategyText, gMatchCall_MayTrainersPokemonText, gMatchCall_MaySelfIntroductionText_Line1, gMatchCall_MaySelfIntroductionText_Line2 } } // May
|
||||
};
|
||||
|
||||
// .text
|
||||
@ -981,7 +983,7 @@ static bool32 MatchCall_IsRematchable_Type3(match_call_t matchCall)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 sub_81D17E8(u32 idx)
|
||||
bool32 MatchCall_HasCheckPage(u32 idx)
|
||||
{
|
||||
match_call_t matchCall;
|
||||
u32 i;
|
||||
@ -990,7 +992,7 @@ bool32 sub_81D17E8(u32 idx)
|
||||
return FALSE;
|
||||
matchCall = sMatchCallHeaders[idx];
|
||||
i = MatchCallGetFunctionIndex(matchCall);
|
||||
if (gUnknown_08625338[i](matchCall))
|
||||
if (sMatchCall_HasCheckPageFunctions[i](matchCall))
|
||||
return TRUE;
|
||||
for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++)
|
||||
{
|
||||
@ -1000,27 +1002,27 @@ bool32 sub_81D17E8(u32 idx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool32 sub_81D1840(match_call_t matchCall)
|
||||
static bool32 MatchCall_HasCheckPage_Type0(match_call_t matchCall)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool32 sub_81D1844(match_call_t matchCall)
|
||||
static bool32 MatchCall_HasCheckPage_Type1(match_call_t matchCall)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool32 sub_81D1848(match_call_t matchCall)
|
||||
static bool32 MatchCall_HasCheckPage_Type2(match_call_t matchCall)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool32 sub_81D184C(match_call_t matchCall)
|
||||
static bool32 MatchCall_HasCheckPage_Type4(match_call_t matchCall)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool32 sub_81D1850(match_call_t matchCall)
|
||||
static bool32 MatchCall_HasCheckPage_Type3(match_call_t matchCall)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -1210,7 +1212,7 @@ static void MatchCall_GetNameAndDescByRematchIdx(u32 idx, const u8 **desc, const
|
||||
*name = trainer->trainerName;
|
||||
}
|
||||
|
||||
const u8 *sub_81D1B40(u32 idx, u32 offset)
|
||||
const u8 *MatchCall_GetOverrideFlavorText(u32 idx, u32 offset)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
@ -1224,24 +1226,24 @@ const u8 *sub_81D1B40(u32 idx, u32 offset)
|
||||
break;
|
||||
if (sMatchCallCheckPageOverrides[i + 1].idx != idx)
|
||||
break;
|
||||
if (!FlagGet(sMatchCallCheckPageOverrides[i + 1].v4))
|
||||
if (!FlagGet(sMatchCallCheckPageOverrides[i + 1].flag))
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
return sMatchCallCheckPageOverrides[i].v8[offset];
|
||||
return sMatchCallCheckPageOverrides[i].flavorTexts[offset];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int sub_81D1BD0(u32 idx)
|
||||
int MatchCall_GetOverrideFacilityClass(u32 idx)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++)
|
||||
{
|
||||
if (sMatchCallCheckPageOverrides[i].idx == idx)
|
||||
return sMatchCallCheckPageOverrides[i].v2;
|
||||
return sMatchCallCheckPageOverrides[i].facilityClass;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ static u32 sub_81CAB44(struct Pokenav3Struct *state)
|
||||
state->callback = sub_81CAC04;
|
||||
state->unk0 = 0;
|
||||
selectedMatchCall = GetSelectedMatchCall();
|
||||
if (!state->unk1C[selectedMatchCall].boxId || sub_81D17E8(state->unk1C[selectedMatchCall].unk6))
|
||||
if (!state->unk1C[selectedMatchCall].boxId || MatchCall_HasCheckPage(state->unk1C[selectedMatchCall].unk6))
|
||||
{
|
||||
state->unk4 = gUnknown_0862250A;
|
||||
state->unk2 = 2;
|
||||
@ -212,7 +212,7 @@ static u32 sub_81CAD20(s32 taskState)
|
||||
state->unkA++;
|
||||
}
|
||||
|
||||
if (++state->unk8 >= 21) // TODO: This is the size of sMatchCallHeaders
|
||||
if (++state->unk8 >= MC_HEADER_COUNT)
|
||||
{
|
||||
state->unkC = state->unk8;
|
||||
state->unk8 = 0;
|
||||
@ -331,7 +331,7 @@ int sub_81CAF04(int index)
|
||||
return gTrainers[index].trainerPic;
|
||||
}
|
||||
|
||||
index = sub_81D1BD0(var0);
|
||||
index = MatchCall_GetOverrideFacilityClass(var0);
|
||||
return gFacilityClassToPicIndex[index];
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ const u8 *sub_81CAFD8(int index, int textType)
|
||||
{
|
||||
var0 = MatchCall_GetRematchTableIdx(state->unk1C[index].unk6);
|
||||
if (var0 == REMATCH_TABLE_ENTRIES)
|
||||
return sub_81D1B40(state->unk1C[index].unk6, textType);
|
||||
return MatchCall_GetOverrideFlavorText(state->unk1C[index].unk6, textType);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -426,7 +426,7 @@ int sub_81CB0E4(int index)
|
||||
{
|
||||
if (!state->unk1C[index].boxId)
|
||||
return count;
|
||||
if (sub_81D17E8(state->unk1C[index].unk6))
|
||||
if (MatchCall_HasCheckPage(state->unk1C[index].unk6))
|
||||
return count;
|
||||
|
||||
count++;
|
||||
@ -443,7 +443,7 @@ int sub_81CB128(int index)
|
||||
{
|
||||
if (!state->unk1C[index].boxId)
|
||||
return count;
|
||||
if (sub_81D17E8(state->unk1C[index].unk6))
|
||||
if (MatchCall_HasCheckPage(state->unk1C[index].unk6))
|
||||
return count;
|
||||
|
||||
count--;
|
||||
@ -462,7 +462,7 @@ bool32 unref_sub_81CB16C(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 21; i++) // TODO: This is the size of sMatchCallHeaders
|
||||
for (i = 0; i < MC_HEADER_COUNT; i++)
|
||||
{
|
||||
if (MatchCallFlagGetByIndex(i))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user