Flatten pos fields in struct Sprite
This commit is contained in:
+84
-84
@@ -363,7 +363,7 @@ const struct SpriteTemplate gSkyAttackBirdSpriteTemplate =
|
||||
static void AnimEllipticalGust(struct Sprite *sprite)
|
||||
{
|
||||
InitSpritePosToAnimTarget(sprite, FALSE);
|
||||
sprite->pos1.y += 20;
|
||||
sprite->y += 20;
|
||||
sprite->data[1] = 191;
|
||||
sprite->callback = sub_80B190C;
|
||||
sprite->callback(sprite);
|
||||
@@ -371,8 +371,8 @@ static void AnimEllipticalGust(struct Sprite *sprite)
|
||||
|
||||
static void sub_80B190C(struct Sprite *sprite)
|
||||
{
|
||||
sprite->pos2.x = Sin(sprite->data[1], 32);
|
||||
sprite->pos2.y = Cos(sprite->data[1], 8);
|
||||
sprite->x2 = Sin(sprite->data[1], 32);
|
||||
sprite->y2 = Cos(sprite->data[1], 8);
|
||||
sprite->data[1] += 5;
|
||||
sprite->data[1] &= 0xFF;
|
||||
if (++sprite->data[0] == 71)
|
||||
@@ -417,9 +417,9 @@ static void AnimGustToTarget(struct Sprite *sprite)
|
||||
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
||||
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
||||
sprite->data[0] = gBattleAnimArgs[4];
|
||||
sprite->data[1] = sprite->pos1.x;
|
||||
sprite->data[1] = sprite->x;
|
||||
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
|
||||
sprite->data[3] = sprite->pos1.y;
|
||||
sprite->data[3] = sprite->y;
|
||||
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
|
||||
InitAnimLinearTranslation(sprite);
|
||||
sprite->callback = RunStoredCallbackWhenAffineAnimEnds;
|
||||
@@ -446,10 +446,10 @@ static void AnimAirWaveCrescent(struct Sprite *sprite)
|
||||
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
||||
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
|
||||
}
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
sprite->pos1.x += gBattleAnimArgs[0];
|
||||
sprite->pos1.y += gBattleAnimArgs[1];
|
||||
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
||||
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
sprite->x += gBattleAnimArgs[0];
|
||||
sprite->y += gBattleAnimArgs[1];
|
||||
sprite->data[0] = gBattleAnimArgs[4];
|
||||
if (gBattleAnimArgs[6] == 0)
|
||||
{
|
||||
@@ -485,9 +485,9 @@ static void sub_80B1BF8(struct Sprite *sprite)
|
||||
else
|
||||
{
|
||||
sprite->data[2] += sprite->data[1];
|
||||
sprite->pos2.y -= (sprite->data[2] >> 8);
|
||||
sprite->y2 -= (sprite->data[2] >> 8);
|
||||
}
|
||||
if (sprite->pos1.y + sprite->pos2.y < -32)
|
||||
if (sprite->y + sprite->y2 < -32)
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
|
||||
@@ -495,19 +495,19 @@ static void AnimFlyBallAttack(struct Sprite *sprite)
|
||||
{
|
||||
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
||||
{
|
||||
sprite->pos1.x = 272;
|
||||
sprite->pos1.y = -32;
|
||||
sprite->x = 272;
|
||||
sprite->y = -32;
|
||||
StartSpriteAffineAnim(sprite, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->pos1.x = -32;
|
||||
sprite->pos1.y = -32;
|
||||
sprite->x = -32;
|
||||
sprite->y = -32;
|
||||
}
|
||||
sprite->data[0] = gBattleAnimArgs[0];
|
||||
sprite->data[1] = sprite->pos1.x;
|
||||
sprite->data[1] = sprite->x;
|
||||
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
||||
sprite->data[3] = sprite->pos1.y;
|
||||
sprite->data[3] = sprite->y;
|
||||
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
InitAnimLinearTranslation(sprite);
|
||||
sprite->callback = sub_80B1CC0;
|
||||
@@ -519,13 +519,13 @@ static void sub_80B1CC0(struct Sprite *sprite)
|
||||
AnimTranslateLinear(sprite);
|
||||
if (((u16)sprite->data[3] >> 8) > 200)
|
||||
{
|
||||
sprite->pos1.x += sprite->pos2.x;
|
||||
sprite->pos2.x = 0;
|
||||
sprite->x += sprite->x2;
|
||||
sprite->x2 = 0;
|
||||
sprite->data[3] &= 0xFF;
|
||||
}
|
||||
if (sprite->pos1.x + sprite->pos2.x < -32
|
||||
|| sprite->pos1.x + sprite->pos2.x > 272
|
||||
|| sprite->pos1.y + sprite->pos2.y > 160)
|
||||
if (sprite->x + sprite->x2 < -32
|
||||
|| sprite->x + sprite->x2 > 272
|
||||
|| sprite->y + sprite->y2 > 160)
|
||||
{
|
||||
gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = FALSE;
|
||||
DestroyAnimSprite(sprite);
|
||||
@@ -576,10 +576,10 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
||||
battler = gBattleAnimTarget;
|
||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_HEIGHT) + gBattleAnimArgs[0];
|
||||
sprite->x = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_HEIGHT) + gBattleAnimArgs[0];
|
||||
spriteCoord = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_WIDTH);
|
||||
sprite->pos1.y = spriteCoord + gBattleAnimArgs[1];
|
||||
data->unk8 = sprite->pos1.y << 8;
|
||||
sprite->y = spriteCoord + gBattleAnimArgs[1];
|
||||
data->unk8 = sprite->y << 8;
|
||||
data->unkE_1 = spriteCoord + gBattleAnimArgs[6];
|
||||
data->unk0_0c = 1;
|
||||
data->unk2 = gBattleAnimArgs[2] & 0xFF;
|
||||
@@ -616,9 +616,9 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
||||
}
|
||||
}
|
||||
data->unk0_1 = data->unk2 >> 6;
|
||||
sprite->pos2.x = (gSineTable[data->unk2] * data->unkC[0]) >> 8;
|
||||
sprite->x2 = (gSineTable[data->unk2] * data->unkC[0]) >> 8;
|
||||
matrixNum = sprite->oam.matrixNum;
|
||||
sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
|
||||
sinIndex = (-sprite->x2 >> 1) + data->unkA;
|
||||
sinVal = gSineTable[sinIndex];
|
||||
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
||||
if (sprite)
|
||||
@@ -858,10 +858,10 @@ static void AnimFallingFeather_Step(struct Sprite *sprite)
|
||||
break;
|
||||
}
|
||||
|
||||
sprite->pos2.x = ((s32)data->unkC[data->unk0_0b] * gSineTable[data->unk2]) >> 8;
|
||||
sprite->x2 = ((s32)data->unkC[data->unk0_0b] * gSineTable[data->unk2]) >> 8;
|
||||
matrixNum = sprite->oam.matrixNum;
|
||||
|
||||
sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
|
||||
sinIndex = (-sprite->x2 >> 1) + data->unkA;
|
||||
sinVal = gSineTable[sinIndex];
|
||||
|
||||
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
||||
@@ -869,13 +869,13 @@ static void AnimFallingFeather_Step(struct Sprite *sprite)
|
||||
gOamMatrices[matrixNum].c = -sinVal;
|
||||
|
||||
data->unk8 += data->unk6;
|
||||
sprite->pos1.y = data->unk8 >> 8;
|
||||
sprite->y = data->unk8 >> 8;
|
||||
if (data->unk4 & 0x8000)
|
||||
data->unk2 = (data->unk2 - (data->unk4 & 0x7FFF)) & 0xFF;
|
||||
else
|
||||
data->unk2 = (data->unk2 + (data->unk4 & 0x7FFF)) & 0xFF;
|
||||
|
||||
if (sprite->pos1.y + sprite->pos2.y >= data->unkE_1)
|
||||
if (sprite->y + sprite->y2 >= data->unkE_1)
|
||||
{
|
||||
sprite->data[0] = 0;
|
||||
sprite->callback = DestroyAnimSpriteAfterTimer;
|
||||
@@ -886,8 +886,8 @@ static void AnimFallingFeather_Step(struct Sprite *sprite)
|
||||
static void sub_80B24C0(struct Sprite *sprite)
|
||||
{
|
||||
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
|
||||
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
|
||||
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
|
||||
sprite->callback = TranslateAnimSpriteToTargetMonLocation;
|
||||
}
|
||||
|
||||
@@ -917,8 +917,8 @@ static void sub_80B2514(struct Sprite *sprite)
|
||||
sprite->data[4] = gSineTable[sprite->data[1] & 0xFF];
|
||||
sprite->data[5] = -gSineTable[(sprite->data[1] & 0xFF) + 64];
|
||||
sprite->data[6] = 0;
|
||||
sprite->pos2.y = 0;
|
||||
sprite->pos2.x = 0;
|
||||
sprite->y2 = 0;
|
||||
sprite->x2 = 0;
|
||||
matrixNum = sprite->oam.matrixNum;
|
||||
sprite->data[1] = (u16)sprite->data[1] >> 8;
|
||||
rn = Random();
|
||||
@@ -948,18 +948,18 @@ static void sub_80B268C(struct Sprite *sprite)
|
||||
++sprite->data[0];
|
||||
if (sprite->data[0] <= 4)
|
||||
return;
|
||||
sprite->pos2.x = (sprite->data[4] * sprite->data[6]) >> 8;
|
||||
sprite->pos2.y = (sprite->data[5] * sprite->data[6]) >> 8;
|
||||
sprite->x2 = (sprite->data[4] * sprite->data[6]) >> 8;
|
||||
sprite->y2 = (sprite->data[5] * sprite->data[6]) >> 8;
|
||||
sprite->data[6] += sprite->data[3] & 0xFF;
|
||||
if (sprite->data[6] < (sprite->data[2] & 0xFF))
|
||||
return;
|
||||
sprite->pos1.x += sprite->pos2.x;
|
||||
sprite->pos1.y += sprite->pos2.y;
|
||||
sprite->pos2.x = 0;
|
||||
sprite->pos2.y = 0;
|
||||
sprite->x += sprite->x2;
|
||||
sprite->y += sprite->y2;
|
||||
sprite->x2 = 0;
|
||||
sprite->y2 = 0;
|
||||
memcpy(&fData, tData, sizeof(struct FeatherDanceData));
|
||||
memset(tData, 0, sizeof(struct FeatherDanceData));
|
||||
tData->unk8 = sprite->pos1.y << 8;
|
||||
tData->unk8 = sprite->y << 8;
|
||||
tData->unk6 = fData.unk6 >> 8;
|
||||
tData->unk2 = 0;
|
||||
tData->unkA = fData.unk2;
|
||||
@@ -998,13 +998,13 @@ static void AnimWhirlwindLine(struct Sprite *sprite)
|
||||
InitSpritePosToAnimTarget(sprite, FALSE);
|
||||
if ((!gBattleAnimArgs[2] && GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
||||
|| (gBattleAnimArgs[2] == 1 && GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER))
|
||||
sprite->pos1.x += 8;
|
||||
sprite->x += 8;
|
||||
SeekSpriteAnim(sprite, gBattleAnimArgs[4]);
|
||||
sprite->pos1.x -= 32;
|
||||
sprite->x -= 32;
|
||||
sprite->data[1] = 0x0ccc;
|
||||
arg = gBattleAnimArgs[4];
|
||||
mult = 12;
|
||||
sprite->pos2.x += mult * arg;
|
||||
sprite->x2 += mult * arg;
|
||||
sprite->data[0] = arg;
|
||||
sprite->data[7] = gBattleAnimArgs[3];
|
||||
sprite->callback = sub_80B2820;
|
||||
@@ -1012,11 +1012,11 @@ static void AnimWhirlwindLine(struct Sprite *sprite)
|
||||
|
||||
static void sub_80B2820(struct Sprite *sprite)
|
||||
{
|
||||
sprite->pos2.x += sprite->data[1] >> 8;
|
||||
sprite->x2 += sprite->data[1] >> 8;
|
||||
if (++sprite->data[0] == 6)
|
||||
{
|
||||
sprite->data[0] = 0;
|
||||
sprite->pos2.x = 0;
|
||||
sprite->x2 = 0;
|
||||
StartSpriteAnim(sprite, 0);
|
||||
}
|
||||
|
||||
@@ -1064,18 +1064,18 @@ static void AnimBounceBallLand(struct Sprite *sprite)
|
||||
switch (sprite->data[0])
|
||||
{
|
||||
case 0:
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
|
||||
sprite->pos2.y = -sprite->pos1.y - 32;
|
||||
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
|
||||
sprite->y2 = -sprite->y - 32;
|
||||
++sprite->data[0];
|
||||
break;
|
||||
case 1:
|
||||
sprite->pos2.y += 10;
|
||||
if (sprite->pos2.y >= 0)
|
||||
sprite->y2 += 10;
|
||||
if (sprite->y2 >= 0)
|
||||
++sprite->data[0];
|
||||
break;
|
||||
case 2:
|
||||
sprite->pos2.y -= 10;
|
||||
if (sprite->pos1.y + sprite->pos2.y < -32)
|
||||
sprite->y2 -= 10;
|
||||
if (sprite->y + sprite->y2 < -32)
|
||||
{
|
||||
gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = FALSE;
|
||||
DestroyAnimSprite(sprite);
|
||||
@@ -1099,10 +1099,10 @@ static void sub_80B2A50(struct Sprite *sprite)
|
||||
{
|
||||
--sprite->data[0];
|
||||
}
|
||||
else if (sprite->pos1.y + sprite->pos2.y > -32)
|
||||
else if (sprite->y + sprite->y2 > -32)
|
||||
{
|
||||
sprite->data[2] += sprite->data[1];
|
||||
sprite->pos2.y -= (sprite->data[2] >> 8);
|
||||
sprite->y2 -= (sprite->data[2] >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1114,10 +1114,10 @@ static void sub_80B2A50(struct Sprite *sprite)
|
||||
|
||||
static void sub_80B2AB0(struct Sprite *sprite)
|
||||
{
|
||||
sprite->pos2.y += sprite->data[2] >> 8;
|
||||
if (sprite->pos1.y + sprite->pos2.y > -32)
|
||||
sprite->y2 += sprite->data[2] >> 8;
|
||||
if (sprite->y + sprite->y2 > -32)
|
||||
sprite->invisible = FALSE;
|
||||
if (sprite->pos2.y > 0)
|
||||
if (sprite->y2 > 0)
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
|
||||
@@ -1131,13 +1131,13 @@ static void AnimDiveWaterSplash(struct Sprite *sprite)
|
||||
case 0:
|
||||
if (!gBattleAnimArgs[0])
|
||||
{
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
|
||||
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
|
||||
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
|
||||
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
|
||||
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
|
||||
}
|
||||
sprite->data[1] = 512;
|
||||
TrySetSpriteRotScale(sprite, 0, 256, sprite->data[1], 0);
|
||||
@@ -1156,7 +1156,7 @@ static void AnimDiveWaterSplash(struct Sprite *sprite)
|
||||
if (t2 > 128)
|
||||
t2 = 128;
|
||||
t2 = (64 - t2) / 2;
|
||||
sprite->pos2.y = t2;
|
||||
sprite->y2 = t2;
|
||||
if (sprite->data[2] == 24)
|
||||
{
|
||||
TryResetSpriteAffineState(sprite);
|
||||
@@ -1185,13 +1185,13 @@ static void AnimSprayWaterDroplet(struct Sprite *sprite)
|
||||
sprite->oam.matrixNum = ST_OAM_HFLIP;
|
||||
if (gBattleAnimArgs[1] == 0)
|
||||
{
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 32;
|
||||
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
|
||||
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 32;
|
||||
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
|
||||
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 32;
|
||||
}
|
||||
sprite->callback = sub_80B2C88;
|
||||
}
|
||||
@@ -1200,13 +1200,13 @@ static void sub_80B2C88(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[2] == 0)
|
||||
{
|
||||
sprite->pos2.x += sprite->data[0] >> 8;
|
||||
sprite->pos2.y -= sprite->data[1] >> 8;
|
||||
sprite->x2 += sprite->data[0] >> 8;
|
||||
sprite->y2 -= sprite->data[1] >> 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->pos2.x -= sprite->data[0] >> 8;
|
||||
sprite->pos2.y -= sprite->data[1] >> 8;
|
||||
sprite->x2 -= sprite->data[0] >> 8;
|
||||
sprite->y2 -= sprite->data[1] >> 8;
|
||||
}
|
||||
sprite->data[0] = sprite->data[0];
|
||||
sprite->data[1] -= 32;
|
||||
@@ -1245,16 +1245,16 @@ static void sub_80B2CF8(struct Sprite *sprite)
|
||||
static void AnimSkyAttackBird(struct Sprite *sprite)
|
||||
{
|
||||
u16 rotation;
|
||||
s16 posx = sprite->pos1.x;
|
||||
s16 posy = sprite->pos1.y;
|
||||
s16 posx = sprite->x;
|
||||
s16 posy = sprite->y;
|
||||
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
|
||||
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
|
||||
sprite->data[4] = sprite->pos1.x << 4;
|
||||
sprite->data[5] = sprite->pos1.y << 4;
|
||||
sprite->data[6] = ((posx - sprite->pos1.x) << 4) / 12;
|
||||
sprite->data[7] = ((posy - sprite->pos1.y) << 4) / 12;
|
||||
rotation = ArcTan2Neg(posx - sprite->pos1.x, posy - sprite->pos1.y);
|
||||
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
|
||||
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
|
||||
sprite->data[4] = sprite->x << 4;
|
||||
sprite->data[5] = sprite->y << 4;
|
||||
sprite->data[6] = ((posx - sprite->x) << 4) / 12;
|
||||
sprite->data[7] = ((posy - sprite->y) << 4) / 12;
|
||||
rotation = ArcTan2Neg(posx - sprite->x, posy - sprite->y);
|
||||
rotation += 49152;
|
||||
TrySetSpriteRotScale(sprite, 1, 0x100, 0x100, rotation);
|
||||
sprite->callback = sub_80B2E20;
|
||||
@@ -1264,10 +1264,10 @@ static void sub_80B2E20(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[4] += sprite->data[6];
|
||||
sprite->data[5] += sprite->data[7];
|
||||
sprite->pos1.x = sprite->data[4] >> 4;
|
||||
sprite->pos1.y = sprite->data[5] >> 4;
|
||||
if (sprite->pos1.x > 285 || sprite->pos1.x < -45
|
||||
|| sprite->pos1.y > 157 || sprite->pos1.y < -45)
|
||||
sprite->x = sprite->data[4] >> 4;
|
||||
sprite->y = sprite->data[5] >> 4;
|
||||
if (sprite->x > 285 || sprite->x < -45
|
||||
|| sprite->y > 157 || sprite->y < -45)
|
||||
DestroySpriteAndMatrix(sprite);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user