Fairy Lock animation fix (#4111)

* Fairy Lock animation fix

* remove comment

* fairy lock anim hopefully works

---------

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
DizzyEggg 2024-02-04 23:23:03 +01:00 committed by GitHub
parent 512ab98bfe
commit 065c0ec588
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 6 deletions

View file

@ -9210,13 +9210,12 @@ Boomburst_Doubles:
goto Boomburst_Last
Move_FAIRY_LOCK::
loadspritegfx ANIM_TAG_CHAIN_LINK @Chain Colour
loadspritegfx ANIM_TAG_FAIRY_LOCK_CHAINS @AnimTask is missing for Fairy Lock Chain
loadspritegfx ANIM_TAG_FAIRY_LOCK_CHAINS
setalpha 8, 8
monbg ANIM_ATK_PARTNER
createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x8, 0x6B1F
waitforvisualfinish
loopsewithpan SE_M_SCRATCH, SOUND_PAN_TARGET, 0x6, 0x4
loopsewithpan SE_M_SCRATCH, SOUND_PAN_TARGET, 0x6, 0x9
createvisualtask AnimTask_VoltTackleBolt, 0x5, 0x7
createvisualtask AnimTask_VoltTackleBolt, 0x5, 0x33
createvisualtask AnimTask_VoltTackleBolt, 0x5, 0x2

View file

@ -415,6 +415,7 @@ extern const struct OamData gOamData_AffineDouble_ObjNormal_64x64;
extern const struct OamData gOamData_AffineDouble_ObjBlend_64x64;
extern const struct OamData gOamData_AffineDouble_ObjBlend_64x32;
extern const struct OamData gOamData_AffineDouble_ObjNormal_8x16;
extern const struct OamData gOamData_AffineDouble_ObjNormal_64x32;
extern const struct OamData gOamData_AffineOff_ObjBlend_16x16;
extern const struct OamData gOamData_AffineDouble_ObjBlend_16x16;
extern const struct OamData gOamData_AffineNormal_ObjNormal_8x8;

View file

@ -479,6 +479,17 @@ const struct SpriteTemplate gVoltTackleBoltSpriteTemplate =
.callback = AnimVoltTackleBolt,
};
const struct SpriteTemplate gFairyLockChainsSpriteTemplate =
{
.tileTag = ANIM_TAG_FAIRY_LOCK_CHAINS,
.paletteTag = ANIM_TAG_FAIRY_LOCK_CHAINS,
.oam = &gOamData_AffineOff_ObjNormal_64x32,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimVoltTackleBolt,
};
const struct SpriteTemplate gGrowingShockWaveOrbSpriteTemplate =
{
.tileTag = ANIM_TAG_CIRCLE_OF_LIGHT,
@ -1190,11 +1201,20 @@ void AnimTask_VoltTackleBolt(u8 taskId)
static bool8 CreateVoltTackleBolt(struct Task *task, u8 taskId)
{
u8 spriteId = CreateSprite(&gVoltTackleBoltSpriteTemplate, task->data[3], task->data[5], 35);
u32 spriteId;
bool32 isFairyLock = (gAnimMoveIndex == MOVE_FAIRY_LOCK);
if (isFairyLock)
spriteId = CreateSprite(&gFairyLockChainsSpriteTemplate, task->data[3], task->data[5] + 10, 35);
else
spriteId = CreateSprite(&gVoltTackleBoltSpriteTemplate, task->data[3], task->data[5], 35);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[6] = taskId;
gSprites[spriteId].data[7] = 7;
gSprites[spriteId].data[1] = isFairyLock ? 25 : 12; // How long the chains / bolts stay on screen.
gSprites[spriteId].data[2] = isFairyLock; // Whether to destroy the Oam Matrix.
task->data[7]++;
}
@ -1220,10 +1240,11 @@ static bool8 CreateVoltTackleBolt(struct Task *task, u8 taskId)
static void AnimVoltTackleBolt(struct Sprite *sprite)
{
if (++sprite->data[0] > 12)
if (++sprite->data[0] > sprite->data[1])
{
gTasks[sprite->data[6]].data[sprite->data[7]]--;
FreeOamMatrix(sprite->oam.matrixNum);
if (!sprite->data[2])
FreeOamMatrix(sprite->oam.matrixNum);
DestroySprite(sprite);
}
}