beams.c
Beam sequences and the ring and spark scene.
games/tbs/src/effect/parts/beams.c on GitHub
Beam sequences and the ring and spark scene. Part of effect.c, the battle effect object, compiled only through it.
Functions
BattleFx_RunBeamSequence
void BattleFx_RunBeamSequence(struct BattleEffectArgument *effect)
Draws the selected beam and its projected sparks over the first target: a beam, arc or wave shoots from the user; from frame 4 the target is hit, a yellow orb flashes over it and sparks fly off, for 32 frames in all. effect->kind picks the picture.
Reached through BattleFx_DispatchByIdRange for kinds 136 to 199 and, through its unsigned test, every kind below 100; BattlePres_RunPlainAttack (battle/staging.c) sends every plain attack there. Only kinds 0 to 5 have pictures. Shows the canvas on BG1 (BattleFx_SetupCanvasTileMap), loads palette colours 0 to 63, scrolls BG1 through gBgScroll[1] and uses work->particles 0 to 63 (only 0 to 31 fly) and both blitter slots; at the end it removes the transfer callback, frees the blitters, sets gBgScroll[1].y back to 32 and hides BG1 again (BattleFx_HideBg1AndRestoreBackdrop).
Used by BattleFx_DispatchByIdRange.
BattleFx_RunRingAndSparkScene
void BattleFx_RunRingAndSparkScene(struct BattleEffectArgument *effect)
Plays the selected ring-and-spark strike, restoring the user motion after it. Kinds above 199 first gather 64 motes of light into the user for 32 frames while it stands still; then star burst and crescent rings flash over the canvas and sparks fly from the first target for 32 frames, and the background palette fades back in.
Reached through BattleFx_DispatchByIdRange for kinds 200 and up, which BattlePres_RunAttack (battle/staging.c) makes by adding 200 to the kind of a critical hit; so the gathering always plays. Shows the canvas on BG1, keeps the battle's transition centred between the user and the first target while it loads, scrolls BG1 through gBgScroll[1] and uses work->particles 0 to 63, work->imageStorage, Ram_MapCellBuffer and both blitter slots. While the motes gather it adds Palette_StepFadeTransfer and stops the user's motion, and restores both after. At the end it removes the transfer callback, frees the blitters, sets gBgScroll[1].y back to 32, steps the background palette level from 6 back to 0 and hides BG1 again.
Used by BattleFx_DispatchByIdRange.