mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
more battle files cleaning
This commit is contained in:
parent
a28dfd6da4
commit
b846015343
@ -478,6 +478,15 @@ struct BattleStruct
|
|||||||
#define IS_MOVE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
|
#define IS_MOVE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
|
||||||
#define IS_MOVE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
|
#define IS_MOVE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
|
||||||
|
|
||||||
|
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0))
|
||||||
|
|
||||||
|
#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type))
|
||||||
|
#define SET_BATTLER_TYPE(battlerId, type) \
|
||||||
|
{ \
|
||||||
|
gBattleMons[battlerId].type1 = type; \
|
||||||
|
gBattleMons[battlerId].type2 = type; \
|
||||||
|
}
|
||||||
|
|
||||||
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
|
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
|
||||||
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
|
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
|
||||||
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
|
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
|
||||||
|
@ -49,36 +49,36 @@ void PressurePPLose(u8 bankDef, u8 bankAtk, u16 move);
|
|||||||
void PressurePPLoseOnUsingPerishSong(u8 bankAtk);
|
void PressurePPLoseOnUsingPerishSong(u8 bankAtk);
|
||||||
void PressurePPLoseOnUsingImprision(u8 bankAtk);
|
void PressurePPLoseOnUsingImprision(u8 bankAtk);
|
||||||
void MarkAllBattlersForControllerExec(void); // unused
|
void MarkAllBattlersForControllerExec(void); // unused
|
||||||
void MarkBattlerForControllerExec(u8 bank);
|
void MarkBattlerForControllerExec(u8 battlerId);
|
||||||
void sub_803F850(u8 arg0);
|
void sub_803F850(u8 arg0);
|
||||||
void CancelMultiTurnMoves(u8 bank);
|
void CancelMultiTurnMoves(u8 battlerId);
|
||||||
bool8 WasUnableToUseMove(u8 bank);
|
bool8 WasUnableToUseMove(u8 battlerId);
|
||||||
void PrepareStringBattle(u16 stringId, u8 bank);
|
void PrepareStringBattle(u16 stringId, u8 battlerId);
|
||||||
void ResetSentPokesToOpponentValue(void);
|
void ResetSentPokesToOpponentValue(void);
|
||||||
void sub_803F9EC(u8 bank);
|
void sub_803F9EC(u8 battlerId);
|
||||||
void sub_803FA70(u8 bank);
|
void sub_803FA70(u8 battlerId);
|
||||||
void BattleScriptPush(const u8* bsPtr);
|
void BattleScriptPush(const u8* bsPtr);
|
||||||
void BattleScriptPushCursor(void);
|
void BattleScriptPushCursor(void);
|
||||||
void BattleScriptPop(void);
|
void BattleScriptPop(void);
|
||||||
u8 TrySetCantSelectMoveBattleScript(void);
|
u8 TrySetCantSelectMoveBattleScript(void);
|
||||||
u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check);
|
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check);
|
||||||
bool8 AreAllMovesUnusable(void);
|
bool8 AreAllMovesUnusable(void);
|
||||||
u8 GetImprisonedMovesCount(u8 bank, u16 move);
|
u8 GetImprisonedMovesCount(u8 battlerId, u16 move);
|
||||||
u8 UpdateTurnCounters(void);
|
u8 UpdateTurnCounters(void);
|
||||||
u8 TurnBasedEffects(void);
|
u8 TurnBasedEffects(void);
|
||||||
bool8 HandleWishPerishSongOnTurnEnd(void);
|
bool8 HandleWishPerishSongOnTurnEnd(void);
|
||||||
bool8 HandleFaintedMonActions(void);
|
bool8 HandleFaintedMonActions(void);
|
||||||
void TryClearRageStatuses(void);
|
void TryClearRageStatuses(void);
|
||||||
u8 AtkCanceller_UnableToUseMove(void);
|
u8 AtkCanceller_UnableToUseMove(void);
|
||||||
bool8 sub_80423F4(u8 bank, u8 r1, u8 r2);
|
bool8 sub_80423F4(u8 battlerId, u8 r1, u8 r2);
|
||||||
u8 CastformDataTypeChange(u8 bank);
|
u8 CastformDataTypeChange(u8 battlerId);
|
||||||
u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg);
|
u8 AbilityBattleEffects(u8 caseID, u8 battlerId, u8 ability, u8 special, u16 moveArg);
|
||||||
void BattleScriptExecute(const u8* BS_ptr);
|
void BattleScriptExecute(const u8* BS_ptr);
|
||||||
void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
|
void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
|
||||||
u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn);
|
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn);
|
||||||
void ClearFuryCutterDestinyBondGrudge(u8 bank);
|
void ClearFuryCutterDestinyBondGrudge(u8 battlerId);
|
||||||
void HandleAction_RunBattleScript(void);
|
void HandleAction_RunBattleScript(void);
|
||||||
u8 GetMoveTarget(u16 move, u8 useMoveTarget);
|
u8 GetMoveTarget(u16 move, u8 setTarget);
|
||||||
u8 IsMonDisobedient(void);
|
u8 IsMonDisobedient(void);
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_UTIL_H
|
#endif // GUARD_BATTLE_UTIL_H
|
||||||
|
@ -12,10 +12,6 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "constants/battle_ai.h"
|
#include "constants/battle_ai.h"
|
||||||
|
|
||||||
#define AIScriptRead32(ptr) ((ptr)[0] | (ptr)[1] << 8 | (ptr)[2] << 16 | (ptr)[3] << 24)
|
|
||||||
#define AIScriptRead16(ptr) ((ptr)[0] | (ptr)[1] << 8)
|
|
||||||
#define AIScriptReadPtr(ptr) (const u8*) AIScriptRead32(ptr)
|
|
||||||
|
|
||||||
#define AI_ACTION_DONE 0x0001
|
#define AI_ACTION_DONE 0x0001
|
||||||
#define AI_ACTION_FLEE 0x0002
|
#define AI_ACTION_FLEE 0x0002
|
||||||
#define AI_ACTION_WATCH 0x0004
|
#define AI_ACTION_WATCH 0x0004
|
||||||
@ -652,7 +648,7 @@ static void BattleAICmd_if_random_less_than(void)
|
|||||||
u16 random = Random();
|
u16 random = Random();
|
||||||
|
|
||||||
if (random % 256 < gAIScriptPtr[1])
|
if (random % 256 < gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -662,7 +658,7 @@ static void BattleAICmd_if_random_greater_than(void)
|
|||||||
u16 random = Random();
|
u16 random = Random();
|
||||||
|
|
||||||
if (random % 256 > gAIScriptPtr[1])
|
if (random % 256 > gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -672,7 +668,7 @@ static void BattleAICmd_if_random_equal(void)
|
|||||||
u16 random = Random();
|
u16 random = Random();
|
||||||
|
|
||||||
if (random % 256 == gAIScriptPtr[1])
|
if (random % 256 == gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -682,7 +678,7 @@ static void BattleAICmd_if_random_not_equal(void)
|
|||||||
u16 random = Random();
|
u16 random = Random();
|
||||||
|
|
||||||
if (random % 256 != gAIScriptPtr[1])
|
if (random % 256 != gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -707,7 +703,7 @@ static void BattleAICmd_if_hp_less_than(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) < gAIScriptPtr[2])
|
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) < gAIScriptPtr[2])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
}
|
}
|
||||||
@ -722,7 +718,7 @@ static void BattleAICmd_if_hp_more_than(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) > gAIScriptPtr[2])
|
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) > gAIScriptPtr[2])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
}
|
}
|
||||||
@ -737,7 +733,7 @@ static void BattleAICmd_if_hp_equal(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) == gAIScriptPtr[2])
|
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) == gAIScriptPtr[2])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
}
|
}
|
||||||
@ -752,7 +748,7 @@ static void BattleAICmd_if_hp_not_equal(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) != gAIScriptPtr[2])
|
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) != gAIScriptPtr[2])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
}
|
}
|
||||||
@ -767,10 +763,10 @@ static void BattleAICmd_if_status(void)
|
|||||||
else
|
else
|
||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
status = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
if ((gBattleMons[battlerId].status1 & status) != 0)
|
if ((gBattleMons[battlerId].status1 & status) != 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 10;
|
gAIScriptPtr += 10;
|
||||||
}
|
}
|
||||||
@ -785,10 +781,10 @@ static void BattleAICmd_if_not_status(void)
|
|||||||
else
|
else
|
||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
status = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
if ((gBattleMons[battlerId].status1 & status) == 0)
|
if ((gBattleMons[battlerId].status1 & status) == 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 10;
|
gAIScriptPtr += 10;
|
||||||
}
|
}
|
||||||
@ -803,10 +799,10 @@ static void BattleAICmd_if_status2(void)
|
|||||||
else
|
else
|
||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
status = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
if ((gBattleMons[battlerId].status2 & status) != 0)
|
if ((gBattleMons[battlerId].status2 & status) != 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 10;
|
gAIScriptPtr += 10;
|
||||||
}
|
}
|
||||||
@ -821,10 +817,10 @@ static void BattleAICmd_if_not_status2(void)
|
|||||||
else
|
else
|
||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
status = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
if ((gBattleMons[battlerId].status2 & status) == 0)
|
if ((gBattleMons[battlerId].status2 & status) == 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 10;
|
gAIScriptPtr += 10;
|
||||||
}
|
}
|
||||||
@ -839,10 +835,10 @@ static void BattleAICmd_if_status3(void)
|
|||||||
else
|
else
|
||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
status = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
if ((gStatuses3[battlerId] & status) != 0)
|
if ((gStatuses3[battlerId] & status) != 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 10;
|
gAIScriptPtr += 10;
|
||||||
}
|
}
|
||||||
@ -857,10 +853,10 @@ static void BattleAICmd_if_not_status3(void)
|
|||||||
else
|
else
|
||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
status = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
if ((gStatuses3[battlerId] & status) == 0)
|
if ((gStatuses3[battlerId] & status) == 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 10;
|
gAIScriptPtr += 10;
|
||||||
}
|
}
|
||||||
@ -876,10 +872,10 @@ static void BattleAICmd_if_side_affecting(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
side = GET_BATTLER_SIDE(battlerId);
|
side = GET_BATTLER_SIDE(battlerId);
|
||||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
status = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
if ((gSideStatuses[side] & status) != 0)
|
if ((gSideStatuses[side] & status) != 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 10;
|
gAIScriptPtr += 10;
|
||||||
}
|
}
|
||||||
@ -895,10 +891,10 @@ static void BattleAICmd_if_not_side_affecting(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
side = GET_BATTLER_SIDE(battlerId);
|
side = GET_BATTLER_SIDE(battlerId);
|
||||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
status = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
if ((gSideStatuses[side] & status) == 0)
|
if ((gSideStatuses[side] & status) == 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 10;
|
gAIScriptPtr += 10;
|
||||||
}
|
}
|
||||||
@ -906,7 +902,7 @@ static void BattleAICmd_if_not_side_affecting(void)
|
|||||||
static void BattleAICmd_if_less_than(void)
|
static void BattleAICmd_if_less_than(void)
|
||||||
{
|
{
|
||||||
if (AI_THINKING_STRUCT->funcResult < gAIScriptPtr[1])
|
if (AI_THINKING_STRUCT->funcResult < gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -914,7 +910,7 @@ static void BattleAICmd_if_less_than(void)
|
|||||||
static void BattleAICmd_if_more_than(void)
|
static void BattleAICmd_if_more_than(void)
|
||||||
{
|
{
|
||||||
if (AI_THINKING_STRUCT->funcResult > gAIScriptPtr[1])
|
if (AI_THINKING_STRUCT->funcResult > gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -922,7 +918,7 @@ static void BattleAICmd_if_more_than(void)
|
|||||||
static void BattleAICmd_if_equal(void)
|
static void BattleAICmd_if_equal(void)
|
||||||
{
|
{
|
||||||
if (AI_THINKING_STRUCT->funcResult == gAIScriptPtr[1])
|
if (AI_THINKING_STRUCT->funcResult == gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -930,80 +926,80 @@ static void BattleAICmd_if_equal(void)
|
|||||||
static void BattleAICmd_if_not_equal(void)
|
static void BattleAICmd_if_not_equal(void)
|
||||||
{
|
{
|
||||||
if (AI_THINKING_STRUCT->funcResult != gAIScriptPtr[1])
|
if (AI_THINKING_STRUCT->funcResult != gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_less_than_ptr(void)
|
static void BattleAICmd_if_less_than_ptr(void)
|
||||||
{
|
{
|
||||||
const u8 *value = AIScriptReadPtr(gAIScriptPtr + 1);
|
const u8 *value = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
|
|
||||||
if (AI_THINKING_STRUCT->funcResult < *value)
|
if (AI_THINKING_STRUCT->funcResult < *value)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 5);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 9;
|
gAIScriptPtr += 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_more_than_ptr(void)
|
static void BattleAICmd_if_more_than_ptr(void)
|
||||||
{
|
{
|
||||||
const u8 *value = AIScriptReadPtr(gAIScriptPtr + 1);
|
const u8 *value = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
|
|
||||||
if (AI_THINKING_STRUCT->funcResult > *value)
|
if (AI_THINKING_STRUCT->funcResult > *value)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 5);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 9;
|
gAIScriptPtr += 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_equal_ptr(void)
|
static void BattleAICmd_if_equal_ptr(void)
|
||||||
{
|
{
|
||||||
const u8 *value = AIScriptReadPtr(gAIScriptPtr + 1);
|
const u8 *value = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
|
|
||||||
if (AI_THINKING_STRUCT->funcResult == *value)
|
if (AI_THINKING_STRUCT->funcResult == *value)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 5);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 9;
|
gAIScriptPtr += 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_not_equal_ptr(void)
|
static void BattleAICmd_if_not_equal_ptr(void)
|
||||||
{
|
{
|
||||||
const u8 *value = AIScriptReadPtr(gAIScriptPtr + 1);
|
const u8 *value = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
|
|
||||||
if (AI_THINKING_STRUCT->funcResult != *value)
|
if (AI_THINKING_STRUCT->funcResult != *value)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 5);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 9;
|
gAIScriptPtr += 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_move(void)
|
static void BattleAICmd_if_move(void)
|
||||||
{
|
{
|
||||||
u16 move = AIScriptRead16(gAIScriptPtr + 1);
|
u16 move = T1_READ_16(gAIScriptPtr + 1);
|
||||||
|
|
||||||
if (AI_THINKING_STRUCT->moveConsidered == move)
|
if (AI_THINKING_STRUCT->moveConsidered == move)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_not_move(void)
|
static void BattleAICmd_if_not_move(void)
|
||||||
{
|
{
|
||||||
u16 move = AIScriptRead16(gAIScriptPtr + 1);
|
u16 move = T1_READ_16(gAIScriptPtr + 1);
|
||||||
|
|
||||||
if (AI_THINKING_STRUCT->moveConsidered != move)
|
if (AI_THINKING_STRUCT->moveConsidered != move)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_in_bytes(void)
|
static void BattleAICmd_if_in_bytes(void)
|
||||||
{
|
{
|
||||||
const u8 *ptr = AIScriptReadPtr(gAIScriptPtr + 1);
|
const u8 *ptr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
|
|
||||||
while (*ptr != 0xFF)
|
while (*ptr != 0xFF)
|
||||||
{
|
{
|
||||||
if (AI_THINKING_STRUCT->funcResult == *ptr)
|
if (AI_THINKING_STRUCT->funcResult == *ptr)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 5);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -1013,7 +1009,7 @@ static void BattleAICmd_if_in_bytes(void)
|
|||||||
|
|
||||||
static void BattleAICmd_if_not_in_bytes(void)
|
static void BattleAICmd_if_not_in_bytes(void)
|
||||||
{
|
{
|
||||||
const u8 *ptr = AIScriptReadPtr(gAIScriptPtr + 1);
|
const u8 *ptr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
|
|
||||||
while (*ptr != 0xFF)
|
while (*ptr != 0xFF)
|
||||||
{
|
{
|
||||||
@ -1024,18 +1020,18 @@ static void BattleAICmd_if_not_in_bytes(void)
|
|||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 5);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_in_hwords(void)
|
static void BattleAICmd_if_in_hwords(void)
|
||||||
{
|
{
|
||||||
const u16 *ptr = (const u16 *)AIScriptReadPtr(gAIScriptPtr + 1);
|
const u16 *ptr = (const u16 *)T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
|
|
||||||
while (*ptr != 0xFFFF)
|
while (*ptr != 0xFFFF)
|
||||||
{
|
{
|
||||||
if (AI_THINKING_STRUCT->funcResult == *ptr)
|
if (AI_THINKING_STRUCT->funcResult == *ptr)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 5);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -1045,7 +1041,7 @@ static void BattleAICmd_if_in_hwords(void)
|
|||||||
|
|
||||||
static void BattleAICmd_if_not_in_hwords(void)
|
static void BattleAICmd_if_not_in_hwords(void)
|
||||||
{
|
{
|
||||||
const u16 *ptr = (u16 *)AIScriptReadPtr(gAIScriptPtr + 1);
|
const u16 *ptr = (u16 *)T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
|
|
||||||
while (*ptr != 0xFFFF)
|
while (*ptr != 0xFFFF)
|
||||||
{
|
{
|
||||||
@ -1056,7 +1052,7 @@ static void BattleAICmd_if_not_in_hwords(void)
|
|||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 5);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_user_has_attacking_move(void)
|
static void BattleAICmd_if_user_has_attacking_move(void)
|
||||||
@ -1072,7 +1068,7 @@ static void BattleAICmd_if_user_has_attacking_move(void)
|
|||||||
if (i == 4)
|
if (i == 4)
|
||||||
gAIScriptPtr += 5;
|
gAIScriptPtr += 5;
|
||||||
else
|
else
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_if_user_has_no_attacking_moves(void)
|
static void BattleAICmd_if_user_has_no_attacking_moves(void)
|
||||||
@ -1088,7 +1084,7 @@ static void BattleAICmd_if_user_has_no_attacking_moves(void)
|
|||||||
if (i != 4)
|
if (i != 4)
|
||||||
gAIScriptPtr += 5;
|
gAIScriptPtr += 5;
|
||||||
else
|
else
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_get_turn_count(void)
|
static void BattleAICmd_get_turn_count(void)
|
||||||
@ -1237,7 +1233,7 @@ static void BattleAICmd_get_last_used_bank_move(void)
|
|||||||
static void BattleAICmd_if_equal_(void) // same as if_equal
|
static void BattleAICmd_if_equal_(void) // same as if_equal
|
||||||
{
|
{
|
||||||
if (gAIScriptPtr[1] == AI_THINKING_STRUCT->funcResult)
|
if (gAIScriptPtr[1] == AI_THINKING_STRUCT->funcResult)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -1245,7 +1241,7 @@ static void BattleAICmd_if_equal_(void) // same as if_equal
|
|||||||
static void BattleAICmd_if_not_equal_(void) // same as if_not_equal
|
static void BattleAICmd_if_not_equal_(void) // same as if_not_equal
|
||||||
{
|
{
|
||||||
if (gAIScriptPtr[1] != AI_THINKING_STRUCT->funcResult)
|
if (gAIScriptPtr[1] != AI_THINKING_STRUCT->funcResult)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -1253,7 +1249,7 @@ static void BattleAICmd_if_not_equal_(void) // same as if_not_equal
|
|||||||
static void BattleAICmd_if_user_goes(void)
|
static void BattleAICmd_if_user_goes(void)
|
||||||
{
|
{
|
||||||
if (GetWhoStrikesFirst(sBattler_AI, gBattlerTarget, TRUE) == gAIScriptPtr[1])
|
if (GetWhoStrikesFirst(sBattler_AI, gBattlerTarget, TRUE) == gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -1261,7 +1257,7 @@ static void BattleAICmd_if_user_goes(void)
|
|||||||
static void BattleAICmd_if_user_doesnt_go(void)
|
static void BattleAICmd_if_user_doesnt_go(void)
|
||||||
{
|
{
|
||||||
if (GetWhoStrikesFirst(sBattler_AI, gBattlerTarget, TRUE) != gAIScriptPtr[1])
|
if (GetWhoStrikesFirst(sBattler_AI, gBattlerTarget, TRUE) != gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -1527,7 +1523,7 @@ static void BattleAICmd_if_type_effectiveness(void)
|
|||||||
damageVar = gBattleMoveDamage;
|
damageVar = gBattleMoveDamage;
|
||||||
|
|
||||||
if (damageVar == gAIScriptPtr[1])
|
if (damageVar == gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -1559,7 +1555,7 @@ static void BattleAICmd_if_status_in_party(void)
|
|||||||
|
|
||||||
party = (GetBattlerSide(battlerId) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
party = (GetBattlerSide(battlerId) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||||
|
|
||||||
statusToCompareTo = AIScriptRead32(gAIScriptPtr + 2);
|
statusToCompareTo = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
@ -1569,7 +1565,7 @@ static void BattleAICmd_if_status_in_party(void)
|
|||||||
|
|
||||||
if (species != SPECIES_NONE && species != SPECIES_EGG && hp != 0 && status == statusToCompareTo)
|
if (species != SPECIES_NONE && species != SPECIES_EGG && hp != 0 && status == statusToCompareTo)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1596,7 +1592,7 @@ static void BattleAICmd_if_status_not_in_party(void)
|
|||||||
|
|
||||||
party = (GetBattlerSide(battlerId) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
party = (GetBattlerSide(battlerId) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||||
|
|
||||||
statusToCompareTo = AIScriptRead32(gAIScriptPtr + 2);
|
statusToCompareTo = T1_READ_32(gAIScriptPtr + 2);
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
@ -1610,7 +1606,7 @@ static void BattleAICmd_if_status_not_in_party(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_get_weather(void)
|
static void BattleAICmd_get_weather(void)
|
||||||
@ -1630,7 +1626,7 @@ static void BattleAICmd_get_weather(void)
|
|||||||
static void BattleAICmd_if_effect(void)
|
static void BattleAICmd_if_effect(void)
|
||||||
{
|
{
|
||||||
if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].effect == gAIScriptPtr[1])
|
if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].effect == gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -1638,7 +1634,7 @@ static void BattleAICmd_if_effect(void)
|
|||||||
static void BattleAICmd_if_not_effect(void)
|
static void BattleAICmd_if_not_effect(void)
|
||||||
{
|
{
|
||||||
if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].effect != gAIScriptPtr[1])
|
if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].effect != gAIScriptPtr[1])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
@ -1653,7 +1649,7 @@ static void BattleAICmd_if_stat_level_less_than(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] < gAIScriptPtr[3])
|
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] < gAIScriptPtr[3])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 8;
|
gAIScriptPtr += 8;
|
||||||
}
|
}
|
||||||
@ -1668,7 +1664,7 @@ static void BattleAICmd_if_stat_level_more_than(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] > gAIScriptPtr[3])
|
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] > gAIScriptPtr[3])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 8;
|
gAIScriptPtr += 8;
|
||||||
}
|
}
|
||||||
@ -1683,7 +1679,7 @@ static void BattleAICmd_if_stat_level_equal(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] == gAIScriptPtr[3])
|
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] == gAIScriptPtr[3])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 8;
|
gAIScriptPtr += 8;
|
||||||
}
|
}
|
||||||
@ -1698,7 +1694,7 @@ static void BattleAICmd_if_stat_level_not_equal(void)
|
|||||||
battlerId = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
|
|
||||||
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] != gAIScriptPtr[3])
|
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] != gAIScriptPtr[3])
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 8;
|
gAIScriptPtr += 8;
|
||||||
}
|
}
|
||||||
@ -1727,7 +1723,7 @@ static void BattleAICmd_if_can_faint(void)
|
|||||||
gBattleMoveDamage = 1;
|
gBattleMoveDamage = 1;
|
||||||
|
|
||||||
if (gBattleMons[gBattlerTarget].hp <= gBattleMoveDamage)
|
if (gBattleMons[gBattlerTarget].hp <= gBattleMoveDamage)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 5;
|
gAIScriptPtr += 5;
|
||||||
}
|
}
|
||||||
@ -1754,7 +1750,7 @@ static void BattleAICmd_if_cant_faint(void)
|
|||||||
// this macro is missing the damage 0 = 1 assumption.
|
// this macro is missing the damage 0 = 1 assumption.
|
||||||
|
|
||||||
if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage)
|
if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 5;
|
gAIScriptPtr += 5;
|
||||||
}
|
}
|
||||||
@ -1779,7 +1775,7 @@ static void BattleAICmd_if_has_move(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case AI_USER_PARTNER:
|
case AI_USER_PARTNER:
|
||||||
@ -1803,7 +1799,7 @@ static void BattleAICmd_if_has_move(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case AI_TARGET:
|
case AI_TARGET:
|
||||||
@ -1820,7 +1816,7 @@ static void BattleAICmd_if_has_move(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1847,7 +1843,7 @@ static void BattleAICmd_if_doesnt_have_move(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case AI_TARGET:
|
case AI_TARGET:
|
||||||
@ -1864,7 +1860,7 @@ static void BattleAICmd_if_doesnt_have_move(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1886,7 +1882,7 @@ static void BattleAICmd_if_has_move_with_effect(void)
|
|||||||
if (i == 4)
|
if (i == 4)
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
else
|
else
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
break;
|
break;
|
||||||
case AI_TARGET:
|
case AI_TARGET:
|
||||||
case AI_TARGET_PARTNER:
|
case AI_TARGET_PARTNER:
|
||||||
@ -1899,7 +1895,7 @@ static void BattleAICmd_if_has_move_with_effect(void)
|
|||||||
if (i == 4)
|
if (i == 4)
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
else
|
else
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1920,7 +1916,7 @@ static void BattleAICmd_if_doesnt_have_move_with_effect(void)
|
|||||||
if (i != 4)
|
if (i != 4)
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
else
|
else
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
break;
|
break;
|
||||||
case AI_TARGET:
|
case AI_TARGET:
|
||||||
case AI_TARGET_PARTNER:
|
case AI_TARGET_PARTNER:
|
||||||
@ -1932,7 +1928,7 @@ static void BattleAICmd_if_doesnt_have_move_with_effect(void)
|
|||||||
if (i != 4)
|
if (i != 4)
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
else
|
else
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1953,7 +1949,7 @@ static void BattleAICmd_if_any_move_disabled_or_encored(void)
|
|||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (gAIScriptPtr[2] != 1) // ignore the macro if its not 0 or 1.
|
else if (gAIScriptPtr[2] != 1) // ignore the macro if its not 0 or 1.
|
||||||
@ -1963,7 +1959,7 @@ static void BattleAICmd_if_any_move_disabled_or_encored(void)
|
|||||||
}
|
}
|
||||||
else if (gDisableStructs[battlerId].encoredMove != 0)
|
else if (gDisableStructs[battlerId].encoredMove != 0)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gAIScriptPtr += 7;
|
gAIScriptPtr += 7;
|
||||||
@ -1976,7 +1972,7 @@ static void BattleAICmd_if_curr_move_disabled_or_encored(void)
|
|||||||
case 0:
|
case 0:
|
||||||
if (gDisableStructs[gActiveBattler].disabledMove == AI_THINKING_STRUCT->moveConsidered)
|
if (gDisableStructs[gActiveBattler].disabledMove == AI_THINKING_STRUCT->moveConsidered)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
@ -1984,7 +1980,7 @@ static void BattleAICmd_if_curr_move_disabled_or_encored(void)
|
|||||||
case 1:
|
case 1:
|
||||||
if (gDisableStructs[gActiveBattler].encoredMove == AI_THINKING_STRUCT->moveConsidered)
|
if (gDisableStructs[gActiveBattler].encoredMove == AI_THINKING_STRUCT->moveConsidered)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
@ -2005,7 +2001,7 @@ static void BattleAICmd_if_random_safari_flee(void)
|
|||||||
u8 safariFleeRate = gBattleStruct->field_7B * 5; // safari flee rate, from 0-20
|
u8 safariFleeRate = gBattleStruct->field_7B * 5; // safari flee rate, from 0-20
|
||||||
|
|
||||||
if ((u8)(Random() % 100) < safariFleeRate)
|
if ((u8)(Random() % 100) < safariFleeRate)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 5;
|
gAIScriptPtr += 5;
|
||||||
}
|
}
|
||||||
@ -2048,7 +2044,7 @@ static void BattleAICmd_if_holds_item(void)
|
|||||||
var1 = gAIScriptPtr[3];
|
var1 = gAIScriptPtr[3];
|
||||||
|
|
||||||
if ((var1 | var2) == item)
|
if ((var1 | var2) == item)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 8;
|
gAIScriptPtr += 8;
|
||||||
}
|
}
|
||||||
@ -2183,12 +2179,12 @@ static void BattleAICmd_nullsub_57(void)
|
|||||||
static void BattleAICmd_call(void)
|
static void BattleAICmd_call(void)
|
||||||
{
|
{
|
||||||
AIStackPushVar(gAIScriptPtr + 5);
|
AIStackPushVar(gAIScriptPtr + 5);
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_goto(void)
|
static void BattleAICmd_goto(void)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BattleAICmd_end(void)
|
static void BattleAICmd_end(void)
|
||||||
@ -2204,7 +2200,7 @@ static void BattleAICmd_if_level_cond(void)
|
|||||||
case 0: // greater than
|
case 0: // greater than
|
||||||
if (gBattleMons[sBattler_AI].level > gBattleMons[gBattlerTarget].level)
|
if (gBattleMons[sBattler_AI].level > gBattleMons[gBattlerTarget].level)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
@ -2212,7 +2208,7 @@ static void BattleAICmd_if_level_cond(void)
|
|||||||
case 1: // less than
|
case 1: // less than
|
||||||
if (gBattleMons[sBattler_AI].level < gBattleMons[gBattlerTarget].level)
|
if (gBattleMons[sBattler_AI].level < gBattleMons[gBattlerTarget].level)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
@ -2220,7 +2216,7 @@ static void BattleAICmd_if_level_cond(void)
|
|||||||
case 2: // equal
|
case 2: // equal
|
||||||
if (gBattleMons[sBattler_AI].level == gBattleMons[gBattlerTarget].level)
|
if (gBattleMons[sBattler_AI].level == gBattleMons[gBattlerTarget].level)
|
||||||
{
|
{
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
@ -2231,7 +2227,7 @@ static void BattleAICmd_if_level_cond(void)
|
|||||||
static void BattleAICmd_if_target_taunted(void)
|
static void BattleAICmd_if_target_taunted(void)
|
||||||
{
|
{
|
||||||
if (gDisableStructs[gBattlerTarget].tauntTimer1 != 0)
|
if (gDisableStructs[gBattlerTarget].tauntTimer1 != 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 5;
|
gAIScriptPtr += 5;
|
||||||
}
|
}
|
||||||
@ -2239,7 +2235,7 @@ static void BattleAICmd_if_target_taunted(void)
|
|||||||
static void BattleAICmd_if_target_not_taunted(void)
|
static void BattleAICmd_if_target_not_taunted(void)
|
||||||
{
|
{
|
||||||
if (gDisableStructs[gBattlerTarget].tauntTimer1 == 0)
|
if (gDisableStructs[gBattlerTarget].tauntTimer1 == 0)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 5;
|
gAIScriptPtr += 5;
|
||||||
}
|
}
|
||||||
@ -2247,7 +2243,7 @@ static void BattleAICmd_if_target_not_taunted(void)
|
|||||||
static void BattleAICmd_if_target_is_ally(void)
|
static void BattleAICmd_if_target_is_ally(void)
|
||||||
{
|
{
|
||||||
if ((sBattler_AI & BIT_SIDE) == (gBattlerTarget & BIT_SIDE))
|
if ((sBattler_AI & BIT_SIDE) == (gBattlerTarget & BIT_SIDE))
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 5;
|
gAIScriptPtr += 5;
|
||||||
}
|
}
|
||||||
@ -2257,7 +2253,7 @@ static void BattleAICmd_if_flash_fired(void)
|
|||||||
u8 battlerId = BattleAI_GetWantedBank(gAIScriptPtr[1]);
|
u8 battlerId = BattleAI_GetWantedBank(gAIScriptPtr[1]);
|
||||||
|
|
||||||
if (gBattleResources->flags->flags[battlerId] & UNKNOWN_FLAG_FLASH_FIRE)
|
if (gBattleResources->flags->flags[battlerId] & UNKNOWN_FLAG_FLASH_FIRE)
|
||||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||||
else
|
else
|
||||||
gAIScriptPtr += 6;
|
gAIScriptPtr += 6;
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "constants/items.h"
|
#include "constants/items.h"
|
||||||
|
|
||||||
extern const u8 * const gItemEffectTable[]; // todo: fix once struct is declared
|
|
||||||
|
|
||||||
// this file's functions
|
// this file's functions
|
||||||
static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng);
|
static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng);
|
||||||
static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent);
|
static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent);
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
// sprites start at 10000 and thus must be subtracted of 10000 to account for the true index.
|
// sprites start at 10000 and thus must be subtracted of 10000 to account for the true index.
|
||||||
#define GET_TRUE_SPRITE_INDEX(i) ((i - 10000))
|
#define GET_TRUE_SPRITE_INDEX(i) ((i - 10000))
|
||||||
|
|
||||||
#define SCRIPT_READ_16(ptr) ((ptr)[0] | ((ptr)[1] << 8))
|
|
||||||
#define SCRIPT_READ_32(ptr) (((ptr)[0]) + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24))
|
|
||||||
#define SCRIPT_READ_PTR(ptr) ((const u8*)(SCRIPT_READ_32(ptr)))
|
|
||||||
|
|
||||||
#define ANIM_SPRITE_INDEX_COUNT 8
|
#define ANIM_SPRITE_INDEX_COUNT 8
|
||||||
|
|
||||||
extern u16 gBattle_WIN0H;
|
extern u16 gBattle_WIN0H;
|
||||||
@ -352,7 +348,7 @@ static void ScriptCmd_loadspritegfx(void)
|
|||||||
u16 index;
|
u16 index;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
index = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
index = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)]);
|
LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)]);
|
||||||
LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(index)]);
|
LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(index)]);
|
||||||
sBattleAnimScriptPtr += 2;
|
sBattleAnimScriptPtr += 2;
|
||||||
@ -366,7 +362,7 @@ static void ScriptCmd_unloadspritegfx(void)
|
|||||||
u16 index;
|
u16 index;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
index = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
index = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
FreeSpriteTilesByTag(gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)].tag);
|
FreeSpriteTilesByTag(gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)].tag);
|
||||||
FreeSpritePaletteByTag(gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)].tag);
|
FreeSpritePaletteByTag(gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)].tag);
|
||||||
sBattleAnimScriptPtr += 2;
|
sBattleAnimScriptPtr += 2;
|
||||||
@ -382,7 +378,7 @@ static void ScriptCmd_createsprite(void)
|
|||||||
s16 subpriority;
|
s16 subpriority;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
template = (const struct SpriteTemplate *)(SCRIPT_READ_32(sBattleAnimScriptPtr));
|
template = (const struct SpriteTemplate *)(T2_READ_32(sBattleAnimScriptPtr));
|
||||||
sBattleAnimScriptPtr += 4;
|
sBattleAnimScriptPtr += 4;
|
||||||
|
|
||||||
argVar = sBattleAnimScriptPtr[0];
|
argVar = sBattleAnimScriptPtr[0];
|
||||||
@ -392,7 +388,7 @@ static void ScriptCmd_createsprite(void)
|
|||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
for (i = 0; i < argsCount; i++)
|
for (i = 0; i < argsCount; i++)
|
||||||
{
|
{
|
||||||
gBattleAnimArgs[i] = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
sBattleAnimScriptPtr += 2;
|
sBattleAnimScriptPtr += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,7 +429,7 @@ static void ScriptCmd_createvisualtask(void)
|
|||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
|
|
||||||
taskFunc = (TaskFunc)SCRIPT_READ_32(sBattleAnimScriptPtr);
|
taskFunc = (TaskFunc)T2_READ_32(sBattleAnimScriptPtr);
|
||||||
sBattleAnimScriptPtr += 4;
|
sBattleAnimScriptPtr += 4;
|
||||||
|
|
||||||
taskPriority = sBattleAnimScriptPtr[0];
|
taskPriority = sBattleAnimScriptPtr[0];
|
||||||
@ -444,7 +440,7 @@ static void ScriptCmd_createvisualtask(void)
|
|||||||
|
|
||||||
for (i = 0; i < numArgs; i++)
|
for (i = 0; i < numArgs; i++)
|
||||||
{
|
{
|
||||||
gBattleAnimArgs[i] = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
sBattleAnimScriptPtr += 2;
|
sBattleAnimScriptPtr += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,26 +538,26 @@ static void ScriptCmd_end(void)
|
|||||||
static void ScriptCmd_playse(void)
|
static void ScriptCmd_playse(void)
|
||||||
{
|
{
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
PlaySE(SCRIPT_READ_16(sBattleAnimScriptPtr));
|
PlaySE(T1_READ_16(sBattleAnimScriptPtr));
|
||||||
sBattleAnimScriptPtr += 2;
|
sBattleAnimScriptPtr += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define t1_MONBG_BANK 0
|
#define t1_MONBG_BATTLER 0
|
||||||
#define t1_MON_IN_BG2 1
|
#define t1_MON_IN_BG2 1
|
||||||
#define t1_CREATE_ANOTHER_TASK 2
|
#define t1_CREATE_ANOTHER_TASK 2
|
||||||
#define t1_IS_SECONDMON_BG 3
|
#define t1_IS_SECONDMON_BG 3
|
||||||
|
|
||||||
#define t2_BANK_SPRITE_ID 0
|
#define t2_BATTLER_SPRITE_ID 0
|
||||||
#define t2_MON_IN_BG2 5
|
#define t2_MON_IN_BG2 5
|
||||||
#define t2_MONBG_BANK 6
|
#define t2_MONBG_BATTLER 6
|
||||||
|
|
||||||
static void sub_80A40F4(u8 taskId)
|
static void sub_80A40F4(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 newTaskId;
|
u8 newTaskId;
|
||||||
|
|
||||||
s16 *selfData = gTasks[taskId].data;
|
s16 *selfData = gTasks[taskId].data;
|
||||||
u8 bankSpriteId = gBattlerSpriteIds[selfData[t1_MONBG_BANK]];
|
u8 battlerSpriteId = gBattlerSpriteIds[selfData[t1_MONBG_BATTLER]];
|
||||||
gSprites[bankSpriteId].invisible = 1;
|
gSprites[battlerSpriteId].invisible = 1;
|
||||||
|
|
||||||
if (!selfData[t1_CREATE_ANOTHER_TASK])
|
if (!selfData[t1_CREATE_ANOTHER_TASK])
|
||||||
{
|
{
|
||||||
@ -570,9 +566,9 @@ static void sub_80A40F4(u8 taskId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
newTaskId = CreateTask(task_pA_ma0A_obj_to_bg_pal, 10);
|
newTaskId = CreateTask(task_pA_ma0A_obj_to_bg_pal, 10);
|
||||||
gTasks[newTaskId].data[t2_BANK_SPRITE_ID] = bankSpriteId;
|
gTasks[newTaskId].data[t2_BATTLER_SPRITE_ID] = battlerSpriteId;
|
||||||
gTasks[newTaskId].data[1] = gSprites[bankSpriteId].pos1.x + gSprites[bankSpriteId].pos2.x;
|
gTasks[newTaskId].data[1] = gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x;
|
||||||
gTasks[newTaskId].data[2] = gSprites[bankSpriteId].pos1.y + gSprites[bankSpriteId].pos2.y;
|
gTasks[newTaskId].data[2] = gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y;
|
||||||
|
|
||||||
if (!selfData[t1_MON_IN_BG2])
|
if (!selfData[t1_MON_IN_BG2])
|
||||||
{
|
{
|
||||||
@ -586,7 +582,7 @@ static void sub_80A40F4(u8 taskId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gTasks[newTaskId].data[t2_MON_IN_BG2] = selfData[t1_MON_IN_BG2];
|
gTasks[newTaskId].data[t2_MON_IN_BG2] = selfData[t1_MON_IN_BG2];
|
||||||
gTasks[newTaskId].data[t2_MONBG_BANK] = selfData[t1_MONBG_BANK];
|
gTasks[newTaskId].data[t2_MONBG_BATTLER] = selfData[t1_MONBG_BATTLER];
|
||||||
sMonAnimTaskIdArray[selfData[t1_IS_SECONDMON_BG]] = newTaskId;
|
sMonAnimTaskIdArray[selfData[t1_IS_SECONDMON_BG]] = newTaskId;
|
||||||
DestroyAnimVisualTask(taskId);
|
DestroyAnimVisualTask(taskId);
|
||||||
}
|
}
|
||||||
@ -595,48 +591,48 @@ static void ScriptCmd_monbg(void)
|
|||||||
{
|
{
|
||||||
bool8 toBG_2;
|
bool8 toBG_2;
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
u8 animBank;
|
u8 animBank;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
|
|
||||||
animBank = sBattleAnimScriptPtr[0];
|
animBank = sBattleAnimScriptPtr[0];
|
||||||
if (animBank & ANIM_TARGET)
|
if (animBank & ANIM_TARGET)
|
||||||
bank = gBattleAnimTarget;
|
battlerId = gBattleAnimTarget;
|
||||||
else
|
else
|
||||||
bank = gBattleAnimAttacker;
|
battlerId = gBattleAnimAttacker;
|
||||||
|
|
||||||
if (IsBattlerSpriteVisible(bank))
|
if (IsBattlerSpriteVisible(battlerId))
|
||||||
{
|
{
|
||||||
u8 position = GetBattlerPosition(bank);
|
u8 position = GetBattlerPosition(battlerId);
|
||||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||||
toBG_2 = FALSE;
|
toBG_2 = FALSE;
|
||||||
else
|
else
|
||||||
toBG_2 = TRUE;
|
toBG_2 = TRUE;
|
||||||
|
|
||||||
sub_80A438C(bank, toBG_2, FALSE);
|
sub_80A438C(battlerId, toBG_2, FALSE);
|
||||||
taskId = CreateTask(sub_80A40F4, 10);
|
taskId = CreateTask(sub_80A40F4, 10);
|
||||||
gAnimVisualTaskCount++;
|
gAnimVisualTaskCount++;
|
||||||
gTasks[taskId].data[t1_MONBG_BANK] = bank;
|
gTasks[taskId].data[t1_MONBG_BATTLER] = battlerId;
|
||||||
gTasks[taskId].data[t1_MON_IN_BG2] = toBG_2;
|
gTasks[taskId].data[t1_MON_IN_BG2] = toBG_2;
|
||||||
gTasks[taskId].data[t1_CREATE_ANOTHER_TASK] = TRUE;
|
gTasks[taskId].data[t1_CREATE_ANOTHER_TASK] = TRUE;
|
||||||
gTasks[taskId].data[t1_IS_SECONDMON_BG] = 0;
|
gTasks[taskId].data[t1_IS_SECONDMON_BG] = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bank ^= BIT_FLANK;
|
battlerId ^= BIT_FLANK;
|
||||||
if (IsBattlerSpriteVisible(bank))
|
if (IsBattlerSpriteVisible(battlerId))
|
||||||
{
|
{
|
||||||
u8 position = GetBattlerPosition(bank);
|
u8 position = GetBattlerPosition(battlerId);
|
||||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||||
toBG_2 = FALSE;
|
toBG_2 = FALSE;
|
||||||
else
|
else
|
||||||
toBG_2 = TRUE;
|
toBG_2 = TRUE;
|
||||||
|
|
||||||
sub_80A438C(bank, toBG_2, FALSE);
|
sub_80A438C(battlerId, toBG_2, FALSE);
|
||||||
taskId = CreateTask(sub_80A40F4, 10);
|
taskId = CreateTask(sub_80A40F4, 10);
|
||||||
gAnimVisualTaskCount++;
|
gAnimVisualTaskCount++;
|
||||||
gTasks[taskId].data[0] = bank;
|
gTasks[taskId].data[0] = battlerId;
|
||||||
gTasks[taskId].data[1] = toBG_2;
|
gTasks[taskId].data[1] = toBG_2;
|
||||||
gTasks[taskId].data[t1_CREATE_ANOTHER_TASK] = TRUE;
|
gTasks[taskId].data[t1_CREATE_ANOTHER_TASK] = TRUE;
|
||||||
gTasks[taskId].data[t1_IS_SECONDMON_BG] = 1;
|
gTasks[taskId].data[t1_IS_SECONDMON_BG] = 1;
|
||||||
@ -647,33 +643,33 @@ static void ScriptCmd_monbg(void)
|
|||||||
gAnimScriptCallback = WaitAnimFrameCount;
|
gAnimScriptCallback = WaitAnimFrameCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 IsBattlerSpriteVisible(u8 bank)
|
bool8 IsBattlerSpriteVisible(u8 battlerId)
|
||||||
{
|
{
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
{
|
{
|
||||||
if (bank == gBattleAnimAttacker)
|
if (battlerId == gBattleAnimAttacker)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!IsBattlerSpritePresent(bank))
|
if (!IsBattlerSpritePresent(battlerId))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
return TRUE; // this line wont ever be reached.
|
return TRUE; // this line wont ever be reached.
|
||||||
if (!gBattleSpritesDataPtr->battlerData[bank].invisible || !gSprites[gBattlerSpriteIds[bank]].invisible)
|
if (!gBattleSpritesDataPtr->battlerData[battlerId].invisible || !gSprites[gBattlerSpriteIds[battlerId]].invisible)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
|
void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
|
||||||
{
|
{
|
||||||
struct UnknownAnimStruct2 unknownStruct;
|
struct UnknownAnimStruct2 unknownStruct;
|
||||||
u8 bankSpriteId;
|
u8 battlerSpriteId;
|
||||||
|
|
||||||
if (!toBG_2)
|
if (!toBG_2)
|
||||||
{
|
{
|
||||||
u8 bankIdentity;
|
u8 battlerPosition;
|
||||||
|
|
||||||
if (IsContest() == TRUE)
|
if (IsContest() == TRUE)
|
||||||
{
|
{
|
||||||
@ -694,28 +690,28 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
|
|||||||
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1);
|
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1);
|
||||||
SetAnimBgAttribute(1, BG_ANIM_AREA_OVERFLOW_MODE, 0);
|
SetAnimBgAttribute(1, BG_ANIM_AREA_OVERFLOW_MODE, 0);
|
||||||
|
|
||||||
bankSpriteId = gBattlerSpriteIds[bank];
|
battlerSpriteId = gBattlerSpriteIds[battlerId];
|
||||||
|
|
||||||
gBattle_BG1_X = -(gSprites[bankSpriteId].pos1.x + gSprites[bankSpriteId].pos2.x) + 0x20;
|
gBattle_BG1_X = -(gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x) + 0x20;
|
||||||
if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->field_0))
|
if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->field_0))
|
||||||
gBattle_BG1_X--;
|
gBattle_BG1_X--;
|
||||||
|
|
||||||
gBattle_BG1_Y = -(gSprites[bankSpriteId].pos1.y + gSprites[bankSpriteId].pos2.y) + 0x20;
|
gBattle_BG1_Y = -(gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y) + 0x20;
|
||||||
if (setSpriteInvisible)
|
if (setSpriteInvisible)
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = 1;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = 1;
|
||||||
|
|
||||||
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
|
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
|
||||||
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
|
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
|
||||||
|
|
||||||
LoadPalette(&gPlttBufferUnfaded[0x100 + bank * 16], unknownStruct.unk8 * 16, 0x20);
|
LoadPalette(&gPlttBufferUnfaded[0x100 + battlerId * 16], unknownStruct.unk8 * 16, 0x20);
|
||||||
CpuCopy32(&gPlttBufferUnfaded[0x100 + bank * 16], (void*)(BG_PLTT + unknownStruct.unk8 * 32), 0x20);
|
CpuCopy32(&gPlttBufferUnfaded[0x100 + battlerId * 16], (void*)(BG_PLTT + unknownStruct.unk8 * 32), 0x20);
|
||||||
|
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
bankIdentity = 0;
|
battlerPosition = 0;
|
||||||
else
|
else
|
||||||
bankIdentity = GetBattlerPosition(bank);
|
battlerPosition = GetBattlerPosition(battlerId);
|
||||||
|
|
||||||
sub_8118FBC(1, 0, 0, bankIdentity, unknownStruct.unk8, unknownStruct.unk0, unknownStruct.unk4, unknownStruct.unkA);
|
sub_8118FBC(1, 0, 0, battlerPosition, unknownStruct.unk8, unknownStruct.unk0, unknownStruct.unk4, unknownStruct.unkA);
|
||||||
|
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
sub_80A46A0();
|
sub_80A46A0();
|
||||||
@ -731,21 +727,21 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
|
|||||||
SetAnimBgAttribute(2, BG_ANIM_SCREEN_SIZE, 1);
|
SetAnimBgAttribute(2, BG_ANIM_SCREEN_SIZE, 1);
|
||||||
SetAnimBgAttribute(2, BG_ANIM_AREA_OVERFLOW_MODE, 0);
|
SetAnimBgAttribute(2, BG_ANIM_AREA_OVERFLOW_MODE, 0);
|
||||||
|
|
||||||
bankSpriteId = gBattlerSpriteIds[bank];
|
battlerSpriteId = gBattlerSpriteIds[battlerId];
|
||||||
|
|
||||||
gBattle_BG2_X = -(gSprites[bankSpriteId].pos1.x + gSprites[bankSpriteId].pos2.x) + 0x20;
|
gBattle_BG2_X = -(gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x) + 0x20;
|
||||||
gBattle_BG2_Y = -(gSprites[bankSpriteId].pos1.y + gSprites[bankSpriteId].pos2.y) + 0x20;
|
gBattle_BG2_Y = -(gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y) + 0x20;
|
||||||
|
|
||||||
if (setSpriteInvisible)
|
if (setSpriteInvisible)
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = 1;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = 1;
|
||||||
|
|
||||||
SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X);
|
SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X);
|
||||||
SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y);
|
SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y);
|
||||||
|
|
||||||
LoadPalette(&gPlttBufferUnfaded[0x100 + bank * 16], 0x90, 0x20);
|
LoadPalette(&gPlttBufferUnfaded[0x100 + battlerId * 16], 0x90, 0x20);
|
||||||
CpuCopy32(&gPlttBufferUnfaded[0x100 + bank * 16], (void*)(BG_PLTT + 0x120), 0x20);
|
CpuCopy32(&gPlttBufferUnfaded[0x100 + battlerId * 16], (void*)(BG_PLTT + 0x120), 0x20);
|
||||||
|
|
||||||
sub_8118FBC(2, 0, 0, GetBattlerPosition(bank), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA);
|
sub_8118FBC(2, 0, 0, GetBattlerPosition(battlerId), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -852,7 +848,7 @@ static void task_pA_ma0A_obj_to_bg_pal(u8 taskId)
|
|||||||
static void ScriptCmd_clearmonbg(void)
|
static void ScriptCmd_clearmonbg(void)
|
||||||
{
|
{
|
||||||
u8 animBankId;
|
u8 animBankId;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
@ -864,20 +860,20 @@ static void ScriptCmd_clearmonbg(void)
|
|||||||
animBankId = ANIM_DEF_PARTNER;
|
animBankId = ANIM_DEF_PARTNER;
|
||||||
|
|
||||||
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
||||||
bank = gBattleAnimAttacker;
|
battlerId = gBattleAnimAttacker;
|
||||||
else
|
else
|
||||||
bank = gBattleAnimTarget;
|
battlerId = gBattleAnimTarget;
|
||||||
|
|
||||||
if (sMonAnimTaskIdArray[0] != 0xFF)
|
if (sMonAnimTaskIdArray[0] != 0xFF)
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = 0;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = 0;
|
||||||
if (animBankId > 1 && sMonAnimTaskIdArray[1] != 0xFF)
|
if (animBankId > 1 && sMonAnimTaskIdArray[1] != 0xFF)
|
||||||
gSprites[gBattlerSpriteIds[bank ^ BIT_FLANK]].invisible = 0;
|
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = 0;
|
||||||
else
|
else
|
||||||
animBankId = 0;
|
animBankId = 0;
|
||||||
|
|
||||||
taskId = CreateTask(sub_80A4980, 5);
|
taskId = CreateTask(sub_80A4980, 5);
|
||||||
gTasks[taskId].data[0] = animBankId;
|
gTasks[taskId].data[0] = animBankId;
|
||||||
gTasks[taskId].data[2] = bank;
|
gTasks[taskId].data[2] = battlerId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
}
|
}
|
||||||
@ -913,7 +909,7 @@ static void sub_80A4980(u8 taskId)
|
|||||||
static void ScriptCmd_monbg_22(void)
|
static void ScriptCmd_monbg_22(void)
|
||||||
{
|
{
|
||||||
bool8 toBG_2;
|
bool8 toBG_2;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
u8 animBankId;
|
u8 animBankId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
@ -926,31 +922,31 @@ static void ScriptCmd_monbg_22(void)
|
|||||||
animBankId = ANIM_DEF_PARTNER;
|
animBankId = ANIM_DEF_PARTNER;
|
||||||
|
|
||||||
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
||||||
bank = gBattleAnimAttacker;
|
battlerId = gBattleAnimAttacker;
|
||||||
else
|
else
|
||||||
bank = gBattleAnimTarget;
|
battlerId = gBattleAnimTarget;
|
||||||
|
|
||||||
if (IsBattlerSpriteVisible(bank))
|
if (IsBattlerSpriteVisible(battlerId))
|
||||||
{
|
{
|
||||||
u8 position = GetBattlerPosition(bank);
|
u8 position = GetBattlerPosition(battlerId);
|
||||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||||
toBG_2 = FALSE;
|
toBG_2 = FALSE;
|
||||||
else
|
else
|
||||||
toBG_2 = TRUE;
|
toBG_2 = TRUE;
|
||||||
|
|
||||||
sub_80A438C(bank, toBG_2, FALSE);
|
sub_80A438C(battlerId, toBG_2, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bank ^= BIT_FLANK;
|
battlerId ^= BIT_FLANK;
|
||||||
if (animBankId > 1 && IsBattlerSpriteVisible(bank))
|
if (animBankId > 1 && IsBattlerSpriteVisible(battlerId))
|
||||||
{
|
{
|
||||||
u8 position = GetBattlerPosition(bank);
|
u8 position = GetBattlerPosition(battlerId);
|
||||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||||
toBG_2 = FALSE;
|
toBG_2 = FALSE;
|
||||||
else
|
else
|
||||||
toBG_2 = TRUE;
|
toBG_2 = TRUE;
|
||||||
|
|
||||||
sub_80A438C(bank, toBG_2, FALSE);
|
sub_80A438C(battlerId, toBG_2, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
@ -959,7 +955,7 @@ static void ScriptCmd_monbg_22(void)
|
|||||||
static void ScriptCmd_clearmonbg_23(void)
|
static void ScriptCmd_clearmonbg_23(void)
|
||||||
{
|
{
|
||||||
u8 animBankId;
|
u8 animBankId;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
@ -971,20 +967,20 @@ static void ScriptCmd_clearmonbg_23(void)
|
|||||||
animBankId = ANIM_DEF_PARTNER;
|
animBankId = ANIM_DEF_PARTNER;
|
||||||
|
|
||||||
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
||||||
bank = gBattleAnimAttacker;
|
battlerId = gBattleAnimAttacker;
|
||||||
else
|
else
|
||||||
bank = gBattleAnimTarget;
|
battlerId = gBattleAnimTarget;
|
||||||
|
|
||||||
if (IsBattlerSpriteVisible(bank))
|
if (IsBattlerSpriteVisible(battlerId))
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = 0;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = 0;
|
||||||
if (animBankId > 1 && IsBattlerSpriteVisible(bank ^ BIT_FLANK))
|
if (animBankId > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK))
|
||||||
gSprites[gBattlerSpriteIds[bank ^ BIT_FLANK]].invisible = 0;
|
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = 0;
|
||||||
else
|
else
|
||||||
animBankId = 0;
|
animBankId = 0;
|
||||||
|
|
||||||
taskId = CreateTask(sub_80A4BB0, 5);
|
taskId = CreateTask(sub_80A4BB0, 5);
|
||||||
gTasks[taskId].data[0] = animBankId;
|
gTasks[taskId].data[0] = animBankId;
|
||||||
gTasks[taskId].data[2] = bank;
|
gTasks[taskId].data[2] = battlerId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
}
|
}
|
||||||
@ -995,30 +991,30 @@ static void sub_80A4BB0(u8 taskId)
|
|||||||
if (gTasks[taskId].data[1] != 1)
|
if (gTasks[taskId].data[1] != 1)
|
||||||
{
|
{
|
||||||
bool8 toBG_2;
|
bool8 toBG_2;
|
||||||
u8 bank = gTasks[taskId].data[2];
|
u8 battlerId = gTasks[taskId].data[2];
|
||||||
u8 position = GetBattlerPosition(bank);
|
u8 position = GetBattlerPosition(battlerId);
|
||||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||||
toBG_2 = FALSE;
|
toBG_2 = FALSE;
|
||||||
else
|
else
|
||||||
toBG_2 = TRUE;
|
toBG_2 = TRUE;
|
||||||
|
|
||||||
if (IsBattlerSpriteVisible(bank))
|
if (IsBattlerSpriteVisible(battlerId))
|
||||||
sub_80A477C(toBG_2);
|
sub_80A477C(toBG_2);
|
||||||
if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(bank ^ BIT_FLANK))
|
if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK))
|
||||||
sub_80A477C(toBG_2 ^ 1);
|
sub_80A477C(toBG_2 ^ 1);
|
||||||
|
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef t1_MONBG_BANK
|
#undef t1_MONBG_BATTLER
|
||||||
#undef t1_MON_IN_BG2
|
#undef t1_MON_IN_BG2
|
||||||
#undef t1_CREATE_ANOTHER_TASK
|
#undef t1_CREATE_ANOTHER_TASK
|
||||||
#undef t1_IS_SECONDMON_BG
|
#undef t1_IS_SECONDMON_BG
|
||||||
|
|
||||||
#undef t2_BANK_SPRITE_ID
|
#undef t2_BATTLER_SPRITE_ID
|
||||||
#undef t2_MON_IN_BG2
|
#undef t2_MON_IN_BG2
|
||||||
#undef t2_MONBG_BANK
|
#undef t2_MONBG_BATTLER
|
||||||
|
|
||||||
static void ScriptCmd_setalpha(void)
|
static void ScriptCmd_setalpha(void)
|
||||||
{
|
{
|
||||||
@ -1052,7 +1048,7 @@ static void ScriptCmd_call(void)
|
|||||||
{
|
{
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
sBattleAnimScriptRetAddr = sBattleAnimScriptPtr + 4;
|
sBattleAnimScriptRetAddr = sBattleAnimScriptPtr + 4;
|
||||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ScriptCmd_return(void)
|
static void ScriptCmd_return(void)
|
||||||
@ -1069,7 +1065,7 @@ static void ScriptCmd_setarg(void)
|
|||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
argId = sBattleAnimScriptPtr[0];
|
argId = sBattleAnimScriptPtr[0];
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
value = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
value = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
sBattleAnimScriptPtr = addr + 4;
|
sBattleAnimScriptPtr = addr + 4;
|
||||||
gBattleAnimArgs[argId] = value;
|
gBattleAnimArgs[argId] = value;
|
||||||
}
|
}
|
||||||
@ -1079,7 +1075,7 @@ static void ScriptCmd_choosetwoturnanim(void)
|
|||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
if (gAnimMoveTurn & 1)
|
if (gAnimMoveTurn & 1)
|
||||||
sBattleAnimScriptPtr += 4;
|
sBattleAnimScriptPtr += 4;
|
||||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ScriptCmd_jumpifmoveturn(void)
|
static void ScriptCmd_jumpifmoveturn(void)
|
||||||
@ -1090,7 +1086,7 @@ static void ScriptCmd_jumpifmoveturn(void)
|
|||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
|
|
||||||
if (toCheck == gAnimMoveTurn)
|
if (toCheck == gAnimMoveTurn)
|
||||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||||
else
|
else
|
||||||
sBattleAnimScriptPtr += 4;
|
sBattleAnimScriptPtr += 4;
|
||||||
}
|
}
|
||||||
@ -1098,7 +1094,7 @@ static void ScriptCmd_jumpifmoveturn(void)
|
|||||||
static void ScriptCmd_goto(void)
|
static void ScriptCmd_goto(void)
|
||||||
{
|
{
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uses of this function that rely on a TRUE return are expecting inBattle to not be ticked as defined in contest behavior. As a result, if misused, this function cannot reliably discern between field and contest status and could result in undefined behavior.
|
// Uses of this function that rely on a TRUE return are expecting inBattle to not be ticked as defined in contest behavior. As a result, if misused, this function cannot reliably discern between field and contest status and could result in undefined behavior.
|
||||||
@ -1354,7 +1350,7 @@ static void ScriptCmd_playsewithpan(void)
|
|||||||
s8 pan;
|
s8 pan;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
pan = sBattleAnimScriptPtr[2];
|
pan = sBattleAnimScriptPtr[2];
|
||||||
PlaySE12WithPanning(songId, BattleAnimAdjustPanning(pan));
|
PlaySE12WithPanning(songId, BattleAnimAdjustPanning(pan));
|
||||||
sBattleAnimScriptPtr += 3;
|
sBattleAnimScriptPtr += 3;
|
||||||
@ -1385,7 +1381,7 @@ static void ScriptCmd_panse_1B(void)
|
|||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
songNum = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
songNum = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
currentPanArg = sBattleAnimScriptPtr[2];
|
currentPanArg = sBattleAnimScriptPtr[2];
|
||||||
incrementPan = sBattleAnimScriptPtr[3];
|
incrementPan = sBattleAnimScriptPtr[3];
|
||||||
incrementPanArg = sBattleAnimScriptPtr[4];
|
incrementPanArg = sBattleAnimScriptPtr[4];
|
||||||
@ -1457,7 +1453,7 @@ static void ScriptCmd_panse_26(void)
|
|||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
currentPan = sBattleAnimScriptPtr[2];
|
currentPan = sBattleAnimScriptPtr[2];
|
||||||
targetPan = sBattleAnimScriptPtr[3];
|
targetPan = sBattleAnimScriptPtr[3];
|
||||||
incrementPan = sBattleAnimScriptPtr[4];
|
incrementPan = sBattleAnimScriptPtr[4];
|
||||||
@ -1484,7 +1480,7 @@ static void ScriptCmd_panse_27(void)
|
|||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
currentPanArg = sBattleAnimScriptPtr[2];
|
currentPanArg = sBattleAnimScriptPtr[2];
|
||||||
targetPanArg = sBattleAnimScriptPtr[3];
|
targetPanArg = sBattleAnimScriptPtr[3];
|
||||||
incrementPanArg = sBattleAnimScriptPtr[4];
|
incrementPanArg = sBattleAnimScriptPtr[4];
|
||||||
@ -1528,7 +1524,7 @@ static void ScriptCmd_loopsewithpan(void)
|
|||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
panningArg = sBattleAnimScriptPtr[2];
|
panningArg = sBattleAnimScriptPtr[2];
|
||||||
framesToWait = sBattleAnimScriptPtr[3];
|
framesToWait = sBattleAnimScriptPtr[3];
|
||||||
numberOfPlays = sBattleAnimScriptPtr[4];
|
numberOfPlays = sBattleAnimScriptPtr[4];
|
||||||
@ -1585,7 +1581,7 @@ static void ScriptCmd_waitplaysewithpan(void)
|
|||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
panningArg = sBattleAnimScriptPtr[2];
|
panningArg = sBattleAnimScriptPtr[2];
|
||||||
framesToWait = sBattleAnimScriptPtr[3];
|
framesToWait = sBattleAnimScriptPtr[3];
|
||||||
panning = BattleAnimAdjustPanning(panningArg);
|
panning = BattleAnimAdjustPanning(panningArg);
|
||||||
@ -1620,13 +1616,13 @@ static void ScriptCmd_createsoundtask(void)
|
|||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
func = (TaskFunc)SCRIPT_READ_32(sBattleAnimScriptPtr);
|
func = (TaskFunc)T2_READ_32(sBattleAnimScriptPtr);
|
||||||
sBattleAnimScriptPtr += 4;
|
sBattleAnimScriptPtr += 4;
|
||||||
numArgs = sBattleAnimScriptPtr[0];
|
numArgs = sBattleAnimScriptPtr[0];
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
for (i = 0; i < numArgs; i++)
|
for (i = 0; i < numArgs; i++)
|
||||||
{
|
{
|
||||||
gBattleAnimArgs[i] = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
|
||||||
sBattleAnimScriptPtr += 2;
|
sBattleAnimScriptPtr += 2;
|
||||||
}
|
}
|
||||||
taskId = CreateTask(func, 1);
|
taskId = CreateTask(func, 1);
|
||||||
@ -1669,10 +1665,10 @@ static void ScriptCmd_jumpargeq(void)
|
|||||||
|
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
argId = sBattleAnimScriptPtr[0];
|
argId = sBattleAnimScriptPtr[0];
|
||||||
valueToCheck = SCRIPT_READ_16(sBattleAnimScriptPtr + 1);
|
valueToCheck = T1_READ_16(sBattleAnimScriptPtr + 1);
|
||||||
|
|
||||||
if (valueToCheck == gBattleAnimArgs[argId])
|
if (valueToCheck == gBattleAnimArgs[argId])
|
||||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr + 3);
|
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr + 3);
|
||||||
else
|
else
|
||||||
sBattleAnimScriptPtr += 7;
|
sBattleAnimScriptPtr += 7;
|
||||||
}
|
}
|
||||||
@ -1681,7 +1677,7 @@ static void ScriptCmd_jumpifcontest(void)
|
|||||||
{
|
{
|
||||||
sBattleAnimScriptPtr++;
|
sBattleAnimScriptPtr++;
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||||
else
|
else
|
||||||
sBattleAnimScriptPtr += 4;
|
sBattleAnimScriptPtr += 4;
|
||||||
}
|
}
|
||||||
@ -1689,19 +1685,19 @@ static void ScriptCmd_jumpifcontest(void)
|
|||||||
static void ScriptCmd_monbgprio_28(void)
|
static void ScriptCmd_monbgprio_28(void)
|
||||||
{
|
{
|
||||||
u8 wantedBank;
|
u8 wantedBank;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
u8 bankIdentity;
|
u8 battlerPosition;
|
||||||
|
|
||||||
wantedBank = sBattleAnimScriptPtr[1];
|
wantedBank = sBattleAnimScriptPtr[1];
|
||||||
sBattleAnimScriptPtr += 2;
|
sBattleAnimScriptPtr += 2;
|
||||||
|
|
||||||
if (wantedBank != ANIM_ATTACKER)
|
if (wantedBank != ANIM_ATTACKER)
|
||||||
bank = gBattleAnimTarget;
|
battlerId = gBattleAnimTarget;
|
||||||
else
|
else
|
||||||
bank = gBattleAnimAttacker;
|
battlerId = gBattleAnimAttacker;
|
||||||
|
|
||||||
bankIdentity = GetBattlerPosition(bank);
|
battlerPosition = GetBattlerPosition(battlerId);
|
||||||
if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT))
|
if (!IsContest() && (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_OPPONENT_RIGHT))
|
||||||
{
|
{
|
||||||
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
||||||
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);
|
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);
|
||||||
@ -1721,20 +1717,20 @@ static void ScriptCmd_monbgprio_29(void)
|
|||||||
static void ScriptCmd_monbgprio_2A(void)
|
static void ScriptCmd_monbgprio_2A(void)
|
||||||
{
|
{
|
||||||
u8 wantedBank;
|
u8 wantedBank;
|
||||||
u8 bankIdentity;
|
u8 battlerPosition;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
wantedBank = sBattleAnimScriptPtr[1];
|
wantedBank = sBattleAnimScriptPtr[1];
|
||||||
sBattleAnimScriptPtr += 2;
|
sBattleAnimScriptPtr += 2;
|
||||||
if (GetBattlerSide(gBattleAnimAttacker) != GetBattlerSide(gBattleAnimTarget))
|
if (GetBattlerSide(gBattleAnimAttacker) != GetBattlerSide(gBattleAnimTarget))
|
||||||
{
|
{
|
||||||
if (wantedBank != ANIM_ATTACKER)
|
if (wantedBank != ANIM_ATTACKER)
|
||||||
bank = gBattleAnimTarget;
|
battlerId = gBattleAnimTarget;
|
||||||
else
|
else
|
||||||
bank = gBattleAnimAttacker;
|
battlerId = gBattleAnimAttacker;
|
||||||
|
|
||||||
bankIdentity = GetBattlerPosition(bank);
|
battlerPosition = GetBattlerPosition(battlerId);
|
||||||
if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT))
|
if (!IsContest() && (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_OPPONENT_RIGHT))
|
||||||
{
|
{
|
||||||
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
||||||
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);
|
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);
|
||||||
|
@ -33,7 +33,7 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
|||||||
|
|
||||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||||
|
|
||||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||||
extern void sub_806A068(u16, u8);
|
extern void sub_806A068(u16, u8);
|
||||||
extern void sub_81851A8(u8 *);
|
extern void sub_81851A8(u8 *);
|
||||||
extern u16 sub_8068B48(void);
|
extern u16 sub_8068B48(void);
|
||||||
@ -103,7 +103,7 @@ static void LinkOpponentBufferExecCompleted(void);
|
|||||||
static void sub_8064DD0(void);
|
static void sub_8064DD0(void);
|
||||||
static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst);
|
static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst);
|
||||||
static void SetLinkOpponentMonData(u8 monId);
|
static void SetLinkOpponentMonData(u8 monId);
|
||||||
static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit);
|
static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||||
static void DoSwitchOutAnimation(void);
|
static void DoSwitchOutAnimation(void);
|
||||||
static void LinkOpponentDoMoveAnimation(void);
|
static void LinkOpponentDoMoveAnimation(void);
|
||||||
static void sub_8067618(u8 taskId);
|
static void sub_8067618(u8 taskId);
|
||||||
@ -1159,36 +1159,36 @@ static void LinkOpponentHandleSwitchInAnim(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = sub_8064F40;
|
gBattlerControllerFuncs[gActiveBattler] = sub_8064F40;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit)
|
static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
|
|
||||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank);
|
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||||
sub_806A068(species, GetBattlerPosition(bank));
|
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||||
|
|
||||||
gBattlerSpriteIds[bank] = CreateSprite(
|
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||||
&gUnknown_0202499C,
|
&gUnknown_0202499C,
|
||||||
GetBattlerSpriteCoord(bank, 2),
|
GetBattlerSpriteCoord(battlerId, 2),
|
||||||
GetBattlerSpriteDefault_Y(bank),
|
GetBattlerSpriteDefault_Y(battlerId),
|
||||||
sub_80A82E4(bank));
|
sub_80A82E4(battlerId));
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||||
|
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LinkOpponentHandleReturnMonToBall(void)
|
static void LinkOpponentHandleReturnMonToBall(void)
|
||||||
@ -1337,7 +1337,7 @@ static void LinkOpponentHandleTrainerSlide(void)
|
|||||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
|
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
|
||||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
|
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
|
||||||
|
|
||||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle bank function
|
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle battlerId function
|
||||||
LinkOpponentBufferExecCompleted();
|
LinkOpponentBufferExecCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1548,11 +1548,11 @@ static void LinkOpponentHandleStatusIconUpdate(void)
|
|||||||
{
|
{
|
||||||
if (!mplay_80342A4(gActiveBattler))
|
if (!mplay_80342A4(gActiveBattler))
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||||
bank = gActiveBattler;
|
battlerId = gActiveBattler;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
|||||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||||
|
|
||||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||||
extern void sub_806A068(u16, u8);
|
extern void sub_806A068(u16, u8);
|
||||||
extern void sub_81851A8(u8 *);
|
extern void sub_81851A8(u8 *);
|
||||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||||
@ -101,7 +101,7 @@ static void LinkPartnerBufferExecCompleted(void);
|
|||||||
static void sub_814B554(void);
|
static void sub_814B554(void);
|
||||||
static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst);
|
static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst);
|
||||||
static void SetLinkPartnerMonData(u8 monId);
|
static void SetLinkPartnerMonData(u8 monId);
|
||||||
static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit);
|
static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||||
static void DoSwitchOutAnimation(void);
|
static void DoSwitchOutAnimation(void);
|
||||||
static void LinkPartnerDoMoveAnimation(void);
|
static void LinkPartnerDoMoveAnimation(void);
|
||||||
static void sub_814DCCC(u8 taskId);
|
static void sub_814DCCC(u8 taskId);
|
||||||
@ -1045,35 +1045,35 @@ static void LinkPartnerHandleSwitchInAnim(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = sub_814B69C;
|
gBattlerControllerFuncs[gActiveBattler] = sub_814B69C;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit)
|
static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
|
|
||||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||||
sub_806A068(species, GetBattlerPosition(bank));
|
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||||
|
|
||||||
gBattlerSpriteIds[bank] = CreateSprite(
|
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||||
&gUnknown_0202499C,
|
&gUnknown_0202499C,
|
||||||
GetBattlerSpriteCoord(bank, 2),
|
GetBattlerSpriteCoord(battlerId, 2),
|
||||||
GetBattlerSpriteDefault_Y(bank),
|
GetBattlerSpriteDefault_Y(battlerId),
|
||||||
sub_80A82E4(bank));
|
sub_80A82E4(battlerId));
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||||
|
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LinkPartnerHandleReturnMonToBall(void)
|
static void LinkPartnerHandleReturnMonToBall(void)
|
||||||
@ -1372,11 +1372,11 @@ static void LinkPartnerHandleStatusIconUpdate(void)
|
|||||||
{
|
{
|
||||||
if (!mplay_80342A4(gActiveBattler))
|
if (!mplay_80342A4(gActiveBattler))
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||||
bank = gActiveBattler;
|
battlerId = gActiveBattler;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
|||||||
|
|
||||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||||
|
|
||||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||||
extern void sub_806A068(u16, u8);
|
extern void sub_806A068(u16, u8);
|
||||||
extern void sub_81A57E4(u8 bank, u16 stringId);
|
extern void sub_81A57E4(u8 battlerId, u16 stringId);
|
||||||
extern u8 sub_81A4CB0(void);
|
extern u8 sub_81A4CB0(void);
|
||||||
extern u8 sub_81D5588(u16 trainerId);
|
extern u8 sub_81D5588(u16 trainerId);
|
||||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||||
@ -108,7 +108,7 @@ static void OpponentBufferExecCompleted(void);
|
|||||||
static void sub_805FC80(void);
|
static void sub_805FC80(void);
|
||||||
static u32 GetOpponentMonData(u8 monId, u8 *dst);
|
static u32 GetOpponentMonData(u8 monId, u8 *dst);
|
||||||
static void SetOpponentMonData(u8 monId);
|
static void SetOpponentMonData(u8 monId);
|
||||||
static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit);
|
static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||||
static void DoSwitchOutAnimation(void);
|
static void DoSwitchOutAnimation(void);
|
||||||
static void OpponentDoMoveAnimation(void);
|
static void OpponentDoMoveAnimation(void);
|
||||||
static void sub_806280C(struct Sprite *sprite);
|
static void sub_806280C(struct Sprite *sprite);
|
||||||
@ -1153,36 +1153,36 @@ static void OpponentHandleSwitchInAnim(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = sub_805FDF0;
|
gBattlerControllerFuncs[gActiveBattler] = sub_805FDF0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit)
|
static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
|
|
||||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank);
|
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||||
sub_806A068(species, GetBattlerPosition(bank));
|
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||||
|
|
||||||
gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
|
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
|
||||||
GetBattlerSpriteCoord(bank, 2),
|
GetBattlerSpriteCoord(battlerId, 2),
|
||||||
GetBattlerSpriteDefault_Y(bank),
|
GetBattlerSpriteDefault_Y(battlerId),
|
||||||
sub_80A82E4(bank));
|
sub_80A82E4(battlerId));
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||||
|
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OpponentHandleReturnMonToBall(void)
|
static void OpponentHandleReturnMonToBall(void)
|
||||||
@ -1697,11 +1697,11 @@ static void OpponentHandleStatusIconUpdate(void)
|
|||||||
{
|
{
|
||||||
if (!mplay_80342A4(gActiveBattler))
|
if (!mplay_80342A4(gActiveBattler))
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||||
bank = gActiveBattler;
|
battlerId = gActiveBattler;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,11 @@ extern struct SpriteTemplate gUnknown_0202499C;
|
|||||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||||
|
|
||||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||||
extern void sub_81B89AC(u8 arg0);
|
extern void sub_81B89AC(u8 arg0);
|
||||||
extern void sub_81AABB0(void);
|
extern void sub_81AABB0(void);
|
||||||
extern void sub_806A068(u16, u8);
|
extern void sub_806A068(u16, u8);
|
||||||
extern void sub_81A57E4(u8 bank, u16 stringId);
|
extern void sub_81A57E4(u8 battlerId, u16 stringId);
|
||||||
extern void sub_81851A8(u8 *);
|
extern void sub_81851A8(u8 *);
|
||||||
|
|
||||||
// this file's functions
|
// this file's functions
|
||||||
@ -130,7 +130,7 @@ static void sub_80595A4(u8 taskId);
|
|||||||
static void PrintLinkStandbyMsg(void);
|
static void PrintLinkStandbyMsg(void);
|
||||||
static u32 CopyPlayerMonData(u8 monId, u8 *dst);
|
static u32 CopyPlayerMonData(u8 monId, u8 *dst);
|
||||||
static void SetPlayerMonData(u8 monId);
|
static void SetPlayerMonData(u8 monId);
|
||||||
static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit);
|
static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||||
static void DoSwitchOutAnimation(void);
|
static void DoSwitchOutAnimation(void);
|
||||||
static void PlayerDoMoveAnimation(void);
|
static void PlayerDoMoveAnimation(void);
|
||||||
static void task05_08033660(u8 taskId);
|
static void task05_08033660(u8 taskId);
|
||||||
@ -1149,10 +1149,10 @@ static void CompleteOnInactiveTextPrinter(void)
|
|||||||
static void Task_GiveExpToMon(u8 taskId)
|
static void Task_GiveExpToMon(u8 taskId)
|
||||||
{
|
{
|
||||||
u32 monId = (u8)(gTasks[taskId].tExpTask_monId);
|
u32 monId = (u8)(gTasks[taskId].tExpTask_monId);
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[bank]) // give exp without the expbar
|
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // give exp without the expbar
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = &gPlayerParty[monId];
|
struct Pokemon *mon = &gPlayerParty[monId];
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
@ -1168,12 +1168,12 @@ static void Task_GiveExpToMon(u8 taskId)
|
|||||||
CalculateMonStats(mon);
|
CalculateMonStats(mon);
|
||||||
gainedExp -= nextLvlExp - currExp;
|
gainedExp -= nextLvlExp - currExp;
|
||||||
savedActiveBank = gActiveBattler;
|
savedActiveBank = gActiveBattler;
|
||||||
gActiveBattler = bank;
|
gActiveBattler = battlerId;
|
||||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||||
gActiveBattler = savedActiveBank;
|
gActiveBattler = savedActiveBank;
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE
|
if (IsDoubleBattle() == TRUE
|
||||||
&& ((u16)(monId) == gBattlerPartyIndexes[bank] || (u16)(monId) == gBattlerPartyIndexes[bank ^ BIT_FLANK]))
|
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]))
|
||||||
gTasks[taskId].func = sub_8059544;
|
gTasks[taskId].func = sub_8059544;
|
||||||
else
|
else
|
||||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||||
@ -1182,7 +1182,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
|||||||
{
|
{
|
||||||
currExp += gainedExp;
|
currExp += gainedExp;
|
||||||
SetMonData(mon, MON_DATA_EXP, &currExp);
|
SetMonData(mon, MON_DATA_EXP, &currExp);
|
||||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1196,7 +1196,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
|||||||
{
|
{
|
||||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||||
s32 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
s32 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
struct Pokemon *mon = &gPlayerParty[monIndex];
|
struct Pokemon *mon = &gPlayerParty[monIndex];
|
||||||
u8 level = GetMonData(mon, MON_DATA_LEVEL);
|
u8 level = GetMonData(mon, MON_DATA_LEVEL);
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
@ -1206,7 +1206,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
|||||||
|
|
||||||
exp -= currLvlExp;
|
exp -= currLvlExp;
|
||||||
expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp;
|
expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp;
|
||||||
SetBattleBarStruct(bank, gHealthboxSpriteIds[bank], expToNextLvl, exp, -gainedExp);
|
SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp);
|
||||||
PlaySE(SE_EXP);
|
PlaySE(SE_EXP);
|
||||||
gTasks[taskId].func = sub_8059400;
|
gTasks[taskId].func = sub_8059400;
|
||||||
}
|
}
|
||||||
@ -1221,11 +1221,11 @@ static void sub_8059400(u8 taskId)
|
|||||||
{
|
{
|
||||||
u8 monId = gTasks[taskId].tExpTask_monId;
|
u8 monId = gTasks[taskId].tExpTask_monId;
|
||||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
s16 r4;
|
s16 r4;
|
||||||
|
|
||||||
r4 = sub_8074AA0(bank, gHealthboxSpriteIds[bank], EXP_BAR, 0);
|
r4 = sub_8074AA0(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
|
||||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[bank]);
|
SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]);
|
||||||
if (r4 == -1)
|
if (r4 == -1)
|
||||||
{
|
{
|
||||||
u8 level;
|
u8 level;
|
||||||
@ -1247,7 +1247,7 @@ static void sub_8059400(u8 taskId)
|
|||||||
CalculateMonStats(&gPlayerParty[monId]);
|
CalculateMonStats(&gPlayerParty[monId]);
|
||||||
gainedExp -= expOnNextLvl - currExp;
|
gainedExp -= expOnNextLvl - currExp;
|
||||||
savedActiveBank = gActiveBattler;
|
savedActiveBank = gActiveBattler;
|
||||||
gActiveBattler = bank;
|
gActiveBattler = battlerId;
|
||||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||||
gActiveBattler = savedActiveBank;
|
gActiveBattler = savedActiveBank;
|
||||||
gTasks[taskId].func = sub_8059544;
|
gTasks[taskId].func = sub_8059544;
|
||||||
@ -1256,7 +1256,7 @@ static void sub_8059400(u8 taskId)
|
|||||||
{
|
{
|
||||||
currExp += gainedExp;
|
currExp += gainedExp;
|
||||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp);
|
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp);
|
||||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1265,30 +1265,30 @@ static void sub_8059400(u8 taskId)
|
|||||||
|
|
||||||
static void sub_8059544(u8 taskId)
|
static void sub_8059544(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||||
bank ^= BIT_FLANK;
|
battlerId ^= BIT_FLANK;
|
||||||
|
|
||||||
InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP);
|
InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP);
|
||||||
gTasks[taskId].func = sub_80595A4;
|
gTasks[taskId].func = sub_80595A4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80595A4(u8 taskId)
|
static void sub_80595A4(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
|
|
||||||
if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive)
|
if (!gBattleSpritesDataPtr->healthBoxesData[battlerId].specialAnimActive)
|
||||||
{
|
{
|
||||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||||
|
|
||||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||||
else
|
else
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||||
|
|
||||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||||
}
|
}
|
||||||
@ -1297,12 +1297,12 @@ static void sub_80595A4(u8 taskId)
|
|||||||
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 monIndex;
|
u8 monIndex;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
monIndex = gTasks[taskId].tExpTask_monId;
|
monIndex = gTasks[taskId].tExpTask_monId;
|
||||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||||
bank = gTasks[taskId].tExpTask_bank;
|
battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2191,35 +2191,35 @@ static void PlayerHandleSwitchInAnim(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = sub_805902C;
|
gBattlerControllerFuncs[gActiveBattler] = sub_805902C;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit)
|
static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
|
|
||||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||||
sub_806A068(species, GetBattlerPosition(bank));
|
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||||
|
|
||||||
gBattlerSpriteIds[bank] = CreateSprite(
|
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||||
&gUnknown_0202499C,
|
&gUnknown_0202499C,
|
||||||
GetBattlerSpriteCoord(bank, 2),
|
GetBattlerSpriteCoord(battlerId, 2),
|
||||||
GetBattlerSpriteDefault_Y(bank),
|
GetBattlerSpriteDefault_Y(battlerId),
|
||||||
sub_80A82E4(bank));
|
sub_80A82E4(battlerId));
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||||
|
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PlayerHandleReturnMonToBall(void)
|
static void PlayerHandleReturnMonToBall(void)
|
||||||
@ -2741,11 +2741,11 @@ static void PlayerHandleStatusIconUpdate(void)
|
|||||||
{
|
{
|
||||||
if (!mplay_80342A4(gActiveBattler))
|
if (!mplay_80342A4(gActiveBattler))
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||||
bank = gActiveBattler;
|
battlerId = gActiveBattler;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2954,13 +2954,13 @@ static void PlayerHandleIntroTrainerBallThrow(void)
|
|||||||
|
|
||||||
void sub_805CC00(struct Sprite *sprite)
|
void sub_805CC00(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
u8 bank = sprite->data[5];
|
u8 battlerId = sprite->data[5];
|
||||||
|
|
||||||
FreeSpriteOamMatrix(sprite);
|
FreeSpriteOamMatrix(sprite);
|
||||||
FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum));
|
FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum));
|
||||||
DestroySprite(sprite);
|
DestroySprite(sprite);
|
||||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[bank]], bank);
|
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], 0);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void task05_08033660(u8 taskId)
|
static void task05_08033660(u8 taskId)
|
||||||
|
@ -33,7 +33,7 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
|||||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||||
|
|
||||||
extern void sub_81358F4(void);
|
extern void sub_81358F4(void);
|
||||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||||
extern void sub_806A068(u16, u8);
|
extern void sub_806A068(u16, u8);
|
||||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ static void sub_81BB688(u8 taskId);
|
|||||||
static void sub_81BB9A0(void);
|
static void sub_81BB9A0(void);
|
||||||
static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst);
|
static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst);
|
||||||
static void SetPlayerPartnerMonData(u8 monId);
|
static void SetPlayerPartnerMonData(u8 monId);
|
||||||
static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit);
|
static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||||
static void DoSwitchOutAnimation(void);
|
static void DoSwitchOutAnimation(void);
|
||||||
static void PlayerPartnerDoMoveAnimation(void);
|
static void PlayerPartnerDoMoveAnimation(void);
|
||||||
static void sub_81BE2C8(u8 taskId);
|
static void sub_81BE2C8(u8 taskId);
|
||||||
@ -324,10 +324,10 @@ static void CompleteOnInactiveTextPrinter(void)
|
|||||||
static void Task_GiveExpToMon(u8 taskId)
|
static void Task_GiveExpToMon(u8 taskId)
|
||||||
{
|
{
|
||||||
u32 monId = (u8)(gTasks[taskId].tExpTask_monId);
|
u32 monId = (u8)(gTasks[taskId].tExpTask_monId);
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[bank]) // give exp without the expbar
|
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // give exp without the expbar
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = &gPlayerParty[monId];
|
struct Pokemon *mon = &gPlayerParty[monId];
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
@ -343,12 +343,12 @@ static void Task_GiveExpToMon(u8 taskId)
|
|||||||
CalculateMonStats(mon);
|
CalculateMonStats(mon);
|
||||||
gainedExp -= nextLvlExp - currExp;
|
gainedExp -= nextLvlExp - currExp;
|
||||||
savedActiveBank = gActiveBattler;
|
savedActiveBank = gActiveBattler;
|
||||||
gActiveBattler = bank;
|
gActiveBattler = battlerId;
|
||||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||||
gActiveBattler = savedActiveBank;
|
gActiveBattler = savedActiveBank;
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE
|
if (IsDoubleBattle() == TRUE
|
||||||
&& ((u16)(monId) == gBattlerPartyIndexes[bank] || (u16)(monId) == gBattlerPartyIndexes[bank ^ BIT_FLANK]))
|
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]))
|
||||||
gTasks[taskId].func = sub_81BB628;
|
gTasks[taskId].func = sub_81BB628;
|
||||||
else
|
else
|
||||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||||
@ -357,7 +357,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
|||||||
{
|
{
|
||||||
currExp += gainedExp;
|
currExp += gainedExp;
|
||||||
SetMonData(mon, MON_DATA_EXP, &currExp);
|
SetMonData(mon, MON_DATA_EXP, &currExp);
|
||||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
|||||||
{
|
{
|
||||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||||
s32 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
s32 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
struct Pokemon *mon = &gPlayerParty[monIndex];
|
struct Pokemon *mon = &gPlayerParty[monIndex];
|
||||||
u8 level = GetMonData(mon, MON_DATA_LEVEL);
|
u8 level = GetMonData(mon, MON_DATA_LEVEL);
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
@ -381,7 +381,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
|||||||
|
|
||||||
exp -= currLvlExp;
|
exp -= currLvlExp;
|
||||||
expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp;
|
expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp;
|
||||||
SetBattleBarStruct(bank, gHealthboxSpriteIds[bank], expToNextLvl, exp, -gainedExp);
|
SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp);
|
||||||
PlaySE(SE_EXP);
|
PlaySE(SE_EXP);
|
||||||
gTasks[taskId].func = sub_81BB4E4;
|
gTasks[taskId].func = sub_81BB4E4;
|
||||||
}
|
}
|
||||||
@ -396,11 +396,11 @@ static void sub_81BB4E4(u8 taskId)
|
|||||||
{
|
{
|
||||||
u8 monId = gTasks[taskId].tExpTask_monId;
|
u8 monId = gTasks[taskId].tExpTask_monId;
|
||||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
s16 r4;
|
s16 r4;
|
||||||
|
|
||||||
r4 = sub_8074AA0(bank, gHealthboxSpriteIds[bank], EXP_BAR, 0);
|
r4 = sub_8074AA0(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
|
||||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[bank]);
|
SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]);
|
||||||
if (r4 == -1)
|
if (r4 == -1)
|
||||||
{
|
{
|
||||||
u8 level;
|
u8 level;
|
||||||
@ -422,7 +422,7 @@ static void sub_81BB4E4(u8 taskId)
|
|||||||
CalculateMonStats(&gPlayerParty[monId]);
|
CalculateMonStats(&gPlayerParty[monId]);
|
||||||
gainedExp -= expOnNextLvl - currExp;
|
gainedExp -= expOnNextLvl - currExp;
|
||||||
savedActiveBank = gActiveBattler;
|
savedActiveBank = gActiveBattler;
|
||||||
gActiveBattler = bank;
|
gActiveBattler = battlerId;
|
||||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||||
gActiveBattler = savedActiveBank;
|
gActiveBattler = savedActiveBank;
|
||||||
gTasks[taskId].func = sub_81BB628;
|
gTasks[taskId].func = sub_81BB628;
|
||||||
@ -431,7 +431,7 @@ static void sub_81BB4E4(u8 taskId)
|
|||||||
{
|
{
|
||||||
currExp += gainedExp;
|
currExp += gainedExp;
|
||||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp);
|
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp);
|
||||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,30 +440,30 @@ static void sub_81BB4E4(u8 taskId)
|
|||||||
|
|
||||||
static void sub_81BB628(u8 taskId)
|
static void sub_81BB628(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||||
bank ^= BIT_FLANK;
|
battlerId ^= BIT_FLANK;
|
||||||
|
|
||||||
InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP);
|
InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP);
|
||||||
gTasks[taskId].func = sub_81BB688;
|
gTasks[taskId].func = sub_81BB688;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81BB688(u8 taskId)
|
static void sub_81BB688(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
|
|
||||||
if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive)
|
if (!gBattleSpritesDataPtr->healthBoxesData[battlerId].specialAnimActive)
|
||||||
{
|
{
|
||||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||||
|
|
||||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||||
else
|
else
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||||
|
|
||||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||||
}
|
}
|
||||||
@ -472,12 +472,12 @@ static void sub_81BB688(u8 taskId)
|
|||||||
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 monIndex;
|
u8 monIndex;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
monIndex = gTasks[taskId].tExpTask_monId;
|
monIndex = gTasks[taskId].tExpTask_monId;
|
||||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||||
bank = gTasks[taskId].tExpTask_bank;
|
battlerId = gTasks[taskId].tExpTask_bank;
|
||||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1232,35 +1232,35 @@ static void PlayerPartnerHandleSwitchInAnim(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = sub_81BBAE8;
|
gBattlerControllerFuncs[gActiveBattler] = sub_81BBAE8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit)
|
static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
|
|
||||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||||
sub_806A068(species, GetBattlerPosition(bank));
|
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||||
|
|
||||||
gBattlerSpriteIds[bank] = CreateSprite(
|
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||||
&gUnknown_0202499C,
|
&gUnknown_0202499C,
|
||||||
GetBattlerSpriteCoord(bank, 2),
|
GetBattlerSpriteCoord(battlerId, 2),
|
||||||
GetBattlerSpriteDefault_Y(bank),
|
GetBattlerSpriteDefault_Y(battlerId),
|
||||||
sub_80A82E4(bank));
|
sub_80A82E4(battlerId));
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||||
|
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PlayerPartnerHandleReturnMonToBall(void)
|
static void PlayerPartnerHandleReturnMonToBall(void)
|
||||||
@ -1625,11 +1625,11 @@ static void PlayerPartnerHandleStatusIconUpdate(void)
|
|||||||
{
|
{
|
||||||
if (!mplay_80342A4(gActiveBattler))
|
if (!mplay_80342A4(gActiveBattler))
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||||
bank = gActiveBattler;
|
battlerId = gActiveBattler;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ extern u8 gUnknown_0203C7B4;
|
|||||||
|
|
||||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||||
|
|
||||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||||
extern void sub_806A068(u16, u8);
|
extern void sub_806A068(u16, u8);
|
||||||
extern u16 sub_8068B48(void);
|
extern u16 sub_8068B48(void);
|
||||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||||
@ -104,7 +104,7 @@ static void RecordedOpponentBufferExecCompleted(void);
|
|||||||
static void sub_8186F14(void);
|
static void sub_8186F14(void);
|
||||||
static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst);
|
static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst);
|
||||||
static void SetRecordedOpponentMonData(u8 monId);
|
static void SetRecordedOpponentMonData(u8 monId);
|
||||||
static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit);
|
static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||||
static void DoSwitchOutAnimation(void);
|
static void DoSwitchOutAnimation(void);
|
||||||
static void RecordedOpponentDoMoveAnimation(void);
|
static void RecordedOpponentDoMoveAnimation(void);
|
||||||
static void sub_8189548(u8 taskId);
|
static void sub_8189548(u8 taskId);
|
||||||
@ -1144,35 +1144,35 @@ static void RecordedOpponentHandleSwitchInAnim(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = sub_8187084;
|
gBattlerControllerFuncs[gActiveBattler] = sub_8187084;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit)
|
static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
|
|
||||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank);
|
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||||
sub_806A068(species, GetBattlerPosition(bank));
|
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||||
|
|
||||||
gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
|
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
|
||||||
GetBattlerSpriteCoord(bank, 2),
|
GetBattlerSpriteCoord(battlerId, 2),
|
||||||
GetBattlerSpriteDefault_Y(bank),
|
GetBattlerSpriteDefault_Y(battlerId),
|
||||||
sub_80A82E4(bank));
|
sub_80A82E4(battlerId));
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||||
|
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RecordedOpponentHandleReturnMonToBall(void)
|
static void RecordedOpponentHandleReturnMonToBall(void)
|
||||||
@ -1490,11 +1490,11 @@ static void RecordedOpponentHandleStatusIconUpdate(void)
|
|||||||
{
|
{
|
||||||
if (!mplay_80342A4(gActiveBattler))
|
if (!mplay_80342A4(gActiveBattler))
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||||
bank = gActiveBattler;
|
battlerId = gActiveBattler;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
|||||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||||
|
|
||||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||||
extern void sub_806A068(u16, u8);
|
extern void sub_806A068(u16, u8);
|
||||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ static void RecordedPlayerBufferExecCompleted(void);
|
|||||||
static void sub_818A328(void);
|
static void sub_818A328(void);
|
||||||
static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst);
|
static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst);
|
||||||
static void SetRecordedPlayerMonData(u8 monId);
|
static void SetRecordedPlayerMonData(u8 monId);
|
||||||
static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit);
|
static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||||
static void DoSwitchOutAnimation(void);
|
static void DoSwitchOutAnimation(void);
|
||||||
static void RecordedPlayerDoMoveAnimation(void);
|
static void RecordedPlayerDoMoveAnimation(void);
|
||||||
static void sub_818CC24(u8 taskId);
|
static void sub_818CC24(u8 taskId);
|
||||||
@ -1129,35 +1129,35 @@ static void RecordedPlayerHandleSwitchInAnim(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = sub_818A470;
|
gBattlerControllerFuncs[gActiveBattler] = sub_818A470;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit)
|
static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
|
|
||||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||||
sub_806A068(species, GetBattlerPosition(bank));
|
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||||
|
|
||||||
gBattlerSpriteIds[bank] = CreateSprite(
|
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||||
&gUnknown_0202499C,
|
&gUnknown_0202499C,
|
||||||
GetBattlerSpriteCoord(bank, 2),
|
GetBattlerSpriteCoord(battlerId, 2),
|
||||||
GetBattlerSpriteDefault_Y(bank),
|
GetBattlerSpriteDefault_Y(battlerId),
|
||||||
sub_80A82E4(bank));
|
sub_80A82E4(battlerId));
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||||
|
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RecordedPlayerHandleReturnMonToBall(void)
|
static void RecordedPlayerHandleReturnMonToBall(void)
|
||||||
@ -1512,11 +1512,11 @@ static void RecordedPlayerHandleStatusIconUpdate(void)
|
|||||||
{
|
{
|
||||||
if (!mplay_80342A4(gActiveBattler))
|
if (!mplay_80342A4(gActiveBattler))
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||||
bank = gActiveBattler;
|
battlerId = gActiveBattler;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
|||||||
|
|
||||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||||
|
|
||||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||||
extern void sub_806A068(u16, u8);
|
extern void sub_806A068(u16, u8);
|
||||||
|
|
||||||
// this file's functions
|
// this file's functions
|
||||||
@ -1457,31 +1457,31 @@ static void WallyHandleIntroTrainerBallThrow(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
|
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_816AA80(u8 bank)
|
static void sub_816AA80(u8 battlerId)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
|
|
||||||
gBattleSpritesDataPtr->battlerData[bank].transformSpecies = 0;
|
gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies = 0;
|
||||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||||
sub_806A068(species, GetBattlerPosition(bank));
|
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||||
gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
|
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
|
||||||
GetBattlerSpriteCoord(bank, 2),
|
GetBattlerSpriteCoord(battlerId, 2),
|
||||||
GetBattlerSpriteDefault_Y(bank),
|
GetBattlerSpriteDefault_Y(battlerId),
|
||||||
sub_80A82E4(bank));
|
sub_80A82E4(battlerId));
|
||||||
|
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||||
|
|
||||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_816AC04(u8 taskId)
|
static void sub_816AC04(u8 taskId)
|
||||||
|
@ -18,9 +18,8 @@ extern u8 gUnknown_02022D0A;
|
|||||||
|
|
||||||
static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {};
|
static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {};
|
||||||
|
|
||||||
|
|
||||||
extern void task00_08081A90(u8 taskId); // cable_club
|
extern void task00_08081A90(u8 taskId); // cable_club
|
||||||
extern void sub_81B8D64(u8 bank, u8 arg1); // party_menu
|
extern void sub_81B8D64(u8 battlerId, u8 arg1); // party_menu
|
||||||
|
|
||||||
// this file's funcionts
|
// this file's funcionts
|
||||||
static void CreateTasksForSendRecvLinkBuffers(void);
|
static void CreateTasksForSendRecvLinkBuffers(void);
|
||||||
@ -868,7 +867,7 @@ void sub_8033648(void)
|
|||||||
static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
|
static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
|
||||||
{
|
{
|
||||||
u16 blockSize;
|
u16 blockSize;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
u8 var;
|
u8 var;
|
||||||
|
|
||||||
if (gTasks[taskId].data[15] != gTasks[taskId].data[14])
|
if (gTasks[taskId].data[15] != gTasks[taskId].data[14])
|
||||||
@ -879,17 +878,17 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
|
|||||||
gTasks[taskId].data[12] = 0;
|
gTasks[taskId].data[12] = 0;
|
||||||
gTasks[taskId].data[15] = 0;
|
gTasks[taskId].data[15] = 0;
|
||||||
}
|
}
|
||||||
bank = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ACTIVE_BANK];
|
battlerId = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ACTIVE_BANK];
|
||||||
blockSize = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_LO] | (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_HI] << 8);
|
blockSize = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_LO] | (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_HI] << 8);
|
||||||
|
|
||||||
switch (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 0])
|
switch (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 0])
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (gBattleControllerExecFlags & gBitTable[bank])
|
if (gBattleControllerExecFlags & gBitTable[battlerId])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memcpy(gBattleBufferA[bank], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize);
|
memcpy(gBattleBufferA[battlerId], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize);
|
||||||
sub_803F850(bank);
|
sub_803F850(battlerId);
|
||||||
|
|
||||||
if (!(gBattleTypeFlags & BATTLE_TYPE_WILD))
|
if (!(gBattleTypeFlags & BATTLE_TYPE_WILD))
|
||||||
{
|
{
|
||||||
@ -900,11 +899,11 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
memcpy(gBattleBufferB[bank], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize);
|
memcpy(gBattleBufferB[battlerId], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
var = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA];
|
var = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA];
|
||||||
gBattleControllerExecFlags &= ~(gBitTable[bank] << (var * 4));
|
gBattleControllerExecFlags &= ~(gBitTable[battlerId] << (var * 4));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "safari_zone.h"
|
#include "safari_zone.h"
|
||||||
#include "battle_anim.h"
|
#include "battle_anim.h"
|
||||||
#include "constants/rgb.h"
|
#include "constants/rgb.h"
|
||||||
|
#include "data2.h"
|
||||||
|
|
||||||
struct TestingBar
|
struct TestingBar
|
||||||
{
|
{
|
||||||
@ -154,7 +155,6 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern const u8 * const gNatureNamePointers[];
|
extern const u8 * const gNatureNamePointers[];
|
||||||
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
|
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
extern const u8 gText_Slash[];
|
extern const u8 gText_Slash[];
|
||||||
@ -162,8 +162,6 @@ extern const u8 gText_HighlightDarkGrey[];
|
|||||||
extern const u8 gText_DynColor2[];
|
extern const u8 gText_DynColor2[];
|
||||||
extern const u8 gText_DynColor2Male[];
|
extern const u8 gText_DynColor2Male[];
|
||||||
extern const u8 gText_DynColor1Female[];
|
extern const u8 gText_DynColor1Female[];
|
||||||
extern const u8 gText_SafariBalls[];
|
|
||||||
extern const u8 gText_SafariBallLeft[];
|
|
||||||
|
|
||||||
// graphics
|
// graphics
|
||||||
extern const u8 gBattleInterface_BallStatusBarGfx[];
|
extern const u8 gBattleInterface_BallStatusBarGfx[];
|
||||||
@ -198,10 +196,10 @@ static void SpriteCB_StatusSummaryBar(struct Sprite *sprite);
|
|||||||
static void SpriteCB_StatusSummaryBallsOnBattleStart(struct Sprite *sprite);
|
static void SpriteCB_StatusSummaryBallsOnBattleStart(struct Sprite *sprite);
|
||||||
static void SpriteCB_StatusSummaryBallsOnSwitchout(struct Sprite *sprite);
|
static void SpriteCB_StatusSummaryBallsOnSwitchout(struct Sprite *sprite);
|
||||||
|
|
||||||
static u8 GetStatusIconForBankId(u8 statusElementId, u8 bank);
|
static u8 GetStatusIconForBankId(u8 statusElementId, u8 battlerId);
|
||||||
static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5);
|
static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5);
|
||||||
static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale);
|
static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale);
|
||||||
static void sub_8074B9C(u8 bank, u8 whichBar);
|
static void sub_8074B9C(u8 battlerId, u8 whichBar);
|
||||||
static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 *arg4, u8 arg5);
|
static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 *arg4, u8 arg5);
|
||||||
static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2);
|
static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2);
|
||||||
|
|
||||||
@ -1034,13 +1032,13 @@ static void sub_8072924(struct Sprite *sprite)
|
|||||||
sprite->pos2.y = gSprites[otherSpriteId].pos2.y;
|
sprite->pos2.y = gSprites[otherSpriteId].pos2.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue)
|
void SetBattleBarStruct(u8 battlerId, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId = healthboxSpriteId;
|
gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId = healthboxSpriteId;
|
||||||
gBattleSpritesDataPtr->battleBars[bank].maxValue = maxVal;
|
gBattleSpritesDataPtr->battleBars[battlerId].maxValue = maxVal;
|
||||||
gBattleSpritesDataPtr->battleBars[bank].currentValue = currVal;
|
gBattleSpritesDataPtr->battleBars[battlerId].currentValue = currVal;
|
||||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue = receivedValue;
|
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue = receivedValue;
|
||||||
gBattleSpritesDataPtr->battleBars[bank].field_10 = -32768;
|
gBattleSpritesDataPtr->battleBars[battlerId].field_10 = -32768;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetHealthboxSpriteInvisible(u8 healthboxSpriteId)
|
void SetHealthboxSpriteInvisible(u8 healthboxSpriteId)
|
||||||
@ -1281,12 +1279,12 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
memcpy(text, sUnknown_0832C3D8, sizeof(sUnknown_0832C3D8));
|
memcpy(text, sUnknown_0832C3D8, sizeof(sUnknown_0832C3D8));
|
||||||
bank = gSprites[healthboxSpriteId].data[6];
|
battlerId = gSprites[healthboxSpriteId].data[6];
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].hpNumbersNoBars) // don't print text if only bars are visible
|
if (gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars) // don't print text if only bars are visible
|
||||||
{
|
{
|
||||||
u8 var = 4;
|
u8 var = 4;
|
||||||
u8 r7;
|
u8 r7;
|
||||||
@ -1327,7 +1325,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER) // impossible to reach part, because the bank is from the opponent's side
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) // impossible to reach part, because the battlerId is from the opponent's side
|
||||||
{
|
{
|
||||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_116),
|
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_116),
|
||||||
(void*)(OBJ_VRAM0) + ((gSprites[healthboxSpriteId].oam.tileNum + 52) * 32),
|
(void*)(OBJ_VRAM0) + ((gSprites[healthboxSpriteId].oam.tileNum + 52) * 32),
|
||||||
@ -1469,7 +1467,7 @@ void SwapHpBarsWithHpText(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart)
|
u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart)
|
||||||
{
|
{
|
||||||
bool8 isOpponent;
|
bool8 isOpponent;
|
||||||
s16 bar_X, bar_Y, bar_pos2_X, bar_data0;
|
s16 bar_X, bar_Y, bar_pos2_X, bar_data0;
|
||||||
@ -1478,9 +1476,9 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
|
|||||||
u8 ballIconSpritesIds[6];
|
u8 ballIconSpritesIds[6];
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
if (!arg2 || GetBattlerPosition(bank) != B_POSITION_OPPONENT_RIGHT)
|
if (!arg2 || GetBattlerPosition(battlerId) != B_POSITION_OPPONENT_RIGHT)
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
isOpponent = FALSE;
|
isOpponent = FALSE;
|
||||||
bar_X = 136, bar_Y = 96;
|
bar_X = 136, bar_Y = 96;
|
||||||
@ -1559,7 +1557,7 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
|
|||||||
gSprites[ballIconSpritesIds[i]].data[2] = isOpponent;
|
gSprites[ballIconSpritesIds[i]].data[2] = isOpponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||||
{
|
{
|
||||||
@ -1658,7 +1656,7 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
taskId = CreateTask(TaskDummy, 5);
|
taskId = CreateTask(TaskDummy, 5);
|
||||||
gTasks[taskId].data[0] = bank;
|
gTasks[taskId].data[0] = battlerId;
|
||||||
gTasks[taskId].data[1] = barSpriteId;
|
gTasks[taskId].data[1] = barSpriteId;
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
@ -1680,12 +1678,12 @@ void sub_8073C30(u8 taskId)
|
|||||||
u8 sp[6];
|
u8 sp[6];
|
||||||
u8 r7;
|
u8 r7;
|
||||||
u8 r10;
|
u8 r10;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
r7 = gTasks[taskId].data[10];
|
r7 = gTasks[taskId].data[10];
|
||||||
r10 = gTasks[taskId].data[1];
|
r10 = gTasks[taskId].data[1];
|
||||||
bank = gTasks[taskId].data[0];
|
battlerId = gTasks[taskId].data[0];
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
sp[i] = gTasks[taskId].data[3 + i];
|
sp[i] = gTasks[taskId].data[3 + i];
|
||||||
@ -1704,7 +1702,7 @@ void sub_8073C30(u8 taskId)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
gSprites[sp[5 - i]].data[1] = 7 * i;
|
gSprites[sp[5 - i]].data[1] = 7 * i;
|
||||||
gSprites[sp[5 - i]].data[3] = 0;
|
gSprites[sp[5 - i]].data[3] = 0;
|
||||||
@ -1752,7 +1750,7 @@ static void sub_8073E64(u8 taskId)
|
|||||||
u8 sp[6];
|
u8 sp[6];
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
u8 bank = gTasks[taskId].data[0];
|
u8 battlerId = gTasks[taskId].data[0];
|
||||||
gTasks[taskId].data[15]--;
|
gTasks[taskId].data[15]--;
|
||||||
if (gTasks[taskId].data[15] == -1)
|
if (gTasks[taskId].data[15] == -1)
|
||||||
{
|
{
|
||||||
@ -1780,7 +1778,7 @@ static void sub_8073E64(u8 taskId)
|
|||||||
}
|
}
|
||||||
else if (gTasks[taskId].data[15] == -3)
|
else if (gTasks[taskId].data[15] == -3)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].flag_x1 = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].flag_x1 = 0;
|
||||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
@ -1792,7 +1790,7 @@ static void sub_8073F98(u8 taskId)
|
|||||||
u8 sp[6];
|
u8 sp[6];
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
u8 bank = gTasks[taskId].data[0];
|
u8 battlerId = gTasks[taskId].data[0];
|
||||||
gTasks[taskId].data[15]--;
|
gTasks[taskId].data[15]--;
|
||||||
if (gTasks[taskId].data[15] >= 0)
|
if (gTasks[taskId].data[15] >= 0)
|
||||||
{
|
{
|
||||||
@ -1813,7 +1811,7 @@ static void sub_8073F98(u8 taskId)
|
|||||||
}
|
}
|
||||||
else if (gTasks[taskId].data[15] == -3)
|
else if (gTasks[taskId].data[15] == -3)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].flag_x1 = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].flag_x1 = 0;
|
||||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
@ -1976,17 +1974,17 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon)
|
|||||||
|
|
||||||
static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus)
|
static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus)
|
||||||
{
|
{
|
||||||
u8 bank, healthboxSpriteId_2;
|
u8 battlerId, healthboxSpriteId_2;
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
|
if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
|
||||||
return;
|
return;
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bank = gSprites[healthboxSpriteId].data[6];
|
battlerId = gSprites[healthboxSpriteId].data[6];
|
||||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||||
return;
|
return;
|
||||||
if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT))
|
if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5];
|
healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5];
|
||||||
@ -2000,17 +1998,17 @@ static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus)
|
|||||||
static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
u8 bank, healthboxSpriteId_2;
|
u8 battlerId, healthboxSpriteId_2;
|
||||||
u32 status, pltAdder;
|
u32 status, pltAdder;
|
||||||
const u8 *statusGfxPtr;
|
const u8 *statusGfxPtr;
|
||||||
s16 tileNumAdder;
|
s16 tileNumAdder;
|
||||||
u8 statusPalId;
|
u8 statusPalId;
|
||||||
|
|
||||||
bank = gSprites[healthboxSpriteId].data[6];
|
battlerId = gSprites[healthboxSpriteId].data[6];
|
||||||
healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5];
|
healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5];
|
||||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_STATUS);
|
status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS);
|
||||||
if (!IsDoubleBattle())
|
if (!IsDoubleBattle())
|
||||||
tileNumAdder = 0x1A;
|
tileNumAdder = 0x1A;
|
||||||
else
|
else
|
||||||
@ -2018,33 +2016,33 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_STATUS);
|
status = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS);
|
||||||
tileNumAdder = 0x11;
|
tileNumAdder = 0x11;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status & STATUS1_SLEEP)
|
if (status & STATUS1_SLEEP)
|
||||||
{
|
{
|
||||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_SLP_BANK0, bank));
|
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_SLP_BANK0, battlerId));
|
||||||
statusPalId = PAL_STATUS_SLP;
|
statusPalId = PAL_STATUS_SLP;
|
||||||
}
|
}
|
||||||
else if (status & STATUS1_PSN_ANY)
|
else if (status & STATUS1_PSN_ANY)
|
||||||
{
|
{
|
||||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PSN_BANK0, bank));
|
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PSN_BANK0, battlerId));
|
||||||
statusPalId = PAL_STATUS_PSN;
|
statusPalId = PAL_STATUS_PSN;
|
||||||
}
|
}
|
||||||
else if (status & STATUS1_BURN)
|
else if (status & STATUS1_BURN)
|
||||||
{
|
{
|
||||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_BRN_BANK0, bank));
|
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_BRN_BANK0, battlerId));
|
||||||
statusPalId = PAL_STATUS_BRN;
|
statusPalId = PAL_STATUS_BRN;
|
||||||
}
|
}
|
||||||
else if (status & STATUS1_FREEZE)
|
else if (status & STATUS1_FREEZE)
|
||||||
{
|
{
|
||||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_FRZ_BANK0, bank));
|
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_FRZ_BANK0, battlerId));
|
||||||
statusPalId = PAL_STATUS_FRZ;
|
statusPalId = PAL_STATUS_FRZ;
|
||||||
}
|
}
|
||||||
else if (status & STATUS1_PARALYSIS)
|
else if (status & STATUS1_PARALYSIS)
|
||||||
{
|
{
|
||||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PRZ_BANK0, bank));
|
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PRZ_BANK0, battlerId));
|
||||||
statusPalId = PAL_STATUS_PAR;
|
statusPalId = PAL_STATUS_PAR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2054,7 +2052,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder + i) * 32), 32);
|
CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder + i) * 32), 32);
|
||||||
|
|
||||||
if (!gBattleSpritesDataPtr->battlerData[bank].hpNumbersNoBars)
|
if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)
|
||||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + gSprites[healthboxSpriteId_2].oam.tileNum * 32), 64);
|
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + gSprites[healthboxSpriteId_2].oam.tileNum * 32), 64);
|
||||||
|
|
||||||
TryAddPokeballIconToHealthbox(healthboxSpriteId, TRUE);
|
TryAddPokeballIconToHealthbox(healthboxSpriteId, TRUE);
|
||||||
@ -2062,14 +2060,14 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pltAdder = gSprites[healthboxSpriteId].oam.paletteNum * 16;
|
pltAdder = gSprites[healthboxSpriteId].oam.paletteNum * 16;
|
||||||
pltAdder += bank + 12;
|
pltAdder += battlerId + 12;
|
||||||
|
|
||||||
FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2);
|
FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2);
|
||||||
CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void*)(OBJ_PLTT + pltAdder * 2), 2);
|
CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void*)(OBJ_PLTT + pltAdder * 2), 2);
|
||||||
CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * 32), 96);
|
CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * 32), 96);
|
||||||
if (IsDoubleBattle() == TRUE || GetBattlerSide(bank) == B_SIDE_OPPONENT)
|
if (IsDoubleBattle() == TRUE || GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
|
||||||
{
|
{
|
||||||
if (!gBattleSpritesDataPtr->battlerData[bank].hpNumbersNoBars)
|
if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)
|
||||||
{
|
{
|
||||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_0), (void*)(OBJ_VRAM0 + gSprites[healthboxSpriteId_2].oam.tileNum * 32), 32);
|
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_0), (void*)(OBJ_VRAM0 + gSprites[healthboxSpriteId_2].oam.tileNum * 32), 32);
|
||||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_65), (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId_2].oam.tileNum + 1) * 32), 32);
|
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_65), (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId_2].oam.tileNum + 1) * 32), 32);
|
||||||
@ -2078,58 +2076,58 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
|||||||
TryAddPokeballIconToHealthbox(healthboxSpriteId, FALSE);
|
TryAddPokeballIconToHealthbox(healthboxSpriteId, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 GetStatusIconForBankId(u8 statusElementId, u8 bank)
|
static u8 GetStatusIconForBankId(u8 statusElementId, u8 battlerId)
|
||||||
{
|
{
|
||||||
u8 ret = statusElementId;
|
u8 ret = statusElementId;
|
||||||
|
|
||||||
switch (statusElementId)
|
switch (statusElementId)
|
||||||
{
|
{
|
||||||
case HEALTHBOX_GFX_STATUS_PSN_BANK0:
|
case HEALTHBOX_GFX_STATUS_PSN_BANK0:
|
||||||
if (bank == 0)
|
if (battlerId == 0)
|
||||||
ret = HEALTHBOX_GFX_STATUS_PSN_BANK0;
|
ret = HEALTHBOX_GFX_STATUS_PSN_BANK0;
|
||||||
else if (bank == 1)
|
else if (battlerId == 1)
|
||||||
ret = HEALTHBOX_GFX_STATUS_PSN_BANK1;
|
ret = HEALTHBOX_GFX_STATUS_PSN_BANK1;
|
||||||
else if (bank == 2)
|
else if (battlerId == 2)
|
||||||
ret = HEALTHBOX_GFX_STATUS_PSN_BANK2;
|
ret = HEALTHBOX_GFX_STATUS_PSN_BANK2;
|
||||||
else
|
else
|
||||||
ret = HEALTHBOX_GFX_STATUS_PSN_BANK3;
|
ret = HEALTHBOX_GFX_STATUS_PSN_BANK3;
|
||||||
break;
|
break;
|
||||||
case HEALTHBOX_GFX_STATUS_PRZ_BANK0:
|
case HEALTHBOX_GFX_STATUS_PRZ_BANK0:
|
||||||
if (bank == 0)
|
if (battlerId == 0)
|
||||||
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK0;
|
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK0;
|
||||||
else if (bank == 1)
|
else if (battlerId == 1)
|
||||||
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK1;
|
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK1;
|
||||||
else if (bank == 2)
|
else if (battlerId == 2)
|
||||||
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK2;
|
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK2;
|
||||||
else
|
else
|
||||||
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK3;
|
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK3;
|
||||||
break;
|
break;
|
||||||
case HEALTHBOX_GFX_STATUS_SLP_BANK0:
|
case HEALTHBOX_GFX_STATUS_SLP_BANK0:
|
||||||
if (bank == 0)
|
if (battlerId == 0)
|
||||||
ret = HEALTHBOX_GFX_STATUS_SLP_BANK0;
|
ret = HEALTHBOX_GFX_STATUS_SLP_BANK0;
|
||||||
else if (bank == 1)
|
else if (battlerId == 1)
|
||||||
ret = HEALTHBOX_GFX_STATUS_SLP_BANK1;
|
ret = HEALTHBOX_GFX_STATUS_SLP_BANK1;
|
||||||
else if (bank == 2)
|
else if (battlerId == 2)
|
||||||
ret = HEALTHBOX_GFX_STATUS_SLP_BANK2;
|
ret = HEALTHBOX_GFX_STATUS_SLP_BANK2;
|
||||||
else
|
else
|
||||||
ret = HEALTHBOX_GFX_STATUS_SLP_BANK3;
|
ret = HEALTHBOX_GFX_STATUS_SLP_BANK3;
|
||||||
break;
|
break;
|
||||||
case HEALTHBOX_GFX_STATUS_FRZ_BANK0:
|
case HEALTHBOX_GFX_STATUS_FRZ_BANK0:
|
||||||
if (bank == 0)
|
if (battlerId == 0)
|
||||||
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK0;
|
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK0;
|
||||||
else if (bank == 1)
|
else if (battlerId == 1)
|
||||||
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK1;
|
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK1;
|
||||||
else if (bank == 2)
|
else if (battlerId == 2)
|
||||||
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK2;
|
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK2;
|
||||||
else
|
else
|
||||||
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK3;
|
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK3;
|
||||||
break;
|
break;
|
||||||
case HEALTHBOX_GFX_STATUS_BRN_BANK0:
|
case HEALTHBOX_GFX_STATUS_BRN_BANK0:
|
||||||
if (bank == 0)
|
if (battlerId == 0)
|
||||||
ret = HEALTHBOX_GFX_STATUS_BRN_BANK0;
|
ret = HEALTHBOX_GFX_STATUS_BRN_BANK0;
|
||||||
else if (bank == 1)
|
else if (battlerId == 1)
|
||||||
ret = HEALTHBOX_GFX_STATUS_BRN_BANK1;
|
ret = HEALTHBOX_GFX_STATUS_BRN_BANK1;
|
||||||
else if (bank == 2)
|
else if (battlerId == 2)
|
||||||
ret = HEALTHBOX_GFX_STATUS_BRN_BANK2;
|
ret = HEALTHBOX_GFX_STATUS_BRN_BANK2;
|
||||||
else
|
else
|
||||||
ret = HEALTHBOX_GFX_STATUS_BRN_BANK3;
|
ret = HEALTHBOX_GFX_STATUS_BRN_BANK3;
|
||||||
@ -2170,10 +2168,10 @@ static void UpdateLeftNoOfBallsTextOnHealthbox(u8 healthboxSpriteId)
|
|||||||
void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId)
|
void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId)
|
||||||
{
|
{
|
||||||
s32 maxHp, currHp;
|
s32 maxHp, currHp;
|
||||||
u8 bank = gSprites[healthboxSpriteId].data[6];
|
u8 battlerId = gSprites[healthboxSpriteId].data[6];
|
||||||
|
|
||||||
if (elementId == HEALTHBOX_ALL && !IsDoubleBattle())
|
if (elementId == HEALTHBOX_ALL && !IsDoubleBattle())
|
||||||
GetBattlerSide(bank); // pointless function call
|
GetBattlerSide(battlerId); // pointless function call
|
||||||
|
|
||||||
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
|
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
@ -2190,8 +2188,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
|||||||
LoadBattleBarGfx(0);
|
LoadBattleBarGfx(0);
|
||||||
maxHp = GetMonData(mon, MON_DATA_MAX_HP);
|
maxHp = GetMonData(mon, MON_DATA_MAX_HP);
|
||||||
currHp = GetMonData(mon, MON_DATA_HP);
|
currHp = GetMonData(mon, MON_DATA_HP);
|
||||||
SetBattleBarStruct(bank, healthboxSpriteId, maxHp, currHp, 0);
|
SetBattleBarStruct(battlerId, healthboxSpriteId, maxHp, currHp, 0);
|
||||||
sub_8074AA0(bank, healthboxSpriteId, HEALTH_BAR, 0);
|
sub_8074AA0(battlerId, healthboxSpriteId, HEALTH_BAR, 0);
|
||||||
}
|
}
|
||||||
isDoubles = IsDoubleBattle();
|
isDoubles = IsDoubleBattle();
|
||||||
if (!isDoubles && (elementId == HEALTHBOX_EXP_BAR || elementId == HEALTHBOX_ALL))
|
if (!isDoubles && (elementId == HEALTHBOX_EXP_BAR || elementId == HEALTHBOX_ALL))
|
||||||
@ -2208,8 +2206,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
|||||||
currLevelExp = gExperienceTables[gBaseStats[species].growthRate][level];
|
currLevelExp = gExperienceTables[gBaseStats[species].growthRate][level];
|
||||||
currExpBarValue = exp - currLevelExp;
|
currExpBarValue = exp - currLevelExp;
|
||||||
maxExpBarValue = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLevelExp;
|
maxExpBarValue = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLevelExp;
|
||||||
SetBattleBarStruct(bank, healthboxSpriteId, maxExpBarValue, currExpBarValue, isDoubles);
|
SetBattleBarStruct(battlerId, healthboxSpriteId, maxExpBarValue, currExpBarValue, isDoubles);
|
||||||
sub_8074AA0(bank, healthboxSpriteId, EXP_BAR, 0);
|
sub_8074AA0(battlerId, healthboxSpriteId, EXP_BAR, 0);
|
||||||
}
|
}
|
||||||
if (elementId == HEALTHBOX_NICK || elementId == HEALTHBOX_ALL)
|
if (elementId == HEALTHBOX_NICK || elementId == HEALTHBOX_ALL)
|
||||||
UpdateNickInHealthbox(healthboxSpriteId, mon);
|
UpdateNickInHealthbox(healthboxSpriteId, mon);
|
||||||
@ -2229,8 +2227,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
|||||||
LoadBattleBarGfx(0);
|
LoadBattleBarGfx(0);
|
||||||
maxHp = GetMonData(mon, MON_DATA_MAX_HP);
|
maxHp = GetMonData(mon, MON_DATA_MAX_HP);
|
||||||
currHp = GetMonData(mon, MON_DATA_HP);
|
currHp = GetMonData(mon, MON_DATA_HP);
|
||||||
SetBattleBarStruct(bank, healthboxSpriteId, maxHp, currHp, 0);
|
SetBattleBarStruct(battlerId, healthboxSpriteId, maxHp, currHp, 0);
|
||||||
sub_8074AA0(bank, healthboxSpriteId, HEALTH_BAR, 0);
|
sub_8074AA0(battlerId, healthboxSpriteId, HEALTH_BAR, 0);
|
||||||
}
|
}
|
||||||
if (elementId == HEALTHBOX_NICK || elementId == HEALTHBOX_ALL)
|
if (elementId == HEALTHBOX_NICK || elementId == HEALTHBOX_ALL)
|
||||||
UpdateNickInHealthbox(healthboxSpriteId, mon);
|
UpdateNickInHealthbox(healthboxSpriteId, mon);
|
||||||
@ -2239,44 +2237,44 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 sub_8074AA0(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3)
|
s32 sub_8074AA0(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 arg3)
|
||||||
{
|
{
|
||||||
s32 var;
|
s32 var;
|
||||||
|
|
||||||
if (whichBar == HEALTH_BAR) // health bar
|
if (whichBar == HEALTH_BAR) // health bar
|
||||||
{
|
{
|
||||||
var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[bank].maxValue,
|
var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||||
&gBattleSpritesDataPtr->battleBars[bank].field_10,
|
&gBattleSpritesDataPtr->battleBars[battlerId].field_10,
|
||||||
6, 1);
|
6, 1);
|
||||||
}
|
}
|
||||||
else // exp bar
|
else // exp bar
|
||||||
{
|
{
|
||||||
u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].maxValue, 8);
|
gBattleSpritesDataPtr->battleBars[battlerId].maxValue, 8);
|
||||||
if (expFraction == 0)
|
if (expFraction == 0)
|
||||||
expFraction = 1;
|
expFraction = 1;
|
||||||
expFraction = abs(gBattleSpritesDataPtr->battleBars[bank].receivedValue / expFraction);
|
expFraction = abs(gBattleSpritesDataPtr->battleBars[battlerId].receivedValue / expFraction);
|
||||||
|
|
||||||
var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[bank].maxValue,
|
var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||||
&gBattleSpritesDataPtr->battleBars[bank].field_10,
|
&gBattleSpritesDataPtr->battleBars[battlerId].field_10,
|
||||||
8, expFraction);
|
8, expFraction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whichBar == EXP_BAR || (whichBar == HEALTH_BAR && !gBattleSpritesDataPtr->battlerData[bank].hpNumbersNoBars))
|
if (whichBar == EXP_BAR || (whichBar == HEALTH_BAR && !gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars))
|
||||||
sub_8074B9C(bank, whichBar);
|
sub_8074B9C(battlerId, whichBar);
|
||||||
|
|
||||||
if (var == -1)
|
if (var == -1)
|
||||||
gBattleSpritesDataPtr->battleBars[bank].field_10 = 0;
|
gBattleSpritesDataPtr->battleBars[battlerId].field_10 = 0;
|
||||||
|
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8074B9C(u8 bank, u8 whichBar)
|
static void sub_8074B9C(u8 battlerId, u8 whichBar)
|
||||||
{
|
{
|
||||||
u8 array[8];
|
u8 array[8];
|
||||||
u8 subRet, level;
|
u8 subRet, level;
|
||||||
@ -2286,10 +2284,10 @@ static void sub_8074B9C(u8 bank, u8 whichBar)
|
|||||||
switch (whichBar)
|
switch (whichBar)
|
||||||
{
|
{
|
||||||
case HEALTH_BAR:
|
case HEALTH_BAR:
|
||||||
subRet = sub_8074E8C(gBattleSpritesDataPtr->battleBars[bank].maxValue,
|
subRet = sub_8074E8C(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||||
&gBattleSpritesDataPtr->battleBars[bank].field_10,
|
&gBattleSpritesDataPtr->battleBars[battlerId].field_10,
|
||||||
array, 6);
|
array, 6);
|
||||||
barElementId = 3;
|
barElementId = 3;
|
||||||
if (subRet <= 0x18)
|
if (subRet <= 0x18)
|
||||||
@ -2300,7 +2298,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
u8 healthboxSpriteId_2 = gSprites[gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId].data[5];
|
u8 healthboxSpriteId_2 = gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].data[5];
|
||||||
if (i < 2)
|
if (i < 2)
|
||||||
CpuCopy32(GetHealthboxElementGfxPtr(barElementId) + array[i] * 32,
|
CpuCopy32(GetHealthboxElementGfxPtr(barElementId) + array[i] * 32,
|
||||||
(void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId_2].oam.tileNum + 2 + i) * 32), 32);
|
(void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId_2].oam.tileNum + 2 + i) * 32), 32);
|
||||||
@ -2310,12 +2308,12 @@ static void sub_8074B9C(u8 bank, u8 whichBar)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXP_BAR:
|
case EXP_BAR:
|
||||||
sub_8074E8C(gBattleSpritesDataPtr->battleBars[bank].maxValue,
|
sub_8074E8C(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||||
&gBattleSpritesDataPtr->battleBars[bank].field_10,
|
&gBattleSpritesDataPtr->battleBars[battlerId].field_10,
|
||||||
array, 8);
|
array, 8);
|
||||||
level = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_LEVEL);
|
level = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_LEVEL);
|
||||||
if (level == MAX_MON_LEVEL)
|
if (level == MAX_MON_LEVEL)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
@ -2325,10 +2323,10 @@ static void sub_8074B9C(u8 bank, u8 whichBar)
|
|||||||
{
|
{
|
||||||
if (i < 4)
|
if (i < 4)
|
||||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32,
|
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32,
|
||||||
(void*)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId].oam.tileNum + 0x24 + i) * 32), 32);
|
(void*)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum + 0x24 + i) * 32), 32);
|
||||||
else
|
else
|
||||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32,
|
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32,
|
||||||
(void*)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId].oam.tileNum) * 32), 32);
|
(void*)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum) * 32), 32);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4038,8 +4038,7 @@ u8 IsRunningFromBattleImpossible(void)
|
|||||||
}
|
}
|
||||||
if (side != GetBattlerSide(i)
|
if (side != GetBattlerSide(i)
|
||||||
&& gBattleMons[gActiveBattler].ability != ABILITY_LEVITATE
|
&& gBattleMons[gActiveBattler].ability != ABILITY_LEVITATE
|
||||||
&& gBattleMons[gActiveBattler].type1 != TYPE_FLYING
|
&& !IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_FLYING)
|
||||||
&& gBattleMons[gActiveBattler].type2 != TYPE_FLYING
|
|
||||||
&& gBattleMons[i].ability == ABILITY_ARENA_TRAP)
|
&& gBattleMons[i].ability == ABILITY_ARENA_TRAP)
|
||||||
{
|
{
|
||||||
gBattleScripting.battler = i;
|
gBattleScripting.battler = i;
|
||||||
@ -4049,7 +4048,7 @@ u8 IsRunningFromBattleImpossible(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
i = AbilityBattleEffects(ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK, gActiveBattler, ABILITY_MAGNET_PULL, 0, 0);
|
i = AbilityBattleEffects(ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK, gActiveBattler, ABILITY_MAGNET_PULL, 0, 0);
|
||||||
if (i != 0 && (gBattleMons[gActiveBattler].type1 == TYPE_STEEL || gBattleMons[gActiveBattler].type2 == TYPE_STEEL))
|
if (i != 0 && IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_STEEL))
|
||||||
{
|
{
|
||||||
gBattleScripting.battler = i - 1;
|
gBattleScripting.battler = i - 1;
|
||||||
gLastUsedAbility = gBattleMons[i - 1].ability;
|
gLastUsedAbility = gBattleMons[i - 1].ability;
|
||||||
@ -4236,12 +4235,10 @@ static void HandleTurnActionSelectionState(void)
|
|||||||
}
|
}
|
||||||
else if ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_SHADOW_TAG, 0, 0))
|
else if ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_SHADOW_TAG, 0, 0))
|
||||||
|| ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_ARENA_TRAP, 0, 0))
|
|| ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_ARENA_TRAP, 0, 0))
|
||||||
&& gBattleMons[gActiveBattler].type1 != TYPE_FLYING
|
&& !IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_FLYING)
|
||||||
&& gBattleMons[gActiveBattler].type2 != TYPE_FLYING
|
|
||||||
&& gBattleMons[gActiveBattler].ability != ABILITY_LEVITATE)
|
&& gBattleMons[gActiveBattler].ability != ABILITY_LEVITATE)
|
||||||
|| ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK, gActiveBattler, ABILITY_MAGNET_PULL, 0, 0))
|
|| ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK, gActiveBattler, ABILITY_MAGNET_PULL, 0, 0))
|
||||||
&& (gBattleMons[gActiveBattler].type1 == TYPE_STEEL
|
&& IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_STEEL)))
|
||||||
|| gBattleMons[gActiveBattler].type2 == TYPE_STEEL)))
|
|
||||||
{
|
{
|
||||||
BtlController_EmitChoosePokemon(0, ((i - 1) << 4) | 4, 6, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]);
|
BtlController_EmitChoosePokemon(0, ((i - 1) << 4) | 4, 6, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]);
|
||||||
}
|
}
|
||||||
|
@ -1736,8 +1736,8 @@ static const u8* TryGetStatusString(u8* src)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HANDLE_NICKNAME_STRING_CASE(bank, monIndex) \
|
#define HANDLE_NICKNAME_STRING_CASE(battlerId, monIndex) \
|
||||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER) \
|
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) \
|
||||||
{ \
|
{ \
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) \
|
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) \
|
||||||
toCpy = sText_FoePkmnPrefix; \
|
toCpy = sText_FoePkmnPrefix; \
|
||||||
@ -1866,7 +1866,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
|||||||
StringGetEnd10(text);
|
StringGetEnd10(text);
|
||||||
toCpy = text;
|
toCpy = text;
|
||||||
break;
|
break;
|
||||||
case B_TXT_ATK_NAME_WITH_PREFIX_MON1: // attacker name with prefix, only bank 0/1
|
case B_TXT_ATK_NAME_WITH_PREFIX_MON1: // attacker name with prefix, only battlerId 0/1
|
||||||
HANDLE_NICKNAME_STRING_CASE(gBattlerAttacker,
|
HANDLE_NICKNAME_STRING_CASE(gBattlerAttacker,
|
||||||
gBattlerPartyIndexes[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattlerAttacker))])
|
gBattlerPartyIndexes[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattlerAttacker))])
|
||||||
break;
|
break;
|
||||||
@ -1885,13 +1885,13 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
|||||||
case B_TXT_DEF_NAME_WITH_PREFIX: // target name with prefix
|
case B_TXT_DEF_NAME_WITH_PREFIX: // target name with prefix
|
||||||
HANDLE_NICKNAME_STRING_CASE(gBattlerTarget, gBattlerPartyIndexes[gBattlerTarget])
|
HANDLE_NICKNAME_STRING_CASE(gBattlerTarget, gBattlerPartyIndexes[gBattlerTarget])
|
||||||
break;
|
break;
|
||||||
case B_TXT_EFF_NAME_WITH_PREFIX: // effect bank name with prefix
|
case B_TXT_EFF_NAME_WITH_PREFIX: // effect battlerId name with prefix
|
||||||
HANDLE_NICKNAME_STRING_CASE(gEffectBattler, gBattlerPartyIndexes[gEffectBattler])
|
HANDLE_NICKNAME_STRING_CASE(gEffectBattler, gBattlerPartyIndexes[gEffectBattler])
|
||||||
break;
|
break;
|
||||||
case B_TXT_ACTIVE_NAME_WITH_PREFIX: // active bank name with prefix
|
case B_TXT_ACTIVE_NAME_WITH_PREFIX: // active battlerId name with prefix
|
||||||
HANDLE_NICKNAME_STRING_CASE(gActiveBattler, gBattlerPartyIndexes[gActiveBattler])
|
HANDLE_NICKNAME_STRING_CASE(gActiveBattler, gBattlerPartyIndexes[gActiveBattler])
|
||||||
break;
|
break;
|
||||||
case B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX: // scripting active bank name with prefix
|
case B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX: // scripting active battlerId name with prefix
|
||||||
HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, gBattlerPartyIndexes[gBattleScripting.battler])
|
HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, gBattlerPartyIndexes[gBattleScripting.battler])
|
||||||
break;
|
break;
|
||||||
case B_TXT_CURRENT_MOVE: // current move name
|
case B_TXT_CURRENT_MOVE: // current move name
|
||||||
@ -1961,7 +1961,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
|||||||
case B_TXT_SCR_ACTIVE_ABILITY: // scripting active ability
|
case B_TXT_SCR_ACTIVE_ABILITY: // scripting active ability
|
||||||
toCpy = gAbilityNames[gBattlerAbilities[gBattleScripting.battler]];
|
toCpy = gAbilityNames[gBattlerAbilities[gBattleScripting.battler]];
|
||||||
break;
|
break;
|
||||||
case B_TXT_EFF_ABILITY: // effect bank ability
|
case B_TXT_EFF_ABILITY: // effect battlerId ability
|
||||||
toCpy = gAbilityNames[gBattlerAbilities[gEffectBattler]];
|
toCpy = gAbilityNames[gBattlerAbilities[gEffectBattler]];
|
||||||
break;
|
break;
|
||||||
case B_TXT_TRAINER1_CLASS: // trainer class name
|
case B_TXT_TRAINER1_CLASS: // trainer class name
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -32,6 +32,7 @@
|
|||||||
#include "overworld.h"
|
#include "overworld.h"
|
||||||
#include "field_weather.h"
|
#include "field_weather.h"
|
||||||
#include "gym_leader_rematch.h"
|
#include "gym_leader_rematch.h"
|
||||||
|
#include "field_map_obj_helpers.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -56,18 +57,12 @@ extern bool8 InBattlePyramid(void);
|
|||||||
extern bool8 InBattlePike(void);
|
extern bool8 InBattlePike(void);
|
||||||
extern bool32 InTrainerHill(void);
|
extern bool32 InTrainerHill(void);
|
||||||
extern bool32 FieldPoisonEffectIsRunning(void);
|
extern bool32 FieldPoisonEffectIsRunning(void);
|
||||||
extern void overworld_free_bg_tilemaps(void);
|
|
||||||
extern void prev_quest_postbuffer_cursor_backup_reset(void);
|
extern void prev_quest_postbuffer_cursor_backup_reset(void);
|
||||||
extern void ResetPoisonStepCounter(void);
|
extern void ResetPoisonStepCounter(void);
|
||||||
extern void sub_81BE72C(void);
|
extern void sub_81BE72C(void);
|
||||||
extern void FreezeMapObjects(void);
|
|
||||||
extern void sub_808BCF4(void);
|
extern void sub_808BCF4(void);
|
||||||
extern void sub_80EECC8(void);
|
extern void sub_80EECC8(void);
|
||||||
extern void Overworld_ClearSavedMusic(void);
|
|
||||||
extern void CB2_WhiteOut(void);
|
|
||||||
extern void sub_80AF6F0(void);
|
extern void sub_80AF6F0(void);
|
||||||
extern void PlayBattleBGM(void);
|
|
||||||
extern u8 Overworld_GetFlashLevel(void);
|
|
||||||
extern u16 sub_81A9AA8(u8 localId);
|
extern u16 sub_81A9AA8(u8 localId);
|
||||||
extern u16 sub_81D6180(u8 localId);
|
extern u16 sub_81D6180(u8 localId);
|
||||||
extern bool8 GetBattlePyramidTrainerFlag(u8 mapObjId);
|
extern bool8 GetBattlePyramidTrainerFlag(u8 mapObjId);
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "berry.h"
|
#include "berry.h"
|
||||||
|
|
||||||
|
|
||||||
extern u8 weather_get_current(void);
|
extern u8 weather_get_current(void);
|
||||||
|
|
||||||
// rom const data
|
// rom const data
|
||||||
@ -1664,36 +1663,31 @@ u8 CastformDataTypeChange(u8 battler)
|
|||||||
u8 formChange = 0;
|
u8 formChange = 0;
|
||||||
if (gBattleMons[battler].species != SPECIES_CASTFORM || gBattleMons[battler].ability != ABILITY_FORECAST || gBattleMons[battler].hp == 0)
|
if (gBattleMons[battler].species != SPECIES_CASTFORM || gBattleMons[battler].ability != ABILITY_FORECAST || gBattleMons[battler].hp == 0)
|
||||||
return CASTFORM_NO_CHANGE;
|
return CASTFORM_NO_CHANGE;
|
||||||
if (!WEATHER_HAS_EFFECT && gBattleMons[battler].type1 != TYPE_NORMAL && gBattleMons[battler].type2 != TYPE_NORMAL)
|
if (!WEATHER_HAS_EFFECT && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||||
{
|
{
|
||||||
gBattleMons[battler].type1 = TYPE_NORMAL;
|
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||||
gBattleMons[battler].type2 = TYPE_NORMAL;
|
|
||||||
return CASTFORM_TO_NORMAL;
|
return CASTFORM_TO_NORMAL;
|
||||||
}
|
}
|
||||||
if (!WEATHER_HAS_EFFECT)
|
if (!WEATHER_HAS_EFFECT)
|
||||||
return CASTFORM_NO_CHANGE;
|
return CASTFORM_NO_CHANGE;
|
||||||
if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL)) && gBattleMons[battler].type1 != TYPE_NORMAL && gBattleMons[battler].type2 != TYPE_NORMAL)
|
if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||||
{
|
{
|
||||||
gBattleMons[battler].type1 = TYPE_NORMAL;
|
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||||
gBattleMons[battler].type2 = TYPE_NORMAL;
|
|
||||||
formChange = CASTFORM_TO_NORMAL;
|
formChange = CASTFORM_TO_NORMAL;
|
||||||
}
|
}
|
||||||
if (gBattleWeather & WEATHER_SUN_ANY && gBattleMons[battler].type1 != TYPE_FIRE && gBattleMons[battler].type2 != TYPE_FIRE)
|
if (gBattleWeather & WEATHER_SUN_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_FIRE))
|
||||||
{
|
{
|
||||||
gBattleMons[battler].type1 = TYPE_FIRE;
|
SET_BATTLER_TYPE(battler, TYPE_FIRE);
|
||||||
gBattleMons[battler].type2 = TYPE_FIRE;
|
|
||||||
formChange = CASTFORM_TO_FIRE;
|
formChange = CASTFORM_TO_FIRE;
|
||||||
}
|
}
|
||||||
if (gBattleWeather & WEATHER_RAIN_ANY && gBattleMons[battler].type1 != TYPE_WATER && gBattleMons[battler].type2 != TYPE_WATER)
|
if (gBattleWeather & WEATHER_RAIN_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_WATER))
|
||||||
{
|
{
|
||||||
gBattleMons[battler].type1 = TYPE_WATER;
|
SET_BATTLER_TYPE(battler, TYPE_WATER);
|
||||||
gBattleMons[battler].type2 = TYPE_WATER;
|
|
||||||
formChange = CASTFORM_TO_WATER;
|
formChange = CASTFORM_TO_WATER;
|
||||||
}
|
}
|
||||||
if (gBattleWeather & WEATHER_HAIL && gBattleMons[battler].type1 != TYPE_ICE && gBattleMons[battler].type2 != TYPE_ICE)
|
if (gBattleWeather & WEATHER_HAIL_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_ICE))
|
||||||
{
|
{
|
||||||
gBattleMons[battler].type1 = TYPE_ICE;
|
SET_BATTLER_TYPE(battler, TYPE_ICE);
|
||||||
gBattleMons[battler].type2 = TYPE_ICE;
|
|
||||||
formChange = CASTFORM_TO_ICE;
|
formChange = CASTFORM_TO_ICE;
|
||||||
}
|
}
|
||||||
return formChange;
|
return formChange;
|
||||||
@ -2023,14 +2017,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& move != MOVE_STRUGGLE
|
&& move != MOVE_STRUGGLE
|
||||||
&& gBattleMoves[move].power != 0
|
&& gBattleMoves[move].power != 0
|
||||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
&& TARGET_TURN_DAMAGED
|
||||||
&& gBattleMons[battler].type1 != moveType
|
&& !IS_BATTLER_OF_TYPE(battler, moveType)
|
||||||
&& gBattleMons[battler].type2 != moveType
|
|
||||||
&& gBattleMons[battler].hp != 0)
|
&& gBattleMons[battler].hp != 0)
|
||||||
{
|
{
|
||||||
gBattleMons[battler].type1 = moveType;
|
SET_BATTLER_TYPE(battler, moveType);
|
||||||
gBattleMons[battler].type2 = moveType;
|
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType);
|
||||||
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType)
|
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_ColorChangeActivates;
|
gBattlescriptCurrInstr = BattleScript_ColorChangeActivates;
|
||||||
effect++;
|
effect++;
|
||||||
@ -2040,7 +2032,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
&& TARGET_TURN_DAMAGED
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
||||||
{
|
{
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||||
@ -2055,7 +2047,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
&& TARGET_TURN_DAMAGED
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (Random() % 10) == 0)
|
&& (Random() % 10) == 0)
|
||||||
{
|
{
|
||||||
@ -2078,7 +2070,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
&& TARGET_TURN_DAMAGED
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (Random() % 3) == 0)
|
&& (Random() % 3) == 0)
|
||||||
{
|
{
|
||||||
@ -2093,7 +2085,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
&& TARGET_TURN_DAMAGED
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (Random() % 3) == 0)
|
&& (Random() % 3) == 0)
|
||||||
{
|
{
|
||||||
@ -2109,7 +2101,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
&& TARGET_TURN_DAMAGED
|
||||||
&& (Random() % 3) == 0)
|
&& (Random() % 3) == 0)
|
||||||
{
|
{
|
||||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
|
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
|
||||||
@ -2124,7 +2116,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
&& TARGET_TURN_DAMAGED
|
||||||
&& gBattleMons[gBattlerTarget].hp != 0
|
&& gBattleMons[gBattlerTarget].hp != 0
|
||||||
&& (Random() % 3) == 0
|
&& (Random() % 3) == 0
|
||||||
&& gBattleMons[gBattlerAttacker].ability != ABILITY_OBLIVIOUS
|
&& gBattleMons[gBattlerAttacker].ability != ABILITY_OBLIVIOUS
|
||||||
@ -3134,7 +3126,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
{
|
{
|
||||||
case HOLD_EFFECT_FLINCH:
|
case HOLD_EFFECT_FLINCH:
|
||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
&& TARGET_TURN_DAMAGED
|
||||||
&& (Random() % 100) < atkQuality
|
&& (Random() % 100) < atkQuality
|
||||||
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
|
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
|
||||||
&& gBattleMons[gBattlerTarget].hp)
|
&& gBattleMons[gBattlerTarget].hp)
|
||||||
@ -3186,14 +3178,14 @@ void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands
|
|||||||
gBattleScriptingCommandsTable[*gBattlescriptCurrInstr]();
|
gBattleScriptingCommandsTable[*gBattlescriptCurrInstr]();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetMoveTarget(u16 move, u8 useMoveTarget)
|
u8 GetMoveTarget(u16 move, u8 setTarget)
|
||||||
{
|
{
|
||||||
u8 targetBank = 0;
|
u8 targetBank = 0;
|
||||||
u8 moveTarget;
|
u8 moveTarget;
|
||||||
u8 side;
|
u8 side;
|
||||||
|
|
||||||
if (useMoveTarget)
|
if (setTarget)
|
||||||
moveTarget = useMoveTarget - 1;
|
moveTarget = setTarget - 1;
|
||||||
else
|
else
|
||||||
moveTarget = gBattleMoves[move].target;
|
moveTarget = gBattleMoves[move].target;
|
||||||
|
|
||||||
|
@ -76,26 +76,26 @@ void FreeBattleResources(void)
|
|||||||
|
|
||||||
void AdjustFriendshipOnBattleFaint(u8 battlerId)
|
void AdjustFriendshipOnBattleFaint(u8 battlerId)
|
||||||
{
|
{
|
||||||
u8 opposingBank;
|
u8 opposingBattlerId;
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
{
|
{
|
||||||
u8 opposingBank2;
|
u8 opposingBattlerId2;
|
||||||
|
|
||||||
opposingBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
opposingBattlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||||
opposingBank2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
opposingBattlerId2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
||||||
|
|
||||||
if (gBattleMons[opposingBank2].level > gBattleMons[opposingBank].level)
|
if (gBattleMons[opposingBattlerId2].level > gBattleMons[opposingBattlerId].level)
|
||||||
opposingBank = opposingBank2;
|
opposingBattlerId = opposingBattlerId2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
opposingBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
opposingBattlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gBattleMons[opposingBank].level > gBattleMons[battlerId].level)
|
if (gBattleMons[opposingBattlerId].level > gBattleMons[battlerId].level)
|
||||||
{
|
{
|
||||||
if (gBattleMons[opposingBank].level - gBattleMons[battlerId].level > 29)
|
if (gBattleMons[opposingBattlerId].level - gBattleMons[battlerId].level > 29)
|
||||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 8);
|
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 8);
|
||||||
else
|
else
|
||||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 6);
|
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 6);
|
||||||
|
184
src/pokeball.c
184
src/pokeball.c
@ -43,7 +43,7 @@ static void sub_80768F0(struct Sprite *sprite);
|
|||||||
static void sub_80769A8(struct Sprite *sprite);
|
static void sub_80769A8(struct Sprite *sprite);
|
||||||
static void sub_80769CC(struct Sprite *sprite);
|
static void sub_80769CC(struct Sprite *sprite);
|
||||||
static void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite);
|
static void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite);
|
||||||
static u16 GetBankPokeballItemId(u8 bank);
|
static u16 GetBattlerPokeballItemId(u8 battlerId);
|
||||||
|
|
||||||
// rom const data
|
// rom const data
|
||||||
|
|
||||||
@ -320,8 +320,8 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] =
|
|||||||
#define tFrames data[0]
|
#define tFrames data[0]
|
||||||
#define tPan data[1]
|
#define tPan data[1]
|
||||||
#define tThrowId data[2]
|
#define tThrowId data[2]
|
||||||
#define tBank data[3]
|
#define tBattler data[3]
|
||||||
#define tOpponentBank data[4]
|
#define tOpponentBattler data[4]
|
||||||
|
|
||||||
u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow)
|
u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow)
|
||||||
{
|
{
|
||||||
@ -333,17 +333,17 @@ u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow)
|
|||||||
taskId = CreateTask(Task_DoPokeballSendOutAnim, 5);
|
taskId = CreateTask(Task_DoPokeballSendOutAnim, 5);
|
||||||
gTasks[taskId].tPan = pan;
|
gTasks[taskId].tPan = pan;
|
||||||
gTasks[taskId].tThrowId = kindOfThrow;
|
gTasks[taskId].tThrowId = kindOfThrow;
|
||||||
gTasks[taskId].tBank = gActiveBattler;
|
gTasks[taskId].tBattler = gActiveBattler;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define sBank data[6]
|
#define sBattler data[6]
|
||||||
|
|
||||||
static void Task_DoPokeballSendOutAnim(u8 taskId)
|
static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||||
{
|
{
|
||||||
u16 throwCaseId;
|
u16 throwCaseId;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
u16 itemId, ballId;
|
u16 itemId, ballId;
|
||||||
u8 ballSpriteId;
|
u8 ballSpriteId;
|
||||||
bool8 notSendOut = FALSE;
|
bool8 notSendOut = FALSE;
|
||||||
@ -355,12 +355,12 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
throwCaseId = gTasks[taskId].tThrowId;
|
throwCaseId = gTasks[taskId].tThrowId;
|
||||||
bank = gTasks[taskId].tBank;
|
battlerId = gTasks[taskId].tBattler;
|
||||||
|
|
||||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||||
itemId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL);
|
itemId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_POKEBALL);
|
||||||
else
|
else
|
||||||
itemId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL);
|
itemId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_POKEBALL);
|
||||||
|
|
||||||
ballId = ItemIdToBallId(itemId);
|
ballId = ItemIdToBallId(itemId);
|
||||||
LoadBallGfx(ballId);
|
LoadBallGfx(ballId);
|
||||||
@ -372,15 +372,15 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
|||||||
switch (throwCaseId)
|
switch (throwCaseId)
|
||||||
{
|
{
|
||||||
case POKEBALL_PLAYER_SENDOUT:
|
case POKEBALL_PLAYER_SENDOUT:
|
||||||
gBattlerTarget = bank;
|
gBattlerTarget = battlerId;
|
||||||
gSprites[ballSpriteId].pos1.x = 24;
|
gSprites[ballSpriteId].pos1.x = 24;
|
||||||
gSprites[ballSpriteId].pos1.y = 68;
|
gSprites[ballSpriteId].pos1.y = 68;
|
||||||
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
|
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
|
||||||
break;
|
break;
|
||||||
case POKEBALL_OPPONENT_SENDOUT:
|
case POKEBALL_OPPONENT_SENDOUT:
|
||||||
gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(bank, BANK_X_POS);
|
gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(battlerId, BANK_X_POS);
|
||||||
gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(bank, BANK_Y_POS) + 24;
|
gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(battlerId, BANK_Y_POS) + 24;
|
||||||
gBattlerTarget = bank;
|
gBattlerTarget = battlerId;
|
||||||
gSprites[ballSpriteId].data[0] = 0;
|
gSprites[ballSpriteId].data[0] = 0;
|
||||||
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
|
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
|
||||||
break;
|
break;
|
||||||
@ -390,7 +390,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gSprites[ballSpriteId].sBank = gBattlerTarget;
|
gSprites[ballSpriteId].sBattler = gBattlerTarget;
|
||||||
if (!notSendOut)
|
if (!notSendOut)
|
||||||
{
|
{
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
@ -404,7 +404,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
|||||||
gSprites[ballSpriteId].data[5] = -40;
|
gSprites[ballSpriteId].data[5] = -40;
|
||||||
sub_80A68D4(&gSprites[ballSpriteId]);
|
sub_80A68D4(&gSprites[ballSpriteId]);
|
||||||
gSprites[ballSpriteId].oam.affineParam = taskId;
|
gSprites[ballSpriteId].oam.affineParam = taskId;
|
||||||
gTasks[taskId].tOpponentBank = gBattlerTarget;
|
gTasks[taskId].tOpponentBattler = gBattlerTarget;
|
||||||
gTasks[taskId].func = TaskDummy;
|
gTasks[taskId].func = TaskDummy;
|
||||||
PlaySE(SE_NAGERU);
|
PlaySE(SE_NAGERU);
|
||||||
}
|
}
|
||||||
@ -415,7 +415,7 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
u16 ballId;
|
u16 ballId;
|
||||||
u8 taskId = sprite->oam.affineParam;
|
u8 taskId = sprite->oam.affineParam;
|
||||||
u8 opponentBank = gTasks[taskId].tOpponentBank;
|
u8 opponentBattler = gTasks[taskId].tOpponentBattler;
|
||||||
u8 noOfShakes = gTasks[taskId].tThrowId;
|
u8 noOfShakes = gTasks[taskId].tThrowId;
|
||||||
|
|
||||||
StartSpriteAnim(sprite, 1);
|
StartSpriteAnim(sprite, 1);
|
||||||
@ -425,10 +425,10 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite)
|
|||||||
sprite->pos2.x = 0;
|
sprite->pos2.x = 0;
|
||||||
sprite->pos2.y = 0;
|
sprite->pos2.y = 0;
|
||||||
sprite->data[5] = 0;
|
sprite->data[5] = 0;
|
||||||
ballId = ItemIdToBallId(GetBankPokeballItemId(opponentBank));
|
ballId = ItemIdToBallId(GetBattlerPokeballItemId(opponentBattler));
|
||||||
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
|
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
|
||||||
sprite->data[0] = LaunchBallFadeMonTask(FALSE, opponentBank, 14, ballId);
|
sprite->data[0] = LaunchBallFadeMonTask(FALSE, opponentBattler, 14, ballId);
|
||||||
sprite->sBank = opponentBank;
|
sprite->sBattler = opponentBattler;
|
||||||
sprite->data[7] = noOfShakes;
|
sprite->data[7] = noOfShakes;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
sprite->callback = sub_80756D4;
|
sprite->callback = sub_80756D4;
|
||||||
@ -438,8 +438,8 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite)
|
|||||||
#undef tFrames
|
#undef tFrames
|
||||||
#undef tPan
|
#undef tPan
|
||||||
#undef tThrowId
|
#undef tThrowId
|
||||||
#undef tBank
|
#undef tBattler
|
||||||
#undef tOpponentBank
|
#undef tOpponentBattler
|
||||||
|
|
||||||
static void sub_80756D4(struct Sprite *sprite)
|
static void sub_80756D4(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
@ -452,9 +452,9 @@ static void sub_80756E0(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
sprite->data[5] = 0;
|
sprite->data[5] = 0;
|
||||||
sprite->callback = sub_807574C;
|
sprite->callback = sub_807574C;
|
||||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBank]], 2);
|
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 2);
|
||||||
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]);
|
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]);
|
||||||
gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] = 0;
|
gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,17 +463,17 @@ static void sub_807574C(struct Sprite *sprite)
|
|||||||
sprite->data[5]++;
|
sprite->data[5]++;
|
||||||
if (sprite->data[5] == 11)
|
if (sprite->data[5] == 11)
|
||||||
PlaySE(SE_SUIKOMU);
|
PlaySE(SE_SUIKOMU);
|
||||||
if (gSprites[gBattlerSpriteIds[sprite->sBank]].affineAnimEnded)
|
if (gSprites[gBattlerSpriteIds[sprite->sBattler]].affineAnimEnded)
|
||||||
{
|
{
|
||||||
StartSpriteAnim(sprite, 2);
|
StartSpriteAnim(sprite, 2);
|
||||||
gSprites[gBattlerSpriteIds[sprite->sBank]].invisible = TRUE;
|
gSprites[gBattlerSpriteIds[sprite->sBattler]].invisible = TRUE;
|
||||||
sprite->data[5] = 0;
|
sprite->data[5] = 0;
|
||||||
sprite->callback = sub_80757E4;
|
sprite->callback = sub_80757E4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] += 0x60;
|
gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] += 0x60;
|
||||||
gSprites[gBattlerSpriteIds[sprite->sBank]].pos2.y = -gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] >> 8;
|
gSprites[gBattlerSpriteIds[sprite->sBattler]].pos2.y = -gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] >> 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ static void sub_8075970(struct Sprite *sprite)
|
|||||||
#define tCryTaskSpecies data[0]
|
#define tCryTaskSpecies data[0]
|
||||||
#define tCryTaskPan data[1]
|
#define tCryTaskPan data[1]
|
||||||
#define tCryTaskWantedCry data[2]
|
#define tCryTaskWantedCry data[2]
|
||||||
#define tCryTaskBank data[3]
|
#define tCryTaskBattler data[3]
|
||||||
#define tCryTaskMonSpriteId data[4]
|
#define tCryTaskMonSpriteId data[4]
|
||||||
#define tCryTaskMonPtr1 data[5]
|
#define tCryTaskMonPtr1 data[5]
|
||||||
#define tCryTaskMonPtr2 data[6]
|
#define tCryTaskMonPtr2 data[6]
|
||||||
@ -653,7 +653,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
|||||||
u8 wantedCry = gTasks[taskId].tCryTaskWantedCry;
|
u8 wantedCry = gTasks[taskId].tCryTaskWantedCry;
|
||||||
s8 pan = gTasks[taskId].tCryTaskPan;
|
s8 pan = gTasks[taskId].tCryTaskPan;
|
||||||
u16 species = gTasks[taskId].tCryTaskSpecies;
|
u16 species = gTasks[taskId].tCryTaskSpecies;
|
||||||
u8 bank = gTasks[taskId].tCryTaskBank;
|
u8 battlerId = gTasks[taskId].tCryTaskBattler;
|
||||||
u8 monSpriteId = gTasks[taskId].tCryTaskMonSpriteId;
|
u8 monSpriteId = gTasks[taskId].tCryTaskMonSpriteId;
|
||||||
struct Pokemon *mon = (void*)(u32)((gTasks[taskId].tCryTaskMonPtr1 << 0x10) | (u16)(gTasks[taskId].tCryTaskMonPtr2));
|
struct Pokemon *mon = (void*)(u32)((gTasks[taskId].tCryTaskMonPtr1 << 0x10) | (u16)(gTasks[taskId].tCryTaskMonPtr2));
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
|||||||
PlayCry3(species, pan, 0);
|
PlayCry3(species, pan, 0);
|
||||||
else
|
else
|
||||||
PlayCry3(species, pan, 11);
|
PlayCry3(species, pan, 11);
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -685,7 +685,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
|||||||
else
|
else
|
||||||
PlayCry4(species, pan, 12);
|
PlayCry4(species, pan, 12);
|
||||||
|
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -724,7 +724,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
|||||||
else
|
else
|
||||||
PlayCry4(species, pan, 11);
|
PlayCry4(species, pan, 11);
|
||||||
|
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -732,13 +732,13 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
|||||||
|
|
||||||
static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
u8 bank = sprite->sBank;
|
u8 battlerId = sprite->sBattler;
|
||||||
u32 ballId;
|
u32 ballId;
|
||||||
|
|
||||||
StartSpriteAnim(sprite, 1);
|
StartSpriteAnim(sprite, 1);
|
||||||
ballId = ItemIdToBallId(GetBankPokeballItemId(bank));
|
ballId = ItemIdToBallId(GetBattlerPokeballItemId(battlerId));
|
||||||
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
|
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
|
||||||
sprite->data[0] = LaunchBallFadeMonTask(1, sprite->sBank, 14, ballId);
|
sprite->data[0] = LaunchBallFadeMonTask(1, sprite->sBattler, 14, ballId);
|
||||||
sprite->callback = HandleBallAnimEnd;
|
sprite->callback = HandleBallAnimEnd;
|
||||||
|
|
||||||
if (gMain.inBattle)
|
if (gMain.inBattle)
|
||||||
@ -749,19 +749,19 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
|||||||
u16 wantedCryCase;
|
u16 wantedCryCase;
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
mon = &gEnemyParty[gBattlerPartyIndexes[bank]];
|
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
|
||||||
pan = 25;
|
pan = 25;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mon = &gPlayerParty[gBattlerPartyIndexes[bank]];
|
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
|
||||||
pan = -25;
|
pan = -25;
|
||||||
}
|
}
|
||||||
|
|
||||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
if ((bank == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || bank == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
if ((battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
||||||
&& IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1)
|
&& IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1)
|
||||||
{
|
{
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||||
@ -777,39 +777,39 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
|||||||
|
|
||||||
if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->field_9_x1)
|
if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->field_9_x1)
|
||||||
wantedCryCase = 0;
|
wantedCryCase = 0;
|
||||||
else if (bank == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || bank == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
else if (battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
||||||
wantedCryCase = 1;
|
wantedCryCase = 1;
|
||||||
else
|
else
|
||||||
wantedCryCase = 2;
|
wantedCryCase = 2;
|
||||||
|
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 1;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 1;
|
||||||
|
|
||||||
taskId = CreateTask(Task_PlayCryWhenReleasedFromBall, 3);
|
taskId = CreateTask(Task_PlayCryWhenReleasedFromBall, 3);
|
||||||
gTasks[taskId].tCryTaskSpecies = species;
|
gTasks[taskId].tCryTaskSpecies = species;
|
||||||
gTasks[taskId].tCryTaskPan = pan;
|
gTasks[taskId].tCryTaskPan = pan;
|
||||||
gTasks[taskId].tCryTaskWantedCry = wantedCryCase;
|
gTasks[taskId].tCryTaskWantedCry = wantedCryCase;
|
||||||
gTasks[taskId].tCryTaskBank = bank;
|
gTasks[taskId].tCryTaskBattler = battlerId;
|
||||||
gTasks[taskId].tCryTaskMonSpriteId = gBattlerSpriteIds[sprite->sBank];
|
gTasks[taskId].tCryTaskMonSpriteId = gBattlerSpriteIds[sprite->sBattler];
|
||||||
gTasks[taskId].tCryTaskMonPtr1 = (u32)(mon) >> 0x10;
|
gTasks[taskId].tCryTaskMonPtr1 = (u32)(mon) >> 0x10;
|
||||||
gTasks[taskId].tCryTaskMonPtr2 = (u32)(mon);
|
gTasks[taskId].tCryTaskMonPtr2 = (u32)(mon);
|
||||||
gTasks[taskId].tCryTaskState = 0;
|
gTasks[taskId].tCryTaskState = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBank]], 1);
|
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 1);
|
||||||
|
|
||||||
if (GetBattlerSide(sprite->sBank) == B_SIDE_OPPONENT)
|
if (GetBattlerSide(sprite->sBattler) == B_SIDE_OPPONENT)
|
||||||
gSprites[gBattlerSpriteIds[sprite->sBank]].callback = sub_8039B58;
|
gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039B58;
|
||||||
else
|
else
|
||||||
gSprites[gBattlerSpriteIds[sprite->sBank]].callback = sub_8039E44;
|
gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039E44;
|
||||||
|
|
||||||
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]);
|
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]);
|
||||||
gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] = 0x1000;
|
gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0x1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef tCryTaskSpecies
|
#undef tCryTaskSpecies
|
||||||
#undef tCryTaskPan
|
#undef tCryTaskPan
|
||||||
#undef tCryTaskWantedCry
|
#undef tCryTaskWantedCry
|
||||||
#undef tCryTaskBank
|
#undef tCryTaskBattler
|
||||||
#undef tCryTaskMonSpriteId
|
#undef tCryTaskMonSpriteId
|
||||||
#undef tCryTaskMonPtr1
|
#undef tCryTaskMonPtr1
|
||||||
#undef tCryTaskMonPtr2
|
#undef tCryTaskMonPtr2
|
||||||
@ -828,37 +828,37 @@ static void sub_8075FB4(struct Sprite *sprite)
|
|||||||
static void HandleBallAnimEnd(struct Sprite *sprite)
|
static void HandleBallAnimEnd(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
bool8 affineAnimEnded = FALSE;
|
bool8 affineAnimEnded = FALSE;
|
||||||
u8 bank = sprite->sBank;
|
u8 battlerId = sprite->sBattler;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].invisible = FALSE;
|
gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE;
|
||||||
if (sprite->animEnded)
|
if (sprite->animEnded)
|
||||||
sprite->invisible = TRUE;
|
sprite->invisible = TRUE;
|
||||||
if (gSprites[gBattlerSpriteIds[bank]].affineAnimEnded)
|
if (gSprites[gBattlerSpriteIds[battlerId]].affineAnimEnded)
|
||||||
{
|
{
|
||||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[bank]], 0);
|
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0);
|
||||||
affineAnimEnded = TRUE;
|
affineAnimEnded = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gSprites[gBattlerSpriteIds[bank]].data[1] -= 288;
|
gSprites[gBattlerSpriteIds[battlerId]].data[1] -= 288;
|
||||||
gSprites[gBattlerSpriteIds[bank]].pos2.y = gSprites[gBattlerSpriteIds[bank]].data[1] >> 8;
|
gSprites[gBattlerSpriteIds[battlerId]].pos2.y = gSprites[gBattlerSpriteIds[battlerId]].data[1] >> 8;
|
||||||
}
|
}
|
||||||
if (sprite->animEnded && affineAnimEnded)
|
if (sprite->animEnded && affineAnimEnded)
|
||||||
{
|
{
|
||||||
s32 i, doneBanks;
|
s32 i, doneBattlers;
|
||||||
|
|
||||||
gSprites[gBattlerSpriteIds[bank]].pos2.y = 0;
|
gSprites[gBattlerSpriteIds[battlerId]].pos2.y = 0;
|
||||||
gDoingBattleAnim = FALSE;
|
gDoingBattleAnim = FALSE;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].ballAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].ballAnimActive = 0;
|
||||||
FreeSpriteOamMatrix(sprite);
|
FreeSpriteOamMatrix(sprite);
|
||||||
DestroySprite(sprite);
|
DestroySprite(sprite);
|
||||||
|
|
||||||
for (doneBanks = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
|
for (doneBattlers = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (gBattleSpritesDataPtr->healthBoxesData[i].ballAnimActive == 0)
|
if (gBattleSpritesDataPtr->healthBoxesData[i].ballAnimActive == 0)
|
||||||
doneBanks++;
|
doneBattlers++;
|
||||||
}
|
}
|
||||||
if (doneBanks == MAX_BATTLERS_COUNT)
|
if (doneBattlers == MAX_BATTLERS_COUNT)
|
||||||
{
|
{
|
||||||
for (i = 0; i < POKEBALL_COUNT; i++)
|
for (i = 0; i < POKEBALL_COUNT; i++)
|
||||||
FreeBallGfx(i);
|
FreeBallGfx(i);
|
||||||
@ -868,7 +868,7 @@ static void HandleBallAnimEnd(struct Sprite *sprite)
|
|||||||
|
|
||||||
static void sub_80760F8(struct Sprite *sprite)
|
static void sub_80760F8(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
u8 bank = sprite->sBank;
|
u8 battlerId = sprite->sBattler;
|
||||||
|
|
||||||
sprite->data[4]++;
|
sprite->data[4]++;
|
||||||
if (sprite->data[4] == 40)
|
if (sprite->data[4] == 40)
|
||||||
@ -883,21 +883,21 @@ static void sub_80760F8(struct Sprite *sprite)
|
|||||||
}
|
}
|
||||||
else if (sprite->data[4] == 315)
|
else if (sprite->data[4] == 315)
|
||||||
{
|
{
|
||||||
FreeOamMatrix(gSprites[gBattlerSpriteIds[sprite->sBank]].oam.matrixNum);
|
FreeOamMatrix(gSprites[gBattlerSpriteIds[sprite->sBattler]].oam.matrixNum);
|
||||||
DestroySprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]);
|
DestroySprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]);
|
||||||
DestroySpriteAndFreeResources(sprite);
|
DestroySpriteAndFreeResources(sprite);
|
||||||
if (gMain.inBattle)
|
if (gMain.inBattle)
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].ballAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].ballAnimActive = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite)
|
static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
sprite->data[0] = 25;
|
sprite->data[0] = 25;
|
||||||
sprite->data[2] = GetBattlerSpriteCoord(sprite->sBank, 2);
|
sprite->data[2] = GetBattlerSpriteCoord(sprite->sBattler, 2);
|
||||||
sprite->data[4] = GetBattlerSpriteCoord(sprite->sBank, 3) + 24;
|
sprite->data[4] = GetBattlerSpriteCoord(sprite->sBattler, 3) + 24;
|
||||||
sprite->data[5] = -30;
|
sprite->data[5] = -30;
|
||||||
sprite->oam.affineParam = sprite->sBank;
|
sprite->oam.affineParam = sprite->sBattler;
|
||||||
sub_80A68D4(sprite);
|
sub_80A68D4(sprite);
|
||||||
sprite->callback = SpriteCB_PlayerMonSendOut_2;
|
sprite->callback = SpriteCB_PlayerMonSendOut_2;
|
||||||
}
|
}
|
||||||
@ -923,7 +923,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
|
|||||||
}
|
}
|
||||||
r4 = sprite->data[0];
|
r4 = sprite->data[0];
|
||||||
sub_80A6F3C(sprite);
|
sub_80A6F3C(sprite);
|
||||||
sprite->data[7] += sprite->sBank / 3;
|
sprite->data[7] += sprite->sBattler / 3;
|
||||||
sprite->pos2.y += Sin(HIBYTE(sprite->data[7]), sprite->data[5]);
|
sprite->pos2.y += Sin(HIBYTE(sprite->data[7]), sprite->data[5]);
|
||||||
sprite->oam.affineParam += 0x100;
|
sprite->oam.affineParam += 0x100;
|
||||||
if ((sprite->oam.affineParam >> 8) % 3 != 0)
|
if ((sprite->oam.affineParam >> 8) % 3 != 0)
|
||||||
@ -946,11 +946,11 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
|
|||||||
sprite->pos1.y += sprite->pos2.y;
|
sprite->pos1.y += sprite->pos2.y;
|
||||||
sprite->pos2.y = 0;
|
sprite->pos2.y = 0;
|
||||||
sprite->pos2.x = 0;
|
sprite->pos2.x = 0;
|
||||||
sprite->sBank = sprite->oam.affineParam & 0xFF;
|
sprite->sBattler = sprite->oam.affineParam & 0xFF;
|
||||||
sprite->data[0] = 0;
|
sprite->data[0] = 0;
|
||||||
|
|
||||||
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
|
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
|
||||||
&& sprite->sBank == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT))
|
&& sprite->sBattler == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT))
|
||||||
sprite->callback = SpriteCB_ReleaseMon2FromBall;
|
sprite->callback = SpriteCB_ReleaseMon2FromBall;
|
||||||
else
|
else
|
||||||
sprite->callback = SpriteCB_ReleaseMonFromBall;
|
sprite->callback = SpriteCB_ReleaseMonFromBall;
|
||||||
@ -976,26 +976,26 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
sprite->data[0] = 0;
|
sprite->data[0] = 0;
|
||||||
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
|
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
|
||||||
&& sprite->sBank == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))
|
&& sprite->sBattler == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))
|
||||||
sprite->callback = SpriteCB_ReleaseMon2FromBall;
|
sprite->callback = SpriteCB_ReleaseMon2FromBall;
|
||||||
else
|
else
|
||||||
sprite->callback = SpriteCB_ReleaseMonFromBall;
|
sprite->callback = SpriteCB_ReleaseMonFromBall;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef sBank
|
#undef sBattler
|
||||||
|
|
||||||
static u8 LaunchBallStarsTaskForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d)
|
static u8 LaunchBallStarsTaskForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d)
|
||||||
{
|
{
|
||||||
return LaunchBallStarsTask(x, y, kindOfStars, d, BALL_POKE);
|
return LaunchBallStarsTask(x, y, kindOfStars, d, BALL_POKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 bank, u32 arg2)
|
static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 arg2)
|
||||||
{
|
{
|
||||||
return LaunchBallFadeMonTask(unFadeLater, bank, arg2, BALL_POKE);
|
return LaunchBallFadeMonTask(unFadeLater, battlerId, arg2, BALL_POKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 bank, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species)
|
void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species)
|
||||||
{
|
{
|
||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
|
|
||||||
@ -1012,7 +1012,7 @@ void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 bank, u8 x, u8 y, u8 oa
|
|||||||
gSprites[monSpriteId].data[7] = species;
|
gSprites[monSpriteId].data[7] = species;
|
||||||
|
|
||||||
gSprites[spriteId].data[1] = g;
|
gSprites[spriteId].data[1] = g;
|
||||||
gSprites[spriteId].data[2] = bank;
|
gSprites[spriteId].data[2] = battlerId;
|
||||||
gSprites[spriteId].data[3] = h;
|
gSprites[spriteId].data[3] = h;
|
||||||
gSprites[spriteId].data[4] = h >> 0x10;
|
gSprites[spriteId].data[4] = h >> 0x10;
|
||||||
gSprites[spriteId].oam.priority = oamPriority;
|
gSprites[spriteId].oam.priority = oamPriority;
|
||||||
@ -1027,7 +1027,7 @@ static void sub_8076524(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
u8 r5;
|
u8 r5;
|
||||||
u8 r7 = sprite->data[0];
|
u8 r7 = sprite->data[0];
|
||||||
u8 bank = sprite->data[2];
|
u8 battlerId = sprite->data[2];
|
||||||
u32 r4 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16);
|
u32 r4 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16);
|
||||||
|
|
||||||
if (sprite->subpriority != 0)
|
if (sprite->subpriority != 0)
|
||||||
@ -1037,7 +1037,7 @@ static void sub_8076524(struct Sprite *sprite)
|
|||||||
|
|
||||||
StartSpriteAnim(sprite, 1);
|
StartSpriteAnim(sprite, 1);
|
||||||
LaunchBallStarsTaskForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5);
|
LaunchBallStarsTaskForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5);
|
||||||
sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, bank, r4);
|
sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4);
|
||||||
sprite->callback = sub_80765E0;
|
sprite->callback = sub_80765E0;
|
||||||
gSprites[r7].invisible = FALSE;
|
gSprites[r7].invisible = FALSE;
|
||||||
StartSpriteAffineAnim(&gSprites[r7], 1);
|
StartSpriteAffineAnim(&gSprites[r7], 1);
|
||||||
@ -1175,16 +1175,16 @@ static void DestroySpriteAndFreeResources_(struct Sprite *sprite)
|
|||||||
DestroySpriteAndFreeResources(sprite);
|
DestroySpriteAndFreeResources(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8076918(u8 bank)
|
void sub_8076918(u8 battlerId)
|
||||||
{
|
{
|
||||||
struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[bank]];
|
struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[battlerId]];
|
||||||
|
|
||||||
healthboxSprite->data[0] = 5;
|
healthboxSprite->data[0] = 5;
|
||||||
healthboxSprite->data[1] = 0;
|
healthboxSprite->data[1] = 0;
|
||||||
healthboxSprite->pos2.x = 0x73;
|
healthboxSprite->pos2.x = 0x73;
|
||||||
healthboxSprite->pos2.y = 0;
|
healthboxSprite->pos2.y = 0;
|
||||||
healthboxSprite->callback = sub_80769CC;
|
healthboxSprite->callback = sub_80769CC;
|
||||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
healthboxSprite->data[0] = -healthboxSprite->data[0];
|
healthboxSprite->data[0] = -healthboxSprite->data[0];
|
||||||
healthboxSprite->data[1] = -healthboxSprite->data[1];
|
healthboxSprite->data[1] = -healthboxSprite->data[1];
|
||||||
@ -1192,7 +1192,7 @@ void sub_8076918(u8 bank)
|
|||||||
healthboxSprite->pos2.y = -healthboxSprite->pos2.y;
|
healthboxSprite->pos2.y = -healthboxSprite->pos2.y;
|
||||||
}
|
}
|
||||||
gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]);
|
gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]);
|
||||||
if (GetBattlerPosition(bank) == B_POSITION_PLAYER_RIGHT)
|
if (GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT)
|
||||||
healthboxSprite->callback = sub_80769A8;
|
healthboxSprite->callback = sub_80769A8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1214,13 +1214,13 @@ static void sub_80769CC(struct Sprite *sprite)
|
|||||||
sprite->callback = SpriteCallbackDummy;
|
sprite->callback = SpriteCallbackDummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoHitAnimHealthboxEffect(u8 bank)
|
void DoHitAnimHealthboxEffect(u8 battlerId)
|
||||||
{
|
{
|
||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
|
|
||||||
spriteId = CreateInvisibleSpriteWithCallback(SpriteCB_HitAnimHealthoxEffect);
|
spriteId = CreateInvisibleSpriteWithCallback(SpriteCB_HitAnimHealthoxEffect);
|
||||||
gSprites[spriteId].data[0] = 1;
|
gSprites[spriteId].data[0] = 1;
|
||||||
gSprites[spriteId].data[1] = gHealthboxSpriteIds[bank];
|
gSprites[spriteId].data[1] = gHealthboxSpriteIds[battlerId];
|
||||||
gSprites[spriteId].callback = SpriteCB_HitAnimHealthoxEffect;
|
gSprites[spriteId].callback = SpriteCB_HitAnimHealthoxEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1267,10 +1267,10 @@ void FreeBallGfx(u8 ballId)
|
|||||||
FreeSpritePaletteByTag(gBallSpritePalettes[ballId].tag);
|
FreeSpritePaletteByTag(gBallSpritePalettes[ballId].tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 GetBankPokeballItemId(u8 bank)
|
static u16 GetBattlerPokeballItemId(u8 battlerId)
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||||
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL);
|
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_POKEBALL);
|
||||||
else
|
else
|
||||||
return GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL);
|
return GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_POKEBALL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user