Converts more defines to enums and name unnamed enums (#7071)

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
Bassoonian 2025-06-18 14:30:37 +02:00 committed by GitHub
parent 340d815c6d
commit 6333702461
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 116 additions and 99 deletions

View File

@ -314,7 +314,8 @@ Cry_Pecharunt::
Then we add the cry ID to [include/constants/cries.h](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/constants/cries.h):
```diff
enum {
enum PokemonCry
{
CRY_NONE,
...
#if P_FAMILY_TERAPAGOS
@ -371,7 +372,8 @@ Edit [include/constants/pokedex.h](https://github.com/rh-hideout/pokeemerald-exp
```diff
// National Pokedex order
enum {
enum NationalDexOrder
{
NATIONAL_DEX_NONE,
// Kanto
NATIONAL_DEX_BULBASAUR,
@ -394,7 +396,8 @@ Do keep in mind that if you intend to add your new species to the Hoenn Dex, you
```diff
// Hoenn Pokedex order
enum {
enum HoennDexOrder
{
HOENN_DEX_NONE,
HOENN_DEX_TREECKO,
...

View File

@ -755,7 +755,7 @@ struct BattleStruct
u8 supremeOverlordCounter[MAX_BATTLERS_COUNT];
u8 shellSideArmCategory[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT];
u8 speedTieBreaks; // MAX_BATTLERS_COUNT! values.
u8 categoryOverride; // for Z-Moves and Max Moves
enum DamageCategory categoryOverride:8; // for Z-Moves and Max Moves
u16 commanderActive[MAX_BATTLERS_COUNT];
u32 stellarBoostFlags[NUM_BATTLE_SIDES]; // stored as a bitfield of flags for all types for each side
u8 monCausingSleepClause[NUM_BATTLE_SIDES]; // Stores which pokemon on a given side is causing Sleep Clause to be active as the mon's index in the party

View File

@ -128,7 +128,7 @@ u32 CountNegativeStatStages(u32 battlerId);
// move checks
bool32 IsAffectedByPowder(u32 battler, u32 ability, enum ItemHoldEffect holdEffect);
bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, u32 category);
bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, enum DamageCategory category);
s32 AI_WhichMoveBetter(u32 move1, u32 move2, u32 battlerAtk, u32 battlerDef, s32 noOfHitsToKo);
struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 move, u32 battlerAtk, u32 battlerDef, uq4_12_t *typeEffectiveness, enum AIConsiderGimmick considerGimmickAtk, enum AIConsiderGimmick considerGimmickDef);
struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, uq4_12_t *typeEffectiveness, enum AIConsiderGimmick considerGimmickAtk, enum AIConsiderGimmick considerGimmickDef, u32 weather);
@ -141,8 +141,8 @@ uq4_12_t AI_GetMoveEffectiveness(u32 move, u32 battlerAtk, u32 battlerDef);
u16 *GetMovesArray(u32 battler);
bool32 IsConfusionMoveEffect(enum BattleMoveEffects moveEffect);
bool32 HasMove(u32 battlerId, u32 move);
bool32 HasOnlyMovesWithCategory(u32 battlerId, u32 category, bool32 onlyOffensive);
bool32 HasMoveWithCategory(u32 battler, u32 category);
bool32 HasOnlyMovesWithCategory(u32 battlerId, enum DamageCategory category, bool32 onlyOffensive);
bool32 HasMoveWithCategory(u32 battler, enum DamageCategory category);
bool32 HasMoveWithType(u32 battler, u32 type);
bool32 HasMoveWithEffect(u32 battlerId, enum BattleMoveEffects moveEffect);
bool32 HasBattlerSideMoveWithEffect(u32 battler, u32 effect);
@ -233,8 +233,8 @@ struct BattlePokemon *AllocSaveBattleMons(void);
void FreeRestoreBattleMons(struct BattlePokemon *savedBattleMons);
s32 CountUsablePartyMons(u32 battlerId);
bool32 IsPartyFullyHealedExceptBattler(u32 battler);
bool32 PartyHasMoveCategory(u32 battlerId, u32 category);
bool32 SideHasMoveCategory(u32 battlerId, u32 category);
bool32 PartyHasMoveCategory(u32 battlerId, enum DamageCategory category);
bool32 SideHasMoveCategory(u32 battlerId, enum DamageCategory category);
// score increases
u32 IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, enum StatChange statId);

View File

@ -309,7 +309,7 @@ void ClearIllusionMon(u32 battler);
u32 GetIllusionMonPartyId(struct Pokemon *party, struct Pokemon *mon, struct Pokemon *partnerMon);
bool32 SetIllusionMon(struct Pokemon *mon, u32 battler);
bool32 ShouldGetStatBadgeBoost(u16 flagId, u32 battler);
u32 GetBattleMoveCategory(u32 move);
enum DamageCategory GetBattleMoveCategory(u32 move);
void SetDynamicMoveCategory(u32 battlerAtk, u32 battlerDef, u32 move);
bool32 CanFling(u32 battler);
bool32 IsTelekinesisBannedSpecies(u16 species);
@ -317,7 +317,7 @@ bool32 IsHealBlockPreventingMove(u32 battler, u32 move);
bool32 IsBelchPreventingMove(u32 battler, u32 move);
bool32 HasEnoughHpToEatBerry(u32 battler, u32 hpFraction, u32 itemId);
bool32 IsPartnerMonFromSameTrainer(u32 battler);
u8 GetCategoryBasedOnStats(u32 battler);
enum DamageCategory GetCategoryBasedOnStats(u32 battler);
void SetShellSideArmCategory(void);
bool32 MoveIsAffectedBySheerForce(u32 move);
bool32 TestIfSheerForceAffected(u32 battler, u16 move);

View File

@ -1,7 +1,8 @@
#ifndef GUARD_CONSTANTS_CRIES_H
#define GUARD_CONSTANTS_CRIES_H
enum {
enum PokemonCry
{
CRY_NONE,
#if P_FAMILY_BULBASAUR
CRY_BULBASAUR,

View File

@ -3,7 +3,8 @@
// National Pokédex order
// These constants are NOT disabled by P_GEN_X_POKEMON to keep pokedex_orders.h clean.
enum {
enum NationalDexOrder
{
NATIONAL_DEX_NONE,
// Kanto
NATIONAL_DEX_BULBASAUR,
@ -1063,7 +1064,8 @@ enum {
#define POKEMON_SLOTS_NUMBER (NATIONAL_DEX_COUNT + 1)
// Hoenn Pokédex order
enum {
enum HoennDexOrder
{
HOENN_DEX_NONE,
HOENN_DEX_TREECKO,
HOENN_DEX_GROVYLE,

View File

@ -218,29 +218,38 @@
#define EV_ITEM_RAISE_LIMIT ((I_VITAMIN_EV_CAP >= GEN_8) ? MAX_PER_STAT_EVS : 100)
// Move category defines.
#define DAMAGE_CATEGORY_PHYSICAL 0
#define DAMAGE_CATEGORY_SPECIAL 1
#define DAMAGE_CATEGORY_STATUS 2
enum DamageCategory
{
DAMAGE_CATEGORY_PHYSICAL,
DAMAGE_CATEGORY_SPECIAL,
DAMAGE_CATEGORY_STATUS
};
// Growth rates
#define GROWTH_MEDIUM_FAST 0
#define GROWTH_ERRATIC 1
#define GROWTH_FLUCTUATING 2
#define GROWTH_MEDIUM_SLOW 3
#define GROWTH_FAST 4
#define GROWTH_SLOW 5
enum GrowthRate
{
GROWTH_MEDIUM_FAST,
GROWTH_ERRATIC,
GROWTH_FLUCTUATING,
GROWTH_MEDIUM_SLOW,
GROWTH_FAST,
GROWTH_SLOW,
};
// Body colors for Pokédex search
#define BODY_COLOR_RED 0
#define BODY_COLOR_BLUE 1
#define BODY_COLOR_YELLOW 2
#define BODY_COLOR_GREEN 3
#define BODY_COLOR_BLACK 4
#define BODY_COLOR_BROWN 5
#define BODY_COLOR_PURPLE 6
#define BODY_COLOR_GRAY 7
#define BODY_COLOR_WHITE 8
#define BODY_COLOR_PINK 9
enum BodyColor
{
BODY_COLOR_RED,
BODY_COLOR_BLUE,
BODY_COLOR_YELLOW,
BODY_COLOR_GREEN,
BODY_COLOR_BLACK,
BODY_COLOR_BROWN,
BODY_COLOR_PURPLE,
BODY_COLOR_GRAY,
BODY_COLOR_WHITE,
BODY_COLOR_PINK,
};
#define F_SUMMARY_SCREEN_FLIP_SPRITE 0x80

View File

@ -69,7 +69,7 @@ struct MoveInfo
const u8 *description;
u16 effect;
u16 type:5; // Up to 32
u16 category:2;
enum DamageCategory category:2;
u16 power:9; // up to 511
// end of word
u16 accuracy:7;
@ -200,7 +200,7 @@ static inline u32 GetMoveType(u32 moveId)
return gMovesInfo[SanitizeMoveId(moveId)].type;
}
static inline u32 GetMoveCategory(u32 moveId)
static inline enum DamageCategory GetMoveCategory(u32 moveId)
{
return gMovesInfo[SanitizeMoveId(moveId)].category;
}

View File

@ -8,9 +8,9 @@ void ResetPokedex(void);
u16 GetNationalPokedexCount(u8 caseID);
u16 GetHoennPokedexCount(u8 caseID);
u8 DisplayCaughtMonDexPage(u16 species, bool32 isShiny, u32 personality);
s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID);
s8 GetSetPokedexFlag(enum NationalDexOrder nationalDexNo, u8 caseID);
void DrawFootprint(u8 windowId, u16 species);
u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot);
u16 CreateMonSpriteFromNationalDexNumber(enum NationalDexOrder nationalNum, s16 x, s16 y, u16 paletteSlot);
bool16 HasAllHoennMons(void);
void ResetPokedexScrollPositions(void);
bool16 HasAllMons(void);

View File

@ -4,6 +4,7 @@
#include "contest_effect.h"
#include "sprite.h"
#include "constants/battle.h"
#include "constants/cries.h"
#include "constants/form_change_types.h"
#include "constants/items.h"
#include "constants/map_groups.h"
@ -431,8 +432,8 @@ struct SpeciesInfo /*0xC4*/
// Pokédex data
u8 categoryName[13];
u8 speciesName[POKEMON_NAME_LENGTH + 1];
u16 cryId;
u16 natDexNum;
enum PokemonCry cryId:16;
enum NationalDexOrder natDexNum:16;
u16 height; //in decimeters
u16 weight; //in hectograms
u16 pokemonScale;
@ -440,7 +441,7 @@ struct SpeciesInfo /*0xC4*/
u16 trainerScale;
u16 trainerOffset;
const u8 *description;
u8 bodyColor:7;
enum BodyColor bodyColor:7;
// Graphical Data
u8 noFlip:1;
u8 frontAnimDelay;
@ -789,11 +790,11 @@ u32 GetGMaxTargetSpecies(u32 species);
bool32 DoesMonMeetAdditionalConditions(struct Pokemon *mon, const struct EvolutionParam *params, struct Pokemon *tradePartner, u32 partyId, bool32 *canStopEvo, enum EvoState evoState);
u32 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 evolutionItem, struct Pokemon *tradePartner, bool32 *canStopEvo, enum EvoState evoState);
bool8 IsMonPastEvolutionLevel(struct Pokemon *mon);
u16 NationalPokedexNumToSpecies(u16 nationalNum);
u16 NationalToHoennOrder(u16 nationalNum);
u16 SpeciesToNationalPokedexNum(u16 species);
u16 SpeciesToHoennPokedexNum(u16 species);
u16 HoennToNationalOrder(u16 hoennNum);
u16 NationalPokedexNumToSpecies(enum NationalDexOrder nationalNum);
enum HoennDexOrder NationalToHoennOrder(enum NationalDexOrder nationalNum);
enum NationalDexOrder SpeciesToNationalPokedexNum(u16 species);
enum HoennDexOrder SpeciesToHoennPokedexNum(u16 species);
enum NationalDexOrder HoennToNationalOrder(enum HoennDexOrder hoennNum);
void DrawSpindaSpots(u32 personality, u8 *dest, bool32 isSecondFrame);
void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
u8 GetPlayerFlankId(void);
@ -843,7 +844,7 @@ void BattleAnimateBackSprite(struct Sprite *sprite, u16 species);
u8 GetOpposingLinkMultiBattlerId(bool8 rightSide, u8 multiplayerId);
u16 FacilityClassToPicIndex(u16 facilityClass);
u16 PlayerGenderToFrontTrainerPicId(u8 playerGender);
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
void HandleSetPokedexFlag(enum NationalDexOrder nationalNum, u8 caseId, u32 personality);
bool8 HasTwoFramesAnimation(u16 species);
struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode);
void DestroyMonSpritesGfxManager(u8 managerId);
@ -865,7 +866,7 @@ void UpdateMonPersonality(struct BoxPokemon *boxMon, u32 personality);
u8 CalculatePartyCount(struct Pokemon *party);
u16 SanitizeSpeciesId(u16 species);
bool32 IsSpeciesEnabled(u16 species);
u16 GetCryIdBySpecies(u16 species);
enum PokemonCry GetCryIdBySpecies(u16 species);
u16 GetSpeciesPreEvolution(u16 species);
void HealPokemon(struct Pokemon *mon);
void HealBoxPokemon(struct BoxPokemon *boxMon);

View File

@ -421,7 +421,7 @@ bool32 IsAffectedByPowder(u32 battler, u32 ability, enum ItemHoldEffect holdEffe
// This function checks if all physical/special moves are either unusable or unreasonable to use.
// Consider a pokemon boosting their attack against a ghost pokemon having only normal-type physical attacks.
bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, u32 category)
bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, enum DamageCategory category)
{
u32 usable = 0;
u16 *moves = GetMovesArray(attacker);
@ -2124,7 +2124,7 @@ u16 *GetMovesArray(u32 battler)
return gBattleHistory->usedMoves[battler];
}
bool32 HasOnlyMovesWithCategory(u32 battlerId, u32 category, bool32 onlyOffensive)
bool32 HasOnlyMovesWithCategory(u32 battlerId, enum DamageCategory category, bool32 onlyOffensive)
{
u32 i;
u16 *moves = GetMovesArray(battlerId);
@ -2140,7 +2140,7 @@ bool32 HasOnlyMovesWithCategory(u32 battlerId, u32 category, bool32 onlyOffensiv
return TRUE;
}
bool32 HasMoveWithCategory(u32 battler, u32 category)
bool32 HasMoveWithCategory(u32 battler, enum DamageCategory category)
{
u32 i;
u16 *moves = GetMovesArray(battler);
@ -3952,7 +3952,7 @@ bool32 IsPartyFullyHealedExceptBattler(u32 battlerId)
return TRUE;
}
bool32 PartyHasMoveCategory(u32 battlerId, u32 category)
bool32 PartyHasMoveCategory(u32 battlerId, enum DamageCategory category)
{
struct Pokemon *party = GetBattlerParty(battlerId);
u32 i, j;
@ -3979,7 +3979,7 @@ bool32 PartyHasMoveCategory(u32 battlerId, u32 category)
return FALSE;
}
bool32 SideHasMoveCategory(u32 battlerId, u32 category)
bool32 SideHasMoveCategory(u32 battlerId, enum DamageCategory category)
{
if (IsDoubleBattle())
{

View File

@ -5055,7 +5055,7 @@ static void Cmd_getexp(void)
if (B_EXP_CAP_TYPE == EXP_CAP_HARD && gBattleStruct->battlerExpReward != 0)
{
u32 growthRate = gSpeciesInfo[GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPECIES)].growthRate;
enum GrowthRate growthRate = gSpeciesInfo[GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPECIES)].growthRate;
u32 currentExp = GetMonData(&gPlayerParty[*expMonId], MON_DATA_EXP);
u32 levelCap = GetCurrentLevelCap();

View File

@ -6007,7 +6007,7 @@ static enum ItemEffect TrySetEnigmaBerry(u32 battler)
return ITEM_NO_EFFECT;
}
static enum ItemEffect DamagedStatBoostBerryEffect(u32 battler, u8 statId, u8 category)
static enum ItemEffect DamagedStatBoostBerryEffect(u32 battler, u8 statId, enum DamageCategory category)
{
if (IsBattlerAlive(battler)
&& CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN)
@ -10347,7 +10347,7 @@ bool32 ShouldGetStatBadgeBoost(u16 badgeFlag, u32 battler)
return FALSE;
}
static u32 SwapMoveDamageCategory(u32 move)
static enum DamageCategory SwapMoveDamageCategory(u32 move)
{
if (GetMoveCategory(move) == DAMAGE_CATEGORY_PHYSICAL)
return DAMAGE_CATEGORY_SPECIAL;
@ -10359,7 +10359,7 @@ static u32 SwapMoveDamageCategory(u32 move)
can be removed but a lot of function arguments (battlerAtk and battlerDef) have to be added for this, about 50+.
This is potentially a good change because it is less likely to cause bugs in the future.
*/
u32 GetBattleMoveCategory(u32 move)
enum DamageCategory GetBattleMoveCategory(u32 move)
{
if (gMain.inBattle)
{
@ -10449,7 +10449,7 @@ static bool32 IsUnnerveAbilityOnOpposingSide(u32 battler)
}
// Photon Geyser, Light That Burns the Sky, Tera Blast
u8 GetCategoryBasedOnStats(u32 battler)
enum DamageCategory GetCategoryBasedOnStats(u32 battler)
{
u32 attack = gBattleMons[battler].attack;
u32 spAttack = gBattleMons[battler].spAttack;

View File

@ -964,7 +964,8 @@ static void Task_ShowWinnerMonBanner(u8 taskId)
static void Task_SetSeenWinnerMon(u8 taskId)
{
int i, nationalDexNum;
int i;
enum NationalDexOrder nationalDexNum;
if (JOY_NEW(A_BUTTON))
{

View File

@ -1542,7 +1542,7 @@ static void SpriteCB_CreditsMonBg(struct Sprite *sprite)
static void DeterminePokemonToShow(void)
{
u16 starter = SpeciesToNationalPokedexNum(GetStarterPokemon(VarGet(VAR_STARTER_MON)));
enum NationalDexOrder starter = SpeciesToNationalPokedexNum(GetStarterPokemon(VarGet(VAR_STARTER_MON)));
u16 page;
u16 dexNum;
u16 j;

View File

@ -3677,7 +3677,7 @@ static void DebugAction_Give_Pokemon_Move(u8 taskId)
static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://github.com/ghoulslash/pokeemerald/tree/custom-givemon
{
u16 nationalDexNum;
enum NationalDexOrder nationalDexNum;
int sentToPc;
struct Pokemon mon;
u8 i;

View File

@ -1909,7 +1909,7 @@ static void DexNavFadeAndExit(void)
static bool8 SpeciesInArray(u16 species, u8 section)
{
u32 i;
u16 dexNum = SpeciesToNationalPokedexNum(species);
enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(species);
switch (section)
{
@ -2122,7 +2122,7 @@ static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId)
static void PrintCurrentSpeciesInfo(void)
{
u16 species = DexNavGetSpecies();
u16 dexNum = SpeciesToNationalPokedexNum(species);
enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(species);
u8 type1, type2;
if (!GetSetPokedexFlag(dexNum, FLAG_GET_SEEN))

View File

@ -5545,7 +5545,7 @@ static u16 GetRandomUnlockedEasyChatPokemon(void)
numWords = gEasyChatGroups[EC_GROUP_POKEMON].numWords;
for (i = 0; i < numWords; i++)
{
u16 dexNum = SpeciesToNationalPokedexNum(*species);
enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(*species);
if (GetSetPokedexFlag(dexNum, FLAG_GET_SEEN))
{
if (index)

View File

@ -362,7 +362,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
static void AddHatchedMonToParty(u8 id)
{
u8 isEgg = 0x46; // ?
u16 species;
enum NationalDexOrder species;
u8 name[POKEMON_NAME_LENGTH + 1];
u16 metLevel;
u8 metLocation;

View File

@ -340,7 +340,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
if (species != SPECIES_EGG)
{
u16 pokedexNum = SpeciesToNationalPokedexNum(species);
enum NationalDexOrder pokedexNum = SpeciesToNationalPokedexNum(species);
GetSetPokedexFlag(pokedexNum, FLAG_SET_SEEN);
GetSetPokedexFlag(pokedexNum, FLAG_SET_CAUGHT);
}

View File

@ -4044,7 +4044,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
{
u8 spriteId;
u16 species = gTasks[taskId].tSpecies;
u16 dexNum = SpeciesToNationalPokedexNum(species);
enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(species);
switch (gTasks[taskId].tState)
{
@ -4513,7 +4513,7 @@ static u8* ConvertMeasurementToMetricString(u32 num, u32* index)
return string;
}
s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID)
s8 GetSetPokedexFlag(enum NationalDexOrder nationalDexNo, u8 caseID)
{
u32 index, bit, mask;
s8 retVal = 0;
@ -4890,7 +4890,7 @@ static u32 GetPokedexMonPersonality(u16 species)
}
}
u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot)
u16 CreateMonSpriteFromNationalDexNumber(enum NationalDexOrder nationalNum, s16 x, s16 y, u16 paletteSlot)
{
nationalNum = NationalPokedexNumToSpecies(nationalNum);
return CreateMonPicSprite(nationalNum, FALSE, GetPokedexMonPersonality(nationalNum), TRUE, x, y, paletteSlot, TAG_NONE);
@ -4925,7 +4925,7 @@ static u16 CreateSizeScreenTrainerPic(u16 species, s16 x, s16 y, s8 paletteSlot)
return CreateTrainerPicSprite(species, TRUE, x, y, paletteSlot, TAG_NONE);
}
static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 type1, u8 type2)
static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, enum BodyColor bodyColor, u8 type1, u8 type2)
{
u16 species;
u16 i;
@ -5336,7 +5336,7 @@ static void Task_StartPokedexSearch(u8 taskId)
u8 dexMode = GetSearchModeSelection(taskId, SEARCH_MODE);
u8 order = GetSearchModeSelection(taskId, SEARCH_ORDER);
u8 abcGroup = GetSearchModeSelection(taskId, SEARCH_NAME);
u8 bodyColor = GetSearchModeSelection(taskId, SEARCH_COLOR);
enum BodyColor bodyColor = GetSearchModeSelection(taskId, SEARCH_COLOR);
u8 type1 = GetSearchModeSelection(taskId, SEARCH_TYPE_LEFT);
u8 type2 = GetSearchModeSelection(taskId, SEARCH_TYPE_RIGHT);

View File

@ -354,7 +354,7 @@ struct PokemonStats
u8 evYield_Defense;
u8 evYield_SpDefense;
u8 catchRate;
u8 growthRate;
enum GrowthRate growthRate:8;
u8 eggGroup1;
u8 eggGroup2;
u8 eggCycles;
@ -590,7 +590,7 @@ static void Task_SwitchScreensFromFormsScreen(u8 taskId);
static void Task_ExitFormsScreen(u8 taskId);
//Physical/Special/Status category icon
static u8 ShowCategoryIcon(u32 category);
static u8 ShowCategoryIcon(enum DamageCategory category);
static void DestroyCategoryIcon(void);
static u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum);
@ -4090,7 +4090,7 @@ void Task_DisplayCaughtMonDexPageHGSS(u8 taskId)
{
u8 spriteId;
u16 species;
u16 dexNum;
enum NationalDexOrder dexNum;
if (!POKEDEX_PLUS_HGSS) return; // prevents the compiler from emitting static .rodata
// if the feature is disabled
@ -4701,7 +4701,7 @@ static void LoadTilesetTilemapHGSS(u8 page)
}
//Physical/Special/Status category
static u8 ShowCategoryIcon(u32 category)
static u8 ShowCategoryIcon(enum DamageCategory category)
{
if (sPokedexView->categoryIconSpriteId == 0xFF)
sPokedexView->categoryIconSpriteId = CreateSprite(&gSpriteTemplate_CategoryIcons, 139, 90, 0);
@ -5622,7 +5622,7 @@ static void PrintStatsScreen_Left(u8 taskId)
if (gTasks[taskId].data[5] == 0)
{
u32 catchRate = sPokedexView->sPokemonStats.catchRate;
u32 growthRate = sPokedexView->sPokemonStats.growthRate;
enum GrowthRate growthRate = sPokedexView->sPokemonStats.growthRate;
//Catch rate
PrintStatsScreenTextSmall(WIN_STATS_LEFT, sText_Stats_CatchRate, base_x, base_y + base_y_offset*base_i);
@ -6178,8 +6178,8 @@ static void Task_HandleEvolutionScreenInput(u8 taskId)
if (JOY_NEW(A_BUTTON))
{
u16 targetSpecies = sPokedexView->sEvoScreenData.targetSpecies[sPokedexView->sEvoScreenData.menuPos];
u16 dexNum = SpeciesToNationalPokedexNum(targetSpecies);
u16 targetSpecies = sPokedexView->sEvoScreenData.targetSpecies[sPokedexView->sEvoScreenData.menuPos];
enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(targetSpecies);
if (sPokedexView->isSearchResults && sPokedexView->originalSearchSelectionNum == 0)
sPokedexView->originalSearchSelectionNum = sPokedexListItem->dexNum;
@ -7747,7 +7747,7 @@ static void Task_ClosePokedexFromSearchResultsStartMenu(u8 taskId)
//* Search code *
//* *
//************************************
static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 type1, u8 type2)
static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, enum BodyColor bodyColor, u8 type1, u8 type2)
{
u16 species;
u16 i;
@ -8163,7 +8163,7 @@ static void Task_StartPokedexSearch(u8 taskId)
u8 dexMode = GetSearchModeSelection(taskId, SEARCH_MODE);
u8 order = GetSearchModeSelection(taskId, SEARCH_ORDER);
u8 abcGroup = GetSearchModeSelection(taskId, SEARCH_NAME);
u8 bodyColor = GetSearchModeSelection(taskId, SEARCH_COLOR);
enum BodyColor bodyColor = GetSearchModeSelection(taskId, SEARCH_COLOR);
u8 type1 = GetSearchModeSelection(taskId, SEARCH_TYPE_LEFT);
u8 type2 = GetSearchModeSelection(taskId, SEARCH_TYPE_RIGHT);

View File

@ -119,7 +119,7 @@ static const struct CombinedMove sCombinedMoves[2] =
#define HOENN_TO_NATIONAL(name) [HOENN_DEX_##name - 1] = NATIONAL_DEX_##name
// Assigns all Hoenn Dex Indexes to a National Dex Index
static const u16 sHoennToNationalOrder[HOENN_DEX_COUNT - 1] =
static const enum NationalDexOrder sHoennToNationalOrder[HOENN_DEX_COUNT - 1] =
{
HOENN_TO_NATIONAL(TREECKO),
HOENN_TO_NATIONAL(GROVYLE),
@ -5041,7 +5041,7 @@ bool8 IsMonPastEvolutionLevel(struct Pokemon *mon)
return FALSE;
}
u16 NationalPokedexNumToSpecies(u16 nationalNum)
u16 NationalPokedexNumToSpecies(enum NationalDexOrder nationalNum)
{
u16 species;
@ -5059,7 +5059,7 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum)
return GET_BASE_SPECIES_ID(species);
}
u16 NationalToHoennOrder(u16 nationalNum)
enum HoennDexOrder NationalToHoennOrder(enum NationalDexOrder nationalNum)
{
u16 hoennNum;
@ -5077,7 +5077,7 @@ u16 NationalToHoennOrder(u16 nationalNum)
return hoennNum + 1;
}
u16 SpeciesToNationalPokedexNum(u16 species)
enum NationalDexOrder SpeciesToNationalPokedexNum(u16 species)
{
species = SanitizeSpeciesId(species);
if (!species)
@ -5086,14 +5086,14 @@ u16 SpeciesToNationalPokedexNum(u16 species)
return gSpeciesInfo[species].natDexNum;
}
u16 SpeciesToHoennPokedexNum(u16 species)
enum HoennDexOrder SpeciesToHoennPokedexNum(u16 species)
{
if (!species)
return 0;
return NationalToHoennOrder(gSpeciesInfo[species].natDexNum);
}
u16 HoennToNationalOrder(u16 hoennNum)
enum NationalDexOrder HoennToNationalOrder(enum HoennDexOrder hoennNum)
{
if (!hoennNum || hoennNum >= HOENN_DEX_COUNT)
return 0;
@ -6404,7 +6404,7 @@ u16 PlayerGenderToFrontTrainerPicId(u8 playerGender)
return FacilityClassToPicIndex(FACILITY_CLASS_BRENDAN);
}
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality)
void HandleSetPokedexFlag(enum NationalDexOrder nationalNum, u8 caseId, u32 personality)
{
u8 getFlagCaseId = (caseId == FLAG_SET_SEEN) ? FLAG_GET_SEEN : FLAG_GET_CAUGHT;
if (!GetSetPokedexFlag(nationalNum, getFlagCaseId)) // don't set if it's already set
@ -7059,7 +7059,7 @@ void HealBoxPokemon(struct BoxPokemon *boxMon)
BoxMonRestorePP(boxMon);
}
u16 GetCryIdBySpecies(u16 species)
enum PokemonCry GetCryIdBySpecies(u16 species)
{
species = SanitizeSpeciesId(species);
if (P_CRIES_ENABLED == FALSE || gSpeciesInfo[species].cryId >= CRY_COUNT || gTestRunnerHeadless)

View File

@ -1156,7 +1156,7 @@ static const struct SpriteTemplate sSpriteTemplate_StatusCondition =
static const u16 sMarkings_Pal[] = INCBIN_U16("graphics/summary_screen/markings.gbapal");
// code
static u8 ShowCategoryIcon(u32 category)
static u8 ShowCategoryIcon(enum DamageCategory category)
{
if (sMonSummaryScreen->categoryIconSpriteId == 0xFF)
sMonSummaryScreen->categoryIconSpriteId = CreateSprite(&gSpriteTemplate_CategoryIcons, 48, 128, 0);

View File

@ -3099,7 +3099,7 @@ bool8 ScrCmd_checkobjectat(struct ScriptContext *ctx)
bool8 Scrcmd_getsetpokedexflag(struct ScriptContext *ctx)
{
u32 speciesId = SpeciesToNationalPokedexNum(VarGet(ScriptReadHalfword(ctx)));
enum NationalDexOrder speciesId = SpeciesToNationalPokedexNum(VarGet(ScriptReadHalfword(ctx)));
u32 desiredFlag = VarGet(ScriptReadHalfword(ctx));
if (desiredFlag == FLAG_SET_CAUGHT || desiredFlag == FLAG_SET_SEEN)

View File

@ -334,7 +334,7 @@ void SetTeraType(struct ScriptContext *ctx)
*/
static u32 ScriptGiveMonParameterized(u8 side, u8 slot, u16 species, u8 level, u16 item, enum PokeBall ball, u8 nature, u8 abilityNum, u8 gender, u8 *evs, u8 *ivs, u16 *moves, bool8 isShiny, bool8 gmaxFactor, u8 teraType, u8 dmaxLevel)
{
u16 nationalDexNum;
enum NationalDexOrder nationalDexNum;
int sentToPc;
struct Pokemon mon;
u32 i;

View File

@ -467,11 +467,11 @@ void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode)
SetPokemonCryChorus(chorus);
SetPokemonCryPriority(priority);
species = GetCryIdBySpecies(species);
if (species != CRY_NONE)
enum PokemonCry cryId = GetCryIdBySpecies(species);
if (cryId != CRY_NONE)
{
species--;
gMPlay_PokemonCry = SetPokemonCryTone(reverse ? &gCryTable_Reverse[species] : &gCryTable[species]);
cryId--;
gMPlay_PokemonCry = SetPokemonCryTone(reverse ? &gCryTable_Reverse[cryId] : &gCryTable[cryId]);
}
}

View File

@ -3057,9 +3057,9 @@ static void UpdatePokedexForReceivedMon(u8 partyIdx)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
species = SpeciesToNationalPokedexNum(species);
GetSetPokedexFlag(species, FLAG_SET_SEEN);
HandleSetPokedexFlag(species, FLAG_SET_CAUGHT, personality);
enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(species);
GetSetPokedexFlag(dexNum, FLAG_SET_SEEN);
HandleSetPokedexFlag(dexNum, FLAG_SET_CAUGHT, personality);
}
}

View File

@ -169,7 +169,7 @@ static u32 PickMonFromPool(const struct Trainer *trainer, u8 *poolIndexArray, u3
u32 chosenTags = trainer->party[monIndex].tags;
u16 chosenSpecies = trainer->party[monIndex].species;
u16 chosenItem = trainer->party[monIndex].heldItem;
u16 chosenNatDex = gSpeciesInfo[chosenSpecies].natDexNum;
enum NationalDexOrder chosenNatDex = gSpeciesInfo[chosenSpecies].natDexNum;
// If tag was required, change pool rule to account for the required tag already being picked
u32 tagsToEliminate = 0;
for (u32 currTag = 0; currTag < POOL_NUM_TAGS; currTag++)
@ -197,7 +197,7 @@ static u32 PickMonFromPool(const struct Trainer *trainer, u8 *poolIndexArray, u3
u32 currentTags = trainer->party[poolIndexArray[currIndex]].tags;
u16 currentSpecies = trainer->party[poolIndexArray[currIndex]].species;
u16 currentItem = trainer->party[poolIndexArray[currIndex]].heldItem;
u16 currentNatDex = gSpeciesInfo[currentSpecies].natDexNum;
enum NationalDexOrder currentNatDex = gSpeciesInfo[currentSpecies].natDexNum;
if (currentTags & tagsToEliminate)
{
poolIndexArray[currIndex] = POOL_SLOT_DISABLED;