9#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_SPANISH) || \
10 (LANGUAGE == LANGUAGE_FRENCH) || (LANGUAGE == LANGUAGE_ITALIAN)
12#define APPEND_NAME_SPACE 1
15#define APPEND_NAME_SPACE 0
50 if (opponent->
side != 0) {
65 }
while (label[i] != 0);
73 opponent->
name[i] = opponent->
name[i - labelLength];
75 for (i = 0; i < labelLength; i++) {
76 opponent->
name[i] = label[i];
118 for (i = 7; i >= 0; i--)
123 for (i = 0; i <
count; i++) {
173 static u8 sBuffer[5];
194 }
while (count >= 0);
228 for (i = 0; i < 30; i++) {
235 if (signature[2] == peer[2] && signature[3] == peer[3])
282 if (signature[2] != peer[2] || signature[3] != peer[3])
284 if (signature[0] == peer[0] && signature[1] == peer[1] &&
285 signature[4] == peer[4] && signature[5] == peer[5])
300 if (signature[4] != peer[4] || signature[5] != peer[5])
302 if (signature[6] == peer[6] && signature[7] == peer[7])
319 if (signature[6] != peer[6] || signature[7] != peer[7])
321 if (signature[0] == peer[0] && signature[1] == peer[1] &&
322 signature[2] == peer[2] && signature[3] == peer[3])
337 if (signature[0] != peer[0] || signature[1] != peer[1] ||
338 signature[2] != peer[2] || signature[3] != peer[3])
340 if (signature[4] == peer[4] && signature[5] == peer[5])
355 if (peer[6] !=
'r' || peer[7] !=
'n')
373 u16 activeMembers[8];
379 for (memberSlot = 0; memberSlot < partySize; memberSlot++) {
380 unitId = activeMembers[memberSlot];
s32 BattleParty_PrepareActiveOwners(u16 *owners)
Lists the party members who fight (the first four of the party, three in a link battle) and marks eac...
What every part of the battle object shares: its includes, in their original order,...
#define UNIT_NAME_LENGTH
The length of a unit's name, its terminator excluded.
#define DJINN_RECOVERY_OPPONENT
#define FIRST_ENEMY_UNIT
Unit ids from 128 are the enemies'; in a link battle the opponent's party takes the first three.
#define DJINN_RECOVERY_PARTY
The Djinn recovery list's two tables (Djinn_GetRecoveryTableFar): the party's and the link opponent's...
#define LINK_MAX_MISSED_FRAMES
The frames a link battle tolerates without a connection before it gives up.
#define LINK_BOTH_CONNECTED
gLinkStatus: both consoles are connected.
struct BattleWork * gBattleWork
struct BattleUnit * UnitGetFar(u32 owner)
void * Djinn_GetRecoveryTableFar(s32 arg0)
void Ui_AdjustValueWithoutLimitFar(s32 message, u16 *buf)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
u16 gLinkPeerSignatures[][12]
24 bytes per peer
void * Runtime_BumpAllocateAlternatePool(s32 size)
As MemAlloc, but tries EWRAM first.
static s32 Iwram_CopyWords(volatile void *destination, const volatile void *source, s32 size)
static s32 Iwram_ClearWords(void *destination, s32 size)
s32 Battle_ClearSerialTransferPayload(void)
Clears the link transfer's payload, the signatures included.
s32 BattlePres_WaitSync(void)
In a link battle, shows the "EXEC" signature to the other console and waits up to 30 frames for it to...
s32 LinkBattle_ReceiveParty(void)
Link battle: receives the opponent's party into the enemy units, one member at a time,...
s32 BattlePres_SyncTurn(void)
In a link battle, after each action and after the end of each round, steps both consoles through the ...
LinkPartyPacketSize
What a link battle sends of each party member, and of the Djinn recovery list.
s32 BattleParty_AssignMemberSlots(void)
Records, for each party member, the unit id the link opponent knows them by (FIRST_ENEMY_UNIT plus th...
s32 LinkBattle_SendParty(void)
Link battle: sends the party, one member at a time and three places in all (an empty place has side 0...
UNUSED u8 * Text_CopyFiveCharsPaddingUnderscore(u32 unused0, u32 unused1, u16 *source)
Copies four characters of a name and a terminator, an underscore for each missing character,...
void MemFree(void *buffer)
void SerialRuntime_WaitForSend(void)
s32 SerialRuntime_BeginReceive(void *destination)
Starts receiving the partner's blocks into destination: sets the receive destination and clears the r...
s32 SerialRuntime_BeginSend(void *source, s32 size)
Starts sending size bytes from source to the partner in 20-byte blocks: sets the send source,...
void SerialRuntime_WaitForReceive(void)
volatile u16 gLinkStatus
Link status, updated by the VBlank exchange handler.
u8 gSerialPeerPayloads[4][24]
struct SerialTransferState gSerialTransfer
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u8 side
BATTLE_UNIT_ABSENT (0), BATTLE_UNIT_ENEMY (1) or BATTLE_UNIT_PARTY (2).
u8 name[0x0f]
The name, one byte a character, ending in 0.
The battle's own work: its enemies, units and their objects, the turn's actions, the spoils,...
u8 twoSided
1 in a link battle
u8 ownerSlots[8]
For each party unit, its slot as a link opponent's enemy, minus FIRST_ENEMY_UNIT; 0xff for none.
u8 linkPaused
set when the link drops or the console's id changes
u8 linkSide
this console's multiplayer id
One side's Djinn recovery list: up to 64 entries and their count.
struct DjinnRecoveryEntry entries[64]
One side's Djinn recovery table, as Djinn_GetRecoveryTable returns it.
struct DjinnRecoveryList list
u8 payload[20]
one block of the data sent