diff --git a/include/battle.h b/include/battle.h index fce5236b38..af6e72774a 100644 --- a/include/battle.h +++ b/include/battle.h @@ -233,7 +233,7 @@ struct SideTimer u8 followmePowder:1; // Rage powder, does not affect grass type pokemon. u8 retaliateTimer; u16 damageNonTypesTimer; - u8 damageNonTypesType; + enum Type damageNonTypesType; u16 rainbowTimer; u16 seaOfFireTimer; u16 swampTimer; @@ -270,7 +270,7 @@ struct AI_SavedBattleMon u16 heldItem; u16 species:15; u16 saved:1; - u8 types[3]; + enum Type types[3]; }; struct AiPartyMon @@ -624,7 +624,7 @@ struct BattleStruct u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party. u8 expSentInMons; // As bits for player party mons - not including exp share mons. u8 wildVictorySong; - u8 dynamicMoveType; + enum Type dynamicMoveType; u8 wrappedBy[MAX_BATTLERS_COUNT]; u8 battlerPreventingSwitchout; u8 moneyMultiplier:6; @@ -825,7 +825,7 @@ static inline bool32 IsBattleMoveStatus(u32 move) * times with one type because it shares the 'GetBattlerTypes' result. */ #define _IS_BATTLER_ANY_TYPE(battler, ignoreTera, ...) \ ({ \ - u32 types[3]; \ + enum Type types[3]; \ GetBattlerTypes(battler, ignoreTera, types); \ RECURSIVELY(R_FOR_EACH(_IS_BATTLER_ANY_TYPE_HELPER, __VA_ARGS__)) FALSE; \ }) @@ -839,7 +839,7 @@ static inline bool32 IsBattleMoveStatus(u32 move) #define IS_BATTLER_TYPELESS(battlerId) \ ({ \ - u32 types[3]; \ + enum Type types[3]; \ GetBattlerTypes(battlerId, FALSE, types); \ types[0] == TYPE_MYSTERY && types[1] == TYPE_MYSTERY && types[2] == TYPE_MYSTERY; \ }) diff --git a/include/battle_ai_switch_items.h b/include/battle_ai_switch_items.h index afc50a2364..35085563a4 100644 --- a/include/battle_ai_switch_items.h +++ b/include/battle_ai_switch_items.h @@ -45,7 +45,7 @@ void GetAIPartyIndexes(u32 battlerId, s32 *firstId, s32 *lastId); void AI_TrySwitchOrUseItem(u32 battler); u32 GetMostSuitableMonToSwitchInto(u32 battler, enum SwitchType switchType); bool32 ShouldSwitch(u32 battler); -bool32 IsMonGrounded(enum HoldEffect heldItemEffect, enum Ability ability, u8 type1, u8 type2); +bool32 IsMonGrounded(enum HoldEffect heldItemEffect, enum Ability ability, enum Type type1, enum Type type2); void ModifySwitchAfterMoveScoring(u32 battler); #endif // GUARD_BATTLE_AI_SWITCH_ITEMS_H diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index ee6922042e..ba0da1b3e7 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -123,7 +123,7 @@ enum WeatherState IsWeatherActive(u32 flags); bool32 CanAIFaintTarget(u32 battlerAtk, u32 battlerDef, u32 numHits); bool32 CanIndexMoveFaintTarget(u32 battlerAtk, u32 battlerDef, u32 index, enum DamageCalcContext calcContext); bool32 HasDamagingMove(u32 battler); -bool32 HasDamagingMoveOfType(u32 battler, u32 type); +bool32 HasDamagingMoveOfType(u32 battler, enum Type type); u32 GetBattlerSecondaryDamage(u32 battlerId); bool32 BattlerWillFaintFromWeather(u32 battler, enum Ability ability); bool32 BattlerWillFaintFromSecondaryDamage(u32 battler, enum Ability ability); @@ -177,7 +177,7 @@ bool32 HasMove(u32 battlerId, u32 move); u32 GetIndexInMoveArray(u32 battler, u32 move); bool32 HasOnlyMovesWithCategory(u32 battlerId, enum DamageCategory category, bool32 onlyOffensive); bool32 HasMoveWithCategory(u32 battler, enum DamageCategory category); -bool32 HasMoveWithType(u32 battler, u32 type); +bool32 HasMoveWithType(u32 battler, enum Type type); bool32 HasMoveWithEffect(u32 battler, enum BattleMoveEffects moveEffect); bool32 HasMoveWithAIEffect(u32 battler, u32 aiEffect); bool32 HasBattlerSideMoveWithEffect(u32 battler, u32 effect); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 0209ccbbca..c3b5fff97f 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -203,7 +203,7 @@ struct ChooseMoveStruct u8 currentPp[MAX_MON_MOVES]; u8 maxPp[MAX_MON_MOVES]; u16 species; - u8 monTypes[3]; + enum Type monTypes[3]; struct ZMoveData zmove; }; diff --git a/include/battle_dynamax.h b/include/battle_dynamax.h index 99c917f456..d9fa48706d 100644 --- a/include/battle_dynamax.h +++ b/include/battle_dynamax.h @@ -15,7 +15,7 @@ bool32 IsMoveBlockedByMaxGuard(u32 move); u16 GetMaxMove(u32 battler, u32 baseMove); u32 GetMaxMovePower(u32 move); bool32 IsMaxMove(u32 move); -void ChooseDamageNonTypesString(u8 type); +void ChooseDamageNonTypesString(enum Type type); void BS_UpdateDynamax(void); void BS_SetSteelsurge(void); diff --git a/include/battle_environment.h b/include/battle_environment.h index e93b848e87..f4870f795c 100644 --- a/include/battle_environment.h +++ b/include/battle_environment.h @@ -8,7 +8,7 @@ struct BattleEnvironment { u16 naturePower; u16 secretPowerEffect; - u8 camouflageType; + enum Type camouflageType; struct BattleBackground background; }; diff --git a/include/battle_main.h b/include/battle_main.h index 400d793b20..c08da1d9ca 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -106,7 +106,7 @@ s32 GetWhichBattlerFasterOrTies(struct BattleContext *ctx, bool32 ignoreChosenMo s32 GetWhichBattlerFaster(struct BattleContext *ctx, bool32 ignoreChosenMoves); void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands(void); -u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState monInBattle); +enum Type GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState monInBattle); void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk); bool32 IsWildMonSmart(void); u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer *trainer, bool32 firstTrainer, u32 battleTypeFlags); diff --git a/include/battle_message.h b/include/battle_message.h index ade0a0826e..9809589243 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -244,7 +244,7 @@ struct BattleMsgData u8 bakScriptPartyIdx; u8 hpScale; u8 itemEffectBattler; - u8 moveType; + enum Type moveType; enum Ability abilities[MAX_BATTLERS_COUNT]; u8 textBuffs[3][TEXT_BUFF_ARRAY_COUNT]; }; diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 2f3bd8e731..ff4a4d56c7 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -67,7 +67,7 @@ bool32 CanCamouflage(u8 battlerId); void StealTargetItem(u8 battlerStealer, u8 battlerItem); u8 GetCatchingBattler(void); enum Stat GetHighestStatId(u32 battlerId); -bool32 ProteanTryChangeType(u32 battler, enum Ability ability, u32 move, u32 moveType); +bool32 ProteanTryChangeType(u32 battler, enum Ability ability, u32 move, enum Type moveType); bool32 IsMoveNotAllowedInSkyBattles(u32 move); bool32 DoSwitchInAbilities(u32 battlerId); u8 GetFirstFaintedPartyIndex(u8 battlerId); diff --git a/include/battle_terastal.h b/include/battle_terastal.h index 9c55a49d70..6bfb74986a 100644 --- a/include/battle_terastal.h +++ b/include/battle_terastal.h @@ -4,11 +4,11 @@ void ActivateTera(u32 battler); void ApplyBattlerVisualsForTeraAnim(u32 battler); bool32 CanTerastallize(u32 battler); -u32 GetBattlerTeraType(u32 battler); -void ExpendTypeStellarBoost(u32 battler, u32 type); -bool32 IsTypeStellarBoosted(u32 battler, u32 type); +enum Type GetBattlerTeraType(u32 battler); +void ExpendTypeStellarBoost(u32 battler, enum Type type); +bool32 IsTypeStellarBoosted(u32 battler, enum Type type); uq4_12_t GetTeraMultiplier(struct DamageContext *ctx); -u16 GetTeraTypeRGB(u32 type); +u16 GetTeraTypeRGB(enum Type type); #endif diff --git a/include/battle_util.h b/include/battle_util.h index 1c56aca9c2..cc65a79bd5 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -91,7 +91,7 @@ enum ItemEffect // for Natural Gift and Fling struct TypePower { - u8 type; + enum Type type; u8 power; u16 effect; }; @@ -158,7 +158,7 @@ struct DamageContext u32 battlerAtk:3; u32 battlerDef:3; u32 move:16; - u32 moveType:5; + enum Type moveType:5; u32 isCrit:1; u32 randomFactor:1; u32 updateFlags:1; @@ -259,7 +259,7 @@ bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2 bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, u32 ability); bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag); bool32 CanAbilityBlockMove(u32 battlerAtk, u32 battlerDef, enum Ability abilityAtk, enum Ability abilityDef, u32 move, enum FunctionCallOption option); -bool32 CanAbilityAbsorbMove(u32 battlerAtk, u32 battlerDef, enum Ability abilityDef, u32 move, u32 moveType, enum FunctionCallOption option); +bool32 CanAbilityAbsorbMove(u32 battlerAtk, u32 battlerDef, enum Ability abilityDef, u32 move, enum Type moveType, enum FunctionCallOption option); bool32 TryFieldEffects(enum FieldEffectCases caseId); u32 AbilityBattleEffects(enum AbilityEffect caseID, u32 battler, enum Ability ability, u32 special, u32 moveArg); bool32 TryPrimalReversion(u32 battler); @@ -302,11 +302,11 @@ s32 DoFixedDamageMoveCalc(struct DamageContext *ctx); s32 ApplyModifiersAfterDmgRoll(struct DamageContext *ctx, s32 dmg); uq4_12_t CalcTypeEffectivenessMultiplier(struct DamageContext *ctx); uq4_12_t CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, enum Ability abilityDef); -uq4_12_t GetTypeModifier(u32 atkType, u32 defType); -uq4_12_t GetOverworldTypeEffectiveness(struct Pokemon *mon, u8 moveType); +uq4_12_t GetTypeModifier(enum Type atkType, enum Type defType); +uq4_12_t GetOverworldTypeEffectiveness(struct Pokemon *mon, enum Type moveType); void UpdateMoveResultFlags(uq4_12_t modifier, u16 *resultFlags); s32 GetStealthHazardDamage(enum TypeSideHazard hazardType, u32 battler); -s32 GetStealthHazardDamageByTypesAndHP(enum TypeSideHazard hazardType, u8 type1, u8 type2, u32 maxHp); +s32 GetStealthHazardDamageByTypesAndHP(enum TypeSideHazard hazardType, enum Type type1, enum Type type2, u32 maxHp); bool32 CanMegaEvolve(u32 battler); bool32 CanUltraBurst(u32 battler); void ActivateMegaEvolution(u32 battler); @@ -387,12 +387,12 @@ bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2); bool32 AreBattlersOfSameGender(u32 battler1, u32 battler2); u32 CalcSecondaryEffectChance(u32 battler, enum Ability battlerAbility, const struct AdditionalEffect *additionalEffect); bool32 MoveEffectIsGuaranteed(u32 battler, enum Ability battlerAbility, const struct AdditionalEffect *additionalEffect); -void GetBattlerTypes(u32 battler, bool32 ignoreTera, u32 types[static 3]); -u32 GetBattlerType(u32 battler, u32 typeIndex, bool32 ignoreTera); +void GetBattlerTypes(u32 battler, bool32 ignoreTera, enum Type types[static 3]); +enum Type GetBattlerType(u32 battler, u32 typeIndex, bool32 ignoreTera); bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon); bool8 IsMonBannedFromSkyBattles(u16 species); -void RemoveBattlerType(u32 battler, u8 type); -u32 GetBattleMoveType(u32 move); +void RemoveBattlerType(u32 battler, enum Type type); +enum Type GetBattleMoveType(u32 move); void TryActivateSleepClause(u32 battler, u32 indexInParty); void TryDeactivateSleepClause(u32 battlerSide, u32 indexInParty); bool32 IsSleepClauseActiveForSide(u32 battlerSide); diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 76c4667696..b3ceb884cf 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -2,28 +2,31 @@ #define GUARD_CONSTANTS_POKEMON_H // Pokémon types -#define TYPE_NONE 0 -#define TYPE_NORMAL 1 -#define TYPE_FIGHTING 2 -#define TYPE_FLYING 3 -#define TYPE_POISON 4 -#define TYPE_GROUND 5 -#define TYPE_ROCK 6 -#define TYPE_BUG 7 -#define TYPE_GHOST 8 -#define TYPE_STEEL 9 -#define TYPE_MYSTERY 10 -#define TYPE_FIRE 11 -#define TYPE_WATER 12 -#define TYPE_GRASS 13 -#define TYPE_ELECTRIC 14 -#define TYPE_PSYCHIC 15 -#define TYPE_ICE 16 -#define TYPE_DRAGON 17 -#define TYPE_DARK 18 -#define TYPE_FAIRY 19 -#define TYPE_STELLAR 20 -#define NUMBER_OF_MON_TYPES 21 +enum __attribute__((packed)) Type +{ + TYPE_NONE = 0, + TYPE_NORMAL = 1, + TYPE_FIGHTING = 2, + TYPE_FLYING = 3, + TYPE_POISON = 4, + TYPE_GROUND = 5, + TYPE_ROCK = 6, + TYPE_BUG = 7, + TYPE_GHOST = 8, + TYPE_STEEL = 9, + TYPE_MYSTERY = 10, + TYPE_FIRE = 11, + TYPE_WATER = 12, + TYPE_GRASS = 13, + TYPE_ELECTRIC = 14, + TYPE_PSYCHIC = 15, + TYPE_ICE = 16, + TYPE_DRAGON = 17, + TYPE_DARK = 18, + TYPE_FAIRY = 19, + TYPE_STELLAR = 20, + NUMBER_OF_MON_TYPES +}; // Pokémon egg groups #define EGG_GROUP_NONE 0 diff --git a/include/data.h b/include/data.h index 6db21db905..fbca022f97 100644 --- a/include/data.h +++ b/include/data.h @@ -71,7 +71,7 @@ struct TrainerMon u8 nature:5; bool8 gender:2; bool8 isShiny:1; - u8 teraType:5; + enum Type teraType:5; bool8 gigantamaxFactor:1; u8 shouldUseDynamax:1; u8 padding1:1; diff --git a/include/move.h b/include/move.h index b1e8cba99f..9cac855610 100644 --- a/include/move.h +++ b/include/move.h @@ -65,7 +65,7 @@ struct MoveInfo const u8 *name; const u8 *description; enum BattleMoveEffects effect; - u16 type:5; // Up to 32 + enum Type type:5; // Up to 32 enum DamageCategory category:2; u16 power:9; // up to 511 // end of word @@ -192,7 +192,7 @@ static inline const u8 *GetMoveDescription(u32 moveId) return gMovesInfo[moveId].description; } -static inline u32 GetMoveType(u32 moveId) +static inline enum Type GetMoveType(u32 moveId) { return gMovesInfo[SanitizeMoveId(moveId)].type; } diff --git a/include/overworld.h b/include/overworld.h index f4368ba57d..c0122677f4 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -143,7 +143,7 @@ bool32 IsOverworldLinkActive(void); void CB1_Overworld(void); void CB2_OverworldBasic(void); void UpdateTimeOfDay(void); -bool32 MapHasNaturalLight(u8 mapType); +bool32 MapHasNaturalLight(enum MapType mapType); bool32 CurrentMapHasShadows(void); void UpdateAltBgPalettes(u16 palettes); void UpdatePalettesWithTime(u32); diff --git a/include/pokemon.h b/include/pokemon.h index f626d3c05e..ca33c961a8 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -130,7 +130,7 @@ enum MonData { struct PokemonSubstruct0 { u16 species:11; // 2047 species. - u16 teraType:5; // 30 types. + enum Type teraType:5; // 30 types. u16 heldItem:10; // 1023 items. u16 unused_02:6; u32 experience:21; @@ -372,7 +372,7 @@ struct BattlePokemon /*0x17*/ u32 abilityNum:2; /*0x18*/ s8 statStages[NUM_BATTLE_STATS]; /*0x20*/ enum Ability ability; - /*0x22*/ u8 types[3]; + /*0x22*/ enum Type types[3]; /*0x25*/ u8 pp[MAX_MON_MOVES]; /*0x29*/ u16 hp; /*0x2B*/ u8 level; @@ -415,7 +415,7 @@ struct SpeciesInfo /*0xC4*/ u8 baseSpeed; u8 baseSpAttack; u8 baseSpDefense; - u8 types[2]; + enum Type types[2]; u8 catchRate; u8 forceTeraType; u16 expYield; // expYield was changed from u8 to u16 for the new Exp System. @@ -785,7 +785,7 @@ const u8 *GetSpeciesCategory(u16 species); const u8 *GetSpeciesPokedexDescription(u16 species); u32 GetSpeciesHeight(u16 species); u32 GetSpeciesWeight(u16 species); -u32 GetSpeciesType(u16 species, u8 slot); +enum Type GetSpeciesType(u16 species, u8 slot); enum Ability GetSpeciesAbility(u16 species, u8 slot); u32 GetSpeciesBaseHP(u16 species); u32 GetSpeciesBaseAttack(u16 species); @@ -900,15 +900,15 @@ void HealPokemon(struct Pokemon *mon); void HealBoxPokemon(struct BoxPokemon *boxMon); void UpdateDaysPassedSinceFormChange(u16 days); void TrySetDayLimitToFormChange(struct Pokemon *mon); -u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state); +enum Type CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state); uq4_12_t GetDynamaxLevelHPMultiplier(u32 dynamaxLevel, bool32 inverseMultiplier); u32 GetRegionalFormByRegion(u32 species, u32 region); bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion); -u32 GetTeraTypeFromPersonality(struct Pokemon *mon); +enum Type GetTeraTypeFromPersonality(struct Pokemon *mon); bool8 ShouldSkipFriendshipChange(void); struct Pokemon *GetSavedPlayerPartyMon(u32 index); u8 *GetSavedPlayerPartyCount(void); void SavePlayerPartyMon(u32 index, struct Pokemon *mon); -u32 IsSpeciesOfType(u32 species, u32 type); +bool32 IsSpeciesOfType(u32 species, enum Type type); #endif // GUARD_POKEMON_H diff --git a/include/test/battle.h b/include/test/battle.h index 2ea4c9a344..fbd4106b35 100644 --- a/include/test/battle.h +++ b/include/test/battle.h @@ -1027,7 +1027,7 @@ void Status1_(u32 sourceLine, u32 status1); void OTName_(u32 sourceLine, const u8 *otName); void DynamaxLevel_(u32 sourceLine, u32 dynamaxLevel); void GigantamaxFactor_(u32 sourceLine, bool32 gigantamaxFactor); -void TeraType_(u32 sourceLine, u32 teraType); +void TeraType_(u32 sourceLine, enum Type teraType); void Shadow_(u32 sourceLine, bool32 isShadow); void Shiny_(u32 sourceLine, bool32 isShiny); diff --git a/include/trade.h b/include/trade.h index 24de69b036..553d5ab334 100644 --- a/include/trade.h +++ b/include/trade.h @@ -14,7 +14,7 @@ s32 GetGameProgressForLinkTrade(void); void CB2_StartCreateTradeMenu(void); void CB2_LinkTrade(void); int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 species2, u16 species, bool8 isModernFatefulEncounter); -int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, bool8 isModernFatefulEncounter); +int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, enum Type requestedType, u16 playerSpecies, bool8 isModernFatefulEncounter); int CanSpinTradeMon(struct Pokemon *mon, u16 monIdx); void InitTradeSequenceBgGpuRegs(void); void LinkTradeDrawWindow(void); diff --git a/include/trainer_slide.h b/include/trainer_slide.h index 19fdf7c24a..a8f1988fb8 100644 --- a/include/trainer_slide.h +++ b/include/trainer_slide.h @@ -12,7 +12,7 @@ struct MessageStatus void SetTrainerSlideMessage(enum DifficultyLevel difficulty, u32 trainerId, u32 slideId); enum TrainerSlideTargets ShouldDoTrainerSlide(u32 battler, enum TrainerSlideType slideId); -void TryInitializeFirstSTABMoveTrainerSlide(u32 battlerDef, u32 battlerAtk, u32 moveType); +void TryInitializeFirstSTABMoveTrainerSlide(u32 battlerDef, u32 battlerAtk, enum Type moveType); void TryInitializeTrainerSlidePlayerLandsFirstCriticalHit(u32 target); void TryInitializeTrainerSlideEnemyLandsFirstCriticalHit(u32 target); void TryInitializeTrainerSlidePlayerLandsFirstSuperEffectiveHit(u32 target); diff --git a/include/union_room.h b/include/union_room.h index 514a159850..5616c106d3 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -149,7 +149,7 @@ extern u8 gPlayerCurrActivity; extern struct RfuGameCompatibilityData gRfuPartnerCompatibilityData; extern u16 gUnionRoomOfferedSpecies; -extern u8 gUnionRoomRequestedMonType; +extern enum Type gUnionRoomRequestedMonType; u8 CreateTask_CreateTradeMenu(void); void SetUsingUnionRoomStartMenu(void); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 94b4a10a51..6db99f3663 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -712,7 +712,7 @@ static u32 PpStallReduction(u32 move, u32 battlerAtk) u32 species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES); enum Ability abilityAtk = ABILITY_NONE; enum Ability abilityDef = GetPartyMonAbility(&gPlayerParty[partyIndex]); - u32 moveType = GetBattleMoveType(move); // Probably doesn't handle dynamic types right now + enum Type moveType = GetBattleMoveType(move); // Probably doesn't handle dynamic types right now if (CanAbilityAbsorbMove(battlerAtk, tempBattleMonIndex, abilityDef, move, moveType, CHECK_TRIGGER) || CanAbilityBlockMove(battlerAtk, tempBattleMonIndex, abilityAtk, abilityDef, move, CHECK_TRIGGER) || (CalcPartyMonTypeEffectivenessMultiplier(move, species, abilityDef) == 0)) @@ -1070,7 +1070,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) // move data enum BattleMoveEffects moveEffect = GetMoveEffect(move); u32 nonVolatileStatus = GetMoveNonVolatileStatus(move); - s32 moveType; + enum Type moveType; u32 moveTarget = GetBattlerMoveTargetType(battlerAtk, move); struct AiLogicData *aiData = gAiLogicData; uq4_12_t effectiveness = aiData->effectiveness[battlerAtk][battlerDef][gAiThinkingStruct->movesetIndex]; @@ -2708,7 +2708,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) break; case EFFECT_SOAK: { - u32 types[3]; + enum Type types[3]; u32 typeArg = GetMoveArgType(move); GetBattlerTypes(battlerDef, FALSE, types); @@ -3052,7 +3052,7 @@ static s32 AI_TryToFaint(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { // move data - u32 moveType = GetMoveType(move); + enum Type moveType = GetMoveType(move); enum BattleMoveEffects effect = GetMoveEffect(move); u32 moveTarget = GetBattlerMoveTargetType(battlerAtk, move); // ally data @@ -4061,7 +4061,7 @@ static s32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move, stru s32 score = 0; u32 predictedMove = GetIncomingMove(battlerAtk, battlerDef, aiData); u32 predictedMoveSpeedCheck = GetIncomingMoveSpeedCheck(battlerAtk, battlerDef, aiData); - u32 predictedType = GetMoveType(predictedMove); + enum Type predictedType = GetMoveType(predictedMove); u32 predictedMoveSlot = GetMoveSlot(GetMovesArray(battlerDef), predictedMove); bool32 isBattle1v1 = IsBattle1v1(); bool32 hasTwoOpponents = HasTwoOpponents(battlerAtk); @@ -6286,7 +6286,7 @@ static s32 AI_PreferBatonPass(u32 battlerAtk, u32 battlerDef, u32 move, s32 scor static s32 AI_HPAware(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { enum BattleMoveEffects effect = GetMoveEffect(move); - u32 moveType = 0; + enum Type moveType = 0; SetTypeBeforeUsingMove(move, battlerAtk); moveType = GetBattleMoveType(move); diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 6b7dcf300b..e30ba186af 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -471,7 +471,7 @@ static bool32 FindMonThatAbsorbsOpponentsMove(u32 battler) { u8 battlerIn1, battlerIn2; u8 numAbsorbingAbilities = 0; - u16 absorbingTypeAbilities[3]; // Array size is maximum number of absorbing abilities for a single type + enum Ability absorbingTypeAbilities[3]; // Array size is maximum number of absorbing abilities for a single type s32 firstId; s32 lastId; struct Pokemon *party; @@ -479,7 +479,7 @@ static bool32 FindMonThatAbsorbsOpponentsMove(u32 battler) u16 aiMove; u32 opposingBattler = GetOppositeBattler(battler); u32 incomingMove = GetIncomingMove(battler, opposingBattler, gAiLogicData); - u32 incomingType = CheckDynamicMoveType(GetBattlerMon(opposingBattler), incomingMove, opposingBattler, MON_IN_BATTLE); + enum Type incomingType = CheckDynamicMoveType(GetBattlerMon(opposingBattler), incomingMove, opposingBattler, MON_IN_BATTLE); bool32 isOpposingBattlerChargingOrInvulnerable = !BreaksThroughSemiInvulnerablity(opposingBattler, incomingMove) || IsTwoTurnNotSemiInvulnerableMove(opposingBattler, incomingMove); s32 i, j; @@ -1535,7 +1535,7 @@ static u32 GetFirstNonInvalidMon(u32 firstId, u32 lastId, u32 invalidMons, u32 b return PARTY_SIZE; } -bool32 IsMonGrounded(enum HoldEffect heldItemEffect, enum Ability ability, u8 type1, u8 type2) +bool32 IsMonGrounded(enum HoldEffect heldItemEffect, enum Ability ability, enum Type type1, enum Type type2) { // List that makes mon not grounded if (type1 == TYPE_FLYING || type2 == TYPE_FLYING || ability == ABILITY_LEVITATE @@ -1554,7 +1554,8 @@ bool32 IsMonGrounded(enum HoldEffect heldItemEffect, enum Ability ability, u8 ty // Gets hazard damage static u32 GetSwitchinHazardsDamage(u32 battler, struct BattlePokemon *battleMon) { - u8 defType1 = battleMon->types[0], defType2 = battleMon->types[1], tSpikesLayers; + enum Type defType1 = battleMon->types[0], defType2 = battleMon->types[1]; + u8 tSpikesLayers; u16 heldItemEffect = GetItemHoldEffect(battleMon->item); u32 maxHP = battleMon->maxHP; enum Ability ability = battleMon->ability, status = battleMon->status1; @@ -1745,7 +1746,7 @@ static u32 GetSwitchinRecurringDamage(void) // Gets one turn of status damage static u32 GetSwitchinStatusDamage(u32 battler) { - u8 defType1 = gAiLogicData->switchinCandidate.battleMon.types[0], defType2 = gAiLogicData->switchinCandidate.battleMon.types[1]; + enum Type defType1 = gAiLogicData->switchinCandidate.battleMon.types[0], defType2 = gAiLogicData->switchinCandidate.battleMon.types[1]; u8 tSpikesLayers = gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount; u16 heldItemEffect = GetItemHoldEffect(gAiLogicData->switchinCandidate.battleMon.item); u32 status = gAiLogicData->switchinCandidate.battleMon.status1; @@ -1934,8 +1935,8 @@ static u32 GetBattleMonTypeMatchup(struct BattlePokemon opposingBattleMon, struc { // Check type matchup u32 typeEffectiveness1 = UQ_4_12(1.0), typeEffectiveness2 = UQ_4_12(1.0); - u8 atkType1 = opposingBattleMon.types[0], atkType2 = opposingBattleMon.types[1], - defType1 = battleMon.types[0], defType2 = battleMon.types[1]; + enum Type atkType1 = opposingBattleMon.types[0], atkType2 = opposingBattleMon.types[1]; + enum Type defType1 = battleMon.types[0], defType2 = battleMon.types[1]; // Add each independent defensive type matchup together typeEffectiveness1 = uq4_12_multiply(typeEffectiveness1, (GetTypeModifier(atkType1, defType1))); diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index bab5d76706..cb35b52ee3 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -761,14 +761,14 @@ static inline s32 SetFixedMoveBasePower(u32 battlerAtk, u32 move) return fixedBasePower; } -static inline void AI_StoreBattlerTypes(u32 battlerAtk, u32 *types) +static inline void AI_StoreBattlerTypes(u32 battlerAtk, enum Type *types) { types[0] = gBattleMons[battlerAtk].types[0]; types[1] = gBattleMons[battlerAtk].types[1]; types[2] = gBattleMons[battlerAtk].types[2]; } -static inline void AI_RestoreBattlerTypes(u32 battlerAtk, u32 *types) +static inline void AI_RestoreBattlerTypes(u32 battlerAtk, enum Type *types) { gBattleMons[battlerAtk].types[0] = types[0]; gBattleMons[battlerAtk].types[1] = types[1]; @@ -946,7 +946,7 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u if (movePower && !isDamageMoveUnusable) { - u32 types[3]; + enum Type types[3]; AI_StoreBattlerTypes(battlerAtk, types); ProteanTryChangeType(battlerAtk, aiData->abilities[battlerAtk], move, ctx.moveType); @@ -2362,7 +2362,7 @@ bool32 HasMoveWithCategory(u32 battler, enum DamageCategory category) return FALSE; } -bool32 HasMoveWithType(u32 battler, u32 type) +bool32 HasMoveWithType(u32 battler, enum Type type) { s32 i; u16 *moves = GetMovesArray(battler); @@ -2968,7 +2968,7 @@ bool32 HasDamagingMove(u32 battler) return FALSE; } -bool32 HasDamagingMoveOfType(u32 battler, u32 type) +bool32 HasDamagingMoveOfType(u32 battler, enum Type type) { s32 i; u16 *moves = GetMovesArray(battler); @@ -2977,7 +2977,7 @@ bool32 HasDamagingMoveOfType(u32 battler, u32 type) { if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && GetMovePower(moves[i]) > 0) { - u32 moveType = GetDynamicMoveType(GetBattlerMon(battler), moves[i], battler, MON_IN_BATTLE); + enum Type moveType = GetDynamicMoveType(GetBattlerMon(battler), moves[i], battler, MON_IN_BATTLE); if (moveType != TYPE_NONE && type == moveType) return TRUE; @@ -3228,8 +3228,8 @@ static bool32 PartyBattlerShouldAvoidHazards(u32 currBattler, u32 switchBattler) enum HoldEffect holdEffect; u32 species = GetMonData(mon, MON_DATA_SPECIES); s32 hazardDamage = 0; - u32 type1 = GetSpeciesType(species, 0); - u32 type2 = GetSpeciesType(species, 1); + enum Type type1 = GetSpeciesType(species, 0); + enum Type type2 = GetSpeciesType(species, 1); u32 maxHp = GetMonData(mon, MON_DATA_MAX_HP); u32 side = GetBattlerSide(currBattler); diff --git a/src/battle_anim.c b/src/battle_anim.c index 100d2d376d..5aea35a05d 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -2224,7 +2224,7 @@ static void Cmd_stopsound(void) static void Cmd_jumpifmovetypeequal(void) { - const u8 *type = sBattleAnimScriptPtr + 1; + const enum Type *type = sBattleAnimScriptPtr + 1; sBattleAnimScriptPtr += 2; if (*type != GetBattleMoveType(gCurrentMove)) sBattleAnimScriptPtr += 4; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 7ade058d19..1d63466ef8 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1673,7 +1673,7 @@ static void MoveSelectionDisplayMoveType(u32 battler) struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); txtPtr = StringCopy(gDisplayedStringBattle, gText_MoveInterfaceType); u32 move = moveInfo->moves[gMoveSelectionCursor[battler]]; - u32 type = GetMoveType(move); + enum Type type = GetMoveType(move); enum BattleMoveEffects effect = GetMoveEffect(move); if (effect == EFFECT_TERA_BLAST) diff --git a/src/battle_debug.c b/src/battle_debug.c index 98c440291b..5c3ce4f7a7 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -1495,7 +1495,7 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data) case LIST_ITEM_TYPES: for (i = 0; i < 3; i++) { - u8 *types = &gBattleMons[data->battlerId].types[0]; + enum Type *types = &gBattleMons[data->battlerId].types[0]; PadString(gTypesInfo[types[i]].name, text); printer.currentY = printer.y = (i * yMultiplier) + sSecondaryListTemplate.upText_Y; diff --git a/src/battle_dome.c b/src/battle_dome.c index 309a0e4a58..df96737f8d 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -2392,7 +2392,7 @@ static int SelectOpponentMonsFromParty(int *partyMovePoints, bool8 allowRandom) static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode) { - int defType1, defType2, moveType; + enum Type defType1, defType2, moveType; int typePower = TYPE_x1; enum Ability defAbility; diff --git a/src/battle_dynamax.c b/src/battle_dynamax.c index a95225bf44..0ea0f94f33 100644 --- a/src/battle_dynamax.c +++ b/src/battle_dynamax.c @@ -27,7 +27,7 @@ static u32 GetMaxPowerTier(u32 move); struct GMaxMove { u16 species; - u8 moveType; + enum Type moveType; u16 gmaxMove; }; @@ -65,8 +65,8 @@ static const struct GMaxMove sGMaxMoveTable[] = {SPECIES_ALCREMIE_GMAX, TYPE_FAIRY, MOVE_G_MAX_FINALE}, {SPECIES_COPPERAJAH_GMAX, TYPE_STEEL, MOVE_G_MAX_STEELSURGE}, {SPECIES_DURALUDON_GMAX, TYPE_DRAGON, MOVE_G_MAX_DEPLETION}, - {SPECIES_URSHIFU_SINGLE_STRIKE_GMAX,TYPE_DARK, MOVE_G_MAX_ONE_BLOW}, - {SPECIES_URSHIFU_RAPID_STRIKE_GMAX, TYPE_WATER, MOVE_G_MAX_RAPID_FLOW}, + {SPECIES_URSHIFU_SINGLE_STRIKE_GMAX, TYPE_DARK, MOVE_G_MAX_ONE_BLOW}, + {SPECIES_URSHIFU_RAPID_STRIKE_GMAX, TYPE_WATER, MOVE_G_MAX_RAPID_FLOW}, }; // Returns whether a battler can Dynamax. @@ -233,7 +233,7 @@ bool32 IsMoveBlockedByMaxGuard(u32 move) return FALSE; } -static u16 GetTypeBasedMaxMove(u32 battler, u32 type) +static u16 GetTypeBasedMaxMove(u32 battler, enum Type type) { // Gigantamax check u32 i; @@ -264,7 +264,7 @@ static u16 GetTypeBasedMaxMove(u32 battler, u32 type) // Returns the appropriate Max Move or G-Max Move for a battler to use. u16 GetMaxMove(u32 battler, u32 baseMove) { - u32 moveType; + enum Type moveType; SetTypeBeforeUsingMove(baseMove, battler); moveType = GetBattleMoveType(baseMove); @@ -317,7 +317,7 @@ u32 GetMaxMovePower(u32 move) } tier = GetMaxPowerTier(move); - u32 moveType = GetMoveType(move); + enum Type moveType = GetMoveType(move); if (moveType == TYPE_FIGHTING || moveType == TYPE_POISON || move == MOVE_MULTI_ATTACK) @@ -437,7 +437,7 @@ bool32 IsMaxMove(u32 move) } // Assigns the multistring to use for the "Damage Non- Types" G-Max effect. -void ChooseDamageNonTypesString(u8 type) +void ChooseDamageNonTypesString(enum Type type) { switch (type) { @@ -453,6 +453,8 @@ void ChooseDamageNonTypesString(u8 type) case TYPE_ROCK: gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SURROUNDED_BY_ROCKS; break; + default: + break; } } diff --git a/src/battle_main.c b/src/battle_main.c index faf7829bdf..5d99e6f964 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -2003,7 +2003,7 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer if (partyData[monIndex].teraType > 0) { gBattleStruct->opponentMonCanTera |= 1 << i; - u32 data = partyData[monIndex].teraType; + enum Type data = partyData[monIndex].teraType; SetMonData(&party[i], MON_DATA_TERA_TYPE, &data); } CalculateMonStats(&party[i]); @@ -5815,9 +5815,9 @@ void RunBattleScriptCommands(void) gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } -u32 TrySetAteType(u32 move, u32 battlerAtk, enum Ability attackerAbility) +enum Type TrySetAteType(u32 move, u32 battlerAtk, enum Ability attackerAbility) { - u32 ateType = TYPE_NONE; + enum Type ateType = TYPE_NONE; switch (GetMoveEffect(move)) { @@ -5863,11 +5863,12 @@ u32 TrySetAteType(u32 move, u32 battlerAtk, enum Ability attackerAbility) } // Returns TYPE_NONE if type doesn't change. -u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state) +enum Type GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state) { - u32 moveType = GetMoveType(move); + enum Type moveType = GetMoveType(move); enum BattleMoveEffects moveEffect = GetMoveEffect(move); - u32 species, heldItem, type1, type2, type3; + u32 species, heldItem; + enum Type type1, type2, type3; enum Ability ability; enum HoldEffect holdEffect; enum Gimmick gimmick = GetActiveGimmick(battler); @@ -5977,7 +5978,7 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState case EFFECT_REVELATION_DANCE: if (gimmick != GIMMICK_Z_MOVE) { - u32 teraType; + enum Type teraType; if (gimmick == GIMMICK_TERA && ((teraType = GetMonData(mon, MON_DATA_TERA_TYPE)) != TYPE_STELLAR)) return teraType; else if (type1 != TYPE_MYSTERY && !(gDisableStructs[battler].roostActive && type1 == TYPE_FLYING)) @@ -6102,7 +6103,7 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState void SetTypeBeforeUsingMove(u32 move, u32 battler) { - u32 moveType; + enum Type moveType; u32 heldItem = gBattleMons[battler].item; enum HoldEffect holdEffect = GetBattlerHoldEffect(battler); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 80e0139f4a..fbae0ee12c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1007,7 +1007,7 @@ static bool32 NoTargetPresent(u8 battler, u32 move) return FALSE; } -bool32 ProteanTryChangeType(u32 battler, enum Ability ability, u32 move, u32 moveType) +bool32 ProteanTryChangeType(u32 battler, enum Ability ability, u32 move, enum Type moveType) { if ((ability == ABILITY_PROTEAN || ability == ABILITY_LIBERO) && !gDisableStructs[gBattlerAttacker].usedProteanLibero @@ -15082,7 +15082,7 @@ void BS_TryReflectType(void) { NATIVE_ARGS(const u8 *failInstr); u16 targetBaseSpecies = GET_BASE_SPECIES_ID(gBattleMons[gBattlerTarget].species); - u32 targetTypes[3]; + enum Type targetTypes[3]; GetBattlerTypes(gBattlerTarget, FALSE, targetTypes); if (targetBaseSpecies == SPECIES_ARCEUS || targetBaseSpecies == SPECIES_SILVALLY) @@ -17238,9 +17238,9 @@ void BS_TryElectrify(void) void BS_TrySoak(void) { NATIVE_ARGS(const u8 *failInstr); - u32 types[3]; + enum Type types[3]; GetBattlerTypes(gBattlerTarget, FALSE, types); - u32 typeToSet = GetMoveArgType(gCurrentMove); + enum Type typeToSet = GetMoveArgType(gCurrentMove); if ((types[0] == typeToSet && types[1] == typeToSet) || GetActiveGimmick(gBattlerTarget) == GIMMICK_TERA) { diff --git a/src/battle_terastal.c b/src/battle_terastal.c index 0c552953b8..f0e720c93e 100644 --- a/src/battle_terastal.c +++ b/src/battle_terastal.c @@ -108,20 +108,20 @@ bool32 CanTerastallize(u32 battler) } // Returns a battler's Tera type. -u32 GetBattlerTeraType(u32 battler) +enum Type GetBattlerTeraType(u32 battler) { return GetMonData(GetBattlerMon(battler), MON_DATA_TERA_TYPE); } // Uses up a type's Stellar boost. -void ExpendTypeStellarBoost(u32 battler, u32 type) +void ExpendTypeStellarBoost(u32 battler, enum Type type) { if (type < 32 && gBattleMons[battler].species != SPECIES_TERAPAGOS_STELLAR) // avoid OOB access gBattleStruct->stellarBoostFlags[GetBattlerSide(battler)] |= 1u << type; } // Checks whether a type's Stellar boost has been expended. -bool32 IsTypeStellarBoosted(u32 battler, u32 type) +bool32 IsTypeStellarBoosted(u32 battler, enum Type type) { if (type < 32) // avoid OOB access return !(gBattleStruct->stellarBoostFlags[GetBattlerSide(battler)] & (1u << type)); @@ -133,7 +133,7 @@ bool32 IsTypeStellarBoosted(u32 battler, u32 type) // Power multipliers from Smogon Research thread. uq4_12_t GetTeraMultiplier(struct DamageContext *ctx) { - u32 teraType = GetBattlerTeraType(ctx->battlerAtk); + enum Type teraType = GetBattlerTeraType(ctx->battlerAtk); // Safety check. if (GetActiveGimmick(ctx->battlerAtk) != GIMMICK_TERA) @@ -179,7 +179,7 @@ uq4_12_t GetTeraMultiplier(struct DamageContext *ctx) } } -u16 GetTeraTypeRGB(u32 type) +u16 GetTeraTypeRGB(enum Type type) { return gTypesInfo[type].teraTypeRGBValue; } diff --git a/src/battle_tower.c b/src/battle_tower.c index 183afaf10a..0f31106142 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -1647,7 +1647,7 @@ void CreateFacilityMon(const struct TrainerMon *fmon, u16 level, u8 fixedIV, u32 } if (fmon->teraType) { - u32 data = fmon->teraType; + enum Type data = fmon->teraType; SetMonData(dst, MON_DATA_TERA_TYPE, &data); } diff --git a/src/battle_util.c b/src/battle_util.c index c7c6f49e58..187ce52955 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -212,7 +212,7 @@ static const struct BattleWeatherInfo sBattleWeatherInfo[BATTLE_WEATHER_COUNT] = // Helper function for actual dmg calcs during battle. For simulated AI dmg, CalcTypeEffectivenessMultiplier should be used directly // This should stay a static function. Ideally everything else is handled through CalcTypeEffectivenessMultiplier just like AI -static uq4_12_t CalcTypeEffectivenessMultiplierHelper(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, enum Ability abilityAtk, enum Ability abilityDef, bool32 recordAbilities) +static uq4_12_t CalcTypeEffectivenessMultiplierHelper(u32 move, enum Type moveType, u32 battlerAtk, u32 battlerDef, enum Ability abilityAtk, enum Ability abilityDef, bool32 recordAbilities) { struct DamageContext ctx = {0}; ctx.battlerAtk = battlerAtk; @@ -365,7 +365,7 @@ bool32 HandleMoveTargetRedirection(void) { u32 redirectorOrderNum = MAX_BATTLERS_COUNT; u16 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove); - u32 moveType = GetBattleMoveType(gCurrentMove); + enum Type moveType = GetBattleMoveType(gCurrentMove); enum BattleMoveEffects moveEffect = GetMoveEffect(gCurrentMove); u32 side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); enum Ability ability = GetBattlerAbility(gBattleStruct->moveTarget[gBattlerAttacker]); @@ -2574,7 +2574,7 @@ static enum MoveCanceller CancellerWeatherPrimal(struct BattleContext *ctx) enum MoveCanceller effect = MOVE_STEP_SUCCESS; if (HasWeatherEffect() && GetMovePower(ctx->currentMove) > 0) { - u32 moveType = GetBattleMoveType(ctx->currentMove); + enum Type moveType = GetBattleMoveType(ctx->currentMove); if (moveType == TYPE_FIRE && (gBattleWeather & B_WEATHER_RAIN_PRIMAL) && (GetGenConfig(GEN_CONFIG_POWDER_RAIN) >= GEN_7 || !TryActivatePowderStatus(ctx->currentMove))) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PRIMAL_WEATHER_FIZZLED_BY_RAIN; @@ -2796,7 +2796,7 @@ static enum MoveCanceller CancellerPriorityBlock(struct BattleContext *ctx) static enum MoveCanceller CancellerProtean(struct BattleContext *ctx) { - u32 moveType = GetBattleMoveType(ctx->currentMove); + enum Type moveType = GetBattleMoveType(ctx->currentMove); if (ProteanTryChangeType(ctx->battlerAtk, ctx->abilities[ctx->battlerAtk], ctx->currentMove, moveType)) { if (GetGenConfig(GEN_PROTEAN_LIBERO) >= GEN_9) @@ -3286,7 +3286,7 @@ static void ForewarnChooseMove(u32 battler) bool32 ChangeTypeBasedOnTerrain(u32 battler) { - u32 battlerType; + enum Type battlerType; if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) battlerType = TYPE_ELECTRIC; @@ -3453,7 +3453,7 @@ bool32 CanAbilityBlockMove(u32 battlerAtk, u32 battlerDef, enum Ability abilityA return TRUE; } -bool32 CanAbilityAbsorbMove(u32 battlerAtk, u32 battlerDef, enum Ability abilityDef, u32 move, u32 moveType, enum FunctionCallOption option) +bool32 CanAbilityAbsorbMove(u32 battlerAtk, u32 battlerDef, enum Ability abilityDef, u32 move, enum Type moveType, enum FunctionCallOption option) { enum MoveAbsorbed effect = MOVE_ABSORBED_BY_NO_ABILITY; const u8 *battleScript = NULL; @@ -3861,7 +3861,8 @@ bool32 TryFieldEffects(enum FieldEffectCases caseId) u32 AbilityBattleEffects(enum AbilityEffect caseID, u32 battler, enum Ability ability, u32 special, u32 moveArg) { u32 effect = 0; - u32 moveType = 0, move = 0; + enum Type moveType = 0; + u32 move = 0; u32 side = 0; u32 i = 0, j = 0; u32 partner = 0; @@ -6200,7 +6201,7 @@ u32 GetBattleMoveTarget(u16 move, u8 setTarget) { u8 targetBattler = 0; u32 moveTarget, side; - u32 moveType = GetBattleMoveType(move); + enum Type moveType = GetBattleMoveType(move); if (setTarget != NO_TARGET_OVERRIDE) moveTarget = setTarget - 1; @@ -6796,7 +6797,7 @@ u32 CalcFuryCutterBasePower(u32 basePower, u32 furyCutterCounter) return basePower; } -static inline u32 IsFieldMudSportAffected(u32 moveType) +static inline u32 IsFieldMudSportAffected(enum Type moveType) { if (moveType == TYPE_ELECTRIC && (gFieldStatuses & STATUS_FIELD_MUDSPORT)) return TRUE; @@ -6813,7 +6814,7 @@ static inline u32 IsFieldMudSportAffected(u32 moveType) return FALSE; } -static inline u32 IsFieldWaterSportAffected(u32 moveType) +static inline u32 IsFieldWaterSportAffected(enum Type moveType) { if (moveType == TYPE_FIRE && (gFieldStatuses & STATUS_FIELD_WATERSPORT)) return TRUE; @@ -7111,7 +7112,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(struct DamageContext *ctx) u32 battlerAtk = ctx->battlerAtk; u32 battlerDef = ctx->battlerDef; u32 move = ctx->move; - u32 moveType = ctx->moveType; + enum Type moveType = ctx->moveType; enum BattleMoveEffects moveEffect = GetMoveEffect(move); uq4_12_t holdEffectModifier; @@ -7448,7 +7449,7 @@ static inline u32 CalcAttackStat(struct DamageContext *ctx) u32 battlerAtk = ctx->battlerAtk; u32 battlerDef = ctx->battlerDef; u32 move = ctx->move; - u32 moveType = ctx->moveType; + enum Type moveType = ctx->moveType; enum BattleMoveEffects moveEffect = GetMoveEffect(move); atkBaseSpeciesId = GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species); @@ -8365,7 +8366,7 @@ static inline s32 DoFutureSightAttackDamageCalcVars(struct DamageContext *ctx) u32 battlerAtk = ctx->battlerAtk; u32 battlerDef = ctx->battlerDef; u32 move = ctx->move; - u32 moveType = ctx->moveType; + enum Type moveType = ctx->moveType; struct Pokemon *party = GetBattlerParty(battlerAtk); struct Pokemon *partyMon = &party[gWishFutureKnock.futureSightPartyIndex[battlerDef]]; @@ -8461,7 +8462,7 @@ s32 CalculateMoveDamageVars(struct DamageContext *ctx) return DoMoveDamageCalcVars(ctx); } -static inline void MulByTypeEffectiveness(struct DamageContext *ctx, uq4_12_t *modifier, u32 defType) +static inline void MulByTypeEffectiveness(struct DamageContext *ctx, uq4_12_t *modifier, enum Type defType) { uq4_12_t mod = GetTypeModifier(ctx->moveType, defType); @@ -8514,7 +8515,7 @@ static inline void MulByTypeEffectiveness(struct DamageContext *ctx, uq4_12_t *m *modifier = uq4_12_multiply(*modifier, mod); } -static inline void TryNoticeIllusionInTypeEffectiveness(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, uq4_12_t resultingModifier, u32 illusionSpecies) +static inline void TryNoticeIllusionInTypeEffectiveness(u32 move, enum Type moveType, u32 battlerAtk, u32 battlerDef, uq4_12_t resultingModifier, u32 illusionSpecies) { // Check if the type effectiveness would've been different if the pokemon really had the types as the disguise. uq4_12_t presumedModifier = UQ_4_12(1.0); @@ -8565,7 +8566,7 @@ void UpdateMoveResultFlags(uq4_12_t modifier, u16 *resultFlags) static inline uq4_12_t CalcTypeEffectivenessMultiplierInternal(struct DamageContext *ctx, uq4_12_t modifier) { u32 illusionSpecies; - u32 types[3]; + enum Type types[3]; GetBattlerTypes(ctx->battlerDef, FALSE, types); MulByTypeEffectiveness(ctx, &modifier, types[0]); @@ -8664,7 +8665,7 @@ uq4_12_t CalcTypeEffectivenessMultiplier(struct DamageContext *ctx) uq4_12_t CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, enum Ability abilityDef) { uq4_12_t modifier = UQ_4_12(1.0); - u32 moveType = GetBattleMoveType(move); + enum Type moveType = GetBattleMoveType(move); if (move != MOVE_STRUGGLE && moveType != TYPE_MYSTERY) { @@ -8702,13 +8703,13 @@ static uq4_12_t GetInverseTypeMultiplier(uq4_12_t multiplier) } } -uq4_12_t GetOverworldTypeEffectiveness(struct Pokemon *mon, u8 moveType) +uq4_12_t GetOverworldTypeEffectiveness(struct Pokemon *mon, enum Type moveType) { uq4_12_t modifier = UQ_4_12(1.0); enum Ability abilityDef = GetMonAbility(mon); u16 speciesDef = GetMonData(mon, MON_DATA_SPECIES); - u8 type1 = GetSpeciesType(speciesDef, 0); - u8 type2 = GetSpeciesType(speciesDef, 1); + enum Type type1 = GetSpeciesType(speciesDef, 0); + enum Type type2 = GetSpeciesType(speciesDef, 1); if (moveType == TYPE_MYSTERY) return modifier; @@ -8729,14 +8730,14 @@ uq4_12_t GetOverworldTypeEffectiveness(struct Pokemon *mon, u8 moveType) return modifier; } -uq4_12_t GetTypeModifier(u32 atkType, u32 defType) +uq4_12_t GetTypeModifier(enum Type atkType, enum Type defType) { if (B_FLAG_INVERSE_BATTLE != 0 && FlagGet(B_FLAG_INVERSE_BATTLE)) return GetInverseTypeMultiplier(gTypeEffectivenessTable[atkType][defType]); return gTypeEffectivenessTable[atkType][defType]; } -s32 GetStealthHazardDamageByTypesAndHP(enum TypeSideHazard hazardType, u8 type1, u8 type2, u32 maxHp) +s32 GetStealthHazardDamageByTypesAndHP(enum TypeSideHazard hazardType, enum Type type1, enum Type type2, u32 maxHp) { s32 dmg = 0; uq4_12_t modifier = UQ_4_12(1.0); @@ -8782,7 +8783,7 @@ s32 GetStealthHazardDamageByTypesAndHP(enum TypeSideHazard hazardType, u8 type1, s32 GetStealthHazardDamage(enum TypeSideHazard hazardType, u32 battler) { - u32 types[3]; + enum Type types[3]; GetBattlerTypes(battler, FALSE, types); u32 maxHp = gBattleMons[battler].maxHP; @@ -9133,7 +9134,7 @@ bool32 TryBattleFormChange(u32 battler, enum FormChanges method) bool32 DoBattlersShareType(u32 battler1, u32 battler2) { s32 i; - u32 types1[3], types2[3]; + enum Type types1[3], types2[3]; GetBattlerTypes(battler1, FALSE, types1); GetBattlerTypes(battler2, FALSE, types2); @@ -10047,13 +10048,13 @@ bool8 IsMonBannedFromSkyBattles(u16 species) } } -void GetBattlerTypes(u32 battler, bool32 ignoreTera, u32 types[static 3]) +void GetBattlerTypes(u32 battler, bool32 ignoreTera, enum Type types[static 3]) { // Terastallization. bool32 isTera = GetActiveGimmick(battler) == GIMMICK_TERA; if (!ignoreTera && isTera) { - u32 teraType = GetBattlerTeraType(battler); + enum Type teraType = GetBattlerTeraType(battler); if (teraType != TYPE_STELLAR) { types[0] = types[1] = types[2] = teraType; @@ -10077,14 +10078,14 @@ void GetBattlerTypes(u32 battler, bool32 ignoreTera, u32 types[static 3]) } } -u32 GetBattlerType(u32 battler, u32 typeIndex, bool32 ignoreTera) +enum Type GetBattlerType(u32 battler, u32 typeIndex, bool32 ignoreTera) { - u32 types[3]; + enum Type types[3]; GetBattlerTypes(battler, ignoreTera, types); return types[typeIndex]; } -void RemoveBattlerType(u32 battler, u8 type) +void RemoveBattlerType(u32 battler, enum Type type) { u32 i; if (GetActiveGimmick(battler) == GIMMICK_TERA) // don't remove type if Terastallized @@ -10162,7 +10163,7 @@ bool32 CanTargetPartner(u32 battlerAtk, u32 battlerDef) && battlerDef != BATTLE_PARTNER(battlerAtk)); } -static inline bool32 DoesBattlerHaveAbilityImmunity(u32 battlerAtk, u32 battlerDef, u32 moveType) +static inline bool32 DoesBattlerHaveAbilityImmunity(u32 battlerAtk, u32 battlerDef, enum Type moveType) { enum Ability abilityDef = GetBattlerAbility(battlerDef); @@ -10172,14 +10173,14 @@ static inline bool32 DoesBattlerHaveAbilityImmunity(u32 battlerAtk, u32 battlerD bool32 TargetFullyImmuneToCurrMove(u32 battlerAtk, u32 battlerDef) { - u32 moveType = GetBattleMoveType(gCurrentMove); + enum Type moveType = GetBattleMoveType(gCurrentMove); return ((CalcTypeEffectivenessMultiplierHelper(gCurrentMove, moveType, battlerAtk, battlerDef, GetBattlerAbility(battlerAtk), GetBattlerAbility(battlerDef), FALSE) == UQ_4_12(0.0)) || IsBattlerProtected(battlerAtk, battlerDef, gCurrentMove) || !BreaksThroughSemiInvulnerablity(battlerDef, gCurrentMove) || DoesBattlerHaveAbilityImmunity(battlerAtk, battlerDef, moveType)); } -u32 GetBattleMoveType(u32 move) +enum Type GetBattleMoveType(u32 move) { if (gMain.inBattle && gBattleStruct->dynamicMoveType) return gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; @@ -10319,7 +10320,7 @@ void UpdateStallMons(void) return; if (!IsDoubleBattle() || gMovesInfo[gCurrentMove].target == MOVE_TARGET_SELECTED) { - u32 moveType = GetBattleMoveType(gCurrentMove); // Probably doesn't handle dynamic move types right now + enum Type moveType = GetBattleMoveType(gCurrentMove); // Probably doesn't handle dynamic move types right now enum Ability abilityAtk = GetBattlerAbility(gBattlerAttacker); enum Ability abilityDef = GetBattlerAbility(gBattlerTarget); if (CanAbilityAbsorbMove(gBattlerAttacker, gBattlerTarget, abilityDef, gCurrentMove, moveType, CHECK_TRIGGER)) diff --git a/src/battle_z_move.c b/src/battle_z_move.c index be3ae07265..4b517ccc8f 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -418,7 +418,7 @@ static void ZMoveSelectionDisplayPpNumber(u32 battler) static void ZMoveSelectionDisplayMoveType(u16 zMove, u32 battler) { u8 *txtPtr, *end; - u32 zMoveType = GetBattleMoveType(zMove); + enum Type zMoveType = GetBattleMoveType(zMove); txtPtr = StringCopy(gDisplayedStringBattle, gText_MoveInterfaceType); *(txtPtr)++ = EXT_CTRL_CODE_BEGIN; diff --git a/src/data/battle_frontier/battle_pyramid_wild_requirements.h b/src/data/battle_frontier/battle_pyramid_wild_requirements.h index 635545b3a2..6679905f58 100644 --- a/src/data/battle_frontier/battle_pyramid_wild_requirements.h +++ b/src/data/battle_frontier/battle_pyramid_wild_requirements.h @@ -7,7 +7,7 @@ struct BattlePyramidRequirement { const u16 *moves; /* use moves instead of effects so we don't need to find moves with said effect in our loop */ enum Ability abilities[10]; u8 nAbilities; - u8 type; + enum Type type; u8 nMoves; const u16 *evoItems; u8 nEvoItems; diff --git a/src/dexnav.c b/src/dexnav.c index fe4b267a70..0d17b90e41 100644 --- a/src/dexnav.c +++ b/src/dexnav.c @@ -2123,7 +2123,7 @@ static void PrintCurrentSpeciesInfo(void) { u16 species = DexNavGetSpecies(); enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(species); - u8 type1, type2; + enum Type type1, type2; if (!GetSetPokedexFlag(dexNum, FLAG_GET_SEEN)) species = SPECIES_NONE; diff --git a/src/overworld.c b/src/overworld.c index 1d87ca44fc..21c0d7c9f6 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1625,7 +1625,7 @@ void UpdateTimeOfDay(void) #undef DEFAULT_WEIGHT // Whether a map type is naturally lit/outside -bool32 MapHasNaturalLight(u8 mapType) +bool32 MapHasNaturalLight(enum MapType mapType) { return (OW_ENABLE_DNS && (mapType == MAP_TYPE_TOWN diff --git a/src/pokedex.c b/src/pokedex.c index 7f2ebe2d9c..d8265a4cee 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1426,7 +1426,7 @@ static const u8 sOrderOptions[] = ORDER_SMALLEST, }; -static const u8 sDexSearchTypeIds[NUMBER_OF_MON_TYPES] = +static const enum Type sDexSearchTypeIds[NUMBER_OF_MON_TYPES] = { TYPE_NONE, TYPE_NORMAL, @@ -4940,12 +4940,12 @@ 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, enum BodyColor bodyColor, u8 type1, u8 type2) +static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, enum BodyColor bodyColor, enum Type type1, enum Type type2) { u16 species; u16 i; u16 resultsCount; - u8 types[2]; + enum Type types[2]; CreatePokedexList(dexMode, order); @@ -5352,8 +5352,8 @@ static void Task_StartPokedexSearch(u8 taskId) u8 order = GetSearchModeSelection(taskId, SEARCH_ORDER); u8 abcGroup = GetSearchModeSelection(taskId, SEARCH_NAME); enum BodyColor bodyColor = GetSearchModeSelection(taskId, SEARCH_COLOR); - u8 type1 = GetSearchModeSelection(taskId, SEARCH_TYPE_LEFT); - u8 type2 = GetSearchModeSelection(taskId, SEARCH_TYPE_RIGHT); + enum Type type1 = GetSearchModeSelection(taskId, SEARCH_TYPE_LEFT); + enum Type type2 = GetSearchModeSelection(taskId, SEARCH_TYPE_RIGHT); DoPokedexSearch(dexMode, order, abcGroup, bodyColor, type1, type2); gTasks[taskId].func = Task_WaitAndCompleteSearch; diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index 9a28f13a54..ca60a935a3 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -1913,7 +1913,7 @@ static const u8 sOrderOptions[] = ORDER_SMALLEST, }; -static const u8 sDexSearchTypeIds[NUMBER_OF_MON_TYPES] = +static const enum Type sDexSearchTypeIds[NUMBER_OF_MON_TYPES] = { TYPE_NONE, TYPE_NORMAL, @@ -4358,7 +4358,7 @@ static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) } static void PrintCurrentSpeciesTypeInfo(u8 newEntry, u16 species) { - u8 type1, type2; + enum Type type1, type2; if (!newEntry) { @@ -7834,12 +7834,12 @@ static void Task_ClosePokedexFromSearchResultsStartMenu(u8 taskId) //* Search code * //* * //************************************ -static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, enum BodyColor bodyColor, u8 type1, u8 type2) +static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, enum BodyColor bodyColor, enum Type type1, enum Type type2) { u16 species; u16 i; u16 resultsCount; - u8 types[2]; + enum Type types[2]; CreatePokedexList(dexMode, order); @@ -8251,8 +8251,8 @@ static void Task_StartPokedexSearch(u8 taskId) u8 order = GetSearchModeSelection(taskId, SEARCH_ORDER); u8 abcGroup = GetSearchModeSelection(taskId, SEARCH_NAME); enum BodyColor bodyColor = GetSearchModeSelection(taskId, SEARCH_COLOR); - u8 type1 = GetSearchModeSelection(taskId, SEARCH_TYPE_LEFT); - u8 type2 = GetSearchModeSelection(taskId, SEARCH_TYPE_RIGHT); + enum Type type1 = GetSearchModeSelection(taskId, SEARCH_TYPE_LEFT); + enum Type type2 = GetSearchModeSelection(taskId, SEARCH_TYPE_RIGHT); DoPokedexSearch(dexMode, order, abcGroup, bodyColor, type1, type2); gTasks[taskId].func = Task_WaitAndCompleteSearch; diff --git a/src/pokemon.c b/src/pokemon.c index a7cdae8af7..aca4498ad7 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1128,7 +1128,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, SetBoxMonData(boxMon, MON_DATA_POKEBALL, &value); SetBoxMonData(boxMon, MON_DATA_OT_GENDER, &gSaveBlock2Ptr->playerGender); - u32 teraType = (boxMon->personality & 0x1) == 0 ? GetSpeciesType(species, 0) : GetSpeciesType(species, 1); + enum Type teraType = (boxMon->personality & 0x1) == 0 ? GetSpeciesType(species, 0) : GetSpeciesType(species, 1); SetBoxMonData(boxMon, MON_DATA_TERA_TYPE, &teraType); if (fixedIV < USE_RANDOM_IVS) @@ -2740,7 +2740,7 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data) } else if (substruct0->teraType == TYPE_NONE) // Tera Type hasn't been modified so we can just use the personality { - const u8 *types = gSpeciesInfo[substruct0->species].types; + const enum Type *types = gSpeciesInfo[substruct0->species].types; retVal = (boxMon->personality & 0x1) == 0 ? types[0] : types[1]; } else @@ -3533,7 +3533,7 @@ u32 GetSpeciesWeight(u16 species) return gSpeciesInfo[SanitizeSpeciesId(species)].weight; } -u32 GetSpeciesType(u16 species, u8 slot) +enum Type GetSpeciesType(u16 species, u8 slot) { return gSpeciesInfo[SanitizeSpeciesId(species)].types[slot]; } @@ -7013,7 +7013,7 @@ void UpdateMonPersonality(struct BoxPokemon *boxMon, u32 personality) bool32 isShiny = GetBoxMonData(boxMon, MON_DATA_IS_SHINY, NULL); u32 hiddenNature = GetBoxMonData(boxMon, MON_DATA_HIDDEN_NATURE, NULL); - u32 teraType = GetBoxMonData(boxMon, MON_DATA_TERA_TYPE, NULL); + enum Type teraType = GetBoxMonData(boxMon, MON_DATA_TERA_TYPE, NULL); old = *boxMon; old0 = &(GetSubstruct(&old, old.personality, SUBSTRUCT_TYPE_0)->type0); @@ -7128,9 +7128,9 @@ void UpdateDaysPassedSinceFormChange(u16 days) } } -u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state) +enum Type CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, enum MonState state) { - u32 moveType = GetDynamicMoveType(mon, move, battler, state); + enum Type moveType = GetDynamicMoveType(mon, move, battler, state); if (moveType != TYPE_NONE) return moveType; return GetMoveType(move); @@ -7210,7 +7210,7 @@ bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion) return FALSE; } -u32 GetTeraTypeFromPersonality(struct Pokemon *mon) +enum Type GetTeraTypeFromPersonality(struct Pokemon *mon) { const u8 *types = gSpeciesInfo[GetMonData(mon, MON_DATA_SPECIES)].types; return (GetMonData(mon, MON_DATA_PERSONALITY) & 0x1) == 0 ? types[0] : types[1]; @@ -7231,7 +7231,7 @@ void SavePlayerPartyMon(u32 index, struct Pokemon *mon) gSaveBlock1Ptr->playerParty[index] = *mon; } -u32 IsSpeciesOfType(u32 species, u32 type) +bool32 IsSpeciesOfType(u32 species, enum Type type) { if (gSpeciesInfo[species].types[0] == type || gSpeciesInfo[species].types[1] == type) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 5ecfb83f2a..f5b61f9cc7 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -163,7 +163,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData u8 sanity; // 0x35 u8 OTName[17]; // 0x36 u32 OTID; // 0x48 - u8 teraType; + enum Type teraType; u8 mintNature; } summary; u16 bgTilemapBuffers[PSS_PAGE_COUNT][2][0x400]; @@ -4252,7 +4252,7 @@ static void CreateMoveTypeIcons(void) } } -void SetTypeSpritePosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) +void SetTypeSpritePosAndPal(enum Type typeId, u8 x, u8 y, u8 spriteArrayId) { struct Sprite *sprite = &gSprites[sMonSummaryScreen->spriteIds[spriteArrayId]]; StartSpriteAnim(sprite, typeId); @@ -4297,7 +4297,7 @@ static void SetMoveTypeIcons(void) u32 i; struct PokeSummary *summary = &sMonSummaryScreen->summary; struct Pokemon *mon = &sMonSummaryScreen->currentMon; - u32 type; + enum Type type; for (i = 0; i < MAX_MON_MOVES; i++) { @@ -4334,7 +4334,7 @@ static void SetContestMoveTypeIcons(void) static void SetNewMoveTypeIcon(void) { - u32 type = GetMoveType(sMonSummaryScreen->newMove); + enum Type type = GetMoveType(sMonSummaryScreen->newMove); struct Pokemon *mon = &sMonSummaryScreen->currentMon; if (P_SHOW_DYNAMIC_TYPES) diff --git a/src/script_pokemon_util.c b/src/script_pokemon_util.c index 13ffc4948d..ae503d1016 100644 --- a/src/script_pokemon_util.c +++ b/src/script_pokemon_util.c @@ -319,7 +319,7 @@ void CheckTeraType(struct ScriptContext *ctx) void SetTeraType(struct ScriptContext *ctx) { - u32 type = ScriptReadByte(ctx); + enum Type type = ScriptReadByte(ctx); u32 partyIndex = VarGet(ScriptReadHalfword(ctx)); Script_RequestEffects(SCREFF_V1 | SCREFF_SAVE); @@ -332,7 +332,7 @@ void SetTeraType(struct ScriptContext *ctx) * if side/slot are assigned, it will create the mon at the assigned party location * if slot == PARTY_SIZE, it will give the mon to first available party or storage slot */ -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, enum ShinyMode shinyMode, bool8 gmaxFactor, u8 teraType, u8 dmaxLevel) +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, enum ShinyMode shinyMode, bool8 gmaxFactor, enum Type teraType, u8 dmaxLevel) { enum NationalDexOrder nationalDexNum; int sentToPc; @@ -559,7 +559,7 @@ void ScrCmd_createmon(struct ScriptContext *ctx) u16 move4 = PARSE_FLAG(20, MOVE_NONE); enum ShinyMode shinyMode = PARSE_FLAG(21, SHINY_MODE_RANDOM); bool8 gmaxFactor = PARSE_FLAG(22, FALSE); - u8 teraType = PARSE_FLAG(23, NUMBER_OF_MON_TYPES); + enum Type teraType = PARSE_FLAG(23, NUMBER_OF_MON_TYPES); u8 dmaxLevel = PARSE_FLAG(24, 0); u8 evs[NUM_STATS] = {hpEv, atkEv, defEv, speedEv, spAtkEv, spDefEv}; diff --git a/src/trade.c b/src/trade.c index 9a76c9aec5..73ee2fcbb9 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2482,7 +2482,7 @@ s32 GetGameProgressForLinkTrade(void) return TRADE_BOTH_PLAYERS_READY; } -int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, bool8 isModernFatefulEncounter) +int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, enum Type requestedType, u16 playerSpecies, bool8 isModernFatefulEncounter) { bool8 playerHasNationalDex = player.hasNationalDex; bool8 playerCanLinkNationally = player.canLinkNationally; diff --git a/src/trainer_slide.c b/src/trainer_slide.c index 3b94894a79..080c1d4bbc 100644 --- a/src/trainer_slide.c +++ b/src/trainer_slide.c @@ -312,7 +312,7 @@ static bool32 IsSlideInitalizedOrPlayed(enum TrainerSlideType slideId) return FALSE; } -void TryInitializeFirstSTABMoveTrainerSlide(u32 battlerDef, u32 battlerAtk, u32 moveType) +void TryInitializeFirstSTABMoveTrainerSlide(u32 battlerDef, u32 battlerAtk, enum Type moveType) { enum TrainerSlideType slideId = TRAINER_SLIDE_PLAYER_LANDS_FIRST_STAB_MOVE; diff --git a/src/type_icons.c b/src/type_icons.c index 08a30c2d5f..237c2c9a4f 100644 --- a/src/type_icons.c +++ b/src/type_icons.c @@ -14,18 +14,18 @@ static void LoadTypeIconsPerBattler(u32, u32); static bool32 UseDoubleBattleCoords(u32); -static u32 GetMonPublicType(u32, u32); +static enum Type GetMonPublicType(u32, u32); static bool32 ShouldHideUncaughtType(u32 species); static bool32 ShouldHideUnseenType(u32 species); -static u32 GetMonDefensiveTeraType(struct Pokemon *, struct Pokemon*, u32, u32, u32, u32); -static u32 IsIllusionActiveAndTypeUnchanged(struct Pokemon*, u32, u32); +static enum Type GetMonDefensiveTeraType(struct Pokemon *, struct Pokemon*, u32, u32, u32, u32); +static bool32 IsIllusionActiveAndTypeUnchanged(struct Pokemon*, u32, u32); -static void CreateSpriteFromType(u32, bool32, u32[], u32, u32); -static bool32 ShouldSkipSecondType(u32[], u32); +static void CreateSpriteFromType(u32, bool32, enum Type[], u32, u32); +static bool32 ShouldSkipSecondType(enum Type[], u32); static void SetTypeIconXY(s32*, s32*, u32, bool32, u32); -static void CreateSpriteAndSetTypeSpriteAttributes(u32, u32 x, u32 y, u32, u32, bool32); -static bool32 ShouldFlipTypeIcon(bool32, u32, u32); +static void CreateSpriteAndSetTypeSpriteAttributes(enum Type, u32 x, u32 y, u32, u32, bool32); +static bool32 ShouldFlipTypeIcon(bool32, u32, enum Type); static void SpriteCB_TypeIcon(struct Sprite*); static void DestroyTypeIcon(struct Sprite*); @@ -266,7 +266,8 @@ static void LoadTypeSpritesAndPalettes(void) static void LoadTypeIconsPerBattler(u32 battler, u32 position) { - u32 typeNum, types[2]; + u32 typeNum; + enum Type types[2]; u32 battlerId = GetBattlerAtPosition(position); bool32 useDoubleBattleCoords = UseDoubleBattleCoords(battlerId); @@ -294,11 +295,11 @@ static bool32 UseDoubleBattleCoords(u32 position) return TRUE; } -static u32 GetMonPublicType(u32 battlerId, u32 typeNum) +static enum Type GetMonPublicType(u32 battlerId, u32 typeNum) { - struct Pokemon* mon = GetBattlerMon(battlerId); + struct Pokemon *mon = GetBattlerMon(battlerId); u32 monSpecies = GetMonData(mon,MON_DATA_SPECIES,NULL); - struct Pokemon* monIllusion; + struct Pokemon *monIllusion; u32 illusionSpecies; if (ShouldHideUncaughtType(monSpecies) || ShouldHideUnseenType(monSpecies)) @@ -338,9 +339,9 @@ static bool32 ShouldHideUnseenType(u32 species) return TRUE; } -static u32 GetMonDefensiveTeraType(struct Pokemon * mon, struct Pokemon* monIllusion, u32 battlerId, u32 typeNum, u32 illusionSpecies, u32 monSpecies) +static enum Type GetMonDefensiveTeraType(struct Pokemon *mon, struct Pokemon *monIllusion, u32 battlerId, u32 typeNum, u32 illusionSpecies, u32 monSpecies) { - u32 teraType = GetBattlerTeraType(battlerId); + enum Type teraType = GetBattlerTeraType(battlerId); u32 targetSpecies; if (teraType != TYPE_STELLAR) @@ -351,7 +352,7 @@ static u32 GetMonDefensiveTeraType(struct Pokemon * mon, struct Pokemon* monIllu return GetSpeciesType(targetSpecies, typeNum); } -static u32 IsIllusionActiveAndTypeUnchanged(struct Pokemon* monIllusion, u32 monSpecies, u32 battlerId) +static bool32 IsIllusionActiveAndTypeUnchanged(struct Pokemon *monIllusion, u32 monSpecies, u32 battlerId) { u32 typeNum; @@ -365,7 +366,7 @@ static u32 IsIllusionActiveAndTypeUnchanged(struct Pokemon* monIllusion, u32 mon return TRUE; } -static void CreateSpriteFromType(u32 position, bool32 useDoubleBattleCoords, u32 types[], u32 typeNum, u32 battler) +static void CreateSpriteFromType(u32 position, bool32 useDoubleBattleCoords, enum Type types[], u32 typeNum, u32 battler) { s32 x = 0, y = 0; @@ -377,7 +378,7 @@ static void CreateSpriteFromType(u32 position, bool32 useDoubleBattleCoords, u32 CreateSpriteAndSetTypeSpriteAttributes(types[typeNum], x, y, position, battler, useDoubleBattleCoords); } -static bool32 ShouldSkipSecondType(u32 types[], u32 typeNum) +static bool32 ShouldSkipSecondType(enum Type types[], u32 typeNum) { if (!typeNum) return FALSE; @@ -394,7 +395,7 @@ static void SetTypeIconXY(s32* x, s32* y, u32 position, bool32 useDoubleBattleCo *y = sTypeIconPositions[position][useDoubleBattleCoords].y + (11 * typeNum); } -static void CreateSpriteAndSetTypeSpriteAttributes(u32 type, u32 x, u32 y, u32 position, u32 battler, bool32 useDoubleBattleCoords) +static void CreateSpriteAndSetTypeSpriteAttributes(enum Type type, u32 x, u32 y, u32 position, u32 battler, bool32 useDoubleBattleCoords) { struct Sprite* sprite; const struct SpriteTemplate* spriteTemplate = gTypesInfo[type].useSecondTypeIconPalette ? &sSpriteTemplate_TypeIcons2 : &sSpriteTemplate_TypeIcons1; @@ -413,7 +414,7 @@ static void CreateSpriteAndSetTypeSpriteAttributes(u32 type, u32 x, u32 y, u32 p StartSpriteAnim(sprite, type); } -static bool32 ShouldFlipTypeIcon(bool32 useDoubleBattleCoords, u32 position, u32 typeId) +static bool32 ShouldFlipTypeIcon(bool32 useDoubleBattleCoords, u32 position, enum Type typeId) { enum BattleSide side = (useDoubleBattleCoords) ? B_SIDE_OPPONENT : B_SIDE_PLAYER; @@ -423,7 +424,7 @@ static bool32 ShouldFlipTypeIcon(bool32 useDoubleBattleCoords, u32 position, u32 return !gTypesInfo[typeId].isSpecialCaseType; } -static void SpriteCB_TypeIcon(struct Sprite* sprite) +static void SpriteCB_TypeIcon(struct Sprite *sprite) { u32 position = sprite->tMonPosition; u32 battlerId = sprite->tBattlerId; @@ -487,7 +488,7 @@ static void FreeAllTypeIconResources(void) } } -static void (* const sShowTypesControllerFuncs[])(u32 battler) = +static void (*const sShowTypesControllerFuncs[])(u32 battler) = { PlayerHandleChooseMove, HandleChooseMoveAfterDma3, @@ -562,7 +563,7 @@ static s32 GetTypeIconSlideMovement(bool32 useDoubleBattleCoords, u32 position, static s32 GetTypeIconBounceMovement(s32 originalY, u32 position) { - struct Sprite* healthbox = &gSprites[gHealthboxSpriteIds[GetBattlerAtPosition(position)]]; + struct Sprite *healthbox = &gSprites[gHealthboxSpriteIds[GetBattlerAtPosition(position)]]; return originalY + healthbox->y2; } diff --git a/src/union_room.c b/src/union_room.c index 135cf3e982..a4e159646a 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -205,7 +205,7 @@ static EWRAM_DATA union } sWirelessLinkMain = {}; EWRAM_DATA struct RfuGameCompatibilityData gRfuPartnerCompatibilityData = {}; EWRAM_DATA u16 gUnionRoomOfferedSpecies = 0; -EWRAM_DATA u8 gUnionRoomRequestedMonType = 0; +EWRAM_DATA enum Type gUnionRoomRequestedMonType = 0; static EWRAM_DATA struct UnionRoomTrade sUnionRoomTrade = {}; static struct WirelessLink_Leader *sLeader; @@ -270,7 +270,7 @@ static void GetURoomActivityRejectMsg(u8 *, s32, u32); static u32 ConvPartnerUnameAndGetWhetherMetAlready(struct RfuPlayer *); static void GetURoomActivityStartMsg(u8 *, u8); static void UR_ClearBg0(void); -static s32 IsRequestedTradeInPlayerParty(u32, u32); +static s32 IsRequestedTradeInPlayerParty(enum Type, u32); static bool32 UR_PrintFieldMessage(const u8 *); static s32 GetChatLeaderActionRequestMessage(u8 *, u32, u16 *, struct WirelessLink_URoom *); static void Task_InitUnionRoom(u8 taskId); @@ -4104,7 +4104,7 @@ static void TradeBoardPrintItemInfo(u8 windowId, u8 y, struct RfuGameData *data, { u8 levelStr[4]; u16 species = data->tradeSpecies; - u8 type = data->tradeType; + enum Type type = data->tradeType; u8 level = data->tradeLevel; PrintUnionRoomText(windowId, FONT_NORMAL, playerName, 8, y, colorIdx); @@ -4174,7 +4174,7 @@ static s32 GetUnionRoomPlayerGender(s32 playerIdx, struct RfuPlayerList *list) return list->players[playerIdx].rfu.data.playerGender; } -static s32 IsRequestedTradeInPlayerParty(u32 type, u32 species) +static s32 IsRequestedTradeInPlayerParty(enum Type type, u32 species) { s32 i; diff --git a/src/wild_encounter.c b/src/wild_encounter.c index f6bf7a7598..f99441d365 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -49,9 +49,9 @@ static void ApplyFluteEncounterRateMod(u32 *encRate); static void ApplyCleanseTagEncounterRateMod(u32 *encRate); static u8 GetMaxLevelOfSpeciesInWildTable(const struct WildPokemon *wildMon, u16 species, enum WildPokemonArea area); #ifdef BUGFIX -static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, enum Ability ability, u8 *monIndex, u32 size); +static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, enum Type type, enum Ability ability, u8 *monIndex, u32 size); #else -static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, enum Ability ability, u8 *monIndex); +static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, enum Type type, enum Ability ability, u8 *monIndex); #endif static bool8 IsAbilityAllowingEncounter(u8 level); @@ -1123,7 +1123,7 @@ static bool8 IsAbilityAllowingEncounter(u8 level) return TRUE; } -static bool8 TryGetRandomWildMonIndexByType(const struct WildPokemon *wildMon, u8 type, u8 numMon, u8 *monIndex) +static bool8 TryGetRandomWildMonIndexByType(const struct WildPokemon *wildMon, enum Type type, u8 numMon, u8 *monIndex) { u8 validIndexes[numMon]; // variable length array, an interesting feature u8 i, validMonCount; @@ -1177,9 +1177,9 @@ static u8 GetMaxLevelOfSpeciesInWildTable(const struct WildPokemon *wildMon, u16 } #ifdef BUGFIX -static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, enum Ability ability, u8 *monIndex, u32 size) +static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, enum Type type, enum Ability ability, u8 *monIndex, u32 size) #else -static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, enum Ability ability, u8 *monIndex) +static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, enum Type type, enum Ability ability, u8 *monIndex) #endif { if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) diff --git a/test/battle/ability/anticipation.c b/test/battle/ability/anticipation.c index a4a3bef77f..ee5b602a13 100644 --- a/test/battle/ability/anticipation.c +++ b/test/battle/ability/anticipation.c @@ -100,7 +100,8 @@ SINGLE_BATTLE_TEST("Anticipation doesn't consider Gravity into their effectivene SINGLE_BATTLE_TEST("Anticipation counts Counter, Metal Burst or Mirror Coat as attacking moves of their types (Gen5+)") { - u32 move, species, typeAtk, typeDef; + u32 move, species; + enum Type typeAtk, typeDef; PARAMETRIZE { move = MOVE_COUNTER; species = SPECIES_RATICATE; typeAtk = TYPE_FIGHTING; typeDef = TYPE_NORMAL; } PARAMETRIZE { move = MOVE_METAL_BURST; species = SPECIES_ROGGENROLA; typeAtk = TYPE_STEEL; typeDef = TYPE_ROCK; } PARAMETRIZE { move = MOVE_MIRROR_COAT; species = SPECIES_NIDORINO; typeAtk = TYPE_PSYCHIC; typeDef = TYPE_POISON; } diff --git a/test/battle/ability/mimicry.c b/test/battle/ability/mimicry.c index 67eab20575..5cdea7276f 100644 --- a/test/battle/ability/mimicry.c +++ b/test/battle/ability/mimicry.c @@ -13,7 +13,7 @@ SINGLE_BATTLE_TEST("Mimicry changes the battler's type based on Terrain") { u32 j; u32 terrainMove = MOVE_NONE; - u32 terrainType = TYPE_NONE; + enum Type terrainType = TYPE_NONE; for (j = 0; j < ARRAY_COUNT(terrainData); j++) PARAMETRIZE { terrainMove = terrainData[j][0]; terrainType = terrainData[j][1]; } diff --git a/test/battle/ability/parental_bond.c b/test/battle/ability/parental_bond.c index 79accaf0a2..1909efe281 100644 --- a/test/battle/ability/parental_bond.c +++ b/test/battle/ability/parental_bond.c @@ -105,7 +105,8 @@ DOUBLE_BATTLE_TEST("Parental Bond does not convert multi-target moves into a two SINGLE_BATTLE_TEST("Parental Bond-converted moves only hit once on Lightning Rod/Storm Drain mons") { - u16 move, species, type; + u16 move, species; + enum Type type; enum Ability ability; PARAMETRIZE { move = MOVE_THUNDERBOLT; ability = ABILITY_LIGHTNING_ROD; species = SPECIES_RAICHU; type = TYPE_ELECTRIC; } PARAMETRIZE { move = MOVE_SURF; ability = ABILITY_STORM_DRAIN; species = SPECIES_LILEEP; type = TYPE_WATER; } diff --git a/test/battle/ability/sand_force.c b/test/battle/ability/sand_force.c index 7592c5afec..ba062f3fa3 100644 --- a/test/battle/ability/sand_force.c +++ b/test/battle/ability/sand_force.c @@ -3,8 +3,8 @@ SINGLE_BATTLE_TEST("Sand Force prevents damage from sandstorm") { - u32 type1 = GetSpeciesType(SPECIES_SHELLOS, 0); - u32 type2 = GetSpeciesType(SPECIES_SHELLOS, 1); + enum Type type1 = GetSpeciesType(SPECIES_SHELLOS, 0); + enum Type type2 = GetSpeciesType(SPECIES_SHELLOS, 1); GIVEN { ASSUME(type1 != TYPE_ROCK && type2 != TYPE_ROCK); ASSUME(type1 != TYPE_GROUND && type2 != TYPE_GROUND); diff --git a/test/battle/ability/sand_rush.c b/test/battle/ability/sand_rush.c index 4d557348e5..9d6ef98274 100644 --- a/test/battle/ability/sand_rush.c +++ b/test/battle/ability/sand_rush.c @@ -3,8 +3,8 @@ SINGLE_BATTLE_TEST("Sand Rush prevents damage from sandstorm") { - u32 type1 = GetSpeciesType(SPECIES_STOUTLAND, 0); - u32 type2 = GetSpeciesType(SPECIES_STOUTLAND, 1); + enum Type type1 = GetSpeciesType(SPECIES_STOUTLAND, 0); + enum Type type2 = GetSpeciesType(SPECIES_STOUTLAND, 1); GIVEN { ASSUME(type1 != TYPE_ROCK && type2 != TYPE_ROCK); ASSUME(type1 != TYPE_GROUND && type2 != TYPE_GROUND); diff --git a/test/battle/gimmick/terastal.c b/test/battle/gimmick/terastal.c index 37a6d515b3..56adddee1a 100644 --- a/test/battle/gimmick/terastal.c +++ b/test/battle/gimmick/terastal.c @@ -822,7 +822,7 @@ SINGLE_BATTLE_TEST("(TERA) Pokemon with Tera forms change upon Terastallizing") SINGLE_BATTLE_TEST("(TERA) All type indicators function correctly") { - u32 type; + enum Type type; PARAMETRIZE { type = TYPE_NONE; } PARAMETRIZE { type = TYPE_NORMAL; } PARAMETRIZE { type = TYPE_FIGHTING; } @@ -854,7 +854,7 @@ SINGLE_BATTLE_TEST("(TERA) All type indicators function correctly") SINGLE_BATTLE_TEST("(TERA) All type indicators function correctly - Opponent") { - u32 type; + enum Type type; PARAMETRIZE { type = TYPE_NONE; } PARAMETRIZE { type = TYPE_NORMAL; } PARAMETRIZE { type = TYPE_FIGHTING; } diff --git a/test/battle/hold_effect/weakness_berry.c b/test/battle/hold_effect/weakness_berry.c index 17adb08aa3..4958c67811 100644 --- a/test/battle/hold_effect/weakness_berry.c +++ b/test/battle/hold_effect/weakness_berry.c @@ -25,7 +25,8 @@ static const u16 sMoveItemTable[][4] = SINGLE_BATTLE_TEST("Weakness berries decrease the base power of moves by half", s16 damage) { - u32 move = 0, item = 0, type = 0, defender = 0; + u32 move = 0, item = 0, defender = 0; + enum Type type = TYPE_NONE; for (u32 j = 0; j < ARRAY_COUNT(sMoveItemTable); j++) { @@ -62,7 +63,8 @@ SINGLE_BATTLE_TEST("Weakness berries decrease the base power of moves by half", SINGLE_BATTLE_TEST("Weakness berries do not activate unless a move is super effective", s16 damage) { - u32 move = 0, item = 0, type = 0, defender = 0; + u32 move = 0, item = 0, defender = 0; + enum Type type = TYPE_NONE; for (u32 j = 0; j < ARRAY_COUNT(sMoveItemTable); j++) { diff --git a/test/battle/move_effect/hidden_power.c b/test/battle/move_effect/hidden_power.c index a04482eb29..9ac88e687f 100644 --- a/test/battle/move_effect/hidden_power.c +++ b/test/battle/move_effect/hidden_power.c @@ -31,7 +31,8 @@ ASSUMPTIONS // IV combinations sourced from https://www.smogon.com/forums/threads/hidden-power-iv-combinations.78083/ SINGLE_BATTLE_TEST("Hidden Power's type is determined by IVs") { - u32 type, j, foeType, foeSpecies, foeItem; + enum Type type, foeType, j; + u32 foeSpecies, foeItem; u32 hp, atk, def, spAtk, spDef, speed; bool32 hidden; diff --git a/test/battle/move_effect/tera_blast.c b/test/battle/move_effect/tera_blast.c index 060e28802d..1e041dda97 100644 --- a/test/battle/move_effect/tera_blast.c +++ b/test/battle/move_effect/tera_blast.c @@ -24,7 +24,7 @@ SINGLE_BATTLE_TEST("Tera Blast changes from Normal-type to the user's Tera Type" SINGLE_BATTLE_TEST("Tera Blast has correct effectiveness for every Tera Type") { u32 species; - u32 type; + enum Type type; PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_FLYING; } PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_POISON; } diff --git a/test/battle/weather/sandstorm.c b/test/battle/weather/sandstorm.c index 96a440a10e..d01bd72ce4 100644 --- a/test/battle/weather/sandstorm.c +++ b/test/battle/weather/sandstorm.c @@ -97,8 +97,8 @@ SINGLE_BATTLE_TEST("Sandstorm damage rounds properly when maxHP < 16") SINGLE_BATTLE_TEST("Sandstorm doesn't do damage when weather is negated") { - u32 type1 = GetSpeciesType(SPECIES_STOUTLAND, 0); - u32 type2 = GetSpeciesType(SPECIES_STOUTLAND, 1); + enum Type type1 = GetSpeciesType(SPECIES_STOUTLAND, 0); + enum Type type2 = GetSpeciesType(SPECIES_STOUTLAND, 1); GIVEN { ASSUME(type1 != TYPE_ROCK && type2 != TYPE_ROCK); ASSUME(type1 != TYPE_GROUND && type2 != TYPE_GROUND); diff --git a/test/pokemon.c b/test/pokemon.c index d6c0cb4d42..207124225e 100644 --- a/test/pokemon.c +++ b/test/pokemon.c @@ -25,7 +25,8 @@ TEST("Nature independent from Hidden Nature") TEST("Terastallization type defaults to primary or secondary type") { - u32 i, teraType; + u32 i; + enum Type teraType; struct Pokemon mon; for (i = 0; i < 128; i++) PARAMETRIZE {} CreateMon(&mon, SPECIES_PIDGEY, 100, 0, FALSE, 0, OT_ID_PRESET, 0); @@ -36,7 +37,8 @@ TEST("Terastallization type defaults to primary or secondary type") TEST("Terastallization type can be set to any type except TYPE_NONE") { - u32 i, teraType; + u32 i; + enum Type teraType; struct Pokemon mon; for (i = 1; i < NUMBER_OF_MON_TYPES; i++) { @@ -49,7 +51,8 @@ TEST("Terastallization type can be set to any type except TYPE_NONE") TEST("Terastallization type is reset to the default types when setting Tera Type back to TYPE_NONE") { - u32 i, teraType, typeNone; + u32 i; + enum Type teraType, typeNone; struct Pokemon mon; for (i = 1; i < NUMBER_OF_MON_TYPES; i++) { diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index 58acd022d5..cc036f2069 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -2162,7 +2162,7 @@ void GigantamaxFactor_(u32 sourceLine, bool32 gigantamaxFactor) SetGimmick(sourceLine, DATA.currentPosition, DATA.currentPartyIndex, GIMMICK_DYNAMAX); } -void TeraType_(u32 sourceLine, u32 teraType) +void TeraType_(u32 sourceLine, enum Type teraType) { INVALID_IF(!DATA.currentMon, "TeraType outside of PLAYER/OPPONENT"); SetMonData(DATA.currentMon, MON_DATA_TERA_TYPE, &teraType); diff --git a/test/text.c b/test/text.c index bc18e2e87d..05e9ca1ffd 100644 --- a/test/text.c +++ b/test/text.c @@ -535,7 +535,7 @@ TEST("Type names fit on Battle Screen") { u32 i; const u32 fontId = FONT_NARROWER, widthPx = 39; - u32 type = TYPE_NORMAL; + enum Type type = TYPE_NORMAL; for (i = 0; i < NUMBER_OF_MON_TYPES; i++) { PARAMETRIZE_LABEL("%S", gTypesInfo[i].name) { type = i; } @@ -547,7 +547,7 @@ TEST("Type names fit on Pokedex Search Screen") { u32 i; const u32 fontId = FONT_NARROWER, widthPx = 38; - u32 type = TYPE_NORMAL; + enum Type type = TYPE_NORMAL; for (i = 0; i < NUMBER_OF_MON_TYPES; i++) { PARAMETRIZE_LABEL("%S", gTypesInfo[i].name) { type = i; } @@ -570,9 +570,9 @@ TEST("Battle strings fit on the battle message window") s32 sixDigitNines = 999999; // 36 pixels. u8 nickname[POKEMON_NAME_LENGTH + 1] = _("MMMMMMMMMMMM"); // 72 pixels. u32 longMoveID = MOVE_NATURES_MADNESS; // 89 pixels. - enum Ability longAbilityID = ABILITY_SUPERSWEET_SYRUP; // 91 pixels. + enum Ability longAbilityID = ABILITY_SUPERSWEET_SYRUP; // 91 pixels. u32 longStatName = STAT_EVASION; // 40 pixels. - u32 longTypeName = TYPE_ELECTRIC; // 43 pixels. + enum Type longTypeName = TYPE_ELECTRIC; // 43 pixels. u32 longSpeciesName = SPECIES_SANDY_SHOCKS; // 47 pixels. u32 longItemName = ITEM_UNREMARKABLE_TEACUP; // 73 pixels. u8 boxName[9] = _("MMMMMMMM"); // 54 pixels.