diff --git a/asm/battle_anim_80A9C70.s b/asm/battle_anim_80A9C70.s index 7556531563..3515b973ee 100644 --- a/asm/battle_anim_80A9C70.s +++ b/asm/battle_anim_80A9C70.s @@ -623,8 +623,8 @@ _080AA186: bx r0 thumb_func_end sub_80AA124 - thumb_func_start sub_80AA18C -sub_80AA18C: @ 80AA18C + thumb_func_start AnimTask_StatsChange +AnimTask_StatsChange: @ 80AA18C push {r4,r5,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -853,7 +853,7 @@ _080AA352: pop {r0} bx r0 .pool - thumb_func_end sub_80AA18C + thumb_func_end AnimTask_StatsChange thumb_func_start LaunchStatusAnimation LaunchStatusAnimation: @ 80AA364 diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 727a62f3d6..624a5c69f5 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -10484,7 +10484,7 @@ AnimScript_82D7ECA: end Anim_StatChange: - createvisualtask sub_80AA18C, 0x5 + createvisualtask AnimTask_StatsChange, 0x5 waitforvisualfinish end diff --git a/include/battle.h b/include/battle.h index 073b161474..fae21908b3 100644 --- a/include/battle.h +++ b/include/battle.h @@ -568,10 +568,11 @@ struct BattleStruct } #define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 +#define GET_STAT_BUFF_VALUE2(n)((n & 0xF0)) #define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40 #define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit -#define SET_STAT_BUFF_VALUE(n)(((s8)(((s8)(n) << 4)) & 0xF0)) +#define SET_STAT_BUFF_VALUE(n)((((n) << 4) & 0xF0)) #define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7)) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ec81fcae2f..e688d0b409 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4378,22 +4378,22 @@ static void atk46_playanimation2(void) // animation Id is stored in the first po static void atk47_setgraphicalstatchangevalues(void) { u8 value = 0; - switch (gBattleScripting.statChanger & 0xF0) + switch (GET_STAT_BUFF_VALUE2(gBattleScripting.statChanger)) { - case 0x10: // +1 + case SET_STAT_BUFF_VALUE(1): // +1 value = 0xF; break; - case 0x20: // +2 + case SET_STAT_BUFF_VALUE(2): // +2 value = 0x27; break; - case 0x90: // -1 + case SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE: // -1 value = 0x16; break; - case 0xA0: // -2 + case SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE: // -2 value = 0x2E; break; } - gBattleScripting.animArg1 = (gBattleScripting.statChanger & 0xF) + value - 1; + gBattleScripting.animArg1 = GET_STAT_BUFF_ID(gBattleScripting.statChanger) + value - 1; gBattleScripting.animArg2 = 0; gBattlescriptCurrInstr++; }