From c393454d186e284b3727f143e9dabce676d0b066 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 17 Jun 2024 12:17:16 +0200 Subject: [PATCH] Get rid of hardcoded stat raise anim values --- include/battle_anim.h | 8 ++++---- src/battle_util.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/battle_anim.h b/include/battle_anim.h index fafde10c5b86..8e21f2f84d1a 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -203,10 +203,10 @@ u8 GetBattlerSpriteDefault_Y(u8 battlerId); u8 GetSubstituteSpriteDefault_Y(u8 battlerId); // battle_anim_status_effects.c -#define STAT_ANIM_PLUS1 MOVE_EFFECT_ATK_PLUS_1 - 1 -#define STAT_ANIM_PLUS2 MOVE_EFFECT_ATK_PLUS_2 - 1 -#define STAT_ANIM_MINUS1 MOVE_EFFECT_ATK_MINUS_1 - 1 -#define STAT_ANIM_MINUS2 MOVE_EFFECT_ATK_MINUS_2 - 1 +#define STAT_ANIM_PLUS1 (MOVE_EFFECT_ATK_PLUS_1 - 1) +#define STAT_ANIM_PLUS2 (MOVE_EFFECT_ATK_PLUS_2 - 1) +#define STAT_ANIM_MINUS1 (MOVE_EFFECT_ATK_MINUS_1 - 1) +#define STAT_ANIM_MINUS2 (MOVE_EFFECT_ATK_MINUS_2 - 1) #define STAT_ANIM_MULTIPLE_PLUS1 55 #define STAT_ANIM_MULTIPLE_PLUS2 56 #define STAT_ANIM_MULTIPLE_MINUS1 57 diff --git a/src/battle_util.c b/src/battle_util.c index ad1648dbd8e5..394e34d42ef3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6499,7 +6499,7 @@ static u8 StatRaiseBerry(u32 battler, u32 itemId, u32 statId, bool32 end2) else SET_STATCHANGER(statId, 1, FALSE); - gBattleScripting.animArg1 = 14 + statId; + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + statId; gBattleScripting.animArg2 = 0; if (end2) @@ -6550,7 +6550,7 @@ static u8 RandomStatRaiseBerry(u32 battler, u32 itemId, bool32 end2) else SET_STATCHANGER(i + 1, 2, FALSE); - gBattleScripting.animArg1 = 0x21 + i + 6; + gBattleScripting.animArg1 = STAT_ANIM_PLUS2 + i + 1; gBattleScripting.animArg2 = 0; if (end2) { @@ -6627,7 +6627,7 @@ static u8 DamagedStatBoostBerryEffect(u32 battler, u8 statId, u8 category) SET_STATCHANGER(statId, 1, FALSE); gBattleScripting.battler = battler; - gBattleScripting.animArg1 = 14 + statId; + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + statId; gBattleScripting.animArg2 = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryStatRaiseRet; @@ -6644,7 +6644,7 @@ u8 TryHandleSeed(u32 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exe gLastUsedItem = itemId; // For surge abilities gEffectBattler = gBattleScripting.battler = battler; SET_STATCHANGER(statId, 1, FALSE); - gBattleScripting.animArg1 = 14 + statId; + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + statId; gBattleScripting.animArg2 = 0; if (execute) { @@ -7052,7 +7052,7 @@ static u8 ItemEffectMoveEnd(u32 battler, u16 holdEffect) } SET_STATCHANGER(STAT_ATK, 2, FALSE); - gBattleScripting.animArg1 = 14 + STAT_ATK; + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK; gBattleScripting.animArg2 = 0; BattleScriptPushCursorAndCallback(BattleScript_BerserkGeneRet); @@ -7334,7 +7334,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn) } SET_STATCHANGER(STAT_ATK, 2, FALSE); - gBattleScripting.animArg1 = 14 + STAT_ATK; + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK; gBattleScripting.animArg2 = 0; BattleScriptPushCursorAndCallback(BattleScript_BerserkGeneRet); @@ -7586,7 +7586,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn) } SET_STATCHANGER(STAT_ATK, 2, FALSE); - gBattleScripting.animArg1 = 14 + STAT_ATK; + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK; gBattleScripting.animArg2 = 0; BattleScriptPushCursorAndCallback(BattleScript_BerserkGeneRet); @@ -11057,7 +11057,7 @@ bool32 TryRoomService(u32 battler) BufferStatChange(battler, STAT_SPEED, STRINGID_STATFELL); gEffectBattler = gBattleScripting.battler = battler; SET_STATCHANGER(STAT_SPEED, 1, TRUE); - gBattleScripting.animArg1 = 14 + STAT_SPEED; + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_SPEED; gBattleScripting.animArg2 = 0; gLastUsedItem = gBattleMons[battler].item; return TRUE;