helm_splitter.c
Helm Splitter, formations and the impact burst.
games/tbs/src/effect/parts/helm_splitter.c on GitHub
Helm Splitter, formations and the impact burst. Part of effect.c, the battle effect object, compiled only through it.
Functions
BattleFx_RunHelmSplitter
void BattleFx_RunHelmSplitter(struct BattleEffectArgument *effect)
The user leaps at the first target and strikes through a fire swirl; on frame 18 the target flashes and reels and 16 sparks scatter, bouncing off the ground.
Abilities: Helm Splitter (kind 51).
Used by gBattleFx_EffectHandlers.
BattleFx_PlaceFormationObjects
void BattleFx_PlaceFormationObjects(s32 formation, s32 x, s32 z)
Arranges work->objects in a formation; x and z are its origin in 16.16 pixels.
Each summon that ends in an impact burst keeps its objects in its own formation, every frame while it plays and then through BattleFx_RunImpactBurst. Places the objects through Object_ApplyProjectedPlacementFar and changes nothing else.
formation: 0 = nine in a 3x3 grid at 32-pixel spacing (Thor);
1 = twelve in rows of 1, 3, 4 and 4, from 16 left and 32 up
(Nereid);
2 = eight in rows of 3, 2 and 3, from 16 right (Cybele);
3 = eight drawn at 1.25 times their size (Tiamat's
BattleFx_RunPaletteParticles).
Any other value places nothing.Used by BattleFx_RunCybele, BattleFx_RunImpactBurst, BattleFx_RunNereid, BattleFx_RunPaletteParticles, BattleFx_RunThor.
BattleFx_RunImpactBurst
void BattleFx_RunImpactBurst(s32 formation, s32 x, s32 y)
Opens an impact flash and scatters sparks and fragments, keeping the effect's objects in formation for the first 36 frames.
The close of four summons: Thor, Nereid, Cybele and Tiamat's BattleFx_RunPaletteParticles call it once their own frames are over, each with its own formation. Builds and frees both blitters, starts and stops the canvas transfer, sets REG_BG2PA, REG_BG2X and REG_BLDCNT, loads pictures into the sheet slot and work->sheet and overwrites work->particles 0 to 63 and PARTICLES 0 to 63. It leaves the canvas's VRAM cleared; ending the canvas layer is left to the caller.
formation: the layout for BattleFx_PlaceFormationObjects. x, y: the formation's origin in 16.16 pixels; the burst is drawn 40 pixels right of x, halved for the wide canvas.
Used by BattleFx_RunCybele, BattleFx_RunNereid, BattleFx_RunPaletteParticles, BattleFx_RunThor.
Macros
HELM_SPLITTER_STAR_CELLS
#define HELM_SPLITTER_STAR_CELLS 0x3e80
The pink star animation, after the swirl.
Used by BattleFx_RunHelmSplitter.
IMPACT_BURST_SHARD_CELLS
#define IMPACT_BURST_SHARD_CELLS 0x59d8
The fragment pictures in the sheet, four of 12x24, after the flash.
Used by BattleFx_RunImpactBurst.
IMPACT_BURST_FIRST_FRAGMENT
#define IMPACT_BURST_FIRST_FRAGMENT 61
the first fragment in work->particles
Used by BattleFx_RunImpactBurst.
Also, macros without a comment: HELM_SPLITTER_FRAMES, HELM_SPLITTER_STRIKE_FRAME, HELM_SPLITTER_CLEARED_SLOTS, HELM_SPLITTER_SPARKS, HELM_SPLITTER_SPARK_SLOTS, IMPACT_BURST_FRAGMENT_WIDTH, IMPACT_BURST_FRAGMENT_HEIGHT, IMPACT_BURST_FRAMES, IMPACT_BURST_FRAGMENTS, IMPACT_BURST_DRAWN_LARGE, IMPACT_BURST_DRAWN_SMALL, IMPACT_BURST_LARGE_SPARKS, IMPACT_BURST_SMALL_SPARKS.