Skip to content

Commit

Permalink
Get rid of hardcoded stat raise anim values (#4825)
Browse files Browse the repository at this point in the history
  • Loading branch information
DizzyEggg authored Jun 17, 2024
1 parent e64a2f3 commit 203318b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions include/battle_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 203318b

Please sign in to comment.