Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add B_SHOW_TYPES and cleaned up IsDoubleBattle #5131

Merged
merged 60 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
cf2f19a
First attempt at a port
pkmnsnfrn Jul 29, 2024
649308a
Slightly broken but working
pkmnsnfrn Jul 29, 2024
65aad31
Got images working and opponent palettes
pkmnsnfrn Jul 29, 2024
a7a11f4
half finished compressed spritesheet approach instead
ravepossum Jul 31, 2024
46b4954
fix the palettes (smh)
ravepossum Aug 1, 2024
1bc4e25
fix hflip, and a lot of clean-up
ravepossum Aug 1, 2024
cc86194
Merge pull request #2 from ravepossum/typeIcons
pkmnsnfrn Aug 1, 2024
f0c21ce
Add B_SHOW_TYPES
pkmnsnfrn Aug 3, 2024
8adb4d0
Got Illusion working
pkmnsnfrn Aug 4, 2024
0bfed89
Add num type enum
pkmnsnfrn Aug 4, 2024
92e8b67
Updated function to get type
pkmnsnfrn Aug 4, 2024
e56635a
Fixed type icon position and cleaned up functions
pkmnsnfrn Aug 4, 2024
c541b63
Updated illusions and Tera handling
pkmnsnfrn Aug 4, 2024
791a892
Added BATTLE_TYPE_IS_SINGLE and DOUBLE
pkmnsnfrn Aug 5, 2024
4be0e35
Removed IS_BATTLE_TYPE_SINGLE
pkmnsnfrn Aug 5, 2024
5cde58d
Implemented BATTLE_TYPE_IS_DOUBLE across repo
pkmnsnfrn Aug 5, 2024
85f1cd5
Removed SIDE macro
pkmnsnfrn Aug 5, 2024
0c08beb
Updated config
pkmnsnfrn Aug 5, 2024
003efcb
Deprecated battler alive macro
pkmnsnfrn Aug 5, 2024
f96af60
Reindented file
pkmnsnfrn Aug 5, 2024
a72d78f
Added exceptions for 2v1
pkmnsnfrn Aug 5, 2024
97f3210
Replaced Fainted check with Null check
pkmnsnfrn Aug 5, 2024
96c5bfc
Added functionality for only types of caught mons
pkmnsnfrn Aug 5, 2024
7ce9366
UseDoubleBattleCoords updated
pkmnsnfrn Aug 5, 2024
ce3c2f6
Added ShouldFlipTypeIcon
pkmnsnfrn Aug 5, 2024
47a5a6b
Renamed TryLoadTypeIcon
pkmnsnfrn Aug 7, 2024
deb14d5
Refactored functions
pkmnsnfrn Aug 7, 2024
0eb4730
Refactored functions
pkmnsnfrn Aug 7, 2024
1376173
Refactored functions
pkmnsnfrn Aug 7, 2024
66e9fcb
Refactored functions
pkmnsnfrn Aug 8, 2024
449de40
Renamed SEEN to CAUGHT
pkmnsnfrn Aug 8, 2024
a18609f
Reset config
pkmnsnfrn Aug 8, 2024
d50431c
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
pkmnsnfrn Aug 8, 2024
a03271b
Added useSecondPalette and isOrdinary to gTypesInfo
fdeblasio Aug 9, 2024
4c8fa97
Further simplified secondPalette and isOrdinary
fdeblasio Aug 9, 2024
f30e759
Merge pull request #3 from fdeblasio/psfTypeIcons
pkmnsnfrn Aug 9, 2024
fcfe5e5
Changed isordinary to isSpecialCase
pkmnsnfrn Aug 9, 2024
c4caf09
Renamed to useSecondTypeIconPalette
pkmnsnfrn Aug 9, 2024
e4f613a
Fixed Stellar type interactions
pkmnsnfrn Aug 10, 2024
d13fdeb
fixed spacing
pkmnsnfrn Aug 10, 2024
fef817a
fixed include/config/battle.h
pkmnsnfrn Aug 10, 2024
ac34f8a
fixed
pkmnsnfrn Aug 10, 2024
3f65d19
fixed include/config/general.h
pkmnsnfrn Aug 10, 2024
95f9d42
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
pkmnsnfrn Aug 10, 2024
85d8b02
changed type1 and type2
pkmnsnfrn Aug 10, 2024
b1947b8
Moved IsDoubleBattle to include.battle.h
pkmnsnfrn Aug 10, 2024
f1b37aa
Changed IsBattlerFainted to IsBattlerAlive
pkmnsnfrn Aug 10, 2024
2fb9358
Removed IsBattlerNull
pkmnsnfrn Aug 10, 2024
997fa9e
Moved GetBattlerData to be inline
pkmnsnfrn Aug 10, 2024
7ba627e
Renamed GetMonDefensiveTeraType
pkmnsnfrn Aug 10, 2024
747fc32
Removed IsIllusionActive
pkmnsnfrn Aug 10, 2024
e901e2d
Fixed identation
pkmnsnfrn Aug 10, 2024
3c2543b
found one last isDoubleBattle hold out
pkmnsnfrn Aug 10, 2024
b40ee8f
fixed redundant brackets
pkmnsnfrn Aug 10, 2024
1a77ad7
Fixed spacing for B_SHOW_TYPES
pkmnsnfrn Aug 10, 2024
3c92e6c
Update src/battle_script_commands.c
pkmnsnfrn Aug 10, 2024
25a25c3
Fixed padding
pkmnsnfrn Aug 10, 2024
654844b
Reindent file and refactored GetTypeIconHideMovement
pkmnsnfrn Aug 10, 2024
5cb7c52
Update include/data.h
pkmnsnfrn Aug 11, 2024
2bb7578
Merge branch 'upcoming' into typeIcons
pkmnsnfrn Aug 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions gflib/sprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ static void SortSprites(u32 *spritePriorities, s32 n);
static u32 CreateSpriteAt(u32 index, const struct SpriteTemplate *template, s16 x, s16 y, u32 subpriority);
static void ResetOamMatrices(void);
static void ResetSprite(struct Sprite *sprite);
static void RequestSpriteFrameImageCopy(u16 index, u16 tileNum, const struct SpriteFrameImage *images);
static void ResetAllSprites(void);
static void BeginAnim(struct Sprite *sprite);
static void ContinueAnim(struct Sprite *sprite);
Expand All @@ -75,7 +74,6 @@ static void AffineAnimCmd_end(u8 matrixNum, struct Sprite *sprite);
static void AffineAnimCmd_frame(u8 matrixNum, struct Sprite *sprite);
static void CopyOamMatrix(u8 destMatrixIndex, struct OamMatrix *srcMatrix);
static u8 GetSpriteMatrixNum(struct Sprite *sprite);
static void SetSpriteOamFlipBits(struct Sprite *sprite, u8 hFlip, u8 vFlip);
static void AffineAnimStateRestartAnim(u8 matrixNum);
static void AffineAnimStateStartAnim(u8 matrixNum, u8 animNum);
static void AffineAnimStateReset(u8 matrixNum);
Expand Down
2 changes: 2 additions & 0 deletions gflib/sprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,7 @@ u8 SpriteTileAllocBitmapOp(u16 bit, u8 op);
void ClearSpriteCopyRequests(void);
void ResetAffineAnimData(void);
u32 GetSpanPerImage(u32 shape, u32 size);
void RequestSpriteFrameImageCopy(u16 index, u16 tileNum, const struct SpriteFrameImage *images);
void SetSpriteOamFlipBits(struct Sprite *sprite, u8 hFlip, u8 vFlip);

#endif //GUARD_SPRITE_H
15 changes: 15 additions & 0 deletions graphics/types/battle_icons1.pal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
JASC-PAL
0100
12
120 152 128
49 49 49
255 255 255
164 82 57
172 189 32
184 160 90
213 180 90
98 98 180
180 90 164
172 164 148
172 172 197
152 172 246
Binary file added graphics/types/battle_icons1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions graphics/types/battle_icons2.pal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
JASC-PAL
0100
12
120 152 128
49 49 49
255 255 255
240 82 48
120 200 80
248 197 49
80 120 136
123 98 230
248 115 164
57 156 255
90 205 230
246 180 246
Binary file added graphics/types/battle_icons2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,13 @@ static inline u32 GetBattlerSide(u32 battler)
return GetBattlerPosition(battler) & BIT_SIDE;
}

static inline struct Pokemon* GetBattlerData(u32 battlerId)
{
u32 index = gBattlerPartyIndexes[battlerId];

return (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) ? &gEnemyParty[index] : &gPlayerParty[index];
}

static inline struct Pokemon *GetSideParty(u32 side)
{
return (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
Expand All @@ -1141,4 +1148,9 @@ static inline struct Pokemon *GetBattlerParty(u32 battler)
return GetSideParty(GetBattlerSide(battler));
}

static inline bool32 IsDoubleBattle(void)
{
return gBattleTypeFlags & BATTLE_TYPE_DOUBLE;
}

#endif // GUARD_BATTLE_H
1 change: 0 additions & 1 deletion include/battle_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId);
bool8 IsBattlerSpritePresent(u8 battlerId);
void ClearBattleAnimBg(u32 bgId);
u8 GetAnimBattlerSpriteId(u8 wantedBattler);
bool8 IsDoubleBattle(void);
u8 GetBattleBgPaletteNum(void);
u8 GetBattlerSpriteBGPriorityRank(u8 battlerId);
void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite *));
Expand Down
5 changes: 5 additions & 0 deletions include/battle_controllers.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ void ActionSelectionDestroyCursorAt(u8 cursorPos);
void InitMoveSelectionsVarsAndStrings(u32 battler);
void MoveSelectionCreateCursorAt(u8 cursorPos, u8 arg1);
void MoveSelectionDestroyCursorAt(u8 cursorPosition);
void PlayerHandleChooseMove(u32 battler);
void HandleInputChooseMove(u32 battler);
void HandleInputChooseTarget(u32 battler);
void HandleMoveSwitching(u32 battler);
void HandleChooseMoveAfterDma3(u32 battler);

// recorded player controller
void SetControllerToRecordedPlayer(u32 battler);
Expand Down
5 changes: 5 additions & 0 deletions include/config/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,9 @@
#define B_ENEMY_THROW_BALLS_SOUND GEN_LATEST // In GEN_5+, enemy Trainer's Poké Balls make a sound when thrown to send out a Pokémon. This can only be used when B_ENEMY_THROW_BALLS is set to GEN_6 or later.
#define B_PLAYER_THROW_BALLS_SOUND GEN_LATEST // In GEN_5+, the player's Poké Balls make a sound when thrown to send out a Pokémon.

#define SHOW_TYPES_NEVER 0
#define SHOW_TYPES_ALWAYS 1
#define SHOW_TYPES_CAUGHT 2
#define B_SHOW_TYPES SHOW_TYPES_NEVER // When defined as SHOW_TYPES_ALWAYS, after selecting "Fight" in battle, the types of all Pokemon are revealed. Whe defined as SHOW_TYPES_OWN, types are only revealed if the player owns the mon in question.

#endif // GUARD_CONFIG_BATTLE_H
1 change: 0 additions & 1 deletion include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
#define BATTLE_TWO_VS_ONE_OPPONENT ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gTrainerBattleOpponent_B == 0xFFFF))
#define BATTLE_TYPE_HAS_AI (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI | BATTLE_TYPE_ROAMER | BATTLE_TYPE_INGAME_PARTNER)


// Battle Outcome defines
#define B_OUTCOME_WON 1
#define B_OUTCOME_LOST 2
Expand Down
4 changes: 3 additions & 1 deletion include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ struct TypeInfo
u16 maxMove;
u16 teraTypeRGBValue; // Most values pulled from the Tera type icon palette.
u16 damageCategory:2; // Used for B_PHYSICAL_SPECIAL_SPLIT <= GEN_3
u16 padding:14;
u16 useSecondTypeIconPalette:1;
u16 isSpecialCaseType:1;
u16 padding:12;
const u32 *const paletteTMHM;
//u16 enhanceItem;
//u16 berry;
Expand Down
5 changes: 5 additions & 0 deletions include/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -3363,4 +3363,9 @@ extern const u8 gMailTilemap_Retro[];
extern const u8 gMonMarkingsMenu_Gfx[];
extern const u16 gMonMarkingsMenu_Pal[];

extern const u32 gBattleIcons_Gfx1[];
extern const u32 gBattleIcons_Gfx2[];
extern const u32 gBattleIcons_Pal1[];
extern const u32 gBattleIcons_Pal2[];

#endif //GUARD_GRAPHICS_H
18 changes: 18 additions & 0 deletions include/type_icons.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef GUARD_TYPE_ICONS_H
#define GUARD_TYPE_ICONS_H

void LoadTypeIcons(u32);

#define TYPE_ICON_TAG 0x2720
#define TYPE_ICON_TAG_2 0x2721
#define NUM_FRAMES_HIDE_TYPE_ICON 10

#define tMonPosition data[0]
#define tBattlerId data[1]
#define tHideIconTimer data[2]
#define tVerticalPosition data[3]

#define TYPE_ICON_1_FRAME(monType) ((monType - 1) * 2)
#define TYPE_ICON_2_FRAME(monType) ((monType - 11) * 2)

#endif // GUARD_TYPE_ICONS_H
10 changes: 5 additions & 5 deletions src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static u32 GetAiFlags(u16 trainerId)
flags = GetTrainerAIFlagsFromId(trainerId);
}

if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
{
flags |= AI_FLAG_DOUBLE_BATTLE;
}
Expand Down Expand Up @@ -224,7 +224,7 @@ void BattleAI_SetupFlags(void)
{
AI_THINKING_STRUCT->aiFlags[B_POSITION_PLAYER_RIGHT] = GetAiFlags(gPartnerTrainerId - TRAINER_PARTNER(PARTNER_NONE));
}
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsAiVsAiBattle())
else if (IsDoubleBattle() && IsAiVsAiBattle())
{
AI_THINKING_STRUCT->aiFlags[B_POSITION_PLAYER_RIGHT] = AI_THINKING_STRUCT->aiFlags[B_POSITION_PLAYER_LEFT];
}
Expand Down Expand Up @@ -275,7 +275,7 @@ u32 BattleAI_ChooseMoveOrAction(void)
{
u32 ret;

if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
if (!IsDoubleBattle())
ret = ChooseMoveOrAction_Singles(sBattler_AI);
else
ret = ChooseMoveOrAction_Doubles(sBattler_AI);
Expand Down Expand Up @@ -323,7 +323,7 @@ void Ai_InitPartyStruct(void)

// Save first 2 or 4(in doubles) mons
CopyBattlerDataToAIParty(B_POSITION_PLAYER_LEFT, B_SIDE_PLAYER);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
CopyBattlerDataToAIParty(B_POSITION_PLAYER_RIGHT, B_SIDE_PLAYER);

// If player's partner is AI, save opponent mons
Expand Down Expand Up @@ -2050,7 +2050,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
}

/*if (AI_THINKING_STRUCT->aiFlags[battlerAtk] == AI_SCRIPT_CHECK_BAD_MOVE //Only basic AI
&& IS_DOUBLE_BATTLE) //Make the regular AI know how to use Protect minimally in Doubles
&& IsDoubleBattle()) //Make the regular AI know how to use Protect minimally in Doubles
{
u8 shouldProtect = ShouldProtect(battlerAtk, battlerDef, move);
if (shouldProtect == USE_PROTECT || shouldProtect == PROTECT_FROM_FOES)
Expand Down
20 changes: 10 additions & 10 deletions src/battle_ai_switch_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static bool32 HasBadOdds(u32 battler, bool32 emitResult)
return FALSE;

// Double Battles aren't included in AI_FLAG_SMART_MON_CHOICE. Defaults to regular switch in logic
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
return FALSE;

opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(battler));
Expand Down Expand Up @@ -242,7 +242,7 @@ static bool32 ShouldSwitchIfWonderGuard(u32 battler, bool32 emitResult)
struct Pokemon *party = NULL;
u16 move;

if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
return FALSE;

opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(battler));
Expand Down Expand Up @@ -318,7 +318,7 @@ static bool32 FindMonThatAbsorbsOpponentsMove(u32 battler, bool32 emitResult)
if (IS_MOVE_STATUS(gLastLandedMoves[battler]))
return FALSE;

if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
{
battlerIn1 = battler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))])
Expand Down Expand Up @@ -707,7 +707,7 @@ static bool32 HasSuperEffectiveMoveAgainstOpponents(u32 battler, bool32 noRng)
}
}
}
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
if (!IsDoubleBattle())
return FALSE;

opposingBattler = GetBattlerAtPosition(BATTLE_PARTNER(opposingPosition));
Expand Down Expand Up @@ -765,7 +765,7 @@ static bool32 FindMonWithFlagsAndSuperEffective(u32 battler, u16 flags, u32 modu
if (IS_MOVE_STATUS(gLastLandedMoves[battler]))
return FALSE;

if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
{
battlerIn1 = battler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))])
Expand Down Expand Up @@ -846,7 +846,7 @@ static bool32 CanMonSurviveHazardSwitchin(u32 battler)
// Battler will faint to hazards, check to see if another mon can clear them
if (hazardDamage > battlerHp)
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
{
battlerIn1 = battler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))])
Expand Down Expand Up @@ -1023,7 +1023,7 @@ bool32 ShouldSwitch(u32 battler, bool32 emitResult)

availableToSwitch = 0;

if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
{
battlerIn1 = battler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))])
Expand Down Expand Up @@ -1140,7 +1140,7 @@ void AI_TrySwitchOrUseItem(u32 battler)
s32 monToSwitchId = AI_DATA->mostSuitableMonId[battler];
if (monToSwitchId == PARTY_SIZE)
{
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
if (!IsDoubleBattle())
{
battlerIn1 = GetBattlerAtPosition(battlerPosition);
battlerIn2 = battlerIn1;
Expand Down Expand Up @@ -2040,7 +2040,7 @@ u32 GetMostSuitableMonToSwitchInto(u32 battler, bool32 switchAfterMonKOd)
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
return gBattlerPartyIndexes[battler] + 1;

if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
{
battlerIn1 = battler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))])
Expand Down Expand Up @@ -2074,7 +2074,7 @@ u32 GetMostSuitableMonToSwitchInto(u32 battler, bool32 switchAfterMonKOd)

// Split ideal mon decision between after previous mon KO'd (prioritize offensive options) and after switching active mon out (prioritize defensive options), and expand the scope of both.
// Only use better mon selection if AI_FLAG_SMART_MON_CHOICES is set for the trainer.
if (AI_THINKING_STRUCT->aiFlags[battler] & AI_FLAG_SMART_MON_CHOICES && !(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) // Double Battles aren't included in AI_FLAG_SMART_MON_CHOICE. Defaults to regular switch in logic
if (AI_THINKING_STRUCT->aiFlags[battler] & AI_FLAG_SMART_MON_CHOICES && !IsDoubleBattle()) // Double Battles aren't included in AI_FLAG_SMART_MON_CHOICE. Defaults to regular switch in logic
{
bestMonId = GetBestMonIntegrated(party, firstId, lastId, battler, opposingBattler, battlerIn1, battlerIn2, switchAfterMonKOd);
return bestMonId;
Expand Down
6 changes: 3 additions & 3 deletions src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,7 @@ bool32 AnyPartyMemberStatused(u32 battlerId, bool32 checkSoundproof)
else
party = gEnemyParty;

if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
{
battlerOnField1 = gBattlerPartyIndexes[battlerId];
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battlerId)))];
Expand Down Expand Up @@ -3417,7 +3417,7 @@ s32 CountUsablePartyMons(u32 battlerId)
else
party = gEnemyParty;

if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle())
{
battlerOnField1 = gBattlerPartyIndexes[battlerId];
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battlerId)))];
Expand Down Expand Up @@ -3828,7 +3828,7 @@ bool32 AI_MoveMakesContact(u32 ability, u32 holdEffect, u32 move)
bool32 ShouldUseZMove(u32 battlerAtk, u32 battlerDef, u32 chosenMove)
{
// simple logic. just upgrades chosen move to z move if possible, unless regular move would kill opponent
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && battlerDef == BATTLE_PARTNER(battlerAtk))
if ((IsDoubleBattle()) && battlerDef == BATTLE_PARTNER(battlerAtk))
return FALSE; // don't use z move on partner
if (HasTrainerUsedGimmick(battlerAtk, GIMMICK_Z_MOVE))
return FALSE; // can't use z move twice
Expand Down
8 changes: 4 additions & 4 deletions src/battle_anim_effects_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -3317,7 +3317,7 @@ static void AnimSolarBeamSmallOrb(struct Sprite *sprite)
{
InitSpritePosToAnimAttacker(sprite, TRUE);

if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gAnimMoveIndex == MOVE_CORE_ENFORCER)
if (IsDoubleBattle() && gAnimMoveIndex == MOVE_CORE_ENFORCER)
{
CoreEnforcerLoadBeamTarget(sprite);
}
Expand Down Expand Up @@ -6567,11 +6567,11 @@ void PrepareDoubleTeamAnim(u32 taskId, u32 animBattler, bool32 forAllySwitch)
gSprites[spriteId].sBattlerFlank = (animBattler != ANIM_ATTACKER);
else
gSprites[spriteId].sBattlerFlank = (animBattler == ANIM_ATTACKER);

// correct direction on opponent side
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
gSprites[spriteId].sBattlerFlank ^= 1;

gSprites[spriteId].callback = AnimDoubleTeam;
task->tBlendSpritesCount++;
}
Expand Down Expand Up @@ -6603,7 +6603,7 @@ static void ReloadBattlerSprites(u32 battler, struct Pokemon *party)
UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], mon, HEALTHBOX_ALL);
// If battler has an indicator for a gimmick, hide the sprite until the move animation finishes.
UpdateIndicatorVisibilityAndType(gHealthboxSpriteIds[battler], TRUE);

// Try to recreate shadow sprite
if (gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteId < MAX_SPRITES)
{
Expand Down
4 changes: 2 additions & 2 deletions src/battle_anim_effects_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ void AnimTask_AirCutterProjectile(u8 taskId)

attackerX = gTasks[taskId].data[9] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
attackerY = gTasks[taskId].data[10] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y);
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (IsDoubleBattle()
&& IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)))
{
SetAverageBattlerPositions(gBattleAnimTarget, FALSE, &targetX, &targetY);
Expand Down Expand Up @@ -3854,7 +3854,7 @@ static void AnimPerishSongMusicNote_Step2(struct Sprite *sprite)

static void AnimGuardRing(struct Sprite *sprite)
{
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
if (IsDoubleBattle() && IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
{
SetAverageBattlerPositions(gBattleAnimAttacker, FALSE, &sprite->x, &sprite->y);
sprite->y += 40;
Expand Down
7 changes: 0 additions & 7 deletions src/battle_anim_mons.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "util.h"
#include "constants/battle_anim.h"

#define IS_DOUBLE_BATTLE() ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE))

extern const struct OamData gOamData_AffineNormal_ObjNormal_64x64;

static void AnimTranslateLinear_WithFollowup_SetCornerVecX(struct Sprite *sprite);
Expand Down Expand Up @@ -868,11 +866,6 @@ bool8 IsBattlerSpritePresent(u8 battlerId)
}
}

bool8 IsDoubleBattle(void)
{
return IS_DOUBLE_BATTLE();
}

#define BG_ANIM_PAL_1 8
#define BG_ANIM_PAL_2 9
#define BG_ANIM_PAL_CONTEST 14
Expand Down
Loading
Loading