Merge pull request #1764 from AsparagusEduardo/pret/battlerMacros
Further uses of GET_BATTLER_SIDE macros'
This commit is contained in:
+1
-2
@@ -13,9 +13,8 @@
|
|||||||
#include "battle_bg.h"
|
#include "battle_bg.h"
|
||||||
#include "pokeball.h"
|
#include "pokeball.h"
|
||||||
|
|
||||||
#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler])
|
|
||||||
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
|
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
|
||||||
#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE)
|
#define GET_BATTLER_SIDE2(battler) (gBattlerPositions[battler] & BIT_SIDE)
|
||||||
|
|
||||||
// Used to exclude moves learned temporarily by Transform or Mimic
|
// Used to exclude moves learned temporarily by Transform or Mimic
|
||||||
#define MOVE_IS_PERMANENT(battler, moveSlot) \
|
#define MOVE_IS_PERMANENT(battler, moveSlot) \
|
||||||
|
|||||||
@@ -1667,7 +1667,7 @@ void AnimTask_AirCutterProjectile(u8 taskId)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER)
|
if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
gTasks[taskId].data[4] = 1;
|
gTasks[taskId].data[4] = 1;
|
||||||
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
|
|||||||
if (Random2() & 1)
|
if (Random2() & 1)
|
||||||
y *= -1;
|
y *= -1;
|
||||||
|
|
||||||
if ((gBattlerPositions[battler] & BIT_SIDE) == B_SIDE_PLAYER)
|
if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER)
|
||||||
y += 0xFFF0;
|
y += 0xFFF0;
|
||||||
|
|
||||||
sprite->x += x;
|
sprite->x += x;
|
||||||
|
|||||||
@@ -1193,12 +1193,12 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite)
|
|||||||
if (GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2))
|
if (GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2))
|
||||||
sprite->data[7] = 0x8000;
|
sprite->data[7] = 0x8000;
|
||||||
|
|
||||||
if ((gBattlerPositions[gBattleAnimTarget] & BIT_SIDE) == B_SIDE_PLAYER)
|
if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
||||||
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
|
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
|
||||||
|
|
||||||
if ((sprite->data[7] & 0x8000) && (gBattlerPositions[gBattleAnimAttacker] & BIT_SIDE) == B_SIDE_PLAYER)
|
if ((sprite->data[7] & 0x8000) && GET_BATTLER_SIDE2(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
||||||
sprite->subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
|
sprite->subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
|
||||||
|
|
||||||
sprite->data[6] = 1;
|
sprite->data[6] = 1;
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ u8 GetBattlerSide(u8 battlerId)
|
|||||||
|
|
||||||
u8 GetBattlerPosition(u8 battlerId)
|
u8 GetBattlerPosition(u8 battlerId)
|
||||||
{
|
{
|
||||||
return GET_BATTLER_POSITION(battlerId);
|
return gBattlerPositions[battlerId];
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetBattlerAtPosition(u8 position)
|
u8 GetBattlerAtPosition(u8 position)
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ static void HandleInputChooseMove(void)
|
|||||||
if (moveTarget & MOVE_TARGET_USER)
|
if (moveTarget & MOVE_TARGET_USER)
|
||||||
gMultiUsePlayerCursor = gActiveBattler;
|
gMultiUsePlayerCursor = gActiveBattler;
|
||||||
else
|
else
|
||||||
gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler) & BIT_SIDE));
|
gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler)));
|
||||||
|
|
||||||
if (!gBattleBufferA[gActiveBattler][1]) // not a double battle
|
if (!gBattleBufferA[gActiveBattler][1]) // not a double battle
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
|
|||||||
else if (moveTarget == MOVE_TARGET_SELECTED)
|
else if (moveTarget == MOVE_TARGET_SELECTED)
|
||||||
chosenMoveId |= GetBattlePalaceTarget();
|
chosenMoveId |= GetBattlePalaceTarget();
|
||||||
else
|
else
|
||||||
chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler) & BIT_SIDE)) << 8);
|
chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler))) << 8);
|
||||||
|
|
||||||
return chosenMoveId;
|
return chosenMoveId;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -3844,7 +3844,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
|
|||||||
case MOVE_TARGET_BOTH:
|
case MOVE_TARGET_BOTH:
|
||||||
case MOVE_TARGET_FOES_AND_ALLY:
|
case MOVE_TARGET_FOES_AND_ALLY:
|
||||||
case MOVE_TARGET_OPPONENTS_FIELD:
|
case MOVE_TARGET_OPPONENTS_FIELD:
|
||||||
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker) & BIT_SIDE));
|
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker)));
|
||||||
if (gAbsentBattlerFlags & gBitTable[targetBattler])
|
if (gAbsentBattlerFlags & gBitTable[targetBattler])
|
||||||
targetBattler ^= BIT_FLANK;
|
targetBattler ^= BIT_FLANK;
|
||||||
break;
|
break;
|
||||||
@@ -3872,7 +3872,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
|
|||||||
targetBattler ^= BIT_FLANK;
|
targetBattler ^= BIT_FLANK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gBattlerAttacker) & BIT_SIDE));
|
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker)));
|
||||||
break;
|
break;
|
||||||
case MOVE_TARGET_USER_OR_SELECTED:
|
case MOVE_TARGET_USER_OR_SELECTED:
|
||||||
case MOVE_TARGET_USER:
|
case MOVE_TARGET_USER:
|
||||||
|
|||||||
+1
-1
@@ -3405,7 +3405,7 @@ static bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
|
|||||||
|
|
||||||
u8 GetDefaultMoveTarget(u8 battlerId)
|
u8 GetDefaultMoveTarget(u8 battlerId)
|
||||||
{
|
{
|
||||||
u8 opposing = BATTLE_OPPOSITE(GetBattlerPosition(battlerId) & BIT_SIDE);
|
u8 opposing = BATTLE_OPPOSITE(GET_BATTLER_SIDE(battlerId));
|
||||||
|
|
||||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
||||||
return GetBattlerAtPosition(opposing);
|
return GetBattlerAtPosition(opposing);
|
||||||
|
|||||||
Reference in New Issue
Block a user