Skip to Content
The Alchemy Project

include/battle/battle_state.h

BATTLE_STATE, the battle's own state, and the battle message window's state.

Included by battle_effect_internal.h, credits.c, screens_internal.h, window_internal.h and ability_staging.h.

Structures

NameDescription
structADVANCE_ARROW_SPROne OAM entry in a sprite list: the arrow that waits for the player to advance a battle message.
structBATTLE_MESSAGE_OFFSETThe battle message, as far as its offset in the window: the advance arrow is drawn at the window's corner plus this offset.
structBATTLE_MESSAGE_STATEThe battle message window: its window, its message and whether the next message is marked.
structBATTLE_PLAYBACK_STATEThe playback queue and the state of its playback: the phase, the entry playing and the advance arrow.
structBATTLE_STATEThe battle's own state: its enemies, units and their battle objects, the turn's actions, the spoils, the background palette, the action under way and the playback.

Macros

NameDescription
#defineBattleMessageStateWorkThe battle message window's state, in HEAP_SLOT_BATTLE_MESSAGE, which btRun takes and zeroes for the battle.
#defineBATTLE_BACKGROUND_COLORS (8 * PALETTE_COLORS)The battle background's colours, BG palettes 6 to 13.
#defineBACKGROUND_LEVEL_STEP (toFIXED(1) / 60)The battle background's darkening step (btBackgroundSetPaletteLevel, btBackgroundLoad, the element glow and the battle effects' fades): each level takes a sixtieth of the full 16.16 brightness, so level 60 is almost black.
#defineLINK_MAX_MISSED_TICKS 24The ticks a link battle tolerates without a connection before it gives up: a count above it pauses the battle (BATTLE_STATE.linkPaused) or fails the sync, transfer or wait for the partner's commands under way.
#defineBATTLE_CHALLENGED_PARTY 2BATTLE_STATE.challengeFlag's bit: the challenge effect landed on a party member ("This is no time to be running away!").
#defineENEMY_SPRITE_SLOTS 6The battle has six enemy sprite slots; a large enemy takes two side by side, a small one (btSpriteIsSmall) one.
#defineBattleStateWork (*(BATTLE_STATE **)&HeapSlots[HEAP_SLOT_BATTLE])The battle's state: HeapSlots[HEAP_SLOT_BATTLE] under its own name.

Enumerations

NameDescription
enumanonymous enum { BATTLE_ACTION_CAPACITY }The most actions a turn's queue holds.

Description

BATTLE_STATE, the battle's own state, and the battle message window's state.

Macros in detail

BattleMessageStateWork

#define BattleMessageStateWork

The battle message window's state, in HEAP_SLOT_BATTLE_MESSAGE, which btRun takes and zeroes for the battle.

Referenced by btMessageWaitForAdvance(), btPlaybackMarkMessage(), btPlaybackRun(), btPlaybackRunAll(), mnBattleMessageClose() and mnGlyphDraw().

Definition at line 68 of file battle_state.h.

BATTLE_BACKGROUND_COLORS

#define BATTLE_BACKGROUND_COLORS (8 * PALETTE_COLORS)

The battle background's colours, BG palettes 6 to 13.

Referenced by btBackgroundLoad(), btBackgroundSetMode(), btBackgroundSetPaletteLevel(), btEffectDarkenBackgroundStep(), btEffectRunJudgment(), btEffectRunShatteringOpening(), btElementGlowPlay(), btStagingRunItem(), mnCreditsClearBuffer() and mnCreditsLoadBackground().

Definition at line 99 of file battle_state.h.

BACKGROUND_LEVEL_STEP

#define BACKGROUND_LEVEL_STEP (toFIXED(1) / 60)

The battle background's darkening step (btBackgroundSetPaletteLevel, btBackgroundLoad, the element glow and the battle effects' fades): each level takes a sixtieth of the full 16.16 brightness, so level 60 is almost black.

Referenced by btBackgroundLoad(), btBackgroundSetPaletteLevel(), btEffectDarkenBackgroundStep() and btElementGlowPlay().

Definition at line 103 of file battle_state.h.

#define LINK_MAX_MISSED_TICKS 24

The ticks a link battle tolerates without a connection before it gives up: a count above it pauses the battle (BATTLE_STATE.linkPaused) or fails the sync, transfer or wait for the partner's commands under way.

Referenced by btAppendLinkedActions(), btCameraUpdate(), btLinkBattleSyncTurn(), btLinkBattleWaitSync(), btRun() and mnBattleCollectPartyCommands().

Definition at line 108 of file battle_state.h.

BATTLE_CHALLENGED_PARTY

#define BATTLE_CHALLENGED_PARTY 2

BATTLE_STATE.challengeFlag's bit: the challenge effect landed on a party member ("This is no time to be running away!").

Referenced by btAbilityApplyToTarget().

Definition at line 112 of file battle_state.h.

ENEMY_SPRITE_SLOTS

#define ENEMY_SPRITE_SLOTS 6

The battle has six enemy sprite slots; a large enemy takes two side by side, a small one (btSpriteIsSmall) one.

Referenced by btEnemyHasSpriteRoom(), btEnemySpriteLoadIntoSlots(), btFormationBuildEnemyList() and btObjectReleaseSpriteSlots().

Definition at line 116 of file battle_state.h.

BattleStateWork

#define BattleStateWork (*(BATTLE_STATE **)&HeapSlots[HEAP_SLOT_BATTLE])

The battle's state: HeapSlots[HEAP_SLOT_BATTLE] under its own name.

Referenced by btAbilityApplyToTarget(), btActionRunBuild(), btAdjustDebugValue(), btAIChooseRandomTarget(), btAIChooseTarget(), btAppendLinkedActions(), btAutoBattleRunAttackOrItem(), btAwardSpoils(), btBackgroundSetMode(), btBackgroundSetPaletteLevel(), btBackgroundStepHighlightBlend(), btBuildEnemyActions(), btEffectRunCondemn(), btEffectRunCriticalHit(), btEffectSetupCanvasTileMap(), btEnemyClaimNameLetter(), btEnemyHasSpriteRoom(), btEnemyRecordDefeat(), btEnemyReleaseNameLetter(), btEnemySpriteLoadIntoSlots(), btFindUnitPlace(), btFleeCheckSuccess(), btFormationBuildEnemyList(), btGatherActions(), btGetUnitAtPlace(), btHighlightSetModes(), btIntroAnnounceEncounter(), btLinkBattleSendParty(), btLinkBattleSyncTurn(), btLinkBattleWaitSync(), btMotionFlashHit(), btObjectGet(), btObjectGetAnchor(), btObjectReleaseSpriteSlots(), btObjectRemoveFromLists(), btPartyAssignOpponentSlots(), btPartyPrepareMembers(), btPlacementRelayoutEnemies(), btPlaybackPush(), btPlaybackReset(), btPlaybackRun(), btPlaybackRunAll(), btPlaybackSchedulePhase(), btPlaybackStart(), btPlaybackWaitForReady(), btProcessTurnEnd(), btSpoilsClear(), btStagingDispatchAction(), btStagingRunAttack(), btStagingRunFullScreen() and 14 more.

Definition at line 258 of file battle_state.h.

Enumerations in detail

anonymous enum

enum { BATTLE_ACTION_CAPACITY }

The most actions a turn's queue holds.

EnumeratorValueDescription
BATTLE_ACTION_CAPACITY20

Definition at line 93 of file battle_state.h.