Skip to Content
The Alchemy Project

src/battle/battle_run.c

A whole battle, btRun, and the lists of the units in it. More…

Included by battle.c.

Macros

NameDescription
#defineNAME_LETTER_PAST_ALL 26A name letter past every edition's last (Z, the Japanese edition's 26th), which leaves an enemy's name bare, as The Lost Age names it.
#defineENEMY_UNITS_SIZE (ENEMY_BATTLE_SIZE * BATTLE_UNIT_SIZE)The six enemy units, EnemyUnits, which gmUnitGet reads for unit ids 128 to 133 while the battle lasts.
#defineBATTLE_ZOOM_BEFORE_OPENING 190The camera's zoom, in percent, from the battle's setup until the opening sets its own: the curtain's a tick later, or the Fusion Dragon's shattering opening's, so no tick shows it.
#defineYAW_TURN_START (TRIG_TURN * 5 / 32)The camera's yaw as a battle starts, and as each turn's commands are chosen: about 56 degrees, a little past YAW_PARTY_ACTION.

Functions

NameDescription
Sint32btRun (Sint32 enemyGroup)Fights the battle against the enemy formation enemyGroup, from the opening to the end.
Sint32btPartyPrepareMembers (Uint16 *unitIds)Lists the party members who fight, three in a link battle, into unitIds when it is not null, and returns how many.
Sint32btEnemyList (Sint16 *unitIds)Lists the enemy units present and returns how many, 0 when unitIds is null.
Sint32btUnitListLiving (Sint32 sideMask, Uint16 *unitIds)Lists the units still standing on the sides in sideMask, party first, into unitIds when it is not null, and returns how many.
Sint32btUnitListIds (Sint32 sideMask, Uint16 *unitIds)Lists the units in the battle on the sides in sideMask, standing or not, and returns how many.

Description

A whole battle, btRun, and the lists of the units in it. Part of battle.c.

Macros in detail

NAME_LETTER_PAST_ALL

#define NAME_LETTER_PAST_ALL 26

A name letter past every edition's last (Z, the Japanese edition's 26th), which leaves an enemy's name bare, as The Lost Age names it.

Referenced by btRun().

Definition at line 7 of file battle_run.c.

ENEMY_UNITS_SIZE

#define ENEMY_UNITS_SIZE (ENEMY_BATTLE_SIZE * BATTLE_UNIT_SIZE)

The six enemy units, EnemyUnits, which gmUnitGet reads for unit ids 128 to 133 while the battle lasts.

Referenced by btRun().

Definition at line 11 of file battle_run.c.

BATTLE_ZOOM_BEFORE_OPENING

#define BATTLE_ZOOM_BEFORE_OPENING 190

The camera's zoom, in percent, from the battle's setup until the opening sets its own: the curtain's a tick later, or the Fusion Dragon's shattering opening's, so no tick shows it.

Referenced by btRun().

Definition at line 16 of file battle_run.c.

YAW_TURN_START

#define YAW_TURN_START (TRIG_TURN * 5 / 32)

The camera's yaw as a battle starts, and as each turn's commands are chosen: about 56 degrees, a little past YAW_PARTY_ACTION.

Referenced by btRun().

Definition at line 20 of file battle_run.c.

Functions in detail

btRun

Sint32 btRun(Sint32 enemyGroup)

Fights the battle against the enemy formation enemyGroup, from the opening to the end. Returns the number of enemies defeated when the party won or the link broke, BATTLE_OUTCOME_FLED or BATTLE_OUTCOME_LOST.

References ActorSpriteSlots, btAutoBattleBuildActions(), btAutoBattleRunAction(), btAwardSpoils(), btBackgroundFree(), btBackgroundInit(), btBackgroundLoad(), btCameraSetDefaultView(), btCameraSetRange(), btCameraSetView(), btCameraUpdate(), btClearSerialTransferPayload(), btDjinnRecoveryCountDown(), btDjinnRecoveryReconcile(), btFormationBuildEnemyList(), btGatherActions(), btLinkBattleSyncTurn(), btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btObjectDestroyAll(), btObjectPut(), btObjectUpdateSpritePriorities(), btPartyAssignOpponentSlots(), btPartyBattleSetupNoOperation(), btPartyClearBattleStatuses(), btPartyPrepareMembers(), btProcessTurnEnd(), btSpoilsClear(), btStagingDispatchAction(), btSummonUpdateAvailability(), btTransitionRun(), btTurnEndNoOperation(), btTurnStartNoOperation(), btUnitCollect(), btUnitListLiving(), btUnitRefreshPlacement(), CpuLoadDisplayEnabled, fdActorSystemInitStub(), fdBattleBackgroundGetSelectedStub(), gmBattleRandomStub(), gmBattleUnitSetStub(), gmDjinnGetRecoveryTableStub(), gmFlagGetByteStub(), gmFlagGetStub(), gmFlagSetStub(), LinkStatusWork, MainRoutineStateWork, mnBattleMessageShowAndWaitStub(), mnMessageAllTypedStub(), mnMessageArgumentClearAllStub() and 23 more.

Referenced by btDebugBattleRunMenu().

Definition at line 25 of file battle_run.c.

btPartyPrepareMembers

Sint32 btPartyPrepareMembers(Uint16 *unitIds)

Lists the party members who fight, three in a link battle, into unitIds when it is not null, and returns how many.

References gmPartyCountMembersStub(), gmUnitGetStub(), MainRoutineStateWork and Sint32.

Referenced by btDjinnRecoveryReconcile(), btFormationSelectLevelMatchedCandidate(), btLinkBattleSendParty(), btPartyAssignOpponentSlots(), btPartyClearBattleStatuses(), btRun(), btSummonUpdateAvailability(), btUnitCollect(), btUnitListLiving() and btUnitRefreshPlacement().

Definition at line 380 of file battle_run.c.

btEnemyList

Sint32 btEnemyList(Sint16 *unitIds)

Lists the enemy units present and returns how many, 0 when unitIds is null.

References gmFlagGetStub(), gmUnitGetStub() and Sint32.

Referenced by btAbilityApplyToTarget(), btIntroAnnounceEncounter() and btUnitCollect().

Definition at line 409 of file battle_run.c.

btUnitListLiving

Sint32 btUnitListLiving(Sint32 sideMask, Uint16 *unitIds)

Lists the units still standing on the sides in sideMask, party first, into unitIds when it is not null, and returns how many.

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

Referenced by btAbilityReplaceDefeated(), btAutoBattleBuildActions(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btAwardSpoils(), btBuildEnemyActions(), btBuildPartyActions(), btFleeCheckSuccess(), btFleePlayRun(), btRun(), btStagingRunFlee() and btUnitProcessActionEnd().

Definition at line 439 of file battle_run.c.

btUnitListIds

Sint32 btUnitListIds(Sint32 sideMask, Uint16 *unitIds)

Lists the units in the battle on the sides in sideMask, standing or not, and returns how many.

References Sint32.

Referenced by btDjinnCountStandby(), btHighlightClearAllSpriteModes(), btHighlightSetModes(), btHighlightSetOtherSpriteModes(), btObjectPut(), btObjectPutKeepingPoses(), btObjectUpdateSpritePriorities(), btProcessTurnEnd(), btStagingDispatchAction(), btStagingRunFullScreen(), btTransitionRun(), btUnitIsListed() and btUnitResetGuardLevels().

Definition at line 501 of file battle_run.c.