From 1d13004a0b23ffd302a8e2da1297f3ab216b64a3 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 18 Jan 2020 20:28:36 +0100 Subject: [PATCH] Fix Power Gem anim --- data/battle_anim_scripts.s | 54 +++++++++--------- src/battle_anim_effects_2.c | 22 +++++++ src/rock.c | 111 ------------------------------------ 3 files changed, 48 insertions(+), 139 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index efb05e105..b7b3a928e 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2124,40 +2124,38 @@ Move_DRAGON_RUSH: blendoff end -Move_POWER_GEM: - createsprite gSimplePaletteBlendSpriteTemplate, 2, 5, 1, 1, 0, 7, 0 - waitforvisualfinish +Move_POWER_GEM: @ Copy of Hidden Power with background blackened loadspritegfx ANIM_TAG_POWER_GEM - playsewithpan 152, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ScaleMonAndRestore, 5, -7, -7, 11, 0, 0 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 1, 0, 7, RGB_BLACK waitforvisualfinish + playsewithpan SE_W036, SOUND_PAN_ATTACKER + createvisualtask AnimTask_ScaleMonAndRestore, 5, -7, -7, 11, ANIM_ATTACKER, 0 + waitforvisualfinish delay 30 - createvisualtask AnimTask_BlendMonInAndOut 5, 5, 0, RGB(31, 31, 31), 12, 5, 1 - delay 4 - createvisualtask AnimTask_ScaleMonAndRestore, 5, -7, -7, 11, 0, 0 + createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_ATTACKER, RGB_WHITE, 12, 5, 1 + delay 4 + createvisualtask AnimTask_ScaleMonAndRestore, 5, -7, -7, 11, ANIM_ATTACKER, 0 playsewithpan SE_W179, SOUND_PAN_ATTACKER - createsprite gPowerGemOrbSpriteTemplate 2, 2, 26, 0 - createsprite gPowerGemOrbSpriteTemplate 2, 2, 26, 42 - createsprite gPowerGemOrbSpriteTemplate 2, 2, 26, 84 - createsprite gPowerGemOrbSpriteTemplate 2, 2, 26, 126 - createsprite gPowerGemOrbSpriteTemplate 2, 2, 26, 168 - createsprite gPowerGemOrbSpriteTemplate 2, 2, 26, 210 + createsprite gPowerGemOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 0 + createsprite gPowerGemOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 42 + createsprite gPowerGemOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 84 + createsprite gPowerGemOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 126 + createsprite gPowerGemOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 168 + createsprite gPowerGemOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 210 delay 52 - setarg 7, -1 + setarg 7, -1 playsewithpan SE_W115, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ScaleMonAndRestore, 5, -7, -7, 11, 0, 0 - createsprite gPowerGemScatterSpriteTemplate 130, 1, 0 - createsprite gPowerGemScatterSpriteTemplate 130, 1, 32 - createsprite gPowerGemScatterSpriteTemplate 130, 1, 64 - createsprite gPowerGemScatterSpriteTemplate 130, 1, 96 - createsprite gPowerGemScatterSpriteTemplate 130, 1, 128 - createsprite gPowerGemScatterSpriteTemplate 130, 1, 160 - createsprite gPowerGemScatterSpriteTemplate 130, 1, SOUND_PAN_ATTACKER - createsprite gPowerGemScatterSpriteTemplate 130, 1, 224 - waitforvisualfinish - clearmonbg ANIM_DEF_PARTNER - createsprite gSimplePaletteBlendSpriteTemplate 2, 5, 1, 1, 7, 0, 0 - blendoff + createvisualtask AnimTask_ScaleMonAndRestore, 5, -7, -7, 11, ANIM_ATTACKER, 0 + createsprite gPowerGemOrbScatterSpriteTemplate, ANIM_TARGET, 2, 0 + createsprite gPowerGemOrbScatterSpriteTemplate, ANIM_TARGET, 2, 32 + createsprite gPowerGemOrbScatterSpriteTemplate, ANIM_TARGET, 2, 64 + createsprite gPowerGemOrbScatterSpriteTemplate, ANIM_TARGET, 2, 96 + createsprite gPowerGemOrbScatterSpriteTemplate, ANIM_TARGET, 2, 128 + createsprite gPowerGemOrbScatterSpriteTemplate, ANIM_TARGET, 2, 160 + createsprite gPowerGemOrbScatterSpriteTemplate, ANIM_TARGET, 2, 192 + createsprite gPowerGemOrbScatterSpriteTemplate, ANIM_TARGET, 2, 224 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 1, 7, 0, RGB_BLACK + waitforvisualfinish end Move_DRAIN_PUNCH: diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index dcbcced39..83e0edf8e 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -980,6 +980,28 @@ const struct SpriteTemplate gHiddenPowerOrbScatterSpriteTemplate = .callback = AnimOrbitScatter, }; +const struct SpriteTemplate gPowerGemOrbSpriteTemplate = +{ + .tileTag = ANIM_TAG_POWER_GEM, + .paletteTag = ANIM_TAG_POWER_GEM, + .oam = &gOamData_AffineNormal_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gHiddenPowerOrbAffineAnimTable, + .callback = AnimOrbitFast, +}; + +const struct SpriteTemplate gPowerGemOrbScatterSpriteTemplate = +{ + .tileTag = ANIM_TAG_POWER_GEM, + .paletteTag = ANIM_TAG_POWER_GEM, + .oam = &gOamData_AffineDouble_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gHiddenPowerOrbAffineAnimTable, + .callback = AnimOrbitScatter, +}; + const union AffineAnimCmd gSpitUpOrbAffineAnimCmds[] = { AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0), diff --git a/src/rock.c b/src/rock.c index 24c93b973..c904cfbab 100644 --- a/src/rock.c +++ b/src/rock.c @@ -312,52 +312,6 @@ const struct SpriteTemplate gUnknown_08596CE0 = .callback = sub_80A8EE4, }; -const union AffineAnimCmd gPowerGemScatterAffineAnimCmd[] = -{ - AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0), - AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 1), - AFFINEANIMCMD_JUMP(1), -}; - -const union AffineAnimCmd *const gPowerGemScatterAffineAnims[] = -{ - gPowerGemScatterAffineAnimCmd, -}; - -const union AffineAnimCmd gPowerGemOrbAffineAnimCmd[] = -{ - AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0), - AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 1), - AFFINEANIMCMD_JUMP(1), -}; - -const union AffineAnimCmd *const gPowerGemOrbAffineAnims[] = -{ - gPowerGemOrbAffineAnimCmd, -}; - -const struct SpriteTemplate gPowerGemScatterSpriteTemplate = -{ - .tileTag = ANIM_TAG_POWER_GEM, - .paletteTag = ANIM_TAG_POWER_GEM, - .oam = &gOamData_AffineDouble_ObjNormal_16x16, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gPowerGemScatterAffineAnims, - .callback = AnimPowerGemScatter, -}; - -const struct SpriteTemplate gPowerGemOrbSpriteTemplate = -{ - .tileTag = ANIM_TAG_POWER_GEM, - .paletteTag = ANIM_TAG_POWER_GEM, - .oam = &gOamData_AffineNormal_ObjNormal_16x16, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gPowerGemOrbAffineAnims, - .callback = AnimPowerGemOrbitFast, -}; - const struct SpriteTemplate gStoneEdgeSpriteTemplate = { .tileTag = ANIM_TAG_STONE_EDGE, @@ -420,71 +374,6 @@ static void AnimStealthRockStep2(struct Sprite *sprite) DestroyAnimSprite(sprite); } -void AnimPowerGemScatter(struct Sprite *sprite) -{ - sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); - sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); - sprite->data[0] = Sin(gBattleAnimArgs[0], 10); - sprite->data[1] = Cos(gBattleAnimArgs[0], 7); - sprite->callback = AnimPowerGemScatterStep; -} - -static void AnimPowerGemScatterStep(struct Sprite *sprite) -{ - sprite->pos2.x += sprite->data[0]; - sprite->pos2.y += sprite->data[1]; - if (sprite->pos1.x + sprite->pos2.x + 16 > 272u || sprite->pos1.y + sprite->pos2.y > 160 || sprite->pos1.y + sprite->pos2.y < -16) - DestroyAnimSprite(sprite); -} - -void AnimPowerGemOrbitFast(struct Sprite *sprite) -{ - sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); - sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); - sprite->affineAnimPaused = 1; - sprite->data[0] = gBattleAnimArgs[0]; - sprite->data[1] = gBattleAnimArgs[1]; - sprite->data[7] = GetBattlerSpriteSubpriority(gBattleAnimAttacker); - sprite->callback = AnimPowerGemOrbitFastStep; - sprite->callback(sprite); -} - -static void AnimPowerGemOrbitFastStep(struct Sprite *sprite) -{ - if (sprite->data[1] >= 64 && sprite->data[1] <= 191) - sprite->subpriority = sprite->data[7] + 1; - else - sprite->subpriority = sprite->data[7] - 1; - - sprite->pos2.x = Sin(sprite->data[1], sprite->data[2] >> 8); - sprite->pos2.y = Cos(sprite->data[1], sprite->data[3] >> 8); - sprite->data[1] = (sprite->data[1] + 9) & 0xFF; - switch (sprite->data[5]) - { - case 1: - sprite->data[2] -= 0x400; - sprite->data[3] -= 0x100; - if (++sprite->data[4] == sprite->data[0]) - { - sprite->data[5] = 2; - return; - } - break; - case 0: - sprite->data[2] += 0x400; - sprite->data[3] += 0x100; - if (++sprite->data[4] == sprite->data[0]) - { - sprite->data[4] = 0; - sprite->data[5] = 1; - } - break; - } - - if ((u16)gBattleAnimArgs[7] == 0xFFFF) - DestroyAnimSprite(sprite); -} - void sub_81109F0(struct Sprite *sprite) { if (gBattleAnimArgs[3] != 0)