diff --git a/include/battle_anim.h b/include/battle_anim.h index 01931125f..8745b0d26 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -74,7 +74,7 @@ void HandleIntroSlide(u8 terrainId); int GetAnimBgAttribute(u8 bgId, u8 attributeId); // battle_anim_mons.c -void TranslateSpriteInEllipseOverDuration(struct Sprite *sprite); +void TranslateSpriteInEllipse(struct Sprite *sprite); void AnimTranslateLinearAndFlicker(struct Sprite *sprite); void AnimTranslateLinearAndFlicker_Flipped(struct Sprite *sprite); void AnimWeatherBallUp(struct Sprite *sprite); @@ -103,7 +103,7 @@ u8 GetBattlerYCoordWithElevation(u8 battlerId); void WaitAnimForDuration(struct Sprite *sprite); void AnimTravelDiagonally(struct Sprite *sprite); void InitAnimLinearTranslation(struct Sprite *sprite); -void AnimTranslateLinear_WaitEnd(struct Sprite *sprite); +void AnimTranslateLinear_WithFollowup(struct Sprite *sprite); u8 GetBattlerSpriteBGPriority(u8 battlerId); void *LoadPointerFromVars(s16 bottom, s16 top); void StorePointerInVars(s16 *bottom, s16 *top, const void *ptr); @@ -128,7 +128,7 @@ u8 CreateInvisibleSpriteCopy(int, u8, int); void AnimLoadCompressedBgTilemapHandleContest(struct BattleAnimBgData*, const void*, bool32); void AnimLoadCompressedBgGfx(u32, const u32*, u32); void UpdateAnimBg3ScreenSize(bool8); -void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *); +void TranslateSpriteInGrowingCircle(struct Sprite *); void sub_80A653C(struct Sprite *); void SetBattlerSpriteYOffsetFromYScale(u8 spriteId); void PrepareEruptAnimTaskData(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7); @@ -142,12 +142,12 @@ void TranslateSpriteLinearById(struct Sprite *sprite); void TranslateSpriteLinear(struct Sprite *sprite); void AnimSpriteOnMonPos(struct Sprite *sprite); void InitAnimLinearTranslationWithSpeedAndPos(struct Sprite *sprite); -void TranslateSpriteInCircleOverDuration(struct Sprite *sprite); +void TranslateSpriteInCircle(struct Sprite *sprite); void SetGrayscaleOrOriginalPalette(u16 palNum, bool8 restoreOriginal); void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union AffineAnimCmd *affineAnimCmds); bool8 RunAffineAnimFromTaskData(struct Task *task); void AnimThrowProjectile(struct Sprite *sprite); -void sub_80A6BFC(struct BattleAnimBgData *unk, u8 unused); +void GetBgDataForTransform(struct BattleAnimBgData *dest, u8 battlerId); u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm); void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite); void TradeMenuBouncePartySprites(struct Sprite *sprite); diff --git a/include/battle_main.h b/include/battle_main.h index f3e961b7b..b7691b4fd 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -65,7 +65,7 @@ void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d); void EndBounceEffect(u8 battlerId, bool8 b); void SpriteCB_PlayerMonFromBall(struct Sprite *sprite); void SpriteCB_TrainerThrowObject(struct Sprite *sprite); -void sub_8039E9C(struct Sprite *sprite); +void AnimSetCenterToCornerVecX(struct Sprite *sprite); void BeginBattleIntroDummy(void); void BeginBattleIntro(void); void SwitchInClearSetData(void); diff --git a/src/battle_anim_bug.c b/src/battle_anim_bug.c index 105cc611e..14b98fcb2 100644 --- a/src/battle_anim_bug.c +++ b/src/battle_anim_bug.c @@ -212,12 +212,12 @@ static void AnimMegahornHorn(struct Sprite *sprite) gBattleAnimArgs[0] = -gBattleAnimArgs[0]; } - sprite->x = GetBattlerSpriteCoord2(gBattleAnimTarget, 2) + gBattleAnimArgs[0]; - sprite->y = GetBattlerSpriteCoord2(gBattleAnimTarget, 3) + gBattleAnimArgs[1]; + sprite->x = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[0]; + sprite->y = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1]; sprite->data[0] = gBattleAnimArgs[4]; - sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2]; - sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3]; sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); @@ -236,12 +236,12 @@ static void AnimLeechLifeNeedle(struct Sprite *sprite) gBattleAnimArgs[0] = -gBattleAnimArgs[0]; } - sprite->x = GetBattlerSpriteCoord2(gBattleAnimTarget, 2) + gBattleAnimArgs[0]; - sprite->y = GetBattlerSpriteCoord2(gBattleAnimTarget, 3) + gBattleAnimArgs[1]; + sprite->x = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[0]; + sprite->y = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1]; sprite->data[0] = gBattleAnimArgs[2]; - sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); - sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); @@ -266,8 +266,8 @@ static void AnimTranslateWebThread(struct Sprite *sprite) if (!gBattleAnimArgs[4]) { - sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); - sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); } else { @@ -394,8 +394,8 @@ static void AnimTranslateStinger(struct Sprite *sprite) InitSpritePosToAnimAttacker(sprite, 1); - lVarX = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2]; - lVarY = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3]; + lVarX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; + lVarY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3]; rot = ArcTan2Neg(lVarX - sprite->x, lVarY - sprite->y); rot += 0xC000; TrySetSpriteRotScale(sprite, FALSE, 0x100, 0x100, rot); @@ -423,8 +423,8 @@ static void AnimMissileArc(struct Sprite *sprite) gBattleAnimArgs[2] = -gBattleAnimArgs[2]; sprite->data[0] = gBattleAnimArgs[4]; - sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2]; - sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3]; sprite->data[5] = gBattleAnimArgs[5]; InitAnimArcTranslation(sprite); @@ -473,13 +473,13 @@ static void AnimTailGlowOrb(struct Sprite *sprite) { if (gBattleAnimArgs[0] == ANIM_ATTACKER) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + 18; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + 18; } else { - sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2); - sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + 18; + sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + 18; } StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); diff --git a/src/battle_anim_dragon.c b/src/battle_anim_dragon.c index 1bc0f569b..029a5c30d 100644 --- a/src/battle_anim_dragon.c +++ b/src/battle_anim_dragon.c @@ -189,8 +189,8 @@ const struct SpriteTemplate gOverheatFlameSpriteTemplate = static void AnimOutrageFlame(struct Sprite *sprite) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { sprite->x -= gBattleAnimArgs[0]; @@ -215,8 +215,8 @@ static void AnimOutrageFlame(struct Sprite *sprite) static void StartDragonFireTranslation(struct Sprite *sprite) { SetSpriteCoordsToAnimAttackerCoords(sprite); - sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); - sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { sprite->x -= gBattleAnimArgs[1]; @@ -242,13 +242,13 @@ static void AnimDragonRageFirePlume(struct Sprite *sprite) { if (gBattleAnimArgs[0] == 0) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0); - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1); + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X); + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y); } else { - sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0); - sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1); + sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X); + sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y); } SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[1]); @@ -270,8 +270,8 @@ static void AnimDragonDanceOrb(struct Sprite *sprite) { u16 r5; u16 r0; - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); sprite->data[4] = 0; sprite->data[5] = 1; sprite->data[6] = gBattleAnimArgs[0]; @@ -417,8 +417,8 @@ static void AnimOverheatFlame(struct Sprite *sprite) { int i; int yAmplitude = (gBattleAnimArgs[2] * 3) / 5; - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[4]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[4]; sprite->data[1] = Cos(gBattleAnimArgs[1], gBattleAnimArgs[2]); sprite->data[2] = Sin(gBattleAnimArgs[1], yAmplitude); sprite->x += sprite->data[1] * gBattleAnimArgs[0]; diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 9d1842176..d460b9236 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -4155,13 +4155,13 @@ static void AnimSparkingStars(struct Sprite* sprite) { if (!gBattleAnimArgs[6]) { - sprite->x = GetBattlerSpriteCoord(battler, 0); - sprite->y = GetBattlerSpriteCoord(battler, 1) + gBattleAnimArgs[1]; + sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X); + sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y) + gBattleAnimArgs[1]; } else { - sprite->x = GetBattlerSpriteCoord(battler, 2); - sprite->y = GetBattlerSpriteCoord(battler, 3) + gBattleAnimArgs[1]; + sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2); + sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1]; } SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]); @@ -4324,8 +4324,8 @@ static void AnimLockOnTarget_Step3(struct Sprite* sprite) sprite->y2 = 0; sprite->x2 = 0; sprite->data[0] = 6; - sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + a; - sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + b; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + a; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + b; sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step5); } @@ -4709,13 +4709,13 @@ static void AnimSlashSlice(struct Sprite* sprite) { if (gBattleAnimArgs[0] == 0) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[1]; - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[1]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2]; } else { - sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[1]; - sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[2]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[1]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2]; } sprite->data[0] = 0; @@ -4726,16 +4726,16 @@ static void AnimSlashSlice(struct Sprite* sprite) static void AnimFalseSwipeSlice(struct Sprite* sprite) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + 0xFFD0; - sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 0xFFD0; + sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); StoreSpriteCallbackInData6(sprite, AnimFalseSwipeSlice_Step1); sprite->callback = RunStoredCallbackWhenAnimEnds; } static void AnimFalseSwipePositionedSlice(struct Sprite* sprite) { - sprite->x = sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + 0xFFD0 + gBattleAnimArgs[0]; - sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sprite->x = sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 0xFFD0 + gBattleAnimArgs[0]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); StartSpriteAnim(sprite, 1); sprite->data[0] = 0; sprite->data[1] = 0; @@ -4776,13 +4776,13 @@ static void AnimEndureEnergy(struct Sprite* sprite) { if (gBattleAnimArgs[0] == 0) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[1]; - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[2]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[1]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[2]; } else { - sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[1]; - sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[2]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[1]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[2]; } sprite->data[0] = 0; @@ -4805,8 +4805,8 @@ static void AnimEndureEnergy_Step(struct Sprite* sprite) static void AnimSharpenSphere(struct Sprite* sprite) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) - 12; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) - 12; sprite->data[0] = 0; sprite->data[1] = 2; sprite->data[2] = 0; @@ -4844,8 +4844,8 @@ static void AnimConversion(struct Sprite* sprite) { if (sprite->data[0] == 0) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[0]; - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[1]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[0]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1]; if (IsContest()) sprite->y += 10; @@ -4898,8 +4898,8 @@ static void AnimConversion2_Step(struct Sprite* sprite) { sprite->animPaused = 0; sprite->data[0] = 30; - sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); - sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } @@ -4970,7 +4970,7 @@ static void AnimMoon_Step(struct Sprite* sprite) static void AnimMoonlightSparkle(struct Sprite* sprite) { - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[0]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[0]; sprite->y = gBattleAnimArgs[1]; sprite->data[0] = 0; sprite->data[1] = 0; @@ -5111,8 +5111,8 @@ static void AnimHornHit(struct Sprite* sprite) sprite->data[0] = 0; sprite->data[1] = gBattleAnimArgs[2]; - sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[0]; - sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[1]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[0]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1]; sprite->data[6] = sprite->x; sprite->data[7] = sprite->y; if (IsContest()) @@ -5299,8 +5299,8 @@ static void AnimWavyMusicNotes(struct Sprite* sprite) } else { - a = GetBattlerSpriteCoord(gBattleAnimTarget, 2); - b = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + a = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + b = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); } sprite->data[4] = sprite->x << 4; @@ -5363,8 +5363,8 @@ static void AnimFlyingMusicNotes(struct Sprite* sprite) if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) gBattleAnimArgs[1] *= -1; - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[1]; - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2]; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[1]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2]; StartSpriteAnim(sprite, gBattleAnimArgs[0]); sprite->data[2] = 0; sprite->data[3] = 0; @@ -5407,8 +5407,8 @@ static void AnimBellyDrumHand(struct Sprite* sprite) a = -16; } - sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + a; - sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + 8; + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + a; + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + 8; sprite->data[0] = 8; sprite->callback = WaitAnimForDuration; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); @@ -5462,7 +5462,7 @@ void SetSpriteNextToMonHead(u8 battler, struct Sprite* sprite) else sprite->x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) - 8; - sprite->y = GetBattlerSpriteCoord(battler, 3) - (s16)GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 4; + sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) - (s16)GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 4; } static void AnimThoughtBubble(struct Sprite* sprite) @@ -5525,7 +5525,7 @@ static void AnimFollowMeFinger(struct Sprite* sprite) else battler = gBattleAnimTarget; - sprite->x = GetBattlerSpriteCoord(battler, 0); + sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X); sprite->y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_TOP); if (sprite->y <= 9) sprite->y = 10; diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index fcdb56a10..c2a89ed4b 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -1262,20 +1262,30 @@ const struct SpriteTemplate gGuardRingSpriteTemplate = .callback = AnimGuardRing, }; +#define sAmplitudeX data[1] +#define sCircleSpeed data[2] +#define sMoveSteps data[3] +#define sAmplitudeY data[4] + static void AnimCirclingFinger(struct Sprite *sprite) { SetSpriteCoordsToAnimAttackerCoords(sprite); SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]); sprite->y += gBattleAnimArgs[1]; - sprite->data[1] = gBattleAnimArgs[2]; - sprite->data[2] = gBattleAnimArgs[4]; - sprite->data[3] = gBattleAnimArgs[5]; - sprite->data[4] = gBattleAnimArgs[3]; + sprite->sAmplitudeX = gBattleAnimArgs[2]; + sprite->sCircleSpeed = gBattleAnimArgs[4]; + sprite->sMoveSteps = gBattleAnimArgs[5]; + sprite->sAmplitudeY = gBattleAnimArgs[3]; StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); - sprite->callback = TranslateSpriteInEllipseOverDuration; + sprite->callback = TranslateSpriteInEllipse; sprite->callback(sprite); } +#undef sAmplitudeX +#undef sCircleSpeed +#undef sMoveSteps +#undef sAmplitudeY + static void AnimBouncingMusicNote(struct Sprite *sprite) { u8 battler; @@ -1883,7 +1893,7 @@ static void AnimRazorWindTornado(struct Sprite *sprite) sprite->data[2] = gBattleAnimArgs[5]; sprite->data[3] = gBattleAnimArgs[6]; sprite->data[4] = gBattleAnimArgs[3]; - sprite->callback = TranslateSpriteInCircleOverDuration; + sprite->callback = TranslateSpriteInCircle; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); sprite->callback(sprite); } diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index cd8051998..f73393de4 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2283,7 +2283,7 @@ void AnimTask_TransformMon(u8 taskId) break; case 2: HandleSpeciesGfxDataChange(gBattleAnimAttacker, gBattleAnimTarget, gTasks[taskId].data[10]); - sub_80A6BFC(&animBg, gBattleAnimAttacker); + GetBgDataForTransform(&animBg, gBattleAnimAttacker); if (IsContest()) position = B_POSITION_PLAYER_LEFT; diff --git a/src/battle_anim_electric.c b/src/battle_anim_electric.c index bd527d244..635aa550e 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -509,7 +509,7 @@ static void AnimUnusedCirclingShock(struct Sprite *sprite) sprite->data[2] = gBattleAnimArgs[3]; sprite->data[3] = gBattleAnimArgs[4]; StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); - sprite->callback = TranslateSpriteInCircleOverDuration; + sprite->callback = TranslateSpriteInCircle; } static void AnimSparkElectricity(struct Sprite *sprite) diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index 76cefcd2c..ca4668e02 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -827,7 +827,7 @@ static void AnimSuperpowerOrb_Step(struct Sprite *sprite) InitAnimLinearTranslation(sprite); StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); - sprite->callback = AnimTranslateLinear_WaitEnd; + sprite->callback = AnimTranslateLinear_WithFollowup; } } @@ -923,7 +923,7 @@ static void AnimSuperpowerFireball(struct Sprite *sprite) InitAnimLinearTranslation(sprite); StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); - sprite->callback = AnimTranslateLinear_WaitEnd; + sprite->callback = AnimTranslateLinear_WithFollowup; } static void AnimArmThrustHit_Step(struct Sprite *sprite) diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index e06ebca7b..8ecb60713 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -472,7 +472,7 @@ static void AnimFireSpiralInward(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); - sprite->callback = TranslateSpriteInGrowingCircleOverDuration; + sprite->callback = TranslateSpriteInGrowingCircle; sprite->callback(sprite); } diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index 1d65d9570..0b89c1f59 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -592,7 +592,7 @@ static void AnimIcePunchSwirlingParticle(struct Sprite *sprite) sprite->data[3] = 30; sprite->data[4] = -512; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); - sprite->callback = TranslateSpriteInGrowingCircleOverDuration; + sprite->callback = TranslateSpriteInGrowingCircle; sprite->callback(sprite); } diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 75e1dadf7..ae0db0b87 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -20,7 +20,7 @@ extern const struct OamData gOamData_AffineNormal_ObjNormal_64x64; -static void sub_80A6FB4(struct Sprite *sprite); +static void AnimTranslateLinear_WithFollowup_SetCornerVecX(struct Sprite *sprite); static void AnimFastTranslateLinearWaitEnd(struct Sprite *sprite); static void AnimThrowProjectile_Step(struct Sprite *sprite); static void AnimBattlerTrace(struct Sprite *sprite); @@ -383,7 +383,7 @@ u8 GetAnimBattlerSpriteId(u8 animBattler) } else { - return 0xff; + return SPRITE_NONE; } } else if (animBattler == ANIM_TARGET) @@ -395,13 +395,13 @@ u8 GetAnimBattlerSpriteId(u8 animBattler) } else { - return 0xff; + return SPRITE_NONE; } } else if (animBattler == ANIM_ATK_PARTNER) { if (!IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker))) - return 0xff; + return SPRITE_NONE; else return gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]; } @@ -410,7 +410,7 @@ u8 GetAnimBattlerSpriteId(u8 animBattler) if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget))) return gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimTarget)]; else - return 0xff; + return SPRITE_NONE; } } @@ -426,18 +426,38 @@ void SetCallbackToStoredInData6(struct Sprite *sprite) sprite->callback = (void (*)(struct Sprite *))callback; } -void TranslateSpriteInCircleOverDuration(struct Sprite *sprite) +// Sprite data for TranslateSpriteInCircle/Ellipse and related +#define sCirclePos data[0] +#define sAmplitude data[1] +#define sCircleSpeed data[2] +#define sDuration data[3] + +// TranslateSpriteInGrowingCircle +#define sAmplitudeSpeed data[4] +#define sAmplitudeChange data[5] + +// TranslateSpriteInEllipse +#define sAmplitudeX sAmplitude +#define sAmplitudeY data[4] + +// TranslateSpriteInWavePattern +#define sCirclePosX sCirclePos +#define sCircleSpeedX sCircleSpeed +#define sCirclePosY data[4] +#define sCircleSpeedY data[5] + +void TranslateSpriteInCircle(struct Sprite *sprite) { - if (sprite->data[3]) + if (sprite->sDuration) { - sprite->x2 = Sin(sprite->data[0], sprite->data[1]); - sprite->y2 = Cos(sprite->data[0], sprite->data[1]); - sprite->data[0] += sprite->data[2]; - if (sprite->data[0] >= 0x100) - sprite->data[0] -= 0x100; - else if (sprite->data[0] < 0) - sprite->data[0] += 0x100; - sprite->data[3]--; + sprite->x2 = Sin(sprite->sCirclePos, sprite->sAmplitude); + sprite->y2 = Cos(sprite->sCirclePos, sprite->sAmplitude); + sprite->sCirclePos += sprite->sCircleSpeed; + if (sprite->sCirclePos >= 0x100) + sprite->sCirclePos -= 0x100; + else if (sprite->sCirclePos < 0) + sprite->sCirclePos += 0x100; + sprite->sDuration--; } else { @@ -445,19 +465,19 @@ void TranslateSpriteInCircleOverDuration(struct Sprite *sprite) } } -void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *sprite) +void TranslateSpriteInGrowingCircle(struct Sprite *sprite) { - if (sprite->data[3]) + if (sprite->sDuration) { - sprite->x2 = Sin(sprite->data[0], (sprite->data[5] >> 8) + sprite->data[1]); - sprite->y2 = Cos(sprite->data[0], (sprite->data[5] >> 8) + sprite->data[1]); - sprite->data[0] += sprite->data[2]; - sprite->data[5] += sprite->data[4]; - if (sprite->data[0] >= 0x100) - sprite->data[0] -= 0x100; - else if (sprite->data[0] < 0) - sprite->data[0] += 0x100; - sprite->data[3]--; + sprite->x2 = Sin(sprite->sCirclePos, (sprite->sAmplitudeChange >> 8) + sprite->sAmplitude); + sprite->y2 = Cos(sprite->sCirclePos, (sprite->sAmplitudeChange >> 8) + sprite->sAmplitude); + sprite->sCirclePos += sprite->sCircleSpeed; + sprite->sAmplitudeChange += sprite->sAmplitudeSpeed; + if (sprite->sCirclePos >= 0x100) + sprite->sCirclePos -= 0x100; + else if (sprite->sCirclePos < 0) + sprite->sCirclePos += 0x100; + sprite->sDuration--; } else { @@ -466,23 +486,27 @@ void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *sprite) } // Unused -static void sub_80A63C8(struct Sprite *sprite) +// Exact shape depends on arguments. Can move in a figure-8-like pattern, or circular, etc. +static void TranslateSpriteInWavePattern(struct Sprite *sprite) { - if (sprite->data[3]) + if (sprite->sDuration) { - sprite->x2 = Sin(sprite->data[0], sprite->data[1]); - sprite->y2 = Cos(sprite->data[4], sprite->data[1]); - sprite->data[0] += sprite->data[2]; - sprite->data[4] += sprite->data[5]; - if (sprite->data[0] >= 0x100) - sprite->data[0] -= 0x100; - else if (sprite->data[0] < 0) - sprite->data[0] += 0x100; - if (sprite->data[4] >= 0x100) - sprite->data[4] -= 0x100; - else if (sprite->data[4] < 0) - sprite->data[4] += 0x100; - sprite->data[3]--; + sprite->x2 = Sin(sprite->sCirclePosX, sprite->sAmplitude); + sprite->y2 = Cos(sprite->sCirclePosY, sprite->sAmplitude); + sprite->sCirclePosX += sprite->sCircleSpeedX; + sprite->sCirclePosY += sprite->sCircleSpeedY; + + if (sprite->sCirclePosX >= 0x100) + sprite->sCirclePosX -= 0x100; + else if (sprite->sCirclePosX < 0) + sprite->sCirclePosX += 0x100; + + if (sprite->sCirclePosY >= 0x100) + sprite->sCirclePosY -= 0x100; + else if (sprite->sCirclePosY < 0) + sprite->sCirclePosY += 0x100; + + sprite->sDuration--; } else { @@ -490,18 +514,18 @@ static void sub_80A63C8(struct Sprite *sprite) } } -void TranslateSpriteInEllipseOverDuration(struct Sprite *sprite) +void TranslateSpriteInEllipse(struct Sprite *sprite) { - if (sprite->data[3]) + if (sprite->sDuration) { - sprite->x2 = Sin(sprite->data[0], sprite->data[1]); - sprite->y2 = Cos(sprite->data[0], sprite->data[4]); - sprite->data[0] += sprite->data[2]; - if (sprite->data[0] >= 0x100) - sprite->data[0] -= 0x100; - else if (sprite->data[0] < 0) - sprite->data[0] += 0x100; - sprite->data[3]--; + sprite->x2 = Sin(sprite->sCirclePos, sprite->sAmplitudeX); + sprite->y2 = Cos(sprite->sCirclePos, sprite->sAmplitudeY); + sprite->sCirclePos += sprite->sCircleSpeed; + if (sprite->sCirclePos >= 0x100) + sprite->sCirclePos -= 0x100; + else if (sprite->sCirclePos < 0) + sprite->sCirclePos += 0x100; + sprite->sDuration--; } else { @@ -509,6 +533,19 @@ void TranslateSpriteInEllipseOverDuration(struct Sprite *sprite) } } +#undef sCirclePos +#undef sAmplitude +#undef sCircleSpeed +#undef sDuration +#undef sAmplitudeSpeed +#undef sAmplitudeChange +#undef sAmplitudeX +#undef sAmplitudeY +#undef sCirclePosX +#undef sCircleSpeedX +#undef sCirclePosY +#undef sCircleSpeedY + // Simply waits until the sprite's data[0] hits zero. // This is used to let sprite anims or affine anims to run for a designated // duration. @@ -521,7 +558,7 @@ void WaitAnimForDuration(struct Sprite *sprite) } // Sprite data for ConvertPosDataToTranslateLinearData -#define sStepsX data[0] +#define sStepsX data[0] #define sStartX data[1] #define sTargetX data[2] #define sStartY data[3] @@ -680,6 +717,12 @@ static void TranslateSpriteToBattleAttackerPos(struct Sprite *sprite) sprite->callback = AnimPosToTranslateLinear; } +#undef sStepsX +#undef sStartX +#undef sTargetX +#undef sStartY +#undef sTargetY + // Unused static void sub_80A67A4(struct Sprite *sprite) { @@ -913,7 +956,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId) } } -void sub_80A6BFC(struct BattleAnimBgData *out, u8 unused) +void GetBgDataForTransform(struct BattleAnimBgData *out, u8 battlerId) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; @@ -1052,17 +1095,17 @@ void StartAnimLinearTranslation(struct Sprite *sprite) sprite->data[1] = sprite->x; sprite->data[3] = sprite->y; InitAnimLinearTranslation(sprite); - sprite->callback = AnimTranslateLinear_WaitEnd; + sprite->callback = AnimTranslateLinear_WithFollowup; sprite->callback(sprite); } // Unused -static void sub_80A6F14(struct Sprite *sprite) +static void StartAnimLinearTranslation_SetCornerVecX(struct Sprite *sprite) { sprite->data[1] = sprite->x; sprite->data[3] = sprite->y; InitAnimLinearTranslation(sprite); - sprite->callback = sub_80A6FB4; + sprite->callback = AnimTranslateLinear_WithFollowup_SetCornerVecX; sprite->callback(sprite); } @@ -1096,16 +1139,16 @@ bool8 AnimTranslateLinear(struct Sprite *sprite) return FALSE; } -void AnimTranslateLinear_WaitEnd(struct Sprite *sprite) +void AnimTranslateLinear_WithFollowup(struct Sprite *sprite) { if (AnimTranslateLinear(sprite)) SetCallbackToStoredInData6(sprite); } // Functionally unused -static void sub_80A6FB4(struct Sprite *sprite) +static void AnimTranslateLinear_WithFollowup_SetCornerVecX(struct Sprite *sprite) { - sub_8039E9C(sprite); + AnimSetCenterToCornerVecX(sprite); if (AnimTranslateLinear(sprite)) SetCallbackToStoredInData6(sprite); } @@ -1122,7 +1165,7 @@ void InitAnimLinearTranslationWithSpeedAndPos(struct Sprite *sprite) sprite->data[1] = sprite->x; sprite->data[3] = sprite->y; InitAnimLinearTranslationWithSpeed(sprite); - sprite->callback = AnimTranslateLinear_WaitEnd; + sprite->callback = AnimTranslateLinear_WithFollowup; sprite->callback(sprite); } diff --git a/src/battle_anim_normal.c b/src/battle_anim_normal.c index d79f344ed..ebf9a588f 100644 --- a/src/battle_anim_normal.c +++ b/src/battle_anim_normal.c @@ -409,7 +409,7 @@ static void AnimCirclingSparkle(struct Sprite *sprite) sprite->data[4] = 112; sprite->data[5] = 0; StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); - sprite->callback = TranslateSpriteInGrowingCircleOverDuration; + sprite->callback = TranslateSpriteInGrowingCircle; sprite->callback(sprite); } diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index f1dc4b734..5aa8f28c3 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -313,7 +313,7 @@ static void AnimFallingRock(struct Sprite *sprite) sprite->data[5] = gBattleAnimArgs[2]; StoreSpriteCallbackInData6(sprite, AnimFallingRock_Step); - sprite->callback = TranslateSpriteInEllipseOverDuration; + sprite->callback = TranslateSpriteInEllipse; sprite->callback(sprite); } @@ -328,7 +328,7 @@ static void AnimFallingRock_Step(struct Sprite *sprite) sprite->data[4] = -24; StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); - sprite->callback = TranslateSpriteInEllipseOverDuration; + sprite->callback = TranslateSpriteInEllipse; sprite->callback(sprite); } diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 1660f6ec1..6def51870 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -1127,7 +1127,7 @@ static void LinkOpponentHandleLoadMonSprite(void) SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); @@ -1161,7 +1161,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) gBattlerSpriteIds[battlerId] = CreateSprite( &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, 2), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index a9240b0ac..a8cbd7dfd 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -1017,7 +1017,7 @@ static void LinkPartnerHandleLoadMonSprite(void) SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; @@ -1048,7 +1048,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) gBattlerSpriteIds[battlerId] = CreateSprite( &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, 2), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index ac330be76..9aeb3e81b 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1136,7 +1136,7 @@ static void OpponentHandleLoadMonSprite(void) SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); @@ -1171,7 +1171,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, 2), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index f4e47b434..20ef730bd 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -2205,7 +2205,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) gBattlerSpriteIds[battlerId] = CreateSprite( &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, 2), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 91fea6cde..b2fd4520f 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -1201,7 +1201,7 @@ static void PlayerPartnerHandleLoadMonSprite(void) SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; @@ -1232,7 +1232,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) gBattlerSpriteIds[battlerId] = CreateSprite( &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, 2), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index c6e649508..a8c159563 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1110,7 +1110,7 @@ static void RecordedOpponentHandleLoadMonSprite(void) SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); @@ -1143,7 +1143,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, 2), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 93d059fe9..c7015dd0b 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -1092,7 +1092,7 @@ static void RecordedPlayerHandleLoadMonSprite(void) SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; @@ -1123,7 +1123,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) gBattlerSpriteIds[battlerId] = CreateSprite( &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, 2), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index d018fe1c0..376f76ab6 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -1466,7 +1466,7 @@ static void StartSendOutAnim(u8 battlerId) gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, 2), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index f36524f37..2a690d129 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -1147,13 +1147,19 @@ void LoadAndCreateEnemyShadowSprites(void) LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow); battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(battlerId, 0), GetBattlerSpriteCoord(battlerId, 1) + 29, 0xC8); + gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 29, + 0xC8); gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].data[0] = battlerId; if (IsDoubleBattle()) { battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); - gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(battlerId, 0), GetBattlerSpriteCoord(battlerId, 1) + 29, 0xC8); + gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X), + GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 29, + 0xC8); gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].data[0] = battlerId; } } diff --git a/src/battle_main.c b/src/battle_main.c index ec093ecc7..2b849aaf9 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -307,7 +307,7 @@ static const u16 *const sUnused1Ptr = sUnused1; static const u16 sUnused2[] = {0xfff0, 0, 0x0400, 0, 0, 0, 0x3c00, 0, 0x7ffe, 1, 0, 0}; static const u16 *const sUnused2Ptr = sUnused2; -static const s8 gUnknown_0831ACE0[] ={-32, -16, -16, -32, -32, 0, 0, 0}; +static const s8 sCenterToCornerVecXs[8] ={-32, -16, -16, -32, -32}; // format: attacking type, defending type, damage multiplier // the multiplier is a (decimal) fixed-point number: @@ -2983,7 +2983,7 @@ void SpriteCB_PlayerMonFromBall(struct Sprite *sprite) static void SpriteCB_TrainerThrowObject_Main(struct Sprite *sprite) { - sub_8039E9C(sprite); + AnimSetCenterToCornerVecX(sprite); if (sprite->animEnded) sprite->callback = SpriteCB_Idle; } @@ -2996,10 +2996,10 @@ void SpriteCB_TrainerThrowObject(struct Sprite *sprite) sprite->callback = SpriteCB_TrainerThrowObject_Main; } -void sub_8039E9C(struct Sprite *sprite) +void AnimSetCenterToCornerVecX(struct Sprite *sprite) { if (sprite->animDelayCounter == 0) - sprite->centerToCornerVecX = gUnknown_0831ACE0[sprite->animCmdIndex]; + sprite->centerToCornerVecX = sCenterToCornerVecXs[sprite->animCmdIndex]; } void BeginBattleIntroDummy(void) diff --git a/src/pokeball.c b/src/pokeball.c index 11f03eefe..bf485c0f0 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -894,8 +894,8 @@ static void SpriteCB_BallThrow_CaptureMon(struct Sprite *sprite) static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite) { sprite->data[0] = 25; - sprite->data[2] = GetBattlerSpriteCoord(sprite->sBattler, 2); - sprite->data[4] = GetBattlerSpriteCoord(sprite->sBattler, 3) + 24; + sprite->data[2] = GetBattlerSpriteCoord(sprite->sBattler, BATTLER_COORD_X_2); + sprite->data[4] = GetBattlerSpriteCoord(sprite->sBattler, BATTLER_COORD_Y_PIC_OFFSET) + 24; sprite->data[5] = -30; sprite->oam.affineParam = sprite->sBattler; InitAnimArcTranslation(sprite); diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index c8c03ede2..1b49a374c 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -222,7 +222,7 @@ static void CreateBattlerSprite(u8 battler) return; SetMultiuseSpriteTemplateToPokemon(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler)); - gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, GetBattlerSpriteSubpriority(battler)); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2), posY, GetBattlerSpriteSubpriority(battler)); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; gSprites[gBattlerSpriteIds[battler]].data[0] = battler; @@ -258,7 +258,7 @@ static void CreateBattlerSprite(u8 battler) return; SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler)); - gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, GetBattlerSpriteSubpriority(battler)); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2), posY, GetBattlerSpriteSubpriority(battler)); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; gSprites[gBattlerSpriteIds[battler]].data[0] = battler;