Merge pull request #1548 from GriffinRichards/doc-banim

Document battle_anim_mons
This commit is contained in:
GriffinR 2021-11-13 23:32:10 -05:00 committed by GitHub
commit 70577e844d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 1543 additions and 1420 deletions

View File

@ -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);
@ -113,7 +113,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData*, u32 arg1);
u8 GetBattlerSpriteSubpriority(u8 battlerId);
bool8 TranslateAnimHorizontalArc(struct Sprite *sprite);
void sub_80A6630(struct Sprite *sprite);
void TranslateMonSpriteLinearFixedPoint(struct Sprite *sprite);
void TranslateSpriteLinearByIdFixedPoint(struct Sprite *sprite);
void ResetSpriteRotScale(u8 spriteId);
void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation);
void InitSpriteDataForLinearTranslation(struct Sprite *sprite);
@ -123,12 +123,12 @@ u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 atta
u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight);
u8 AnimDummyReturnArg(u8 battler);
s16 CloneBattlerSpriteWithBlend(u8);
void obj_delete_but_dont_free_vram(struct Sprite*);
void DestroySpriteWithActiveSheet(struct Sprite*);
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);
@ -138,16 +138,16 @@ void AnimLoadCompressedBgTilemap(u32 bgId, const void *src);
void InitAnimFastLinearTranslationWithSpeed(struct Sprite *sprite);
bool8 AnimFastTranslateLinear(struct Sprite *sprite);
void InitAndRunAnimFastLinearTranslation(struct Sprite *sprite);
void TranslateMonSpriteLinear(struct Sprite *sprite);
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);
@ -157,7 +157,7 @@ void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId);
u8 GetBattlerSide(u8 battler);
u8 GetBattlerPosition(u8 battler);
u8 GetBattlerAtPosition(u8 position);
void sub_80A64EC(struct Sprite *sprite);
void ConvertPosDataToTranslateLinearData(struct Sprite *sprite);
void InitAnimFastLinearTranslationWithSpeedAndPos(struct Sprite *sprite);
enum

View File

@ -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);

View File

@ -337,7 +337,9 @@
#define NUM_MALE_LINK_FACILITY_CLASSES 8
#define NUM_FEMALE_LINK_FACILITY_CLASSES 8
#define MON_PIC_SIZE (64 * 64 / 2)
#define MON_PIC_WIDTH 64
#define MON_PIC_HEIGHT 64
#define MON_PIC_SIZE (MON_PIC_WIDTH * MON_PIC_HEIGHT / 2)
#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
#define BATTLE_ALIVE_ATK_SIDE 1

View File

@ -21,6 +21,10 @@ struct MonCoords
u8 y_offset;
};
#define MON_COORDS_SIZE(width, height)(DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8))
#define GET_MON_COORDS_WIDTH(size)((size >> 4) * 8)
#define GET_MON_COORDS_HEIGHT(size)((size & 0xF) * 8)
struct TrainerMonNoItemDefaultMoves
{
u16 iv;

View File

@ -120,10 +120,12 @@
f; \
})
#define ROUND_BITS_TO_BYTES(numBits)(((numBits) / 8) + (((numBits) % 8) ? 1 : 0))
#define DIV_ROUND_UP(val, roundBy)(((val) / (roundBy)) + (((val) % (roundBy)) ? 1 : 0))
#define DEX_FLAGS_NO (ROUND_BITS_TO_BYTES(NUM_SPECIES))
#define NUM_FLAG_BYTES (ROUND_BITS_TO_BYTES(FLAGS_COUNT))
#define ROUND_BITS_TO_BYTES(numBits) DIV_ROUND_UP(numBits, 8)
#define DEX_FLAGS_NO ROUND_BITS_TO_BYTES(NUM_SPECIES)
#define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT)
struct Coords8
{

View File

@ -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);

View File

@ -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];

View File

@ -2548,7 +2548,7 @@ static void AnimPetalDanceSmallFlower(struct Sprite* sprite)
sprite->data[1] = sprite->x;
sprite->data[2] = sprite->x;
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
InitAnimLinearTranslation(sprite);
sprite->data[5] = 0x40;
sprite->callback = AnimPetalDanceSmallFlower_Step;
@ -2971,8 +2971,8 @@ static void AnimIngrainOrb(struct Sprite* sprite)
{
if (!sprite->data[0])
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[1];
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1];
sprite->data[1] = gBattleAnimArgs[2];
sprite->data[2] = gBattleAnimArgs[3];
sprite->data[3] = gBattleAnimArgs[4];
@ -3309,8 +3309,8 @@ void AnimTask_LeafBlade(u8 taskId)
struct Task *task = &gTasks[taskId];
task->data[4] = GetBattlerSpriteSubpriority(gBattleAnimTarget) - 1;
task->data[6] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
task->data[7] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
task->data[6] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
task->data[7] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
task->data[10] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_WIDTH);
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT);
task->data[5] = (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) ? 1 : -1;
@ -3601,11 +3601,11 @@ static void AnimFlyingParticle(struct Sprite* sprite)
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
break;
case 2:
sprite->y = GetBattlerSpriteCoord(battler, 3) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[0];
sprite->oam.priority = GetBattlerSpriteBGPriority(battler);
break;
case 3:
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[0];
GetAnimBattlerSpriteId(ANIM_TARGET);
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
break;
@ -3681,13 +3681,13 @@ static void AnimNeedleArmSpike(struct Sprite* sprite)
{
if (gBattleAnimArgs[0] == 0)
{
a = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
b = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
a = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
b = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
}
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[0] = gBattleAnimArgs[4];
@ -3790,8 +3790,8 @@ static void AnimFlickeringPunch(struct Sprite* sprite)
// arg 2: slice direction; 0 = right-to-left, 1 = left-to-right
static void AnimCuttingSlice(struct Sprite* sprite)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
sprite->y += 8;
@ -3816,32 +3816,31 @@ static void AnimCuttingSlice(struct Sprite* sprite)
static void AnimAirCutterSlice(struct Sprite* sprite)
{
u8 a;
u8 b;
u8 x, y;
switch (gBattleAnimArgs[3])
{
case 1:
a = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), 0);
b = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), 1);
x = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_X);
y = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_Y);
break;
case 2:
a = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
b = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)))
{
a = (GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), 0) + a) / 2;
b = (GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), 1) + b) / 2;
x = (GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_X) + x) / 2;
y = (GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_Y) + y) / 2;
}
break;
case 0:
default:
a = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
b = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
break;
}
sprite->x = a;
sprite->y = b;
sprite->x = x;
sprite->y = y;
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
sprite->y += 8;
@ -3956,8 +3955,8 @@ static void AnimProtect(struct Sprite* sprite)
if (IsContest())
gBattleAnimArgs[1] += 8;
sprite->x = GetBattlerSpriteCoord2(gBattleAnimAttacker, 0) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord2(gBattleAnimAttacker, 1) + gBattleAnimArgs[1];
sprite->x = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1];
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER || IsContest())
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker) + 1;
else
@ -4016,8 +4015,8 @@ static void AnimProtect_Step(struct Sprite *sprite)
static void AnimMilkBottle(struct Sprite* sprite)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + 0xFFE8;
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + 0xFFE8;
sprite->data[0] = 0;
sprite->data[1] = 0;
sprite->data[2] = 0;
@ -4156,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]);
@ -4325,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);
}
@ -4442,7 +4441,7 @@ static void AnimBowMon_Step1(struct Sprite* sprite)
sprite->data[2] = 0;
sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker];
StoreSpriteCallbackInData6(sprite, AnimBowMon_Step1_Callback);
sprite->callback = TranslateMonSpriteLinear;
sprite->callback = TranslateSpriteLinearById;
}
static void AnimBowMon_Step1_Callback(struct Sprite* sprite)
@ -4472,7 +4471,7 @@ static void AnimBowMon_Step2(struct Sprite* sprite)
sprite->data[2] = 0;
sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker];
StoreSpriteCallbackInData6(sprite, AnimBowMon_Step4);
sprite->callback = TranslateMonSpriteLinear;
sprite->callback = TranslateSpriteLinearById;
}
static void AnimBowMon_Step3(struct Sprite* sprite)
@ -4710,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;
@ -4727,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;
@ -4777,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;
@ -4806,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;
@ -4845,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;
@ -4899,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);
}
@ -4971,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;
@ -5112,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())
@ -5226,7 +5225,7 @@ static void AnimDoubleTeam(struct Sprite* sprite)
if (sprite->data[0] > 64)
{
gTasks[sprite->data[2]].data[3]--;
obj_delete_but_dont_free_vram(sprite);
DestroySpriteWithActiveSheet(sprite);
}
else
{
@ -5300,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;
@ -5364,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;
@ -5408,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);
@ -5463,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)
@ -5526,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;

View File

@ -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;
@ -1329,8 +1339,8 @@ static void AnimVibrateBattlerBack_Step(struct Sprite *sprite)
static void AnimVibrateBattlerBack(struct Sprite *sprite)
{
u8 spriteId;
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);
spriteId = gBattlerSpriteIds[gBattleAnimTarget];
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
sprite->x -= gBattleAnimArgs[0];
@ -1498,8 +1508,8 @@ static void AnimSonicBoomProjectile(struct Sprite *sprite)
}
InitSpritePosToAnimAttacker(sprite, TRUE);
targetXPos = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2];
targetYPos = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
targetXPos = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
targetYPos = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
rotation = ArcTan2Neg(targetXPos - sprite->x, targetYPos - sprite->y);
rotation += 0xF000;
if (IsContest())
@ -1772,8 +1782,8 @@ static void AnimCoinThrow(struct Sprite *sprite)
u16 var;
InitSpritePosToAnimAttacker(sprite, TRUE);
r6 = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
r7 = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
r6 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
r7 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
@ -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);
}
@ -2113,7 +2123,7 @@ static void CreateMinimizeSprite(struct Task* task, u8 taskId)
{
if ((matrixNum = AllocOamMatrix()) == 0xFF)
{
obj_delete_but_dont_free_vram(&gSprites[spriteId]);
DestroySpriteWithActiveSheet(&gSprites[spriteId]);
}
else
{
@ -2141,7 +2151,7 @@ static void ClonedMinizeSprite_Step(struct Sprite *sprite)
{
gTasks[sprite->data[1]].data[sprite->data[2]]--;
FreeOamMatrix(sprite->oam.matrixNum);
obj_delete_but_dont_free_vram(sprite);
DestroySpriteWithActiveSheet(sprite);
}
}
@ -2467,7 +2477,7 @@ static void AnimTask_SketchDrawMon_Step(u8 taskId)
static void AnimPencil(struct Sprite *sprite)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) - 16;
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) - 16;
sprite->y = GetBattlerYCoordWithElevation(gBattleAnimTarget) + 16;
sprite->data[0] = 0;
sprite->data[1] = 0;
@ -2555,9 +2565,9 @@ static void AnimBlendThinRing(struct Sprite *sprite)
{
SetAverageBattlerPositions(battler, r4, &sp0, &sp1);
if (r4 == 0)
r4 = GetBattlerSpriteCoord(battler, 0);
r4 = GetBattlerSpriteCoord(battler, BATTLER_COORD_X);
else
r4 = GetBattlerSpriteCoord(battler, 2);
r4 = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2);
if (GetBattlerSide(battler) != B_SIDE_PLAYER)
gBattleAnimArgs[0] -= (sp0 - r4) - gBattleAnimArgs[0]; // This is weird.
@ -2580,14 +2590,14 @@ static void AnimHyperVoiceRing_WaitEnd(struct Sprite *sprite)
static void AnimHyperVoiceRing(struct Sprite *sprite)
{
u16 r9 = 0;
u16 r6 = 0;
s16 sp0 = 0;
s16 sp1 = 0;
u8 sp4;
u16 startX = 0;
u16 startY = 0;
s16 x = 0;
s16 y = 0;
u8 yCoordType;
u8 battler1;
u8 battler2;
u8 r10;
u8 xCoordType;
if (gBattleAnimArgs[5] == 0)
{
@ -2602,18 +2612,18 @@ static void AnimHyperVoiceRing(struct Sprite *sprite)
if (!gBattleAnimArgs[6])
{
r10 = 0;
sp4 = 1;
xCoordType = BATTLER_COORD_X;
yCoordType = BATTLER_COORD_Y;
}
else
{
r10 = 2;
sp4 = 3;
xCoordType = BATTLER_COORD_X_2;
yCoordType = BATTLER_COORD_Y_PIC_OFFSET;
}
if (GetBattlerSide(battler1) != B_SIDE_PLAYER)
{
r9 = GetBattlerSpriteCoord(battler1, r10) + gBattleAnimArgs[0];
startX = GetBattlerSpriteCoord(battler1, xCoordType) + gBattleAnimArgs[0];
if (IsBattlerSpriteVisible(BATTLE_PARTNER(battler2)))
sprite->subpriority = gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler2)]].subpriority - 1;
else
@ -2621,7 +2631,7 @@ static void AnimHyperVoiceRing(struct Sprite *sprite)
}
else
{
r9 = GetBattlerSpriteCoord(battler1, r10) - gBattleAnimArgs[0];
startX = GetBattlerSpriteCoord(battler1, xCoordType) - gBattleAnimArgs[0];
if (!IsContest() && IsBattlerSpriteVisible(BATTLE_PARTNER(battler1)))
{
if (gSprites[gBattlerSpriteIds[battler1]].x < gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler1)]].x)
@ -2636,27 +2646,27 @@ static void AnimHyperVoiceRing(struct Sprite *sprite)
}
r6 = GetBattlerSpriteCoord(battler1, sp4) + gBattleAnimArgs[1];
startY = GetBattlerSpriteCoord(battler1, yCoordType) + gBattleAnimArgs[1];
if (!IsContest() && IsBattlerSpriteVisible(BATTLE_PARTNER(battler2)))
{
SetAverageBattlerPositions(battler2, gBattleAnimArgs[6], &sp0, &sp1);
SetAverageBattlerPositions(battler2, gBattleAnimArgs[6], &x, &y);
}
else
{
sp0 = GetBattlerSpriteCoord(battler2, r10);
sp1 = GetBattlerSpriteCoord(battler2, sp4);
x = GetBattlerSpriteCoord(battler2, xCoordType);
y = GetBattlerSpriteCoord(battler2, yCoordType);
}
if (GetBattlerSide(battler2))
sp0 += gBattleAnimArgs[3];
x += gBattleAnimArgs[3];
else
sp0 -= gBattleAnimArgs[3];
x -= gBattleAnimArgs[3];
sp1 += gBattleAnimArgs[4];
sprite->x = sprite->data[1] = r9;
sprite->y = sprite->data[3] = r6;
sprite->data[2] = sp0;
sprite->data[4] = sp1;
y += gBattleAnimArgs[4];
sprite->x = sprite->data[1] = startX;
sprite->y = sprite->data[3] = startY;
sprite->data[2] = x;
sprite->data[4] = y;
sprite->data[0] = gBattleAnimArgs[0];
InitAnimLinearTranslation(sprite);
sprite->callback = AnimHyperVoiceRing_WaitEnd;
@ -2923,8 +2933,8 @@ void AnimTask_SpeedDust(u8 taskId)
task->data[7] = 0;
task->data[8] = 0;
task->data[13] = 0;
task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, ANIM_ATTACKER);
task->data[15] = GetBattlerSpriteCoord(gBattleAnimAttacker, ANIM_TARGET);
task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
task->data[15] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
task->func = AnimTask_SpeedDust_Step;
}
@ -3047,8 +3057,8 @@ static void AnimHealBellMusicNote(struct Sprite *sprite)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[3];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[3];
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
SetMusicNotePalette(sprite, gBattleAnimArgs[5], gBattleAnimArgs[6]);
@ -3165,9 +3175,9 @@ static void AnimRedHeartProjectile(struct Sprite *sprite)
InitSpritePosToAnimAttacker(sprite, TRUE);
sprite->data[0] = 95;
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
InitAnimLinearTranslation(sprite);
sprite->callback = AnimRedHeartProjectile_Step;
}
@ -3402,8 +3412,8 @@ static void AnimTask_ScaryFace_Step(u8 taskId)
// arg 1: initial wave offset
static void AnimOrbitFast(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);
sprite->affineAnimPaused = 1;
sprite->data[0] = gBattleAnimArgs[0];
sprite->data[1] = gBattleAnimArgs[1];
@ -3453,8 +3463,8 @@ static void AnimOrbitFast_Step(struct Sprite *sprite)
// arg 0: initial wave offset
static void AnimOrbitScatter(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);
sprite->data[0] = Sin(gBattleAnimArgs[0], 10);
sprite->data[1] = Cos(gBattleAnimArgs[0], 7);
sprite->callback = AnimOrbitScatter_Step;
@ -3479,8 +3489,8 @@ static void AnimSpitUpOrb_Step(struct Sprite *sprite)
static void AnimSpitUpOrb(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);
sprite->data[0] = Sin(gBattleAnimArgs[0], 10);
sprite->data[1] = Cos(gBattleAnimArgs[0], 7);
sprite->data[2] = gBattleAnimArgs[1];
@ -3617,13 +3627,13 @@ static void AnimMovementWaves(struct Sprite *sprite)
{
if (!gBattleAnimArgs[0])
{
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);
}
else
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
}
if (!gBattleAnimArgs[1])
@ -3671,8 +3681,8 @@ static void AnimJaggedMusicNote(struct Sprite *sprite)
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
gBattleAnimArgs[1] *= -1;
sprite->x = GetBattlerSpriteCoord(battler, 2) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(battler, 3) + gBattleAnimArgs[2];
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[2];
sprite->data[0] = 0;
sprite->data[1] = (u16)sprite->x << 3;
sprite->data[2] = (u16)sprite->y << 3;
@ -3804,8 +3814,8 @@ static void AnimGuardRing(struct Sprite *sprite)
}
else
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 40;
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 40;
}
sprite->data[0] = 13;

View File

@ -1211,8 +1211,8 @@ static void AnimBlackSmoke_Step(struct Sprite *sprite)
void AnimTask_SmokescreenImpact(u8 taskId)
{
SmokescreenImpact(
GetBattlerSpriteCoord(gBattleAnimTarget, 2) + 8,
GetBattlerSpriteCoord(gBattleAnimTarget, 3) + 8,
GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 8,
GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + 8,
0);
DestroyAnimVisualTask(taskId);
}
@ -1247,8 +1247,8 @@ static void AnimWhiteHalo_Step2(struct Sprite *sprite)
static void AnimTealAlert(struct Sprite *sprite)
{
u16 rotation;
u8 x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
u8 y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
u8 x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
u8 y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
InitSpritePosToAnimTarget(sprite, TRUE);
@ -1608,8 +1608,8 @@ static void AnimClappingHand(struct Sprite *sprite)
{
if (gBattleAnimArgs[3] == 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);
}
sprite->x += gBattleAnimArgs[0];
@ -1710,13 +1710,13 @@ static void AnimRapidSpin(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == 0)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
}
else
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[1];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
}
sprite->y2 = gBattleAnimArgs[2];
@ -1896,8 +1896,8 @@ void AnimTask_TormentAttacker(u8 taskId)
task->data[0] = 0;
task->data[1] = 0;
task->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
task->data[3] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
task->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
task->data[3] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
task->data[4] = 32;
task->data[5] = -20;
task->data[6] = 0;
@ -2038,8 +2038,8 @@ static void AnimTriAttackTriangle(struct Sprite *sprite)
sprite->x2 = 0;
sprite->y2 = 0;
sprite->data[0] = 20;
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;
}
}
@ -2066,8 +2066,8 @@ static void AnimBatonPassPokeball(struct Sprite *sprite)
switch (sprite->data[0])
{
case 0:
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);
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
sprite->data[1] = 256;
sprite->data[2] = 256;
@ -2222,7 +2222,7 @@ static void AnimSwallowBlueOrb(struct Sprite *sprite)
case 0:
InitSpritePosToAnimAttacker(sprite, FALSE);
sprite->data[1] = 0x900;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->data[0]++;
break;
case 1:
@ -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;
@ -2476,8 +2476,8 @@ static void AnimGreenStar(struct Sprite *sprite)
if (xOffset > 31)
xOffset = 32 - xOffset;
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + xOffset;
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 32;
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + xOffset;
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 32;
sprite->data[1] = gBattleAnimArgs[0];
sprite->data[2] = gBattleAnimArgs[1];
@ -3246,8 +3246,8 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
}
}
coord1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
coord2 = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
coord1 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
coord2 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
spriteId = CreateAdditionalMonSpriteForMoveAnim(species, isBackPic, 0, coord1 + xOffset, coord2, 5, personality, otId, gBattleAnimTarget, TRUE);
gSprites[spriteId].oam.priority = priority;
@ -4165,7 +4165,7 @@ static void AnimSmellingSaltsHand(struct Sprite *sprite)
sprite->oam.tileNum += 16;
sprite->data[6] = gBattleAnimArgs[2];
sprite->data[7] = gBattleAnimArgs[1] == 0 ? -1 : 1;
sprite->y = GetBattlerSpriteCoord(battler, 3);
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET);
if (gBattleAnimArgs[1] == 0)
{
sprite->oam.matrixNum |= ST_OAM_HFLIP;
@ -4280,12 +4280,12 @@ static void AnimSmellingSaltExclamation(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP);
}
else
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_TOP);
}
@ -4426,9 +4426,9 @@ void AnimTask_HelpingHandAttackerMovement(u8 taskId)
{
if (IsDoubleBattle() == TRUE)
{
int x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
int y = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimAttacker), 0);
if (x > y)
int attackerX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
int partnerX = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_X);
if (attackerX > partnerX)
task->data[14] = 1;
else
task->data[14] = -1;
@ -4566,24 +4566,24 @@ static void AnimForesightMagnifyingGlass_Step(struct Sprite *sprite)
sprite->data[6] = 0;
case 0:
case 4:
x = GetBattlerSpriteCoordAttr(sprite->data[7], 5) - 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], 3) - 4;
x = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_RIGHT) - 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_BOTTOM) - 4;
break;
case 1:
x = GetBattlerSpriteCoordAttr(sprite->data[7], 5) - 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], 2) + 4;
x = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_RIGHT) - 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_TOP) + 4;
break;
case 2:
x = GetBattlerSpriteCoordAttr(sprite->data[7], 4) + 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], 3) - 4;
x = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_LEFT) + 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_BOTTOM) - 4;
break;
case 3:
x = GetBattlerSpriteCoordAttr(sprite->data[7], 4) + 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], 2) - 4;
x = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_LEFT) + 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], BATTLER_COORD_ATTR_TOP) - 4;
break;
case 5:
x = GetBattlerSpriteCoord(sprite->data[7], 2);
y = GetBattlerSpriteCoord(sprite->data[7], 3);
x = GetBattlerSpriteCoord(sprite->data[7], BATTLER_COORD_X_2);
y = GetBattlerSpriteCoord(sprite->data[7], BATTLER_COORD_Y_PIC_OFFSET);
break;
}
@ -4814,7 +4814,7 @@ static void AnimBlockX(struct Sprite *sprite)
y = -96;
}
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->y2 = y;
sprite->callback = AnimBlockX_Step;
}
@ -4896,7 +4896,7 @@ void AnimTask_OdorSleuthMovement(u8 taskId)
spriteId2 = CloneBattlerSpriteWithBlend(ANIM_TARGET);
if (spriteId2 < 0)
{
obj_delete_but_dont_free_vram(&gSprites[spriteId1]);
DestroySpriteWithActiveSheet(&gSprites[spriteId1]);
DestroyAnimVisualTask(taskId);
return;
}
@ -4974,7 +4974,7 @@ static void MoveOdorSleuthClone(struct Sprite *sprite)
if (sprite->data[5] < 0)
{
gTasks[sprite->data[6]].data[sprite->data[7]]--;
obj_delete_but_dont_free_vram(sprite);
DestroySpriteWithActiveSheet(sprite);
}
}
break;

View File

@ -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)
@ -682,8 +682,8 @@ static void AnimElectricity(struct Sprite *sprite)
// The vertical falling thunder bolt used in Thunder Wave/Shock/Bolt
void AnimTask_ElectricBolt(u8 taskId)
{
gTasks[taskId].data[0] = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[0];
gTasks[taskId].data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[1];
gTasks[taskId].data[0] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[0];
gTasks[taskId].data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[1];
gTasks[taskId].data[2] = gBattleAnimArgs[2];
gTasks[taskId].func = AnimTask_ElectricBolt_Step;
}

View File

@ -478,8 +478,8 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
gBattleAnimArgs[2] = Random2() % 5;
StartSpriteAnim(sprite, gBattleAnimArgs[2]);
sprite->x = GetBattlerSpriteCoord(battler, 2);
sprite->y = GetBattlerSpriteCoord(battler, 3);
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET);
xMod = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_WIDTH) / 2;
yMod = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 4;
@ -646,8 +646,8 @@ static void AnimStompFoot_Step(struct Sprite *sprite)
if (--sprite->data[0] == -1)
{
sprite->data[0] = 6;
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, AnimStompFoot_End);
@ -691,13 +691,13 @@ static void AnimBrickBreakWall(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
{
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);
}
sprite->x += gBattleAnimArgs[1];
@ -745,13 +745,13 @@ static void AnimBrickBreakWallShard(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[2];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[3];
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[2];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[3];
}
else
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[2];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[3];
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[2];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[3];
}
sprite->oam.tileNum += gBattleAnimArgs[1] * 16;
@ -796,8 +796,8 @@ static void AnimSuperpowerOrb(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
{
sprite->x = GetBattlerSpriteCoord(gBattlerAttacker, 2);
sprite->y = GetBattlerSpriteCoord(gBattlerAttacker, 3);
sprite->x = GetBattlerSpriteCoord(gBattlerAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattlerAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
sprite->data[7] = gBattleAnimTarget;
}
@ -821,13 +821,13 @@ static void AnimSuperpowerOrb_Step(struct Sprite *sprite)
sprite->data[0] = 16;
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(sprite->data[7], 2);
sprite->data[2] = GetBattlerSpriteCoord(sprite->data[7], BATTLER_COORD_X_2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(sprite->data[7], 3);
sprite->data[4] = GetBattlerSpriteCoord(sprite->data[7], BATTLER_COORD_Y_PIC_OFFSET);
InitAnimLinearTranslation(sprite);
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
sprite->callback = AnimTranslateLinear_WaitEnd;
sprite->callback = AnimTranslateLinear_WithFollowup;
}
}
@ -865,10 +865,10 @@ static void AnimSuperpowerRock_Step1(struct Sprite *sprite)
}
else
{
s16 pos0 = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
s16 pos1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
s16 pos2 = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
s16 pos3 = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
s16 pos0 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
s16 pos1 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
s16 pos2 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
s16 pos3 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->data[0] = pos2 - pos0;
sprite->data[1] = pos3 - pos1;
@ -899,8 +899,8 @@ static void AnimSuperpowerFireball(struct Sprite *sprite)
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
{
sprite->x = GetBattlerSpriteCoord(gBattlerAttacker, 2);
sprite->y = GetBattlerSpriteCoord(gBattlerAttacker, 3);
sprite->x = GetBattlerSpriteCoord(gBattlerAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattlerAttacker, BATTLER_COORD_Y_PIC_OFFSET);
battler = gBattleAnimTarget;
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
}
@ -917,13 +917,13 @@ static void AnimSuperpowerFireball(struct Sprite *sprite)
sprite->data[0] = 16;
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(battler, 2);
sprite->data[2] = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(battler, 3);
sprite->data[4] = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET);
InitAnimLinearTranslation(sprite);
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
sprite->callback = AnimTranslateLinear_WaitEnd;
sprite->callback = AnimTranslateLinear_WithFollowup;
}
static void AnimArmThrustHit_Step(struct Sprite *sprite)
@ -938,8 +938,8 @@ static void AnimArmThrustHit(struct Sprite *sprite)
{
u8 turn;
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[2] = gBattleAnimArgs[0];
sprite->data[3] = gBattleAnimArgs[1];

View File

@ -472,7 +472,7 @@ static void AnimFireSpiralInward(struct Sprite *sprite)
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
sprite->callback = TranslateSpriteInGrowingCircleOverDuration;
sprite->callback = TranslateSpriteInGrowingCircle;
sprite->callback(sprite);
}
@ -665,9 +665,9 @@ static void AnimFireRing_Step1(struct Sprite *sprite)
{
sprite->data[0] = 0x19;
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
InitAnimLinearTranslation(sprite);
@ -681,8 +681,8 @@ static void AnimFireRing_Step2(struct Sprite *sprite)
{
sprite->data[0] = 0;
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->y2 = 0;
sprite->x2 = 0;
@ -1101,9 +1101,9 @@ static void AnimWillOWispOrb(struct Sprite *sprite)
sprite->data[0] = 256;
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
InitAnimLinearTranslationWithSpeed(sprite);
sprite->callback = AnimWillOWispOrb_Step;

View File

@ -895,8 +895,8 @@ static void AnimFallingFeather_Step(struct Sprite *sprite)
static void AnimUnusedBubbleThrow(struct Sprite *sprite)
{
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
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->callback = TranslateAnimSpriteToTargetMonLocation;
}
@ -955,8 +955,8 @@ void AnimTask_DrillPeckHitSplats(u8 task)
gBattleAnimArgs[3] = 3;
CreateSpriteAndAnimate(&gFlashingHitSplatSpriteTemplate,
GetBattlerSpriteCoord(gBattleAnimTarget, 2),
GetBattlerSpriteCoord(gBattleAnimTarget, 3),
GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2),
GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET),
3);
}
@ -987,7 +987,7 @@ static void AnimBounceBallLand(struct Sprite *sprite)
switch (sprite->data[0])
{
case 0:
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
sprite->y2 = -sprite->y - 32;
sprite->data[0]++;
break;
@ -1056,13 +1056,13 @@ static void AnimDiveWaterSplash(struct Sprite *sprite)
case 0:
if (!gBattleAnimArgs[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);
}
sprite->data[1] = 0x200;
@ -1123,13 +1123,13 @@ static void AnimSprayWaterDroplet(struct Sprite *sprite)
if (gBattleAnimArgs[1] == 0)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 32;
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 32;
}
else
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 32;
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 32;
}
sprite->callback = AnimSprayWaterDroplet_Step;
@ -1190,8 +1190,8 @@ static void AnimSkyAttackBird(struct Sprite *sprite)
s16 posx = sprite->x;
s16 posy = sprite->y;
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] = sprite->x << 4;
sprite->data[5] = sprite->y << 4;

View File

@ -222,9 +222,9 @@ static void AnimConfuseRayBallBounce(struct Sprite *sprite)
InitSpritePosToAnimAttacker(sprite, TRUE);
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
InitAnimLinearTranslationWithSpeed(sprite);
sprite->callback = AnimConfuseRayBallBounce_Step1;
sprite->data[6] = 16;
@ -400,8 +400,8 @@ static void AnimShadowBall(struct Sprite *sprite)
s16 oldPosX = sprite->x;
s16 oldPosY = sprite->y;
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[0] = 0;
sprite->data[1] = gBattleAnimArgs[0];
sprite->data[2] = gBattleAnimArgs[1];
@ -431,8 +431,8 @@ static void AnimShadowBall_Step(struct Sprite *sprite)
sprite->data[2] -= 1;
if (sprite->data[2] > 0)
break;
sprite->data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->data[4] = sprite->x << 4;
sprite->data[5] = sprite->y << 4;
sprite->data[6] = ((sprite->data[1] - sprite->x) << 4) / sprite->data[3];
@ -447,8 +447,8 @@ static void AnimShadowBall_Step(struct Sprite *sprite)
sprite->data[3] -= 1;
if (sprite->data[3] > 0)
break;
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->data[0] += 1;
break;
case 3:
@ -567,7 +567,7 @@ static void AnimTask_NightmareClone_Step(u8 taskId)
break;
if (task->data[1] <= 80)
break;
obj_delete_but_dont_free_vram(&gSprites[task->data[0]]);
DestroySpriteWithActiveSheet(&gSprites[task->data[0]]);
task->data[4] = 1;
break;
case 1:
@ -723,7 +723,7 @@ static void AnimTask_SpiteTargetShadow_Step3(u8 taskId)
break;
case 2:
gSprites[task->data[14]].invisible = TRUE;
obj_delete_but_dont_free_vram(&gSprites[task->data[0]]);
DestroySpriteWithActiveSheet(&gSprites[task->data[0]]);
FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
@ -747,17 +747,17 @@ static void AnimDestinyBondWhiteShadow(struct Sprite *sprite)
if (gBattleAnimArgs[0] == 0)
{
battler1X = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
battler1Y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 28;
battler2X = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
battler2Y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 28;
battler1X = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
battler1Y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 28;
battler2X = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
battler2Y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 28;
}
else
{
battler1X = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
battler1Y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 28;
battler2X = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
battler2Y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 28;
battler1X = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
battler1Y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 28;
battler2X = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
battler2Y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 28;
}
yDiff = battler2Y - battler1Y;
@ -807,7 +807,7 @@ void AnimTask_DestinyBondWhiteShadow(u8 taskId)
task->data[9] = 16;
task->data[10] = gBattleAnimArgs[0];
baseX = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
baseX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
baseY = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_BOTTOM);
if (!IsContest())
{
@ -820,7 +820,7 @@ void AnimTask_DestinyBondWhiteShadow(u8 taskId)
spriteId = CreateSprite(&gDestinyBondWhiteShadowSpriteTemplate, baseX, baseY, 55);
if (spriteId != MAX_SPRITES)
{
x = GetBattlerSpriteCoord(battler, 2);
x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2);
y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_BOTTOM);
gSprites[spriteId].data[0] = baseX << 4;
gSprites[spriteId].data[1] = baseY << 4;
@ -1175,7 +1175,7 @@ void AnimTask_GrudgeFlames(u8 taskId)
task->data[0] = 0;
task->data[1] = 16;
task->data[9] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
task->data[9] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
task->data[10] = GetBattlerYCoordWithElevation(gBattleAnimAttacker);
task->data[11] = (GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_WIDTH) / 2) + 8;
task->data[7] = 0;

View File

@ -141,11 +141,11 @@ const struct SpriteTemplate gDirtMoundSpriteTemplate =
// a boomerang. After hitting the target mon, it comes back to the user.
static void AnimBonemerangProjectile(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);
sprite->data[0] = 20;
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->data[5] = -40;
InitAnimArcTranslation(sprite);
sprite->callback = AnimBonemerangProjectile_Step;
@ -160,8 +160,8 @@ static void AnimBonemerangProjectile_Step(struct Sprite *sprite)
sprite->y2 = 0;
sprite->x2 = 0;
sprite->data[0] = 20;
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->data[5] = 40;
InitAnimArcTranslation(sprite);
sprite->callback = AnimBonemerangProjectile_End;
@ -188,8 +188,8 @@ static void AnimBoneHitProjectile(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->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
@ -207,8 +207,8 @@ static void AnimDirtScatter(struct Sprite *sprite)
InitSpritePosToAnimAttacker(sprite, 1);
targetXPos = GetBattlerSpriteCoord2(gBattleAnimTarget, 2);
targetYPos = GetBattlerSpriteCoord2(gBattleAnimTarget, 3);
targetXPos = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_X_2);
targetYPos = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
xOffset = Random2() & 0x1F;
yOffset = Random2() & 0x1F;
@ -234,8 +234,8 @@ static void AnimMudSportDirt(struct Sprite *sprite)
sprite->oam.tileNum++;
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];
sprite->data[0] = gBattleAnimArgs[1] > 0 ? 1 : -1;
sprite->callback = AnimMudSportDirtRising;
}
@ -518,7 +518,7 @@ void AnimDirtPlumeParticle(struct Sprite *sprite)
gBattleAnimArgs[2] *= -1;
}
sprite->x = GetBattlerSpriteCoord(battler, 2) + xOffset;
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2) + xOffset;
sprite->y = GetBattlerYCoordWithElevation(battler) + 30;
sprite->data[0] = gBattleAnimArgs[5];
sprite->data[2] = sprite->x + gBattleAnimArgs[2];
@ -549,7 +549,7 @@ static void AnimDigDirtMound(struct Sprite *sprite)
else
battler = gBattleAnimTarget;
sprite->x = GetBattlerSpriteCoord(battler, 0) - 16 + (gBattleAnimArgs[1] * 32);
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_X) - 16 + (gBattleAnimArgs[1] * 32);
sprite->y = GetBattlerYCoordWithElevation(battler) + 32;
sprite->oam.tileNum += gBattleAnimArgs[1] * 8;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);

View File

@ -538,7 +538,7 @@ static void AnimUnusedIceCrystalThrow(struct Sprite *sprite)
sprite->data[2] = gBattleAnimArgs[2] + targetX;
sprite->data[3] = gBattleAnimArgs[1] + attackerY;
sprite->data[4] = gBattleAnimArgs[3] + targetY;
sub_80A64EC(sprite);
ConvertPosDataToTranslateLinearData(sprite);
for (;(targetX >= -32 && targetX <= DISPLAY_WIDTH + 32) && (targetY >= -32 && targetY <= DISPLAY_HEIGHT + 32);
targetX += sprite->data[1], targetY += sprite->data[2])
@ -557,7 +557,7 @@ static void AnimUnusedIceCrystalThrow(struct Sprite *sprite)
sprite->data[2] = targetX;
sprite->data[3] = attackerY;
sprite->data[4] = targetY;
sub_80A64EC(sprite);
ConvertPosDataToTranslateLinearData(sprite);
sprite->data[3] = gBattleAnimArgs[5];
sprite->data[4] = gBattleAnimArgs[6];
sprite->callback = AnimUnusedIceCrystalThrow_Step;
@ -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);
}

View File

@ -441,14 +441,14 @@ static void DoHorizontalLunge(struct Sprite *sprite)
sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker];
sprite->data[4] = gBattleAnimArgs[0];
StoreSpriteCallbackInData6(sprite, ReverseHorizontalLungeDirection);
sprite->callback = TranslateMonSpriteLinear;
sprite->callback = TranslateSpriteLinearById;
}
static void ReverseHorizontalLungeDirection(struct Sprite *sprite)
{
sprite->data[0] = sprite->data[4];
sprite->data[1] = -sprite->data[1];
sprite->callback = TranslateMonSpriteLinear;
sprite->callback = TranslateSpriteLinearById;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
@ -468,14 +468,14 @@ static void DoVerticalDip(struct Sprite *sprite)
sprite->data[3] = spriteId;
sprite->data[4] = gBattleAnimArgs[0];
StoreSpriteCallbackInData6(sprite, ReverseVerticalDipDirection);
sprite->callback = TranslateMonSpriteLinear;
sprite->callback = TranslateSpriteLinearById;
}
static void ReverseVerticalDipDirection(struct Sprite *sprite)
{
sprite->data[0] = sprite->data[4];
sprite->data[2] = -sprite->data[2];
sprite->callback = TranslateMonSpriteLinear;
sprite->callback = TranslateSpriteLinearById;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
@ -581,7 +581,7 @@ static void SlideMonToOffset(struct Sprite *sprite)
sprite->data[5] = monSpriteId;
sprite->invisible = TRUE;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
sprite->callback = TranslateMonSpriteLinearFixedPoint;
sprite->callback = TranslateSpriteLinearByIdFixedPoint;
}
static void SlideMonToOffsetAndBack(struct Sprite *sprite)
@ -622,7 +622,7 @@ static void SlideMonToOffsetAndBack(struct Sprite *sprite)
{
StoreSpriteCallbackInData6(sprite, SlideMonToOffsetAndBack_End);
}
sprite->callback = TranslateMonSpriteLinearFixedPoint;
sprite->callback = TranslateSpriteLinearByIdFixedPoint;
}

View File

@ -20,23 +20,21 @@
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 sub_80A8DFC(struct Sprite *sprite);
static void AnimBattlerTrace(struct Sprite *sprite);
static void AnimWeatherBallUp_Step(struct Sprite *sprite);
static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId);
static void AnimTask_BlendPalInAndOutSetup(struct Task *task);
static void AnimTask_AlphaFadeIn_Step(u8 taskId);
static void AnimTask_AttackerPunchWithTrace_Step(u8 taskId);
static void AnimTask_BlendMonInAndOut_Step(u8 taskId);
static bool8 sub_80A7238(void);
static void sub_80A8D78(struct Task *task, u8 taskId);
static bool8 ShouldRotScaleSpeciesBeFlipped(void);
static void CreateBattlerTrace(struct Task *task, u8 taskId);
// EWRAM vars
EWRAM_DATA static union AffineAnimCmd *gAnimTaskAffineAnim = NULL;
EWRAM_DATA static union AffineAnimCmd *sAnimTaskAffineAnim = NULL;
// Const rom data
static const struct UCoords8 sBattlerCoords[][MAX_BATTLERS_COUNT] =
{
{ // Single battle
@ -56,10 +54,10 @@ static const struct UCoords8 sBattlerCoords[][MAX_BATTLERS_COUNT] =
// One entry for each of the four Castform forms.
const struct MonCoords gCastformFrontSpriteCoords[NUM_CASTFORM_FORMS] =
{
[CASTFORM_NORMAL] = { .size = 0x44, .y_offset = 17 },
[CASTFORM_FIRE] = { .size = 0x66, .y_offset = 9 },
[CASTFORM_WATER] = { .size = 0x46, .y_offset = 9 },
[CASTFORM_ICE] = { .size = 0x86, .y_offset = 8 },
[CASTFORM_NORMAL] = { .size = MON_COORDS_SIZE(32, 32), .y_offset = 17 },
[CASTFORM_FIRE] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 9 },
[CASTFORM_WATER] = { .size = MON_COORDS_SIZE(32, 48), .y_offset = 9 },
[CASTFORM_ICE] = { .size = MON_COORDS_SIZE(64, 48), .y_offset = 8 },
};
static const u8 sCastformElevations[NUM_CASTFORM_FORMS] =
@ -287,8 +285,8 @@ u8 GetBattlerSpriteFinal_Y(u8 battlerId, u16 species, bool8 a3)
{
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
y += 8;
if (y > 104)
y = 104;
if (y > DISPLAY_HEIGHT - MON_PIC_HEIGHT + 8)
y = DISPLAY_HEIGHT - MON_PIC_HEIGHT + 8;
}
return y;
}
@ -385,7 +383,7 @@ u8 GetAnimBattlerSpriteId(u8 animBattler)
}
else
{
return 0xff;
return SPRITE_NONE;
}
}
else if (animBattler == ANIM_TARGET)
@ -397,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)];
}
@ -412,7 +410,7 @@ u8 GetAnimBattlerSpriteId(u8 animBattler)
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)))
return gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimTarget)];
else
return 0xff;
return SPRITE_NONE;
}
}
@ -428,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
{
@ -447,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
{
@ -467,23 +485,28 @@ void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *sprite)
}
}
void sub_80A63C8(struct Sprite *sprite)
// Unused
// Exact shape depends on arguments. Can move in a figure-8-like pattern, or circular, etc.
static void TranslateSpriteInWavePattern(struct Sprite *sprite)
{
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
{
@ -491,18 +514,18 @@ 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
{
@ -510,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,34 +557,47 @@ void WaitAnimForDuration(struct Sprite *sprite)
SetCallbackToStoredInData6(sprite);
}
static void sub_80A64D0(struct Sprite *sprite)
// Sprite data for ConvertPosDataToTranslateLinearData
#define sStepsX data[0]
#define sStartX data[1]
#define sTargetX data[2]
#define sStartY data[3]
#define sTargetY data[4]
// Sprite data for TranslateSpriteLinear
#define sMoveSteps data[0]
#define sSpeedX data[1]
#define sSpeedY data[2]
// Functionally unused
static void AnimPosToTranslateLinear(struct Sprite *sprite)
{
sub_80A64EC(sprite);
ConvertPosDataToTranslateLinearData(sprite);
sprite->callback = TranslateSpriteLinear;
sprite->callback(sprite);
}
void sub_80A64EC(struct Sprite *sprite)
void ConvertPosDataToTranslateLinearData(struct Sprite *sprite)
{
s16 old;
int xDiff;
if (sprite->data[1] > sprite->data[2])
sprite->data[0] = -sprite->data[0];
xDiff = sprite->data[2] - sprite->data[1];
old = sprite->data[0];
sprite->data[0] = abs(xDiff / sprite->data[0]);
sprite->data[2] = (sprite->data[4] - sprite->data[3]) / sprite->data[0];
sprite->data[1] = old;
if (sprite->sStartX > sprite->sTargetX)
sprite->sStepsX = -sprite->sStepsX;
xDiff = sprite->sTargetX - sprite->sStartX;
old = sprite->sStepsX;
sprite->sMoveSteps = abs(xDiff / sprite->sStepsX);
sprite->sSpeedY = (sprite->sTargetY - sprite->sStartY) / sprite->sMoveSteps;
sprite->sSpeedX = old;
}
void TranslateSpriteLinear(struct Sprite *sprite)
{
if (sprite->data[0] > 0)
if (sprite->sMoveSteps > 0)
{
sprite->data[0]--;
sprite->x2 += sprite->data[1];
sprite->y2 += sprite->data[2];
sprite->sMoveSteps--;
sprite->x2 += sprite->sSpeedX;
sprite->y2 += sprite->sSpeedY;
}
else
{
@ -590,16 +639,18 @@ static void TranslateSpriteLinearFixedPointIconFrame(struct Sprite *sprite)
UpdateMonIconFrame(sprite);
}
void sub_80A65EC(struct Sprite *sprite)
// Unused
static void TranslateSpriteToBattleTargetPos(struct Sprite *sprite)
{
sprite->data[1] = sprite->x + sprite->x2;
sprite->data[3] = sprite->y + sprite->y2;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = sub_80A64D0;
sprite->sStartX = sprite->x + sprite->x2;
sprite->sStartY = sprite->y + sprite->y2;
sprite->sTargetX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->sTargetY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = AnimPosToTranslateLinear;
}
void TranslateMonSpriteLinear(struct Sprite *sprite)
// Same as TranslateSpriteLinear but takes an id to specify which sprite to move
void TranslateSpriteLinearById(struct Sprite *sprite)
{
if (sprite->data[0] > 0)
{
@ -613,7 +664,7 @@ void TranslateMonSpriteLinear(struct Sprite *sprite)
}
}
void TranslateMonSpriteLinearFixedPoint(struct Sprite *sprite)
void TranslateSpriteLinearByIdFixedPoint(struct Sprite *sprite)
{
if (sprite->data[0] > 0)
{
@ -656,15 +707,22 @@ void DestroySpriteAndMatrix(struct Sprite *sprite)
DestroyAnimSprite(sprite);
}
void sub_80A6760(struct Sprite *sprite)
// Unused
static void TranslateSpriteToBattleAttackerPos(struct Sprite *sprite)
{
sprite->data[1] = sprite->x + sprite->x2;
sprite->data[3] = sprite->y + sprite->y2;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = sub_80A64D0;
sprite->sStartX = sprite->x + sprite->x2;
sprite->sStartY = sprite->y + sprite->y2;
sprite->sTargetX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->sTargetY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = AnimPosToTranslateLinear;
}
#undef sStepsX
#undef sStartX
#undef sTargetX
#undef sStartY
#undef sTargetY
// Unused
static void EndUnkPaletteAnim(struct Sprite *sprite)
{
@ -898,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;
@ -1037,16 +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);
}
void sub_80A6F14(struct Sprite *sprite)
// Unused
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);
}
@ -1080,15 +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);
}
static void sub_80A6FB4(struct Sprite *sprite)
// Functionally unused
static void AnimTranslateLinear_WithFollowup_SetCornerVecX(struct Sprite *sprite)
{
sub_8039E9C(sprite);
AnimSetCenterToCornerVecX(sprite);
if (AnimTranslateLinear(sprite))
SetCallbackToStoredInData6(sprite);
}
@ -1105,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);
}
@ -1207,7 +1267,7 @@ void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation)
src.xScale = xScale;
src.yScale = yScale;
src.rotation = rotation;
if (sub_80A7238())
if (ShouldRotScaleSpeciesBeFlipped())
src.xScale = -src.xScale;
i = gSprites[spriteId].oam.matrixNum;
ObjAffineSet(&src, &matrix, 1, 2);
@ -1217,7 +1277,8 @@ void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation)
gOamMatrices[i].d = matrix.d;
}
static bool8 sub_80A7238(void)
// Pokémon in Contests (except Unown) should be flipped.
static bool8 ShouldRotScaleSpeciesBeFlipped(void)
{
if (IsContest())
{
@ -1282,7 +1343,7 @@ void TrySetSpriteRotScale(struct Sprite *sprite, bool8 recalcCenterVector, s16 x
src.xScale = xScale;
src.yScale = yScale;
src.rotation = rotation;
if (sub_80A7238())
if (ShouldRotScaleSpeciesBeFlipped())
src.xScale = -src.xScale;
i = sprite->oam.matrixNum;
ObjAffineSet(&src, &matrix, 1, 2);
@ -1586,7 +1647,7 @@ s16 CloneBattlerSpriteWithBlend(u8 animBattler)
return -1;
}
void obj_delete_but_dont_free_vram(struct Sprite *sprite)
void DestroySpriteWithActiveSheet(struct Sprite *sprite)
{
sprite->usingSheet = TRUE;
DestroySprite(sprite);
@ -1741,34 +1802,34 @@ void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union Aff
bool8 RunAffineAnimFromTaskData(struct Task *task)
{
gAnimTaskAffineAnim = &((union AffineAnimCmd *)LoadPointerFromVars(task->data[13], task->data[14]))[task->data[7]];
switch (gAnimTaskAffineAnim->type)
sAnimTaskAffineAnim = &((union AffineAnimCmd *)LoadPointerFromVars(task->data[13], task->data[14]))[task->data[7]];
switch (sAnimTaskAffineAnim->type)
{
default:
if (!gAnimTaskAffineAnim->frame.duration)
if (!sAnimTaskAffineAnim->frame.duration)
{
task->data[10] = gAnimTaskAffineAnim->frame.xScale;
task->data[11] = gAnimTaskAffineAnim->frame.yScale;
task->data[12] = gAnimTaskAffineAnim->frame.rotation;
task->data[10] = sAnimTaskAffineAnim->frame.xScale;
task->data[11] = sAnimTaskAffineAnim->frame.yScale;
task->data[12] = sAnimTaskAffineAnim->frame.rotation;
task->data[7]++;
gAnimTaskAffineAnim++;
sAnimTaskAffineAnim++;
}
task->data[10] += gAnimTaskAffineAnim->frame.xScale;
task->data[11] += gAnimTaskAffineAnim->frame.yScale;
task->data[12] += gAnimTaskAffineAnim->frame.rotation;
task->data[10] += sAnimTaskAffineAnim->frame.xScale;
task->data[11] += sAnimTaskAffineAnim->frame.yScale;
task->data[12] += sAnimTaskAffineAnim->frame.rotation;
SetSpriteRotScale(task->data[15], task->data[10], task->data[11], task->data[12]);
SetBattlerSpriteYOffsetFromYScale(task->data[15]);
if (++task->data[8] >= gAnimTaskAffineAnim->frame.duration)
if (++task->data[8] >= sAnimTaskAffineAnim->frame.duration)
{
task->data[8] = 0;
task->data[7]++;
}
break;
case AFFINEANIMCMDTYPE_JUMP:
task->data[7] = gAnimTaskAffineAnim->jump.target;
task->data[7] = sAnimTaskAffineAnim->jump.target;
break;
case AFFINEANIMCMDTYPE_LOOP:
if (gAnimTaskAffineAnim->loop.count)
if (sAnimTaskAffineAnim->loop.count)
{
if (task->data[9])
{
@ -1780,7 +1841,7 @@ bool8 RunAffineAnimFromTaskData(struct Task *task)
}
else
{
task->data[9] = gAnimTaskAffineAnim->loop.count;
task->data[9] = sAnimTaskAffineAnim->loop.count;
}
if (!task->data[7])
{
@ -1789,8 +1850,8 @@ bool8 RunAffineAnimFromTaskData(struct Task *task)
for (;;)
{
task->data[7]--;
gAnimTaskAffineAnim--;
if (gAnimTaskAffineAnim->type == AFFINEANIMCMDTYPE_LOOP)
sAnimTaskAffineAnim--;
if (sAnimTaskAffineAnim->type == AFFINEANIMCMDTYPE_LOOP)
{
task->data[7]++;
return TRUE;
@ -1814,12 +1875,12 @@ bool8 RunAffineAnimFromTaskData(struct Task *task)
// matrix's scale in the y dimension.
void SetBattlerSpriteYOffsetFromYScale(u8 spriteId)
{
int var = 64 - GetBattlerYDeltaFromSpriteId(spriteId) * 2;
int var = MON_PIC_HEIGHT - GetBattlerYDeltaFromSpriteId(spriteId) * 2;
u16 matrix = gSprites[spriteId].oam.matrixNum;
int var2 = SAFE_DIV(var << 8, gOamMatrices[matrix].d);
if (var2 > 128)
var2 = 128;
if (var2 > MON_PIC_HEIGHT * 2)
var2 = MON_PIC_HEIGHT * 2;
gSprites[spriteId].y2 = (var - var2) / 2;
}
@ -1827,12 +1888,12 @@ void SetBattlerSpriteYOffsetFromYScale(u8 spriteId)
// matrix's scale in the y dimension.
void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId)
{
int var = 64 - GetBattlerYDeltaFromSpriteId(otherSpriteId) * 2;
int var = MON_PIC_HEIGHT - GetBattlerYDeltaFromSpriteId(otherSpriteId) * 2;
u16 matrix = gSprites[spriteId].oam.matrixNum;
int var2 = SAFE_DIV(var << 8, gOamMatrices[matrix].d);
if (var2 > 128)
var2 = 128;
if (var2 > MON_PIC_HEIGHT * 2)
var2 = MON_PIC_HEIGHT * 2;
gSprites[spriteId].y2 = (var - var2) / 2;
}
@ -1883,7 +1944,7 @@ static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId)
}
}
}
return 64;
return MON_PIC_HEIGHT;
}
void StorePointerInVars(s16 *lo, s16 *hi, const void *ptr)
@ -2210,17 +2271,17 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr)
switch (attr)
{
case BATTLER_COORD_ATTR_HEIGHT:
return (coords->size & 0xf) * 8;
return GET_MON_COORDS_HEIGHT(coords->size);
case BATTLER_COORD_ATTR_WIDTH:
return (coords->size >> 4) * 8;
return GET_MON_COORDS_WIDTH(coords->size);
case BATTLER_COORD_ATTR_LEFT:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - ((coords->size >> 4) * 4);
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - (GET_MON_COORDS_WIDTH(coords->size) / 2);
case BATTLER_COORD_ATTR_RIGHT:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + ((coords->size >> 4) * 4);
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + (GET_MON_COORDS_WIDTH(coords->size) / 2);
case BATTLER_COORD_ATTR_TOP:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - ((coords->size & 0xf) * 4);
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - (GET_MON_COORDS_HEIGHT(coords->size) / 2);
case BATTLER_COORD_ATTR_BOTTOM:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + ((coords->size & 0xf) * 4);
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + (GET_MON_COORDS_HEIGHT(coords->size) / 2);
case BATTLER_COORD_ATTR_RAW_BOTTOM:
ret = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 31;
return ret - coords->y_offset;
@ -2332,6 +2393,19 @@ void AnimSpinningSparkle(struct Sprite *sprite)
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
// Task and sprite data for AnimTask_AttackerPunchWithTrace
#define tBattlerSpriteId data[0]
#define tMoveSpeed data[1]
#define tState data[2]
#define tCounter data[3]
#define tPaletteNum data[4]
#define tNumTracesActive data[5]
#define tPriority data[6]
#define sActiveTime data[0]
#define sTaskId data[1]
#define sSpriteId data[2]
// Slides attacker to right and back with a cloned trace of the specified color
// arg0: Trace palette blend color
// arg1: Trace palette blend coeff
@ -2341,21 +2415,24 @@ void AnimTask_AttackerPunchWithTrace(u8 taskId)
u16 dest;
struct Task *task = &gTasks[taskId];
task->data[0] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->data[1] = ((GetBattlerSide(gBattleAnimAttacker)) != B_SIDE_PLAYER) ? -8 : 8;
task->data[2] = 0;
task->data[3] = 0;
gSprites[task->data[0]].x2 -= task->data[0];
task->data[4] = AllocSpritePalette(ANIM_TAG_BENT_SPOON);
task->data[5] = 0;
task->tBattlerSpriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->tMoveSpeed = (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) ? -8 : 8;
task->tState = 0;
task->tCounter = 0;
gSprites[task->tBattlerSpriteId].x2 -= task->tBattlerSpriteId;
task->tPaletteNum = AllocSpritePalette(ANIM_TAG_BENT_SPOON);
task->tNumTracesActive = 0;
dest = (task->data[4] + 0x10) * 0x10;
src = (gSprites[task->data[0]].oam.paletteNum + 0x10) * 0x10;
task->data[6] = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
if (task->data[6] == 20 || task->data[6] == 40)
task->data[6] = 2;
dest = (task->tPaletteNum + 16) * 16;
src = (gSprites[task->tBattlerSpriteId].oam.paletteNum + 0x10) * 0x10;
// Set trace's priority based on battler's subpriority
task->tPriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
if (task->tPriority == 20 || task->tPriority == 40)
task->tPriority = 2;
else
task->data[6] = 3;
task->tPriority = 3;
CpuCopy32(&gPlttBufferUnfaded[src], &gPlttBufferFaded[dest], 0x20);
BlendPalette(dest, 16, gBattleAnimArgs[1], gBattleAnimArgs[0]);
task->func = AnimTask_AttackerPunchWithTrace_Step;
@ -2364,28 +2441,30 @@ void AnimTask_AttackerPunchWithTrace(u8 taskId)
static void AnimTask_AttackerPunchWithTrace_Step(u8 taskId)
{
struct Task *task = &gTasks[taskId];
switch (task->data[2])
switch (task->tState)
{
case 0:
sub_80A8D78(task, taskId);
gSprites[task->data[0]].x2 += task->data[1];
if (++task->data[3] == 5)
// Move forward
CreateBattlerTrace(task, taskId);
gSprites[task->tBattlerSpriteId].x2 += task->tMoveSpeed;
if (++task->tCounter == 5)
{
task->data[3]--;
task->data[2]++;
task->tCounter--;
task->tState++;
}
break;
case 1:
sub_80A8D78(task, taskId);
gSprites[task->data[0]].x2 -= task->data[1];
if (--task->data[3] == 0)
// Move back (do same number of traces as before)
CreateBattlerTrace(task, taskId);
gSprites[task->tBattlerSpriteId].x2 -= task->tMoveSpeed;
if (--task->tCounter == 0)
{
gSprites[task->data[0]].x2 = 0;
task->data[2]++;
gSprites[task->tBattlerSpriteId].x2 = 0;
task->tState++;
}
break;
case 2:
if (!task->data[5])
if (task->tNumTracesActive == 0)
{
FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON);
DestroyAnimVisualTask(taskId);
@ -2394,31 +2473,44 @@ static void AnimTask_AttackerPunchWithTrace_Step(u8 taskId)
}
}
static void sub_80A8D78(struct Task *task, u8 taskId)
static void CreateBattlerTrace(struct Task *task, u8 taskId)
{
s16 spriteId = CloneBattlerSpriteWithBlend(0);
if (spriteId >= 0)
{
gSprites[spriteId].oam.priority = task->data[6];
gSprites[spriteId].oam.paletteNum = task->data[4];
gSprites[spriteId].data[0] = 8;
gSprites[spriteId].data[1] = taskId;
gSprites[spriteId].data[2] = spriteId;
gSprites[spriteId].x2 = gSprites[task->data[0]].x2;
gSprites[spriteId].callback = sub_80A8DFC;
task->data[5]++;
gSprites[spriteId].oam.priority = task->tPriority;
gSprites[spriteId].oam.paletteNum = task->tPaletteNum;
gSprites[spriteId].sActiveTime = 8;
gSprites[spriteId].sTaskId = taskId;
gSprites[spriteId].sSpriteId = spriteId;
gSprites[spriteId].x2 = gSprites[task->tBattlerSpriteId].x2;
gSprites[spriteId].callback = AnimBattlerTrace;
task->tNumTracesActive++;
}
}
static void sub_80A8DFC(struct Sprite *sprite)
// Just waits until destroyed
static void AnimBattlerTrace(struct Sprite *sprite)
{
if (--sprite->data[0] == 0)
if (--sprite->sActiveTime == 0)
{
gTasks[sprite->data[1]].data[5]--;
obj_delete_but_dont_free_vram(sprite);
gTasks[sprite->sTaskId].tNumTracesActive--;
DestroySpriteWithActiveSheet(sprite);
}
}
#undef tBattlerSpriteId
#undef tMoveSpeed
#undef tState
#undef tCounter
#undef tPaletteNum
#undef tNumTracesActive
#undef tPriority
#undef sActiveTime
#undef sTaskId
#undef sSpriteId
void AnimWeatherBallUp(struct Sprite *sprite)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);

View File

@ -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);
}

View File

@ -193,8 +193,8 @@ static void AnimSludgeProjectile(struct Sprite *sprite)
InitSpritePosToAnimAttacker(sprite, 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->data[5] = -30;
InitAnimArcTranslation(sprite);

View File

@ -650,8 +650,8 @@ static void AnimQuestionMark(struct Sprite *sprite)
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
x = -x;
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + x;
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + y;
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + x;
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + y;
if (sprite->y < 16)
sprite->y = 16;
@ -1108,7 +1108,7 @@ static void AnimTask_TransparentCloneGrowAndShrink_Step(u8 taskId)
task->data[0]++;
break;
case 2:
obj_delete_but_dont_free_vram(&gSprites[task->data[15]]);
DestroySpriteWithActiveSheet(&gSprites[task->data[15]]);
task->data[0]++;
break;
case 3:

View File

@ -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);
}
@ -564,10 +564,10 @@ void AnimTask_Rollout(u8 taskId)
task = &gTasks[taskId];
var0 = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
var1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 24;
var2 = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
var3 = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 24;
var0 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
var1 = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 24;
var2 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
var3 = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 24;
if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget)
var3 = var1;
@ -787,8 +787,8 @@ static void AnimRockBlastRock(struct Sprite *sprite)
static void AnimRockScatter(struct Sprite *sprite)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y);
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];

View File

@ -267,7 +267,7 @@ static void AnimMonTrace(struct Sprite *sprite)
else
{
gTasks[sprite->data[1]].data[sprite->data[2]]--;
obj_delete_but_dont_free_vram(sprite);
DestroySpriteWithActiveSheet(sprite);
}
}

View File

@ -517,23 +517,23 @@ static void AnimWaterBubbleProjectile(struct Sprite *sprite)
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) - gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[1];
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) - gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1];
sprite->animPaused = TRUE;
}
else
{
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[1];
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[1];
sprite->animPaused = TRUE;
}
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[6];
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
InitAnimLinearTranslation(sprite);
spriteId = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy);
sprite->data[5] = spriteId;
@ -595,9 +595,9 @@ static void AnimAuroraBeamRings(struct Sprite *sprite)
unkArg = gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + unkArg;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + unkArg;
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
InitAnimLinearTranslation(sprite);
sprite->callback = AnimAuroraBeamRings_Step;
sprite->affineAnimPaused = TRUE;
@ -650,9 +650,9 @@ static void AnimToTargetInSinWave(struct Sprite *sprite)
InitSpritePosToAnimAttacker(sprite, TRUE);
sprite->data[0] = 30;
sprite->data[1] = sprite->x;
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[3] = sprite->y;
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
InitAnimLinearTranslation(sprite);
sprite->data[5] = 0xD200 / sprite->data[0];
sprite->data[7] = gBattleAnimArgs[3];
@ -705,8 +705,8 @@ static void AnimHydroCannonCharge(struct Sprite *sprite)
{
u8 priority;
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
sprite->y2 = -10;
priority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
if (!IsContest())
@ -752,14 +752,14 @@ static void AnimHydroCannonBeam(struct Sprite *sprite)
else
animType = FALSE;
if ((u8)gBattleAnimArgs[5] == 0)
coordType = 3;
coordType = BATTLER_COORD_Y_PIC_OFFSET;
else
coordType = 1;
coordType = BATTLER_COORD_Y;
InitSpritePosToAnimAttacker(sprite, animType);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, coordType) + gBattleAnimArgs[3];
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
@ -1167,8 +1167,8 @@ static u8 GetWaterSpoutPowerForAnim(void)
static void CreateWaterSpoutLaunchDroplets(struct Task *task, u8 taskId)
{
s16 i;
s16 attackerCoordX = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
s16 attackerCoordY = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
s16 attackerCoordX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
s16 attackerCoordY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
s16 trigIndex = 172;
u8 subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
s16 increment = 4 - task->data[1];
@ -1341,8 +1341,8 @@ void AnimTask_WaterSport(u8 taskId)
{
struct Task *task = &gTasks[taskId];
task->data[3] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
task->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
task->data[3] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
task->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
task->data[7] = (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) ? 1 : -1;
if (IsContest())
task->data[7] *= -1;
@ -1514,8 +1514,8 @@ static void AnimWaterPulseRingBubble(struct Sprite *sprite)
void AnimWaterPulseRing(struct Sprite *sprite)
{
InitSpritePosToAnimAttacker(sprite, TRUE);
sprite->data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->data[3] = gBattleAnimArgs[2];
sprite->data[4] = gBattleAnimArgs[3];
sprite->callback = AnimWaterPulseRing_Step;

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -1468,7 +1468,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));

View File

@ -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;
}
}

View File

@ -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)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -897,8 +897,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);

View File

@ -1116,7 +1116,7 @@ u16 GetIconSpeciesNoPersonality(u16 species)
}
else
{
if (species > (SPECIES_UNOWN_B - 1))
if (species > NUM_SPECIES)
species = INVALID_ICON_SPECIES;
return GetIconSpecies(species, 0);
}

View File

@ -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;