Merge pull request #1742 from GriffinRichards/sound-pan

Add missing usage of SOUND_PAN_*
This commit is contained in:
GriffinR 2022-08-26 14:47:24 -04:00 committed by GitHub
commit c5e873aa2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 121 additions and 130 deletions

View File

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

View File

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

View File

@ -34,16 +34,19 @@ enum
#define TAG_HEALTHBAR_PLAYER2_TILE 0xD706 #define TAG_HEALTHBAR_PLAYER2_TILE 0xD706
#define TAG_HEALTHBAR_OPPONENT2_TILE 0xD707 #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_HEALTHBOX_SAFARI_TILE 0xD70B
#define TAG_STATUS_SUMMARY_BAR_TILE 0xD70C #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_BAR_PAL 0xD710
#define TAG_STATUS_SUMMARY_BALLS_PAL 0xD712 #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 enum
{ {
HEALTHBOX_ALL, HEALTHBOX_ALL,

View File

@ -84,7 +84,7 @@ static void AnimMilkBottle(struct Sprite *);
static void AnimMilkBottle_Step1(struct Sprite *); static void AnimMilkBottle_Step1(struct Sprite *);
static void AnimMilkBottle_Step2(struct Sprite *, int, int); static void AnimMilkBottle_Step2(struct Sprite *, int, int);
static void AnimGrantingStars(struct Sprite *); static void AnimGrantingStars(struct Sprite *);
static void AnimSparkingStars(struct Sprite *); static void AnimSparklingStars(struct Sprite *);
static void AnimBubbleBurst(struct Sprite *); static void AnimBubbleBurst(struct Sprite *);
static void AnimBubbleBurst_Step(struct Sprite *); static void AnimBubbleBurst_Step(struct Sprite *);
static void AnimSleepLetterZ(struct Sprite *); static void AnimSleepLetterZ(struct Sprite *);
@ -1416,7 +1416,7 @@ const struct SpriteTemplate gSparklingStarsSpriteTemplate =
.anims = gGrantingStarsAnimTable, .anims = gGrantingStarsAnimTable,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSparkingStars, .callback = AnimSparklingStars,
}; };
static const union AnimCmd sAnim_BubbleBurst[] = static const union AnimCmd sAnim_BubbleBurst[] =
@ -3184,14 +3184,14 @@ static void AnimItemSteal_Step3(struct Sprite *sprite)
sprite->y2 = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8); sprite->y2 = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8);
if (sprite->y2 == 0) if (sprite->y2 == 0)
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(63)); PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
if (moveAlongLinearPath(sprite)) if (moveAlongLinearPath(sprite))
{ {
sprite->y2 = 0; sprite->y2 = 0;
sprite->data[0] = 0; sprite->data[0] = 0;
sprite->callback = AnimItemSteal_Step2; sprite->callback = AnimItemSteal_Step2;
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64)); PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
} }
} }
@ -4137,7 +4137,7 @@ static void AnimGrantingStars(struct Sprite *sprite)
sprite->callback = TranslateSpriteLinearFixedPoint; sprite->callback = TranslateSpriteLinearFixedPoint;
} }
static void AnimSparkingStars(struct Sprite *sprite) static void AnimSparklingStars(struct Sprite *sprite)
{ {
u8 battler; u8 battler;
if (!gBattleAnimArgs[2]) if (!gBattleAnimArgs[2])
@ -4264,7 +4264,7 @@ static void AnimLockOnTarget_Step1(struct Sprite *sprite)
sprite->callback = StartAnimLinearTranslation; sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step2); StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step2);
sprite->data[5] += 0x100; sprite->data[5] += 0x100;
PlaySE12WithPanning(SE_M_LOCK_ON, BattleAnimAdjustPanning(63)); PlaySE12WithPanning(SE_M_LOCK_ON, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
break; break;
} }
@ -4350,7 +4350,7 @@ static void AnimLockOnTarget_Step4(struct Sprite *sprite)
sprite->data[2]++; sprite->data[2]++;
pal = sprite->oam.paletteNum; pal = sprite->oam.paletteNum;
LoadPalette(&gPlttBufferUnfaded[0x108 + pal * 16], pal * 16 | 0x101, 4); LoadPalette(&gPlttBufferUnfaded[0x108 + pal * 16], pal * 16 | 0x101, 4);
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(63)); PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
} }
else if (sprite->data[1] == 0) else if (sprite->data[1] == 0)
{ {
@ -4812,7 +4812,7 @@ static void AnimSharpenSphere(struct Sprite *sprite)
sprite->data[2] = 0; sprite->data[2] = 0;
sprite->data[3] = 0; sprite->data[3] = 0;
sprite->data[4] = 0; sprite->data[4] = 0;
sprite->data[5] = BattleAnimAdjustPanning(-64); sprite->data[5] = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
sprite->callback = AnimSharpenSphere_Step; sprite->callback = AnimSharpenSphere_Step;
} }

View File

@ -1642,7 +1642,7 @@ static void AirCutterProjectileStep1(u8 taskId)
gTasks[taskId].data[gTasks[taskId].data[1] + 13] = spriteId; gTasks[taskId].data[gTasks[taskId].data[1] + 13] = spriteId;
gTasks[taskId].data[0] = gTasks[taskId].data[3]; gTasks[taskId].data[0] = gTasks[taskId].data[3];
gTasks[taskId].data[1]++; gTasks[taskId].data[1]++;
PlaySE12WithPanning(SE_M_BLIZZARD2, BattleAnimAdjustPanning(-63)); PlaySE12WithPanning(SE_M_BLIZZARD2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER + 1));
if (gTasks[taskId].data[1] > 2) if (gTasks[taskId].data[1] > 2)
gTasks[taskId].func = AirCutterProjectileStep2; gTasks[taskId].func = AirCutterProjectileStep2;
} }
@ -1839,7 +1839,7 @@ static void AnimBulletSeed_Step1(struct Sprite *sprite)
int i; int i;
u16 rand; u16 rand;
s16 *ptr; s16 *ptr;
PlaySE12WithPanning(SE_M_HORN_ATTACK, BattleAnimAdjustPanning(63)); PlaySE12WithPanning(SE_M_HORN_ATTACK, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->x += sprite->x2; sprite->x += sprite->x2;
sprite->y += sprite->y2; sprite->y += sprite->y2;
sprite->y2 = 0; sprite->y2 = 0;
@ -2485,7 +2485,7 @@ static void AnimPencil(struct Sprite *sprite)
sprite->data[3] = 16; sprite->data[3] = 16;
sprite->data[4] = 0; sprite->data[4] = 0;
sprite->data[5] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT) + 2; sprite->data[5] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT) + 2;
sprite->data[6] = BattleAnimAdjustPanning(63); sprite->data[6] = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
sprite->callback = AnimPencil_Step; sprite->callback = AnimPencil_Step;
} }
@ -3043,9 +3043,7 @@ void AnimTask_FreeMusicNotesPals(u8 taskId)
static void SetMusicNotePalette(struct Sprite *sprite, u8 a, u8 b) static void SetMusicNotePalette(struct Sprite *sprite, u8 a, u8 b)
{ {
u8 tile; u8 tile = (b & 1) ? 32 : 0;
tile = (b & 1);
tile = ((-tile | tile) >> 31) & 32;
sprite->oam.tileNum += tile + (a << 2); sprite->oam.tileNum += tile + (a << 2);
sprite->oam.paletteNum = IndexOfSpritePaletteTag(sMusicNotePaletteTagsTable[b >> 1]); sprite->oam.paletteNum = IndexOfSpritePaletteTag(sMusicNotePaletteTagsTable[b >> 1]);
} }
@ -3792,8 +3790,7 @@ static void AnimPerishSongMusicNote_Step2(struct Sprite *sprite)
if (sprite->data[4] > 3) if (sprite->data[4] > 3)
{ {
int var1 = sprite->data[2]; sprite->invisible = sprite->data[2] % 2;
sprite->invisible = var1 - (((s32)(var1 + ((u32)var1 >> 31)) >> 1) << 1);
DestroyAnimSprite(sprite); DestroyAnimSprite(sprite);
} }

View File

@ -1646,7 +1646,7 @@ static void AnimClappingHand_Step(struct Sprite *sprite)
sprite->data[2]++; sprite->data[2]++;
if (sprite->data[3] == 0) if (sprite->data[3] == 0)
{ {
PlaySE1WithPanning(SE_M_ENCORE, BattleAnimAdjustPanning(-64)); PlaySE1WithPanning(SE_M_ENCORE, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
} }
} }
} }
@ -1930,7 +1930,7 @@ static void TormentAttacker_Step(u8 taskId)
y = task->data[3] + task->data[5]; y = task->data[3] + task->data[5];
spriteId = CreateSprite(&gThoughtBubbleSpriteTemplate, x, y, 6 - task->data[1]); spriteId = CreateSprite(&gThoughtBubbleSpriteTemplate, x, y, 6 - task->data[1]);
PlaySE12WithPanning(SE_M_METRONOME, BattleAnimAdjustPanning(-64)); PlaySE12WithPanning(SE_M_METRONOME, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
if (spriteId != MAX_SPRITES) if (spriteId != MAX_SPRITES)
{ {
@ -2107,7 +2107,7 @@ static void AnimWishStar(struct Sprite *sprite)
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
sprite->x = -16; sprite->x = -16;
else else
sprite->x = 256; sprite->x = DISPLAY_WIDTH + 16;
sprite->y = 0; sprite->y = 0;
sprite->callback = AnimWishStar_Step; sprite->callback = AnimWishStar_Step;
@ -2136,7 +2136,7 @@ static void AnimWishStar_Step(struct Sprite *sprite)
} }
newX = sprite->x + sprite->x2 + 32; newX = sprite->x + sprite->x2 + 32;
if (newX > 304) if (newX > DISPLAY_WIDTH + 64)
DestroyAnimSprite(sprite); DestroyAnimSprite(sprite);
} }
@ -2411,7 +2411,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId)
gTasks[taskId].data[11] = gBattle_BG1_Y; gTasks[taskId].data[11] = gBattle_BG1_Y;
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(-64)); PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
break; break;
case 1: case 1:
if (gTasks[taskId].data[4]++ > 0) if (gTasks[taskId].data[4]++ > 0)
@ -2446,7 +2446,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId)
{ {
gTasks[taskId].data[3] = 0; gTasks[taskId].data[3] = 0;
gTasks[taskId].data[0] = 1; gTasks[taskId].data[0] = 1;
PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(-64)); PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
} }
break; break;
case 4: case 4:
@ -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. // Copies the target mon's sprite, and makes a white silhouette that shrinks away.
void AnimTask_RolePlaySilhouette(u8 taskId) void AnimTask_RolePlaySilhouette(u8 taskId)
{ {
u8 isBackPic; bool8 isBackPic;
u32 personality; u32 personality;
u32 otId; u32 otId;
u16 species; u16 species;
@ -3206,7 +3206,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
{ {
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{ {
isBackPic = 0; isBackPic = FALSE;
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY); personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY);
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID); otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID);
if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE) if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE)
@ -3226,7 +3226,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
} }
else else
{ {
isBackPic = 1; isBackPic = TRUE;
personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY); personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY);
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID); otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID);
if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE) if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE)
@ -4845,7 +4845,7 @@ static void AnimTask_MonToSubstituteDoll(u8 taskId)
if (gSprites[spriteId].y2 == 0) if (gSprites[spriteId].y2 == 0)
{ {
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64)); PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
gTasks[taskId].data[10] -= 0x800; gTasks[taskId].data[10] -= 0x800;
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
@ -4867,7 +4867,7 @@ static void AnimTask_MonToSubstituteDoll(u8 taskId)
if (gSprites[spriteId].y2 == 0) if (gSprites[spriteId].y2 == 0)
{ {
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64)); PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
} }
break; break;
@ -4904,7 +4904,7 @@ static void AnimBlockX_Step(struct Sprite *sprite)
sprite->y2 += 10; sprite->y2 += 10;
if (sprite->y2 >= 0) if (sprite->y2 >= 0)
{ {
PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(63)); PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->y2 = 0; sprite->y2 = 0;
sprite->data[0]++; sprite->data[0]++;
} }
@ -4914,7 +4914,7 @@ static void AnimBlockX_Step(struct Sprite *sprite)
sprite->y2 = -(gSineTable[sprite->data[1]] >> 3); sprite->y2 = -(gSineTable[sprite->data[1]] >> 3);
if (sprite->data[1] > 0x7F) if (sprite->data[1] > 0x7F)
{ {
PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(63)); PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->data[1] = 0; sprite->data[1] = 0;
sprite->y2 = 0; sprite->y2 = 0;
sprite->data[0]++; sprite->data[0]++;
@ -4933,7 +4933,7 @@ static void AnimBlockX_Step(struct Sprite *sprite)
case 3: case 3:
if (++sprite->data[1] > 8) if (++sprite->data[1] > 8)
{ {
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(63)); PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->data[1] = 0; sprite->data[1] = 0;
sprite->data[0]++; sprite->data[0]++;
} }
@ -5097,7 +5097,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
gTasks[taskId].data[1] &= 0xFF; gTasks[taskId].data[1] &= 0xFF;
x = gSprites[spriteId].x + gSprites[spriteId].x2; 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[1] = 0;
gTasks[taskId].data[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[1] = 0;
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
@ -5227,7 +5227,7 @@ static void AnimUnusedItemBagSteal(struct Sprite *sprite)
case 0: case 0:
if (gBattleAnimArgs[7] == -1) if (gBattleAnimArgs[7] == -1)
{ {
PlaySE12WithPanning(SE_M_VITAL_THROW, BattleAnimAdjustPanning(63)); PlaySE12WithPanning(SE_M_VITAL_THROW, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 16; sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 16;
sprite->data[0] = -32; sprite->data[0] = -32;
sprite->data[7]++; sprite->data[7]++;

View File

@ -583,7 +583,7 @@ static void AnimZapCannonSpark(struct Sprite *sprite)
sprite->data[7] = gBattleAnimArgs[4]; sprite->data[7] = gBattleAnimArgs[4];
sprite->oam.tileNum += gBattleAnimArgs[6] * 4; sprite->oam.tileNum += gBattleAnimArgs[6] * 4;
sprite->callback = AnimZapCannonSpark_Step; sprite->callback = AnimZapCannonSpark_Step;
AnimZapCannonSpark_Step(sprite); sprite->callback(sprite);
} }
static void AnimZapCannonSpark_Step(struct Sprite *sprite) static void AnimZapCannonSpark_Step(struct Sprite *sprite)
@ -1159,7 +1159,7 @@ void AnimTask_ShockWaveProgressingBolt(u8 taskId)
task->data[4] = 7; task->data[4] = 7;
task->data[5] = -1; task->data[5] = -1;
task->data[11] = 12; task->data[11] = 12;
task->data[12] = BattleAnimAdjustPanning(task->data[11] - 76); task->data[12] = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
task->data[13] = BattleAnimAdjustPanning(SOUND_PAN_TARGET); task->data[13] = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
task->data[14] = task->data[12]; task->data[14] = task->data[12];
task->data[15] = (task->data[13] - task->data[12]) / 3; task->data[15] = (task->data[13] - task->data[12]) / 3;

View File

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

View File

@ -1227,8 +1227,8 @@ void AnimTask_MoveHeatWaveTargets(u8 taskId)
{ {
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
task->data[12] = !GetBattlerSide(gBattleAnimAttacker) ? 1 : -1; task->data[12] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1;
task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ 2) + 1; task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ BIT_FLANK) + 1;
task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET); task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET);
task->data[15] = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER); 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 if (sprite->x + sprite->x2 < -32
|| sprite->x + sprite->x2 > DISPLAY_WIDTH + 32 || sprite->x + sprite->x2 > DISPLAY_WIDTH + 32
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT) || sprite->y + sprite->y2 > DISPLAY_HEIGHT)
{ {
gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = FALSE; gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = FALSE;
DestroyAnimSprite(sprite); DestroyAnimSprite(sprite);
@ -1215,8 +1215,8 @@ void AnimSkyAttackBird_Step(struct Sprite *sprite)
sprite->x = sprite->data[4] >> 4; sprite->x = sprite->data[4] >> 4;
sprite->y = sprite->data[5] >> 4; sprite->y = sprite->data[5] >> 4;
if (sprite->x > 285 || sprite->x < -45 if (sprite->x > DISPLAY_WIDTH + 45 || sprite->x < -45
|| sprite->y > 157 || sprite->y < -45) || sprite->y > 157 || sprite->y < -45)
DestroySpriteAndMatrix(sprite); DestroySpriteAndMatrix(sprite);
} }

View File

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

View File

@ -5,7 +5,6 @@
#include "task.h" #include "task.h"
#include "trig.h" #include "trig.h"
// This file's functions.
static void AnimTask_ShakeMon_Step(u8 taskId); static void AnimTask_ShakeMon_Step(u8 taskId);
static void AnimTask_ShakeMon2_Step(u8 taskId); static void AnimTask_ShakeMon2_Step(u8 taskId);
static void AnimTask_ShakeMonInPlace_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[4] = gBattleAnimArgs[1];
gTasks[taskId].data[5] = gBattleAnimArgs[2]; gTasks[taskId].data[5] = gBattleAnimArgs[2];
gTasks[taskId].func = AnimTask_ShakeMon_Step; gTasks[taskId].func = AnimTask_ShakeMon_Step;
AnimTask_ShakeMon_Step(taskId); gTasks[taskId].func(taskId);
} }
static void AnimTask_ShakeMon_Step(u8 taskId) static void AnimTask_ShakeMon_Step(u8 taskId)
@ -156,17 +155,14 @@ static void AnimTask_ShakeMon_Step(u8 taskId)
void AnimTask_ShakeMon2(u8 taskId) void AnimTask_ShakeMon2(u8 taskId)
{ {
u8 spriteId; u8 spriteId;
bool8 destroy = FALSE; bool8 abort = FALSE;
u8 battlerId; u8 battlerId;
if (gBattleAnimArgs[0] < MAX_BATTLERS_COUNT) if (gBattleAnimArgs[0] < MAX_BATTLERS_COUNT)
{ {
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (spriteId == SPRITE_NONE) if (spriteId == SPRITE_NONE)
{ abort = TRUE;
DestroyAnimVisualTask(taskId);
return;
}
} }
else if (gBattleAnimArgs[0] != 8) else if (gBattleAnimArgs[0] != 8)
{ {
@ -188,7 +184,7 @@ void AnimTask_ShakeMon2(u8 taskId)
} }
if (IsBattlerSpriteVisible(battlerId) == FALSE) if (IsBattlerSpriteVisible(battlerId) == FALSE)
destroy = TRUE; abort = TRUE;
spriteId = gBattlerSpriteIds[battlerId]; spriteId = gBattlerSpriteIds[battlerId];
} }
@ -197,7 +193,7 @@ void AnimTask_ShakeMon2(u8 taskId)
spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
} }
if (destroy) if (abort)
{ {
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
return; return;
@ -332,10 +328,8 @@ void AnimTask_ShakeAndSinkMon(u8 taskId)
static void AnimTask_ShakeAndSinkMon_Step(u8 taskId) static void AnimTask_ShakeAndSinkMon_Step(u8 taskId)
{ {
s16 x; u8 spriteId = gTasks[taskId].data[0];
u8 spriteId; s16 x = gTasks[taskId].data[1];
spriteId = gTasks[taskId].data[0];
x = gTasks[taskId].data[1];
if (gTasks[taskId].data[2] == gTasks[taskId].data[8]++) if (gTasks[taskId].data[2] == gTasks[taskId].data[8]++)
{ {
gTasks[taskId].data[8] = 0; gTasks[taskId].data[8] = 0;
@ -365,11 +359,8 @@ static void AnimTask_ShakeAndSinkMon_Step(u8 taskId)
void AnimTask_TranslateMonElliptical(u8 taskId) void AnimTask_TranslateMonElliptical(u8 taskId)
{ {
u8 i; u8 i;
u8 spriteId; u8 wavePeriod = 1;
u8 wavePeriod; u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
wavePeriod = 1;
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (gBattleAnimArgs[4] > 5) if (gBattleAnimArgs[4] > 5)
gBattleAnimArgs[4] = 5; gBattleAnimArgs[4] = 5;
@ -742,7 +733,7 @@ static void AnimTask_SlideOffScreen_Step(u8 taskId)
{ {
u8 spriteId = gTasks[taskId].data[0]; u8 spriteId = gTasks[taskId].data[0];
gSprites[spriteId].x2 += gTasks[taskId].data[1]; 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); DestroyAnimVisualTask(taskId);
return; return;
@ -831,8 +822,7 @@ static void AnimTask_SwayMonStep(u8 taskId)
// arg 4: sprite object mode // arg 4: sprite object mode
void AnimTask_ScaleMonAndRestore(u8 taskId) void AnimTask_ScaleMonAndRestore(u8 taskId)
{ {
u8 spriteId; u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]);
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]);
PrepareBattlerSpriteForRotScale(spriteId, gBattleAnimArgs[4]); PrepareBattlerSpriteForRotScale(spriteId, gBattleAnimArgs[4]);
gTasks[taskId].data[0] = gBattleAnimArgs[0]; gTasks[taskId].data[0] = gBattleAnimArgs[0];
gTasks[taskId].data[1] = gBattleAnimArgs[1]; gTasks[taskId].data[1] = gBattleAnimArgs[1];
@ -893,7 +883,7 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId)
} }
else else
{ {
if (gBattleAnimArgs[2] == 0) if (gBattleAnimArgs[2] == ANIM_ATTACKER)
{ {
gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimAttacker); 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 // Rotates mon to side and back to original position. For Peck and when a held item activates
void AnimTask_RotateMonToSideAndRestore(u8 taskId) void AnimTask_RotateMonToSideAndRestore(u8 taskId)
{ {
u8 spriteId; u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]);
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]);
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL); PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
gTasks[taskId].data[1] = 0; gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = gBattleAnimArgs[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_1 55125
#define TAG_MOVE_EFFECT_MON_2 55126 #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, .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_1, },
{ gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_2, }, { gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_2, },
@ -440,7 +440,7 @@ void SetCallbackToStoredInData6(struct Sprite *sprite)
#define sAmplitudeX sAmplitude #define sAmplitudeX sAmplitude
#define sAmplitudeY data[4] #define sAmplitudeY data[4]
// TranslateSpriteInWavePattern // TranslateSpriteInLissajousCurve
#define sCirclePosX sCirclePos #define sCirclePosX sCirclePos
#define sCircleSpeedX sCircleSpeed #define sCircleSpeedX sCircleSpeed
#define sCirclePosY data[4] #define sCirclePosY data[4]
@ -487,7 +487,7 @@ void TranslateSpriteInGrowingCircle(struct Sprite *sprite)
// Unused // Unused
// Exact shape depends on arguments. Can move in a figure-8-like pattern, or circular, etc. // 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) if (sprite->sDuration)
{ {
@ -1508,13 +1508,13 @@ u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLef
return selectedPalettes; return selectedPalettes;
} }
// Presumably something commented here, just returns arg u8 GetSpritePalIdxByBattler(u8 battler)
u8 AnimDummyReturnArg(u8 battler)
{ {
return battler; return battler;
} }
static u8 GetBattlerAtPosition_(u8 position) // Unused
static u8 GetSpritePalIdxByPosition(u8 position)
{ {
return GetBattlerAtPosition(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 // arg 5: lower 8 bits = location on attacking mon, upper 8 bits = location on target mon pick to target
void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite) void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite)
{ {
bool8 v1; bool8 respectMonPicOffsets;
u8 coordType; u8 coordType;
if (!(gBattleAnimArgs[5] & 0xff00)) if (!(gBattleAnimArgs[5] & 0xff00))
v1 = TRUE; respectMonPicOffsets = TRUE;
else else
v1 = FALSE; respectMonPicOffsets = FALSE;
if (!(gBattleAnimArgs[5] & 0xff)) if (!(gBattleAnimArgs[5] & 0xff))
coordType = BATTLER_COORD_Y_PIC_OFFSET; coordType = BATTLER_COORD_Y_PIC_OFFSET;
else else
coordType = BATTLER_COORD_Y; coordType = BATTLER_COORD_Y;
InitSpritePosToAnimAttacker(sprite, v1); InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2]; 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 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm)
{ {
u8 spriteId; u8 spriteId;
u16 sheet = LoadSpriteSheet(&sSpriteSheet_MoveEffectMons[id]); u16 sheet = LoadSpriteSheet(&sSpriteSheets_MoveEffectMons[id]);
u16 palette = AllocSpritePalette(sSpriteTemplate_MoveEffectMons[id].paletteTag); u16 palette = AllocSpritePalette(sSpriteTemplates_MoveEffectMons[id].paletteTag);
if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->buffer == NULL) if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->buffer == NULL)
gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000); gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000);
@ -2139,9 +2139,9 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16
FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer); FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer);
if (!isBackpic) 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 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()) if (IsContest())
{ {

View File

@ -818,7 +818,7 @@ static void AnimTask_ImprisonOrbs_Step(u8 taskId)
{ {
for (i = 8; i < 13; i++) for (i = 8; i < 13; i++)
{ {
if (task->data[i] != 64) if (task->data[i] != MAX_SPRITES)
DestroySprite(&gSprites[task->data[i]]); DestroySprite(&gSprites[task->data[i]]);
} }
@ -997,12 +997,10 @@ void AnimTask_ExtrasensoryDistortion(u8 taskId)
scanlineParams.dmaDest = &REG_BG2HOFS; scanlineParams.dmaDest = &REG_BG2HOFS;
} }
i = task->data[14]; for (i = task->data[14]; i <= task->data[14] + 64; i++)
while (i <= task->data[14] + 64)
{ {
gScanlineEffectRegBuffers[0][i] = task->data[10]; gScanlineEffectRegBuffers[0][i] = task->data[10];
gScanlineEffectRegBuffers[1][i] = task->data[10]; gScanlineEffectRegBuffers[1][i] = task->data[10];
i++;
} }
scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT; scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;
@ -1137,7 +1135,7 @@ static void AnimPsychoBoost(struct Sprite *sprite)
case 1: case 1:
if (sprite->affineAnimEnded) if (sprite->affineAnimEnded)
{ {
PlaySE12WithPanning(SE_M_TELEPORT, BattleAnimAdjustPanning(-64)); PlaySE12WithPanning(SE_M_TELEPORT, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
ChangeSpriteAffineAnim(sprite, 1); ChangeSpriteAffineAnim(sprite, 1);
sprite->data[0]++; sprite->data[0]++;
} }

View File

@ -596,8 +596,8 @@ void AnimTask_Rollout(u8 taskId)
task->data[6] = 0; task->data[6] = 0;
task->data[7] = 0; task->data[7] = 0;
pan1 = BattleAnimAdjustPanning(-64); pan1 = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
pan2 = BattleAnimAdjustPanning(63); pan2 = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
task->data[13] = pan1; task->data[13] = pan1;
task->data[14] = (pan2 - pan1) / task->data[8]; task->data[14] = (pan2 - pan1) / task->data[8];

View File

@ -100,7 +100,7 @@ void SoundTask_LoopSEAdjustPanning(u8 taskId)
gTasks[taskId].data[12] = r9; gTasks[taskId].data[12] = r9;
gTasks[taskId].func = SoundTask_LoopSEAdjustPanning_Step; gTasks[taskId].func = SoundTask_LoopSEAdjustPanning_Step;
SoundTask_LoopSEAdjustPanning_Step(taskId); gTasks[taskId].func(taskId);
} }
static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId) static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId)
@ -385,7 +385,7 @@ void SoundTask_AdjustPanningVar(u8 taskId)
gTasks[taskId].data[11] = sourcePan; gTasks[taskId].data[11] = sourcePan;
gTasks[taskId].func = SoundTask_AdjustPanningVar_Step; gTasks[taskId].func = SoundTask_AdjustPanningVar_Step;
SoundTask_AdjustPanningVar_Step(taskId); gTasks[taskId].func(taskId);
} }
static void SoundTask_AdjustPanningVar_Step(u8 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]; healthBoxSpriteId = gHealthboxSpriteIds[battler];
spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam;
spriteId2 = gSprites[healthBoxSpriteId].data[5]; spriteId2 = gSprites[healthBoxSpriteId].data[5];
*paletteId1 = AllocSpritePalette(0xD709); *paletteId1 = AllocSpritePalette(TAG_HEALTHBOX_PALS_1);
*paletteId2 = AllocSpritePalette(0xD70A); *paletteId2 = AllocSpritePalette(TAG_HEALTHBOX_PALS_2);
offset1 = (gSprites[healthBoxSpriteId].oam.paletteNum * 16) + 0x100; offset1 = (gSprites[healthBoxSpriteId].oam.paletteNum * 16) + 0x100;
offset2 = (gSprites[spriteId2].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; spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam;
spriteId2 = gSprites[healthBoxSpriteId].data[5]; spriteId2 = gSprites[healthBoxSpriteId].data[5];
FreeSpritePaletteByTag(0xD709); FreeSpritePaletteByTag(TAG_HEALTHBOX_PALS_1);
FreeSpritePaletteByTag(0xD70A); FreeSpritePaletteByTag(TAG_HEALTHBOX_PALS_2);
paletteId1 = IndexOfSpritePaletteTag(0xD6FF); paletteId1 = IndexOfSpritePaletteTag(TAG_HEALTHBOX_PAL);
paletteId2 = IndexOfSpritePaletteTag(0xD704); paletteId2 = IndexOfSpritePaletteTag(TAG_HEALTHBAR_PAL);
gSprites[healthBoxSpriteId].oam.paletteNum = paletteId1; gSprites[healthBoxSpriteId].oam.paletteNum = paletteId1;
gSprites[spriteId1].oam.paletteNum = paletteId1; gSprites[spriteId1].oam.paletteNum = paletteId1;
gSprites[spriteId2].oam.paletteNum = paletteId2; 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]) if (gTasks[taskId].data[0]++ >= gTasks[taskId].data[11])
{ {
gTasks[taskId].data[0] = 0; gTasks[taskId].data[0] = 0;
paletteNum = IndexOfSpritePaletteTag(0xD709); paletteNum = IndexOfSpritePaletteTag(TAG_HEALTHBOX_PALS_1);
colorOffset = gTasks[taskId].data[10] == 0 ? 6 : 2; colorOffset = gTasks[taskId].data[10] == 0 ? 6 : 2;
switch (gTasks[taskId].data[1]) switch (gTasks[taskId].data[1])
{ {

View File

@ -97,7 +97,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId)
for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++) for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
{ {
if (battler != animBattlers[0] && battler != animBattlers[1] && IsBattlerSpriteVisible(battler)) if (battler != animBattlers[0] && battler != animBattlers[1] && IsBattlerSpriteVisible(battler))
selectedPalettes |= 0x10000 << AnimDummyReturnArg(battler); selectedPalettes |= 0x10000 << GetSpritePalIdxByBattler(battler);
} }
StartBlendAnimSpriteColor(taskId, selectedPalettes); StartBlendAnimSpriteColor(taskId, selectedPalettes);
@ -535,9 +535,9 @@ static void StatsChangeAnimation_Step2(u8 taskId)
gTasks[taskId].func = StatsChangeAnimation_Step3; gTasks[taskId].func = StatsChangeAnimation_Step3;
if (sAnimStatsChangeData->data[0] == 0) if (sAnimStatsChangeData->data[0] == 0)
PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(-64)); PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER));
else else
PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(-64)); PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER));
} }
static void StatsChangeAnimation_Step3(u8 taskId) static void StatsChangeAnimation_Step3(u8 taskId)