Document remainder of battle_controllers.c

This commit is contained in:
GriffinR 2021-01-22 02:48:22 -05:00
parent 8fe4d004e3
commit 4eca05ccf5
23 changed files with 181 additions and 172 deletions

View File

@ -503,7 +503,7 @@
.byte \battler
.endm
.macro atk57
.macro endlinkbattle
.byte 0x57
.endm

View File

@ -2989,7 +2989,7 @@ BattleScript_LocalBattleLostDoTrainer2WinText::
BattleScript_LocalBattleLostEnd_::
end2
BattleScript_82DAA0B::
BattleScript_FrontierLinkBattleLost::
returnopponentmon1toball BS_ATTACKER
waitstate
returnopponentmon2toball BS_ATTACKER
@ -3002,23 +3002,23 @@ BattleScript_82DAA0B::
trainerslidein BS_FAINTED
waitstate
printstring STRINGID_TRAINER2WINTEXT
jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_82DAA31
atk57
BattleScript_82DAA31::
jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_FrontierLinkBattleLostEnd
endlinkbattle
BattleScript_FrontierLinkBattleLostEnd::
waitmessage 0x40
end2
BattleScript_LinkBattleWonOrLost::
jumpifbattletype BATTLE_TYPE_BATTLE_TOWER, BattleScript_82DAA5C
jumpifbattletype BATTLE_TYPE_BATTLE_TOWER, BattleScript_TowerLinkBattleWon
printstring STRINGID_BATTLEEND
waitmessage 0x40
jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_LinkBattleWonOrLostWaitEnd
atk57
endlinkbattle
BattleScript_LinkBattleWonOrLostWaitEnd::
waitmessage 0x40
end2
BattleScript_82DAA5C::
BattleScript_TowerLinkBattleWon::
playtrainerdefeatbgm BS_ATTACKER
printstring STRINGID_BATTLEEND
waitmessage 0x40
@ -3030,9 +3030,9 @@ BattleScript_82DAA5C::
trainerslidein BS_FAINTED
waitstate
printstring STRINGID_TRAINER2LOSETEXT
jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_82DAA83
atk57
BattleScript_82DAA83::
jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_TowerLinkBattleWonEnd
endlinkbattle
BattleScript_TowerLinkBattleWonEnd::
waitmessage 0x40
end2
@ -4566,6 +4566,6 @@ BattleScript_PrintPlayerForfeited::
BattleScript_PrintPlayerForfeitedLinkBattle::
printstring STRINGID_FORFEITEDMATCH
waitmessage 0x40
atk57
endlinkbattle
waitmessage 0x40
end2

View File

@ -617,7 +617,7 @@ extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT];
extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT];
extern u32 gBattleTypeFlags;
extern u8 gBattleTerrain;
extern u32 gUnknown_02022FF4;
extern u32 gUnusedFirstBattleVar1;
extern u8 *gUnknown_0202305C;
extern u8 *gUnknown_02023060;
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
@ -667,7 +667,7 @@ extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT];
extern u8 gMoveResultFlags;
extern u32 gHitMarker;
extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT];
extern u8 gUnknown_0202428C;
extern u8 gUnusedFirstBattleVar2;
extern u16 gSideStatuses[2];
extern struct SideTimer gSideTimers[2];
extern u32 gStatuses3[MAX_BATTLERS_COUNT];

View File

@ -133,7 +133,7 @@ enum
CONTROLLER_PRINTSTRING,
CONTROLLER_PRINTSTRINGPLAYERONLY,
CONTROLLER_CHOOSEACTION,
CONTROLLER_UNKNOWNYESNOBOX,
CONTROLLER_YESNOBOX,
CONTROLLER_CHOOSEMOVE,
CONTROLLER_OPENBAG,
CONTROLLER_CHOOSEPOKEMON,
@ -169,7 +169,7 @@ enum
CONTROLLER_BATTLEANIMATION,
CONTROLLER_LINKSTANDBYMSG,
CONTROLLER_RESETACTIONMOVESELECTION,
CONTROLLER_55,
CONTROLLER_ENDLINKBATTLE,
/*new controllers should go here*/
CONTROLLER_TERMINATOR_NOP,
CONTROLLER_CMDS_COUNT
@ -180,8 +180,8 @@ extern struct UnusedControllerStruct gUnusedControllerStruct;
// general functions
void HandleLinkBattleSetup(void);
void SetUpBattleVarsAndBirchZigzagoon(void);
void sub_8032768(void);
void sub_8033648(void);
void InitBattleControllers(void);
void TryReceiveLinkBattleData(void);
void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);
// emitters
@ -204,7 +204,7 @@ void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 m
void BtlController_EmitPrintString(u8 bufferId, u16 stringId);
void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId);
void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2);
void BtlController_EmitUnknownYesNoBox(u8 bufferId);
void BtlController_EmitYesNoBox(u8 bufferId);
void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData);
void BtlController_EmitChooseItem(u8 bufferId, u8* arg1);
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4);
@ -238,13 +238,13 @@ void BtlController_EmitHidePartyStatusSummary(u8 bufferId);
void BtlController_EmitEndBounceEffect(u8 bufferId);
void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 record);
void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome);
void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome);
// player controller
void SetControllerToPlayer(void);
void nullsub_21(void);
void BattleControllerDummy(void);
void PlayerHandleGetRawMonData(void);
void sub_80587B0(void);
void sub_805CC00(struct Sprite *sprite);

View File

@ -69,7 +69,7 @@ void SpriteCb_PlayerMonFromBall(struct Sprite *sprite);
void sub_8039E60(struct Sprite *sprite);
void SpriteCB_TrainerThrowObject(struct Sprite *sprite);
void sub_8039E9C(struct Sprite *sprite);
void nullsub_20(void);
void BeginBattleIntroDummy(void);
void BeginBattleIntro(void);
void SwitchInClearSetData(void);
void FaintClearSetData(void);

View File

@ -207,7 +207,7 @@ extern const u8 BattleScript_ActionSelectionItemsCantBeUsed[];
extern const u8 BattleScript_ArenaTurnBeginning[];
extern const u8 BattleScript_PalacePrintFlavorText[];
extern const u8 BattleScript_ArenaDoJudgment[];
extern const u8 BattleScript_82DAA0B[];
extern const u8 BattleScript_FrontierLinkBattleLost[];
extern const u8 BattleScript_AskIfWantsToForfeitMatch[];
extern const u8 BattleScript_PrintPlayerForfeited[];
extern const u8 BattleScript_PrintPlayerForfeitedLinkBattle[];

View File

@ -60,7 +60,7 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker);
void PressurePPLoseOnUsingImprison(u8 attacker);
void MarkAllBattlersForControllerExec(void); // unused
void MarkBattlerForControllerExec(u8 battlerId);
void sub_803F850(u8 arg0);
void MarkBattlerReceivedLinkData(u8 arg0);
void CancelMultiTurnMoves(u8 battlerId);
bool8 WasUnableToUseMove(u8 battlerId);
void PrepareStringBattle(u16 stringId, u8 battlerId);

View File

@ -5,13 +5,15 @@ extern u32 gRecordedBattleRngSeed;
extern u32 gBattlePalaceMoveSelectionRngValue;
extern u8 gRecordedBattleMultiplayerId;
void sub_8184DA4(u8 arg0);
#define B_RECORD_MODE_RECORDING 1
#define B_RECORD_MODE_PLAYBACK 2
void RecordedBattle_Init(u8 arg0);
void sub_8184E58(void);
void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action);
void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear);
u8 RecordedBattle_GetBattlerAction(u8 battlerId);
u8 sub_81850D0(void);
u8 sub_81850DC(u8 *arg0);
u8 RecordedBattle_GetAllNewBattlerData(u8 *dst);
void sub_81851A8(u8 *arg0);
bool32 CanCopyRecordedBattleSaveData(void);
bool32 MoveRecordedBattleToSaveData(void);

View File

@ -51,7 +51,7 @@ static void LinkOpponentHandleMoveAnimation(void);
static void LinkOpponentHandlePrintString(void);
static void LinkOpponentHandlePrintSelectionString(void);
static void LinkOpponentHandleChooseAction(void);
static void LinkOpponentHandleUnknownYesNoBox(void);
static void LinkOpponentHandleYesNoBox(void);
static void LinkOpponentHandleChooseMove(void);
static void LinkOpponentHandleChooseItem(void);
static void LinkOpponentHandleChoosePokemon(void);
@ -87,7 +87,7 @@ static void LinkOpponentHandleSpriteInvisibility(void);
static void LinkOpponentHandleBattleAnimation(void);
static void LinkOpponentHandleLinkStandbyMsg(void);
static void LinkOpponentHandleResetActionMoveSelection(void);
static void LinkOpponentHandleCmd55(void);
static void LinkOpponentHandleEndLinkBattle(void);
static void LinkOpponentCmdEnd(void);
static void LinkOpponentBufferRunCommand(void);
@ -123,7 +123,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_PRINTSTRING] = LinkOpponentHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = LinkOpponentHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = LinkOpponentHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = LinkOpponentHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = LinkOpponentHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = LinkOpponentHandleChooseMove,
[CONTROLLER_OPENBAG] = LinkOpponentHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = LinkOpponentHandleChoosePokemon,
@ -159,7 +159,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_BATTLEANIMATION] = LinkOpponentHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = LinkOpponentHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = LinkOpponentHandleResetActionMoveSelection,
[CONTROLLER_55] = LinkOpponentHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = LinkOpponentHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = LinkOpponentCmdEnd
};
@ -1482,7 +1482,7 @@ static void LinkOpponentHandleChooseAction(void)
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleUnknownYesNoBox(void)
static void LinkOpponentHandleYesNoBox(void)
{
LinkOpponentBufferExecCompleted();
}
@ -1836,7 +1836,7 @@ static void LinkOpponentHandleResetActionMoveSelection(void)
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleCmd55(void)
static void LinkOpponentHandleEndLinkBattle(void)
{
sub_81851A8(&gBattleBufferA[gActiveBattler][4]);

View File

@ -49,7 +49,7 @@ static void LinkPartnerHandleMoveAnimation(void);
static void LinkPartnerHandlePrintString(void);
static void LinkPartnerHandlePrintSelectionString(void);
static void LinkPartnerHandleChooseAction(void);
static void LinkPartnerHandleUnknownYesNoBox(void);
static void LinkPartnerHandleYesNoBox(void);
static void LinkPartnerHandleChooseMove(void);
static void LinkPartnerHandleChooseItem(void);
static void LinkPartnerHandleChoosePokemon(void);
@ -85,7 +85,7 @@ static void LinkPartnerHandleSpriteInvisibility(void);
static void LinkPartnerHandleBattleAnimation(void);
static void LinkPartnerHandleLinkStandbyMsg(void);
static void LinkPartnerHandleResetActionMoveSelection(void);
static void LinkPartnerHandleCmd55(void);
static void LinkPartnerHandleEndLinkBattle(void);
static void LinkPartnerCmdEnd(void);
static void LinkPartnerBufferRunCommand(void);
@ -120,7 +120,7 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_PRINTSTRING] = LinkPartnerHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = LinkPartnerHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = LinkPartnerHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = LinkPartnerHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = LinkPartnerHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = LinkPartnerHandleChooseMove,
[CONTROLLER_OPENBAG] = LinkPartnerHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = LinkPartnerHandleChoosePokemon,
@ -156,7 +156,7 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_BATTLEANIMATION] = LinkPartnerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = LinkPartnerHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = LinkPartnerHandleResetActionMoveSelection,
[CONTROLLER_55] = LinkPartnerHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = LinkPartnerHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = LinkPartnerCmdEnd
};
@ -1306,7 +1306,7 @@ static void LinkPartnerHandleChooseAction(void)
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleUnknownYesNoBox(void)
static void LinkPartnerHandleYesNoBox(void)
{
LinkPartnerBufferExecCompleted();
}
@ -1672,7 +1672,7 @@ static void LinkPartnerHandleResetActionMoveSelection(void)
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd55(void)
static void LinkPartnerHandleEndLinkBattle(void)
{
sub_81851A8(&gBattleBufferA[gActiveBattler][4]);
gBattleOutcome = gBattleBufferA[gActiveBattler][1];

View File

@ -56,7 +56,7 @@ static void OpponentHandleMoveAnimation(void);
static void OpponentHandlePrintString(void);
static void OpponentHandlePrintSelectionString(void);
static void OpponentHandleChooseAction(void);
static void OpponentHandleUnknownYesNoBox(void);
static void OpponentHandleYesNoBox(void);
static void OpponentHandleChooseMove(void);
static void OpponentHandleChooseItem(void);
static void OpponentHandleChoosePokemon(void);
@ -92,7 +92,7 @@ static void OpponentHandleSpriteInvisibility(void);
static void OpponentHandleBattleAnimation(void);
static void OpponentHandleLinkStandbyMsg(void);
static void OpponentHandleResetActionMoveSelection(void);
static void OpponentHandleCmd55(void);
static void OpponentHandleEndLinkBattle(void);
static void OpponentCmdEnd(void);
static void OpponentBufferRunCommand(void);
@ -128,7 +128,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_PRINTSTRING] = OpponentHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = OpponentHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = OpponentHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = OpponentHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = OpponentHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = OpponentHandleChooseMove,
[CONTROLLER_OPENBAG] = OpponentHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = OpponentHandleChoosePokemon,
@ -164,7 +164,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_BATTLEANIMATION] = OpponentHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = OpponentHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = OpponentHandleResetActionMoveSelection,
[CONTROLLER_55] = OpponentHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = OpponentHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = OpponentCmdEnd
};
@ -1535,7 +1535,7 @@ static void OpponentHandleChooseAction(void)
OpponentBufferExecCompleted();
}
static void OpponentHandleUnknownYesNoBox(void)
static void OpponentHandleYesNoBox(void)
{
OpponentBufferExecCompleted();
}
@ -2003,7 +2003,7 @@ static void OpponentHandleResetActionMoveSelection(void)
OpponentBufferExecCompleted();
}
static void OpponentHandleCmd55(void)
static void OpponentHandleEndLinkBattle(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_LINK && !(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER))
{

View File

@ -57,7 +57,7 @@ static void PlayerHandleMoveAnimation(void);
static void PlayerHandlePrintString(void);
static void PlayerHandlePrintSelectionString(void);
static void PlayerHandleChooseAction(void);
static void PlayerHandleUnknownYesNoBox(void);
static void PlayerHandleYesNoBox(void);
static void PlayerHandleChooseMove(void);
static void PlayerHandleChooseItem(void);
static void PlayerHandleChoosePokemon(void);
@ -93,7 +93,7 @@ static void PlayerHandleSpriteInvisibility(void);
static void PlayerHandleBattleAnimation(void);
static void PlayerHandleLinkStandbyMsg(void);
static void PlayerHandleResetActionMoveSelection(void);
static void PlayerHandleCmd55(void);
static void PlayerHandleEndLinkBattle(void);
static void PlayerCmdEnd(void);
static void PlayerBufferRunCommand(void);
@ -144,7 +144,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_PRINTSTRING] = PlayerHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = PlayerHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = PlayerHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = PlayerHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = PlayerHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = PlayerHandleChooseMove,
[CONTROLLER_OPENBAG] = PlayerHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = PlayerHandleChoosePokemon,
@ -180,7 +180,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_BATTLEANIMATION] = PlayerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = PlayerHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = PlayerHandleResetActionMoveSelection,
[CONTROLLER_55] = PlayerHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = PlayerHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = PlayerCmdEnd
};
@ -189,7 +189,7 @@ static const u8 sTargetIdentities[] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER
// unknown unused data
static const u8 sUnused[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58};
void nullsub_21(void)
void BattleControllerDummy(void)
{
}
@ -1400,7 +1400,7 @@ static void DoHitAnimBlinkSpriteEffect(void)
}
}
static void PlayerHandleUnknownYesNoInput(void)
static void PlayerHandleYesNoInput(void)
{
if (JOY_NEW(DPAD_UP) && gMultiUsePlayerCursor != 0)
{
@ -2560,7 +2560,7 @@ static void PlayerHandleChooseAction(void)
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
}
static void PlayerHandleUnknownYesNoBox(void)
static void PlayerHandleYesNoBox(void)
{
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
@ -2568,7 +2568,7 @@ static void PlayerHandleUnknownYesNoBox(void)
BattlePutTextOnWindow(gText_BattleYesNoChoice, 12);
gMultiUsePlayerCursor = 1;
BattleCreateYesNoCursorAt(1);
gBattlerControllerFuncs[gActiveBattler] = PlayerHandleUnknownYesNoInput;
gBattlerControllerFuncs[gActiveBattler] = PlayerHandleYesNoInput;
}
else
{
@ -2715,7 +2715,7 @@ static void PlayerHandleExpUpdate(void)
gTasks[taskId].tExpTask_monId = monId;
gTasks[taskId].tExpTask_gainedExp = expPointsToGive;
gTasks[taskId].tExpTask_battler = gActiveBattler;
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy;
}
}
@ -2936,7 +2936,7 @@ static void PlayerHandleIntroTrainerBallThrow(void)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy;
}
void sub_805CC00(struct Sprite *sprite)
@ -3087,7 +3087,7 @@ static void PlayerHandleResetActionMoveSelection(void)
PlayerBufferExecCompleted();
}
static void PlayerHandleCmd55(void)
static void PlayerHandleEndLinkBattle(void)
{
sub_81851A8(&gBattleBufferA[gActiveBattler][4]);
gBattleOutcome = gBattleBufferA[gActiveBattler][1];

View File

@ -47,7 +47,7 @@ static void PlayerPartnerHandleMoveAnimation(void);
static void PlayerPartnerHandlePrintString(void);
static void PlayerPartnerHandlePrintSelectionString(void);
static void PlayerPartnerHandleChooseAction(void);
static void PlayerPartnerHandleUnknownYesNoBox(void);
static void PlayerPartnerHandleYesNoBox(void);
static void PlayerPartnerHandleChooseMove(void);
static void PlayerPartnerHandleChooseItem(void);
static void PlayerPartnerHandleChoosePokemon(void);
@ -83,7 +83,7 @@ static void PlayerPartnerHandleSpriteInvisibility(void);
static void PlayerPartnerHandleBattleAnimation(void);
static void PlayerPartnerHandleLinkStandbyMsg(void);
static void PlayerPartnerHandleResetActionMoveSelection(void);
static void PlayerPartnerHandleCmd55(void);
static void PlayerPartnerHandleEndLinkBattle(void);
static void PlayerPartnerCmdEnd(void);
static void PlayerPartnerBufferRunCommand(void);
@ -124,7 +124,7 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_PRINTSTRING] = PlayerPartnerHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = PlayerPartnerHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = PlayerPartnerHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = PlayerPartnerHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = PlayerPartnerHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = PlayerPartnerHandleChooseMove,
[CONTROLLER_OPENBAG] = PlayerPartnerHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = PlayerPartnerHandleChoosePokemon,
@ -160,7 +160,7 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_BATTLEANIMATION] = PlayerPartnerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = PlayerPartnerHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = PlayerPartnerHandleResetActionMoveSelection,
[CONTROLLER_55] = PlayerPartnerHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = PlayerPartnerHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = PlayerPartnerCmdEnd
};
@ -1497,7 +1497,7 @@ static void PlayerPartnerHandleChooseAction(void)
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleUnknownYesNoBox(void)
static void PlayerPartnerHandleYesNoBox(void)
{
PlayerPartnerBufferExecCompleted();
}
@ -1602,7 +1602,7 @@ static void PlayerPartnerHandleExpUpdate(void)
gTasks[taskId].tExpTask_monId = monId;
gTasks[taskId].tExpTask_gainedExp = expPointsToGive;
gTasks[taskId].tExpTask_bank = gActiveBattler;
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy;
}
}
@ -1913,7 +1913,7 @@ static void PlayerPartnerHandleResetActionMoveSelection(void)
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleCmd55(void)
static void PlayerPartnerHandleEndLinkBattle(void)
{
gBattleOutcome = gBattleBufferA[gActiveBattler][1];
FadeOutMapMusic(5);

View File

@ -51,7 +51,7 @@ static void RecordedOpponentHandleMoveAnimation(void);
static void RecordedOpponentHandlePrintString(void);
static void RecordedOpponentHandlePrintSelectionString(void);
static void RecordedOpponentHandleChooseAction(void);
static void RecordedOpponentHandleUnknownYesNoBox(void);
static void RecordedOpponentHandleYesNoBox(void);
static void RecordedOpponentHandleChooseMove(void);
static void RecordedOpponentHandleChooseItem(void);
static void RecordedOpponentHandleChoosePokemon(void);
@ -87,7 +87,7 @@ static void RecordedOpponentHandleSpriteInvisibility(void);
static void RecordedOpponentHandleBattleAnimation(void);
static void RecordedOpponentHandleLinkStandbyMsg(void);
static void RecordedOpponentHandleResetActionMoveSelection(void);
static void RecordedOpponentHandleCmd55(void);
static void RecordedOpponentHandleEndLinkBattle(void);
static void RecordedOpponentCmdEnd(void);
static void RecordedOpponentBufferRunCommand(void);
@ -123,7 +123,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void
[CONTROLLER_PRINTSTRING] = RecordedOpponentHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedOpponentHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = RecordedOpponentHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = RecordedOpponentHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = RecordedOpponentHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = RecordedOpponentHandleChooseMove,
[CONTROLLER_OPENBAG] = RecordedOpponentHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = RecordedOpponentHandleChoosePokemon,
@ -159,7 +159,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void
[CONTROLLER_BATTLEANIMATION] = RecordedOpponentHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = RecordedOpponentHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = RecordedOpponentHandleResetActionMoveSelection,
[CONTROLLER_55] = RecordedOpponentHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = RecordedOpponentHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = RecordedOpponentCmdEnd
};
@ -1409,7 +1409,7 @@ static void RecordedOpponentHandleChooseAction(void)
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleUnknownYesNoBox(void)
static void RecordedOpponentHandleYesNoBox(void)
{
RecordedOpponentBufferExecCompleted();
}
@ -1773,7 +1773,7 @@ static void RecordedOpponentHandleResetActionMoveSelection(void)
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleCmd55(void)
static void RecordedOpponentHandleEndLinkBattle(void)
{
if (gBattleBufferA[gActiveBattler][1] == B_OUTCOME_DREW)
gBattleOutcome = gBattleBufferA[gActiveBattler][1];

View File

@ -47,7 +47,7 @@ static void RecordedPlayerHandleMoveAnimation(void);
static void RecordedPlayerHandlePrintString(void);
static void RecordedPlayerHandlePrintSelectionString(void);
static void RecordedPlayerHandleChooseAction(void);
static void RecordedPlayerHandleUnknownYesNoBox(void);
static void RecordedPlayerHandleYesNoBox(void);
static void RecordedPlayerHandleChooseMove(void);
static void RecordedPlayerHandleChooseItem(void);
static void RecordedPlayerHandleChoosePokemon(void);
@ -83,7 +83,7 @@ static void RecordedPlayerHandleSpriteInvisibility(void);
static void RecordedPlayerHandleBattleAnimation(void);
static void RecordedPlayerHandleLinkStandbyMsg(void);
static void RecordedPlayerHandleResetActionMoveSelection(void);
static void RecordedPlayerHandleCmd55(void);
static void RecordedPlayerHandleEndLinkBattle(void);
static void RecordedPlayerCmdEnd(void);
static void RecordedPlayerBufferRunCommand(void);
@ -118,7 +118,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void)
[CONTROLLER_PRINTSTRING] = RecordedPlayerHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedPlayerHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = RecordedPlayerHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = RecordedPlayerHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = RecordedPlayerHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = RecordedPlayerHandleChooseMove,
[CONTROLLER_OPENBAG] = RecordedPlayerHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = RecordedPlayerHandleChoosePokemon,
@ -154,7 +154,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void)
[CONTROLLER_BATTLEANIMATION] = RecordedPlayerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = RecordedPlayerHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = RecordedPlayerHandleResetActionMoveSelection,
[CONTROLLER_55] = RecordedPlayerHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = RecordedPlayerHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = RecordedPlayerCmdEnd
};
@ -1425,7 +1425,7 @@ static void RecordedPlayerHandleChooseAction(void)
}
}
static void RecordedPlayerHandleUnknownYesNoBox(void)
static void RecordedPlayerHandleYesNoBox(void)
{
RecordedPlayerBufferExecCompleted();
}
@ -1791,7 +1791,7 @@ static void RecordedPlayerHandleResetActionMoveSelection(void)
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleCmd55(void)
static void RecordedPlayerHandleEndLinkBattle(void)
{
gBattleOutcome = gBattleBufferA[gActiveBattler][1];
FadeOutMapMusic(5);

View File

@ -44,7 +44,7 @@ static void SafariHandleMoveAnimation(void);
static void SafariHandlePrintString(void);
static void SafariHandlePrintSelectionString(void);
static void SafariHandleChooseAction(void);
static void SafariHandleUnknownYesNoBox(void);
static void SafariHandleYesNoBox(void);
static void SafariHandleChooseMove(void);
static void SafariHandleChooseItem(void);
static void SafariHandleChoosePokemon(void);
@ -80,7 +80,7 @@ static void SafariHandleSpriteInvisibility(void);
static void SafariHandleBattleAnimation(void);
static void SafariHandleLinkStandbyMsg(void);
static void SafariHandleResetActionMoveSelection(void);
static void SafariHandleCmd55(void);
static void SafariHandleEndLinkBattle(void);
static void SafariCmdEnd(void);
static void SafariBufferRunCommand(void);
@ -108,7 +108,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_PRINTSTRING] = SafariHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = SafariHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = SafariHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = SafariHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = SafariHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = SafariHandleChooseMove,
[CONTROLLER_OPENBAG] = SafariHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = SafariHandleChoosePokemon,
@ -144,7 +144,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_BATTLEANIMATION] = SafariHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = SafariHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = SafariHandleResetActionMoveSelection,
[CONTROLLER_55] = SafariHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = SafariHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = SafariCmdEnd
};
@ -458,7 +458,7 @@ static void SafariHandleChooseAction(void)
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
}
static void SafariHandleUnknownYesNoBox(void)
static void SafariHandleYesNoBox(void)
{
SafariBufferExecCompleted();
}
@ -673,7 +673,7 @@ static void SafariHandleResetActionMoveSelection(void)
SafariBufferExecCompleted();
}
static void SafariHandleCmd55(void)
static void SafariHandleEndLinkBattle(void)
{
gBattleOutcome = gBattleBufferA[gActiveBattler][1];
FadeOutMapMusic(5);

View File

@ -52,7 +52,7 @@ static void WallyHandleMoveAnimation(void);
static void WallyHandlePrintString(void);
static void WallyHandlePrintSelectionString(void);
static void WallyHandleChooseAction(void);
static void WallyHandleUnknownYesNoBox(void);
static void WallyHandleYesNoBox(void);
static void WallyHandleChooseMove(void);
static void WallyHandleChooseItem(void);
static void WallyHandleChoosePokemon(void);
@ -88,7 +88,7 @@ static void WallyHandleSpriteInvisibility(void);
static void WallyHandleBattleAnimation(void);
static void WallyHandleLinkStandbyMsg(void);
static void WallyHandleResetActionMoveSelection(void);
static void WallyHandleCmd55(void);
static void WallyHandleEndLinkBattle(void);
static void WallyCmdEnd(void);
static void WallyBufferRunCommand(void);
@ -121,7 +121,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_PRINTSTRING] = WallyHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = WallyHandlePrintSelectionString,
[CONTROLLER_CHOOSEACTION] = WallyHandleChooseAction,
[CONTROLLER_UNKNOWNYESNOBOX] = WallyHandleUnknownYesNoBox,
[CONTROLLER_YESNOBOX] = WallyHandleYesNoBox,
[CONTROLLER_CHOOSEMOVE] = WallyHandleChooseMove,
[CONTROLLER_OPENBAG] = WallyHandleChooseItem,
[CONTROLLER_CHOOSEPOKEMON] = WallyHandleChoosePokemon,
@ -157,7 +157,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_BATTLEANIMATION] = WallyHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = WallyHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = WallyHandleResetActionMoveSelection,
[CONTROLLER_55] = WallyHandleCmd55,
[CONTROLLER_ENDLINKBATTLE] = WallyHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = WallyCmdEnd
};
@ -1211,7 +1211,7 @@ static void WallyHandleChooseAction(void)
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
}
static void WallyHandleUnknownYesNoBox(void)
static void WallyHandleYesNoBox(void)
{
WallyBufferExecCompleted();
}
@ -1449,7 +1449,7 @@ static void WallyHandleIntroTrainerBallThrow(void)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy;
}
static void sub_816AA80(u8 battlerId)
@ -1548,7 +1548,7 @@ static void WallyHandleResetActionMoveSelection(void)
WallyBufferExecCompleted();
}
static void WallyHandleCmd55(void)
static void WallyHandleEndLinkBattle(void)
{
gBattleOutcome = gBattleBufferA[gActiveBattler][1];
FadeOutMapMusic(5);

View File

@ -16,11 +16,10 @@
static EWRAM_DATA u8 sLinkSendTaskId = 0;
static EWRAM_DATA u8 sLinkReceiveTaskId = 0;
static EWRAM_DATA u8 sUnknown_02022D0A = 0;
static EWRAM_DATA u8 sUnused = 0; // Debug? Never read
EWRAM_DATA struct UnusedControllerStruct gUnusedControllerStruct = {}; // Debug? Unused code that writes to it, never read
static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {};
// this file's funcionts
static void CreateTasksForSendRecvLinkBuffers(void);
static void InitLinkBtlControllers(void);
static void InitSinglePlayerBtlControllers(void);
@ -45,11 +44,11 @@ void SetUpBattleVarsAndBirchZigzagoon(void)
{
s32 i;
gBattleMainFunc = nullsub_20;
gBattleMainFunc = BeginBattleIntroDummy;
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
gBattlerControllerFuncs[i] = nullsub_21;
gBattlerControllerFuncs[i] = BattleControllerDummy;
gBattlerPositions[i] = 0xFF;
gActionSelectionCursor[i] = 0;
gMoveSelectionCursor[i] = 0;
@ -69,18 +68,19 @@ void SetUpBattleVarsAndBirchZigzagoon(void)
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &i);
}
gUnknown_02022FF4 = 0;
gUnknown_0202428C = 0;
// Below are never read
gUnusedFirstBattleVar1 = 0;
gUnusedFirstBattleVar2 = 0;
}
void sub_8032768(void)
void InitBattleControllers(void)
{
s32 i;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
sub_8184DA4(1);
RecordedBattle_Init(B_RECORD_MODE_RECORDING);
else
sub_8184DA4(2);
RecordedBattle_Init(B_RECORD_MODE_PLAYBACK);
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
RecordedBattle_SaveParties();
@ -693,7 +693,7 @@ static void CreateTasksForSendRecvLinkBuffers(void)
gTasks[sLinkReceiveTaskId].data[14] = 0;
gTasks[sLinkReceiveTaskId].data[15] = 0;
sUnknown_02022D0A = 0;
sUnused = 0;
}
enum
@ -819,7 +819,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
}
}
void sub_8033648(void)
void TryReceiveLinkBattleData(void)
{
u8 i;
s32 j;
@ -836,9 +836,9 @@ void sub_8033648(void)
recvBuffer = (u8 *)gBlockRecvBuffer[i];
{
u8 *dest, *src;
u16 r6 = gBlockRecvBuffer[i][2];
u16 dataSize = gBlockRecvBuffer[i][2];
if (gTasks[sLinkReceiveTaskId].data[14] + 9 + r6 > 0x1000)
if (gTasks[sLinkReceiveTaskId].data[14] + 9 + dataSize > 0x1000)
{
gTasks[sLinkReceiveTaskId].data[12] = gTasks[sLinkReceiveTaskId].data[14];
gTasks[sLinkReceiveTaskId].data[14] = 0;
@ -847,10 +847,10 @@ void sub_8033648(void)
dest = &gLinkBattleRecvBuffer[gTasks[sLinkReceiveTaskId].data[14]];
src = recvBuffer;
for (j = 0; j < r6 + 8; j++)
for (j = 0; j < dataSize + 8; j++)
dest[j] = src[j];
gTasks[sLinkReceiveTaskId].data[14] = gTasks[sLinkReceiveTaskId].data[14] + r6 + 8;
gTasks[sLinkReceiveTaskId].data[14] = gTasks[sLinkReceiveTaskId].data[14] + dataSize + 8;
}
}
}
@ -881,7 +881,7 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
return;
memcpy(gBattleBufferA[battlerId], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA], blockSize);
sub_803F850(battlerId);
MarkBattlerReceivedLinkData(battlerId);
if (!(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER))
{
@ -1143,12 +1143,14 @@ void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitUnknownYesNoBox(u8 bufferId)
// Only used by the forfeit prompt in the Battle Frontier
// For other Yes/No boxes in battle, see Cmd_yesnobox
void BtlController_EmitYesNoBox(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX;
sBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX;
sBattleBuffersTransferData[2] = CONTROLLER_UNKNOWNYESNOBOX;
sBattleBuffersTransferData[3] = CONTROLLER_UNKNOWNYESNOBOX;
sBattleBuffersTransferData[0] = CONTROLLER_YESNOBOX;
sBattleBuffersTransferData[1] = CONTROLLER_YESNOBOX;
sBattleBuffersTransferData[2] = CONTROLLER_YESNOBOX;
sBattleBuffersTransferData[3] = CONTROLLER_YESNOBOX;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
@ -1484,14 +1486,14 @@ void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2)
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 record)
{
bool8 arg2_ = arg2;
bool8 record_ = record;
sBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG;
sBattleBuffersTransferData[1] = arg1;
if (arg2_)
sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = sub_81850DC(&sBattleBuffersTransferData[4]);
if (record_)
sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = RecordedBattle_GetAllNewBattlerData(&sBattleBuffersTransferData[4]);
else
sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = 0;
@ -1505,12 +1507,12 @@ void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome)
void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome)
{
sBattleBuffersTransferData[0] = CONTROLLER_55;
sBattleBuffersTransferData[0] = CONTROLLER_ENDLINKBATTLE;
sBattleBuffersTransferData[1] = battleOutcome;
sBattleBuffersTransferData[2] = gSaveBlock2Ptr->frontier.disableRecordBattle;
sBattleBuffersTransferData[3] = gSaveBlock2Ptr->frontier.disableRecordBattle;
sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = sub_81850DC(&sBattleBuffersTransferData[6]);
sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = RecordedBattle_GetAllNewBattlerData(&sBattleBuffersTransferData[6]);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[4] + 6);
}

View File

@ -147,7 +147,7 @@ EWRAM_DATA u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT] = {0};
EWRAM_DATA static u32 sUnusedUnknownArray[25] = {0};
EWRAM_DATA u32 gBattleTypeFlags = 0;
EWRAM_DATA u8 gBattleTerrain = 0;
EWRAM_DATA u32 gUnknown_02022FF4 = 0;
EWRAM_DATA u32 gUnusedFirstBattleVar1 = 0; // Never read
EWRAM_DATA struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE] = {0};
EWRAM_DATA static struct UnknownPokemonStruct4* sMultiPartnerPartyBuffer = NULL;
EWRAM_DATA u8 *gUnknown_0202305C = NULL;
@ -200,7 +200,7 @@ EWRAM_DATA u8 gMoveResultFlags = 0;
EWRAM_DATA u32 gHitMarker = 0;
EWRAM_DATA static u8 sUnusedBattlersArray[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gUnknown_0202428C = 0;
EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read
EWRAM_DATA u16 gSideStatuses[2] = {0};
EWRAM_DATA struct SideTimer gSideTimers[2] = {0};
EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0};
@ -1065,7 +1065,7 @@ static void CB2_HandleStartBattle(void)
}
break;
case 15:
sub_8032768();
InitBattleControllers();
sub_8184E58();
gBattleCommunication[SPRITES_INIT_STATE1] = 0;
gBattleCommunication[SPRITES_INIT_STATE2] = 0;
@ -1325,7 +1325,7 @@ static void CB2_HandleStartMultiPartnerBattle(void)
}
break;
case 13:
sub_8032768();
InitBattleControllers();
sub_8184E58();
gBattleCommunication[SPRITES_INIT_STATE1] = 0;
gBattleCommunication[SPRITES_INIT_STATE2] = 0;
@ -1762,7 +1762,7 @@ static void CB2_HandleStartMultiBattle(void)
}
break;
case 7:
sub_8032768();
InitBattleControllers();
sub_8184E58();
gBattleCommunication[SPRITES_INIT_STATE1] = 0;
gBattleCommunication[SPRITES_INIT_STATE2] = 0;
@ -2967,7 +2967,7 @@ void sub_8039E9C(struct Sprite *sprite)
sprite->centerToCornerVecX = gUnknown_0831ACE0[sprite->animCmdIndex];
}
void nullsub_20(void)
void BeginBattleIntroDummy(void)
{
}
@ -4393,7 +4393,11 @@ static void HandleTurnActionSelectionState(void)
}
break;
case STATE_WAIT_ACTION_CONFIRMED_STANDBY:
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC))))
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler])
| (0xF0000000)
| (gBitTable[gActiveBattler] << 4)
| (gBitTable[gActiveBattler] << 8)
| (gBitTable[gActiveBattler] << 12))))
{
if (AllAtActionConfirmed())
i = TRUE;
@ -4962,7 +4966,7 @@ static void HandleEndTurn_BattleLost(void)
}
else
{
gBattlescriptCurrInstr = BattleScript_82DAA0B;
gBattlescriptCurrInstr = BattleScript_FrontierLinkBattleLost;
gBattleOutcome &= ~(B_OUTCOME_LINK_BATTLE_RAN);
}
}

View File

@ -163,7 +163,7 @@ static void Cmd_trainerslidein(void);
static void Cmd_playse(void);
static void Cmd_fanfare(void);
static void Cmd_playfaintcry(void);
static void Cmd_unknown_57(void);
static void Cmd_endlinkbattle(void);
static void Cmd_returntoball(void);
static void Cmd_handlelearnnewmove(void);
static void Cmd_yesnoboxlearnmove(void);
@ -415,7 +415,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_playse, //0x54
Cmd_fanfare, //0x55
Cmd_playfaintcry, //0x56
Cmd_unknown_57, //0x57
Cmd_endlinkbattle, //0x57
Cmd_returntoball, //0x58
Cmd_handlelearnnewmove, //0x59
Cmd_yesnoboxlearnmove, //0x5A
@ -4835,7 +4835,7 @@ static void Cmd_openpartyscreen(void)
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
}
else if (!gSpecialStatuses[gActiveBattler].flag40)
@ -4846,7 +4846,7 @@ static void Cmd_openpartyscreen(void)
}
else
{
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
}
}
@ -4874,7 +4874,7 @@ static void Cmd_openpartyscreen(void)
}
else
{
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
flags |= 1;
}
@ -4896,7 +4896,7 @@ static void Cmd_openpartyscreen(void)
}
else if (!(flags & 1))
{
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
}
}
@ -4917,7 +4917,7 @@ static void Cmd_openpartyscreen(void)
}
else
{
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
flags |= 2;
}
@ -4939,7 +4939,7 @@ static void Cmd_openpartyscreen(void)
}
else if (!(flags & 2))
{
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
}
}
@ -4955,7 +4955,7 @@ static void Cmd_openpartyscreen(void)
else
gActiveBattler = 0;
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
}
@ -4971,7 +4971,7 @@ static void Cmd_openpartyscreen(void)
else
gActiveBattler = 1;
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
}
}
@ -5079,7 +5079,7 @@ static void Cmd_openpartyscreen(void)
{
if (gActiveBattler != battlerId)
{
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
}
}
@ -5090,7 +5090,7 @@ static void Cmd_openpartyscreen(void)
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
gActiveBattler ^= BIT_FLANK;
BtlController_EmitLinkStandbyMsg(0, 2, 0);
BtlController_EmitLinkStandbyMsg(0, 2, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
}
}
@ -5282,10 +5282,10 @@ static void Cmd_playfaintcry(void)
gBattlescriptCurrInstr += 2;
}
static void Cmd_unknown_57(void)
static void Cmd_endlinkbattle(void)
{
gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
BtlController_EmitCmd55(0, gBattleOutcome);
BtlController_EmitEndLinkBattle(0, gBattleOutcome);
MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr += 1;
@ -6362,7 +6362,7 @@ static void Cmd_various(void)
gDisableStructs[1].truantSwitchInHack = 1;
break;
case VARIOUS_EMIT_YESNOBOX:
BtlController_EmitUnknownYesNoBox(0);
BtlController_EmitYesNoBox(0);
MarkBattlerForControllerExec(gActiveBattler);
break;
case 14:

View File

@ -819,14 +819,14 @@ void MarkBattlerForControllerExec(u8 battlerId)
gBattleControllerExecFlags |= gBitTable[battlerId];
}
void sub_803F850(u8 arg0)
void MarkBattlerReceivedLinkData(u8 battlerId)
{
s32 i;
for (i = 0; i < GetLinkPlayerCount(); i++)
gBattleControllerExecFlags |= gBitTable[arg0] << (i << 2);
gBattleControllerExecFlags |= gBitTable[battlerId] << (i << 2);
gBattleControllerExecFlags &= ~(0x10000000 << arg0);
gBattleControllerExecFlags &= ~(0x10000000 << battlerId);
}
void CancelMultiTurnMoves(u8 battler)

View File

@ -350,7 +350,7 @@ static void VBlankIntr(void)
gPcmDmaCounter = gSoundInfo.pcmDmaCounter;
m4aSoundMain();
sub_8033648();
TryReceiveLinkBattleData();
if (!gMain.inBattle || !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_RECORDED)))
Random();

View File

@ -76,9 +76,9 @@ EWRAM_DATA u32 gRecordedBattleRngSeed = 0;
EWRAM_DATA u32 gBattlePalaceMoveSelectionRngValue = 0;
EWRAM_DATA static u8 sBattleRecords[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE] = {0};
EWRAM_DATA static u16 sRecordedBytesNo[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u16 sUnknown_0203C79C[4] = {0};
EWRAM_DATA static u16 sUnknown_0203C7A4[4] = {0};
EWRAM_DATA static u8 sUnknown_0203C7AC = 0;
EWRAM_DATA static u16 sPrevRecordedBytesNo[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u16 sUnknown_0203C7A4[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u8 sRecordMode = 0;
EWRAM_DATA static u8 sLvlMode = 0;
EWRAM_DATA static u8 sFrontierFacility = 0;
EWRAM_DATA static u8 sFrontierBrainSymbol = 0;
@ -93,7 +93,7 @@ EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0};
EWRAM_DATA static u16 sPlayerMonMoves[2][MAX_MON_MOVES] = {0};
EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u8 sUnknown_0203CCD0 = 0;
EWRAM_DATA static bool8 sUnknown_0203CCD0 = 0;
EWRAM_DATA static u8 sRecordMixFriendName[PLAYER_NAME_LENGTH + 1] = {0};
EWRAM_DATA static u8 sRecordMixFriendClass = 0;
EWRAM_DATA static u8 sApprenticeId = 0;
@ -104,25 +104,25 @@ static u8 sRecordMixFriendLanguage;
static u8 sApprenticeLanguage;
// this file's functions
static u8 sub_8185278(u8 *arg0, u8 *arg1, u8 *arg2);
static bool32 CopyRecordedBattleFromSave(struct RecordedBattleSave *dst);
static u8 sub_8185278(u8 *, u8 *, u8 *);
static bool32 CopyRecordedBattleFromSave(struct RecordedBattleSave *);
static void RecordedBattle_RestoreSavedParties(void);
static void CB2_RecordedBattle(void);
void sub_8184DA4(u8 arg0)
void RecordedBattle_Init(u8 mode)
{
s32 i, j;
sUnknown_0203C7AC = arg0;
sUnknown_0203CCD0 = 0;
sRecordMode = mode;
sUnknown_0203CCD0 = FALSE;
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
sRecordedBytesNo[i] = 0;
sUnknown_0203C79C[i] = 0;
sPrevRecordedBytesNo[i] = 0;
sUnknown_0203C7A4[i] = 0;
if (arg0 == 1)
if (mode == B_RECORD_MODE_RECORDING)
{
for (j = 0; j < BATTLER_RECORD_SIZE; j++)
{
@ -138,13 +138,13 @@ void sub_8184E58(void)
{
s32 i, j;
if (sUnknown_0203C7AC == 1)
if (sRecordMode == B_RECORD_MODE_RECORDING)
{
gRecordedBattleRngSeed = gRngValue;
sFrontierFacility = VarGet(VAR_FRONTIER_FACILITY);
sFrontierBrainSymbol = GetFronterBrainSymbol();
}
else if (sUnknown_0203C7AC == 2)
else if (sRecordMode == B_RECORD_MODE_PLAYBACK)
{
gRngValue = gRecordedBattleRngSeed;
}
@ -195,7 +195,7 @@ void sub_8184E58(void)
void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action)
{
if (sRecordedBytesNo[battlerId] < BATTLER_RECORD_SIZE && sUnknown_0203C7AC != 2)
if (sRecordedBytesNo[battlerId] < BATTLER_RECORD_SIZE && sRecordMode != B_RECORD_MODE_PLAYBACK)
{
sBattleRecords[battlerId][sRecordedBytesNo[battlerId]++] = action;
}
@ -231,33 +231,34 @@ u8 RecordedBattle_GetBattlerAction(u8 battlerId)
}
}
u8 sub_81850D0(void)
// Unused
static u8 GetRecordedBattleMode(void)
{
return sUnknown_0203C7AC;
return sRecordMode;
}
u8 sub_81850DC(u8 *arg0)
u8 RecordedBattle_GetAllNewBattlerData(u8 *dst)
{
u8 i, j;
u8 ret = 0;
u8 idx = 0;
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (sRecordedBytesNo[i] != sUnknown_0203C79C[i])
if (sRecordedBytesNo[i] != sPrevRecordedBytesNo[i])
{
arg0[ret++] = i;
arg0[ret++] = sRecordedBytesNo[i] - sUnknown_0203C79C[i];
dst[idx++] = i;
dst[idx++] = sRecordedBytesNo[i] - sPrevRecordedBytesNo[i];
for (j = 0; j < sRecordedBytesNo[i] - sUnknown_0203C79C[i]; j++)
for (j = 0; j < sRecordedBytesNo[i] - sPrevRecordedBytesNo[i]; j++)
{
arg0[ret++] = sBattleRecords[i][sUnknown_0203C79C[i] + j];
dst[idx++] = sBattleRecords[i][sPrevRecordedBytesNo[i] + j];
}
sUnknown_0203C79C[i] = sRecordedBytesNo[i];
sPrevRecordedBytesNo[i] = sRecordedBytesNo[i];
}
}
return ret;
return idx;
}
void sub_81851A8(u8 *arg0)
@ -720,7 +721,7 @@ void RecordedBattle_CopyBattlerMoves(void)
return;
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK))
return;
if (sUnknown_0203C7AC == 2)
if (sRecordMode == B_RECORD_MODE_PLAYBACK)
return;
for (i = 0; i < MAX_MON_MOVES; i++)
@ -841,12 +842,12 @@ u32 GetAiScriptsInRecordedBattle(void)
void sub_8186444(void)
{
sUnknown_0203CCD0 = 1;
sUnknown_0203CCD0 = TRUE;
}
bool8 sub_8186450(void)
{
return (sUnknown_0203CCD0 == 0);
return (sUnknown_0203CCD0 == FALSE);
}
void GetRecordedBattleRecordMixFriendName(u8 *dst)