simplify the get mon set mon data functions more

This commit is contained in:
DizzyEggg 2023-08-05 12:53:14 +02:00
parent cbebdf044a
commit a505cd7fb9
10 changed files with 44 additions and 192 deletions

View File

@ -257,10 +257,10 @@ void BtlController_TerminatorNop(void); // Dummy function at the end of the tabl
void StartSendOutAnim(u32 battler, bool32 dontClearSubstituteBit); void StartSendOutAnim(u32 battler, bool32 dontClearSubstituteBit);
// handlers // handlers
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party); void BtlController_HandleGetMonData(void);
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party); void BtlController_HandleGetRawMonData(void);
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party); void BtlController_HandleSetMonData(void);
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party); void BtlController_HandleSetRawMonData(void);
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerCallback)(void)); void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerCallback)(void));
void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(void)); void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(void));
void BtlController_HandleReturnMonToBall(u32 battler); void BtlController_HandleReturnMonToBall(u32 battler);

View File

@ -29,9 +29,6 @@
#include "constants/trainers.h" #include "constants/trainers.h"
#include "recorded_battle.h" #include "recorded_battle.h"
static void LinkOpponentHandleGetMonData(void);
static void LinkOpponentHandleSetMonData(void);
static void LinkOpponentHandleSetRawMonData(void);
static void LinkOpponentHandleLoadMonSprite(void); static void LinkOpponentHandleLoadMonSprite(void);
static void LinkOpponentHandleSwitchInAnim(void); static void LinkOpponentHandleSwitchInAnim(void);
static void LinkOpponentHandleReturnMonToBall(void); static void LinkOpponentHandleReturnMonToBall(void);
@ -70,10 +67,10 @@ static void EndDrawPartyStatusSummary(void);
static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{ {
[CONTROLLER_GETMONDATA] = LinkOpponentHandleGetMonData, [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = BtlController_Empty, [CONTROLLER_GETRAWMONDATA] = BtlController_Empty,
[CONTROLLER_SETMONDATA] = LinkOpponentHandleSetMonData, [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = LinkOpponentHandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = LinkOpponentHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = LinkOpponentHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = LinkOpponentHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = LinkOpponentHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = LinkOpponentHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = LinkOpponentHandleReturnMonToBall,
@ -477,21 +474,6 @@ static void LinkOpponentBufferExecCompleted(void)
} }
} }
static void LinkOpponentHandleGetMonData(void)
{
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty);
}
static void LinkOpponentHandleSetMonData(void)
{
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty);
}
static void LinkOpponentHandleSetRawMonData(void)
{
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty);
}
static void LinkOpponentHandleLoadMonSprite(void) static void LinkOpponentHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim); BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim);

View File

@ -29,9 +29,6 @@
#include "constants/trainers.h" #include "constants/trainers.h"
#include "recorded_battle.h" #include "recorded_battle.h"
static void LinkPartnerHandleGetMonData(void);
static void LinkPartnerHandleSetMonData(void);
static void LinkPartnerHandleSetRawMonData(void);
static void LinkPartnerHandleLoadMonSprite(void); static void LinkPartnerHandleLoadMonSprite(void);
static void LinkPartnerHandleSwitchInAnim(void); static void LinkPartnerHandleSwitchInAnim(void);
static void LinkPartnerHandleReturnMonToBall(void); static void LinkPartnerHandleReturnMonToBall(void);
@ -68,10 +65,10 @@ static void EndDrawPartyStatusSummary(void);
static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{ {
[CONTROLLER_GETMONDATA] = LinkPartnerHandleGetMonData, [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = BtlController_Empty, [CONTROLLER_GETRAWMONDATA] = BtlController_Empty,
[CONTROLLER_SETMONDATA] = LinkPartnerHandleSetMonData, [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = LinkPartnerHandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = LinkPartnerHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = LinkPartnerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = LinkPartnerHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = LinkPartnerHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = LinkPartnerHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = LinkPartnerHandleReturnMonToBall,
@ -366,21 +363,6 @@ static void CompleteOnFinishedBattleAnimation(void)
LinkPartnerBufferExecCompleted(); LinkPartnerBufferExecCompleted();
} }
static void LinkPartnerHandleGetMonData(void)
{
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
}
static void LinkPartnerHandleSetMonData(void)
{
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
}
static void LinkPartnerHandleSetRawMonData(void)
{
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty);
}
static void LinkPartnerHandleLoadMonSprite(void) static void LinkPartnerHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad); BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);

View File

@ -39,10 +39,6 @@
#include "constants/trainers.h" #include "constants/trainers.h"
#include "trainer_hill.h" #include "trainer_hill.h"
static void OpponentHandleGetMonData(void);
static void OpponentHandleGetRawMonData(void);
static void OpponentHandleSetMonData(void);
static void OpponentHandleSetRawMonData(void);
static void OpponentHandleLoadMonSprite(void); static void OpponentHandleLoadMonSprite(void);
static void OpponentHandleSwitchInAnim(void); static void OpponentHandleSwitchInAnim(void);
static void OpponentHandleReturnMonToBall(void); static void OpponentHandleReturnMonToBall(void);
@ -85,10 +81,10 @@ static void EndDrawPartyStatusSummary(void);
static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{ {
[CONTROLLER_GETMONDATA] = OpponentHandleGetMonData, [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = OpponentHandleGetRawMonData, [CONTROLLER_GETRAWMONDATA] = BtlController_HandleGetRawMonData,
[CONTROLLER_SETMONDATA] = OpponentHandleSetMonData, [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = OpponentHandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = OpponentHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = OpponentHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = OpponentHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = OpponentHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = OpponentHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = OpponentHandleReturnMonToBall,
@ -499,26 +495,6 @@ static void OpponentBufferExecCompleted(void)
} }
} }
static void OpponentHandleGetMonData(void)
{
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty);
}
static void OpponentHandleGetRawMonData(void)
{
BtlController_HandleGetRawMonData(gActiveBattler, gEnemyParty);
}
static void OpponentHandleSetMonData(void)
{
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty);
}
static void OpponentHandleSetRawMonData(void)
{
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty);
}
static void OpponentHandleLoadMonSprite(void) static void OpponentHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim); BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim);

View File

@ -38,10 +38,6 @@
#include "constants/rgb.h" #include "constants/rgb.h"
static void PlayerBufferExecCompleted(void); static void PlayerBufferExecCompleted(void);
static void PlayerHandleGetMonData(void);
static void PlayerHandleGetRawMonData(void);
static void PlayerHandleSetMonData(void);
static void PlayerHandleSetRawMonData(void);
static void PlayerHandleLoadMonSprite(void); static void PlayerHandleLoadMonSprite(void);
static void PlayerHandleSwitchInAnim(void); static void PlayerHandleSwitchInAnim(void);
static void PlayerHandleReturnMonToBall(void); static void PlayerHandleReturnMonToBall(void);
@ -117,10 +113,10 @@ static void ReloadMoveNames(void);
static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{ {
[CONTROLLER_GETMONDATA] = PlayerHandleGetMonData, [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = PlayerHandleGetRawMonData, [CONTROLLER_GETRAWMONDATA] = BtlController_HandleGetRawMonData,
[CONTROLLER_SETMONDATA] = PlayerHandleSetMonData, [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = PlayerHandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = PlayerHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = PlayerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = PlayerHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = PlayerHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = PlayerHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = PlayerHandleReturnMonToBall,
@ -1759,26 +1755,6 @@ static void PrintLinkStandbyMsg(void)
} }
} }
static void PlayerHandleGetMonData(void)
{
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
}
static void PlayerHandleGetRawMonData(void)
{
BtlController_HandleGetRawMonData(gActiveBattler, gPlayerParty);
}
static void PlayerHandleSetMonData(void)
{
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
}
static void PlayerHandleSetRawMonData(void)
{
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty);
}
static void PlayerHandleLoadMonSprite(void) static void PlayerHandleLoadMonSprite(void)
{ {
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);

View File

@ -31,9 +31,6 @@
#include "constants/party_menu.h" #include "constants/party_menu.h"
#include "constants/trainers.h" #include "constants/trainers.h"
static void PlayerPartnerHandleGetMonData(void);
static void PlayerPartnerHandleSetMonData(void);
static void PlayerPartnerHandleSetRawMonData(void);
static void PlayerPartnerHandleLoadMonSprite(void); static void PlayerPartnerHandleLoadMonSprite(void);
static void PlayerPartnerHandleSwitchInAnim(void); static void PlayerPartnerHandleSwitchInAnim(void);
static void PlayerPartnerHandleReturnMonToBall(void); static void PlayerPartnerHandleReturnMonToBall(void);
@ -78,10 +75,10 @@ static void EndDrawPartyStatusSummary(void);
static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{ {
[CONTROLLER_GETMONDATA] = PlayerPartnerHandleGetMonData, [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = BtlController_Empty, [CONTROLLER_GETRAWMONDATA] = BtlController_Empty,
[CONTROLLER_SETMONDATA] = PlayerPartnerHandleSetMonData, [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = PlayerPartnerHandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = PlayerPartnerHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = PlayerPartnerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = PlayerPartnerHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = PlayerPartnerHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = PlayerPartnerHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = PlayerPartnerHandleReturnMonToBall,
@ -548,21 +545,6 @@ static void CompleteOnFinishedBattleAnimation(void)
PlayerPartnerBufferExecCompleted(); PlayerPartnerBufferExecCompleted();
} }
static void PlayerPartnerHandleGetMonData(void)
{
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
}
static void PlayerPartnerHandleSetMonData(void)
{
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
}
static void PlayerPartnerHandleSetRawMonData(void)
{
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty);
}
static void PlayerPartnerHandleLoadMonSprite(void) static void PlayerPartnerHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad); BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);

View File

@ -32,9 +32,6 @@
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/trainers.h" #include "constants/trainers.h"
static void RecordedOpponentHandleGetMonData(void);
static void RecordedOpponentHandleSetMonData(void);
static void RecordedOpponentHandleSetRawMonData(void);
static void RecordedOpponentHandleLoadMonSprite(void); static void RecordedOpponentHandleLoadMonSprite(void);
static void RecordedOpponentHandleSwitchInAnim(void); static void RecordedOpponentHandleSwitchInAnim(void);
static void RecordedOpponentHandleReturnMonToBall(void); static void RecordedOpponentHandleReturnMonToBall(void);
@ -75,10 +72,10 @@ static void EndDrawPartyStatusSummary(void);
static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{ {
[CONTROLLER_GETMONDATA] = RecordedOpponentHandleGetMonData, [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = BtlController_Empty, [CONTROLLER_GETRAWMONDATA] = BtlController_Empty,
[CONTROLLER_SETMONDATA] = RecordedOpponentHandleSetMonData, [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = RecordedOpponentHandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = RecordedOpponentHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = RecordedOpponentHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = RecordedOpponentHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = RecordedOpponentHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = RecordedOpponentHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = RecordedOpponentHandleReturnMonToBall,
@ -468,21 +465,6 @@ static void RecordedOpponentBufferExecCompleted(void)
} }
} }
static void RecordedOpponentHandleGetMonData(void)
{
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty);
}
static void RecordedOpponentHandleSetMonData(void)
{
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty);
}
static void RecordedOpponentHandleSetRawMonData(void)
{
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty);
}
static void RecordedOpponentHandleLoadMonSprite(void) static void RecordedOpponentHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim); BtlController_HandleLoadMonSprite(gActiveBattler, gEnemyParty, TryShinyAnimAfterMonAnim);

View File

@ -28,9 +28,6 @@
#include "constants/battle_anim.h" #include "constants/battle_anim.h"
#include "constants/songs.h" #include "constants/songs.h"
static void RecordedPlayerHandleGetMonData(void);
static void RecordedPlayerHandleSetMonData(void);
static void RecordedPlayerHandleSetRawMonData(void);
static void RecordedPlayerHandleLoadMonSprite(void); static void RecordedPlayerHandleLoadMonSprite(void);
static void RecordedPlayerHandleSwitchInAnim(void); static void RecordedPlayerHandleSwitchInAnim(void);
static void RecordedPlayerHandleReturnMonToBall(void); static void RecordedPlayerHandleReturnMonToBall(void);
@ -70,10 +67,10 @@ static void EndDrawPartyStatusSummary(void);
static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{ {
[CONTROLLER_GETMONDATA] = RecordedPlayerHandleGetMonData, [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = BtlController_Empty, [CONTROLLER_GETRAWMONDATA] = BtlController_Empty,
[CONTROLLER_SETMONDATA] = RecordedPlayerHandleSetMonData, [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = RecordedPlayerHandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = RecordedPlayerHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = RecordedPlayerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = RecordedPlayerHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = RecordedPlayerHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = RecordedPlayerHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = RecordedPlayerHandleReturnMonToBall,
@ -447,21 +444,6 @@ static void CompleteOnFinishedBattleAnimation(void)
RecordedPlayerBufferExecCompleted(); RecordedPlayerBufferExecCompleted();
} }
static void RecordedPlayerHandleGetMonData(void)
{
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
}
static void RecordedPlayerHandleSetMonData(void)
{
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
}
static void RecordedPlayerHandleSetRawMonData(void)
{
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty);
}
static void RecordedPlayerHandleLoadMonSprite(void) static void RecordedPlayerHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad); BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);

View File

@ -32,10 +32,6 @@
#include "constants/trainers.h" #include "constants/trainers.h"
#include "constants/rgb.h" #include "constants/rgb.h"
// this file's functions
static void WallyHandleGetMonData(void);
static void WallyHandleGetRawMonData(void);
static void WallyHandleSetMonData(void);
static void WallyHandleReturnMonToBall(void); static void WallyHandleReturnMonToBall(void);
static void WallyHandleDrawTrainerPic(void); static void WallyHandleDrawTrainerPic(void);
static void WallyHandleTrainerSlide(void); static void WallyHandleTrainerSlide(void);
@ -68,9 +64,9 @@ static void Task_StartSendOutAnim(u8 taskId);
static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{ {
[CONTROLLER_GETMONDATA] = WallyHandleGetMonData, [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = WallyHandleGetRawMonData, [CONTROLLER_GETRAWMONDATA] = BtlController_HandleGetRawMonData,
[CONTROLLER_SETMONDATA] = WallyHandleSetMonData, [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = BtlController_Empty, [CONTROLLER_SETRAWMONDATA] = BtlController_Empty,
[CONTROLLER_LOADMONSPRITE] = BtlController_Empty, [CONTROLLER_LOADMONSPRITE] = BtlController_Empty,
[CONTROLLER_SWITCHINANIM] = BtlController_Empty, [CONTROLLER_SWITCHINANIM] = BtlController_Empty,
@ -368,21 +364,6 @@ static void WallyBufferExecCompleted(void)
} }
} }
static void WallyHandleGetMonData(void)
{
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
}
static void WallyHandleGetRawMonData(void)
{
BtlController_HandleGetRawMonData(gActiveBattler, gPlayerParty);
}
static void WallyHandleSetMonData(void)
{
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
}
static void WallyHandleReturnMonToBall(void) static void WallyHandleReturnMonToBall(void)
{ {
BtlController_HandleReturnMonToBall(gActiveBattler); BtlController_HandleReturnMonToBall(gActiveBattler);

View File

@ -2195,10 +2195,12 @@ void BtlController_TerminatorNop(void)
{ {
} }
// Handlers of all the controller commands // Handlers of the controller commands
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party) void BtlController_HandleGetMonData(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 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 battler = gActiveBattler;
struct Pokemon *party = GetBattlerParty(battler);
u32 size = 0; u32 size = 0;
u8 monToCheck; u8 monToCheck;
s32 i; s32 i;
@ -2221,9 +2223,12 @@ void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party)
BattleControllerComplete(battler); BattleControllerComplete(battler);
} }
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party) void BtlController_HandleGetRawMonData(void)
{ {
struct BattlePokemon battleMon; struct BattlePokemon battleMon;
u32 battler = gActiveBattler;
struct Pokemon *party = GetBattlerParty(battler);
u8 *src = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1]; u8 *src = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1];
u8 *dst = (u8 *)&battleMon + gBattleResources->bufferA[battler][1]; u8 *dst = (u8 *)&battleMon + gBattleResources->bufferA[battler][1];
u8 i; u8 i;
@ -2235,8 +2240,10 @@ void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party)
BattleControllerComplete(battler); BattleControllerComplete(battler);
} }
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party) void BtlController_HandleSetMonData(void)
{ {
u32 battler = gActiveBattler;
struct Pokemon *party = GetBattlerParty(battler);
u32 i, monToCheck; u32 i, monToCheck;
if (gBattleResources->bufferA[battler][2] == 0) if (gBattleResources->bufferA[battler][2] == 0)
@ -2256,9 +2263,11 @@ void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party)
BattleControllerComplete(battler); BattleControllerComplete(battler);
} }
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party) void BtlController_HandleSetRawMonData(void)
{ {
u32 i; u32 i;
u32 battler = gActiveBattler;
struct Pokemon *party = GetBattlerParty(battler);
u8 *dst = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1]; u8 *dst = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1];
for (i = 0; i < gBattleResources->bufferA[battler][2]; i++) for (i = 0; i < gBattleResources->bufferA[battler][2]; i++)