Skip to Content
The Alchemy Project

include/battle/battle_camera.h

The battle camera, the battle background's modes and scanline state, and the presentation state an action's staging hands its battle effect. More…

Included by battle_internal.h, battle_effect_internal.h, field_world_map.c, lucky_dice.c and super_lucky_dice.c.

Structures

NameDescription
structBATTLE_CAMERAThe battle camera: its eye, the focus it turns about, and its pitch, yaw and distance.
structBATTLE_BACKGROUND_STATEThe HEAP_SLOT_BATTLE_BACKGROUND heap slot: the yaw the battle camera eases toward and the ticks left to ease it, and how the battle background is shown.
structBATTLE_PRESENTATION_STATEA presentation's effect command, laid out as BATTLE_EFFECT_PARM with a ninth actor, and the animation state it keeps.
structBATTLE_AFFINEThe battle background's affine parameters and reference point, copied whole to the BG2PA registers.
structBATTLE_AFFINE_HDMAThe battle background's scanline state: two pages of per-line values, swapped each tick, and the affine parameters.

Macros

NameDescription
#defineBATTLE_BACKGROUND_FADE_RESTORE 128btBackgroundSetMode's fade that restores the saved palette instead of taking from each colour channel.
#defineBATTLE_CAMERA_DISTANCE toFIXED(510)The battle camera's distance from its focus in its default view, and the unzoomed projection's focal length, in 16.16 pixels (btCameraSetView).

Enumerations

NameDescription
enumBATTLE_BACKGROUND_MODE { BATTLE_BACKGROUND_NONE, BATTLE_BACKGROUND_FIXED, BATTLE_BACK … }BATTLE_BACKGROUND_STATE.mode, how the battle background is shown, and its bg1ScrollMode.

Functions

NameDescription
UNREAD_RESULTbtStagingRunMessages (struct BATTLE_PLAN *plan, Sint32 unused)Plays an action with no battle effect (STAGING_MESSAGES): each target's outcome is applied and its messages shown in turn.
voidbtStagingBuildTargetList (struct BATTLE_PLAN *plan, BATTLE_PRESENTATION_STATE *state)Fills a battle effect command from an action run: its kind and strength, the user and the targets still standing, or all of them for an effect that revives.
voidbtCameraSetRange (FIXED cx, FIXED cy, Sint32 ox, Sint32 oy, FIXED scale)Builds the zoomed background's next page for a zoom of scale about centerX and centerY, shifted by offsetX and offsetY, and shows it: below a zoom of 1 the plane lies flat, from 1 it wraps and turns with the camera.
Sint32btObjectIsValidId (Uint32 objectId)Returns 0 for a party member's or an enemy's unit id, -1 for any other.
voidbtHighlightSetSpriteMode (Sint32 actor, Sint32 mode)Sets the sprite mode of a unit's picture and its shadow.
voidbtEffectRunSummonStub (Sint32 *context)Runs one of the large battle effects, the summons and the scenes of a few abilities.
voidbtEffectTransferCanvas (void)Copies the canvas to VRAM when a transfer is pending.
voidbtEffectArmBg2AffineHBlankDMA (void)Restarts DMA channel 0 as an H-blank transfer of the effect state's line table into BG2X, one word a line.
voidbtEffectDarkenBackgroundStep (void)Steps the background palette fade.

Description

The battle camera, the battle background's modes and scanline state, and the presentation state an action's staging hands its battle effect. The Broken Seal's presentation state holds eight targets; this one nine.

Macros in detail

BATTLE_BACKGROUND_FADE_RESTORE

#define BATTLE_BACKGROUND_FADE_RESTORE 128

btBackgroundSetMode's fade that restores the saved palette instead of taking from each colour channel.

Referenced by btBackgroundSetMode() and btEffectOpenCanvasLayer().

Definition at line 99 of file battle_camera.h.

BATTLE_CAMERA_DISTANCE

#define BATTLE_CAMERA_DISTANCE toFIXED(510)

The battle camera's distance from its focus in its default view, and the unzoomed projection's focal length, in 16.16 pixels (btCameraSetView).

Referenced by btCameraSetDefaultView(), btCameraSetView(), btCameraSetViewAtDepth(), btEffectRunThor() and btStagingDispatchAction().

Definition at line 145 of file battle_camera.h.

Enumerations in detail

BATTLE_BACKGROUND_MODE

enum BATTLE_BACKGROUND_MODE

BATTLE_BACKGROUND_STATE.mode, how the battle background is shown, and its bg1ScrollMode.

EnumeratorValueDescription
BATTLE_BACKGROUND_NONENot loaded yet.
BATTLE_BACKGROUND_FIXEDThe picture at a fixed size on BG1, its scroll following the camera, BG2 left to a battle effect.
BATTLE_BACKGROUND_ZOOMEDThe picture zoomed and panned on BG2, an affine layer; HBlank DMA sets each line's BG2CNT to the half of the picture it reads.

Definition at line 86 of file battle_camera.h.

Functions in detail

btEffectRunSummonStub

void btEffectRunSummonStub(Sint32 *context)

Runs one of the large battle effects, the summons and the scenes of a few abilities.

Referenced by btAutoBattleRunPsynergy() and btStagingRunFullScreen().

Definition at line 135 of file battle_camera.h.