growth.c
Growth, Punji, Vine and Thorn.
games/tbs/src/effect/parts/growth.c on GitHub
Growth, Punji, Vine and Thorn. Part of effect.c, the battle effect object, compiled only through it.
Functions
BattleFx_RunGrowth
void BattleFx_RunGrowth(struct BattleEffectArgument *effect)
Grows vines from the ground, scattering dust from each root.
Abilities: Growth, Mad Growth, Wild Growth (kind 4).
Used by gBattleFx_EffectHandlers.
BattleFx_RunPunji
void BattleFx_RunPunji(struct BattleEffectArgument *effect)
Grows green pillars from the ground, scattering dust from each root.
Abilities: Punji, Punji Trap, Punji Strike (kind 56).
Used by gBattleFx_EffectHandlers.
BattleFx_RunGrowingColumns
void BattleFx_RunGrowingColumns(struct BattleEffectArgument *effect, s32 mode)
Vines (mode 0) or green pillars (mode 1) grow one every 4 frames, alternately mirrored, each throwing up dust from its root.
Column i appears on frame 4i + 9, shaking the screen, and grows 8 pixels a frame to a random length capped by its shape (i % 3); a pillar also stops at its gGrowth_PillarHeights. On frame 4i + 12 the targets react (even columns with a sound), and on frames 4i + 12 and 4i + 16 the column throws up a puff of dust. The battle moves on to the results 64 frames before the end; the scene fades out over 16 frames, and nothing grows in its last 4.
Called by BattleFx_RunGrowth (mode 0) and BattleFx_RunPunji (mode 1). work->particles holds the 16 columns (struct DualColumn) and PARTICLES the dust. Writes REG_BG2PA, REG_BLDCNT, REG_BLDALPHA and, on side 1, REG_BG2X; sets work->shakeFrames as each column appears. Ends with the transfer callback removed, the blitters freed and the canvas layer closed.
effect: the targets; variant picks the number of columns
(gGrowth_ColumnCounts).Used by BattleFx_RunGrowth, BattleFx_RunPunji.
BattleFx_RunVine
void BattleFx_RunVine(struct BattleEffectArgument *effect)
Rising vines: sixteen green vines grow from the middle of the row of targets, 2 frames apart, and shrink back.
Abilities: Vine (kind 202).
Vine i appears on frame 2i + 5 and grows 4 pixels a frame up to 32, cycling through five 32x32 pictures, then shrinks away from frame 2i + 32; odd vines are mirrored. Vine i shakes the screen on frame 4i + 5. On frame 32 the targets react together, with a sound.
A Djinni appears first (BattleFx_RunDjinniEntrance). work->particles holds the 16 vines' x. Writes REG_BG2PA, REG_BLDCNT and REG_BG2X, sets work->shakeFrames, and ends with the transfer callback removed, the blitters freed and the canvas layer closed.
Used by gBattleFx_EffectHandlers.
BattleFx_RunThorn
void BattleFx_RunThorn(struct BattleEffectArgument *effect)
Rising thorns: thorns burst from the ground one every 8 frames, throwing up dust from their roots.
Abilities: Thorn, Briar, Nettle (kind 5).
Thorn i appears on frame 8i + 9, shaking the screen, and throws up a puff of dust on each of its first two frames; on frame 8i + 12 the targets react with a sound. The battle moves on to the results 64 frames before the end, and the scene fades out over its last 16 frames.
effect: the targets; variant picks the number of thorns
(gGrowth_Counts). gGrowth_Kinds gives each
thorn's size and direction.PARTICLES holds the dust, 64 puffs. Writes REG_BG2PA, REG_BLDCNT, REG_BLDALPHA and, on side 1, REG_BG2X; sets work->shakeFrames as each thorn appears. Ends with the transfer callback removed, the blitters freed and the canvas layer closed.
Used by gBattleFx_EffectHandlers.
Structures
DualColumn
struct DualColumn
One growing column, laid over a struct EffectStep in work->particles.
| Field | Declared as | |
|---|---|---|
x | s32 x | the root, in canvas pixels |
y | s32 y | the root's row: 108 to 115, lower for later columns |
z | s32 z | the EffectStep's z and velocityX, unused here |
velocityX | s32 velocityX | |
height | s32 height | the full length, 55 to 118 capped by its shape |
velocityZ | s32 velocityZ | the EffectStep's, unused here |
start | s32 start | The frame it starts to grow; set, but the frame loop computes its own. |
Used by BattleFx_RunGrowingColumns.
Macros
GROWING_COLUMNS_VINE_DUST_CELLS
#define GROWING_COLUMNS_VINE_DUST_CELLS 0x1e59
The dust pictures in the vine sheet, after the vines.
Used by BattleFx_RunGrowingColumns.
GROWING_COLUMNS_PILLAR_DUST_CELLS
#define GROWING_COLUMNS_PILLAR_DUST_CELLS 0xaff
The dust pictures in the pillar sheet, after the pillars.
Used by BattleFx_RunGrowingColumns.
THORN_SMALL_CELLS
#define THORN_SMALL_CELLS (48 * 80)
The small thorn in the thorn sheet, after the 48x80 big one.
Used by BattleFx_RunThorn.
Also, macros without a comment: VINE_COLUMNS, VINE_FRAMES.