Alchemy

falling.c

Ice and Douse: shards and bolts falling on the targets' side.

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

Ice and Douse: shards and bolts falling on the targets' side. Part of effect.c, the battle effect object, compiled only through it.

Functions

BattleFx_RunIce

void BattleFx_RunIce(struct BattleEffectArgument *effect)

Ice shards rain down diagonally onto the targets' side of the field and shatter into puffs of sparkle, flashing and shaking each target as they land.

Abilities: Ice, Ice Horn, Ice Missile (kind 7).

The canvas shows only inside a slanted band of window 0, so the shards stream out of the sky above the targets. effect->variant picks the size of the volley from gFalling_IceCounts (shards and frames: 16 for 46 frames, 20 for 52, 32 for 80); variant 1 leaves longer trails and variant 2 draws additively. effect->side is 1 when the targets are the party, 0 when they are enemies.

Used by gBattleFx_EffectHandlers.

Line 53

BattleFx_RunDouse

void BattleFx_RunDouse(struct BattleEffectArgument *effect)

Blue bolts streak down diagonally onto the targets' side of the field, each bursting into a fountain of falling sparks where it lands, while the targets flash.

Abilities: Douse, Drench, Deluge (kind 9).

Like the falling shards, the canvas shows only inside a slanted band of window 0. effect->variant picks the volley from gFalling_Counts: 6 bolts of 8 sparks, 8 of 16 or 32 of 4, spaced 32, 24 or 8 pixels apart, over 80 frames; it also picks how the canvas fades (see below). effect->side is 1 when the targets are the party, 0 when they are enemies.

Used by gBattleFx_EffectHandlers.

Line 276

Structures

BoltSparkBuffer

struct BoltSparkBuffer

Ram_MapCellBuffer as the falling bolts use it: window 0's scanline table, then the bolts' sparks.

FieldDeclared as
linesu16 lines[160]WIN0H for each screen line, read by the HBlank DMA
sparksstruct EffectStep sparks[FALLING_BOLT_SPARK_COUNT]free while -1

Line 253

Macros

FALLING_BUILD_SLANTED_WINDOW

#define FALLING_BUILD_SLANTED_WINDOW(line, i, last, slant, span)

Fills window 0's per-scanline edges for the falling shards and bolts: lines 8 to last take slant, an expression of the line i; the rest of the battle view, down to line 135, takes the fixed span; and the lines below it are empty. Every band the effects pass is 128 pixels wide.

Used by BattleFx_RunDouse, BattleFx_RunIce.

Line 11

FALLING_LAND_Y

#define FALLING_LAND_Y 0x27f

A falling shard or bolt keeps falling while its y (in eighths of a pixel) is at most this, just above 80 pixels.

Used by BattleFx_RunDouse, BattleFx_RunIce.

Line 39

FALLING_BOLT_SPARKS

#define FALLING_BOLT_SPARKS ((struct BoltSparkBuffer *)Ram_MapCellBuffer)

Ram_MapCellBuffer seen as Douse's struct BoltSparkBuffer.

Used by BattleFx_RunDouse.

Line 259

Also, macros without a comment: DOUSE_FALLING_CELL, DOUSE_FLASH_CELL, DOUSE_BURST_CELL.

On this page