Alchemy

particle_streams.c

Meteor and Outer Space.

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

Meteor and Outer Space. Part of effect.c, the battle effect object, compiled only through it.

Functions

Palette_BrightenBgEntries

void Palette_BrightenBgEntries(s32 blueStep, s32 greenStep, s32 redStep)

Adds per-channel steps to background colours 1 to 63, capped at 31.

Called once a frame to whiten the colours over a few frames: by BattleFx_RunParticleStreams from frame 36 of its burst, and by Tiamat's BattleFx_RunPaletteParticles. Rewrites background palette RAM.

Used by BattleFx_RunPaletteParticles, BattleFx_RunParticleStreams.

Line 12

BattleFx_ArmPaletteHBlankDma

void BattleFx_ArmPaletteHBlankDma(void)

Arms DMA 0 to write one halfword of the table at work->sheet + 0x1f80 into background colour 0 at each horizontal blank, so the backdrop colour changes line by line.

Runs each frame as a scheduler callback (order 0x4fe) that BattleFx_RunParticleStreams adds for its rise and removes after it; the rise rewrites the 160 colours, its heat lines, every frame. Stops DMA 0 and sets it up again, so the table is read from line 0.

Used by BattleFx_RunParticleStreams.

Line 42

BattleFx_RunMeteor

void BattleFx_RunMeteor(struct BattleEffectArgument *effect)

A formation rises out of a dissolving starfield and bursts into embers and flashes: the particle stream in mode 0, with one spawned object rising.

Abilities: Meteor (scene kind 11).

Used by BattleFx_RunSceneEffect.

Line 54

BattleFx_RunOuterSpace

void BattleFx_RunOuterSpace(struct BattleEffectArgument *effect)

The user leaps up, and two objects rise out of a dissolving starfield and burst into embers and flashes: the particle stream in mode 1, in the lightning bolt's colours.

Abilities: Outer Space (kind 384).

Used by gBattleFx_EffectHandlers.

Line 63

BattleFx_RunParticleStreams

void BattleFx_RunParticleStreams(struct BattleEffectArgument *effect, s32 mode)

The stream runs in two halves. The rise dissolves the battle map into a starfield, then for up to PARTICLE_STREAMS_RISE_FRAMES lifts a formation of objects while motes, orbiting sparks and falling drops are drawn into the map buffer over a heat-tinted scanline palette. The burst then switches to a blended half-scale canvas and throws embers, screen motes and growing flashes from the origin for PARTICLE_STREAMS_BURST_FRAMES shaking frames.

Particle slots: the burst's flashes use PARTICLES 0 to 127 and its embers the 512 after them (PARTICLE_STREAMS_EMBERS); work->particles holds the rising motes (0 to 31) and the flames (32 to 47).

Called by BattleFx_RunMeteor (mode 0) and BattleFx_RunOuterSpace (mode 1). The rise shows Ram_MapCellBuffer on BG1 through BattleFx_FlushPendingGraphicsTransfer, scrolls BG2 with BattleFx_AdvanceBg2OnInterval and colours the backdrop with BattleFx_ArmPaletteHBlankDma, and removes all three after; it also moves the projection centre down to line 240 and sets the background view's active flag while it runs. The burst sets BG2 back to the half-scale canvas and ends the canvas layer. Releases the formation objects it spawned (mode 1's on frame 48 of the burst).

Used by BattleFx_RunMeteor, BattleFx_RunOuterSpace.

Line 96

Macros

PARTICLE_STREAMS_EMBERS

#define PARTICLE_STREAMS_EMBERS (&PARTICLES[128])

The burst's embers, 512 in PARTICLES after its 128 flashes.

Used by BattleFx_RunParticleStreams.

Line 68

PARTICLE_STREAMS_MOTE_CELLS

#define PARTICLE_STREAMS_MOTE_CELLS 0x3200

The mote pictures in the sheet: two sets, MOTE_SET_BYTES apart.

Used by BattleFx_RunParticleStreams.

Line 74

Also, macros without a comment: PARTICLE_STREAMS_RISE_FRAMES, PARTICLE_STREAMS_BURST_FRAMES.

On this page