Add typedefs for MAPSEC and METLOC values (#2183)

Added typedefs: mapsec_t, metloc_t, and variants for MAPSEC and METLOC values. There are some rough edges that could do with smoothing out, but for now, this gets us close to ideal with a ROM that compares equal.

Per feedback, all typedefs to mention the underlying type within the typedef name. The documentation comments reflect and explain the naming convention.

Updated comments to reflect the fact that we're no longer using SET8 for a Pokemon's met locations, in favor of a new macro (added by this PR) that adjusts to match the width of whatever is being set.
This commit is contained in:
DavidJCobb
2025-10-19 18:37:13 +02:00
committed by GitHub
parent 0965dffe70
commit 7fd0029ed7
26 changed files with 185 additions and 102 deletions
+18 -18
View File
@@ -34,13 +34,13 @@ typedef struct MatchCallTextDataStruct {
struct MatchCallStructCommon {
u8 type;
u8 mapSec;
mapsec_u8_t mapSec;
u16 flag;
};
struct MatchCallStructNPC {
u8 type;
u8 mapSec;
mapsec_u8_t mapSec;
u16 flag;
const u8 *desc;
const u8 *name;
@@ -50,7 +50,7 @@ struct MatchCallStructNPC {
// Shared by MC_TYPE_TRAINER and MC_TYPE_LEADER
struct MatchCallStructTrainer {
u8 type;
u8 mapSec;
mapsec_u8_t mapSec;
u16 flag;
u16 rematchTableIdx;
const u8 *desc;
@@ -60,12 +60,12 @@ struct MatchCallStructTrainer {
struct MatchCallLocationOverride {
u16 flag;
u8 mapSec;
mapsec_u8_t mapSec;
};
struct MatchCallWally {
u8 type;
u8 mapSec;
mapsec_u8_t mapSec;
u16 flag;
u16 rematchTableIdx;
const u8 *desc;
@@ -75,7 +75,7 @@ struct MatchCallWally {
struct MatchCallBirch {
u8 type;
u8 mapSec;
mapsec_u8_t mapSec;
u16 flag;
const u8 *desc;
const u8 *name;
@@ -117,11 +117,11 @@ static bool32 MatchCall_GetEnabled_Wally(match_call_t);
static bool32 MatchCall_GetEnabled_Birch(match_call_t);
static bool32 MatchCall_GetEnabled_Rival(match_call_t);
static u8 MatchCall_GetMapSec_NPC(match_call_t);
static u8 MatchCall_GetMapSec_Trainer(match_call_t);
static u8 MatchCall_GetMapSec_Wally(match_call_t);
static u8 MatchCall_GetMapSec_Birch(match_call_t);
static u8 MatchCall_GetMapSec_Rival(match_call_t);
static mapsec_u8_t MatchCall_GetMapSec_NPC(match_call_t);
static mapsec_u8_t MatchCall_GetMapSec_Trainer(match_call_t);
static mapsec_u8_t MatchCall_GetMapSec_Wally(match_call_t);
static mapsec_u8_t MatchCall_GetMapSec_Birch(match_call_t);
static mapsec_u8_t MatchCall_GetMapSec_Rival(match_call_t);
static bool32 MatchCall_IsRematchable_NPC(match_call_t);
static bool32 MatchCall_IsRematchable_Trainer(match_call_t);
@@ -609,7 +609,7 @@ static bool32 (*const sMatchCallGetEnabledFuncs[])(match_call_t) = {
MatchCall_GetEnabled_Birch
};
static u8 (*const sMatchCallGetMapSecFuncs[])(match_call_t) = {
static mapsec_u8_t (*const sMatchCallGetMapSecFuncs[])(match_call_t) = {
MatchCall_GetMapSec_NPC,
MatchCall_GetMapSec_Trainer,
MatchCall_GetMapSec_Wally,
@@ -779,7 +779,7 @@ static bool32 MatchCall_GetEnabled_Birch(match_call_t matchCall)
return FlagGet(matchCall.birch->flag);
}
u8 MatchCall_GetMapSec(u32 idx)
mapsec_u8_t MatchCall_GetMapSec(u32 idx)
{
match_call_t matchCall;
u32 i;
@@ -791,17 +791,17 @@ u8 MatchCall_GetMapSec(u32 idx)
return sMatchCallGetMapSecFuncs[i](matchCall);
}
static u8 MatchCall_GetMapSec_NPC(match_call_t matchCall)
static mapsec_u8_t MatchCall_GetMapSec_NPC(match_call_t matchCall)
{
return matchCall.npc->mapSec;
}
static u8 MatchCall_GetMapSec_Trainer(match_call_t matchCall)
static mapsec_u8_t MatchCall_GetMapSec_Trainer(match_call_t matchCall)
{
return matchCall.trainer->mapSec;
}
static u8 MatchCall_GetMapSec_Wally(match_call_t matchCall)
static mapsec_u8_t MatchCall_GetMapSec_Wally(match_call_t matchCall)
{
s32 i;
@@ -813,12 +813,12 @@ static u8 MatchCall_GetMapSec_Wally(match_call_t matchCall)
return matchCall.wally->locationData[i].mapSec;
}
static u8 MatchCall_GetMapSec_Rival(match_call_t matchCall)
static mapsec_u8_t MatchCall_GetMapSec_Rival(match_call_t matchCall)
{
return MAPSEC_NONE;
}
static u8 MatchCall_GetMapSec_Birch(match_call_t matchCall)
static mapsec_u8_t MatchCall_GetMapSec_Birch(match_call_t matchCall)
{
return MAPSEC_NONE;
}