Use HFLIP, VFLIP

This commit is contained in:
PikalaxALT 2019-08-09 20:31:24 -04:00 committed by huderlem
parent a46f7952f9
commit f7cf4fa154
10 changed files with 25 additions and 21 deletions

View File

@ -68,6 +68,10 @@ struct OamData
/*0x06*/ u16 affineParam; /*0x06*/ u16 affineParam;
}; };
#define ST_OAM_MNUM_HFLIP 0x08
#define ST_OAM_MNUM_VFLIP 0x10
#define ST_OAM_MNUM_FLIP_MASK 0x18
#define ST_OAM_OBJ_NORMAL 0 #define ST_OAM_OBJ_NORMAL 0
#define ST_OAM_OBJ_BLEND 1 #define ST_OAM_OBJ_BLEND 1
#define ST_OAM_OBJ_WINDOW 2 #define ST_OAM_OBJ_WINDOW 2

View File

@ -2547,7 +2547,7 @@ static void AnimPetalDanceSmallFlowerStep(struct Sprite* sprite)
{ {
sprite->pos2.x += Sin(sprite->data[5], 8); sprite->pos2.x += Sin(sprite->data[5], 8);
if ((u16)(sprite->data[5] - 59) < 5 || (u16)(sprite->data[5] - 187) < 5) if ((u16)(sprite->data[5] - 59) < 5 || (u16)(sprite->data[5] - 187) < 5)
sprite->oam.matrixNum ^= 0x8; // horizontal flip sprite->oam.matrixNum ^= ST_OAM_MNUM_HFLIP;
sprite->data[5] += 5; sprite->data[5] += 5;
sprite->data[5] &= 0xFF; sprite->data[5] &= 0xFF;
@ -4380,19 +4380,19 @@ void sub_8101898(struct Sprite* sprite)
{ {
sprite->pos1.x -= 0x18; sprite->pos1.x -= 0x18;
sprite->pos1.y += 0x18; sprite->pos1.y += 0x18;
sprite->oam.matrixNum = 16; sprite->oam.matrixNum = ST_OAM_MNUM_VFLIP;
} }
else if ((s16)sprite->oam.affineParam == 3) else if ((s16)sprite->oam.affineParam == 3)
{ {
sprite->pos1.x += 0x18; sprite->pos1.x += 0x18;
sprite->pos1.y -= 0x18; sprite->pos1.y -= 0x18;
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
} }
else else
{ {
sprite->pos1.x += 0x18; sprite->pos1.x += 0x18;
sprite->pos1.y += 0x18; sprite->pos1.y += 0x18;
sprite->oam.matrixNum = 24; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP | ST_OAM_MNUM_VFLIP;
} }
sprite->oam.tileNum = (sprite->oam.tileNum + 16); sprite->oam.tileNum = (sprite->oam.tileNum + 16);
@ -5105,7 +5105,7 @@ void sub_8102844(struct Sprite* sprite)
sprite->data[7] = sprite->pos1.y; sprite->data[7] = sprite->pos1.y;
if (IsContest()) if (IsContest())
{ {
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
sprite->pos1.x += 40; sprite->pos1.x += 40;
sprite->pos1.y += 20; sprite->pos1.y += 20;
sprite->data[2] = sprite->pos1.x << 7; sprite->data[2] = sprite->pos1.x << 7;
@ -5130,7 +5130,7 @@ void sub_8102844(struct Sprite* sprite)
sprite->data[3] = -0x1400 / sprite->data[1]; sprite->data[3] = -0x1400 / sprite->data[1];
sprite->data[4] = sprite->pos1.y << 7; sprite->data[4] = sprite->pos1.y << 7;
sprite->data[5] = 0xA00 / sprite->data[1]; sprite->data[5] = 0xA00 / sprite->data[1];
sprite->oam.matrixNum = 24; sprite->oam.matrixNum = (ST_OAM_MNUM_HFLIP | ST_OAM_MNUM_VFLIP);
} }
sprite->callback = sub_810296C; sprite->callback = sub_810296C;
@ -5387,7 +5387,7 @@ void sub_8102FB8(struct Sprite* sprite)
s16 a; s16 a;
if (gBattleAnimArgs[0] == 1) if (gBattleAnimArgs[0] == 1)
{ {
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
a = 16; a = 16;
} }
else else

View File

@ -1609,10 +1609,10 @@ static void sub_8103C0C(u8 taskId)
switch (gTasks[taskId].data[4]) switch (gTasks[taskId].data[4])
{ {
case 1: case 1:
sprite->oam.matrixNum |= 24; sprite->oam.matrixNum |= (ST_OAM_MNUM_HFLIP | ST_OAM_MNUM_VFLIP);
break; break;
case 2: case 2:
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
break; break;
} }

View File

@ -1618,7 +1618,7 @@ void sub_815AAA4(struct Sprite *sprite)
if (gBattleAnimArgs[2] == 0) if (gBattleAnimArgs[2] == 0)
{ {
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
sprite->pos2.x = -12; sprite->pos2.x = -12;
sprite->data[1] = 2; sprite->data[1] = 2;
} }
@ -4167,7 +4167,7 @@ void AnimSmellingSaltsHand(struct Sprite *sprite)
sprite->pos1.y = GetBattlerSpriteCoord(battler, 3); sprite->pos1.y = GetBattlerSpriteCoord(battler, 3);
if (gBattleAnimArgs[1] == 0) if (gBattleAnimArgs[1] == 0)
{ {
sprite->oam.matrixNum |= 0x8; sprite->oam.matrixNum |= ST_OAM_MNUM_HFLIP;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) - 8; sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) - 8;
} }
else else
@ -4317,7 +4317,7 @@ void AnimHelpingHandClap(struct Sprite *sprite)
{ {
if (gBattleAnimArgs[0] == 0) if (gBattleAnimArgs[0] == 0)
{ {
sprite->oam.matrixNum |= 0x8; // horizontal flip sprite->oam.matrixNum |= ST_OAM_MNUM_HFLIP;
sprite->pos1.x = 100; sprite->pos1.x = 100;
sprite->data[7] = 1; sprite->data[7] = 1;
} }
@ -4545,7 +4545,7 @@ void AnimForesightMagnifyingGlass(struct Sprite *sprite)
} }
if (GetBattlerSide(sprite->data[7]) == B_SIDE_OPPONENT) if (GetBattlerSide(sprite->data[7]) == B_SIDE_OPPONENT)
sprite->oam.matrixNum = 8; // horizontal flip sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
sprite->oam.priority = GetBattlerSpriteBGPriority(sprite->data[7]); sprite->oam.priority = GetBattlerSpriteBGPriority(sprite->data[7]);
sprite->oam.objMode = ST_OAM_OBJ_BLEND; sprite->oam.objMode = ST_OAM_OBJ_BLEND;

View File

@ -1536,7 +1536,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
if (isOpponent) if (isOpponent)
{ {
gSprites[summaryBarSpriteId].pos1.x -= 96; gSprites[summaryBarSpriteId].pos1.x -= 96;
gSprites[summaryBarSpriteId].oam.matrixNum = 8; gSprites[summaryBarSpriteId].oam.matrixNum = ST_OAM_MNUM_HFLIP;
} }
else else
{ {

View File

@ -667,9 +667,9 @@ static void sub_810A75C(struct Sprite *sprite)
sprite->oam.tileNum += gBattleAnimArgs[3] * 4; sprite->oam.tileNum += gBattleAnimArgs[3] * 4;
if (gBattleAnimArgs[3] == 1) if (gBattleAnimArgs[3] == 1)
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
else if (gBattleAnimArgs[3] == 2) else if (gBattleAnimArgs[3] == 2)
sprite->oam.matrixNum = 16; sprite->oam.matrixNum = ST_OAM_MNUM_VFLIP;
sprite->data[0] = gBattleAnimArgs[2]; sprite->data[0] = gBattleAnimArgs[2];
sprite->callback = WaitAnimForDuration; sprite->callback = WaitAnimForDuration;

View File

@ -912,9 +912,9 @@ void sub_810D874(struct Sprite *sprite)
} }
if (IsContest()) if (IsContest())
sprite->oam.matrixNum |= 0x8; sprite->oam.matrixNum |= ST_OAM_MNUM_HFLIP;
else if (GetBattlerSide(battler) == B_SIDE_PLAYER) else if (GetBattlerSide(battler) == B_SIDE_PLAYER)
sprite->oam.matrixNum |= 0x18; sprite->oam.matrixNum |= (ST_OAM_MNUM_HFLIP | ST_OAM_MNUM_VFLIP);
sprite->data[0] = 16; sprite->data[0] = 16;
sprite->data[1] = sprite->pos1.x; sprite->data[1] = sprite->pos1.x;

View File

@ -1800,7 +1800,7 @@ void sub_810EEF8(struct Sprite *sprite)
sprite->data[2] = gBattleAnimArgs[0]; sprite->data[2] = gBattleAnimArgs[0];
if (sprite->data[2]) if (sprite->data[2])
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
if (gBattleAnimArgs[1] == 0) if (gBattleAnimArgs[1] == 0)
{ {

View File

@ -1039,7 +1039,7 @@ static void sub_81129F0(struct Sprite *sprite)
{ {
xDelta = 24; xDelta = 24;
xDelta2 = -2; xDelta2 = -2;
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
} }
else else
{ {

View File

@ -508,7 +508,7 @@ void AnimDirtParticleAcrossScreen(struct Sprite *sprite)
sprite->pos1.x = 304; sprite->pos1.x = 304;
gBattleAnimArgs[1] = -gBattleAnimArgs[1]; gBattleAnimArgs[1] = -gBattleAnimArgs[1];
sprite->data[5] = 1; sprite->data[5] = 1;
sprite->oam.matrixNum = 8; sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP;
} }
else else
{ {