From f7cf4fa15464e8485e3d07f9ea12d3f12470268b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 9 Aug 2019 20:31:24 -0400 Subject: [PATCH] Use HFLIP, VFLIP --- include/gba/types.h | 4 ++++ src/battle_anim_effects_1.c | 14 +++++++------- src/battle_anim_effects_2.c | 4 ++-- src/battle_anim_effects_3.c | 8 ++++---- src/battle_interface.c | 2 +- src/electric.c | 4 ++-- src/fight.c | 4 ++-- src/flying.c | 2 +- src/ghost.c | 2 +- src/rock.c | 2 +- 10 files changed, 25 insertions(+), 21 deletions(-) diff --git a/include/gba/types.h b/include/gba/types.h index 9f2594703..07e5d4c26 100644 --- a/include/gba/types.h +++ b/include/gba/types.h @@ -68,6 +68,10 @@ struct OamData /*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_BLEND 1 #define ST_OAM_OBJ_WINDOW 2 diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index b3a67a509..242b7977c 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -2547,7 +2547,7 @@ static void AnimPetalDanceSmallFlowerStep(struct Sprite* sprite) { sprite->pos2.x += Sin(sprite->data[5], 8); 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] &= 0xFF; @@ -4380,19 +4380,19 @@ void sub_8101898(struct Sprite* sprite) { sprite->pos1.x -= 0x18; sprite->pos1.y += 0x18; - sprite->oam.matrixNum = 16; + sprite->oam.matrixNum = ST_OAM_MNUM_VFLIP; } else if ((s16)sprite->oam.affineParam == 3) { sprite->pos1.x += 0x18; sprite->pos1.y -= 0x18; - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; } else { sprite->pos1.x += 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); @@ -5105,7 +5105,7 @@ void sub_8102844(struct Sprite* sprite) sprite->data[7] = sprite->pos1.y; if (IsContest()) { - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; sprite->pos1.x += 40; sprite->pos1.y += 20; 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[4] = sprite->pos1.y << 7; 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; @@ -5387,7 +5387,7 @@ void sub_8102FB8(struct Sprite* sprite) s16 a; if (gBattleAnimArgs[0] == 1) { - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; a = 16; } else diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 65cc55604..124b98381 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -1609,10 +1609,10 @@ static void sub_8103C0C(u8 taskId) switch (gTasks[taskId].data[4]) { case 1: - sprite->oam.matrixNum |= 24; + sprite->oam.matrixNum |= (ST_OAM_MNUM_HFLIP | ST_OAM_MNUM_VFLIP); break; case 2: - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; break; } diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 5d79a9e6b..8c4ee34a9 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -1618,7 +1618,7 @@ void sub_815AAA4(struct Sprite *sprite) if (gBattleAnimArgs[2] == 0) { - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; sprite->pos2.x = -12; sprite->data[1] = 2; } @@ -4167,7 +4167,7 @@ void AnimSmellingSaltsHand(struct Sprite *sprite) sprite->pos1.y = GetBattlerSpriteCoord(battler, 3); 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; } else @@ -4317,7 +4317,7 @@ void AnimHelpingHandClap(struct Sprite *sprite) { if (gBattleAnimArgs[0] == 0) { - sprite->oam.matrixNum |= 0x8; // horizontal flip + sprite->oam.matrixNum |= ST_OAM_MNUM_HFLIP; sprite->pos1.x = 100; sprite->data[7] = 1; } @@ -4545,7 +4545,7 @@ void AnimForesightMagnifyingGlass(struct Sprite *sprite) } 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.objMode = ST_OAM_OBJ_BLEND; diff --git a/src/battle_interface.c b/src/battle_interface.c index 922437597..39fa0c277 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1536,7 +1536,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, if (isOpponent) { gSprites[summaryBarSpriteId].pos1.x -= 96; - gSprites[summaryBarSpriteId].oam.matrixNum = 8; + gSprites[summaryBarSpriteId].oam.matrixNum = ST_OAM_MNUM_HFLIP; } else { diff --git a/src/electric.c b/src/electric.c index 5e7729842..920c83f24 100644 --- a/src/electric.c +++ b/src/electric.c @@ -667,9 +667,9 @@ static void sub_810A75C(struct Sprite *sprite) sprite->oam.tileNum += gBattleAnimArgs[3] * 4; if (gBattleAnimArgs[3] == 1) - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; else if (gBattleAnimArgs[3] == 2) - sprite->oam.matrixNum = 16; + sprite->oam.matrixNum = ST_OAM_MNUM_VFLIP; sprite->data[0] = gBattleAnimArgs[2]; sprite->callback = WaitAnimForDuration; diff --git a/src/fight.c b/src/fight.c index c924effae..99346651d 100644 --- a/src/fight.c +++ b/src/fight.c @@ -912,9 +912,9 @@ void sub_810D874(struct Sprite *sprite) } if (IsContest()) - sprite->oam.matrixNum |= 0x8; + sprite->oam.matrixNum |= ST_OAM_MNUM_HFLIP; 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[1] = sprite->pos1.x; diff --git a/src/flying.c b/src/flying.c index a157582e9..45661c7fa 100644 --- a/src/flying.c +++ b/src/flying.c @@ -1800,7 +1800,7 @@ void sub_810EEF8(struct Sprite *sprite) sprite->data[2] = gBattleAnimArgs[0]; if (sprite->data[2]) - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; if (gBattleAnimArgs[1] == 0) { diff --git a/src/ghost.c b/src/ghost.c index dd29fb7ca..f1fb9166d 100644 --- a/src/ghost.c +++ b/src/ghost.c @@ -1039,7 +1039,7 @@ static void sub_81129F0(struct Sprite *sprite) { xDelta = 24; xDelta2 = -2; - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; } else { diff --git a/src/rock.c b/src/rock.c index f05816362..a4b4269fb 100644 --- a/src/rock.c +++ b/src/rock.c @@ -508,7 +508,7 @@ void AnimDirtParticleAcrossScreen(struct Sprite *sprite) sprite->pos1.x = 304; gBattleAnimArgs[1] = -gBattleAnimArgs[1]; sprite->data[5] = 1; - sprite->oam.matrixNum = 8; + sprite->oam.matrixNum = ST_OAM_MNUM_HFLIP; } else {