Skip to content

Commit

Permalink
Converts a bunch of defines to enums (#6071)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bassoonian authored Jan 21, 2025
1 parent ac9c8ac commit a3ce3a5
Show file tree
Hide file tree
Showing 38 changed files with 396 additions and 387 deletions.
2 changes: 1 addition & 1 deletion include/battle_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void BattleSetup_StartLatiBattle(void);
void BattleSetup_StartLegendaryBattle(void);
void StartGroudonKyogreBattle(void);
void StartRegiBattle(void);
u8 BattleSetup_GetTerrainId(void);
enum BattleTerrain BattleSetup_GetTerrainId(void);
u8 GetWildBattleTransition(void);
u8 GetTrainerBattleTransition(void);
u8 GetSpecialBattleTransition(s32 id);
Expand Down
4 changes: 2 additions & 2 deletions include/battle_tower.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void SetEReaderTrainerGfxId(void);
u16 GetBattleFacilityTrainerGfxId(u16 trainerId);
void PutNewBattleTowerRecord(struct EmeraldBattleTowerRecord *newRecordEm);
u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
u8 GetFrontierOpponentClass(u16 trainerId);
enum TrainerClassID GetFrontierOpponentClass(u16 trainerId);
void GetFrontierTrainerName(u8 *dst, u16 trainerId);
void FillFrontierTrainerParty(u8 monsCount);
void FillFrontierTrainersParties(u8 monsCount);
Expand All @@ -60,7 +60,7 @@ void CalcEmeraldBattleTowerChecksum(struct EmeraldBattleTowerRecord *record);
void CalcRubyBattleTowerChecksum(struct RSBattleTowerRecord *record);
u16 GetCurrentBattleTowerWinStreak(u8 lvlMode, u8 battleMode);
u8 GetEreaderTrainerFrontSpriteId(void);
u8 GetEreaderTrainerClassId(void);
enum TrainerClassID GetEreaderTrainerClassId(void);
void GetEreaderTrainerName(u8 *dst);
void ValidateEReaderTrainer(void);
void ClearEReaderTrainer(struct BattleTowerEReaderTrainer *ereaderTrainer);
Expand Down
52 changes: 27 additions & 25 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,31 +425,33 @@ enum BattleWeather
#define MOVE_EFFECT_CONTINUE 0x8000

// Battle terrain defines for gBattleTerrain.
#define BATTLE_TERRAIN_GRASS 0
#define BATTLE_TERRAIN_LONG_GRASS 1
#define BATTLE_TERRAIN_SAND 2
#define BATTLE_TERRAIN_UNDERWATER 3
#define BATTLE_TERRAIN_WATER 4
#define BATTLE_TERRAIN_POND 5
#define BATTLE_TERRAIN_MOUNTAIN 6
#define BATTLE_TERRAIN_CAVE 7
#define BATTLE_TERRAIN_BUILDING 8
#define BATTLE_TERRAIN_PLAIN 9
// New battle terrains are used for Secret Power but not fully implemented.
#define BATTLE_TERRAIN_SOARING 10
#define BATTLE_TERRAIN_SKY_PILLAR 11
#define BATTLE_TERRAIN_BURIAL_GROUND 12
#define BATTLE_TERRAIN_PUDDLE 13
#define BATTLE_TERRAIN_MARSH 14
#define BATTLE_TERRAIN_SWAMP 15
#define BATTLE_TERRAIN_SNOW 16
#define BATTLE_TERRAIN_ICE 17
#define BATTLE_TERRAIN_VOLCANO 18
#define BATTLE_TERRAIN_DISTORTION_WORLD 19
#define BATTLE_TERRAIN_SPACE 20
#define BATTLE_TERRAIN_ULTRA_SPACE 21

#define BATTLE_TERRAIN_COUNT 22
enum BattleTerrain
{
BATTLE_TERRAIN_GRASS,
BATTLE_TERRAIN_LONG_GRASS,
BATTLE_TERRAIN_SAND,
BATTLE_TERRAIN_UNDERWATER,
BATTLE_TERRAIN_WATER,
BATTLE_TERRAIN_POND,
BATTLE_TERRAIN_MOUNTAIN,
BATTLE_TERRAIN_CAVE,
BATTLE_TERRAIN_BUILDING,
BATTLE_TERRAIN_PLAIN,
// New battle terrains are used for Secret Power but not fully implemented.
BATTLE_TERRAIN_SOARING,
BATTLE_TERRAIN_SKY_PILLAR,
BATTLE_TERRAIN_BURIAL_GROUND,
BATTLE_TERRAIN_PUDDLE,
BATTLE_TERRAIN_MARSH,
BATTLE_TERRAIN_SWAMP,
BATTLE_TERRAIN_SNOW,
BATTLE_TERRAIN_ICE,
BATTLE_TERRAIN_VOLCANO,
BATTLE_TERRAIN_DISTORTION_WORLD,
BATTLE_TERRAIN_SPACE,
BATTLE_TERRAIN_ULTRA_SPACE,
BATTLE_TERRAIN_COUNT,
};

#define B_WAIT_TIME_LONG (B_WAIT_TIME_MULTIPLIER * 4)
#define B_WAIT_TIME_MED (B_WAIT_TIME_MULTIPLIER * 3)
Expand Down
44 changes: 25 additions & 19 deletions include/constants/map_types.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
#ifndef GUARD_CONSTANTS_MAP_TYPES_H
#define GUARD_CONSTANTS_MAP_TYPES_H

#define MAP_TYPE_NONE 0
#define MAP_TYPE_TOWN 1
#define MAP_TYPE_CITY 2
#define MAP_TYPE_ROUTE 3
#define MAP_TYPE_UNDERGROUND 4
#define MAP_TYPE_UNDERWATER 5
#define MAP_TYPE_OCEAN_ROUTE 6
#define MAP_TYPE_UNKNOWN 7 // Not used by any map.
#define MAP_TYPE_INDOOR 8
#define MAP_TYPE_SECRET_BASE 9
enum MapType
{
MAP_TYPE_NONE,
MAP_TYPE_TOWN,
MAP_TYPE_CITY,
MAP_TYPE_ROUTE,
MAP_TYPE_UNDERGROUND,
MAP_TYPE_UNDERWATER,
MAP_TYPE_OCEAN_ROUTE,
MAP_TYPE_UNKNOWN, // Not used by any map.
MAP_TYPE_INDOOR,
MAP_TYPE_SECRET_BASE,
};

#define MAP_BATTLE_SCENE_NORMAL 0
#define MAP_BATTLE_SCENE_GYM 1
#define MAP_BATTLE_SCENE_MAGMA 2
#define MAP_BATTLE_SCENE_AQUA 3
#define MAP_BATTLE_SCENE_SIDNEY 4
#define MAP_BATTLE_SCENE_PHOEBE 5
#define MAP_BATTLE_SCENE_GLACIA 6
#define MAP_BATTLE_SCENE_DRAKE 7
#define MAP_BATTLE_SCENE_FRONTIER 8
enum MapBattleScene
{
MAP_BATTLE_SCENE_NORMAL,
MAP_BATTLE_SCENE_GYM,
MAP_BATTLE_SCENE_MAGMA,
MAP_BATTLE_SCENE_AQUA,
MAP_BATTLE_SCENE_SIDNEY,
MAP_BATTLE_SCENE_PHOEBE,
MAP_BATTLE_SCENE_GLACIA,
MAP_BATTLE_SCENE_DRAKE,
MAP_BATTLE_SCENE_FRONTIER,
};

#endif // GUARD_CONSTANTS_MAP_TYPES_H
11 changes: 7 additions & 4 deletions include/constants/trade.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
#define TRADE_PARTNER 1

// In-game Trade IDs
#define INGAME_TRADE_SEEDOT 0
#define INGAME_TRADE_PLUSLE 1
#define INGAME_TRADE_HORSEA 2
#define INGAME_TRADE_MEOWTH 3
enum InGameTradeID
{
INGAME_TRADE_SEEDOT,
INGAME_TRADE_PLUSLE,
INGAME_TRADE_HORSEA,
INGAME_TRADE_MEOWTH,
};

// Return values for CanTradeSelectedMon and CanSpinTradeMon
#define CAN_TRADE_MON 0
Expand Down
137 changes: 70 additions & 67 deletions include/constants/trainers.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,73 +285,76 @@

#define RS_FACILITY_CLASSES_COUNT 0x4D

#define TRAINER_CLASS_PKMN_TRAINER_1 0x0 // Unused
#define TRAINER_CLASS_PKMN_TRAINER_2 0x1 // Unused
#define TRAINER_CLASS_HIKER 0x2
#define TRAINER_CLASS_TEAM_AQUA 0x3
#define TRAINER_CLASS_PKMN_BREEDER 0x4
#define TRAINER_CLASS_COOLTRAINER 0x5
#define TRAINER_CLASS_BIRD_KEEPER 0x6
#define TRAINER_CLASS_COLLECTOR 0x7
#define TRAINER_CLASS_SWIMMER_M 0x8
#define TRAINER_CLASS_TEAM_MAGMA 0x9
#define TRAINER_CLASS_EXPERT 0xa
#define TRAINER_CLASS_AQUA_ADMIN 0xb
#define TRAINER_CLASS_BLACK_BELT 0xc
#define TRAINER_CLASS_AQUA_LEADER 0xd
#define TRAINER_CLASS_HEX_MANIAC 0xe
#define TRAINER_CLASS_AROMA_LADY 0xf
#define TRAINER_CLASS_RUIN_MANIAC 0x10
#define TRAINER_CLASS_INTERVIEWER 0x11
#define TRAINER_CLASS_TUBER_F 0x12
#define TRAINER_CLASS_TUBER_M 0x13
#define TRAINER_CLASS_LADY 0x14
#define TRAINER_CLASS_BEAUTY 0x15
#define TRAINER_CLASS_RICH_BOY 0x16
#define TRAINER_CLASS_POKEMANIAC 0x17
#define TRAINER_CLASS_GUITARIST 0x18
#define TRAINER_CLASS_KINDLER 0x19
#define TRAINER_CLASS_CAMPER 0x1a
#define TRAINER_CLASS_PICNICKER 0x1b
#define TRAINER_CLASS_BUG_MANIAC 0x1c
#define TRAINER_CLASS_PSYCHIC 0x1d
#define TRAINER_CLASS_GENTLEMAN 0x1e
#define TRAINER_CLASS_ELITE_FOUR 0x1f
#define TRAINER_CLASS_LEADER 0x20
#define TRAINER_CLASS_SCHOOL_KID 0x21
#define TRAINER_CLASS_SR_AND_JR 0x22
#define TRAINER_CLASS_WINSTRATE 0x23
#define TRAINER_CLASS_POKEFAN 0x24
#define TRAINER_CLASS_YOUNGSTER 0x25
#define TRAINER_CLASS_CHAMPION 0x26
#define TRAINER_CLASS_FISHERMAN 0x27
#define TRAINER_CLASS_TRIATHLETE 0x28
#define TRAINER_CLASS_DRAGON_TAMER 0x29
#define TRAINER_CLASS_NINJA_BOY 0x2a
#define TRAINER_CLASS_BATTLE_GIRL 0x2b
#define TRAINER_CLASS_PARASOL_LADY 0x2c
#define TRAINER_CLASS_SWIMMER_F 0x2d
#define TRAINER_CLASS_TWINS 0x2e
#define TRAINER_CLASS_SAILOR 0x2f
#define TRAINER_CLASS_COOLTRAINER_2 0x30 // Used for only one trainer.
#define TRAINER_CLASS_MAGMA_ADMIN 0x31
#define TRAINER_CLASS_RIVAL 0x32
#define TRAINER_CLASS_BUG_CATCHER 0x33
#define TRAINER_CLASS_PKMN_RANGER 0x34
#define TRAINER_CLASS_MAGMA_LEADER 0x35
#define TRAINER_CLASS_LASS 0x36
#define TRAINER_CLASS_YOUNG_COUPLE 0x37
#define TRAINER_CLASS_OLD_COUPLE 0x38
#define TRAINER_CLASS_SIS_AND_BRO 0x39
#define TRAINER_CLASS_SALON_MAIDEN 0x3a
#define TRAINER_CLASS_DOME_ACE 0x3b
#define TRAINER_CLASS_PALACE_MAVEN 0x3c
#define TRAINER_CLASS_ARENA_TYCOON 0x3d
#define TRAINER_CLASS_FACTORY_HEAD 0x3e
#define TRAINER_CLASS_PIKE_QUEEN 0x3f
#define TRAINER_CLASS_PYRAMID_KING 0x40
#define TRAINER_CLASS_RS_PROTAG 0x41
#define TRAINER_CLASS_COUNT 0x42
enum TrainerClassID
{
TRAINER_CLASS_PKMN_TRAINER_1, // Unused
TRAINER_CLASS_PKMN_TRAINER_2, // Unused
TRAINER_CLASS_HIKER,
TRAINER_CLASS_TEAM_AQUA,
TRAINER_CLASS_PKMN_BREEDER,
TRAINER_CLASS_COOLTRAINER,
TRAINER_CLASS_BIRD_KEEPER,
TRAINER_CLASS_COLLECTOR,
TRAINER_CLASS_SWIMMER_M,
TRAINER_CLASS_TEAM_MAGMA,
TRAINER_CLASS_EXPERT,
TRAINER_CLASS_AQUA_ADMIN,
TRAINER_CLASS_BLACK_BELT,
TRAINER_CLASS_AQUA_LEADER,
TRAINER_CLASS_HEX_MANIAC,
TRAINER_CLASS_AROMA_LADY,
TRAINER_CLASS_RUIN_MANIAC,
TRAINER_CLASS_INTERVIEWER,
TRAINER_CLASS_TUBER_F,
TRAINER_CLASS_TUBER_M,
TRAINER_CLASS_LADY,
TRAINER_CLASS_BEAUTY,
TRAINER_CLASS_RICH_BOY,
TRAINER_CLASS_POKEMANIAC,
TRAINER_CLASS_GUITARIST,
TRAINER_CLASS_KINDLER,
TRAINER_CLASS_CAMPER,
TRAINER_CLASS_PICNICKER,
TRAINER_CLASS_BUG_MANIAC,
TRAINER_CLASS_PSYCHIC,
TRAINER_CLASS_GENTLEMAN,
TRAINER_CLASS_ELITE_FOUR,
TRAINER_CLASS_LEADER,
TRAINER_CLASS_SCHOOL_KID,
TRAINER_CLASS_SR_AND_JR,
TRAINER_CLASS_WINSTRATE,
TRAINER_CLASS_POKEFAN,
TRAINER_CLASS_YOUNGSTER,
TRAINER_CLASS_CHAMPION,
TRAINER_CLASS_FISHERMAN,
TRAINER_CLASS_TRIATHLETE,
TRAINER_CLASS_DRAGON_TAMER,
TRAINER_CLASS_NINJA_BOY,
TRAINER_CLASS_BATTLE_GIRL,
TRAINER_CLASS_PARASOL_LADY,
TRAINER_CLASS_SWIMMER_F,
TRAINER_CLASS_TWINS,
TRAINER_CLASS_SAILOR,
TRAINER_CLASS_COOLTRAINER_2, // Used for only one trainer.
TRAINER_CLASS_MAGMA_ADMIN,
TRAINER_CLASS_RIVAL,
TRAINER_CLASS_BUG_CATCHER,
TRAINER_CLASS_PKMN_RANGER,
TRAINER_CLASS_MAGMA_LEADER,
TRAINER_CLASS_LASS,
TRAINER_CLASS_YOUNG_COUPLE,
TRAINER_CLASS_OLD_COUPLE,
TRAINER_CLASS_SIS_AND_BRO,
TRAINER_CLASS_SALON_MAIDEN,
TRAINER_CLASS_DOME_ACE,
TRAINER_CLASS_PALACE_MAVEN,
TRAINER_CLASS_ARENA_TYCOON,
TRAINER_CLASS_FACTORY_HEAD,
TRAINER_CLASS_PIKE_QUEEN,
TRAINER_CLASS_PYRAMID_KING,
TRAINER_CLASS_RS_PROTAG,
TRAINER_CLASS_COUNT,
};

#define TRAINER_ENCOUNTER_MUSIC_MALE 0 // standard male encounter music
#define TRAINER_ENCOUNTER_MUSIC_FEMALE 1 // standard female encounter music
Expand Down
2 changes: 1 addition & 1 deletion include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static inline const struct Trainer *GetTrainerStructFromId(u16 trainerId)
return &gTrainers[difficulty][sanitizedTrainerId];
}

static inline const u8 GetTrainerClassFromId(u16 trainerId)
static inline const enum TrainerClassID GetTrainerClassFromId(u16 trainerId)
{
u32 sanitizedTrainerId = SanitizeTrainerId(trainerId);
enum DifficultyLevel difficulty = GetTrainerDifficultyLevel(sanitizedTrainerId);
Expand Down
2 changes: 1 addition & 1 deletion include/frontier_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void ScrollRankingHallRecordsWindow(void);
void ClearRankingHallRecords(void);
void SaveGameFrontier(void);
u8 GetFrontierBrainTrainerPicIndex(void);
u8 GetFrontierBrainTrainerClass(void);
enum TrainerClassID GetFrontierBrainTrainerClass(void);
void CopyFrontierBrainTrainerName(u8 *dst);
bool8 IsFrontierBrainFemale(void);
void SetFrontierBrainObjEventGfx_2(void);
Expand Down
18 changes: 10 additions & 8 deletions include/overworld.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef GUARD_OVERWORLD_H
#define GUARD_OVERWORLD_H

#include "constants/map_types.h"

#define LINK_KEY_CODE_NULL 0x00
#define LINK_KEY_CODE_EMPTY 0x11
#define LINK_KEY_CODE_DPAD_DOWN 0x12
Expand Down Expand Up @@ -116,16 +118,16 @@ void TryFadeOutOldMapMusic(void);
bool8 BGMusicStopped(void);
void Overworld_FadeOutMapMusic(void);
void UpdateAmbientCry(s16 *state, u16 *delayCounter);
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
u8 GetMapTypeByWarpData(struct WarpData *warp);
u8 GetCurrentMapType(void);
u8 GetLastUsedWarpMapType(void);
bool8 IsMapTypeOutdoors(u8 mapType);
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType);
bool8 IsMapTypeIndoors(u8 mapType);
enum MapType GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
enum MapType GetMapTypeByWarpData(struct WarpData *warp);
enum MapType GetCurrentMapType(void);
enum MapType GetLastUsedWarpMapType(void);
bool8 IsMapTypeOutdoors(enum MapType mapType);
bool8 Overworld_MapTypeAllowsTeleportAndFly(enum MapType mapType);
bool8 IsMapTypeIndoors(enum MapType mapType);
u8 GetSavedWarpRegionMapSectionId(void);
u8 GetCurrentRegionMapSectionId(void);
u8 GetCurrentMapBattleScene(void);
enum MapBattleScene GetCurrentMapBattleScene(void);
void CleanupOverworldWindowsAndTilemaps(void);
bool32 IsOverworldLinkActive(void);
void CB1_Overworld(void);
Expand Down
11 changes: 6 additions & 5 deletions include/pokemon.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#ifndef GUARD_POKEMON_H
#define GUARD_POKEMON_H

#include "contest_effect.h"
#include "sprite.h"
#include "constants/items.h"
#include "constants/region_map_sections.h"
#include "constants/map_groups.h"
#include "contest_effect.h"
#include "constants/region_map_sections.h"
#include "constants/trainers.h"

#define GET_BASE_SPECIES_ID(speciesId) (GetFormSpeciesId(speciesId, 0))
#define FORM_SPECIES_END (0xffff)
Expand Down Expand Up @@ -609,7 +610,7 @@ extern struct SpriteTemplate gMultiuseSpriteTemplate;
extern u16 gFollowerSteps;

extern const u8 gFacilityClassToPicIndex[];
extern const u8 gFacilityClassToTrainerClass[];
extern const enum TrainerClassID gFacilityClassToTrainerClass[];
extern const struct SpeciesInfo gSpeciesInfo[];
extern const u32 gExperienceTables[][MAX_LEVEL + 1];
extern const u8 gPPUpGetMask[];
Expand Down Expand Up @@ -641,7 +642,7 @@ void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level,
void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest);
bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId);
u16 GetUnionRoomTrainerPic(void);
u16 GetUnionRoomTrainerClass(void);
enum TrainerClassID GetUnionRoomTrainerClass(void);
void CreateEnemyEventMon(void);
void CalculateMonStats(struct Pokemon *mon);
void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest);
Expand Down Expand Up @@ -694,7 +695,7 @@ u16 GetAbilityBySpecies(u16 species, u8 abilityNum);
u16 GetMonAbility(struct Pokemon *mon);
void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord);
u8 GetSecretBaseTrainerPicIndex(void);
u8 GetSecretBaseTrainerClass(void);
enum TrainerClassID GetSecretBaseTrainerClass(void);
bool8 IsPlayerPartyAndPokemonStorageFull(void);
bool8 IsPokemonStorageFull(void);
const u8 *GetSpeciesName(u16 species);
Expand Down
Loading

0 comments on commit a3ce3a5

Please sign in to comment.