Alchemy

death_plunge.c

Death Plunge, the blade rain, the element pillar, the element burst and the shattering picture.

games/tbs/src/effect/parts/death_plunge.c on GitHub

Death Plunge, the blade rain, the element pillar, the element burst and the shattering picture. Part of effect.c, the battle effect object, compiled only through it.

Functions

BattleFx_RunDeathPlunge

void BattleFx_RunDeathPlunge(struct BattleEffectArgument *effect)

The user runs 9/10 of the way to the first target, then both leap and turn upside down in the air; on frame 54 the target is hit and both bounce back, while flashes burst from the user and rise in a widening ring.

Abilities: Death Plunge (kind 53).

Used by gBattleFx_EffectHandlers.

Line 35

BattleFx_RunBladeRain

UNUSED void BattleFx_RunBladeRain(struct BattleEffectArgument *effect)

Drops 16 swords, one every 4 frames, slanting in towards the first target (the middle of the canvas, x 64) and sticking in the ground, where their bottom 4 pixels are hidden.

Sword i falls from frame 4i + 16 and sticks at frame 4i + 25. Every 4 frames from 24 to 84 the target flashes white in its damage pose for 2 frames and the screen shakes; every 8 frames the hit sound plays.

Nothing reaches it: no handler table entry or call names it. Places 64 swords in work->particles but draws only the first 16, and moves BG2X to centre the canvas on the target.

Line 189

BattleFx_RunElementPillar

void BattleFx_RunElementPillar(struct BattleEffectArgument *effect)

The glow of an element around a unit: a symmetrical pillar of light stands at the unit's feet while motes spiral up around it, for 56 frames, and the first target flashes.

Called through BattleFx_RunElementPillarFar by BattleFx_PlayUnitElementEffect (its mode 2) and four times in a row, one for each element, by BattlePres_RunUnitAction. Allocates and frees its own work, canvas and sheet slots; loads the element's colours over the first 64 of the background palette, fills PARTICLES 0 to 127 and moves BG2X with the unit. Increments effect->variant in place, so BattlePres_RunUnitAction's four calls draw ever larger motes.

effect->kind    : the element, which picks the palette: 0 Venus yellow,
                  1 Mercury blue, 2 Mars red, others Jupiter violet.
effect->variant : the mote size less one, kept to 1 to 4 after adding 1.

Line 358

BattleFx_RunShatteringOpening

void BattleFx_RunShatteringOpening(struct BattleEffectArgument *effect)

The shattering opening of the battle on the Venus aerie storm backdrop: the screen turns white and a grey disc grows from (96, 60) by 32 pixels a frame while the TileAnimationMask picture breaks into 33 pieces that fly apart and fall; background palettes 6 to 13 then ease from white back to the battle backdrop's colours, and from frame 51 32 flashes rise. Runs for 128 frames.

Called through BattleFx_RunShatteringOpeningFar by BattlePres_RunEntryTransition, as a battle opens. Allocates and frees its own work, canvas and sheet slots; sets up BG2 as the canvas itself, as BattleFx_BeginCanvasLayer would; draws the disc in Ram_MapCellBuffer and copies it over 0x7800 bytes of BG character block 2; writes background colours 1 to 63 and palettes 6 to 13; reloads the battle backdrop on BG1 on frame 5, and on its way out restores gBgScroll[1], starts the battle's palette fade (mode 2) and queues a DISPCNT without BG1.

effect : only effect->actors[0], the unit that flashes, is read.

Line 548

BattleFx_RunElementBurst

void BattleFx_RunElementBurst(struct BattleEffectArgument *effect)

The burst of an element over a unit, for 56 frames: sparks flare at the four corners around the unit, motes spiral in, and from frame 28 a burst of light plays over the unit while the first target flashes.

Called through BattleFx_RunElementBurstFar by BattleFx_PlayUnitElementEffect (its mode 3). Allocates and frees its own work, canvas and sheet slots; loads the element's colours over the first 64 of the background palette, fills PARTICLES 0 to 127 and work->particles, and moves BG2X with the unit.

effect->kind : the element, which picks the palette: 0 Venus yellow,
               1 Mercury blue, 2 Mars red, others Jupiter violet.

Line 923

BattleFx_DrawStreaks

void BattleFx_DrawStreaks(void)

Draws a frame of the element streak burst: on its first frame seeds 256 streaks with random axes, then each frame draws the first 64 (streak i from frame i / 4) as lines three pixels thick that shrink 4 pixels a frame towards the centre of the canvas, a little below its middle.

Runs each frame as a scheduler callback added by BattleFx_StartElementStreaks and removed by BattleFx_EndElementStreaks. Counts work->frame, keeps the streaks in Ram_MapCellBuffer, draws into the canvas through BattleFx_DrawClippedCanvasLine, resets the render transform and sets work->transferPending.

Used by BattleFx_EndElementStreaks, BattleFx_StartElementStreaks.

Line 1062

BattleFx_StartElementStreaks

void BattleFx_StartElementStreaks(s32 element)

Starts the element streak burst and returns at once: opens the canvas and schedules BattleFx_DrawStreaks with a canvas that darkens each frame.

Called through BattleFx_StartElementStreaksFar by BattleFx_PlayUnitElementEffect (its mode 1), which keeps the canvas on its unit and ends the burst with BattleFx_EndElementStreaks. Allocates the work and canvas slots, which the end frees; loads the element's colours over the first 64 of the background palette; adds BattleFx_DrawStreaks and the canvas transfer to the scheduler, beside the backdrop fade BattleFx_BeginCanvasLayer adds.

element: the element, which picks the palette: 0 Venus yellow, 1 Mercury
       blue, 2 Mars red, 3 Jupiter violet, others a dusty grey.

Line 1136

BattleFx_EndElementStreaks

void BattleFx_EndElementStreaks(void)

Ends the element streak burst that BattleFx_StartElementStreaks started: stops its callbacks and the background palette fade, clears the canvas in VRAM and frees the work and the canvas.

Called through BattleFx_EndElementStreaksFar by BattleFx_PlayUnitElementEffect. Unlike BattleFx_EndCanvasLayer it leaves BG2's settings and the backdrop's colours as they are.

Line 1183

Structures

Streak

struct Streak

One streak of light of the element streak burst, laid over the same 28-byte records as PARTICLES: a line along a randomly turned axis from tail to head, in distance from the centre.

FieldDeclared as
heads32 headthe head's distance from the centre, 48 to 63 at first
tails32 tailthe tail's distance, 8 less; both close in 4 a frame
unused08s32 unused08the EffectStep's z, which the streaks leave alone
pitchs32 pitchthe axis's turn, a random 16-bit angle
yaws32 yawthe axis's turn, a random 16-bit angle
rolls32 rollthe axis's turn, a random 16-bit angle
unused18s32 unused18the EffectStep's variant, which the streaks leave alone

Used by BattleFx_DrawStreaks.

Line 901

Macros

SHATTERING_OPENING_PLOT_PIXEL

#define SHATTERING_OPENING_PLOT_PIXEL(x, y)

Sets the pixel at (x, y) of the 256x120 8bpp tile picture in Ram_MapCellBuffer (32 tiles across) to colour 2.

Line 513

SHATTERING_OPENING_PLOT_CORNERS

#define SHATTERING_OPENING_PLOT_CORNERS(x1, x2, y1, y2)

Plots the four corners (x1 or x2, y1 or y2): one point of the circle mirrored into four octants.

Used by BattleFx_RunShatteringOpening.

Line 519

Also, macros without a comment: DEATH_PLUNGE_FRAMES, BLADE_RAIN_FRAMES, ELEMENT_PILLAR_FRAMES, SHATTERING_OPENING_FRAMES, SHATTERING_OPENING_FLASHES, SHATTERING_OPENING_PIECES, SHATTERING_OPENING_DISC_X, SHATTERING_OPENING_DISC_Y.

On this page