Alchemy
Loading...
Searching...
No Matches

setup.c File Reference

The battle camera each frame, the opening announcement, the unit lists, and the party's battle state and Djinn as a battle starts and ends. More...

Go to the source code of this file.

Macros

#define NUM_SUMMONS   32
 The summon ids the mask covers, one bit each.

Functions

void BattlePresentation_UpdateCamera (void)
 Runs each frame of a battle.
void BattleIntro_AnnounceEncounter (s32 enemyCount)
 Announces the enemies at the start of a battle, then whether the party strikes first or is caught by surprise.
void BattleParty_CollectUnitList (void)
 Fills the battle's two unit lists, each ended by BATTLE_UNIT_LIST_END: the party members in their order, and the enemies, left to right for a random formation or, for a fixed one, alternating out from the centre (gBattleParty_CenterOrderOffsets).
s32 BattlePresentation_InitializeTilePattern (void)
 Moves the 16 bytes at VRAM 0x06000290 down to 0x06000280 and clears the 20 bytes from 0x0600028c.
void BattlePresentation_ClearBg0VerticalOffset (void)
 Nothing in the source calls it.
void Party_ReservedNoOp5B14 (s32 unused)
 Does nothing; Battle_RunEncounter calls it with 1 as the battle is set up.
s32 BattleParty_ResetActiveRuntimeFields (void)
 Clears every battle-only state of the party members (stat stages and their turns, statuses, Djinn element boosts, the countdowns) and recalculates their stats, as a battle ends.
s32 BattleParty_ReconcileDjinnRecovery (void)
 Brings the Djinn recovery list up to date as a battle starts: every Djinni a party member has on standby that the list lacks joins it.
struct BattleSummonState * BattleSummon_UpdateAvailability (void)
 Works out which summons the party can call: one whose Djinn requirement of every element is met by the party's Djinn of that element, all members together.
void BattleSummon_ReservedNoOp (void)
 Does nothing; nothing in the source calls it.

Detailed Description

The battle camera each frame, the opening announcement, the unit lists, and the party's battle state and Djinn as a battle starts and ends.

Part of battle.c, the battle object, compiled only through it.

Definition in file setup.c.

Macro Definition Documentation

◆ NUM_SUMMONS

#define NUM_SUMMONS   32

The summon ids the mask covers, one bit each.

Definition at line 329 of file setup.c.

Referenced by BattleSummon_UpdateAvailability().

Function Documentation

◆ BattlePresentation_UpdateCamera()

void BattlePresentation_UpdateCamera ( void )

Runs each frame of a battle.

In a link battle it first checks the link: a connection lost for more than LINK_MAX_MISSED_FRAMES frames, or a console whose link number changed, pauses the battle. Then it turns the camera a sixteenth of the way toward a transition's yaw, places the camera at its position (or at the one it follows) with its yaw, pitch and distance, and, unless a transition owns the background, refreshes the background's perspective. Runs as a scheduler callback (priority 0xc7f) that Battle_RunEncounter adds. Changes work->linkMisses and linkPaused, the camera's yaw and the transition's frame count, the transform state, and through BattleCamera_SetRange the background's affine page.

Definition at line 18 of file setup.c.

Referenced by Battle_RunEncounter(), and BattlePresentation_UpdateCamera().

◆ BattleIntro_AnnounceEncounter()

void BattleIntro_AnnounceEncounter ( s32 enemyCount)

Announces the enemies at the start of a battle, then whether the party strikes first or is caught by surprise.

Each of the first enemyCount enemies gets <enemy> appeared!, the last one's message a different line. Called by BattlePres_RunEntryTransition. Rewrites the message argument tables.

Definition at line 90 of file setup.c.

Referenced by BattleIntro_AnnounceEncounter(), and BattlePres_RunEntryTransition().

◆ BattleParty_CollectUnitList()

void BattleParty_CollectUnitList ( void )

Fills the battle's two unit lists, each ended by BATTLE_UNIT_LIST_END: the party members in their order, and the enemies, left to right for a random formation or, for a fixed one, alternating out from the centre (gBattleParty_CenterOrderOffsets).

Called by Battle_RunEncounter as the battle is set up. Writes gBattleWork->partyUnits and enemyIds, and marks each party member's side.

Definition at line 135 of file setup.c.

Referenced by Battle_RunEncounter(), and BattleParty_CollectUnitList().

◆ BattlePresentation_InitializeTilePattern()

s32 BattlePresentation_InitializeTilePattern ( void )

Moves the 16 bytes at VRAM 0x06000290 down to 0x06000280 and clears the 20 bytes from 0x0600028c.

Nothing in the source calls it. XXX: what the tiles at 0x06000280 are; a caller in another image, or the picture loaded there, would settle it.

Definition at line 173 of file setup.c.

Referenced by BattlePresentation_InitializeTilePattern().

◆ BattlePresentation_ClearBg0VerticalOffset()

void BattlePresentation_ClearBg0VerticalOffset ( void )

Nothing in the source calls it.

Definition at line 180 of file setup.c.

Referenced by BattlePresentation_ClearBg0VerticalOffset().

◆ Party_ReservedNoOp5B14()

void Party_ReservedNoOp5B14 ( s32 unused)

Does nothing; Battle_RunEncounter calls it with 1 as the battle is set up.

Definition at line 188 of file setup.c.

Referenced by Battle_RunEncounter(), and Party_ReservedNoOp5B14().

◆ BattleParty_ResetActiveRuntimeFields()

s32 BattleParty_ResetActiveRuntimeFields ( void )

Clears every battle-only state of the party members (stat stages and their turns, statuses, Djinn element boosts, the countdowns) and recalculates their stats, as a battle ends.

Called by Battle_RunEncounter on every way out of the battle.

Definition at line 197 of file setup.c.

Referenced by Battle_RunEncounter(), and BattleParty_ResetActiveRuntimeFields().

◆ BattleParty_ReconcileDjinnRecovery()

s32 BattleParty_ReconcileDjinnRecovery ( void )

Brings the Djinn recovery list up to date as a battle starts: every Djinni a party member has on standby that the list lacks joins it.

Then, outside a link battle, each Djinni waiting for a battle to end whose owner has no battle object is Set again and leaves the list. Called by Battle_RunEncounter once the unit lists and battle objects are in place. Changes the party's and the opponent's recovery lists and Djinn states.

Definition at line 260 of file setup.c.

Referenced by Battle_RunEncounter(), and BattleParty_ReconcileDjinnRecovery().

◆ BattleSummon_UpdateAvailability()

struct BattleSummonState * BattleSummon_UpdateAvailability ( void )

Works out which summons the party can call: one whose Djinn requirement of every element is met by the party's Djinn of that element, all members together.

Stores the mask of them (bit n for summon n) and returns the state that holds it. Called by Battle_RunEncounter as the battle is set up and at the start of each round. Writes the party recovery table's availableMask.

Definition at line 337 of file setup.c.

Referenced by Battle_RunEncounter(), and BattleSummon_UpdateAvailability().

◆ BattleSummon_ReservedNoOp()

void BattleSummon_ReservedNoOp ( void )

Does nothing; nothing in the source calls it.

Definition at line 401 of file setup.c.

Referenced by BattleSummon_ReservedNoOp().