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

View File

@@ -1,4 +1,4 @@
static const u8 sRegionMap_MapSectionLayout[MAP_HEIGHT][MAP_WIDTH] = {
static const mapsec_u8_t sRegionMap_MapSectionLayout[MAP_HEIGHT][MAP_WIDTH] = {
{MAPSEC_NONE, MAPSEC_ROUTE_114, MAPSEC_ROUTE_114, MAPSEC_FALLARBOR_TOWN, MAPSEC_ROUTE_113, MAPSEC_ROUTE_113, MAPSEC_ROUTE_113, MAPSEC_ROUTE_113, MAPSEC_ROUTE_111, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_ROUTE_119, MAPSEC_FORTREE_CITY, MAPSEC_ROUTE_120, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE},
{MAPSEC_NONE, MAPSEC_ROUTE_114, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_MT_CHIMNEY, MAPSEC_MT_CHIMNEY, MAPSEC_ROUTE_111, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_ROUTE_119, MAPSEC_NONE, MAPSEC_ROUTE_120, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE},
{MAPSEC_ROUTE_115, MAPSEC_ROUTE_114, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_MT_CHIMNEY, MAPSEC_MT_CHIMNEY, MAPSEC_ROUTE_111, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_ROUTE_119, MAPSEC_NONE, MAPSEC_ROUTE_120, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_SAFARI_ZONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE, MAPSEC_NONE},

View File

@@ -830,7 +830,7 @@ void CreateEgg(struct Pokemon *mon, u16 species, bool8 setHotSpringsLocation)
u8 metLevel;
u16 ball;
u8 language;
u8 metLocation;
metloc_u8_t metLocation;
u8 isEgg;
CreateMon(mon, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0);

View File

@@ -362,7 +362,7 @@ static void AddHatchedMonToParty(u8 id)
u8 name[POKEMON_NAME_LENGTH + 1];
u16 ball;
u16 metLevel;
u8 metLocation;
metloc_u8_t metLocation;
struct Pokemon *mon = &gPlayerParty[id];
CreateHatchedMon(mon, &gEnemyParty[0]);

View File

@@ -606,7 +606,9 @@ static void LeaveFrontierPass(void)
static u32 AllocateFrontierPassData(MainCallback callback)
{
u8 i;
// This variable is a MAPSEC initially, but is recycled as a
// bare integer near the end of the function.
mapsec_u8_t i;
if (sPassData != NULL)
return ERR_ALREADY_DONE;

View File

@@ -10,7 +10,7 @@ struct Landmark
struct LandmarkList
{
u8 mapSection;
mapsec_u8_t mapSection;
u8 id;
const struct Landmark *const *landmarks;
};
@@ -392,9 +392,9 @@ static const struct LandmarkList sLandmarkLists[] =
{MAPSEC_NONE, 0, NULL},
};
static const struct Landmark *const *GetLandmarks(u8 mapSection, u8 id);
static const struct Landmark *const *GetLandmarks(mapsec_u8_t mapSection, u8 id);
const u8 *GetLandmarkName(u8 mapSection, u8 id, u8 count)
const u8 *GetLandmarkName(mapsec_u8_t mapSection, u8 id, u8 count)
{
const struct Landmark *const *landmarks = GetLandmarks(mapSection, id);
@@ -421,7 +421,7 @@ const u8 *GetLandmarkName(u8 mapSection, u8 id, u8 count)
return (*landmarks)->name;
}
static const struct Landmark *const *GetLandmarks(u8 mapSection, u8 id)
static const struct Landmark *const *GetLandmarks(mapsec_u8_t mapSection, u8 id)
{
u16 i = 0;

View File

@@ -404,7 +404,7 @@ static void LoadMapNamePopUpWindowBg(void)
{
u8 popUpThemeId;
u8 popupWindowId = GetMapNamePopUpWindowId();
u16 regionMapSectionId = gMapHeader.regionMapSectionId;
mapsec_u16_t regionMapSectionId = gMapHeader.regionMapSectionId;
if (regionMapSectionId >= KANTO_MAPSEC_START)
{

View File

@@ -134,7 +134,7 @@ static u32 GetCurrentTotalMinutes(struct Time *);
static u32 GetNumRegisteredTrainers(void);
static u32 GetActiveMatchCallTrainerId(u32);
static int GetTrainerMatchCallId(int);
static u16 GetRematchTrainerLocation(int);
static mapsec_u16_t GetRematchTrainerLocation(int);
static bool32 TrainerIsEligibleForRematch(int);
static void StartMatchCall(void);
static void ExecuteMatchCall(u8);
@@ -1463,7 +1463,7 @@ static bool32 TrainerIsEligibleForRematch(int matchCallId)
return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0;
}
static u16 GetRematchTrainerLocation(int matchCallId)
static mapsec_u16_t GetRematchTrainerLocation(int matchCallId)
{
const struct MapHeader *mapHeader = Overworld_GetMapHeaderByGroupAndId(gRematchTable[matchCallId].mapGroup, gRematchTable[matchCallId].mapNum);
return mapHeader->regionMapSectionId;

View File

@@ -194,7 +194,7 @@ EWRAM_DATA struct WarpData gLastUsedWarp = {0};
EWRAM_DATA static struct WarpData sWarpDestination = {0}; // new warp position
EWRAM_DATA static struct WarpData sFixedDiveWarp = {0};
EWRAM_DATA static struct WarpData sFixedHoleWarp = {0};
EWRAM_DATA static u16 sLastMapSectionId = 0;
EWRAM_DATA static mapsec_u16_t sLastMapSectionId = 0;
EWRAM_DATA static struct InitialPlayerAvatarState sInitialPlayerAvatarState = {0};
EWRAM_DATA static u16 sAmbientCrySpecies = 0;
EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE;
@@ -1383,12 +1383,12 @@ bool8 IsMapTypeIndoors(u8 mapType)
return FALSE;
}
u8 GetSavedWarpRegionMapSectionId(void)
mapsec_u8_t GetSavedWarpRegionMapSectionId(void)
{
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->dynamicWarp.mapGroup, gSaveBlock1Ptr->dynamicWarp.mapNum)->regionMapSectionId;
}
u8 GetCurrentRegionMapSectionId(void)
mapsec_u8_t GetCurrentRegionMapSectionId(void)
{
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum)->regionMapSectionId;
}

View File

@@ -58,7 +58,7 @@ struct OverworldArea
{
u8 mapGroup;
u8 mapNum;
u16 regionMapSectionId;
mapsec_u16_t regionMapSectionId;
};
struct
@@ -79,7 +79,7 @@ struct
/*0x61C*/ u16 areaShadeBldArgHi;
/*0x61E*/ bool8 showingMarkers;
/*0x61F*/ u8 markerFlashCounter;
/*0x620*/ u16 specialAreaRegionMapSectionIds[MAX_AREA_MARKERS];
/*0x620*/ mapsec_u16_t specialAreaRegionMapSectionIds[MAX_AREA_MARKERS];
/*0x660*/ struct Sprite *areaMarkerSprites[MAX_AREA_MARKERS];
/*0x6E0*/ u16 numAreaMarkerSprites;
/*0x6E2*/ u16 alteringCaveCounter;
@@ -95,7 +95,7 @@ static void FindMapsWithMon(u16);
static void BuildAreaGlowTilemap(void);
static void SetAreaHasMon(u16, u16);
static void SetSpecialMapHasMon(u16, u16);
static u16 GetRegionMapSectionId(u8, u8);
static mapsec_u16_t GetRegionMapSectionId(u8, u8);
static bool8 MapHasSpecies(const struct WildPokemonHeader *, u16);
static bool8 MonListHasSpecies(const struct WildPokemonInfo *, u16, u16);
static void DoAreaGlow(void);
@@ -112,7 +112,7 @@ static const u32 sAreaGlow_Gfx[] = INCBIN_U32("graphics/pokedex/area_glow.4bpp.l
static const u16 sSpeciesHiddenFromAreaScreen[] = { SPECIES_WYNAUT };
static const u16 sMovingRegionMapSections[3] =
static const mapsec_u16_t sMovingRegionMapSections[3] =
{
MAPSEC_MARINE_CAVE,
MAPSEC_UNDERWATER_MARINE_CAVE,
@@ -125,7 +125,7 @@ static const u16 sFeebasData[][3] =
{NUM_SPECIES}
};
static const u16 sLandmarkData[][2] =
static const mapsec_u16_t sLandmarkData[][2] =
{
{MAPSEC_SKY_PILLAR, FLAG_LANDMARK_SKY_PILLAR},
{MAPSEC_SEAFLOOR_CAVERN, FLAG_LANDMARK_SEAFLOOR_CAVERN},
@@ -336,7 +336,7 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum)
if (sPokedexAreaScreen->numSpecialAreas < MAX_AREA_MARKERS)
{
u16 regionMapSectionId = GetRegionMapSectionId(mapGroup, mapNum);
mapsec_u16_t regionMapSectionId = GetRegionMapSectionId(mapGroup, mapNum);
if (regionMapSectionId < MAPSEC_NONE)
{
// Don't highlight the area if it's a moving area (Marine/Terra Cave)
@@ -370,7 +370,7 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum)
}
}
static u16 GetRegionMapSectionId(u8 mapGroup, u8 mapNum)
static mapsec_u16_t GetRegionMapSectionId(u8 mapGroup, u8 mapNum)
{
return Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->regionMapSectionId;
}
@@ -710,7 +710,7 @@ static void CreateAreaMarkerSprites(void)
static s16 x;
static s16 y;
static s16 i;
static s16 mapSecId;
static mapsec_s16_t mapSecId;
static s16 numSprites;
LoadSpriteSheet(&sAreaMarkerSpriteSheet);

View File

@@ -4074,6 +4074,19 @@ u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field) __attribute__((alias("G
#define SET8(lhs) (lhs) = *data
#define SET16(lhs) (lhs) = data[0] + (data[1] << 8)
#define SET32(lhs) (lhs) = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24)
//
// Prefer SET_BY_WIDTH for fields whose types might be extended (e.g.
// anything whose typedef is in gametypes.h).
//
#define SET_BY_WIDTH(lhs) \
do { \
if (sizeof(lhs) == 1) \
SET8(lhs); \
else if (sizeof(lhs) == 2) \
SET16(lhs); \
else if (sizeof(lhs) == 4) \
SET32(lhs); \
} while (0)
void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg)
{
@@ -4263,7 +4276,7 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
SET8(substruct3->pokerus);
break;
case MON_DATA_MET_LOCATION:
SET8(substruct3->metLocation);
SET_BY_WIDTH(substruct3->metLocation);
break;
case MON_DATA_MET_LEVEL:
{

View File

@@ -143,7 +143,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData
u8 ribbonCount; // 0x6
u8 ailment; // 0x7
u8 abilityNum; // 0x8
u8 metLocation; // 0x9
metloc_u8_t metLocation; // 0x9
u8 metLevel; // 0xA
u8 metGame; // 0xB
u32 pid; // 0xC

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

View File

@@ -1022,7 +1022,7 @@ static void PrintMatchCallLocation(struct Pokenav_MatchCallGfx *gfx, int delta)
u8 mapName[32];
int x;
int index = PokenavList_GetSelectedIndex() + delta;
int mapSec = GetMatchCallMapSec(index);
mapsec_s32_t mapSec = GetMatchCallMapSec(index);
if (mapSec != MAPSEC_NONE)
GetMapName(mapName, mapSec, 0);
else

View File

@@ -306,7 +306,7 @@ struct PokenavMatchCallEntry *GetMatchCallList(void)
return state->matchCallEntries;
}
u16 GetMatchCallMapSec(int index)
mapsec_u16_t GetMatchCallMapSec(int index)
{
struct Pokenav_MatchCallMenu *state = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_MAIN);
return state->matchCallEntries[index].mapSec;
@@ -424,7 +424,7 @@ void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry *matchCallEntry, u8
}
}
u8 GetMatchTableMapSectionId(int rematchIndex)
mapsec_u8_t GetMatchTableMapSectionId(int rematchIndex)
{
int mapGroup = gRematchTable[rematchIndex].mapGroup;
int mapNum = gRematchTable[rematchIndex].mapNum;

View File

@@ -41,7 +41,7 @@ struct Pokenav_RegionMapGfx
struct CityMapEntry
{
u16 mapSecId;
mapsec_u16_t mapSecId;
u16 index;
const u32 *tilemap;
};
@@ -63,8 +63,8 @@ static bool32 IsDma3ManagerBusyWithBgCopy_(struct Pokenav_RegionMapGfx *);
static void ChangeBgYForZoom(bool32);
static bool32 IsChangeBgYForZoomActive(void);
static void CreateCityZoomTextSprites(void);
static void DrawCityMap(struct Pokenav_RegionMapGfx *, int, int);
static void PrintLandmarkNames(struct Pokenav_RegionMapGfx *, int, int);
static void DrawCityMap(struct Pokenav_RegionMapGfx *, mapsec_s32_t, int);
static void PrintLandmarkNames(struct Pokenav_RegionMapGfx *, mapsec_s32_t, int);
static void SetCityZoomTextInvisibility(bool32);
static void Task_ChangeBgYForZoom(u8 taskId);
static void UpdateCityZoomTextPosition(void);
@@ -634,7 +634,7 @@ static u32 LoopedTask_DecompressCityMaps(s32 taskState)
return LT_FINISH;
}
static void DrawCityMap(struct Pokenav_RegionMapGfx *state, int mapSecId, int pos)
static void DrawCityMap(struct Pokenav_RegionMapGfx *state, mapsec_s32_t mapSecId, int pos)
{
int i;
for (i = 0; i < NUM_CITY_MAPS && (sPokenavCityMaps[i].mapSecId != mapSecId || sPokenavCityMaps[i].index != pos); i++)
@@ -647,7 +647,7 @@ static void DrawCityMap(struct Pokenav_RegionMapGfx *state, int mapSecId, int po
CopyToBgTilemapBufferRect(1, state->cityZoomPics[i], 18, 6, 10, 10);
}
static void PrintLandmarkNames(struct Pokenav_RegionMapGfx *state, int mapSecId, int pos)
static void PrintLandmarkNames(struct Pokenav_RegionMapGfx *state, mapsec_s32_t mapSecId, int pos)
{
int i = 0;
while (1)

View File

@@ -63,7 +63,7 @@ enum {
struct MultiNameFlyDest
{
const u8 *const *name;
u16 mapSecId;
mapsec_u16_t mapSecId;
u16 flag;
};
@@ -72,7 +72,7 @@ static EWRAM_DATA struct RegionMap *sRegionMap = NULL;
static EWRAM_DATA struct {
void (*callback)(void);
u16 state;
u16 mapSecId;
mapsec_u16_t mapSecId;
struct RegionMap regionMap;
u8 tileBuffer[0x1c0];
u8 nameBuffer[0x26]; // never read
@@ -86,15 +86,15 @@ static u8 MoveRegionMapCursor_Full(void);
static u8 ProcessRegionMapInput_Zoomed(void);
static u8 MoveRegionMapCursor_Zoomed(void);
static void CalcZoomScrollParams(s16 scrollX, s16 scrollY, s16 c, s16 d, u16 e, u16 f, u8 rotation);
static u16 GetMapSecIdAt(u16 x, u16 y);
static mapsec_u16_t GetMapSecIdAt(u16 x, u16 y);
static void RegionMap_SetBG2XAndBG2Y(s16 x, s16 y);
static void InitMapBasedOnPlayerLocation(void);
static void RegionMap_InitializeStateBasedOnSSTidalLocation(void);
static u8 GetMapsecType(u16 mapSecId);
static u16 CorrectSpecialMapSecId_Internal(u16 mapSecId);
static u16 GetTerraOrMarineCaveMapSecId(void);
static u8 GetMapsecType(mapsec_u16_t mapSecId);
static mapsec_u16_t CorrectSpecialMapSecId_Internal(mapsec_u16_t mapSecId);
static mapsec_u16_t GetTerraOrMarineCaveMapSecId(void);
static void GetMarineCaveCoords(u16 *x, u16 *y);
static bool32 IsPlayerInAquaHideout(u8 mapSecId);
static bool32 IsPlayerInAquaHideout(mapsec_u8_t mapSecId);
static void GetPositionOfCursorWithinMapSec(void);
static bool8 RegionMap_IsMapSecIdInNextRow(u16 y);
static void SpriteCB_CursorMapFull(struct Sprite *sprite);
@@ -130,7 +130,7 @@ static const u8 sRegionMapPlayerIcon_MayGfx[] = INCBIN_U8("graphics/pokenav/regi
#include "data/region_map/region_map_layout.h"
#include "data/region_map/region_map_entries.h"
static const u16 sRegionMap_SpecialPlaceLocations[][2] =
static const mapsec_u16_t sRegionMap_SpecialPlaceLocations[][2] =
{
{MAPSEC_UNDERWATER_105, MAPSEC_ROUTE_105},
{MAPSEC_UNDERWATER_124, MAPSEC_ROUTE_124},
@@ -162,14 +162,14 @@ static const u16 sRegionMap_SpecialPlaceLocations[][2] =
{MAPSEC_NONE, MAPSEC_NONE}
};
static const u16 sMarineCaveMapSecIds[] =
static const mapsec_u16_t sMarineCaveMapSecIds[] =
{
MAPSEC_MARINE_CAVE,
MAPSEC_UNDERWATER_MARINE_CAVE,
MAPSEC_UNDERWATER_MARINE_CAVE
};
static const u16 sTerraOrMarineCaveMapSecIds[ABNORMAL_WEATHER_LOCATIONS] =
static const mapsec_u16_t sTerraOrMarineCaveMapSecIds[ABNORMAL_WEATHER_LOCATIONS] =
{
[ABNORMAL_WEATHER_ROUTE_114_NORTH - 1] = MAPSEC_ROUTE_114,
[ABNORMAL_WEATHER_ROUTE_114_SOUTH - 1] = MAPSEC_ROUTE_114,
@@ -203,7 +203,7 @@ static const struct UCoords16 sMarineCaveLocationCoords[MARINE_CAVE_LOCATIONS] =
[MARINE_CAVE_COORD(ROUTE_129_EAST)] = {24, 10}
};
static const u8 sMapSecAquaHideoutOld[] =
static const mapsec_u8_t sMapSecAquaHideoutOld[] =
{
MAPSEC_AQUA_HIDEOUT_OLD
};
@@ -273,7 +273,7 @@ static const union AnimCmd *const sRegionMapPlayerIconAnimTable[] =
};
// Event islands that don't appear on map. (Southern Island does)
static const u8 sMapSecIdsOffMap[] =
static const mapsec_u8_t sMapSecIdsOffMap[] =
{
MAPSEC_BIRTH_ISLAND,
MAPSEC_FARAWAY_ISLAND,
@@ -421,7 +421,7 @@ static const struct SpritePalette sFlyTargetIconsSpritePalette =
.tag = TAG_FLY_ICON
};
static const u16 sRedOutlineFlyDestinations[][2] =
static const mapsec_u16_t sRedOutlineFlyDestinations[][2] =
{
{
FLAG_LANDMARK_BATTLE_FRONTIER,
@@ -690,7 +690,7 @@ static u8 ProcessRegionMapInput_Full(void)
static u8 MoveRegionMapCursor_Full(void)
{
u16 mapSecId;
mapsec_u16_t mapSecId;
if (sRegionMap->cursorMovementFrameCounter != 0)
return MAP_INPUT_MOVE_CONT;
@@ -771,7 +771,7 @@ static u8 MoveRegionMapCursor_Zoomed(void)
{
u16 x;
u16 y;
u16 mapSecId;
mapsec_u16_t mapSecId;
sRegionMap->scrollY += sRegionMap->zoomedCursorDeltaY;
sRegionMap->scrollX += sRegionMap->zoomedCursorDeltaX;
@@ -954,7 +954,7 @@ void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y)
}
}
static u16 GetMapSecIdAt(u16 x, u16 y)
static mapsec_u16_t GetMapSecIdAt(u16 x, u16 y)
{
if (y < MAPCURSOR_Y_MIN || y > MAPCURSOR_Y_MAX || x < MAPCURSOR_X_MIN || x > MAPCURSOR_X_MAX)
{
@@ -1172,7 +1172,7 @@ static void RegionMap_InitializeStateBasedOnSSTidalLocation(void)
sRegionMap->cursorPosY = gRegionMapEntries[sRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN;
}
static u8 GetMapsecType(u16 mapSecId)
static u8 GetMapsecType(mapsec_u16_t mapSecId)
{
switch (mapSecId)
{
@@ -1219,12 +1219,12 @@ static u8 GetMapsecType(u16 mapSecId)
}
}
u16 GetRegionMapSecIdAt(u16 x, u16 y)
mapsec_u16_t GetRegionMapSecIdAt(u16 x, u16 y)
{
return GetMapSecIdAt(x, y);
}
static u16 CorrectSpecialMapSecId_Internal(u16 mapSecId)
static mapsec_u16_t CorrectSpecialMapSecId_Internal(mapsec_u16_t mapSecId)
{
u32 i;
@@ -1245,7 +1245,7 @@ static u16 CorrectSpecialMapSecId_Internal(u16 mapSecId)
return mapSecId;
}
static u16 GetTerraOrMarineCaveMapSecId(void)
static mapsec_u16_t GetTerraOrMarineCaveMapSecId(void)
{
s16 idx;
@@ -1274,7 +1274,7 @@ static void GetMarineCaveCoords(u16 *x, u16 *y)
// Probably meant to be an "IsPlayerInIndoorDungeon" function, but in practice it only has the one mapsec
// Additionally, because the mapsec doesnt exist in Emerald, this function always returns FALSE
static bool32 IsPlayerInAquaHideout(u8 mapSecId)
static bool32 IsPlayerInAquaHideout(mapsec_u8_t mapSecId)
{
u32 i;
@@ -1286,7 +1286,7 @@ static bool32 IsPlayerInAquaHideout(u8 mapSecId)
return FALSE;
}
u16 CorrectSpecialMapSecId(u16 mapSecId)
mapsec_u16_t CorrectSpecialMapSecId(mapsec_u16_t mapSecId)
{
return CorrectSpecialMapSecId_Internal(mapSecId);
}
@@ -1565,7 +1565,7 @@ void TrySetPlayerIconBlink(void)
#undef sVisible
#undef sTimer
u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength)
u8 *GetMapName(u8 *dest, mapsec_u16_t regionMapId, u16 padLength)
{
u8 *str;
u16 i;
@@ -1598,7 +1598,7 @@ u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength)
}
// TODO: probably needs a better name
u8 *GetMapNameGeneric(u8 *dest, u16 mapSecId)
u8 *GetMapNameGeneric(u8 *dest, mapsec_u16_t mapSecId)
{
switch (mapSecId)
{
@@ -1611,7 +1611,7 @@ u8 *GetMapNameGeneric(u8 *dest, u16 mapSecId)
}
}
u8 *GetMapNameHandleAquaHideout(u8 *dest, u16 mapSecId)
u8 *GetMapNameHandleAquaHideout(u8 *dest, mapsec_u16_t mapSecId)
{
if (mapSecId == MAPSEC_AQUA_HIDEOUT_OLD)
return StringCopy(dest, gText_Hideout);
@@ -1619,7 +1619,7 @@ u8 *GetMapNameHandleAquaHideout(u8 *dest, u16 mapSecId)
return GetMapNameGeneric(dest, mapSecId);
}
static void GetMapSecDimensions(u16 mapSecId, u16 *x, u16 *y, u16 *width, u16 *height)
static void GetMapSecDimensions(mapsec_u16_t mapSecId, u16 *x, u16 *y, u16 *width, u16 *height)
{
*x = gRegionMapEntries[mapSecId].x;
*y = gRegionMapEntries[mapSecId].y;
@@ -1632,7 +1632,7 @@ bool8 IsRegionMapZoomed(void)
return sRegionMap->zoomed;
}
bool32 IsEventIslandMapSecId(u8 mapSecId)
bool32 IsEventIslandMapSecId(mapsec_u8_t mapSecId)
{
u32 i;
@@ -1839,7 +1839,7 @@ static void LoadFlyDestIcons(void)
static void CreateFlyDestIcons(void)
{
u16 canFlyFlag;
u16 mapSecId;
mapsec_u16_t mapSecId;
u16 x;
u16 y;
u16 width;
@@ -1887,7 +1887,7 @@ static void TryCreateRedOutlineFlyDestIcons(void)
u16 y;
u16 width;
u16 height;
u16 mapSecId;
mapsec_u16_t mapSecId;
u8 spriteId;
for (i = 0; sRedOutlineFlyDestinations[i][1] != MAPSEC_NONE; i++)

View File

@@ -4552,7 +4552,7 @@ static void CreateInGameTradePokemonInternal(u8 whichPlayerMon, u8 whichInGameTr
u8 level = GetMonData(&gPlayerParty[whichPlayerMon], MON_DATA_LEVEL);
struct Mail mail;
u8 metLocation = METLOC_IN_GAME_TRADE;
metloc_u8_t metLocation = METLOC_IN_GAME_TRADE;
u8 mailNum;
struct Pokemon *pokemon = &gEnemyParty[0];