15#define GROWING_COLUMNS_VINE_DUST_CELLS 0x1e59
17#define GROWING_COLUMNS_PILLAR_DUST_CELLS 0xaff
19#define THORN_SMALL_CELLS (48 * 80)
125 draw[1] = secondSlot;
135 *(
s32 *)variantCursor = -1;
146 setup->
y = i / 2 + 108;
155 setup->
start = limit;
165 cueFrame = duration - 64;
166 fadeStart = duration - 20;
167 fadeEnd = duration - 4;
169 if (frame == cueFrame) {
172 if (frame >= fadeStart && frame < fadeEnd) {
179 if (frame < fadeEnd) {
186 if (frame == i * 4 + 9) {
196 length = (frame -
start) * 8;
198 if (length > reach) {
207 canvas, work->sheet + cell, column->
x - (shape >> 1),
208 column->
y - length, shape, length);
212 if (length > pillarHeight) {
213 length = pillarHeight;
220 canvas, work->sheet + cell, column->
x - (shape >> 1),
221 column->
y - length, shape, length);
230 reactFrame =
start + 4;
232 if (frame == reactFrame) {
243 reactFrame =
start + 4;
248 if ((frame == reactFrame) || (frame == (
start + 8))) {
254 if (((
struct EffectStep *)length)->variant == -1) {
303 }
while (frame != duration);
308#define VINE_COLUMNS 16
309#define VINE_FRAMES 70
330 s32 originX, originY;
332 s32 i, frame, cell, height, offset, middle;
338 canvas = (
void *)*cursor;
353 middle += (last.
x - middle) / 2;
383 if (
frame == i * 4 + 5)
390 if (
frame > offset + 4) {
391 cell = (
frame / 4 + i) % 5;
392 if (
frame < offset + 32) {
393 height = (
frame - offset) * 4 - 16;
397 height = 160 - (
frame - offset) * 4;
400 draw[i & 1](canvas, work->sheet + (cell << 10), column->
x - 16,
401 (i & 7) - height + 104, 32, height);
448 canvas = (
void *)*cursor;
473 for (i = 0; i != 1024; i++) {
478 if (
frame == frameCount - 64) {
481 if (
frame >= frameCount - 16) {
490 age =
frame - (i * 8 + 8);
509 drawFlip(canvas, work->sheet,
gGrowth_X[i] - lean, 108 - height, 48,
512 draw(canvas, work->sheet,
gGrowth_X[i] + lean, 108 - height, 48,
526 gGrowth_X[i] - lean, 108 - height, 32, height);
529 108 - height, 32, height);
532 if (
frame == start + 1) {
539 if (
frame < start + 3) {
542 for (j = 0; j != 64; j++) {
557 if (frame == start + 4) {
566 for (i = 0; i != 64; i++) {
589#undef GROWING_COLUMNS_VINE_DUST_CELLS
590#undef GROWING_COLUMNS_PILLAR_DUST_CELLS
591#undef THORN_SMALL_CELLS
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ POSE_DAMAGE
taking damage
BattleEffectDrawRectangle DrawRectangle
#define EFFECT_FOR_EACH_TARGET(i, effect)
Loops i over the effect's targets, effect->actors[0] to effect->actors[effect->count - 1]: the loops ...
void BattleFx_ProcessPendingGraphicsTransfer(void)
Copies the canvas to VRAM once the effect has finished drawing a frame (transferPending): the 128x128...
void BattleFx_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
void Resource_LoadAndDecompress(s32 id, void *dst, s32 skipPalette, s32 copyPalette)
Decompresses a resource whose first 128 bytes may be a palette.
void ObjectGroup_UpdateMembers(s32 actorId, s32 palette, s32 animation, s32 timerSlot, s32 timerFrames)
Updates every animation group of one battler's object.
#define GROWING_COLUMNS_VINE_DUST_CELLS
The dust pictures in the vine sheet, after the vines.
void BattleFx_RunVine(struct BattleEffectArgument *effect)
Rising vines: sixteen green vines grow from the middle of the row of targets, 2 frames apart,...
void BattleFx_RunThorn(struct BattleEffectArgument *effect)
Rising thorns: thorns burst from the ground one every 8 frames, throwing up dust from their roots.
#define GROWING_COLUMNS_PILLAR_DUST_CELLS
The dust pictures in the pillar sheet, after the pillars.
#define VINE_COLUMNS
columns that rise
#define THORN_SMALL_CELLS
The small thorn in the thorn sheet, after the 48x80 big one.
void BattleFx_RunPunji(struct BattleEffectArgument *effect)
Grows green pillars from the ground, scattering dust from each root.
void BattleFx_RunGrowingColumns(struct BattleEffectArgument *effect, s32 mode)
Vines (mode 0) or green pillars (mode 1) grow one every 4 frames, alternately mirrored,...
void BattleFx_RunGrowth(struct BattleEffectArgument *effect)
Grows vines from the ground, scattering dust from each root.
What every part of the battle effect object shares: its includes, macros and frame-loop helpers.
@ CANVAS_COPY_AND_CLEAR
copy, then fill the canvas with transferValue
#define EFFECT_CALLBACK_ORDER
The scheduler order of every per-frame effect callback (Scheduler_AddOrUpdateCallback sorts the frame...
#define EFFECT_SLOT(slots, slot)
A work slot read through a pointer to the effect's own slot, gWorkSlot[HEAP_SLOT_BATTLE_EFFECT].
#define EFFECT_FINISH_CANVAS()
The usual end of a canvas effect: stops the transfer callback before freeing what it reads,...
#define EFFECT_SHOW_DAMAGE(hitSound)
Lets the battle show the damage: resumes its paused playback, which plays hitSound (an SE_ id; 0 keep...
#define EFFECT_START_TRANSFER(work, mode, value)
Sets the transfer, then starts copying the canvas to VRAM once a frame.
#define EFFECT_LOAD_BLITTER(slot, flags, mode)
Builds a blitter for the 128x128 canvas (1 << 7 pixels each way) in work slot slot: BattleFx_BuildBli...
#define EFFECT_GET_SLOTS(slots, cursor, work, canvas)
Starts at the effect's entry in the whole work-slot array.
#define EFFECT_END_FRAME(work)
The usual end of an effect frame: counts down the targets' flash timers (ObjectGroup_TickMemberTimers...
u8 gGrowth_HeightLimits[]
u16 gGrowth_ThornPuffCells[]
s8 gGrowth_ColumnOffsets[]
Each vine's root, across from the middle of the targets.
u8 gGrowth_Counts[]
Thorns by variant.
u8 gGrowth_ThornPuffHeights[]
s8 gGrowth_PillarHeights[]
u8 gGrowth_PillarWidths[]
s8 gGrowth_ThornPuffWidths[]
u8 gGrowth_ColumnCounts[]
u16 gGrowth_PillarCells[]
void AudioCommand_PlayFar(s32 id)
void Camera_ApplyShake(s32 rangeX, u32 rangeY)
Shakes the battle view while gBattleFxWork's shakeFrames lasts, moving BG1 and the projection centre ...
@ HEAP_SLOT_BATTLE_EFFECT
@ HEAP_SLOT_BLITTER_ALTERNATE
#define Q_8_8(n)
The BG2/BG3 affine matrix entries are signed 8.8 fixed point: texels stepped per screen pixel.
#define BLDCNT_EFFECT_BLEND
weighted by REG_BLDALPHA
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
void EffectPosition_ProjectScaledBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, scaled for the battle view, 16 pixels higher.
void BattleFx_RunDjinniEntrance(struct BattleEffectArgument *effect, s32 mode, s32 side, s32 anchor, s32 *outX, s32 *outY)
Djinni entrance: sparks swirl around a point that travels from the user to the goal and gather into t...
#define Ram_MapCellBuffer
char ResourceId_ThornSheet
char ResourceId_GreenPillarSheet
char ResourceId_GreenVineSheet
char ResourceId_VineSheet
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
#define offsetof(type, member)
The command shared by an effect's caller, dispatcher and handlers.
s32 side
1 when the targets are the party, 0 for enemies
s16 actors[8]
the targets' unit ids, count of them
s32 variant
the ability's size, from 0 (Quake, then Earthquake)
s32 count
targets in actors, at least 1
The running battle effect's work: its canvas image, 64 particles, the display registers it stages and...
s32 frame
frame counter some effects keep, from 0
s32 shakeFrames
shake frames left; Camera_ApplyShake counts down
s32 transferMode
How the canvas transfer callbacks treat the canvas after each copy (enum CanvasTransferMode in effect...
s32 transferValue
The transfer mode's argument: the fill value, the share kept (50 or 75 percent) or the darken or brig...
struct BattleEffectArgument * effect
the command being run
struct EffectStep particles[64]
free while variant is -1
One growing column, laid over a struct EffectStep in work->particles.
s32 x
the root, in canvas pixels
s32 velocityZ
the EffectStep's, unused here
s32 y
the root's row: 108 to 115, lower for later columns
s32 z
the EffectStep's z and velocityX, unused here
s32 start
The frame it starts to grow; set, but the frame loop computes its own.
s32 height
the full length, 55 to 118 capped by its shape
A point projected onto the screen, with its depth.
A moving point of an effect: its position, its velocity and a value each effect uses its own way (a s...
s32 variant
each effect's own: a size, a countdown, -1 for idle
s32 x
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
#define EFFECT_CLIP_BOUNDS
Clips overflow on all four sides.
#define PARTICLES
The map cell buffer (gMapCellBuffer), which the effects borrow, has two views here: Ram_MapCellBuffer...
DrawRectangle BlitterPair[2]
A blitter pair: [0] built in HEAP_SLOT_BLITTER and [1] in HEAP_SLOT_BLITTER_ALTERNATE (BattleFx_Fetch...