57 if (transition->
frames != 0) {
81 if (transition->
flag == 0) {
101 if (enemyCount != 0) {
105 if (announced == enemyCount - 1)
111 }
while (announced != enemyCount);
145 for (i = 0; i < count; i++)
156 for (i = 0; i < count; i++)
161 for (i = 0; i < count; i++) {
163 battle->
enemyIds[position] = unitIds[i];
220 }
while (remaining >= 0);
272 for (i = 0; i < count; i++) {
308 if (i < list->count) {
323 }
while (i < list->count);
329#define NUM_SUMMONS 32
339 u16 partyMembers[10];
354 for (partySlot = 0; partySlot < partySize; partySlot++) {
374 if (totals[0] >= required[0]) {
383 }
while (*total >= *required);
387 availableMask |= 1u << element;
void BattleCamera_SetRange(s32 centerX, s32 centerY, s32 offsetX, s32 offsetY, s32 scale)
Builds the perspective plane's next page for a zoom of scale about centerX and centerY (all 16....
s32 BattleEnemyList(s16 *unitIds)
Lists the enemy units present, ended by BATTLE_UNIT_LIST_END, and returns how many there are (0 when ...
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...
s32 BattlePresentation_WaitForAdvance(void)
Shows the bobbing arrow at the message window and waits for the player to go on (B,...
struct BattleObj * BattleObjGet(s32 unitId)
Returns unitId's battle object, through its place, or null for a unit with no place.
#define NUM_SUMMONS
The summon ids the mask covers, one bit each.
void BattleParty_CollectUnitList(void)
Fills the battle's two unit lists, each ended by BATTLE_UNIT_LIST_END: the party members in their ord...
void BattleIntro_AnnounceEncounter(s32 enemyCount)
Announces the enemies at the start of a battle, then whether the party strikes first or is caught by ...
s32 BattlePresentation_InitializeTilePattern(void)
Moves the 16 bytes at VRAM 0x06000290 down to 0x06000280 and clears the 20 bytes from 0x0600028c.
void BattlePresentation_UpdateCamera(void)
Runs each frame of a battle.
struct BattleSummonState * BattleSummon_UpdateAvailability(void)
Works out which summons the party can call: one whose Djinn requirement of every element is met by th...
void Party_ReservedNoOp5B14(s32 unused)
Does nothing; Battle_RunEncounter calls it with 1 as the battle is set up.
s32 BattleParty_ReconcileDjinnRecovery(void)
Brings the Djinn recovery list up to date as a battle starts: every Djinni a party member has on stan...
s32 BattleParty_ResetActiveRuntimeFields(void)
Clears every battle-only state of the party members (stat stages and their turns, statuses,...
void BattlePresentation_ClearBg0VerticalOffset(void)
Nothing in the source calls it.
void BattleSummon_ReservedNoOp(void)
Does nothing; nothing in the source calls it.
s8 gBattleParty_CenterOrderOffsets[]
struct BattleCamera * gCameraWork
What every part of the battle object shares: its includes, in their original order,...
#define FORMATION_INTERLEAVED
#define DJINN_RECOVERY_OPPONENT
#define DJINN_RECOVERY_AFTER_BATTLE
DjinnRecoveryEntry.turns of a Djinni waiting for the battle to end.
#define FORMATION_SHUFFLED
BattleWork.battleType, from the enemy formation (BattleFormation_BuildEnemyList): the random formatio...
#define SIO_MULTI_PLAYER_ID()
This console's number in a link session (SIOCNT bits 4 and 5, which the hardware sets in multi-player...
#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.
#define DJINN_PER_ELEMENT
@ BATTLE_ENCOUNTER_ENEMIES_FIRST
@ BATTLE_ENCOUNTER_PARTY_FIRST
@ BATTLE_UNIT_LIST_END
ends the list
struct BattleWork * gBattleWork
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
struct BattleUnit * UnitGetFar(u32 owner)
s32 GameFlag_TestFar(s32 flag)
u32 * DjinnRecovery_AddStandbyFar(u32 kind, u32 first, u32 second)
void * Djinn_GetRecoveryTableFar(s32 arg0)
s32 DjinnRecovery_RemoveFar(s32 owner, s32 index, s32 bit)
const struct SummonDefinition * SummonDefinition_Get(u32 summon_id)
Far call to SummonDefinition_GetNear.
s32 Djinn_IsReadyFar(s32 owner, s32 index, s32 bit)
s32 Djinn_ActivateFar(s32 owner, s32 index, s32 bit)
void UnitCalcFar(s32 owner)
void UiWork_FinalizeSharedSlotFar(void)
void UiWork_PushValueSlotFar(u32 value, u32 kind)
void UiText_ShowMessageAndWaitCoreFar(s32 argument)
void UiWork_ClearValueNameTablesFar(void)
@ HEAP_SLOT_BATTLE_BACKGROUND
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
#define DMA_COPY_HALFWORDS(n)
static s32 Iwram_TransformVector(const void *vector, s32 *result)
static s32 Iwram_ClearWords(void *destination, s32 size)
volatile u16 gLinkStatus
Link status, updated by the VBlank exchange handler.
The battle camera: its eye, the focus it turns about, and its pitch, yaw and distance.
s32 distance
eye to focus, 16.16 fixed-point pixels
s32 * followPos
when set, the focus followed instead of pos
s32 pos[3]
the focus, 16.16 fixed-point pixels
The battle background's work slot as the camera reads it: the yaw the camera eases toward and the fra...
s32 frames
frames left to ease the yaw, a sixteenth a frame
s32 flag
0 lets the camera update set the background's range each frame; 1 for a critical hit's zoom and once ...
s32 targetYaw
1/65536 turns
The party's Djinn recovery table as summons read it: the mask of summons the party can call,...
u32 availableMask
nonzero offers the Summon command
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u8 agilityTurns
the Agility change's turns left, 5 when cast
u8 immobile
set by Ground: the next action is lost
s8 elementLevels[4]
A summon's boost to each element: the Djinn of that element the summon spent, adding (n * n + n) * 5 ...
u8 djinnOwnedCounts[4]
the Djinn held in each element, at most 10
u8 grimReaper
The Grim Reaper's countdown: 7 when cursed, down one at each turn's end; at 0 the unit falls.
u8 psySeal
bits: 7..3 Luff (16 when cast, minus 8 a turn) | 2..0 Bind's turns (7 when cast).
struct BattleElementStats element[4]
Power and resistance in each element, 0 to 200, after equipment, element levels and Resistance stages...
s8 challenge
Set by the challenge effect: an enemy with it never chooses to flee.
s8 agilityStage
The Agility stage: -4 (Vine) to 8 (Zephyr, twice the Agility).
u8 refrain
Regenerate's turns left, 7 when cast.
s8 reflect
Reflect's turns left, 7 when cast.
u8 equipBonus[2]
The totals of equipment effects 23 (unleash chance) and 24 that UnitCalc sums; TBS never reads them b...
u8 level
1 to 99 for a character
u8 attackTurns
Each stat change: the turns it has left, and its stage (UnitCalc: an eighth of Attack,...
u8 delusion
Delusion to sleep: the turns each status has left, 7 when it lands; each may end sooner at the end of...
u8 ready
Kite's extra action: 2 when cast, down one at each turn's end; while nonzero UnitCalc gives the unit ...
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 encounterMode
BATTLE_ENCOUNTER_: who strikes first.
s16 partyUnits[7]
ends with BATTLE_UNIT_LIST_END
u8 battleType
FORMATION_SHUFFLED or FORMATION_INTERLEAVED.
u8 linkPaused
set when the link drops or the console's id changes
u8 linkSide
this console's multiplayer id
u8 linkMisses
frames the link has been down
s16 enemyIds[BATTLE_ENEMY_CAPACITY+1]
ends with BATTLE_UNIT_LIST_END
A Djinni on standby or recovering: its element and index, its owner, and the turns until it is set ag...
s8 turns
Turns until it is set again; -1 on standby (DJINN_RECOVERY_AFTER_BATTLE), -2 while a summon uses it.
u8 index
the Djinni within its element, 0 to 19
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
A position in three coordinates, each in 16.16 fixed point.
A summon: its name's message and the Djinn of each element it needs.
u8 djinnRequired[4]
standby Djinn needed, by element