mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
start removing duplicate controller functions
This commit is contained in:
parent
17555feb20
commit
cc30d2fb53
@ -251,10 +251,15 @@ void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
|
||||
void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome);
|
||||
void BtlController_EmitDebugMenu(u8 bufferId);
|
||||
|
||||
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void));
|
||||
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void));
|
||||
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void));
|
||||
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void));
|
||||
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerFunc)(void));
|
||||
|
||||
// player controller
|
||||
void SetControllerToPlayer(void);
|
||||
void BattleControllerDummy(void);
|
||||
void PlayerHandleGetRawMonData(void);
|
||||
void SetBattleEndCallbacks(void);
|
||||
void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite);
|
||||
void CB2_SetUpReshowBattleScreenAfterMenu(void);
|
||||
|
@ -10,8 +10,7 @@ void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status);
|
||||
bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId, u16 argument);
|
||||
void InitAndLaunchSpecialAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId);
|
||||
bool8 IsBattleSEPlaying(u8 battlerId);
|
||||
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId);
|
||||
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId);
|
||||
void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId);
|
||||
void BattleGfxSfxDummy2(u16 species);
|
||||
void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId);
|
||||
void DecompressTrainerBackPic(u16 backPicId, u8 battlerId);
|
||||
|
@ -531,333 +531,7 @@ static void LinkOpponentBufferExecCompleted(void)
|
||||
|
||||
static void LinkOpponentHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
size += CopyLinkOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += CopyLinkOpponentMonData(i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty, LinkOpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleGetRawMonData(void)
|
||||
@ -867,273 +541,17 @@ static void LinkOpponentHandleGetRawMonData(void)
|
||||
|
||||
static void LinkOpponentHandleSetMonData(void)
|
||||
{
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
SetLinkOpponentMonData(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetLinkOpponentMonData(i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SetLinkOpponentMonData(u8 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
}
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty, LinkOpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleSetRawMonData(void)
|
||||
{
|
||||
u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i];
|
||||
|
||||
LinkOpponentBufferExecCompleted();
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty, LinkOpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleLoadMonSprite(void)
|
||||
{
|
||||
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
|
||||
|
||||
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2),
|
||||
GetBattlerSpriteDefault_Y(gActiveBattler),
|
||||
GetBattlerSpriteSubpriority(gActiveBattler));
|
||||
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0);
|
||||
|
||||
SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES));
|
||||
|
||||
gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim;
|
||||
BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleSwitchInAnim(void)
|
||||
@ -1153,7 +571,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
if (species == SPECIES_NONE)
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||
|
@ -425,333 +425,7 @@ static void CompleteOnFinishedBattleAnimation(void)
|
||||
|
||||
static void LinkPartnerHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
size += CopyLinkPartnerMonData(gBattlerPartyIndexes[gActiveBattler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += CopyLinkPartnerMonData(i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
LinkPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, LinkPartnerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleGetRawMonData(void)
|
||||
@ -761,279 +435,24 @@ static void LinkPartnerHandleGetRawMonData(void)
|
||||
|
||||
static void LinkPartnerHandleSetMonData(void)
|
||||
{
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
SetLinkPartnerMonData(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetLinkPartnerMonData(i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
LinkPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SetLinkPartnerMonData(u8 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
}
|
||||
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, LinkPartnerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleSetRawMonData(void)
|
||||
{
|
||||
u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i];
|
||||
|
||||
LinkPartnerBufferExecCompleted();
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty, LinkPartnerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleLoadMonSprite(void)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
|
||||
|
||||
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2),
|
||||
GetBattlerSpriteDefault_Y(gActiveBattler),
|
||||
GetBattlerSpriteSubpriority(gActiveBattler));
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0);
|
||||
gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad;
|
||||
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleSwitchInAnim(void)
|
||||
{
|
||||
ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]);
|
||||
gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1];
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]);
|
||||
gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim;
|
||||
}
|
||||
@ -1590,7 +1009,7 @@ static void Task_StartSendOutAnim(u8 taskId)
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
}
|
||||
|
@ -552,619 +552,27 @@ static void OpponentBufferExecCompleted(void)
|
||||
|
||||
static void OpponentHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
size += GetOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += GetOpponentMonData(i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static u32 GetOpponentMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty, OpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void OpponentHandleGetRawMonData(void)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
u8 *src = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 *dst = (u8 *)&battleMon + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = src[i];
|
||||
|
||||
BtlController_EmitDataTransfer(BUFFER_B, gBattleResources->bufferA[gActiveBattler][2], dst);
|
||||
OpponentBufferExecCompleted();
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gEnemyParty, OpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void OpponentHandleSetMonData(void)
|
||||
{
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
SetOpponentMonData(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetOpponentMonData(i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SetOpponentMonData(u8 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
}
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty, OpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void OpponentHandleSetRawMonData(void)
|
||||
{
|
||||
u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i];
|
||||
|
||||
OpponentBufferExecCompleted();
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty, OpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void OpponentHandleLoadMonSprite(void)
|
||||
{
|
||||
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
|
||||
|
||||
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2),
|
||||
GetBattlerSpriteDefault_Y(gActiveBattler),
|
||||
GetBattlerSpriteSubpriority(gActiveBattler));
|
||||
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0);
|
||||
|
||||
SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES));
|
||||
|
||||
gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim;
|
||||
BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim);
|
||||
}
|
||||
|
||||
static void OpponentHandleSwitchInAnim(void)
|
||||
@ -1185,7 +593,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
if (species == SPECIES_NONE)
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "constants/rgb.h"
|
||||
|
||||
static void PlayerHandleGetMonData(void);
|
||||
static void PlayerHandleGetRawMonData(void);
|
||||
static void PlayerHandleSetMonData(void);
|
||||
static void PlayerHandleSetRawMonData(void);
|
||||
static void PlayerHandleLoadMonSprite(void);
|
||||
@ -1801,603 +1802,27 @@ static void PrintLinkStandbyMsg(void)
|
||||
|
||||
static void PlayerHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
size += CopyPlayerMonData(gBattlerPartyIndexes[gActiveBattler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += CopyPlayerMonData(i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
PlayerBufferExecCompleted();
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, PlayerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static u32 CopyPlayerMonData(u8 monId, u8 *dst)
|
||||
static void PlayerHandleGetRawMonData(void)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
void PlayerHandleGetRawMonData(void)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
u8 *src = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 *dst = (u8 *)&battleMon + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = src[i];
|
||||
|
||||
BtlController_EmitDataTransfer(BUFFER_B, gBattleResources->bufferA[gActiveBattler][2], dst);
|
||||
PlayerBufferExecCompleted();
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gPlayerParty, PlayerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void PlayerHandleSetMonData(void)
|
||||
{
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
SetPlayerMonData(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetPlayerMonData(i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SetPlayerMonData(u8 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
}
|
||||
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, PlayerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void PlayerHandleSetRawMonData(void)
|
||||
{
|
||||
u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i];
|
||||
|
||||
PlayerBufferExecCompleted();
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty, PlayerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void PlayerHandleLoadMonSprite(void)
|
||||
{
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpritePosX_0;
|
||||
}
|
||||
@ -2406,7 +1831,7 @@ static void PlayerHandleSwitchInAnim(void)
|
||||
{
|
||||
ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]);
|
||||
gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1];
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
gActionSelectionCursor[gActiveBattler] = 0;
|
||||
gMoveSelectionCursor[gActiveBattler] = 0;
|
||||
StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]);
|
||||
@ -3220,7 +2645,7 @@ void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite)
|
||||
DestroySprite(sprite);
|
||||
|
||||
// Load mon sprite
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0);
|
||||
}
|
||||
|
||||
@ -3244,7 +2669,7 @@ static void Task_StartSendOutAnim(u8 taskId)
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
}
|
||||
|
@ -613,333 +613,7 @@ static void CompleteOnFinishedBattleAnimation(void)
|
||||
|
||||
static void PlayerPartnerHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
size += CopyPlayerPartnerMonData(gBattlerPartyIndexes[gActiveBattler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += CopyPlayerPartnerMonData(i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, PlayerPartnerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleGetRawMonData(void)
|
||||
@ -949,279 +623,24 @@ static void PlayerPartnerHandleGetRawMonData(void)
|
||||
|
||||
static void PlayerPartnerHandleSetMonData(void)
|
||||
{
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
SetPlayerPartnerMonData(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetPlayerPartnerMonData(i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SetPlayerPartnerMonData(u8 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
}
|
||||
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, PlayerPartnerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleSetRawMonData(void)
|
||||
{
|
||||
u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i];
|
||||
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty, PlayerPartnerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleLoadMonSprite(void)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
|
||||
|
||||
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2),
|
||||
GetBattlerSpriteDefault_Y(gActiveBattler),
|
||||
GetBattlerSpriteSubpriority(gActiveBattler));
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0);
|
||||
gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad;
|
||||
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleSwitchInAnim(void)
|
||||
{
|
||||
ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]);
|
||||
gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1];
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]);
|
||||
gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim;
|
||||
}
|
||||
@ -1864,7 +1283,7 @@ static void Task_StartSendOutAnim(u8 taskId)
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
}
|
||||
|
@ -520,333 +520,7 @@ static void RecordedOpponentBufferExecCompleted(void)
|
||||
|
||||
static void RecordedOpponentHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
size += CopyRecordedOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += CopyRecordedOpponentMonData(i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty, RecordedOpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleGetRawMonData(void)
|
||||
@ -856,273 +530,17 @@ static void RecordedOpponentHandleGetRawMonData(void)
|
||||
|
||||
static void RecordedOpponentHandleSetMonData(void)
|
||||
{
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
SetRecordedOpponentMonData(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetRecordedOpponentMonData(i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SetRecordedOpponentMonData(u8 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
}
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty, RecordedOpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleSetRawMonData(void)
|
||||
{
|
||||
u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i];
|
||||
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty, RecordedOpponentBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleLoadMonSprite(void)
|
||||
{
|
||||
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
|
||||
|
||||
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2),
|
||||
GetBattlerSpriteDefault_Y(gActiveBattler),
|
||||
GetBattlerSpriteSubpriority(gActiveBattler));
|
||||
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0);
|
||||
|
||||
SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES));
|
||||
|
||||
gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim;
|
||||
BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleSwitchInAnim(void)
|
||||
@ -1140,7 +558,7 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1];
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
|
@ -501,333 +501,7 @@ static void CompleteOnFinishedBattleAnimation(void)
|
||||
|
||||
static void RecordedPlayerHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
size += CopyRecordedPlayerMonData(gBattlerPartyIndexes[gActiveBattler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += CopyRecordedPlayerMonData(i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, RecordedPlayerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleGetRawMonData(void)
|
||||
@ -837,279 +511,24 @@ static void RecordedPlayerHandleGetRawMonData(void)
|
||||
|
||||
static void RecordedPlayerHandleSetMonData(void)
|
||||
{
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
SetRecordedPlayerMonData(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetRecordedPlayerMonData(i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SetRecordedPlayerMonData(u8 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
}
|
||||
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, RecordedPlayerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleSetRawMonData(void)
|
||||
{
|
||||
u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i];
|
||||
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty, RecordedPlayerBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleLoadMonSprite(void)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
|
||||
|
||||
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2),
|
||||
GetBattlerSpriteDefault_Y(gActiveBattler),
|
||||
GetBattlerSpriteSubpriority(gActiveBattler));
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0);
|
||||
gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad;
|
||||
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleSwitchInAnim(void)
|
||||
{
|
||||
ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]);
|
||||
gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1];
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]);
|
||||
gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim;
|
||||
}
|
||||
@ -1733,7 +1152,7 @@ static void Task_StartSendOutAnim(u8 taskId)
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
}
|
||||
|
@ -427,578 +427,17 @@ static void CompleteOnFinishedStatusAnimation(void)
|
||||
|
||||
static void WallyHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
size += CopyWallyMonData(gBattlerPartyIndexes[gActiveBattler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += CopyWallyMonData(i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
|
||||
static u32 CopyWallyMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, WallyBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void WallyHandleGetRawMonData(void)
|
||||
{
|
||||
PlayerHandleGetRawMonData();
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gPlayerParty, WallyBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void WallyHandleSetMonData(void)
|
||||
{
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleResources->bufferA[gActiveBattler][2] == 0)
|
||||
{
|
||||
SetWallyMonData(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[gActiveBattler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetWallyMonData(i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void SetWallyMonData(u8 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]);
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]);
|
||||
break;
|
||||
}
|
||||
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, WallyBufferExecCompleted);
|
||||
}
|
||||
|
||||
static void WallyHandleSetRawMonData(void)
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_gfx_sfx_util.h"
|
||||
#include "battle_message.h"
|
||||
#include "battle_setup.h"
|
||||
#include "cable_club.h"
|
||||
@ -10,6 +11,7 @@
|
||||
#include "link_rfu.h"
|
||||
#include "party_menu.h"
|
||||
#include "recorded_battle.h"
|
||||
#include "string_util.h"
|
||||
#include "task.h"
|
||||
#include "util.h"
|
||||
#include "constants/abilities.h"
|
||||
@ -1546,3 +1548,624 @@ void BtlController_EmitDebugMenu(u8 bufferId)
|
||||
sBattleBuffersTransferData[0] = CONTROLLER_DEBUGMENU;
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 1);
|
||||
}
|
||||
|
||||
// Standardized Controller functions
|
||||
static u32 GetBattlerMonData(u32 battler, struct Pokemon *party, u32 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
s32 size = 0;
|
||||
|
||||
switch (gBattleResources->bufferA[battler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
battleMon.species = GetMonData(&party[monId], MON_DATA_SPECIES);
|
||||
battleMon.item = GetMonData(&party[monId], MON_DATA_HELD_ITEM);
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
battleMon.moves[size] = GetMonData(&party[monId], MON_DATA_MOVE1 + size);
|
||||
battleMon.pp[size] = GetMonData(&party[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
battleMon.ppBonuses = GetMonData(&party[monId], MON_DATA_PP_BONUSES);
|
||||
battleMon.friendship = GetMonData(&party[monId], MON_DATA_FRIENDSHIP);
|
||||
battleMon.experience = GetMonData(&party[monId], MON_DATA_EXP);
|
||||
battleMon.hpIV = GetMonData(&party[monId], MON_DATA_HP_IV);
|
||||
battleMon.attackIV = GetMonData(&party[monId], MON_DATA_ATK_IV);
|
||||
battleMon.defenseIV = GetMonData(&party[monId], MON_DATA_DEF_IV);
|
||||
battleMon.speedIV = GetMonData(&party[monId], MON_DATA_SPEED_IV);
|
||||
battleMon.spAttackIV = GetMonData(&party[monId], MON_DATA_SPATK_IV);
|
||||
battleMon.spDefenseIV = GetMonData(&party[monId], MON_DATA_SPDEF_IV);
|
||||
battleMon.personality = GetMonData(&party[monId], MON_DATA_PERSONALITY);
|
||||
battleMon.status1 = GetMonData(&party[monId], MON_DATA_STATUS);
|
||||
battleMon.level = GetMonData(&party[monId], MON_DATA_LEVEL);
|
||||
battleMon.hp = GetMonData(&party[monId], MON_DATA_HP);
|
||||
battleMon.maxHP = GetMonData(&party[monId], MON_DATA_MAX_HP);
|
||||
battleMon.attack = GetMonData(&party[monId], MON_DATA_ATK);
|
||||
battleMon.defense = GetMonData(&party[monId], MON_DATA_DEF);
|
||||
battleMon.speed = GetMonData(&party[monId], MON_DATA_SPEED);
|
||||
battleMon.spAttack = GetMonData(&party[monId], MON_DATA_SPATK);
|
||||
battleMon.spDefense = GetMonData(&party[monId], MON_DATA_SPDEF);
|
||||
battleMon.abilityNum = GetMonData(&party[monId], MON_DATA_ABILITY_NUM);
|
||||
battleMon.otId = GetMonData(&party[monId], MON_DATA_OT_ID);
|
||||
battleMon.metLevel = GetMonData(&party[monId], MON_DATA_MET_LEVEL);
|
||||
GetMonData(&party[monId], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(battleMon.nickname, nickname);
|
||||
GetMonData(&party[monId], MON_DATA_OT_NAME, battleMon.otName);
|
||||
src = (u8 *)&battleMon;
|
||||
for (size = 0; size < sizeof(battleMon); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_SPECIES);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_HELD_ITEM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
{
|
||||
moveData.moves[size] = GetMonData(&party[monId], MON_DATA_MOVE1 + size);
|
||||
moveData.pp[size] = GetMonData(&party[monId], MON_DATA_PP1 + size);
|
||||
}
|
||||
moveData.ppBonuses = GetMonData(&party[monId], MON_DATA_PP_BONUSES);
|
||||
src = (u8 *)(&moveData);
|
||||
for (size = 0; size < sizeof(moveData); size++)
|
||||
dst[size] = src[size];
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[battler][1] - REQUEST_MOVE1_BATTLE);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
for (size = 0; size < MAX_MON_MOVES; size++)
|
||||
dst[size] = GetMonData(&party[monId], MON_DATA_PP1 + size);
|
||||
dst[size] = GetMonData(&party[monId], MON_DATA_PP_BONUSES);
|
||||
size++;
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_PP1 + gBattleResources->bufferA[battler][1] - REQUEST_PPMOVE1_BATTLE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
data32 = GetMonData(&party[monId], MON_DATA_OT_ID);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
data32 = GetMonData(&party[monId], MON_DATA_EXP);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
size = 3;
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_HP_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_ATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_DEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SPEED_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SPATK_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SPDEF_EV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_FRIENDSHIP);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_POKERUS);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_MET_LOCATION);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_MET_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_MET_GAME);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_POKEBALL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_HP_IV);
|
||||
dst[1] = GetMonData(&party[monId], MON_DATA_ATK_IV);
|
||||
dst[2] = GetMonData(&party[monId], MON_DATA_DEF_IV);
|
||||
dst[3] = GetMonData(&party[monId], MON_DATA_SPEED_IV);
|
||||
dst[4] = GetMonData(&party[monId], MON_DATA_SPATK_IV);
|
||||
dst[5] = GetMonData(&party[monId], MON_DATA_SPDEF_IV);
|
||||
size = 6;
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_HP_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_ATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_DEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SPEED_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SPATK_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SPDEF_IV);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
data32 = GetMonData(&party[monId], MON_DATA_PERSONALITY);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_CHECKSUM);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
data32 = GetMonData(&party[monId], MON_DATA_STATUS);
|
||||
dst[0] = (data32 & 0x000000FF);
|
||||
dst[1] = (data32 & 0x0000FF00) >> 8;
|
||||
dst[2] = (data32 & 0x00FF0000) >> 16;
|
||||
dst[3] = (data32 & 0xFF000000) >> 24;
|
||||
size = 4;
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_LEVEL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_MAX_HP);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_ATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_DEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_SPEED);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_SPATK);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
data16 = GetMonData(&party[monId], MON_DATA_SPDEF);
|
||||
dst[0] = data16;
|
||||
dst[1] = data16 >> 8;
|
||||
size = 2;
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_COOL);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_BEAUTY);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_CUTE);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SMART);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_TOUGH);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SHEEN);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_COOL_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_BEAUTY_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_CUTE_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_SMART_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
dst[0] = GetMonData(&party[monId], MON_DATA_TOUGH_RIBBON);
|
||||
size = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static void SetBattlerMonData(u32 battler, struct Pokemon *party, u32 monId)
|
||||
{
|
||||
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[battler][3];
|
||||
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[battler][3];
|
||||
s32 i;
|
||||
|
||||
switch (gBattleResources->bufferA[battler][1])
|
||||
{
|
||||
case REQUEST_ALL_BATTLE:
|
||||
{
|
||||
u8 iv;
|
||||
|
||||
SetMonData(&party[monId], MON_DATA_SPECIES, &battlePokemon->species);
|
||||
SetMonData(&party[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&party[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
|
||||
SetMonData(&party[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
|
||||
}
|
||||
SetMonData(&party[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
|
||||
SetMonData(&party[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
|
||||
SetMonData(&party[monId], MON_DATA_EXP, &battlePokemon->experience);
|
||||
iv = battlePokemon->hpIV;
|
||||
SetMonData(&party[monId], MON_DATA_HP_IV, &iv);
|
||||
iv = battlePokemon->attackIV;
|
||||
SetMonData(&party[monId], MON_DATA_ATK_IV, &iv);
|
||||
iv = battlePokemon->defenseIV;
|
||||
SetMonData(&party[monId], MON_DATA_DEF_IV, &iv);
|
||||
iv = battlePokemon->speedIV;
|
||||
SetMonData(&party[monId], MON_DATA_SPEED_IV, &iv);
|
||||
iv = battlePokemon->spAttackIV;
|
||||
SetMonData(&party[monId], MON_DATA_SPATK_IV, &iv);
|
||||
iv = battlePokemon->spDefenseIV;
|
||||
SetMonData(&party[monId], MON_DATA_SPDEF_IV, &iv);
|
||||
SetMonData(&party[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
|
||||
SetMonData(&party[monId], MON_DATA_STATUS, &battlePokemon->status1);
|
||||
SetMonData(&party[monId], MON_DATA_LEVEL, &battlePokemon->level);
|
||||
SetMonData(&party[monId], MON_DATA_HP, &battlePokemon->hp);
|
||||
SetMonData(&party[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
|
||||
SetMonData(&party[monId], MON_DATA_ATK, &battlePokemon->attack);
|
||||
SetMonData(&party[monId], MON_DATA_DEF, &battlePokemon->defense);
|
||||
SetMonData(&party[monId], MON_DATA_SPEED, &battlePokemon->speed);
|
||||
SetMonData(&party[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
|
||||
SetMonData(&party[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
|
||||
}
|
||||
break;
|
||||
case REQUEST_SPECIES_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_HELDITEM_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_MOVES_PP_BATTLE:
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
SetMonData(&party[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
|
||||
SetMonData(&party[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
|
||||
}
|
||||
SetMonData(&party[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
|
||||
break;
|
||||
case REQUEST_MOVE1_BATTLE:
|
||||
case REQUEST_MOVE2_BATTLE:
|
||||
case REQUEST_MOVE3_BATTLE:
|
||||
case REQUEST_MOVE4_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[battler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_PP_DATA_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_PP1, &gBattleResources->bufferA[battler][3]);
|
||||
SetMonData(&party[monId], MON_DATA_PP2, &gBattleResources->bufferA[battler][4]);
|
||||
SetMonData(&party[monId], MON_DATA_PP3, &gBattleResources->bufferA[battler][5]);
|
||||
SetMonData(&party[monId], MON_DATA_PP4, &gBattleResources->bufferA[battler][6]);
|
||||
SetMonData(&party[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[battler][7]);
|
||||
break;
|
||||
case REQUEST_PPMOVE1_BATTLE:
|
||||
case REQUEST_PPMOVE2_BATTLE:
|
||||
case REQUEST_PPMOVE3_BATTLE:
|
||||
case REQUEST_PPMOVE4_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_PP1 + gBattleResources->bufferA[battler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_OTID_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_EXP_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_EXP, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_HP_EV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_EV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_EV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_EV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_EV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_EV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_FRIENDSHIP_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_POKERUS_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LOCATION_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_MET_LEVEL_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_MET_GAME_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_POKEBALL_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_ALL_IVS_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[battler][3]);
|
||||
SetMonData(&party[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[battler][4]);
|
||||
SetMonData(&party[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[battler][5]);
|
||||
SetMonData(&party[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[battler][6]);
|
||||
SetMonData(&party[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[battler][7]);
|
||||
SetMonData(&party[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[battler][8]);
|
||||
break;
|
||||
case REQUEST_HP_IV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_IV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_IV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_IV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_IV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_IV_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_PERSONALITY_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_CHECKSUM_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_STATUS_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_STATUS, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_LEVEL_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_HP_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_HP, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_MAX_HP_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_ATK_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_ATK, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_DEF_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_DEF, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPEED_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPEED, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPATK_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPATK, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SPDEF_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_COOL, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_CUTE, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SMART, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SHEEN_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_COOL_RIBBON_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_BEAUTY_RIBBON_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_CUTE_RIBBON_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_SMART_RIBBON_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
case REQUEST_TOUGH_RIBBON_BATTLE:
|
||||
SetMonData(&party[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[battler][3]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||
HandleLowHpMusicChange(&party[gBattlerPartyIndexes[battler]], battler);
|
||||
}
|
||||
|
||||
|
||||
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void))
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleResources->bufferA[battler][2] == 0)
|
||||
{
|
||||
size += GetBattlerMonData(battler, party, gBattlerPartyIndexes[battler], monData);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[battler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
size += GetBattlerMonData(battler, party, i, monData + size);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
execCompleteFunc();
|
||||
}
|
||||
|
||||
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void))
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
u8 *src = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1];
|
||||
u8 *dst = (u8 *)&battleMon + gBattleResources->bufferA[battler][1];
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[battler][2]; i++)
|
||||
dst[i] = src[i];
|
||||
|
||||
BtlController_EmitDataTransfer(BUFFER_B, gBattleResources->bufferA[battler][2], dst);
|
||||
execCompleteFunc();
|
||||
}
|
||||
|
||||
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void))
|
||||
{
|
||||
u32 i, monToCheck;
|
||||
|
||||
if (gBattleResources->bufferA[battler][2] == 0)
|
||||
{
|
||||
SetBattlerMonData(battler, party, gBattlerPartyIndexes[battler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
monToCheck = gBattleResources->bufferA[battler][2];
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (monToCheck & 1)
|
||||
SetBattlerMonData(battler, party, i);
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
execCompleteFunc();
|
||||
}
|
||||
|
||||
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void))
|
||||
{
|
||||
u32 i;
|
||||
u8 *dst = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1];
|
||||
|
||||
for (i = 0; i < gBattleResources->bufferA[battler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[battler][3 + i];
|
||||
|
||||
execCompleteFunc();
|
||||
}
|
||||
|
||||
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerFunc)(void))
|
||||
{
|
||||
u16 species = GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES);
|
||||
|
||||
BattleLoadMonSpriteGfx(&party[gBattlerPartyIndexes[battler]], battler, GetBattlerSide(battler));
|
||||
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battler));
|
||||
|
||||
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate,
|
||||
GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2),
|
||||
GetBattlerSpriteDefault_Y(battler),
|
||||
GetBattlerSpriteSubpriority(battler));
|
||||
|
||||
gSprites[gBattlerSpriteIds[battler]].x2 = -DISPLAY_WIDTH;
|
||||
gSprites[gBattlerSpriteIds[battler]].data[0] = battler;
|
||||
gSprites[gBattlerSpriteIds[battler]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0);
|
||||
|
||||
SetBattlerShadowSpriteCallback(battler, species);
|
||||
|
||||
gBattlerControllerFuncs[battler] = controllerFunc;
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ bool8 IsBattleSEPlaying(u8 battlerId)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 opponent)
|
||||
void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId)
|
||||
{
|
||||
u32 monsPersonality, currentPersonality, otId, currentOtId, species, paletteOffset, position;
|
||||
const void *lzPaletteData;
|
||||
@ -577,7 +577,7 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
|
||||
}
|
||||
|
||||
position = GetBattlerPosition(battlerId);
|
||||
if (opponent)
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
|
||||
{
|
||||
HandleLoadSpecialPokePic(TRUE,
|
||||
gMonSpritesGfxPtr->sprites.ptr[position],
|
||||
@ -609,16 +609,6 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
|
||||
}
|
||||
}
|
||||
|
||||
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||
{
|
||||
BattleLoadMonSpriteGfx(mon, battlerId, TRUE);
|
||||
}
|
||||
|
||||
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||
{
|
||||
BattleLoadMonSpriteGfx(mon, battlerId, FALSE);
|
||||
}
|
||||
|
||||
void BattleGfxSfxDummy2(u16 species)
|
||||
{
|
||||
}
|
||||
@ -968,12 +958,7 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
|
||||
else
|
||||
{
|
||||
if (!IsContest())
|
||||
{
|
||||
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
else
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
}
|
||||
BattleLoadMonSpriteGfx(&GetBattlerParty(battlerId)[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9983,13 +9983,13 @@ static void Cmd_various(void)
|
||||
if (IsBattlerAlive(gActiveBattler))
|
||||
{
|
||||
SetBattlerShadowSpriteCallback(gActiveBattler, gBattleMons[gActiveBattler].species);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
}
|
||||
i = BATTLE_PARTNER(gActiveBattler);
|
||||
if (IsBattlerAlive(i))
|
||||
{
|
||||
SetBattlerShadowSpriteCallback(i, gBattleMons[i].species);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[i]], i);
|
||||
BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[i]], i);
|
||||
}
|
||||
}
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
@ -187,7 +187,7 @@ static bool8 LoadBattlerSpriteGfx(u8 battler)
|
||||
if (GetBattlerSide(battler) != B_SIDE_PLAYER)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->battlerData[battler].behindSubstitute)
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battler]], battler);
|
||||
BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battler]], battler);
|
||||
else
|
||||
BattleLoadSubstituteOrMonSpriteGfx(battler, FALSE);
|
||||
}
|
||||
@ -196,7 +196,7 @@ static bool8 LoadBattlerSpriteGfx(u8 battler)
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == B_POSITION_PLAYER_LEFT) // Should be checking position, not battler.
|
||||
DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, battler);
|
||||
else if (!gBattleSpritesDataPtr->battlerData[battler].behindSubstitute)
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler);
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler);
|
||||
else
|
||||
BattleLoadSubstituteOrMonSpriteGfx(battler, FALSE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user