summaryrefslogtreecommitdiff
path: root/src/pokenav_match_call_data.c
diff options
context:
space:
mode:
authorGriffinR <griffin.richards@comcast.net>2019-09-26 15:02:38 -0400
committerGitHub <noreply@github.com>2019-09-26 15:02:38 -0400
commit1016b239186097361ea20f2f91adf3932026f40c (patch)
tree840a0f28046d3c66fcaf1c2bb8ab3228386a3a8a /src/pokenav_match_call_data.c
parentbb236b490d99fef02ed172e7ca86f6c70ef09527 (diff)
parent208e1c968959c781562f0b94c03368385ce7012c (diff)
Merge branch 'master' into rename-tablecmds
Diffstat (limited to 'src/pokenav_match_call_data.c')
-rw-r--r--src/pokenav_match_call_data.c116
1 files changed, 59 insertions, 57 deletions
diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c
index d2d89babf..5379ee88e 100644
--- a/src/pokenav_match_call_data.c
+++ b/src/pokenav_match_call_data.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;
}