Battle Effects
This page is a guide to the games/tbs/src/battle_effect/ folder of the Alchemy
project, where every weapon slash, Psynergy blast, Djinni prelude, and summon
animation in Golden Sun: The Broken Seal lives as a self-contained visual
effect.
Each animation is a blocking C handler that paints onto a 128×128 brightness
canvas. None of these handlers decide combat math, damage numbers, or hit
checks. They draw the animation on screen and call btPlaybackStart at the
exact impact tick so that the battle engine can resolve the hit.
When a party member casts Fire, calls down Bolt, or unleashes a sword in battle, the code in this folder lights the darkened arena. The sections below cover ability dispatch, palette ramps, glowing trails, assembly blitters, unused effects, and the file map. How effects stay decoupled from combat rules is described in Battle & Effects.
Dispatch, variants, and the 128×128 brightness canvas

battle_effect_table.c maps every ability to an (effectId, variant) pair, so
tiered spells such as Quake, Earthquake, and Quake Sphere share one handler at
variants 0, 1, and 2. Families reuse art widely: Herbs borrow Ply's
sparkles, Gaia and Rockfall share one rock-wall handler, and
battle_effect_casting_impact.c drives 8 Djinn plus many weapon unleashes.
Nearly every effect draws 6-bit brightness values (0..63) onto a 128×128
software canvas, then maps those values through an effect-supplied 64-colour
palette ramp. The same drawing routine therefore appears as fire under one ramp
and as ice under another. Most spells stretch the canvas 2× horizontally and
blend additively so blasts glow like light, while solid effects such as Quake
display 1× opaque so pillars hide sprites behind them.
VBlank transfer and glowing trails

Handlers draw onto a RAM copy of the canvas and wait a tick via sySynch(1). At
VBlank, a transfer event copies the canvas to VRAM and immediately applies one
of four post-copy decay modes to RAM. This is how Fire's fireballs leave glowing
tails that no code draws explicitly: the tail is last tick's fireball, a
quarter dimmer.
| Post-transfer mode | Visual result |
|---|---|
Clear to 0 | Only this tick's drawing (no trail) |
Scale pixels to 3/4 | Long glowing trails (e.g., Fire's fireball tails) |
Scale pixels to 1/2 | Short motion trails |
| Leave untouched | Cumulative buildup across ticks |
Blitters, motes, hardware windows, and unused handlers

- Assembly blitters (
blitter_*): Stamp sprites onto the canvas with replace, additive, or max-brightness blending. Ray keeps max brightness so crossing bolts stay uniform, while stronger variants switch to additive so crossings flare. - Motes and particles: Round motes and square flares unpack from
graphics/battle_effects/(Graphics assets) at 10 sizes so particles shrink smoothly as they die. - Viewport framing and HBlank lines: Effects use GBA display windows (
WIN0andWIN1) to frame the viewport while darkening the backdrop. They also register temporary HBlank DMA events for per-scanline effects such as Ice's slanted shard band, Heartrender's wave, and Meteor's sky gradient. Every handler unregisters its events before freeing heap memory. - Starting point and unused handlers:
battle_effect_bolt.ccontains a short handler loop.btEffectRunUnusedSevereBlowLeap(battle_effect_thrash.c) goes unused in TBS and becomes Severe Blow in The Lost Age.btEffectRunUnusedTriangleStrike(battle_effect_bind.c) is unused in both games (How The Lost Age Evolved from The Broken Seal).
File map
| File(s) | Role |
|---|---|
battle_effect.c | Parent translation unit #includeing all battle_effect_*.c parts in ROM order |
battle_effect_*.c | Per-ability and summon visual handlers (named for their primary ability) |
battle_effect_table.c | Ability-to-(effectId, variant) dispatch and asset lookup tables |
blitter_*.s, stubs.s | Assembly canvas blitters and jump-table stubs |
Source files
| File | Description |
|---|---|
battle_effect.c | Everything drawn over the battle while an ability plays: the effects are the parts under battle_effect/, and battle_effect_internal.h holds what they share. |
battle_effect_annihilation.c | Annihilation. |
battle_effect_atalanta.c | The Atalanta summon. |
battle_effect_beams.c | The plain attack's slash, and the critical hit's gathering light and crescent. |
battle_effect_bind.c | Bind and Triangle Strike. |
battle_effect_blitter.c | The blitter builder, btEffectBuildBlitter. |
battle_effect_bolt.c | Bolt. |
battle_effect_boreas.c | The Boreas summon. |
battle_effect_burst_shower.c | The blessings' burst showers. |
battle_effect_canvas.c | The canvas layer: opening and closing it, its transfers, the battle background's darkening behind it, the targets' flash timers, and lines. |
battle_effect_canvas_wipe.c | The canvas wipe: the ragged sweep that blacks out or clears the canvas as the summons and the larger effects open and close. |
battle_effect_casting_impact.c | The casting impacts, the Djinn attacks, weapons' unleashes and enemy abilities that open the same way: sparks close in on the caster, a streak shoots at the target and a ring of light bursts over it in a spray of sparks, and then each impact plays its own effect over the target (enum CASTING_IMPACT). |
battle_effect_condemn.c | Condemn. |
battle_effect_cybele.c | The Cybele summon. |
battle_effect_death_plunge.c | |
battle_effect_dispatch.c | The two ways into an effect, a summon or an ordinary ability, with the sheet, state and canvas they lend it; and the helpers the summons share for window 0's ragged edge and the targets' sprites. |
battle_effect_display.c | The display every effect starts from, the timed scroll of BG1 and BG2 the summons' skies use, and the line-by-line feed of window 0's edges. |
battle_effect_djinn_attacks.c | The summons that spend one Djinni: Mercury, Jupiter, Venus and Mars. |
battle_effect_djinn_beams.c | Revive, Water of Life, Quartz and Dew. |
battle_effect_djinn_heal.c | An unused Mercury Djinni heal, and the camera turn Fire and Froth share. |
battle_effect_dragon_cloud.c | Dragon Cloud. |
battle_effect_drain.c | Break and Drain. |
battle_effect_element_pillar.c | The blade rain, the element pillar, the shattering opening, the element burst and the element streaks. |
battle_effect_eruption.c | Smoke Bomb and Blast. |
battle_effect_falling.c | Ice and Douse: shards and drops of water falling on the targets' side. |
battle_effect_fire.c | Fire. |
battle_effect_flare.c | Flare. |
battle_effect_flurry.c | Gust, Flying Attack and the rush strikes. |
battle_effect_frost.c | Frost. |
battle_effect_gaia.c | The Gaia and Rockfall Psynergy. |
battle_effect_gathering_lights.c | Demon Night, Rumble and Haunting. |
battle_effect_growth.c | Growth, Punji, Vine and Thorn: columns, vines and thorns spring up one after another, each shaking the screen and throwing up dust from its root, and the targets react a few ticks later. |
battle_effect_hail.c | Hail and Ground. |
battle_effect_haunt.c | Haunt and the orbiting spirals. |
battle_effect_healing.c | The healing motes of Ply, Wish, Cure, Cure Poison, Tonic and Psy Crystal. |
battle_effect_helm_splitter.c | |
battle_effect_internal.h | What every part of the battle effect object shares: its includes, macros and tick-loop helpers. |
battle_effect_judgment.c | The Judgment summon. |
battle_effect_kirin.c | The Kirin summon. |
battle_effect_lobbed_shells.c | Lobbed shells (Mad Spatter, Decompose, Bone Chiller ...). |
battle_effect_mirrored_wall.c | The walls of Berserk, Spasm and Recovery. |
battle_effect_neptune.c | The Neptune summon. |
battle_effect_nereid.c | The Nereid summon. |
battle_effect_orbiting.c | Swirling stars, orbiting skulls and target bursts. |
battle_effect_planet_diver.c | Planet Diver. |
battle_effect_plasma.c | Plasma, and the spark groups of Blast and Dynamite. |
battle_effect_positions.c | Where an effect's pieces are: particles moved a tick at a time, and the screen points of units, which effects anchor on; and the runner for a casting impact, a plain attack or a critical hit. |
battle_effect_prism.c | Prism. |
battle_effect_procne.c | The Procne summon. |
battle_effect_projectiles.c | The Djinni entrance that opens the Djinn's effects, and the projectile volleys (Slash, Shuriken, Wing Flutter, Blizzard ...). |
battle_effect_quake.c | Quake. |
battle_effect_ragnarok.c | Ragnarok. |
battle_effect_ramses.c | The Ramses summon. |
battle_effect_ray.c | Ray. |
battle_effect_rushing_strike.c | Rushing strikes, where the user charges into its target (Bone Charge, Brute Force, Onslaught, Headbutt). |
battle_effect_spider_web.c | Poison Beat, Spinning Beat and Spider Web. |
battle_effect_spire.c | Spire. |
battle_effect_starfield_fall.c | Summon formations, the impact burst, Meteor and Outer Space. |
battle_effect_stars.c | Astral Blast and Shining Star. |
battle_effect_stat_change.c | Stat boosts and reductions (Impact, Guard, Ward, Dull, Weaken ...). |
battle_effect_streaks.c | Streak volleys (Sonic Wave, Shriek, War Cry ...) and mote fountains (Sleep Star, Soothing Star). |
battle_effect_table.c | Picture layouts, timing rows and handler entries for the battle effects. |
battle_effect_target_motes.c | The status motes of Taint, Delude, Paralyze, Heartrender, Mystic Flame, Demon Fire and Drown, then Sleep's sheep and Curse's flames. |
battle_effect_target_strike.c | Monster bites and slashes on one target. |
battle_effect_thor.c | The Thor summon. |
battle_effect_thrash.c | Thrash, Quick Strike and Vorpal Slash. |
battle_effect_tiamat.c | Dragon Driver and the Tiamat summon. |
battle_effect_titan_blade.c | Titan Blade. |
battle_effect_torch.c | Torch and Kite. |
battle_effect_undead_sword.c | Undead Sword, the sword of light that rises under its target. |
battle_effect_volcano.c | Volcano. |
battle_effect_vortices.c | Froth's bubbles that burst into whirling vortices, and Whirlwind's tornadoes. |
blitter_color_fragments.c | The colour fragments btEffectBuildBlitter (battle_effect_blitter.c) builds canvas blitters from, as it does the others in blitter_fragments.c: each adds four picture pixels to a canvas word at once, forward or reverse, and caps each byte that reaches the cap mask's bit at the brightest canvas level. |
blitter_fragments.c | The pieces btEffectBuildBlitter (battle_effect_blitter.c) builds canvas blitters from. |
blitter_operands.c | The ARM immediate operands for powers of two, which the blitter builder (battle_effect_blitter.c) adds to its clip words to fit the canvas width. |
| File | Description |
|---|---|
battle_effect.h | The battle effects: the effect kinds an ability plays, and the runners in src/battle_effect/ that draw them over the battle, part by part. |
battle_effect_ids.h | The kinds of battle effect, by AbilityBattleEffects' low twelve bits: the large effects btEffectRunSummon runs, and the effects the table of handlers plays. |
battle_effect_table.h | The tables the battle effects read (battle_effect_table.c), in its order: picture offsets, sizes, timings and counts by variant. |
blitter_operands.h | The ARM operands for powers of two that the blitter builder adds to its templates (blitter_operands.c). |
stubs.h | The battle effects module's stub calls: the Psynergy, summon and element effects a battle plays. |