Skip to Content
The Alchemy Project

src/battle/battle_setup.c

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

Included by battle.c.

Macros

NameDescription
#defineCAMERA_YAW_EASE 16Each tick of a turn the camera closes this share of the gap to its target yaw, one sixteenth, so it slows as it nears it.
#defineSUMMON_MASK_BITS 32The summon mask's bits, one for each summon id; gmSummonDefinitionGetNearStub gives NULL for the ids past the last summon.

Functions

NameDescription
voidbtCameraUpdate (void)Runs each tick of a battle: pauses a link battle whose connection is lost, turns the camera a sixteenth of the way toward its target yaw, places it, and refreshes the background's zoom.
voidbtIntroAnnounceEncounter (Sint32 enemyCount)Announces the enemies at the start of a battle, "<enemy> appeared!" for each, then whether the party strikes first or is caught by surprise.
voidbtUnitCollect (void)Fills the battle's two unit lists: the party in its order, and the enemies left to right, or for a fixed formation out from the centre.
Sint32btShiftVRAMTiles (void)Unused: moves 16 bytes of VRAM down by 16 and clears the 20 from 12 bytes past where they land.
voidbtClearBg0Vofs (void)Unused: clears BG0's vertical scroll.
voidbtPartyBattleSetupNoOperation (Sint32 unused)Does nothing; btRun calls it with 1 as the battle is set up.
UNREAD_RESULTbtPartyClearBattleStatuses (void)Clears the party's battle-only states, and works their stats out again, as a battle ends.
UNREAD_RESULTbtDjinnRecoveryReconcile (void)Brings the Djinn recovery list up to date as a battle starts, and outside a link battle sets again each Djinni waiting for a battle's end.
DJINN_RECOVERY_TABLE *btSummonUpdateAvailability (void)Works out which summons the party can call, by the Djinn it holds of each element, set or not; whether enough are on standby is checked when one is chosen.
voidbtSummonReservedNoOperation (void)Unused: does nothing.

Description

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

Macros in detail

CAMERA_YAW_EASE

#define CAMERA_YAW_EASE 16

Each tick of a turn the camera closes this share of the gap to its target yaw, one sixteenth, so it slows as it nears it.

Referenced by btCameraUpdate().

Definition at line 9 of file battle_setup.c.

SUMMON_MASK_BITS

#define SUMMON_MASK_BITS 32

The summon mask's bits, one for each summon id; gmSummonDefinitionGetNearStub gives NULL for the ids past the last summon.

Referenced by btSummonUpdateAvailability().

Definition at line 306 of file battle_setup.c.

Functions in detail

btCameraUpdate

void btCameraUpdate(void)

Runs each tick of a battle: pauses a link battle whose connection is lost, turns the camera a sixteenth of the way toward its target yaw, places it, and refreshes the background's zoom.

References btCameraSetRange(), HeapSlots, LinkStatusWork, Sint32, syCalcPoint(), syInitMatrix(), syMatrixTranslateVector(), syRotX() and syRotY().

Referenced by btRun().

Definition at line 14 of file battle_setup.c.

btIntroAnnounceEncounter

void btIntroAnnounceEncounter(Sint32 enemyCount)

Announces the enemies at the start of a battle, "<enemy> appeared!" for each, then whether the party strikes first or is caught by surprise.

References btEnemyList(), btMessageWaitForAdvance(), mnBattleMessageCloseStub(), mnBattleMessageShowAndWaitStub(), mnMessageArgumentClearAllStub(), mnMessageArgumentPushStub() and Sint32.

Referenced by btTransitionRun().

Definition at line 88 of file battle_setup.c.

btUnitCollect

void btUnitCollect(void)

Fills the battle's two unit lists: the party in its order, and the enemies left to right, or for a fixed formation out from the centre.

References BattleFormationCenteredOffsets, btEnemyList(), btPartyPrepareMembers() and Sint32.

Referenced by btRun().

Definition at line 126 of file battle_setup.c.

btShiftVRAMTiles

Sint32 btShiftVRAMTiles(void)

Unused: moves 16 bytes of VRAM down by 16 and clears the 20 from 12 bytes past where they land.

References Sint32, syDMAXCopy() and syWordsClear().

Definition at line 166 of file battle_setup.c.

btClearBg0Vofs

void btClearBg0Vofs(void)

Unused: clears BG0's vertical scroll.

Definition at line 178 of file battle_setup.c.

btPartyBattleSetupNoOperation

void btPartyBattleSetupNoOperation(Sint32 unused)

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

References Sint32.

Referenced by btRun().

Definition at line 184 of file battle_setup.c.

btPartyClearBattleStatuses

UNREAD_RESULT btPartyClearBattleStatuses(void)

Clears the party's battle-only states, and works their stats out again, as a battle ends.

References btPartyPrepareMembers(), gmUnitCalculateStub(), gmUnitGetStub() and Sint32.

Referenced by btRun().

Definition at line 190 of file battle_setup.c.

btDjinnRecoveryReconcile

UNREAD_RESULT btDjinnRecoveryReconcile(void)

Brings the Djinn recovery list up to date as a battle starts, and outside a link battle sets again each Djinni waiting for a battle's end.

References btObjectGet(), btPartyPrepareMembers(), gmDjinnCanSetStub(), gmDjinnGetRecoveryTableStub(), gmDjinnRecoveryAddStandbyStub(), gmDjinnRecoveryRemoveStub(), gmDjinnSetStub(), gmFlagGetStub() and Sint32.

Referenced by btRun().

Definition at line 235 of file battle_setup.c.

btSummonUpdateAvailability

DJINN_RECOVERY_TABLE *btSummonUpdateAvailability(void)

Works out which summons the party can call, by the Djinn it holds of each element, set or not; whether enough are on standby is checked when one is chosen.

References btPartyPrepareMembers(), gmDjinnGetRecoveryTableStub(), gmSummonDefinitionGetNearStub(), gmUnitGetStub() and Sint32.

Referenced by btRun().

Definition at line 311 of file battle_setup.c.

btSummonReservedNoOperation

void btSummonReservedNoOperation(void)

Unused: does nothing.

Definition at line 380 of file battle_setup.c.