From 59c5beefe7d46ca0912c1d46d5ef8a817a1cbba6 Mon Sep 17 00:00:00 2001 From: DavidJCobb <831497+DavidJCobb@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:13:09 -0400 Subject: [PATCH 1/8] Added typedefs: mapsec_t, metloc_t, and variants Initial attempt at adding typedefs 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. --- include/gametypes.h | 51 ++++++++++++++++++++++ include/global.fieldmap.h | 4 +- include/global.tv.h | 15 ++++--- include/landmark.h | 4 +- include/overworld.h | 6 ++- include/pokemon.h | 3 +- include/pokenav.h | 7 +-- include/region_map.h | 15 ++++--- src/data/region_map/region_map_layout.h | 2 +- src/daycare.c | 3 +- src/egg_hatch.c | 3 +- src/frontier_pass.c | 3 +- src/landmark.c | 8 ++-- src/map_name_popup.c | 3 +- src/match_call.c | 5 ++- src/overworld.c | 6 +-- src/pokedex_area_screen.c | 17 ++++---- src/pokemon_summary_screen.c | 3 +- src/pokenav_match_call_data.c | 37 ++++++++-------- src/pokenav_match_call_gfx.c | 3 +- src/pokenav_match_call_list.c | 4 +- src/pokenav_region_map.c | 11 ++--- src/region_map.c | 58 ++++++++++++------------- src/trade.c | 3 +- 24 files changed, 173 insertions(+), 101 deletions(-) create mode 100644 include/gametypes.h diff --git a/include/gametypes.h b/include/gametypes.h new file mode 100644 index 000000000000..4f2f6bcfe3bf --- /dev/null +++ b/include/gametypes.h @@ -0,0 +1,51 @@ +#ifndef GUARD_GAMETYPES_H +#define GUARD_GAMETYPES_H + +#include "gba/types.h" + +// +// This header includes typedefs for fields that commonly appear throughout +// the codebase, and which ROM hacks might benefit from being able to widen. +// +// Game Freak wasn't consistent with field widths; for example, some fields +// are stored as u8s, but some functions take those fields as u16s. We offer +// typedefs for those cases as well; the general naming convention takes +// inspiration from and is: +// +// - foo_t The type something is persistently stored as. +// +// - foo_min#_t foo_t with a minimum size of # bits. For example, +// foo_min16_t would be a u16 or s16 depending on the +// signedness of foo_t. +// +// - foo_min#_s_t foo_min#_t, but signed. Used when foo_t is usually +// unsigned. +// +// - foo_min#_u_t foo_min#_t, but unsigned. Used when foo_t is usually +// signed. +// +// - foo_int_t For cases where a variable is a bare int. +// +// If you need to widen a type, make sure that its variations are widened +// as well. For example, if bar_t is a u8 and you want to widen it to u32, +// you must change bar_min16_t to a u32 as well, and bar_min16_s_t to an +// s32. +// + +// Map Sections are named areas that can appear in the region map. Each +// individual map can be assigned to a Map Section as appropriate. The +// possible values are in constants/region_map_sections.h. +typedef u8 mapsec_t; +typedef u16 mapsec_min16_t; +typedef s16 mapsec_min16_s_t; +typedef int mapsec_int_t; + +// Met Locations for caught Pokemon use the same values as Map Sections, +// except that 0xFD, 0xFE, and 0xFF have special meanings. +// +// Note that SetBoxMonData and friends use the SET8 macro to write this +// data, so widening mapsec_t or metloc_t will require updating that as +// well. +typedef mapsec_t metloc_t; + +#endif //GUARD_GAMETYPES_H diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 1207bd80ea14..4ce1e72dbc09 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -1,6 +1,8 @@ #ifndef GUARD_GLOBAL_FIELDMAP_H #define GUARD_GLOBAL_FIELDMAP_H +#include "gametypes.h" + // Masks/shifts for blocks in the map grid // Map grid blocks consist of a 10 bit metatile id, a 2 bit collision value, and a 4 bit elevation value // This is the data stored in each data/layouts/*/map.bin file @@ -167,7 +169,7 @@ struct MapHeader /* 0x0C */ const struct MapConnections *connections; /* 0x10 */ u16 music; /* 0x12 */ u16 mapLayoutId; - /* 0x14 */ u8 regionMapSectionId; + /* 0x14 */ mapsec_t regionMapSectionId; /* 0x15 */ u8 cave; /* 0x16 */ u8 weather; /* 0x17 */ u8 mapType; diff --git a/include/global.tv.h b/include/global.tv.h index 9c3902e7cca4..fb5f45a4abdf 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -2,6 +2,7 @@ #define GUARD_GLOBAL_TV_H #include "constants/tv.h" +#include "gametypes.h" typedef union // size = 0x24 { @@ -226,7 +227,7 @@ typedef union // size = 0x24 /*0x04*/ u8 filler_04[2]; /*0x06*/ u16 itemIds[SMARTSHOPPER_NUM_ITEMS]; /*0x0C*/ u16 itemAmounts[SMARTSHOPPER_NUM_ITEMS]; - /*0x12*/ u8 shopLocation; + /*0x12*/ mapsec_t shopLocation; /*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x1B*/ //u8 padding; } smartshopperShow; @@ -241,7 +242,7 @@ typedef union // size = 0x24 /*0x0E*/ u16 species2; /*0x10*/ u8 nBallsUsed; /*0x11*/ u8 outcome; - /*0x12*/ u8 location; + /*0x12*/ mapsec_t location; /*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x1B*/ //u8 padding; } pokemonTodayFailed; @@ -267,7 +268,7 @@ typedef union // size = 0x24 /*0x04*/ u16 caughtPoke; /*0x06*/ u16 steps; /*0x08*/ u16 species; - /*0x0A*/ u8 location; + /*0x0A*/ mapsec_t location; /*0x0B*/ u8 language; /*0x0C*/ u8 filler_0C[7]; /*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; @@ -282,7 +283,7 @@ typedef union // size = 0x24 /*0x04*/ u8 badgeCount; /*0x05*/ u8 nSilverSymbols; /*0x06*/ u8 nGoldSymbols; - /*0x07*/ u8 location; + /*0x07*/ mapsec_t location; /*0x08*/ u16 battlePoints; /*0x0A*/ u16 mapLayoutId; /*0x0C*/ u8 language; @@ -309,7 +310,7 @@ typedef union // size = 0x24 /*0x00*/ u8 kind; /*0x01*/ bool8 active; /*0x02*/ u16 item; - /*0x04*/ u8 location; + /*0x04*/ mapsec_t location; /*0x05*/ u8 language; /*0x06*/ u16 mapLayoutId; /*0x08*/ u8 filler_08[11]; @@ -336,7 +337,7 @@ typedef union // size = 0x24 /*0x00*/ u8 kind; /*0x01*/ bool8 active; /*0x02*/ u16 lastOpponentSpecies; - /*0x04*/ u8 location; + /*0x04*/ mapsec_t location; /*0x05*/ u8 outcome; /*0x06*/ u16 caughtMonBall; /*0x08*/ u16 balls; @@ -505,7 +506,7 @@ struct GabbyAndTyData /*2BA6*/ u16 mon2; /*2BA8*/ u16 lastMove; /*2BAA*/ u16 quote[1]; - /*2BAC*/ u8 mapnum; + /*2BAC*/ mapsec_t mapnum; /*2BAD*/ u8 battleNum; /*2BAE*/ u8 battleTookMoreThanOneTurn:1; u8 playerLostAMon:1; diff --git a/include/landmark.h b/include/landmark.h index 395905033a2a..57fc7adc1abc 100644 --- a/include/landmark.h +++ b/include/landmark.h @@ -1,6 +1,8 @@ #ifndef GUARD_LANDMARK_H #define GUARD_LANDMARK_H -const u8 *GetLandmarkName(u8 mapSection, u8 id, u8 count); +#include "gametypes.h" + +const u8 *GetLandmarkName(mapsec_t mapSection, u8 id, u8 count); #endif // GUARD_LANDMARK_H diff --git a/include/overworld.h b/include/overworld.h index bde6896569d0..12f1ec56be8a 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -1,6 +1,8 @@ #ifndef GUARD_OVERWORLD_H #define GUARD_OVERWORLD_H +#include "gametypes.h" + #define LINK_KEY_CODE_NULL 0x00 #define LINK_KEY_CODE_EMPTY 0x11 #define LINK_KEY_CODE_DPAD_DOWN 0x12 @@ -121,8 +123,8 @@ u8 GetLastUsedWarpMapType(void); bool8 IsMapTypeOutdoors(u8 mapType); bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType); bool8 IsMapTypeIndoors(u8 mapType); -u8 GetSavedWarpRegionMapSectionId(void); -u8 GetCurrentRegionMapSectionId(void); +mapsec_t GetSavedWarpRegionMapSectionId(void); +mapsec_t GetCurrentRegionMapSectionId(void); u8 GetCurrentMapBattleScene(void); void CleanupOverworldWindowsAndTilemaps(void); bool32 IsOverworldLinkActive(void); diff --git a/include/pokemon.h b/include/pokemon.h index 53f7f02fd0d9..5a2e1ca6cb22 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -1,6 +1,7 @@ #ifndef GUARD_POKEMON_H #define GUARD_POKEMON_H +#include "gametypes.h" #include "sprite.h" // Property labels for Get(Box)MonData / Set(Box)MonData @@ -131,7 +132,7 @@ struct PokemonSubstruct2 struct PokemonSubstruct3 { /* 0x00 */ u8 pokerus; - /* 0x01 */ u8 metLocation; + /* 0x01 */ metloc_t metLocation; /* 0x02 */ u16 metLevel:7; /* 0x02 */ u16 metGame:4; diff --git a/include/pokenav.h b/include/pokenav.h index 553d2ad0f606..96f996998dcb 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -2,6 +2,7 @@ #define GUARD_POKENAV_H #include "bg.h" +#include "gametypes.h" #include "main.h" #include "pokemon_storage_system.h" @@ -17,7 +18,7 @@ struct PokenavMonListItem struct PokenavMatchCallEntry { bool8 isSpecialTrainer; - u8 mapSec; + mapsec_t mapSec; u16 headerId; }; @@ -410,7 +411,7 @@ void FreeMatchCallSubstruct1(void); int IsMatchCallListInitFinished(void); int GetNumberRegistered(void); struct PokenavMatchCallEntry *GetMatchCallList(void); -u16 GetMatchCallMapSec(int index); +mapsec_min16_t GetMatchCallMapSec(int index); bool32 ShouldDrawRematchPokeballIcon(int index); void ClearRematchPokeballIcon(u16 windowId, u32 tileOffset); int GetMatchCallTrainerPic(int index); @@ -419,7 +420,7 @@ const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest); u16 GetMatchCallOptionCursorPos(void); u16 GetMatchCallOptionId(int optionId); void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry *matchCallEntry, u8 *str); -u8 GetMatchTableMapSectionId(int rematchIndex); +mapsec_t GetMatchTableMapSectionId(int rematchIndex); int GetIndexDeltaOfNextCheckPageDown(int index); int GetIndexDeltaOfNextCheckPageUp(int index); bool32 IsRematchEntryRegistered(int rematchIndex); diff --git a/include/region_map.h b/include/region_map.h index 2bca9e7f7d44..9490edc69824 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -2,6 +2,7 @@ #define GUARD_REGION_MAP_H #include "bg.h" +#include "gametypes.h" // Exported type declarations #define MAP_NAME_LENGTH 16 @@ -26,7 +27,7 @@ enum { }; struct RegionMap { - /*0x000*/ u16 mapSecId; + /*0x000*/ mapsec_min16_t mapSecId; /*0x002*/ u8 mapSecType; /*0x003*/ u8 posWithinMapSec; /*0x004*/ u8 mapSecName[20]; @@ -99,14 +100,14 @@ void InitRegionMap(struct RegionMap *regionMap, bool8 zoomed); u8 DoRegionMapInputCallback(void); bool8 UpdateRegionMapZoom(void); void FreeRegionMapIconResources(void); -u16 GetRegionMapSecIdAt(u16 x, u16 y); +mapsec_min16_t GetRegionMapSecIdAt(u16 x, u16 y); void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag); void CreateRegionMapCursor(u16 tileTag, u16 paletteTag); -bool32 IsEventIslandMapSecId(u8 mapSecId); -u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength); -u8 *GetMapNameGeneric(u8 *dest, u16 mapSecId); -u8 *GetMapNameHandleAquaHideout(u8 *dest, u16 mapSecId); -u16 CorrectSpecialMapSecId(u16 mapSecId); +bool32 IsEventIslandMapSecId(mapsec_t mapSecId); +u8 *GetMapName(u8 *dest, mapsec_min16_t regionMapId, u16 padLength); +u8 *GetMapNameGeneric(u8 *dest, mapsec_min16_t mapSecId); +u8 *GetMapNameHandleAquaHideout(u8 *dest, mapsec_min16_t mapSecId); +mapsec_min16_t CorrectSpecialMapSecId(mapsec_min16_t mapSecId); void ShowRegionMapForPokedexAreaScreen(struct RegionMap *regionMap); void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y); void CB2_OpenFlyMap(void); diff --git a/src/data/region_map/region_map_layout.h b/src/data/region_map/region_map_layout.h index 95a4e94f3120..54288ca55f4f 100644 --- a/src/data/region_map/region_map_layout.h +++ b/src/data/region_map/region_map_layout.h @@ -1,4 +1,4 @@ -static const u8 sRegionMap_MapSectionLayout[MAP_HEIGHT][MAP_WIDTH] = { +static const mapsec_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}, diff --git a/src/daycare.c b/src/daycare.c index 5ebe255b3922..7248db360089 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -2,6 +2,7 @@ #include "pokemon.h" #include "battle.h" #include "daycare.h" +#include "gametypes.h" #include "string_util.h" #include "mail.h" #include "pokemon_storage_system.h" @@ -830,7 +831,7 @@ void CreateEgg(struct Pokemon *mon, u16 species, bool8 setHotSpringsLocation) u8 metLevel; u16 ball; u8 language; - u8 metLocation; + metloc_t metLocation; u8 isEgg; CreateMon(mon, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 5aa955d7e979..7e2d8f69d31e 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -1,4 +1,5 @@ #include "global.h" +#include "gametypes.h" #include "pokemon.h" #include "egg_hatch.h" #include "pokedex.h" @@ -362,7 +363,7 @@ static void AddHatchedMonToParty(u8 id) u8 name[POKEMON_NAME_LENGTH + 1]; u16 ball; u16 metLevel; - u8 metLocation; + metloc_t metLocation; struct Pokemon *mon = &gPlayerParty[id]; CreateHatchedMon(mon, &gEnemyParty[0]); diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 54d25a11e0f0..a1142e109a10 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -1,4 +1,5 @@ #include "global.h" +#include "gametypes.h" #include "gpu_regs.h" #include "main.h" #include "trainer_card.h" @@ -606,7 +607,7 @@ static void LeaveFrontierPass(void) static u32 AllocateFrontierPassData(void (*callback)(void)) { - u8 i; + mapsec_t i; if (sPassData != NULL) return ERR_ALREADY_DONE; diff --git a/src/landmark.c b/src/landmark.c index d2bb3c4105a7..511bd21b08c5 100644 --- a/src/landmark.c +++ b/src/landmark.c @@ -10,7 +10,7 @@ struct Landmark struct LandmarkList { - u8 mapSection; + mapsec_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_t mapSection, u8 id); -const u8 *GetLandmarkName(u8 mapSection, u8 id, u8 count) +const u8 *GetLandmarkName(mapsec_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_t mapSection, u8 id) { u16 i = 0; diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 4b30068f3c04..ae7de31ee9d1 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -1,4 +1,5 @@ #include "global.h" +#include "gametypes.h" #include "battle_pyramid.h" #include "bg.h" #include "event_data.h" @@ -404,7 +405,7 @@ static void LoadMapNamePopUpWindowBg(void) { u8 popUpThemeId; u8 popupWindowId = GetMapNamePopUpWindowId(); - u16 regionMapSectionId = gMapHeader.regionMapSectionId; + mapsec_min16_t regionMapSectionId = gMapHeader.regionMapSectionId; if (regionMapSectionId >= KANTO_MAPSEC_START) { diff --git a/src/match_call.c b/src/match_call.c index e6a141a1bc7f..8ce8e31d9bb7 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -7,6 +7,7 @@ #include "event_data.h" #include "event_object_movement.h" #include "field_player_avatar.h" +#include "gametypes.h" #include "main.h" #include "match_call.h" #include "menu.h" @@ -134,7 +135,7 @@ static u32 GetCurrentTotalMinutes(struct Time *); static u32 GetNumRegisteredTrainers(void); static u32 GetActiveMatchCallTrainerId(u32); static int GetTrainerMatchCallId(int); -static u16 GetRematchTrainerLocation(int); +static mapsec_min16_t GetRematchTrainerLocation(int); static bool32 TrainerIsEligibleForRematch(int); static void StartMatchCall(void); static void ExecuteMatchCall(u8); @@ -1463,7 +1464,7 @@ static bool32 TrainerIsEligibleForRematch(int matchCallId) return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0; } -static u16 GetRematchTrainerLocation(int matchCallId) +static mapsec_min16_t GetRematchTrainerLocation(int matchCallId) { const struct MapHeader *mapHeader = Overworld_GetMapHeaderByGroupAndId(gRematchTable[matchCallId].mapGroup, gRematchTable[matchCallId].mapNum); return mapHeader->regionMapSectionId; diff --git a/src/overworld.c b/src/overworld.c index 32c5eb0678cb..06ea5daa3863 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -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_min16_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_t GetSavedWarpRegionMapSectionId(void) { return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->dynamicWarp.mapGroup, gSaveBlock1Ptr->dynamicWarp.mapNum)->regionMapSectionId; } -u8 GetCurrentRegionMapSectionId(void) +mapsec_t GetCurrentRegionMapSectionId(void) { return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum)->regionMapSectionId; } diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index 8b0a84510227..5c0242fceb8d 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -1,6 +1,7 @@ #include "global.h" #include "bg.h" #include "event_data.h" +#include "gametypes.h" #include "gpu_regs.h" #include "graphics.h" #include "main.h" @@ -58,7 +59,7 @@ struct OverworldArea { u8 mapGroup; u8 mapNum; - u16 regionMapSectionId; + mapsec_min16_t regionMapSectionId; }; struct @@ -79,7 +80,7 @@ struct /*0x61C*/ u16 areaShadeBldArgHi; /*0x61E*/ bool8 showingMarkers; /*0x61F*/ u8 markerFlashCounter; - /*0x620*/ u16 specialAreaRegionMapSectionIds[MAX_AREA_MARKERS]; + /*0x620*/ mapsec_min16_t specialAreaRegionMapSectionIds[MAX_AREA_MARKERS]; /*0x660*/ struct Sprite *areaMarkerSprites[MAX_AREA_MARKERS]; /*0x6E0*/ u16 numAreaMarkerSprites; /*0x6E2*/ u16 alteringCaveCounter; @@ -95,7 +96,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_min16_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 +113,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_min16_t sMovingRegionMapSections[3] = { MAPSEC_MARINE_CAVE, MAPSEC_UNDERWATER_MARINE_CAVE, @@ -125,7 +126,7 @@ static const u16 sFeebasData[][3] = {NUM_SPECIES} }; -static const u16 sLandmarkData[][2] = +static const mapsec_min16_t sLandmarkData[][2] = { {MAPSEC_SKY_PILLAR, FLAG_LANDMARK_SKY_PILLAR}, {MAPSEC_SEAFLOOR_CAVERN, FLAG_LANDMARK_SEAFLOOR_CAVERN}, @@ -336,7 +337,7 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum) if (sPokedexAreaScreen->numSpecialAreas < MAX_AREA_MARKERS) { - u16 regionMapSectionId = GetRegionMapSectionId(mapGroup, mapNum); + mapsec_min16_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 +371,7 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum) } } -static u16 GetRegionMapSectionId(u8 mapGroup, u8 mapNum) +static mapsec_min16_t GetRegionMapSectionId(u8 mapGroup, u8 mapNum) { return Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->regionMapSectionId; } @@ -710,7 +711,7 @@ static void CreateAreaMarkerSprites(void) static s16 x; static s16 y; static s16 i; - static s16 mapSecId; + static mapsec_min16_s_t mapSecId; static s16 numSprites; LoadSpriteSheet(&sAreaMarkerSpriteSheet); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index a5886fd6a99d..d31b34a4adaa 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1,4 +1,5 @@ #include "global.h" +#include "gametypes.h" #include "main.h" #include "battle.h" #include "battle_anim.h" @@ -143,7 +144,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData u8 ribbonCount; // 0x6 u8 ailment; // 0x7 u8 abilityNum; // 0x8 - u8 metLocation; // 0x9 + metloc_t metLocation; // 0x9 u8 metLevel; // 0xA u8 metGame; // 0xB u32 pid; // 0xC diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 1c3cf9aeeb02..5221697990e6 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -2,6 +2,7 @@ #include "battle_setup.h" #include "data.h" #include "event_data.h" +#include "gametypes.h" #include "string_util.h" #include "battle.h" #include "gym_leader_rematch.h" @@ -34,13 +35,13 @@ typedef struct MatchCallTextDataStruct { struct MatchCallStructCommon { u8 type; - u8 mapSec; + mapsec_t mapSec; u16 flag; }; struct MatchCallStructNPC { u8 type; - u8 mapSec; + mapsec_t mapSec; u16 flag; const u8 *desc; const u8 *name; @@ -50,7 +51,7 @@ struct MatchCallStructNPC { // Shared by MC_TYPE_TRAINER and MC_TYPE_LEADER struct MatchCallStructTrainer { u8 type; - u8 mapSec; + mapsec_t mapSec; u16 flag; u16 rematchTableIdx; const u8 *desc; @@ -60,12 +61,12 @@ struct MatchCallStructTrainer { struct MatchCallLocationOverride { u16 flag; - u8 mapSec; + mapsec_t mapSec; }; struct MatchCallWally { u8 type; - u8 mapSec; + mapsec_t mapSec; u16 flag; u16 rematchTableIdx; const u8 *desc; @@ -75,7 +76,7 @@ struct MatchCallWally { struct MatchCallBirch { u8 type; - u8 mapSec; + mapsec_t mapSec; u16 flag; const u8 *desc; const u8 *name; @@ -117,11 +118,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_t MatchCall_GetMapSec_NPC(match_call_t); +static mapsec_t MatchCall_GetMapSec_Trainer(match_call_t); +static mapsec_t MatchCall_GetMapSec_Wally(match_call_t); +static mapsec_t MatchCall_GetMapSec_Birch(match_call_t); +static mapsec_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 +610,7 @@ static bool32 (*const sMatchCallGetEnabledFuncs[])(match_call_t) = { MatchCall_GetEnabled_Birch }; -static u8 (*const sMatchCallGetMapSecFuncs[])(match_call_t) = { +static mapsec_t (*const sMatchCallGetMapSecFuncs[])(match_call_t) = { MatchCall_GetMapSec_NPC, MatchCall_GetMapSec_Trainer, MatchCall_GetMapSec_Wally, @@ -779,7 +780,7 @@ static bool32 MatchCall_GetEnabled_Birch(match_call_t matchCall) return FlagGet(matchCall.birch->flag); } -u8 MatchCall_GetMapSec(u32 idx) +mapsec_t MatchCall_GetMapSec(u32 idx) { match_call_t matchCall; u32 i; @@ -791,17 +792,17 @@ u8 MatchCall_GetMapSec(u32 idx) return sMatchCallGetMapSecFuncs[i](matchCall); } -static u8 MatchCall_GetMapSec_NPC(match_call_t matchCall) +static mapsec_t MatchCall_GetMapSec_NPC(match_call_t matchCall) { return matchCall.npc->mapSec; } -static u8 MatchCall_GetMapSec_Trainer(match_call_t matchCall) +static mapsec_t MatchCall_GetMapSec_Trainer(match_call_t matchCall) { return matchCall.trainer->mapSec; } -static u8 MatchCall_GetMapSec_Wally(match_call_t matchCall) +static mapsec_t MatchCall_GetMapSec_Wally(match_call_t matchCall) { s32 i; @@ -813,12 +814,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_t MatchCall_GetMapSec_Rival(match_call_t matchCall) { return MAPSEC_NONE; } -static u8 MatchCall_GetMapSec_Birch(match_call_t matchCall) +static mapsec_t MatchCall_GetMapSec_Birch(match_call_t matchCall) { return MAPSEC_NONE; } diff --git a/src/pokenav_match_call_gfx.c b/src/pokenav_match_call_gfx.c index 4271e2ff23b9..3f773f94c08f 100755 --- a/src/pokenav_match_call_gfx.c +++ b/src/pokenav_match_call_gfx.c @@ -3,6 +3,7 @@ #include "data.h" #include "decompress.h" #include "dma3.h" +#include "gametypes.h" #include "international_string_util.h" #include "main.h" #include "match_call.h" @@ -1022,7 +1023,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_int_t mapSec = GetMatchCallMapSec(index); if (mapSec != MAPSEC_NONE) GetMapName(mapName, mapSec, 0); else diff --git a/src/pokenav_match_call_list.c b/src/pokenav_match_call_list.c index fb89e33e0b23..e7aaaa5ee7b6 100755 --- a/src/pokenav_match_call_list.c +++ b/src/pokenav_match_call_list.c @@ -306,7 +306,7 @@ struct PokenavMatchCallEntry *GetMatchCallList(void) return state->matchCallEntries; } -u16 GetMatchCallMapSec(int index) +mapsec_min16_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_t GetMatchTableMapSectionId(int rematchIndex) { int mapGroup = gRematchTable[rematchIndex].mapGroup; int mapNum = gRematchTable[rematchIndex].mapNum; diff --git a/src/pokenav_region_map.c b/src/pokenav_region_map.c index f81ff4296639..cd1114d52e21 100755 --- a/src/pokenav_region_map.c +++ b/src/pokenav_region_map.c @@ -1,6 +1,7 @@ #include "global.h" #include "bg.h" #include "decompress.h" +#include "gametypes.h" #include "landmark.h" #include "main.h" #include "menu.h" @@ -41,7 +42,7 @@ struct Pokenav_RegionMapGfx struct CityMapEntry { - u16 mapSecId; + mapsec_min16_t mapSecId; u16 index; const u32 *tilemap; }; @@ -63,8 +64,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_int_t, int); +static void PrintLandmarkNames(struct Pokenav_RegionMapGfx *, mapsec_int_t, int); static void SetCityZoomTextInvisibility(bool32); static void Task_ChangeBgYForZoom(u8 taskId); static void UpdateCityZoomTextPosition(void); @@ -634,7 +635,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_int_t mapSecId, int pos) { int i; for (i = 0; i < NUM_CITY_MAPS && (sPokenavCityMaps[i].mapSecId != mapSecId || sPokenavCityMaps[i].index != pos); i++) @@ -647,7 +648,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_int_t mapSecId, int pos) { int i = 0; while (1) diff --git a/src/region_map.c b/src/region_map.c index 22a3f567b479..3b6f75e6f175 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -63,7 +63,7 @@ enum { struct MultiNameFlyDest { const u8 *const *name; - u16 mapSecId; + mapsec_min16_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_min16_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_min16_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_min16_t mapSecId); +static mapsec_min16_t CorrectSpecialMapSecId_Internal(mapsec_min16_t mapSecId); +static mapsec_min16_t GetTerraOrMarineCaveMapSecId(void); static void GetMarineCaveCoords(u16 *x, u16 *y); -static bool32 IsPlayerInAquaHideout(u8 mapSecId); +static bool32 IsPlayerInAquaHideout(mapsec_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_min16_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_min16_t sMarineCaveMapSecIds[] = { MAPSEC_MARINE_CAVE, MAPSEC_UNDERWATER_MARINE_CAVE, MAPSEC_UNDERWATER_MARINE_CAVE }; -static const u16 sTerraOrMarineCaveMapSecIds[ABNORMAL_WEATHER_LOCATIONS] = +static const mapsec_min16_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_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_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_min16_t sRedOutlineFlyDestinations[][2] = { { FLAG_LANDMARK_BATTLE_FRONTIER, @@ -690,7 +690,7 @@ static u8 ProcessRegionMapInput_Full(void) static u8 MoveRegionMapCursor_Full(void) { - u16 mapSecId; + mapsec_min16_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_min16_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_min16_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_min16_t mapSecId) { switch (mapSecId) { @@ -1219,12 +1219,12 @@ static u8 GetMapsecType(u16 mapSecId) } } -u16 GetRegionMapSecIdAt(u16 x, u16 y) +mapsec_min16_t GetRegionMapSecIdAt(u16 x, u16 y) { return GetMapSecIdAt(x, y); } -static u16 CorrectSpecialMapSecId_Internal(u16 mapSecId) +static mapsec_min16_t CorrectSpecialMapSecId_Internal(mapsec_min16_t mapSecId) { u32 i; @@ -1245,7 +1245,7 @@ static u16 CorrectSpecialMapSecId_Internal(u16 mapSecId) return mapSecId; } -static u16 GetTerraOrMarineCaveMapSecId(void) +static mapsec_min16_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_t mapSecId) { u32 i; @@ -1286,7 +1286,7 @@ static bool32 IsPlayerInAquaHideout(u8 mapSecId) return FALSE; } -u16 CorrectSpecialMapSecId(u16 mapSecId) +mapsec_min16_t CorrectSpecialMapSecId(mapsec_min16_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_min16_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_min16_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_min16_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_min16_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_t mapSecId) { u32 i; @@ -1839,7 +1839,7 @@ static void LoadFlyDestIcons(void) static void CreateFlyDestIcons(void) { u16 canFlyFlag; - u16 mapSecId; + mapsec_min16_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_min16_t mapSecId; u8 spriteId; for (i = 0; sRedOutlineFlyDestinations[i][1] != MAPSEC_NONE; i++) diff --git a/src/trade.c b/src/trade.c index e07e418d1add..200a64c819e8 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1,4 +1,5 @@ #include "global.h" +#include "gametypes.h" #include "malloc.h" #include "battle_anim.h" #include "battle_interface.h" @@ -4552,7 +4553,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_t metLocation = METLOC_IN_GAME_TRADE; u8 mailNum; struct Pokemon *pokemon = &gEnemyParty[0]; From 58738a2e7bb6dbb56811814779cd3114576b5b23 Mon Sep 17 00:00:00 2001 From: DavidJCobb <831497+DavidJCobb@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:22:59 -0400 Subject: [PATCH 2/8] Set(Box)MonData set up to handle metloc_t being extended --- src/frontier_pass.c | 2 ++ src/pokemon.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/frontier_pass.c b/src/frontier_pass.c index a1142e109a10..76f9e7a59aac 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -607,6 +607,8 @@ static void LeaveFrontierPass(void) static u32 AllocateFrontierPassData(void (*callback)(void)) { + // This variable is a MAPSEC initially, but is recycled as a + // bare integer near the end of the function. mapsec_t i; if (sPassData != NULL) diff --git a/src/pokemon.c b/src/pokemon.c index a06693dc8a37..c974c6018d89 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4074,6 +4074,18 @@ 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) \ + if (sizeof(lhs) == 1) { \ + SET8(lhs); \ + } else if (sizeof(lhs) == 2) { \ + SET16(lhs); \ + } else if (sizeof(lhs) == 4) { \ + SET32(lhs); \ + } void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg) { @@ -4263,7 +4275,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: { From 911759a21ddc3892b329bd241579eb01a05afcd0 Mon Sep 17 00:00:00 2001 From: DavidJCobb <831497+DavidJCobb@users.noreply.github.com> Date: Thu, 25 Sep 2025 18:25:37 -0400 Subject: [PATCH 3/8] Renamed the mapsec/metloc typedefs Per feedback, renamed all typedefs to mention the underlying type within the typedef name. Rewrote the documentation comments to reflect and to explain the new 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. --- include/gametypes.h | 66 +++++++++++++++---------- include/global.fieldmap.h | 2 +- include/global.tv.h | 14 +++--- include/landmark.h | 2 +- include/overworld.h | 4 +- include/pokemon.h | 2 +- include/pokenav.h | 6 +-- include/region_map.h | 16 +++--- src/data/region_map/region_map_layout.h | 2 +- src/daycare.c | 2 +- src/egg_hatch.c | 2 +- src/frontier_pass.c | 2 +- src/landmark.c | 8 +-- src/map_name_popup.c | 6 +-- src/match_call.c | 4 +- src/overworld.c | 6 +-- src/pokedex_area_screen.c | 18 +++---- src/pokemon_summary_screen.c | 2 +- src/pokenav_match_call_data.c | 38 +++++++------- src/pokenav_match_call_list.c | 4 +- src/pokenav_region_map.c | 2 +- src/region_map.c | 62 +++++++++++------------ src/trade.c | 2 +- 23 files changed, 144 insertions(+), 128 deletions(-) diff --git a/include/gametypes.h b/include/gametypes.h index 4f2f6bcfe3bf..6dcb297fffb4 100644 --- a/include/gametypes.h +++ b/include/gametypes.h @@ -7,45 +7,61 @@ // This header includes typedefs for fields that commonly appear throughout // the codebase, and which ROM hacks might benefit from being able to widen. // -// Game Freak wasn't consistent with field widths; for example, some fields -// are stored as u8s, but some functions take those fields as u16s. We offer -// typedefs for those cases as well; the general naming convention takes -// inspiration from and is: +// These typedefs include the underlying type in their name for two reasons: // -// - foo_t The type something is persistently stored as. +// - Game Freak wasn't fully consistent about field widths throughout +// their codebase. For example, when Region Map Sections are persistently +// stored in savedata, they're stored as 8-bit values; but much of the +// codebase handles them as 16-bit values. // -// - foo_min#_t foo_t with a minimum size of # bits. For example, -// foo_min16_t would be a u16 or s16 depending on the -// signedness of foo_t. +// - Although Pokemon Emerald doesn't come close to maxing out RAM, it *does* +// use nearly all of its EEPROM. That is: the vanilla game uses 96% of the +// flash memory available for storing players' save files, leaving 2172 +// bytes to spare within each of the game's two save files (primary and +// backup). These spare bytes are not contiguous: SaveBlock1 can only grow +// by 84 bytes, and SaveBlock2 can only grow by 120 bytes, with the rest +// of the free space located after the player's PC-boxed Pokemon. // -// - foo_min#_s_t foo_min#_t, but signed. Used when foo_t is usually -// unsigned. +// With so little flash memory to spare, keeping track of how much space +// you're using is vital -- and so is arranging struct members to minimize +// compiler-inserted padding. It's easier to deal with this when you can +// see these types' widths at a glance. // -// - foo_min#_u_t foo_min#_t, but unsigned. Used when foo_t is usually -// signed. +// Accordingly, this file generally doesn't contain just single types, but +// rather families of types. For example, Region Map Sections are saved as +// u8s within the player's save file, but are sometimes handled as u16s or +// even s16s and ints; and so there are multiple typedefs for Map Sections +// corresponding to each of these underlying types, and each typedef has a +// name which indicates the underlying type. // -// - foo_int_t For cases where a variable is a bare int. -// -// If you need to widen a type, make sure that its variations are widened -// as well. For example, if bar_t is a u8 and you want to widen it to u32, -// you must change bar_min16_t to a u32 as well, and bar_min16_s_t to an -// s32. +// For a given family of typedefs, the smallest one should be considered +// the "real" or "canonical" type. Continuing with Map Sections as our +// example, the smallest type is an 8-bit integer, and so any values that +// can't fit in an 8-bit integer will be truncated and lost at some point +// within the codebase. Therefore mapsec_u8_t is the "canonical" type for +// Map Sections, and the larger typedefs just exist to describe situations +// where the game handles Map Sections inconsistently with that "canon." // // Map Sections are named areas that can appear in the region map. Each // individual map can be assigned to a Map Section as appropriate. The // possible values are in constants/region_map_sections.h. -typedef u8 mapsec_t; -typedef u16 mapsec_min16_t; -typedef s16 mapsec_min16_s_t; +// +// If you choose to widen Map Sections, be aware that Met Locations (below) +// are based on Map Sections and will also be widened. +typedef u8 mapsec_u8_t; +typedef u16 mapsec_u16_t; +typedef s16 mapsec_s16_t; typedef int mapsec_int_t; // Met Locations for caught Pokemon use the same values as Map Sections, // except that 0xFD, 0xFE, and 0xFF have special meanings. // -// Note that SetBoxMonData and friends use the SET8 macro to write this -// data, so widening mapsec_t or metloc_t will require updating that as -// well. -typedef mapsec_t metloc_t; +// Because this value appears inside every Pokemon's data, widening it will +// consume a lot more space within flash memory. The space usage will be +// greater than you expect due to how Pokemon substructs are laid out; you +// would have to rearrange the substructs' contents in order to minimize +// how much more space a wider Met Location would consume. +typedef mapsec_u8_t metloc_u8_t; #endif //GUARD_GAMETYPES_H diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 4ce1e72dbc09..3236a82b2790 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -169,7 +169,7 @@ struct MapHeader /* 0x0C */ const struct MapConnections *connections; /* 0x10 */ u16 music; /* 0x12 */ u16 mapLayoutId; - /* 0x14 */ mapsec_t regionMapSectionId; + /* 0x14 */ mapsec_u8_t regionMapSectionId; /* 0x15 */ u8 cave; /* 0x16 */ u8 weather; /* 0x17 */ u8 mapType; diff --git a/include/global.tv.h b/include/global.tv.h index fb5f45a4abdf..b730d61eac1b 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -227,7 +227,7 @@ typedef union // size = 0x24 /*0x04*/ u8 filler_04[2]; /*0x06*/ u16 itemIds[SMARTSHOPPER_NUM_ITEMS]; /*0x0C*/ u16 itemAmounts[SMARTSHOPPER_NUM_ITEMS]; - /*0x12*/ mapsec_t shopLocation; + /*0x12*/ mapsec_u8_t shopLocation; /*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x1B*/ //u8 padding; } smartshopperShow; @@ -242,7 +242,7 @@ typedef union // size = 0x24 /*0x0E*/ u16 species2; /*0x10*/ u8 nBallsUsed; /*0x11*/ u8 outcome; - /*0x12*/ mapsec_t location; + /*0x12*/ mapsec_u8_t location; /*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x1B*/ //u8 padding; } pokemonTodayFailed; @@ -268,7 +268,7 @@ typedef union // size = 0x24 /*0x04*/ u16 caughtPoke; /*0x06*/ u16 steps; /*0x08*/ u16 species; - /*0x0A*/ mapsec_t location; + /*0x0A*/ mapsec_u8_t location; /*0x0B*/ u8 language; /*0x0C*/ u8 filler_0C[7]; /*0x13*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; @@ -283,7 +283,7 @@ typedef union // size = 0x24 /*0x04*/ u8 badgeCount; /*0x05*/ u8 nSilverSymbols; /*0x06*/ u8 nGoldSymbols; - /*0x07*/ mapsec_t location; + /*0x07*/ mapsec_u8_t location; /*0x08*/ u16 battlePoints; /*0x0A*/ u16 mapLayoutId; /*0x0C*/ u8 language; @@ -310,7 +310,7 @@ typedef union // size = 0x24 /*0x00*/ u8 kind; /*0x01*/ bool8 active; /*0x02*/ u16 item; - /*0x04*/ mapsec_t location; + /*0x04*/ mapsec_u8_t location; /*0x05*/ u8 language; /*0x06*/ u16 mapLayoutId; /*0x08*/ u8 filler_08[11]; @@ -337,7 +337,7 @@ typedef union // size = 0x24 /*0x00*/ u8 kind; /*0x01*/ bool8 active; /*0x02*/ u16 lastOpponentSpecies; - /*0x04*/ mapsec_t location; + /*0x04*/ mapsec_u8_t location; /*0x05*/ u8 outcome; /*0x06*/ u16 caughtMonBall; /*0x08*/ u16 balls; @@ -506,7 +506,7 @@ struct GabbyAndTyData /*2BA6*/ u16 mon2; /*2BA8*/ u16 lastMove; /*2BAA*/ u16 quote[1]; - /*2BAC*/ mapsec_t mapnum; + /*2BAC*/ mapsec_u8_t mapnum; /*2BAD*/ u8 battleNum; /*2BAE*/ u8 battleTookMoreThanOneTurn:1; u8 playerLostAMon:1; diff --git a/include/landmark.h b/include/landmark.h index 57fc7adc1abc..95eb84370adb 100644 --- a/include/landmark.h +++ b/include/landmark.h @@ -3,6 +3,6 @@ #include "gametypes.h" -const u8 *GetLandmarkName(mapsec_t mapSection, u8 id, u8 count); +const u8 *GetLandmarkName(mapsec_u8_t mapSection, u8 id, u8 count); #endif // GUARD_LANDMARK_H diff --git a/include/overworld.h b/include/overworld.h index 12f1ec56be8a..5f9924690180 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -123,8 +123,8 @@ u8 GetLastUsedWarpMapType(void); bool8 IsMapTypeOutdoors(u8 mapType); bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType); bool8 IsMapTypeIndoors(u8 mapType); -mapsec_t GetSavedWarpRegionMapSectionId(void); -mapsec_t GetCurrentRegionMapSectionId(void); +mapsec_u8_t GetSavedWarpRegionMapSectionId(void); +mapsec_u8_t GetCurrentRegionMapSectionId(void); u8 GetCurrentMapBattleScene(void); void CleanupOverworldWindowsAndTilemaps(void); bool32 IsOverworldLinkActive(void); diff --git a/include/pokemon.h b/include/pokemon.h index 5a2e1ca6cb22..c1359124df5c 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -132,7 +132,7 @@ struct PokemonSubstruct2 struct PokemonSubstruct3 { /* 0x00 */ u8 pokerus; - /* 0x01 */ metloc_t metLocation; + /* 0x01 */ metloc_u8_t metLocation; /* 0x02 */ u16 metLevel:7; /* 0x02 */ u16 metGame:4; diff --git a/include/pokenav.h b/include/pokenav.h index 96f996998dcb..9cfb32963ea6 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -18,7 +18,7 @@ struct PokenavMonListItem struct PokenavMatchCallEntry { bool8 isSpecialTrainer; - mapsec_t mapSec; + mapsec_u8_t mapSec; u16 headerId; }; @@ -411,7 +411,7 @@ void FreeMatchCallSubstruct1(void); int IsMatchCallListInitFinished(void); int GetNumberRegistered(void); struct PokenavMatchCallEntry *GetMatchCallList(void); -mapsec_min16_t GetMatchCallMapSec(int index); +mapsec_u16_t GetMatchCallMapSec(int index); bool32 ShouldDrawRematchPokeballIcon(int index); void ClearRematchPokeballIcon(u16 windowId, u32 tileOffset); int GetMatchCallTrainerPic(int index); @@ -420,7 +420,7 @@ const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest); u16 GetMatchCallOptionCursorPos(void); u16 GetMatchCallOptionId(int optionId); void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry *matchCallEntry, u8 *str); -mapsec_t GetMatchTableMapSectionId(int rematchIndex); +mapsec_u8_t GetMatchTableMapSectionId(int rematchIndex); int GetIndexDeltaOfNextCheckPageDown(int index); int GetIndexDeltaOfNextCheckPageUp(int index); bool32 IsRematchEntryRegistered(int rematchIndex); diff --git a/include/region_map.h b/include/region_map.h index 9490edc69824..fbadcc6fca19 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -23,11 +23,11 @@ enum { MAPSECTYPE_CITY_CANFLY, MAPSECTYPE_CITY_CANTFLY, MAPSECTYPE_BATTLE_FRONTIER, - NUM_MAPSEC_TYPES + NUM_mapsec_u8_tYPES }; struct RegionMap { - /*0x000*/ mapsec_min16_t mapSecId; + /*0x000*/ mapsec_u16_t mapSecId; /*0x002*/ u8 mapSecType; /*0x003*/ u8 posWithinMapSec; /*0x004*/ u8 mapSecName[20]; @@ -100,14 +100,14 @@ void InitRegionMap(struct RegionMap *regionMap, bool8 zoomed); u8 DoRegionMapInputCallback(void); bool8 UpdateRegionMapZoom(void); void FreeRegionMapIconResources(void); -mapsec_min16_t GetRegionMapSecIdAt(u16 x, u16 y); +mapsec_u16_t GetRegionMapSecIdAt(u16 x, u16 y); void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag); void CreateRegionMapCursor(u16 tileTag, u16 paletteTag); -bool32 IsEventIslandMapSecId(mapsec_t mapSecId); -u8 *GetMapName(u8 *dest, mapsec_min16_t regionMapId, u16 padLength); -u8 *GetMapNameGeneric(u8 *dest, mapsec_min16_t mapSecId); -u8 *GetMapNameHandleAquaHideout(u8 *dest, mapsec_min16_t mapSecId); -mapsec_min16_t CorrectSpecialMapSecId(mapsec_min16_t mapSecId); +bool32 IsEventIslandMapSecId(mapsec_u8_t mapSecId); +u8 *GetMapName(u8 *dest, mapsec_u16_t regionMapId, u16 padLength); +u8 *GetMapNameGeneric(u8 *dest, mapsec_u16_t mapSecId); +u8 *GetMapNameHandleAquaHideout(u8 *dest, mapsec_u16_t mapSecId); +mapsec_u16_t CorrectSpecialMapSecId(mapsec_u16_t mapSecId); void ShowRegionMapForPokedexAreaScreen(struct RegionMap *regionMap); void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y); void CB2_OpenFlyMap(void); diff --git a/src/data/region_map/region_map_layout.h b/src/data/region_map/region_map_layout.h index 54288ca55f4f..32ce91724d97 100644 --- a/src/data/region_map/region_map_layout.h +++ b/src/data/region_map/region_map_layout.h @@ -1,4 +1,4 @@ -static const mapsec_t 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}, diff --git a/src/daycare.c b/src/daycare.c index 7248db360089..8c311aa33993 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -831,7 +831,7 @@ void CreateEgg(struct Pokemon *mon, u16 species, bool8 setHotSpringsLocation) u8 metLevel; u16 ball; u8 language; - metloc_t metLocation; + metloc_u8_t metLocation; u8 isEgg; CreateMon(mon, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 7e2d8f69d31e..719b9c0d90cc 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -363,7 +363,7 @@ static void AddHatchedMonToParty(u8 id) u8 name[POKEMON_NAME_LENGTH + 1]; u16 ball; u16 metLevel; - metloc_t metLocation; + metloc_u8_t metLocation; struct Pokemon *mon = &gPlayerParty[id]; CreateHatchedMon(mon, &gEnemyParty[0]); diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 76f9e7a59aac..7d7c61d6b86e 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -609,7 +609,7 @@ static u32 AllocateFrontierPassData(void (*callback)(void)) { // This variable is a MAPSEC initially, but is recycled as a // bare integer near the end of the function. - mapsec_t i; + mapsec_u8_t i; if (sPassData != NULL) return ERR_ALREADY_DONE; diff --git a/src/landmark.c b/src/landmark.c index 511bd21b08c5..a8cf6c123362 100644 --- a/src/landmark.c +++ b/src/landmark.c @@ -10,7 +10,7 @@ struct Landmark struct LandmarkList { - mapsec_t 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(mapsec_t mapSection, u8 id); +static const struct Landmark *const *GetLandmarks(mapsec_u8_t mapSection, u8 id); -const u8 *GetLandmarkName(mapsec_t 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(mapsec_t mapSection, u8 id, u8 count) return (*landmarks)->name; } -static const struct Landmark *const *GetLandmarks(mapsec_t mapSection, u8 id) +static const struct Landmark *const *GetLandmarks(mapsec_u8_t mapSection, u8 id) { u16 i = 0; diff --git a/src/map_name_popup.c b/src/map_name_popup.c index ae7de31ee9d1..dc7cb6d1ca5d 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -171,14 +171,14 @@ static const u8 sMapSectionToThemeId[MAPSEC_COUNT - KANTO_MAPSEC_COUNT - 1] = [MAPSEC_ARTISAN_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_MARINE_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_UNDERWATER_MARINE_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2, - [MAPSEC_TERRA_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, + [mapsec_u8_tERRA_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_UNDERWATER_105 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2, [MAPSEC_UNDERWATER_125 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2, [MAPSEC_UNDERWATER_129 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2, [MAPSEC_DESERT_UNDERPASS - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_ALTERING_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_NAVEL_ROCK - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, - [MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE, + [mapsec_u8_tRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE, }; static const u8 sText_PyramidFloor1[] = _("PYRAMID FLOOR 1"); @@ -405,7 +405,7 @@ static void LoadMapNamePopUpWindowBg(void) { u8 popUpThemeId; u8 popupWindowId = GetMapNamePopUpWindowId(); - mapsec_min16_t regionMapSectionId = gMapHeader.regionMapSectionId; + mapsec_u16_t regionMapSectionId = gMapHeader.regionMapSectionId; if (regionMapSectionId >= KANTO_MAPSEC_START) { diff --git a/src/match_call.c b/src/match_call.c index 8ce8e31d9bb7..c19ee3d71d57 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -135,7 +135,7 @@ static u32 GetCurrentTotalMinutes(struct Time *); static u32 GetNumRegisteredTrainers(void); static u32 GetActiveMatchCallTrainerId(u32); static int GetTrainerMatchCallId(int); -static mapsec_min16_t GetRematchTrainerLocation(int); +static mapsec_u16_t GetRematchTrainerLocation(int); static bool32 TrainerIsEligibleForRematch(int); static void StartMatchCall(void); static void ExecuteMatchCall(u8); @@ -1464,7 +1464,7 @@ static bool32 TrainerIsEligibleForRematch(int matchCallId) return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0; } -static mapsec_min16_t 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; diff --git a/src/overworld.c b/src/overworld.c index 06ea5daa3863..d1d3ddcd37b2 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -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 mapsec_min16_t 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; } -mapsec_t GetSavedWarpRegionMapSectionId(void) +mapsec_u8_t GetSavedWarpRegionMapSectionId(void) { return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->dynamicWarp.mapGroup, gSaveBlock1Ptr->dynamicWarp.mapNum)->regionMapSectionId; } -mapsec_t GetCurrentRegionMapSectionId(void) +mapsec_u8_t GetCurrentRegionMapSectionId(void) { return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum)->regionMapSectionId; } diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index 5c0242fceb8d..59332117ed12 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -59,7 +59,7 @@ struct OverworldArea { u8 mapGroup; u8 mapNum; - mapsec_min16_t regionMapSectionId; + mapsec_u16_t regionMapSectionId; }; struct @@ -80,7 +80,7 @@ struct /*0x61C*/ u16 areaShadeBldArgHi; /*0x61E*/ bool8 showingMarkers; /*0x61F*/ u8 markerFlashCounter; - /*0x620*/ mapsec_min16_t 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; @@ -96,7 +96,7 @@ static void FindMapsWithMon(u16); static void BuildAreaGlowTilemap(void); static void SetAreaHasMon(u16, u16); static void SetSpecialMapHasMon(u16, u16); -static mapsec_min16_t 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); @@ -113,11 +113,11 @@ static const u32 sAreaGlow_Gfx[] = INCBIN_U32("graphics/pokedex/area_glow.4bpp.l static const u16 sSpeciesHiddenFromAreaScreen[] = { SPECIES_WYNAUT }; -static const mapsec_min16_t sMovingRegionMapSections[3] = +static const mapsec_u16_t sMovingRegionMapSections[3] = { MAPSEC_MARINE_CAVE, MAPSEC_UNDERWATER_MARINE_CAVE, - MAPSEC_TERRA_CAVE + mapsec_u8_tERRA_CAVE }; static const u16 sFeebasData[][3] = @@ -126,7 +126,7 @@ static const u16 sFeebasData[][3] = {NUM_SPECIES} }; -static const mapsec_min16_t sLandmarkData[][2] = +static const mapsec_u16_t sLandmarkData[][2] = { {MAPSEC_SKY_PILLAR, FLAG_LANDMARK_SKY_PILLAR}, {MAPSEC_SEAFLOOR_CAVERN, FLAG_LANDMARK_SEAFLOOR_CAVERN}, @@ -337,7 +337,7 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum) if (sPokedexAreaScreen->numSpecialAreas < MAX_AREA_MARKERS) { - mapsec_min16_t 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) @@ -371,7 +371,7 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum) } } -static mapsec_min16_t GetRegionMapSectionId(u8 mapGroup, u8 mapNum) +static mapsec_u16_t GetRegionMapSectionId(u8 mapGroup, u8 mapNum) { return Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->regionMapSectionId; } @@ -711,7 +711,7 @@ static void CreateAreaMarkerSprites(void) static s16 x; static s16 y; static s16 i; - static mapsec_min16_s_t mapSecId; + static mapsec_s16_t mapSecId; static s16 numSprites; LoadSpriteSheet(&sAreaMarkerSpriteSheet); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index d31b34a4adaa..8190e2b24b1b 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -144,7 +144,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData u8 ribbonCount; // 0x6 u8 ailment; // 0x7 u8 abilityNum; // 0x8 - metloc_t metLocation; // 0x9 + metloc_u8_t metLocation; // 0x9 u8 metLevel; // 0xA u8 metGame; // 0xB u32 pid; // 0xC diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 5221697990e6..2723d7432db9 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -35,13 +35,13 @@ typedef struct MatchCallTextDataStruct { struct MatchCallStructCommon { u8 type; - mapsec_t mapSec; + mapsec_u8_t mapSec; u16 flag; }; struct MatchCallStructNPC { u8 type; - mapsec_t mapSec; + mapsec_u8_t mapSec; u16 flag; const u8 *desc; const u8 *name; @@ -51,7 +51,7 @@ struct MatchCallStructNPC { // Shared by MC_TYPE_TRAINER and MC_TYPE_LEADER struct MatchCallStructTrainer { u8 type; - mapsec_t mapSec; + mapsec_u8_t mapSec; u16 flag; u16 rematchTableIdx; const u8 *desc; @@ -61,12 +61,12 @@ struct MatchCallStructTrainer { struct MatchCallLocationOverride { u16 flag; - mapsec_t mapSec; + mapsec_u8_t mapSec; }; struct MatchCallWally { u8 type; - mapsec_t mapSec; + mapsec_u8_t mapSec; u16 flag; u16 rematchTableIdx; const u8 *desc; @@ -76,7 +76,7 @@ struct MatchCallWally { struct MatchCallBirch { u8 type; - mapsec_t mapSec; + mapsec_u8_t mapSec; u16 flag; const u8 *desc; const u8 *name; @@ -118,11 +118,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 mapsec_t MatchCall_GetMapSec_NPC(match_call_t); -static mapsec_t MatchCall_GetMapSec_Trainer(match_call_t); -static mapsec_t MatchCall_GetMapSec_Wally(match_call_t); -static mapsec_t MatchCall_GetMapSec_Birch(match_call_t); -static mapsec_t MatchCall_GetMapSec_Rival(match_call_t); +static mapsec_u8_t MatchCall_GetMapSec_NPC(match_call_t); +static mapsec_u8_t MatchCall_Getmapsec_u8_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); @@ -610,9 +610,9 @@ static bool32 (*const sMatchCallGetEnabledFuncs[])(match_call_t) = { MatchCall_GetEnabled_Birch }; -static mapsec_t (*const sMatchCallGetMapSecFuncs[])(match_call_t) = { +static mapsec_u8_t (*const sMatchCallGetMapSecFuncs[])(match_call_t) = { MatchCall_GetMapSec_NPC, - MatchCall_GetMapSec_Trainer, + MatchCall_Getmapsec_u8_trainer, MatchCall_GetMapSec_Wally, MatchCall_GetMapSec_Rival, MatchCall_GetMapSec_Birch @@ -780,7 +780,7 @@ static bool32 MatchCall_GetEnabled_Birch(match_call_t matchCall) return FlagGet(matchCall.birch->flag); } -mapsec_t MatchCall_GetMapSec(u32 idx) +mapsec_u8_t MatchCall_GetMapSec(u32 idx) { match_call_t matchCall; u32 i; @@ -792,17 +792,17 @@ mapsec_t MatchCall_GetMapSec(u32 idx) return sMatchCallGetMapSecFuncs[i](matchCall); } -static mapsec_t MatchCall_GetMapSec_NPC(match_call_t matchCall) +static mapsec_u8_t MatchCall_GetMapSec_NPC(match_call_t matchCall) { return matchCall.npc->mapSec; } -static mapsec_t MatchCall_GetMapSec_Trainer(match_call_t matchCall) +static mapsec_u8_t MatchCall_Getmapsec_u8_trainer(match_call_t matchCall) { return matchCall.trainer->mapSec; } -static mapsec_t MatchCall_GetMapSec_Wally(match_call_t matchCall) +static mapsec_u8_t MatchCall_GetMapSec_Wally(match_call_t matchCall) { s32 i; @@ -814,12 +814,12 @@ static mapsec_t MatchCall_GetMapSec_Wally(match_call_t matchCall) return matchCall.wally->locationData[i].mapSec; } -static mapsec_t MatchCall_GetMapSec_Rival(match_call_t matchCall) +static mapsec_u8_t MatchCall_GetMapSec_Rival(match_call_t matchCall) { return MAPSEC_NONE; } -static mapsec_t MatchCall_GetMapSec_Birch(match_call_t matchCall) +static mapsec_u8_t MatchCall_GetMapSec_Birch(match_call_t matchCall) { return MAPSEC_NONE; } diff --git a/src/pokenav_match_call_list.c b/src/pokenav_match_call_list.c index e7aaaa5ee7b6..8f8fc6b4c25a 100755 --- a/src/pokenav_match_call_list.c +++ b/src/pokenav_match_call_list.c @@ -306,7 +306,7 @@ struct PokenavMatchCallEntry *GetMatchCallList(void) return state->matchCallEntries; } -mapsec_min16_t 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 } } -mapsec_t GetMatchTableMapSectionId(int rematchIndex) +mapsec_u8_t GetMatchTableMapSectionId(int rematchIndex) { int mapGroup = gRematchTable[rematchIndex].mapGroup; int mapNum = gRematchTable[rematchIndex].mapNum; diff --git a/src/pokenav_region_map.c b/src/pokenav_region_map.c index cd1114d52e21..5d8e7fb95ae4 100755 --- a/src/pokenav_region_map.c +++ b/src/pokenav_region_map.c @@ -42,7 +42,7 @@ struct Pokenav_RegionMapGfx struct CityMapEntry { - mapsec_min16_t mapSecId; + mapsec_u16_t mapSecId; u16 index; const u32 *tilemap; }; diff --git a/src/region_map.c b/src/region_map.c index 3b6f75e6f175..8375f6e9d993 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -63,7 +63,7 @@ enum { struct MultiNameFlyDest { const u8 *const *name; - mapsec_min16_t 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; - mapsec_min16_t 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 mapsec_min16_t 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(mapsec_min16_t mapSecId); -static mapsec_min16_t CorrectSpecialMapSecId_Internal(mapsec_min16_t mapSecId); -static mapsec_min16_t 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(mapsec_t 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 mapsec_min16_t sRegionMap_SpecialPlaceLocations[][2] = +static const mapsec_u16_t sRegionMap_SpecialPlaceLocations[][2] = { {MAPSEC_UNDERWATER_105, MAPSEC_ROUTE_105}, {MAPSEC_UNDERWATER_124, MAPSEC_ROUTE_124}, @@ -154,7 +154,7 @@ static const mapsec_min16_t sRegionMap_SpecialPlaceLocations[][2] = {MAPSEC_MT_PYRE, MAPSEC_ROUTE_122}, {MAPSEC_SKY_PILLAR, MAPSEC_ROUTE_131}, {MAPSEC_MIRAGE_TOWER, MAPSEC_ROUTE_111}, - {MAPSEC_TRAINER_HILL, MAPSEC_ROUTE_111}, + {mapsec_u8_tRAINER_HILL, MAPSEC_ROUTE_111}, {MAPSEC_DESERT_UNDERPASS, MAPSEC_ROUTE_114}, {MAPSEC_ALTERING_CAVE, MAPSEC_ROUTE_103}, {MAPSEC_ARTISAN_CAVE, MAPSEC_ROUTE_103}, @@ -162,14 +162,14 @@ static const mapsec_min16_t sRegionMap_SpecialPlaceLocations[][2] = {MAPSEC_NONE, MAPSEC_NONE} }; -static const mapsec_min16_t sMarineCaveMapSecIds[] = +static const mapsec_u16_t sMarineCaveMapSecIds[] = { MAPSEC_MARINE_CAVE, MAPSEC_UNDERWATER_MARINE_CAVE, MAPSEC_UNDERWATER_MARINE_CAVE }; -static const mapsec_min16_t 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 mapsec_t 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 mapsec_t 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 mapsec_min16_t 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) { - mapsec_min16_t 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; - mapsec_min16_t 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 mapsec_min16_t 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(mapsec_min16_t mapSecId) +static u8 GetMapsecType(mapsec_u16_t mapSecId) { switch (mapSecId) { @@ -1219,12 +1219,12 @@ static u8 GetMapsecType(mapsec_min16_t mapSecId) } } -mapsec_min16_t GetRegionMapSecIdAt(u16 x, u16 y) +mapsec_u16_t GetRegionMapSecIdAt(u16 x, u16 y) { return GetMapSecIdAt(x, y); } -static mapsec_min16_t CorrectSpecialMapSecId_Internal(mapsec_min16_t mapSecId) +static mapsec_u16_t CorrectSpecialMapSecId_Internal(mapsec_u16_t mapSecId) { u32 i; @@ -1245,7 +1245,7 @@ static mapsec_min16_t CorrectSpecialMapSecId_Internal(mapsec_min16_t mapSecId) return mapSecId; } -static mapsec_min16_t 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(mapsec_t mapSecId) +static bool32 IsPlayerInAquaHideout(mapsec_u8_t mapSecId) { u32 i; @@ -1286,7 +1286,7 @@ static bool32 IsPlayerInAquaHideout(mapsec_t mapSecId) return FALSE; } -mapsec_min16_t CorrectSpecialMapSecId(mapsec_min16_t 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, mapsec_min16_t 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, mapsec_min16_t regionMapId, u16 padLength) } // TODO: probably needs a better name -u8 *GetMapNameGeneric(u8 *dest, mapsec_min16_t mapSecId) +u8 *GetMapNameGeneric(u8 *dest, mapsec_u16_t mapSecId) { switch (mapSecId) { @@ -1611,7 +1611,7 @@ u8 *GetMapNameGeneric(u8 *dest, mapsec_min16_t mapSecId) } } -u8 *GetMapNameHandleAquaHideout(u8 *dest, mapsec_min16_t 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, mapsec_min16_t mapSecId) return GetMapNameGeneric(dest, mapSecId); } -static void GetMapSecDimensions(mapsec_min16_t 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(mapsec_t mapSecId) +bool32 IsEventIslandMapSecId(mapsec_u8_t mapSecId) { u32 i; @@ -1763,7 +1763,7 @@ static void DrawFlyDestTextWindow(void) bool32 namePrinted; const u8 *name; - if (sFlyMap->regionMap.mapSecType > MAPSECTYPE_NONE && sFlyMap->regionMap.mapSecType < NUM_MAPSEC_TYPES) + if (sFlyMap->regionMap.mapSecType > MAPSECTYPE_NONE && sFlyMap->regionMap.mapSecType < NUM_mapsec_u8_tYPES) { namePrinted = FALSE; for (i = 0; i < ARRAY_COUNT(sMultiNameFlyDestinations); i++) @@ -1839,7 +1839,7 @@ static void LoadFlyDestIcons(void) static void CreateFlyDestIcons(void) { u16 canFlyFlag; - mapsec_min16_t 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; - mapsec_min16_t mapSecId; + mapsec_u16_t mapSecId; u8 spriteId; for (i = 0; sRedOutlineFlyDestinations[i][1] != MAPSEC_NONE; i++) diff --git a/src/trade.c b/src/trade.c index 200a64c819e8..1476276d2e25 100644 --- a/src/trade.c +++ b/src/trade.c @@ -4553,7 +4553,7 @@ static void CreateInGameTradePokemonInternal(u8 whichPlayerMon, u8 whichInGameTr u8 level = GetMonData(&gPlayerParty[whichPlayerMon], MON_DATA_LEVEL); struct Mail mail; - metloc_t metLocation = METLOC_IN_GAME_TRADE; + metloc_u8_t metLocation = METLOC_IN_GAME_TRADE; u8 mailNum; struct Pokemon *pokemon = &gEnemyParty[0]; From ed1c954bf7c0ef860a878e21cadcd89bd182214b Mon Sep 17 00:00:00 2001 From: DavidJCobb <831497+DavidJCobb@users.noreply.github.com> Date: Thu, 25 Sep 2025 18:40:01 -0400 Subject: [PATCH 4/8] Fixes for last commit re: mapsec/metloc typedefs Had Notepad++ set to case-insensitive to find mapsec values. Forgot to set it back to case-sensitive before find-and-replacing the typedef names in the last commit... --- src/map_name_popup.c | 4 ++-- src/pokedex_area_screen.c | 2 +- src/region_map.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/map_name_popup.c b/src/map_name_popup.c index dc7cb6d1ca5d..ae6d702dd0cc 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -171,14 +171,14 @@ static const u8 sMapSectionToThemeId[MAPSEC_COUNT - KANTO_MAPSEC_COUNT - 1] = [MAPSEC_ARTISAN_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_MARINE_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_UNDERWATER_MARINE_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2, - [mapsec_u8_tERRA_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, + [MAPSEC_TERRA_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_UNDERWATER_105 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2, [MAPSEC_UNDERWATER_125 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2, [MAPSEC_UNDERWATER_129 - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE2, [MAPSEC_DESERT_UNDERPASS - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_ALTERING_CAVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, [MAPSEC_NAVEL_ROCK - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_STONE, - [mapsec_u8_tRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE, + [MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE, }; static const u8 sText_PyramidFloor1[] = _("PYRAMID FLOOR 1"); diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index 59332117ed12..bbaaf4d49478 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -117,7 +117,7 @@ static const mapsec_u16_t sMovingRegionMapSections[3] = { MAPSEC_MARINE_CAVE, MAPSEC_UNDERWATER_MARINE_CAVE, - mapsec_u8_tERRA_CAVE + MAPSEC_TERRA_CAVE }; static const u16 sFeebasData[][3] = diff --git a/src/region_map.c b/src/region_map.c index 8375f6e9d993..88a93bc8414f 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -154,7 +154,7 @@ static const mapsec_u16_t sRegionMap_SpecialPlaceLocations[][2] = {MAPSEC_MT_PYRE, MAPSEC_ROUTE_122}, {MAPSEC_SKY_PILLAR, MAPSEC_ROUTE_131}, {MAPSEC_MIRAGE_TOWER, MAPSEC_ROUTE_111}, - {mapsec_u8_tRAINER_HILL, MAPSEC_ROUTE_111}, + {MAPSEC_TRAINER_HILL, MAPSEC_ROUTE_111}, {MAPSEC_DESERT_UNDERPASS, MAPSEC_ROUTE_114}, {MAPSEC_ALTERING_CAVE, MAPSEC_ROUTE_103}, {MAPSEC_ARTISAN_CAVE, MAPSEC_ROUTE_103}, From fc9fd2fb7e4c523ef1dc5dba305b2d1dbf13eea2 Mon Sep 17 00:00:00 2001 From: DavidJCobb <831497+DavidJCobb@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:16:05 -0400 Subject: [PATCH 5/8] Changes/fixes per maintainer feedback Changed `mapsec_int_t` to `mapsec_s32_t` per maintainer feedback. Fixed a bad (case-insensitive) find-and-replace that had incorrectly damaged the identifier `NUM_MAPSEC_TYPES`. Converted SET_BY_WIDTH, used in SetMonData and SetBoxMonData, to a do-while-style macro. Stripped braces from its inner single-statement ifs to match the repo's overall coding style. --- include/gametypes.h | 2 +- include/region_map.h | 2 +- src/pokemon.c | 15 ++++++++------- src/pokenav_match_call_gfx.c | 2 +- src/pokenav_region_map.c | 8 ++++---- src/region_map.c | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/gametypes.h b/include/gametypes.h index 6dcb297fffb4..242fc9d9dbf0 100644 --- a/include/gametypes.h +++ b/include/gametypes.h @@ -52,7 +52,7 @@ typedef u8 mapsec_u8_t; typedef u16 mapsec_u16_t; typedef s16 mapsec_s16_t; -typedef int mapsec_int_t; +typedef s32 mapsec_s32_t; // Met Locations for caught Pokemon use the same values as Map Sections, // except that 0xFD, 0xFE, and 0xFF have special meanings. diff --git a/include/region_map.h b/include/region_map.h index fbadcc6fca19..a2c60655e025 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -23,7 +23,7 @@ enum { MAPSECTYPE_CITY_CANFLY, MAPSECTYPE_CITY_CANTFLY, MAPSECTYPE_BATTLE_FRONTIER, - NUM_mapsec_u8_tYPES + NUM_MAPSEC_TYPES }; struct RegionMap { diff --git a/src/pokemon.c b/src/pokemon.c index c974c6018d89..7283e0e4566a 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4079,13 +4079,14 @@ u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field) __attribute__((alias("G // anything whose typedef is in gametypes.h). // #define SET_BY_WIDTH(lhs) \ - if (sizeof(lhs) == 1) { \ - SET8(lhs); \ - } else if (sizeof(lhs) == 2) { \ - SET16(lhs); \ - } else if (sizeof(lhs) == 4) { \ - SET32(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) { diff --git a/src/pokenav_match_call_gfx.c b/src/pokenav_match_call_gfx.c index 3f773f94c08f..894d1a90df16 100755 --- a/src/pokenav_match_call_gfx.c +++ b/src/pokenav_match_call_gfx.c @@ -1023,7 +1023,7 @@ static void PrintMatchCallLocation(struct Pokenav_MatchCallGfx *gfx, int delta) u8 mapName[32]; int x; int index = PokenavList_GetSelectedIndex() + delta; - mapsec_int_t mapSec = GetMatchCallMapSec(index); + mapsec_s32_t mapSec = GetMatchCallMapSec(index); if (mapSec != MAPSEC_NONE) GetMapName(mapName, mapSec, 0); else diff --git a/src/pokenav_region_map.c b/src/pokenav_region_map.c index 5d8e7fb95ae4..4daaca362a23 100755 --- a/src/pokenav_region_map.c +++ b/src/pokenav_region_map.c @@ -64,8 +64,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 *, mapsec_int_t, int); -static void PrintLandmarkNames(struct Pokenav_RegionMapGfx *, mapsec_int_t, 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); @@ -635,7 +635,7 @@ static u32 LoopedTask_DecompressCityMaps(s32 taskState) return LT_FINISH; } -static void DrawCityMap(struct Pokenav_RegionMapGfx *state, mapsec_int_t 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++) @@ -648,7 +648,7 @@ static void DrawCityMap(struct Pokenav_RegionMapGfx *state, mapsec_int_t mapSecI CopyToBgTilemapBufferRect(1, state->cityZoomPics[i], 18, 6, 10, 10); } -static void PrintLandmarkNames(struct Pokenav_RegionMapGfx *state, mapsec_int_t mapSecId, int pos) +static void PrintLandmarkNames(struct Pokenav_RegionMapGfx *state, mapsec_s32_t mapSecId, int pos) { int i = 0; while (1) diff --git a/src/region_map.c b/src/region_map.c index 88a93bc8414f..a418b7fe4fbb 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1763,7 +1763,7 @@ static void DrawFlyDestTextWindow(void) bool32 namePrinted; const u8 *name; - if (sFlyMap->regionMap.mapSecType > MAPSECTYPE_NONE && sFlyMap->regionMap.mapSecType < NUM_mapsec_u8_tYPES) + if (sFlyMap->regionMap.mapSecType > MAPSECTYPE_NONE && sFlyMap->regionMap.mapSecType < NUM_MAPSEC_TYPES) { namePrinted = FALSE; for (i = 0; i < ARRAY_COUNT(sMultiNameFlyDestinations); i++) From 06f3feb5412892c9c7b7713d31a6a2fb5e51cfb9 Mon Sep 17 00:00:00 2001 From: DavidJCobb <831497+DavidJCobb@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:24:00 -0400 Subject: [PATCH 6/8] Game types header is now transitively included via global header Per feedback, removed direct includes of the game-types header in favor of transitive includes through global.h, for consistency with the repo's overall status quo. --- include/global.fieldmap.h | 2 -- include/global.h | 1 + include/global.tv.h | 1 - include/landmark.h | 2 -- include/overworld.h | 2 -- include/pokemon.h | 1 - include/pokenav.h | 1 - include/region_map.h | 1 - src/daycare.c | 1 - src/egg_hatch.c | 1 - src/frontier_pass.c | 1 - src/map_name_popup.c | 1 - src/match_call.c | 1 - src/pokedex_area_screen.c | 1 - src/pokemon_summary_screen.c | 1 - src/pokenav_match_call_data.c | 1 - src/pokenav_match_call_gfx.c | 1 - src/pokenav_region_map.c | 1 - src/trade.c | 1 - 19 files changed, 1 insertion(+), 21 deletions(-) diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 3236a82b2790..90f2080d7149 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -1,8 +1,6 @@ #ifndef GUARD_GLOBAL_FIELDMAP_H #define GUARD_GLOBAL_FIELDMAP_H -#include "gametypes.h" - // Masks/shifts for blocks in the map grid // Map grid blocks consist of a 10 bit metatile id, a 2 bit collision value, and a 4 bit elevation value // This is the data stored in each data/layouts/*/map.bin file diff --git a/include/global.h b/include/global.h index f0882710e55e..bdfc426fb93c 100644 --- a/include/global.h +++ b/include/global.h @@ -5,6 +5,7 @@ #include #include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines. #include "gba/gba.h" +#include "gametypes.h" #include "constants/global.h" #include "constants/flags.h" #include "constants/vars.h" diff --git a/include/global.tv.h b/include/global.tv.h index b730d61eac1b..a2721b06b4d2 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -2,7 +2,6 @@ #define GUARD_GLOBAL_TV_H #include "constants/tv.h" -#include "gametypes.h" typedef union // size = 0x24 { diff --git a/include/landmark.h b/include/landmark.h index 95eb84370adb..f5feb407bc02 100644 --- a/include/landmark.h +++ b/include/landmark.h @@ -1,8 +1,6 @@ #ifndef GUARD_LANDMARK_H #define GUARD_LANDMARK_H -#include "gametypes.h" - const u8 *GetLandmarkName(mapsec_u8_t mapSection, u8 id, u8 count); #endif // GUARD_LANDMARK_H diff --git a/include/overworld.h b/include/overworld.h index 5f9924690180..8ac0ddc81e6a 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -1,8 +1,6 @@ #ifndef GUARD_OVERWORLD_H #define GUARD_OVERWORLD_H -#include "gametypes.h" - #define LINK_KEY_CODE_NULL 0x00 #define LINK_KEY_CODE_EMPTY 0x11 #define LINK_KEY_CODE_DPAD_DOWN 0x12 diff --git a/include/pokemon.h b/include/pokemon.h index c1359124df5c..3d75157f91f4 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -1,7 +1,6 @@ #ifndef GUARD_POKEMON_H #define GUARD_POKEMON_H -#include "gametypes.h" #include "sprite.h" // Property labels for Get(Box)MonData / Set(Box)MonData diff --git a/include/pokenav.h b/include/pokenav.h index 9cfb32963ea6..b5488242348b 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -2,7 +2,6 @@ #define GUARD_POKENAV_H #include "bg.h" -#include "gametypes.h" #include "main.h" #include "pokemon_storage_system.h" diff --git a/include/region_map.h b/include/region_map.h index a2c60655e025..abdb44b16ce3 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -2,7 +2,6 @@ #define GUARD_REGION_MAP_H #include "bg.h" -#include "gametypes.h" // Exported type declarations #define MAP_NAME_LENGTH 16 diff --git a/src/daycare.c b/src/daycare.c index 8c311aa33993..eb9a5fdeb0cb 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -2,7 +2,6 @@ #include "pokemon.h" #include "battle.h" #include "daycare.h" -#include "gametypes.h" #include "string_util.h" #include "mail.h" #include "pokemon_storage_system.h" diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 719b9c0d90cc..00a194ea7014 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -1,5 +1,4 @@ #include "global.h" -#include "gametypes.h" #include "pokemon.h" #include "egg_hatch.h" #include "pokedex.h" diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 7d7c61d6b86e..3dc458bb7a56 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -1,5 +1,4 @@ #include "global.h" -#include "gametypes.h" #include "gpu_regs.h" #include "main.h" #include "trainer_card.h" diff --git a/src/map_name_popup.c b/src/map_name_popup.c index ae6d702dd0cc..665cccec3cbc 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -1,5 +1,4 @@ #include "global.h" -#include "gametypes.h" #include "battle_pyramid.h" #include "bg.h" #include "event_data.h" diff --git a/src/match_call.c b/src/match_call.c index c19ee3d71d57..41188f51bbc5 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -7,7 +7,6 @@ #include "event_data.h" #include "event_object_movement.h" #include "field_player_avatar.h" -#include "gametypes.h" #include "main.h" #include "match_call.h" #include "menu.h" diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index bbaaf4d49478..c3211ed45408 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -1,7 +1,6 @@ #include "global.h" #include "bg.h" #include "event_data.h" -#include "gametypes.h" #include "gpu_regs.h" #include "graphics.h" #include "main.h" diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 8190e2b24b1b..0f8ef8e3d16c 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1,5 +1,4 @@ #include "global.h" -#include "gametypes.h" #include "main.h" #include "battle.h" #include "battle_anim.h" diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 2723d7432db9..078d620a71fe 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -2,7 +2,6 @@ #include "battle_setup.h" #include "data.h" #include "event_data.h" -#include "gametypes.h" #include "string_util.h" #include "battle.h" #include "gym_leader_rematch.h" diff --git a/src/pokenav_match_call_gfx.c b/src/pokenav_match_call_gfx.c index 894d1a90df16..dde725d8bd46 100755 --- a/src/pokenav_match_call_gfx.c +++ b/src/pokenav_match_call_gfx.c @@ -3,7 +3,6 @@ #include "data.h" #include "decompress.h" #include "dma3.h" -#include "gametypes.h" #include "international_string_util.h" #include "main.h" #include "match_call.h" diff --git a/src/pokenav_region_map.c b/src/pokenav_region_map.c index 4daaca362a23..8475bbacb8ca 100755 --- a/src/pokenav_region_map.c +++ b/src/pokenav_region_map.c @@ -1,7 +1,6 @@ #include "global.h" #include "bg.h" #include "decompress.h" -#include "gametypes.h" #include "landmark.h" #include "main.h" #include "menu.h" diff --git a/src/trade.c b/src/trade.c index 1476276d2e25..e9c298408730 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1,5 +1,4 @@ #include "global.h" -#include "gametypes.h" #include "malloc.h" #include "battle_anim.h" #include "battle_interface.h" From 1e9d4abccded3d2e602c15297fc31d5640050cfc Mon Sep 17 00:00:00 2001 From: DavidJCobb <831497+DavidJCobb@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:06:55 -0400 Subject: [PATCH 7/8] Repaired identifier damaged by find-and-replace --- src/pokenav_match_call_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 078d620a71fe..31d1a2ec8304 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -611,7 +611,7 @@ static bool32 (*const sMatchCallGetEnabledFuncs[])(match_call_t) = { static mapsec_u8_t (*const sMatchCallGetMapSecFuncs[])(match_call_t) = { MatchCall_GetMapSec_NPC, - MatchCall_Getmapsec_u8_trainer, + MatchCall_GetMapSec_Trainer, MatchCall_GetMapSec_Wally, MatchCall_GetMapSec_Rival, MatchCall_GetMapSec_Birch From da6abb03b9b562e7f972dac08cb9ef5c1f6947d1 Mon Sep 17 00:00:00 2001 From: DavidJCobb <831497+DavidJCobb@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:12:49 -0400 Subject: [PATCH 8/8] Update pokenav_match_call_data.c per last commit --- src/pokenav_match_call_data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 31d1a2ec8304..3f47550f1710 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -118,7 +118,7 @@ static bool32 MatchCall_GetEnabled_Birch(match_call_t); static bool32 MatchCall_GetEnabled_Rival(match_call_t); static mapsec_u8_t MatchCall_GetMapSec_NPC(match_call_t); -static mapsec_u8_t MatchCall_Getmapsec_u8_trainer(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); @@ -796,7 +796,7 @@ static mapsec_u8_t MatchCall_GetMapSec_NPC(match_call_t matchCall) return matchCall.npc->mapSec; } -static mapsec_u8_t MatchCall_Getmapsec_u8_trainer(match_call_t matchCall) +static mapsec_u8_t MatchCall_GetMapSec_Trainer(match_call_t matchCall) { return matchCall.trainer->mapSec; }