Merge pull request #1765 from AsparagusEduardo/pret/pokefirered_sync4

Implemented review changes from https://github.com/pret/pokefirered/pull/548
This commit is contained in:
GriffinR 2022-09-06 21:40:37 -04:00 committed by GitHub
commit 281bddcd3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 23 additions and 40 deletions

View File

@ -386,13 +386,9 @@ static void CompleteOnHealthbarDone(void)
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
if (hpValue != -1)
{
UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT);
}
else
{
LinkOpponentBufferExecCompleted();
}
}
static void HideHealthboxAfterMonFaint(void)

View File

@ -397,9 +397,7 @@ static void CompleteOnHealthbarDone(void)
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
if (hpValue != -1)
{
UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT);
}
else
OpponentBufferExecCompleted();
}

View File

@ -373,13 +373,9 @@ static void CompleteOnHealthbarDone(void)
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
if (hpValue != -1)
{
UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT);
}
else
{
RecordedOpponentBufferExecCompleted();
}
}
static void HideHealthboxAfterMonFaint(void)

View File

@ -660,18 +660,12 @@ static void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size)
switch (bufferId)
{
case BUFFER_A:
for (i = 0; i < size; i++)
{
for (i = 0; i < size; data++, i++)
gBattleBufferA[gActiveBattler][i] = *data;
data++;
}
break;
case BUFFER_B:
for (i = 0; i < size; i++)
{
for (i = 0; i < size; data++, i++)
gBattleBufferB[gActiveBattler][i] = *data;
data++;
}
break;
}
}
@ -808,8 +802,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
}
break;
case 5:
gTasks[taskId].data[13]--;
if (gTasks[taskId].data[13] == 0)
if (--gTasks[taskId].data[13] == 0)
{
gTasks[taskId].data[13] = 1;
gTasks[taskId].data[11] = 3;
@ -824,7 +817,7 @@ void TryReceiveLinkBattleData(void)
s32 j;
u8 *recvBuffer;
if (gReceivedRemoteLinkPlayers != 0 && (gBattleTypeFlags & BATTLE_TYPE_LINK_IN_BATTLE))
if (gReceivedRemoteLinkPlayers && (gBattleTypeFlags & BATTLE_TYPE_LINK_IN_BATTLE))
{
DestroyTask_RfuIdle();
for (i = 0; i < GetLinkPlayerCount(); i++)

View File

@ -967,7 +967,7 @@ static void CB2_HandleStartBattle(void)
case 1:
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
if (IsLinkTaskFinished())
{
@ -1175,7 +1175,7 @@ static void CB2_HandleStartMultiPartnerBattle(void)
case 1:
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
u8 language;
@ -1442,7 +1442,7 @@ static void CB2_PreInitMultiBattle(void)
switch (gBattleCommunication[MULTIUSE_STATE])
{
case 0:
if (gReceivedRemoteLinkPlayers != 0 && IsLinkTaskFinished())
if (gReceivedRemoteLinkPlayers && IsLinkTaskFinished())
{
sMultiPartnerPartyBuffer = Alloc(sizeof(gMultiPartnerParty));
SetMultiPartnerMenuParty(0);
@ -1578,7 +1578,7 @@ static void CB2_HandleStartMultiBattle(void)
case 1:
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
if (IsLinkTaskFinished())
{
@ -5183,7 +5183,7 @@ static void ReturnFromBattleToOverworld(void)
PartySpreadPokerus(gPlayerParty);
}
if (gBattleTypeFlags & BATTLE_TYPE_LINK && gReceivedRemoteLinkPlayers != 0)
if (gBattleTypeFlags & BATTLE_TYPE_LINK && gReceivedRemoteLinkPlayers)
return;
gSpecialVar_Result = gBattleOutcome;

View File

@ -2635,7 +2635,7 @@ static void LoadLinkMultiOpponentsData(void)
gTrainerBattleOpponent_B = gSaveBlock2Ptr->frontier.trainerIds[battleNum * 2 + 1];
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_B, 1);
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType == 0)
if (gReceivedRemoteLinkPlayers && gWirelessCommType == 0)
gSpecialVar_Result = 4;
else
gSpecialVar_Result = 6;

View File

@ -3428,7 +3428,7 @@ static u32 Cmd_CloseLink(struct BerryCrushGame *game, u8 *args)
SetCloseLinkCallback();
break;
case 2:
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
return 0;
game->nextCmd = CMD_QUIT;
RunOrScheduleCommand(CMD_HIDE_GAME, SCHEDULE_CMD, NULL);

View File

@ -665,7 +665,7 @@ void StartDodrioBerryPicking(u16 partyId, void (*exitCallback)(void))
{
sExitingGame = FALSE;
if (gReceivedRemoteLinkPlayers != 0 && (sGame = AllocZeroed(sizeof(*sGame))))
if (gReceivedRemoteLinkPlayers && (sGame = AllocZeroed(sizeof(*sGame))))
{
ResetTasksAndSprites();
InitDodrioGame(sGame);
@ -775,7 +775,7 @@ static void Task_StartDodrioGame(u8 taskId)
case 3:
if (IsLinkTaskFinished())
{
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(0, 0);

View File

@ -1115,7 +1115,7 @@ static void RfuHandleReceiveCommand(u8 unused)
{
gRfu.recvBlock[i].receiving = RECV_STATE_FINISHED;
Rfu_SetBlockReceivedFlag(i);
if (GetHostRfuGameData()->activity == (ACTIVITY_CHAT | IN_UNION_ROOM) && gReceivedRemoteLinkPlayers != 0 && gRfu.parentChild == MODE_CHILD)
if (GetHostRfuGameData()->activity == (ACTIVITY_CHAT | IN_UNION_ROOM) && gReceivedRemoteLinkPlayers && gRfu.parentChild == MODE_CHILD)
ValidateAndReceivePokemonSioInfo(gBlockRecvBuffer);
}
}

View File

@ -315,7 +315,7 @@ static void Task_StaticCountdown_Run(u8 taskId)
u16 packet[RFU_PACKET_SIZE];
s16 *data = gTasks[taskId].data;
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
// Read link timer
if (gRecvCmds[0][1] == LINKCMD_COUNTDOWN)

View File

@ -201,7 +201,7 @@ static void CB2_MysteryEventMenu(void)
case 6:
if (IsLinkConnectionEstablished())
{
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == EXCHANGE_DIFF_SELECTIONS)
{

View File

@ -1232,7 +1232,7 @@ static void Task_MysteryGift(u8 taskId)
data->state = MG_STATE_CLIENT_LINK_WAIT;
break;
case MG_STATE_CLIENT_LINK_WAIT:
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
ClearScreenInBg0(TRUE);
data->state = MG_STATE_CLIENT_COMMUNICATING;
@ -1528,7 +1528,7 @@ static void Task_MysteryGift(u8 taskId)
}
break;
case MG_STATE_SERVER_LINK_WAIT:
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
ClearScreenInBg0(TRUE);
data->state = MG_STATE_SERVER_LINK_START;

View File

@ -444,7 +444,7 @@ static void Task_MixingRecordsRecv(u8 taskId)
}
break;
case 1: // wait for handshake
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
ConvertIntToDecimalStringN(gStringVar1, GetMultiplayerId_(), STR_CONV_MODE_LEADING_ZEROS, 2);
task->tState = 5;

View File

@ -149,7 +149,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gBattlerInMenuId], 0);
if (gWirelessCommType != 0 && gReceivedRemoteLinkPlayers != 0)
if (gWirelessCommType != 0 && gReceivedRemoteLinkPlayers)
{
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(0, 0);

View File

@ -2391,7 +2391,7 @@ s32 GetGameProgressForLinkTrade(void)
s32 isGameFrLg;
u16 version;
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
isGameFrLg = 0;
version = (gLinkPlayers[GetMultiplayerId() ^ 1].version & 0xFF);

View File

@ -702,7 +702,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
}
else
{
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
if (IsActivityWithVariableGroupSize(gPlayerCurrActivity))
GetOtherPlayersInfoFlags();
@ -2047,7 +2047,7 @@ static void Task_SendMysteryGift(u8 taskId)
{
data->state = 13;
}
else if (gReceivedRemoteLinkPlayers != 0)
else if (gReceivedRemoteLinkPlayers)
{
UpdateGameData_GroupLockedIn(TRUE);
data->state++;