From e2f14d43dbce4316e9d1c54916c3eca2982cc716 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 8 Jun 2021 12:13:40 +0200 Subject: [PATCH] Fix Gravity's animation --- data/battle_anim_scripts.s | 1 + src/battle_anim_mon_movement.c | 6 ++++++ src/battle_anim_utility_funcs.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 65bac00d7..9ebf32a92 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -863,6 +863,7 @@ Move_ROOST: Move_GRAVITY: fadetobg BG_COSMIC waitbgfadein + createvisualtask AnimTask_SetAnimTargetToAttackerOpposite, 1 playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER createvisualtask AnimTask_ShakeAndSinkMon, 5, ANIM_ATTACKER, 2, 0, 96, 30 createvisualtask AnimTask_ShakeAndSinkMon, 5, ANIM_DEF_PARTNER, 2, 0, 96, 30 diff --git a/src/battle_anim_mon_movement.c b/src/battle_anim_mon_movement.c index 9b0835224..75b77494e 100644 --- a/src/battle_anim_mon_movement.c +++ b/src/battle_anim_mon_movement.c @@ -321,6 +321,12 @@ static void AnimTask_ShakeMonInPlace_Step(u8 taskId) void AnimTask_ShakeAndSinkMon(u8 taskId) { u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + + if (spriteId == SPRITE_NONE) + { + DestroyAnimVisualTask(taskId); + return; + } gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; gTasks[taskId].data[0] = spriteId; gTasks[taskId].data[1] = gBattleAnimArgs[1]; diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 4d18d04fa..0f2c8bda8 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -1084,3 +1084,9 @@ void AnimTask_SetInvisible(u8 taskId) gSprites[spriteId].invisible = gBattleSpritesDataPtr->battlerData[battlerId].invisible = gBattleAnimArgs[1]; DestroyAnimVisualTask(taskId); } + +void AnimTask_SetAnimTargetToAttackerOpposite(u8 taskId) +{ + gBattleAnimTarget = BATTLE_OPPOSITE(gBattleAnimAttacker); + DestroyAnimVisualTask(taskId); +}