Additional battle anim sync

This commit is contained in:
GriffinR 2022-08-17 11:44:20 -04:00
parent 2ec8f27811
commit c2d5dd2a1f
17 changed files with 97 additions and 106 deletions

View File

@ -798,14 +798,14 @@ Move_DOUBLE_EDGE:
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, -10, 0, ANIM_TARGET, 0
createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -32, 0, 0, 3
waitforvisualfinish
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 0
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 0
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_ATTACKER, 0
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_TARGET, 0
createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 4, 0, 12, 1
createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_WHITE
waitforvisualfinish
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 1
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 1
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_ATTACKER, 1
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_TARGET, 1
waitforvisualfinish
createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 5
delay 3
@ -2441,7 +2441,7 @@ Move_HORN_ATTACK:
Move_FURY_ATTACK:
loadspritegfx ANIM_TAG_IMPACT
loadspritegfx ANIM_TAG_HORN_HIT
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 256, 0, 2
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 256, ANIM_ATTACKER, 2
choosetwoturnanim FuryAttackRight, FuryAttackLeft
FuryAttackContinue:
createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1
@ -2590,7 +2590,7 @@ Move_LOW_KICK:
createsprite gSlidingKickSpriteTemplate, ANIM_TARGET, 2, -24, 28, 40, 8, 160, 0
delay 4
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, -8, 8, ANIM_TARGET, 2
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 6, 384, 1, 2
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 6, 384, ANIM_TARGET, 2
playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET
waitforvisualfinish
createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 1, 4
@ -2835,7 +2835,7 @@ SkullBashSetUpHeadDown:
createsprite gSlideMonToOffsetAndBackSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, -24, 0, 0, 10, 0
playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER
waitforvisualfinish
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 16, 96, 0, 2
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 16, 96, ANIM_ATTACKER, 2
waitforvisualfinish
createsprite gSlideMonToOffsetAndBackSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 24, 0, 0, 10, 1
waitforvisualfinish
@ -3958,7 +3958,7 @@ Move_MIST_BALL:
createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 1, 1, RGB(23, 16, 31), 16, RGB_WHITE, 16
delay 0
playsewithpan SE_M_HAZE, 0
createvisualtask AnimTask_LoadMistTiles, 5
createvisualtask AnimTask_MistBallFog, 5
createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 3, 0, 16, RGB_WHITE
delay 8
createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 4, 0, 70, 0
@ -8570,14 +8570,14 @@ Move_ARM_THRUST:
loadspritegfx ANIM_TAG_IMPACT
splitbgprio ANIM_TARGET
setalpha 12, 8
createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, 0, 0
createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, ANIM_ATTACKER, 0
delay 6
createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 3
delay 4
playsewithpan SE_M_SWAGGER, SOUND_PAN_TARGET
createsprite gArmThrustHandSpriteTemplate, ANIM_TARGET, 2, 10, -8, 14, 3
waitforvisualfinish
createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, 0, 1
createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, ANIM_ATTACKER, 1
playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET
choosetwoturnanim ArmThrustRight, ArmThrustLeft
ArmThrustContinue:

View File

@ -120,7 +120,7 @@ void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode);
void SetBattlerSpriteYOffsetFromRotation(u8 spriteId);
u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2);
u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight);
u8 AnimDummyReturnArg(u8 battler);
u8 GetSpritePalIdxByBattler(u8 battler);
s16 CloneBattlerSpriteWithBlend(u8);
void DestroySpriteWithActiveSheet(struct Sprite *);
u8 CreateInvisibleSpriteCopy(int, u8, int);

View File

@ -34,16 +34,19 @@ enum
#define TAG_HEALTHBAR_PLAYER2_TILE 0xD706
#define TAG_HEALTHBAR_OPPONENT2_TILE 0xD707
#define TAG_HEALTHBOX_PALS_1 0xD709
#define TAG_HEALTHBOX_PALS_2 0xD70A
#define TAG_HEALTHBOX_SAFARI_TILE 0xD70B
#define TAG_STATUS_SUMMARY_BAR_TILE 0xD70C
#define TAG_STATUS_SUMMARY_BALLS_TILE 0xD714
#define TAG_HEALTHBOX_PAL 0xD6FF
#define TAG_HEALTHBAR_PAL 0xD704
#define TAG_STATUS_SUMMARY_BAR_PAL 0xD710
#define TAG_STATUS_SUMMARY_BALLS_PAL 0xD712
#define TAG_STATUS_SUMMARY_BALLS_TILE 0xD714
#define TAG_HEALTHBAR_PAL TAG_HEALTHBAR_PLAYER1_TILE
#define TAG_HEALTHBOX_PAL TAG_HEALTHBOX_PLAYER1_TILE
enum
{
HEALTHBOX_ALL,

View File

@ -84,7 +84,7 @@ static void AnimMilkBottle(struct Sprite *);
static void AnimMilkBottle_Step1(struct Sprite *);
static void AnimMilkBottle_Step2(struct Sprite *, int, int);
static void AnimGrantingStars(struct Sprite *);
static void AnimSparkingStars(struct Sprite *);
static void AnimSparklingStars(struct Sprite *);
static void AnimBubbleBurst(struct Sprite *);
static void AnimBubbleBurst_Step(struct Sprite *);
static void AnimSleepLetterZ(struct Sprite *);
@ -1416,7 +1416,7 @@ const struct SpriteTemplate gSparklingStarsSpriteTemplate =
.anims = gGrantingStarsAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSparkingStars,
.callback = AnimSparklingStars,
};
static const union AnimCmd sAnim_BubbleBurst[] =
@ -4137,7 +4137,7 @@ static void AnimGrantingStars(struct Sprite *sprite)
sprite->callback = TranslateSpriteLinearFixedPoint;
}
static void AnimSparkingStars(struct Sprite *sprite)
static void AnimSparklingStars(struct Sprite *sprite)
{
u8 battler;
if (!gBattleAnimArgs[2])

View File

@ -3043,9 +3043,7 @@ void AnimTask_FreeMusicNotesPals(u8 taskId)
static void SetMusicNotePalette(struct Sprite *sprite, u8 a, u8 b)
{
u8 tile;
tile = (b & 1);
tile = ((-tile | tile) >> 31) & 32;
u8 tile = (b & 1) ? 32 : 0;
sprite->oam.tileNum += tile + (a << 2);
sprite->oam.paletteNum = IndexOfSpritePaletteTag(sMusicNotePaletteTagsTable[b >> 1]);
}
@ -3792,8 +3790,7 @@ static void AnimPerishSongMusicNote_Step2(struct Sprite *sprite)
if (sprite->data[4] > 3)
{
int var1 = sprite->data[2];
sprite->invisible = var1 - (((s32)(var1 + ((u32)var1 >> 31)) >> 1) << 1);
sprite->invisible = sprite->data[2] % 2;
DestroyAnimSprite(sprite);
}

View File

@ -2107,7 +2107,7 @@ static void AnimWishStar(struct Sprite *sprite)
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
sprite->x = -16;
else
sprite->x = 256;
sprite->x = DISPLAY_WIDTH + 16;
sprite->y = 0;
sprite->callback = AnimWishStar_Step;
@ -2136,7 +2136,7 @@ static void AnimWishStar_Step(struct Sprite *sprite)
}
newX = sprite->x + sprite->x2 + 32;
if (newX > 304)
if (newX > DISPLAY_WIDTH + 64)
DestroyAnimSprite(sprite);
}
@ -3183,7 +3183,7 @@ static void AnimReversalOrb_Step(struct Sprite *sprite)
// Copies the target mon's sprite, and makes a white silhouette that shrinks away.
void AnimTask_RolePlaySilhouette(u8 taskId)
{
u8 isBackPic;
bool8 isBackPic;
u32 personality;
u32 otId;
u16 species;
@ -3206,7 +3206,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
{
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
isBackPic = 0;
isBackPic = FALSE;
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY);
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID);
if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE)
@ -3226,7 +3226,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
}
else
{
isBackPic = 1;
isBackPic = TRUE;
personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY);
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID);
if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE)
@ -5097,7 +5097,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
gTasks[taskId].data[1] &= 0xFF;
x = gSprites[spriteId].x + gSprites[spriteId].x2;
if ((u16)(x + 32) > 304)
if (x < -32 || x > DISPLAY_WIDTH + 32)
{
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++;
@ -5180,7 +5180,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
}
}
if ((u16)(x + 32) > 304)
if (x < -32 || x > DISPLAY_WIDTH + 32)
{
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++;

View File

@ -583,7 +583,7 @@ static void AnimZapCannonSpark(struct Sprite *sprite)
sprite->data[7] = gBattleAnimArgs[4];
sprite->oam.tileNum += gBattleAnimArgs[6] * 4;
sprite->callback = AnimZapCannonSpark_Step;
AnimZapCannonSpark_Step(sprite);
sprite->callback(sprite);
}
static void AnimZapCannonSpark_Step(struct Sprite *sprite)

View File

@ -500,7 +500,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
sprite->data[0] = gBattleAnimArgs[1];
sprite->data[7] = CreateSprite(&gBasicHitSplatSpriteTemplate, sprite->x, sprite->y, sprite->subpriority + 1);
if (sprite->data[7] != 64)
if (sprite->data[7] != MAX_SPRITES)
{
StartSpriteAffineAnim(&gSprites[sprite->data[7]], 0);
gSprites[sprite->data[7]].callback = SpriteCallbackDummy;
@ -513,7 +513,7 @@ static void AnimFistOrFootRandomPos_Step(struct Sprite *sprite)
{
if (sprite->data[0] == 0)
{
if (sprite->data[7] != 64)
if (sprite->data[7] != MAX_SPRITES)
{
FreeOamMatrix(gSprites[sprite->data[7]].oam.matrixNum);
DestroySprite(&gSprites[sprite->data[7]]);

View File

@ -1227,8 +1227,8 @@ void AnimTask_MoveHeatWaveTargets(u8 taskId)
{
struct Task *task = &gTasks[taskId];
task->data[12] = !GetBattlerSide(gBattleAnimAttacker) ? 1 : -1;
task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ 2) + 1;
task->data[12] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1;
task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ BIT_FLANK) + 1;
task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET);
task->data[15] = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER);

View File

@ -528,8 +528,8 @@ static void AnimFlyBallAttack_Step(struct Sprite *sprite)
}
if (sprite->x + sprite->x2 < -32
|| sprite->x + sprite->x2 > DISPLAY_WIDTH + 32
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT)
|| sprite->x + sprite->x2 > DISPLAY_WIDTH + 32
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT)
{
gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = FALSE;
DestroyAnimSprite(sprite);
@ -1215,8 +1215,8 @@ void AnimSkyAttackBird_Step(struct Sprite *sprite)
sprite->x = sprite->data[4] >> 4;
sprite->y = sprite->data[5] >> 4;
if (sprite->x > 285 || sprite->x < -45
|| sprite->y > 157 || sprite->y < -45)
if (sprite->x > DISPLAY_WIDTH + 45 || sprite->x < -45
|| sprite->y > 157 || sprite->y < -45)
DestroySpriteAndMatrix(sprite);
}

View File

@ -45,7 +45,7 @@ static void AnimThrowIceBall(struct Sprite *);
static void InitIceBallParticle(struct Sprite *);
static void AnimIceBallParticle(struct Sprite *);
static void AnimTask_HazeScrollingFog_Step(u8);
static void AnimTask_LoadMistTiles_Step(u8);
static void AnimTask_MistBallFog_Step(u8);
static void AnimTask_Hail2(u8);
static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, u8 c);
@ -353,7 +353,7 @@ const struct SpriteTemplate gMistBallSpriteTemplate =
.callback = AnimThrowMistBall,
};
static const u8 wMistBlendAmounts[] =
static const u8 sMistBlendAmounts[] =
{
0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5,
};
@ -696,7 +696,8 @@ static void AnimSwirlingSnowball(struct Sprite *sprite)
sprite->data[0] = 1;
AnimFastTranslateLinear(sprite);
if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32
if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT
|| sprite->y + sprite->y2 < -16)
break;
@ -762,7 +763,8 @@ static void AnimSwirlingSnowball_End(struct Sprite *sprite)
sprite->data[0] = 1;
AnimFastTranslateLinear(sprite);
if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32
if (sprite->x + sprite->x2 > 256
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > 256
|| sprite->y + sprite->y2 < -16)
DestroyAnimSprite(sprite);
@ -816,7 +818,8 @@ static void AnimMoveParticleBeyondTarget(struct Sprite *sprite)
{
sprite->data[0] = 1;
AnimFastTranslateLinear(sprite);
if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32
if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT
|| sprite->y + sprite->y2 < -16)
break;
@ -846,7 +849,8 @@ static void AnimWiggleParticleTowardsTarget(struct Sprite *sprite)
sprite->data[7] = (sprite->data[7] + sprite->data[6]) & 0xFF;
if (sprite->data[0] == 1)
{
if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32
if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT
|| sprite->y + sprite->y2 < -16)
DestroyAnimSprite(sprite);
@ -1086,7 +1090,7 @@ static void AnimThrowMistBall(struct Sprite *sprite)
}
// Displays misty background in Mist Ball.
void AnimTask_LoadMistTiles(u8 taskId)
void AnimTask_MistBallFog(u8 taskId)
{
struct BattleAnimBgData animBg;
@ -1109,10 +1113,10 @@ void AnimTask_LoadMistTiles(u8 taskId)
LoadPalette(&gFogPalette, animBg.paletteId * 16, 32);
gTasks[taskId].data[15] = -1;
gTasks[taskId].func = AnimTask_LoadMistTiles_Step;
gTasks[taskId].func = AnimTask_MistBallFog_Step;
}
static void AnimTask_LoadMistTiles_Step(u8 taskId)
static void AnimTask_MistBallFog_Step(u8 taskId)
{
struct BattleAnimBgData animBg;
@ -1123,7 +1127,7 @@ static void AnimTask_LoadMistTiles_Step(u8 taskId)
{
case 0:
gTasks[taskId].data[9] += 1;
gTasks[taskId].data[11] = wMistBlendAmounts[gTasks[taskId].data[9]];
gTasks[taskId].data[11] = sMistBlendAmounts[gTasks[taskId].data[9]];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 17 - gTasks[taskId].data[11]));
if (gTasks[taskId].data[11] == 5)
{
@ -1410,14 +1414,14 @@ static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId,
}
else
{
battlerX = (sHailCoordData[hailStructId].x);
battlerY = (sHailCoordData[hailStructId].y);
battlerX = sHailCoordData[hailStructId].x;
battlerY = sHailCoordData[hailStructId].y;
}
}
else
{
battlerX = (sHailCoordData[hailStructId].x);
battlerY = (sHailCoordData[hailStructId].y);
battlerX = sHailCoordData[hailStructId].x;
battlerY = sHailCoordData[hailStructId].y;
}
spriteX = battlerX - ((battlerY + 8) / 2);
id = CreateSprite(&gHailParticleSpriteTemplate, spriteX, -8, 18);

View File

@ -5,7 +5,6 @@
#include "task.h"
#include "trig.h"
// This file's functions.
static void AnimTask_ShakeMon_Step(u8 taskId);
static void AnimTask_ShakeMon2_Step(u8 taskId);
static void AnimTask_ShakeMonInPlace_Step(u8 taskId);
@ -108,7 +107,7 @@ void AnimTask_ShakeMon(u8 taskId)
gTasks[taskId].data[4] = gBattleAnimArgs[1];
gTasks[taskId].data[5] = gBattleAnimArgs[2];
gTasks[taskId].func = AnimTask_ShakeMon_Step;
AnimTask_ShakeMon_Step(taskId);
gTasks[taskId].func(taskId);
}
static void AnimTask_ShakeMon_Step(u8 taskId)
@ -156,17 +155,14 @@ static void AnimTask_ShakeMon_Step(u8 taskId)
void AnimTask_ShakeMon2(u8 taskId)
{
u8 spriteId;
bool8 destroy = FALSE;
bool8 abort = FALSE;
u8 battlerId;
if (gBattleAnimArgs[0] < MAX_BATTLERS_COUNT)
{
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (spriteId == SPRITE_NONE)
{
DestroyAnimVisualTask(taskId);
return;
}
abort = TRUE;
}
else if (gBattleAnimArgs[0] != 8)
{
@ -188,7 +184,7 @@ void AnimTask_ShakeMon2(u8 taskId)
}
if (IsBattlerSpriteVisible(battlerId) == FALSE)
destroy = TRUE;
abort = TRUE;
spriteId = gBattlerSpriteIds[battlerId];
}
@ -197,7 +193,7 @@ void AnimTask_ShakeMon2(u8 taskId)
spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
}
if (destroy)
if (abort)
{
DestroyAnimVisualTask(taskId);
return;
@ -332,10 +328,8 @@ void AnimTask_ShakeAndSinkMon(u8 taskId)
static void AnimTask_ShakeAndSinkMon_Step(u8 taskId)
{
s16 x;
u8 spriteId;
spriteId = gTasks[taskId].data[0];
x = gTasks[taskId].data[1];
u8 spriteId = gTasks[taskId].data[0];
s16 x = gTasks[taskId].data[1];
if (gTasks[taskId].data[2] == gTasks[taskId].data[8]++)
{
gTasks[taskId].data[8] = 0;
@ -365,11 +359,8 @@ static void AnimTask_ShakeAndSinkMon_Step(u8 taskId)
void AnimTask_TranslateMonElliptical(u8 taskId)
{
u8 i;
u8 spriteId;
u8 wavePeriod;
wavePeriod = 1;
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
u8 wavePeriod = 1;
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (gBattleAnimArgs[4] > 5)
gBattleAnimArgs[4] = 5;
@ -742,7 +733,7 @@ static void AnimTask_SlideOffScreen_Step(u8 taskId)
{
u8 spriteId = gTasks[taskId].data[0];
gSprites[spriteId].x2 += gTasks[taskId].data[1];
if (gSprites[spriteId].x2 + gSprites[spriteId].x + 0x20 > 0x130u)
if (gSprites[spriteId].x2 + gSprites[spriteId].x < -32 || gSprites[spriteId].x2 + gSprites[spriteId].x > DISPLAY_WIDTH + 32)
{
DestroyAnimVisualTask(taskId);
return;
@ -831,8 +822,7 @@ static void AnimTask_SwayMonStep(u8 taskId)
// arg 4: sprite object mode
void AnimTask_ScaleMonAndRestore(u8 taskId)
{
u8 spriteId;
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]);
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]);
PrepareBattlerSpriteForRotScale(spriteId, gBattleAnimArgs[4]);
gTasks[taskId].data[0] = gBattleAnimArgs[0];
gTasks[taskId].data[1] = gBattleAnimArgs[1];
@ -893,7 +883,7 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId)
}
else
{
if (gBattleAnimArgs[2] == 0)
if (gBattleAnimArgs[2] == ANIM_ATTACKER)
{
gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimAttacker);
}
@ -916,8 +906,7 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId)
// Rotates mon to side and back to original position. For Peck and when a held item activates
void AnimTask_RotateMonToSideAndRestore(u8 taskId)
{
u8 spriteId;
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]);
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]);
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = gBattleAnimArgs[0];

View File

@ -81,7 +81,7 @@ static const u8 sCastformBackSpriteYCoords[NUM_CASTFORM_FORMS] =
#define TAG_MOVE_EFFECT_MON_1 55125
#define TAG_MOVE_EFFECT_MON_2 55126
static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] =
static const struct SpriteTemplate sSpriteTemplates_MoveEffectMons[] =
{
{
.tileTag = TAG_MOVE_EFFECT_MON_1,
@ -103,7 +103,7 @@ static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] =
}
};
static const struct SpriteSheet sSpriteSheet_MoveEffectMons[] =
static const struct SpriteSheet sSpriteSheets_MoveEffectMons[] =
{
{ gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_1, },
{ gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_2, },
@ -440,7 +440,7 @@ void SetCallbackToStoredInData6(struct Sprite *sprite)
#define sAmplitudeX sAmplitude
#define sAmplitudeY data[4]
// TranslateSpriteInWavePattern
// TranslateSpriteInLissajousCurve
#define sCirclePosX sCirclePos
#define sCircleSpeedX sCircleSpeed
#define sCirclePosY data[4]
@ -487,7 +487,7 @@ void TranslateSpriteInGrowingCircle(struct Sprite *sprite)
// Unused
// Exact shape depends on arguments. Can move in a figure-8-like pattern, or circular, etc.
static void TranslateSpriteInWavePattern(struct Sprite *sprite)
static void TranslateSpriteInLissajousCurve(struct Sprite *sprite)
{
if (sprite->sDuration)
{
@ -1508,13 +1508,13 @@ u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLef
return selectedPalettes;
}
// Presumably something commented here, just returns arg
u8 AnimDummyReturnArg(u8 battler)
u8 GetSpritePalIdxByBattler(u8 battler)
{
return battler;
}
static u8 GetBattlerAtPosition_(u8 position)
// Unused
static u8 GetSpritePalIdxByPosition(u8 position)
{
return GetBattlerAtPosition(position);
}
@ -1552,20 +1552,20 @@ void AnimSpriteOnMonPos(struct Sprite *sprite)
// arg 5: lower 8 bits = location on attacking mon, upper 8 bits = location on target mon pick to target
void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite)
{
bool8 v1;
bool8 respectMonPicOffsets;
u8 coordType;
if (!(gBattleAnimArgs[5] & 0xff00))
v1 = TRUE;
respectMonPicOffsets = TRUE;
else
v1 = FALSE;
respectMonPicOffsets = FALSE;
if (!(gBattleAnimArgs[5] & 0xff))
coordType = BATTLER_COORD_Y_PIC_OFFSET;
else
coordType = BATTLER_COORD_Y;
InitSpritePosToAnimAttacker(sprite, v1);
InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
@ -2097,8 +2097,8 @@ u8 GetBattlerSpriteBGPriorityRank(u8 battlerId)
u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm)
{
u8 spriteId;
u16 sheet = LoadSpriteSheet(&sSpriteSheet_MoveEffectMons[id]);
u16 palette = AllocSpritePalette(sSpriteTemplate_MoveEffectMons[id].paletteTag);
u16 sheet = LoadSpriteSheet(&sSpriteSheets_MoveEffectMons[id]);
u16 palette = AllocSpritePalette(sSpriteTemplates_MoveEffectMons[id].paletteTag);
if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->buffer == NULL)
gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000);
@ -2139,9 +2139,9 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16
FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer);
if (!isBackpic)
spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonFrontPicCoords[species].y_offset, subpriority);
spriteId = CreateSprite(&sSpriteTemplates_MoveEffectMons[id], x, y + gMonFrontPicCoords[species].y_offset, subpriority);
else
spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonBackPicCoords[species].y_offset, subpriority);
spriteId = CreateSprite(&sSpriteTemplates_MoveEffectMons[id], x, y + gMonBackPicCoords[species].y_offset, subpriority);
if (IsContest())
{

View File

@ -818,7 +818,7 @@ static void AnimTask_ImprisonOrbs_Step(u8 taskId)
{
for (i = 8; i < 13; i++)
{
if (task->data[i] != 64)
if (task->data[i] != MAX_SPRITES)
DestroySprite(&gSprites[task->data[i]]);
}
@ -997,12 +997,10 @@ void AnimTask_ExtrasensoryDistortion(u8 taskId)
scanlineParams.dmaDest = &REG_BG2HOFS;
}
i = task->data[14];
while (i <= task->data[14] + 64)
for (i = task->data[14]; i <= task->data[14] + 64; i++)
{
gScanlineEffectRegBuffers[0][i] = task->data[10];
gScanlineEffectRegBuffers[1][i] = task->data[10];
i++;
}
scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;

View File

@ -100,7 +100,7 @@ void SoundTask_LoopSEAdjustPanning(u8 taskId)
gTasks[taskId].data[12] = r9;
gTasks[taskId].func = SoundTask_LoopSEAdjustPanning_Step;
SoundTask_LoopSEAdjustPanning_Step(taskId);
gTasks[taskId].func(taskId);
}
static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId)
@ -385,7 +385,7 @@ void SoundTask_AdjustPanningVar(u8 taskId)
gTasks[taskId].data[11] = sourcePan;
gTasks[taskId].func = SoundTask_AdjustPanningVar_Step;
SoundTask_AdjustPanningVar_Step(taskId);
gTasks[taskId].func(taskId);
}
static void SoundTask_AdjustPanningVar_Step(u8 taskId)

View File

@ -550,8 +550,8 @@ static void LoadHealthboxPalsForLevelUp(u8 *paletteId1, u8 *paletteId2, u8 battl
healthBoxSpriteId = gHealthboxSpriteIds[battler];
spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam;
spriteId2 = gSprites[healthBoxSpriteId].data[5];
*paletteId1 = AllocSpritePalette(0xD709);
*paletteId2 = AllocSpritePalette(0xD70A);
*paletteId1 = AllocSpritePalette(TAG_HEALTHBOX_PALS_1);
*paletteId2 = AllocSpritePalette(TAG_HEALTHBOX_PALS_2);
offset1 = (gSprites[healthBoxSpriteId].oam.paletteNum * 16) + 0x100;
offset2 = (gSprites[spriteId2].oam.paletteNum * 16) + 0x100;
@ -580,10 +580,10 @@ static void FreeHealthboxPalsForLevelUp(u8 battler)
spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam;
spriteId2 = gSprites[healthBoxSpriteId].data[5];
FreeSpritePaletteByTag(0xD709);
FreeSpritePaletteByTag(0xD70A);
paletteId1 = IndexOfSpritePaletteTag(0xD6FF);
paletteId2 = IndexOfSpritePaletteTag(0xD704);
FreeSpritePaletteByTag(TAG_HEALTHBOX_PALS_1);
FreeSpritePaletteByTag(TAG_HEALTHBOX_PALS_2);
paletteId1 = IndexOfSpritePaletteTag(TAG_HEALTHBOX_PAL);
paletteId2 = IndexOfSpritePaletteTag(TAG_HEALTHBAR_PAL);
gSprites[healthBoxSpriteId].oam.paletteNum = paletteId1;
gSprites[spriteId1].oam.paletteNum = paletteId1;
gSprites[spriteId2].oam.paletteNum = paletteId2;
@ -611,7 +611,7 @@ static void AnimTask_FlashHealthboxOnLevelUp_Step(u8 taskId)
if (gTasks[taskId].data[0]++ >= gTasks[taskId].data[11])
{
gTasks[taskId].data[0] = 0;
paletteNum = IndexOfSpritePaletteTag(0xD709);
paletteNum = IndexOfSpritePaletteTag(TAG_HEALTHBOX_PALS_1);
colorOffset = gTasks[taskId].data[10] == 0 ? 6 : 2;
switch (gTasks[taskId].data[1])
{

View File

@ -97,7 +97,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId)
for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
{
if (battler != animBattlers[0] && battler != animBattlers[1] && IsBattlerSpriteVisible(battler))
selectedPalettes |= 0x10000 << AnimDummyReturnArg(battler);
selectedPalettes |= 0x10000 << GetSpritePalIdxByBattler(battler);
}
StartBlendAnimSpriteColor(taskId, selectedPalettes);