This commit is contained in:
Eduardo Quezada 2022-09-04 21:24:12 -03:00
parent 797aa08141
commit 7500435a80
16 changed files with 23 additions and 40 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1115,7 +1115,7 @@ static void RfuHandleReceiveCommand(u8 unused)
{ {
gRfu.recvBlock[i].receiving = RECV_STATE_FINISHED; gRfu.recvBlock[i].receiving = RECV_STATE_FINISHED;
Rfu_SetBlockReceivedFlag(i); 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); ValidateAndReceivePokemonSioInfo(gBlockRecvBuffer);
} }
} }

View File

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

View File

@ -201,7 +201,7 @@ static void CB2_MysteryEventMenu(void)
case 6: case 6:
if (IsLinkConnectionEstablished()) if (IsLinkConnectionEstablished())
{ {
if (gReceivedRemoteLinkPlayers != 0) if (gReceivedRemoteLinkPlayers)
{ {
if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == EXCHANGE_DIFF_SELECTIONS) 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; data->state = MG_STATE_CLIENT_LINK_WAIT;
break; break;
case MG_STATE_CLIENT_LINK_WAIT: case MG_STATE_CLIENT_LINK_WAIT:
if (gReceivedRemoteLinkPlayers != 0) if (gReceivedRemoteLinkPlayers)
{ {
ClearScreenInBg0(TRUE); ClearScreenInBg0(TRUE);
data->state = MG_STATE_CLIENT_COMMUNICATING; data->state = MG_STATE_CLIENT_COMMUNICATING;
@ -1528,7 +1528,7 @@ static void Task_MysteryGift(u8 taskId)
} }
break; break;
case MG_STATE_SERVER_LINK_WAIT: case MG_STATE_SERVER_LINK_WAIT:
if (gReceivedRemoteLinkPlayers != 0) if (gReceivedRemoteLinkPlayers)
{ {
ClearScreenInBg0(TRUE); ClearScreenInBg0(TRUE);
data->state = MG_STATE_SERVER_LINK_START; data->state = MG_STATE_SERVER_LINK_START;

View File

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

View File

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

View File

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

View File

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