Introduce NUM_BATTLE_SIDES

This commit is contained in:
Eduardo Quezada D'Ottone 2022-10-20 08:41:18 -03:00
parent 0d0a9bd31d
commit 18e7fc5efc
4 changed files with 15 additions and 14 deletions

View file

@ -164,7 +164,7 @@ struct WishFutureKnock
u8 wishCounter[MAX_BATTLERS_COUNT]; u8 wishCounter[MAX_BATTLERS_COUNT];
u8 wishMonId[MAX_BATTLERS_COUNT]; u8 wishMonId[MAX_BATTLERS_COUNT];
u8 weatherDuration; u8 weatherDuration;
u8 knockedOffMons[2]; // Each battler is represented by a bit. The array entry is dependent on the battler's side. u8 knockedOffMons[NUM_BATTLE_SIDES]; // Each battler is represented by a bit.
}; };
struct AI_ThinkingStruct struct AI_ThinkingStruct
@ -326,9 +326,9 @@ struct BattleTv_Mon
struct BattleTv struct BattleTv
{ {
struct BattleTv_Mon mon[2][PARTY_SIZE]; // [side][partyId] struct BattleTv_Mon mon[NUM_BATTLE_SIDES][PARTY_SIZE];
struct BattleTv_Position pos[2][2]; // [side][flank] struct BattleTv_Position pos[NUM_BATTLE_SIDES][2]; // [side][flank]
struct BattleTv_Side side[2]; // [side] struct BattleTv_Side side[NUM_BATTLE_SIDES];
}; };
struct BattleTvMovePoints struct BattleTvMovePoints
@ -399,7 +399,7 @@ struct BattleStruct
u8 wallyWaitFrames; u8 wallyWaitFrames;
u8 wallyMoveFrames; u8 wallyMoveFrames;
u8 lastTakenMove[MAX_BATTLERS_COUNT * 2 * 2]; // Last move that a battler was hit with. This field seems to erroneously take 16 bytes instead of 8. u8 lastTakenMove[MAX_BATTLERS_COUNT * 2 * 2]; // Last move that a battler was hit with. This field seems to erroneously take 16 bytes instead of 8.
u16 hpOnSwitchout[2]; u16 hpOnSwitchout[NUM_BATTLE_SIDES];
u32 savedBattleTypeFlags; u32 savedBattleTypeFlags;
u8 abilityPreventingSwitchout; u8 abilityPreventingSwitchout;
u8 hpScale; u8 hpScale;
@ -670,8 +670,8 @@ extern u8 gMoveResultFlags;
extern u32 gHitMarker; extern u32 gHitMarker;
extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT]; extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT];
extern u8 gUnusedFirstBattleVar2; extern u8 gUnusedFirstBattleVar2;
extern u16 gSideStatuses[2]; extern u16 gSideStatuses[NUM_BATTLE_SIDES];
extern struct SideTimer gSideTimers[2]; extern struct SideTimer gSideTimers[NUM_BATTLE_SIDES];
extern u32 gStatuses3[MAX_BATTLERS_COUNT]; extern u32 gStatuses3[MAX_BATTLERS_COUNT];
extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT]; extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT];
extern u16 gPauseCounterBattle; extern u16 gPauseCounterBattle;

View file

@ -36,6 +36,7 @@
#define B_SIDE_PLAYER 0 #define B_SIDE_PLAYER 0
#define B_SIDE_OPPONENT 1 #define B_SIDE_OPPONENT 1
#define NUM_BATTLE_SIDES 2
#define B_FLANK_LEFT 0 #define B_FLANK_LEFT 0
#define B_FLANK_RIGHT 1 #define B_FLANK_RIGHT 1

View file

@ -4561,11 +4561,11 @@ static void AnimTipMon_Step(struct Sprite *sprite)
void AnimTask_SkullBashPosition(u8 taskId) void AnimTask_SkullBashPosition(u8 taskId)
{ {
u8 a; u8 side;
gTasks[taskId].data[0] = gBattlerSpriteIds[gBattleAnimAttacker]; gTasks[taskId].data[0] = gBattlerSpriteIds[gBattleAnimAttacker];
a = GetBattlerSide(gBattleAnimAttacker); side = GetBattlerSide(gBattleAnimAttacker);
gTasks[taskId].data[1] = a; gTasks[taskId].data[1] = side;
gTasks[taskId].data[2] = 0; gTasks[taskId].data[2] = 0;
switch (gBattleAnimArgs[0]) switch (gBattleAnimArgs[0])
{ {
@ -4577,7 +4577,7 @@ void AnimTask_SkullBashPosition(u8 taskId)
gTasks[taskId].data[3] = 8; gTasks[taskId].data[3] = 8;
gTasks[taskId].data[4] = 0; gTasks[taskId].data[4] = 0;
gTasks[taskId].data[5] = 3; gTasks[taskId].data[5] = 3;
if (a == 0) if (side == B_SIDE_PLAYER)
gTasks[taskId].data[5] *= -1; gTasks[taskId].data[5] *= -1;
gTasks[taskId].func = AnimTask_SkullBashPositionSet; gTasks[taskId].func = AnimTask_SkullBashPositionSet;
@ -4586,7 +4586,7 @@ void AnimTask_SkullBashPosition(u8 taskId)
gTasks[taskId].data[3] = 8; gTasks[taskId].data[3] = 8;
gTasks[taskId].data[4] = 0x600; gTasks[taskId].data[4] = 0x600;
gTasks[taskId].data[5] = 0xC0; gTasks[taskId].data[5] = 0xC0;
if (a == 0) if (side == B_SIDE_PLAYER)
{ {
gTasks[taskId].data[4] = -gTasks[taskId].data[4]; gTasks[taskId].data[4] = -gTasks[taskId].data[4];
gTasks[taskId].data[5] = -gTasks[taskId].data[5]; gTasks[taskId].data[5] = -gTasks[taskId].data[5];

View file

@ -199,8 +199,8 @@ EWRAM_DATA u32 gHitMarker = 0;
EWRAM_DATA static u8 sUnusedBattlersArray[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA static u8 sUnusedBattlersArray[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read
EWRAM_DATA u16 gSideStatuses[2] = {0}; EWRAM_DATA u16 gSideStatuses[NUM_BATTLE_SIDES] = {0};
EWRAM_DATA struct SideTimer gSideTimers[2] = {0}; EWRAM_DATA struct SideTimer gSideTimers[NUM_BATTLE_SIDES] = {0};
EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u16 gPauseCounterBattle = 0; EWRAM_DATA u16 gPauseCounterBattle = 0;