Skip to Content
The Alchemy Project

struct BATTLE_EFFECT_STATE

The running battle effect's state: its canvas image, 64 particles, the display registers it stages and its sprites. More…

Declared in battle_effect_state.h.

Fields

NameDescription
PARTICLEparticles [64]
Uint8sheet [27008]The effect's decoded pictures, at fixed offsets.
Sint32bg2xLines [160]BG2X for each scanline, for an HBlank DMA.
Uint8imageTail [832]The rest of the pictures' storage, which no code names.
Uint16backdropLines [160]The backdrop's 160 colours, one a line, that btEffectArmPaletteHBlankDMA streams into colour 0.
Sint32transferModeHow the canvas transfer callback treats the canvas after each copy, an CANVAS_TRANSFER_MODE.
Sint32transferValueThe transfer mode's argument: the fill value, the share kept (an enum CANVAS_FADE_SHARE) or the darken or brighten amount.
Sint32unusedNever read or written in either game.
Sint32frameTick counter some effects keep, from 0.
Sint32scrollTimerTicks since the last interval scroll step.
Sint32scrollIntervalTicks between interval scroll steps.
Sint32scrollStepXAdded to BG1 or BG2 x at each step.
Sint32scrollStepYAdded to BG1 or BG2 y at each step.
Sint32savedBg1XBG1 scroll restored when a shake ends.
Sint32savedBg1YBG1 scroll restored when a shake ends.
Sint32shakeFrameShake ticks left; the effect that set it counts it down as it shakes.
Sint32cameraDeltaCamera yaw turned per effect tick.
Sint32cameraPhaseThe effect sets 1 after a tick; btCameraApplyPhasedDelta then turns the whole cameraDelta and sets 0, else turns half and toggles 0 and 2.
Sint32fadeFrameBackdrop fade ticks left (btEffectDarkenBackgroundStep).
Sint32fadeStepSteps the backdrop has darkened so far.
Uint16win0hWindow, display and blend registers, which btEffectApplyWindowBlendRegisters writes all at once.
Uint16win0v
Uint16win1h
Uint16win1v
Uint16winin
Uint16winout
Uint16dispcnt
Uint16bldcnt
Uint16bldalpha
Uint16paddingAligns bg2x.
volatile Sint32bg2xBG2's reference point, written
volatile Sint32bg2yto BG2X and BG2Y by btEffectApplyBg2Reference and btDisplayApplyBg2Affine.
volatile Uint16bg2paBG2's scale, written to BG2PA
volatile Uint16bg2pdand BG2PD by btDisplayApplyBg2Affine.
void *sprites [64]The effect's sprites.
Uint8actorTimers [8]Each target's flash timer in ticks, for args->targets[n]: set by btEffectTintBattler, counted down by btEffectCountDownBattlerTints.
volatile Uint32framesSinceTransfer1 on a canvas copy's VBlank, then counts up.
Sint32transferPending1 once the effect has drawn a tick; the canvas transfer callback copies the canvas and clears it.
Sint32stampPendingOne draft sets 1 for a tick range; no reader found.
BATTLE_EFFECT_PARM *argsThe command being run.

Description

The running battle effect's state: its canvas image, 64 particles, the display registers it stages and its sprites. It lives in the HEAP_SLOT_BATTLE_EFFECT heap slot.

struct BATTLE_EFFECT_STATE

Referenced by btCameraApplyPhasedDelta(), btCameraApplyVerticalShake(), btCameraShake(), btDisplayApplyBg2Affine(), btEffectAdvanceBg2OnInterval(), btEffectAdvanceScrollOnInterval(), btEffectApplyBg2Reference(), btEffectApplyWindowBlendRegisters(), btEffectArmBg1HBlankDMA(), btEffectArmBg2AffineHBlankDMA(), btEffectArmMeteorBlowPaletteDMA(), btEffectArmPaletteHBlankDMA(), btEffectClearTintTimers(), btEffectCountDownBattlerTints(), btEffectCreateSprites(), btEffectDarkenBackgroundStep(), btEffectEndCanvasLayer(), btEffectGetTargetsMidpoint(), btEffectOpenCanvasLayer(), btEffectPlaceFormationSprites(), btEffectProcessPendingBlock2Transfer(), btEffectProcessPendingStampTransfer(), btEffectReadKeysForEnemyTarget(), btEffectRunAnnihilation(), btEffectRunAstralBlast(), btEffectRunAtalanta(), btEffectRunAttackSlash(), btEffectRunAzul(), btEffectRunBackgroundFadeIn(), btEffectRunBackstab(), btEffectRunBallLightning(), btEffectRunBind(), btEffectRunBladeRain(), btEffectRunBolt(), btEffectRunBoreas(), btEffectRunBreak(), btEffectRunBreaths(), btEffectRunBubbleColumn(), btEffectRunBurstShower(), btEffectRunByIdRange(), btEffectRunCanvasBurst(), btEffectRunCards(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCloudSwirl(), btEffectRunCoatlicue(), btEffectRunCondemn(), btEffectRunCool(), btEffectRunCrescentSlash() and 152 more.

Definition at line 43 of file battle_effect_state.h.

Fields in detail

particles

PARTICLE particles[64]

sheet

Uint8 sheet[27008]

The effect's decoded pictures, at fixed offsets.

bg2xLines

Sint32 bg2xLines[160]

BG2X for each scanline, for an HBlank DMA.

imageTail

Uint8 imageTail[832]

The rest of the pictures' storage, which no code names.

backdropLines

Uint16 backdropLines[160]

The backdrop's 160 colours, one a line, that btEffectArmPaletteHBlankDMA streams into colour 0.

transferMode

Sint32 transferMode

How the canvas transfer callback treats the canvas after each copy, an CANVAS_TRANSFER_MODE.

transferValue

Sint32 transferValue

The transfer mode's argument: the fill value, the share kept (an enum CANVAS_FADE_SHARE) or the darken or brighten amount.

unused

Sint32 unused

Never read or written in either game.

frame

Sint32 frame

Tick counter some effects keep, from 0.

scrollTimer

Sint32 scrollTimer

Ticks since the last interval scroll step.

scrollInterval

Sint32 scrollInterval

Ticks between interval scroll steps.

scrollStepX

Sint32 scrollStepX

Added to BG1 or BG2 x at each step.

scrollStepY

Sint32 scrollStepY

Added to BG1 or BG2 y at each step.

savedBg1X

Sint32 savedBg1X

BG1 scroll restored when a shake ends.

savedBg1Y

Sint32 savedBg1Y

BG1 scroll restored when a shake ends.

shakeFrame

Sint32 shakeFrame

Shake ticks left; the effect that set it counts it down as it shakes.

cameraDelta

Sint32 cameraDelta

Camera yaw turned per effect tick.

cameraPhase

Sint32 cameraPhase

The effect sets 1 after a tick; btCameraApplyPhasedDelta then turns the whole cameraDelta and sets 0, else turns half and toggles 0 and 2.

fadeFrame

Sint32 fadeFrame

Backdrop fade ticks left (btEffectDarkenBackgroundStep).

fadeStep

Sint32 fadeStep

Steps the backdrop has darkened so far.

win0h

Uint16 win0h

Window, display and blend registers, which btEffectApplyWindowBlendRegisters writes all at once.

win0v

Uint16 win0v

win1h

Uint16 win1h

win1v

Uint16 win1v

winin

Uint16 winin

winout

Uint16 winout

dispcnt

Uint16 dispcnt

bldcnt

Uint16 bldcnt

bldalpha

Uint16 bldalpha

padding

Uint16 padding

Aligns bg2x.

bg2x

volatile Sint32 bg2x

BG2's reference point, written

bg2y

volatile Sint32 bg2y

to BG2X and BG2Y by btEffectApplyBg2Reference and btDisplayApplyBg2Affine. Volatile, as the scale below.

bg2pa

volatile Uint16 bg2pa

BG2's scale, written to BG2PA

bg2pd

volatile Uint16 bg2pd

and BG2PD by btDisplayApplyBg2Affine. Volatile: btDisplayApplyBg2Affine copies them out from the VBlank handler (EVENT_PASS_VBLANK).

sprites

void *sprites[64]

The effect's sprites.

actorTimers

Uint8 actorTimers[8]

Each target's flash timer in ticks, for args->targets[n]: set by btEffectTintBattler, counted down by btEffectCountDownBattlerTints.

framesSinceTransfer

volatile Uint32 framesSinceTransfer

1 on a canvas copy's VBlank, then counts up. Volatile and unsigned: the VBlank handler counts it while an effect waits on it, each wait reads it afresh and compares it unsigned.

transferPending

Sint32 transferPending

1 once the effect has drawn a tick; the canvas transfer callback copies the canvas and clears it.

stampPending

Sint32 stampPending

One draft sets 1 for a tick range; no reader found.

args

BATTLE_EFFECT_PARM *args

The command being run.