Skip to Content
The Alchemy Project

include/battle/battle_effect_state.h

BATTLE_EFFECT_STATE, the running battle effect's state, and its sprites.

Included by battle_internal.h, battle_effect_internal.h, lucky_dice.c, lucky_wheels.c and battle_effect.h.

Structures

NameDescription
structBATTLE_BG2_ORIGINTwo adjacent affine background coordinates, queued together for BG2X/BG2Y.
structBATTLE_EFFECT_STATEThe running battle effect's state: its canvas image, 64 particles, the display registers it stages and its sprites.

Macros

NameDescription
#defineCANVAS_FILL_WORD (level) PIXELS_8BPP(level)A canvas word holding level in each of its four bytes: a fill for CANVAS_COPY_AND_CLEAR or a step for CANVAS_COPY_AND_DARKEN, one byte per pixel.
#defineCANVAS_LEVEL_BRIGHTEST 63The brightest canvas level: the additive blitters and CANVAS_COPY_AND_BRIGHTEN stop at it.

Enumerations

NameDescription
enumCANVAS_TRANSFER_MODE { CANVAS_COPY, CANVAS_COPY_AND_CLEAR, CANVAS_COPY_AND_FADE, CA … }How btEffectTransferCanvas moves the effect's 128x128 canvas into VRAM once a tick (state->transferMode); the canvas pixels are indices into a palette ramp, so scaling them fades a trail.
enumCANVAS_FADE_SHARE { CANVAS_FADE_HALF, CANVAS_FADE_THREE_QUARTERS }CANVAS_COPY_AND_FADE's transferValue: the percentage of each pixel's level kept for the next tick.

Variables

NameDescription
STATIC_ASSERT(offsetof (BATTLE_EFFECT_STATE, trackedCanvas.origin)
extern const Uint32BattleEffectMax4Reverse []The pixel fragments btEffectBuildBlitter copies into its blitters, from blitter_fragments.c: Forward reads the picture left to right and Reverse right to left.
extern const Uint32BattleEffectMax4Forward []Max, four pixels (one canvas word), left to right; a full cell's row takes it twice.
extern const Uint32BattleEffectMaxReverse []Max, one pixel, right to left.
extern const Uint32BattleEffectMaxForward []Max, one pixel, left to right.
extern const Uint32BattleEffectColorReverse []Additive, four pixels added a word at a time, right to left; a full cell's row takes it twice.
extern const Uint32BattleEffectColorForward []Additive, four pixels added a word at a time, left to right; a full cell's row takes it twice.
extern const Uint32BattleEffectAdditiveReverse []Additive, one pixel, right to left.
extern const Uint32BattleEffectAdditiveForward []Additive, one pixel, left to right.
extern const Uint32BattleEffectMask []Builds the mask word, 64 in every byte, with which an additive word's pixels are capped at CANVAS_LEVEL_BRIGHTEST.
extern const Uint32BattleEffectTransparent8Reverse []Transparent, a full cell's eight pixels, right to left.
extern const Uint32BattleEffectTransparent8Forward []Transparent, a full cell's eight pixels, left to right.
extern const Uint32BattleEffectTransparentReverse []Transparent, one pixel, right to left.
extern const Uint32BattleEffectTransparentForward []Transparent, one pixel, left to right.
extern const Uint32BattleEffectCopyReverse []Copy, one pixel, right to left.
extern const Uint32BattleEffectCopyForward []Copy, one pixel, left to right.

Description

BATTLE_EFFECT_STATE, the running battle effect's state, and its sprites.

Macros in detail

CANVAS_FILL_WORD

#define CANVAS_FILL_WORD(level) PIXELS_8BPP(level)

A canvas word holding level in each of its four bytes: a fill for CANVAS_COPY_AND_CLEAR or a step for CANVAS_COPY_AND_DARKEN, one byte per pixel.

Referenced by btEffectRunAnnihilation(), btEffectRunBind(), btEffectRunBolt(), btEffectRunCastingImpact(), btEffectRunCondemn(), btEffectRunDragonFire(), btEffectRunDrain(), btEffectRunFlashingStrike(), btEffectRunFlurry(), btEffectRunHaunt(), btEffectRunJudgment(), btEffectRunPlasma(), btEffectRunPrism(), btEffectRunRay(), btEffectRunShatteringOpening(), btEffectRunSparkGroups(), btEffectRunStarfieldFall(), btEffectRunThor(), btEffectRunTitanBlade(), btEffectRunUnusedTriangleStrike(), btEffectRunWhirlwind() and btEffectStartElementStreaks().

Definition at line 60 of file battle_effect_state.h.

CANVAS_LEVEL_BRIGHTEST

#define CANVAS_LEVEL_BRIGHTEST 63

The brightest canvas level: the additive blitters and CANVAS_COPY_AND_BRIGHTEN stop at it.

Referenced by btEffectRunAnnihilation(), btEffectRunCastingImpact(), btEffectRunCondemn(), btEffectRunDragonFire(), btEffectRunFlashingStrike(), btEffectRunJudgment(), btEffectRunNeptune(), btEffectRunSparkGroups(), btEffectRunThor(), btEffectRunTitanBlade(), btEffectRunTorch() and btEffectUpdatePhasePalette().

Definition at line 64 of file battle_effect_state.h.

Enumerations in detail

CANVAS_TRANSFER_MODE

enum CANVAS_TRANSFER_MODE

How btEffectTransferCanvas moves the effect's 128x128 canvas into VRAM once a tick (state->transferMode); the canvas pixels are indices into a palette ramp, so scaling them fades a trail. For the clear, darken and brighten modes transferValue is a word, a fill or a step repeated in each of its four bytes (one per pixel, CANVAS_FILL_WORD); the fade mode only compares it with CANVAS_FADE_HALF.

EnumeratorValueDescription
CANVAS_COPYcopy as drawn
CANVAS_COPY_AND_CLEARcopy, then fill the canvas with transferValue (0 clears it)
CANVAS_COPY_AND_FADEcopy, keeping half of each pixel's level for the next tick when transferValue is CANVAS_FADE_HALF, and three quarters for any other value (CANVAS_FADE_THREE_QUARTERS by convention)
CANVAS_COPY_AND_DARKENcopy, then lower each level by a byte of transferValue, stopping at 0
CANVAS_COPY_AND_BRIGHTENcopy, then raise each level by a byte of transferValue, stopping at CANVAS_LEVEL_BRIGHTEST; no effect uses it

Definition at line 32 of file battle_effect_state.h.

CANVAS_FADE_SHARE

enum CANVAS_FADE_SHARE

CANVAS_COPY_AND_FADE's transferValue: the percentage of each pixel's level kept for the next tick.

EnumeratorValueDescription
CANVAS_FADE_HALF50
CANVAS_FADE_THREE_QUARTERS75

Definition at line 51 of file battle_effect_state.h.

Variables in detail

offsetof

STATIC_ASSERT(offsetof(BATTLE_EFFECT_STATE, trackedCanvas.origin)

Definition at line 164 of file battle_effect_state.h.