Fix recorded battle link player loops (#2071)

This commit is contained in:
Eduardo Quezada 2024-12-04 18:22:16 -03:00 committed by GitHub
parent 4beb0efbcc
commit e605ffba53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -35,13 +35,13 @@ struct RecordedBattleSave
{ {
struct Pokemon playerParty[PARTY_SIZE]; struct Pokemon playerParty[PARTY_SIZE];
struct Pokemon opponentParty[PARTY_SIZE]; struct Pokemon opponentParty[PARTY_SIZE];
u8 playersName[MAX_BATTLERS_COUNT][PLAYER_NAME_LENGTH + 1]; u8 playersName[MAX_LINK_PLAYERS][PLAYER_NAME_LENGTH + 1];
u8 playersGender[MAX_BATTLERS_COUNT]; u8 playersGender[MAX_LINK_PLAYERS];
u32 playersTrainerId[MAX_BATTLERS_COUNT]; u32 playersTrainerId[MAX_LINK_PLAYERS];
u8 playersLanguage[MAX_BATTLERS_COUNT]; u8 playersLanguage[MAX_LINK_PLAYERS];
u32 rngSeed; u32 rngSeed;
u32 battleFlags; u32 battleFlags;
u8 playersBattlers[MAX_BATTLERS_COUNT]; u8 playersBattlers[MAX_LINK_PLAYERS];
u16 opponentA; u16 opponentA;
u16 opponentB; u16 opponentB;
u16 partnerId; u16 partnerId;
@ -85,7 +85,7 @@ EWRAM_DATA static u32 sAI_Scripts = 0;
EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0}; EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0}; EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0};
EWRAM_DATA static u16 sPlayerMonMoves[MAX_BATTLERS_COUNT / 2][MAX_MON_MOVES] = {0}; EWRAM_DATA static u16 sPlayerMonMoves[MAX_BATTLERS_COUNT / 2][MAX_MON_MOVES] = {0};
EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA static struct PlayerInfo sPlayers[MAX_LINK_PLAYERS] = {0};
EWRAM_DATA static bool8 sIsPlaybackFinished = 0; EWRAM_DATA static bool8 sIsPlaybackFinished = 0;
EWRAM_DATA static u8 sRecordMixFriendName[PLAYER_NAME_LENGTH + 1] = {0}; EWRAM_DATA static u8 sRecordMixFriendName[PLAYER_NAME_LENGTH + 1] = {0};
EWRAM_DATA static u8 sRecordMixFriendClass = 0; EWRAM_DATA static u8 sRecordMixFriendClass = 0;
@ -148,7 +148,7 @@ void RecordedBattle_SetTrainerInfo(void)
gRecordedBattleMultiplayerId = GetMultiplayerId(); gRecordedBattleMultiplayerId = GetMultiplayerId();
linkPlayersCount = GetLinkPlayerCount(); linkPlayersCount = GetLinkPlayerCount();
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_LINK_PLAYERS; i++)
{ {
sPlayers[i].trainerId = gLinkPlayers[i].trainerId; sPlayers[i].trainerId = gLinkPlayers[i].trainerId;
sPlayers[i].gender = gLinkPlayers[i].gender; sPlayers[i].gender = gLinkPlayers[i].gender;
@ -333,7 +333,7 @@ bool32 MoveRecordedBattleToSaveData(void)
battleSave->opponentParty[i] = sSavedOpponentParty[i]; battleSave->opponentParty[i] = sSavedOpponentParty[i];
} }
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_LINK_PLAYERS; i++)
{ {
for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++) for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++)
battleSave->playersName[i][j] = sPlayers[i].name[j]; battleSave->playersName[i][j] = sPlayers[i].name[j];
@ -535,7 +535,7 @@ static void SetVariablesForRecordedBattle(struct RecordedBattleSave *src)
gEnemyParty[i] = src->opponentParty[i]; gEnemyParty[i] = src->opponentParty[i];
} }
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_LINK_PLAYERS; i++)
{ {
for (var = FALSE, j = 0; j < PLAYER_NAME_LENGTH + 1; j++) for (var = FALSE, j = 0; j < PLAYER_NAME_LENGTH + 1; j++)
{ {