BUFFER_A/B -> BATTLELINKMSGTYPE; link send/recv. task data names

Replaced the BUFFER_A and BUFFER_B constants with the BATTLELINKMSGTYPE enum, which also identifies the "controller becoming idle" message type.

Named the task data for the link send task and the link receive task. Added macros to functions related to those tasks, for legibility.
This commit is contained in:
DavidJCobb
2025-04-26 00:13:42 -04:00
parent 66c07f9c33
commit 9dc48899d3
15 changed files with 325 additions and 268 deletions

View File

@@ -332,7 +332,7 @@ static void Task_GiveExpToMon(u8 taskId)
gainedExp -= nextLvlExp - currExp;
savedActiveBank = gActiveBattler;
gActiveBattler = battlerId;
BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp);
BtlController_EmitTwoReturnValues(BATTLELINKMSGTYPE_ENGINE_TO_CONTROLLER, RET_VALUE_LEVELED_UP, gainedExp);
gActiveBattler = savedActiveBank;
if (IsDoubleBattle() == TRUE
@@ -411,7 +411,7 @@ static void Task_GiveExpWithExpBar(u8 taskId)
gainedExp -= expOnNextLvl - currExp;
savedActiveBank = gActiveBattler;
gActiveBattler = battlerId;
BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp);
BtlController_EmitTwoReturnValues(BATTLELINKMSGTYPE_ENGINE_TO_CONTROLLER, RET_VALUE_LEVELED_UP, gainedExp);
gActiveBattler = savedActiveBank;
gTasks[taskId].func = Task_LaunchLvlUpAnim;
}
@@ -584,7 +584,7 @@ static void PlayerPartnerBufferExecCompleted(void)
{
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
PrepareBufferDataTransferLink(BATTLELINKMSGTYPE_CONTROLLER_BECOMING_IDLE, 4, &playerId);
gBattleBufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP;
}
else
@@ -626,7 +626,7 @@ static void PlayerPartnerHandleGetMonData(void)
monToCheck >>= 1;
}
}
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
BtlController_EmitDataTransfer(BATTLELINKMSGTYPE_ENGINE_TO_CONTROLLER, size, monData);
PlayerPartnerBufferExecCompleted();
}
@@ -1527,7 +1527,7 @@ static void PlayerPartnerHandleChooseMove(void)
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
}
BtlController_EmitTwoReturnValues(BUFFER_B, 10, chosenMoveId | (gBattlerTarget << 8));
BtlController_EmitTwoReturnValues(BATTLELINKMSGTYPE_ENGINE_TO_CONTROLLER, 10, chosenMoveId | (gBattlerTarget << 8));
PlayerPartnerBufferExecCompleted();
}
@@ -1557,7 +1557,7 @@ static void PlayerPartnerHandleChoosePokemon(void)
}
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId;
BtlController_EmitChosenMonReturnValue(BUFFER_B, chosenMonId, NULL);
BtlController_EmitChosenMonReturnValue(BATTLELINKMSGTYPE_ENGINE_TO_CONTROLLER, chosenMonId, NULL);
PlayerPartnerBufferExecCompleted();
}