Alchemy
Loading...
Searching...
No Matches

growth.c

Go to the documentation of this file.
1/// @file
2/// Growth, Punji, Vine and Thorn.
3/// Part of effect.c, the battle effect object, compiled only through it.
4
6
7// Growing columns and thorns spring up one after another on a fixed schedule,
8// each shaking the screen as it appears, throwing up puffs of dust from its
9// root and making the targets react a few frames later. The dust is a pool
10// of EffectSteps in PARTICLES, a free one marked by variant -1, its x and y
11// in canvas pixels; each puff plays seven pictures, 2 frames each, drawn
12// mirrored about its x. Both scenes fade out over their last 16 frames.
13
14/// The dust pictures in the vine sheet, after the vines.
15#define GROWING_COLUMNS_VINE_DUST_CELLS 0x1e59
16/// The dust pictures in the pillar sheet, after the pillars.
17#define GROWING_COLUMNS_PILLAR_DUST_CELLS 0xaff
18/// The small thorn in the thorn sheet, after the 48x80 big one.
19#define THORN_SMALL_CELLS (48 * 80)
20
21/// One growing column, laid over a struct EffectStep in work->particles.
22struct DualColumn {
23 s32 x; ///< the root, in canvas pixels
24 s32 y; ///< the root's row: 108 to 115, lower for later columns
25 s32 z; ///< the EffectStep's z and velocityX, unused here
27 s32 height; ///< the full length, 55 to 118 capped by its shape
28 s32 velocityZ; ///< the EffectStep's, unused here
29 /// The frame it starts to grow; set, but the frame loop computes its own.
31};
32
33/// Grows vines from the ground, scattering dust from each root.
34///
35/// Abilities: Growth, Mad Growth, Wild Growth (kind 4).
38}
39/// Grows green pillars from the ground, scattering dust from each root.
40///
41/// Abilities: Punji, Punji Trap, Punji Strike (kind 56).
44}
45/// Vines (mode 0) or green pillars (mode 1) grow one every 4 frames,
46/// alternately mirrored, each throwing up dust from its root.
47///
48/// Column i appears on frame 4i + 9, shaking the screen, and grows 8 pixels a
49/// frame to a random length capped by its shape (i % 3); a pillar also stops
50/// at its gGrowth_PillarHeights. On frame 4i + 12 the targets react (even
51/// columns with a sound), and on frames 4i + 12 and 4i + 16 the column throws
52/// up a puff of dust. The battle moves on to the results 64 frames before the
53/// end; the scene fades out over 16 frames, and nothing grows in its last 4.
54///
55/// Called by BattleFx_RunGrowth (mode 0) and BattleFx_RunPunji (mode 1).
56/// work->particles holds the 16 columns (struct DualColumn) and PARTICLES
57/// the dust. Writes REG_BG2PA, REG_BLDCNT, REG_BLDALPHA and, on side 1,
58/// REG_BG2X; sets work->shakeFrames as each column appears. Ends with the
59/// transfer callback removed, the blitters freed and the canvas layer closed.
60///
61/// effect: the targets; variant picks the number of columns
62/// (gGrowth_ColumnCounts).
64 void **slots;
65 void **cursor;
66 struct BattleEffectWork *work;
67 void *canvas;
68 void *rectangle[2];
69 void *secondSlot;
70
71 s32 frame;
72 s32 duration;
73 void **draw;
74 s32 cueFrame;
75 s32 fadeStart;
76 s32 fadeEnd;
77 s32 start;
78
79 u8 *variantCursor;
80
81 struct DualColumn *setup;
82 s32 x;
83 s32 height;
84 s32 limit;
85
86 s32 puffCells;
87 struct DualColumn *column;
88 s32 length;
89 s32 reach;
90 s8 pillarHeight;
91
92 s32 n;
93 s32 reactFrame;
94
95 s32 i;
96 struct EffectStep *puff;
97 s32 puffAge;
98 s32 image;
99
100 EFFECT_GET_SLOTS(slots, cursor, work, canvas);
101 work->effect = effect;
103 REG_BG2PA = Q_8_8(1); // the canvas at its own width
104 REG_BLDCNT = 0;
105 if (mode == 1) {
107 1, 1);
108 } else {
110 }
111 if (work->effect->side == 1) {
112 REG_BG2X = -0x7000; // 112 pixels right
113 }
116 rectangle[0] = gWorkSlot[HEAP_SLOT_BLITTER];
121 /* FAKEMATCH: the columns draw through a second pointer to the pair, whose
122 * address the frame keeps in a stack slot; as rectangle[side], 22
123 * instructions differ in tbs-en. */
124 draw = rectangle;
125 draw[1] = secondSlot;
126
127 duration = gGrowth_ColumnCounts[work->effect->variant] * 4 + 56;
128
129 // Mark the dust free (variant -1): 1024 records, though only the first 512
130 // are used.
131 variantCursor = Ram_MapCellBuffer + offsetof(struct EffectStep, variant);
132 i = 0;
133 do {
134 i++;
135 *(s32 *)variantCursor = -1;
136 variantCursor += sizeof(struct EffectStep);
137 } while (i != 1024);
138
139 // The 16 columns' roots and lengths: each root up to 4 pixels either side
140 // of its gGrowth_ColumnX, each length random and capped by its shape. All
141 // 16 are placed, whatever the variant's count.
142 i = 0;
143 setup = (struct DualColumn *)work->particles;
144 do {
145 x = (gGrowth_ColumnX[i] + (7 & Random16())) - 4;
146 setup->y = i / 2 + 108;
147 setup->x = x;
148 height = (63 & Random16()) + 55;
149 setup->height = height;
150 limit = gGrowth_HeightLimits[i % 3];
151 if (limit < height) {
152 setup->height = limit;
153 }
154 limit = i * 4 + 8;
155 setup->start = limit;
156 i++;
157 setup++;
158 } while (i != 16);
159
160 // Each transfer clears the canvas: everything is redrawn every frame.
162
163 frame = 0;
164 if (duration != 0) {
165 cueFrame = duration - 64;
166 fadeStart = duration - 20;
167 fadeEnd = duration - 4;
168 do {
169 if (frame == cueFrame) {
171 }
172 if (frame >= fadeStart && frame < fadeEnd) {
173 // Fade out over 16 frames, the canvas's share falling from 15/16 to
174 // nothing, which it stays at for the last 4.
176 REG_BLDALPHA = BLEND_ALPHA((duration - frame) - 5, 16);
177 }
178 // The columns, the targets' reactions and the dust they throw up.
179 if (frame < fadeEnd) {
180 i = 0;
181 if (gGrowth_ColumnCounts[work->effect->variant] != 0) {
182 do {
183 column = (struct DualColumn *)((u8 *)work->particles +
184 i * sizeof(struct DualColumn));
185 start = i * 4 + 8;
186 if (frame == i * 4 + 9) {
187 work->shakeFrames = 2;
188 }
189
190 // Grow 8 pixels a frame (odd columns mirrored), standing on the
191 // root and centred across it. A pillar also stops at its
192 // gGrowth_PillarHeights entry.
193 if (frame > start) {
194 u32 shape = i % 3;
195
196 length = (frame - start) * 8;
197 reach = column->height;
198 if (length > reach) {
199 length = reach;
200 }
201 if (mode == 0) {
202 {
203 s32 side = 1 & i;
204 s32 cell = gGrowth_VineCells[shape];
205 shape = gGrowth_VineWidths[shape];
206 ((DrawRectangle)draw[side])(
207 canvas, work->sheet + cell, column->x - (shape >> 1),
208 column->y - length, shape, length);
209 }
210 } else {
211 pillarHeight = gGrowth_PillarHeights[7 & i];
212 if (length > pillarHeight) {
213 length = pillarHeight;
214 }
215 {
216 s32 side = 1 & i;
217 s32 cell = gGrowth_PillarCells[shape];
218 shape = gGrowth_PillarWidths[shape];
219 ((DrawRectangle)draw[side])(
220 canvas, work->sheet + cell, column->x - (shape >> 1),
221 column->y - length, shape, length);
222 }
223 }
224 }
225
226 // The targets react 4 frames after the column starts to grow,
227 // with a sound for even columns only.
228 n = 0;
229 if (work->effect->count != 0) {
230 reactFrame = start + 4;
231 do {
232 if (frame == reactFrame) {
233 if (!(i & 1)) {
235 }
238 3);
239 }
240 n++;
241 } while (n != work->effect->count);
242 } else {
243 reactFrame = start + 4;
244 }
245
246 // On frames 4 and 8, put the first free puff of dust near the
247 // root: x within 8 pixels of it, y on rows 80 to 95.
248 if ((frame == reactFrame) || (frame == (start + 8))) {
249 /* FAKEMATCH: the scan reuses length as its puff pointer; as a
250 * block pointer of its own, 48 instructions differ in tbs-en. */
251 length = (u32)PARTICLES;
252 n = 0;
253 while (n != 512) {
254 if (((struct EffectStep *)length)->variant == -1) {
255 ((struct EffectStep *)length)->x =
256 ((Random16() & 0xf) + column->x) - 8;
257 ((struct EffectStep *)length)->y = (Random16() & 0xf) + 80;
258 ((struct EffectStep *)length)->variant = 0;
259 break;
260 }
261 length += sizeof(struct EffectStep);
262 n++;
263 }
264 }
265 i++;
266 } while (i != gGrowth_ColumnCounts[work->effect->variant]);
267 }
268 }
269
270 // Dust, after the columns so it is drawn over them; it keeps going
271 // through the last 4 frames.
272 i = 0;
273 puff = PARTICLES;
274 do {
275 puffAge = puff->variant;
276 if (puffAge >= 0) {
277 image = puffAge / 2;
279 if (mode != 0) {
281 }
282 ((DrawRectangle)rectangle[0])(
283 canvas, work->sheet + (gGrowth_PuffCells[image] + puffCells),
284 puff->x - gGrowth_PuffWidths[image],
285 puff->y - (s8)gGrowth_PuffHeights[image] / 2,
287 ((DrawRectangle)rectangle[1])(
288 canvas, work->sheet + (gGrowth_PuffCells[image] + puffCells),
289 puff->x, puff->y - (s8)gGrowth_PuffHeights[image] / 2,
291 puff->variant++;
292 if (puff->variant == 14) {
293 puff->variant = -1;
294 }
295 }
296 puff++;
297 i++;
298 } while (i != 512);
299
300 Camera_ApplyShake(4, 4);
301 EFFECT_END_FRAME(work);
302 frame++;
303 } while (frame != duration);
304 }
306}
307
308#define VINE_COLUMNS 16 ///< columns that rise
309#define VINE_FRAMES 70
310
311/// Rising vines: sixteen green vines grow from the middle of the row of
312/// targets, 2 frames apart, and shrink back.
313///
314/// Abilities: Vine (kind 202).
315///
316/// Vine i appears on frame 2i + 5 and grows 4 pixels a frame up to 32,
317/// cycling through five 32x32 pictures, then shrinks away from frame 2i + 32;
318/// odd vines are mirrored. Vine i shakes the screen on frame 4i + 5. On frame
319/// 32 the targets react together, with a sound.
320///
321/// A Djinni appears first (BattleFx_RunDjinniEntrance). work->particles holds
322/// the 16 vines' x. Writes REG_BG2PA, REG_BLDCNT and REG_BG2X, sets
323/// work->shakeFrames, and ends with the transfer callback removed, the
324/// blitters freed and the canvas layer closed.
326 u32 *slots, *cursor;
327 struct BattleEffectWork *work;
328 void *canvas;
329 BlitterPair draw;
330 s32 originX, originY;
331 struct EffectPosition first, last;
332 s32 i, frame, cell, height, offset, middle;
333 struct EffectStep *column;
334
336 cursor = slots;
337 work = (struct BattleEffectWork *)*cursor++;
338 canvas = (void *)*cursor;
339 work->effect = effect;
340 BattleFx_RunDjinniEntrance(effect, 4, effect->side, 4, &originX, &originY);
342 REG_BG2PA = Q_8_8(1); // the canvas at its own width
343 REG_BLDCNT = 0;
345 1);
346
347 // Put the point halfway between the first and last targets at canvas x
348 // 64.
351 work->effect->actors[work->effect->count - 1], &last);
352 middle = first.x;
353 middle += (last.x - middle) / 2;
354 first.x = middle;
355 REG_BG2X = (64 - first.x) << 8;
363 column = work->particles;
364 i = 0;
365 do {
366 column[i].x = gGrowth_ColumnOffsets[i] + 64;
367 i++;
368 } while (i != VINE_COLUMNS);
369 // Each transfer clears the canvas: the vines are redrawn every frame.
371 frame = 0;
372 do {
373 // No EFFECT_SHOW_DAMAGE here: the targets only flash, on frame 32.
374 if (frame == 32) {
378 POSE_DAMAGE, i, 16);
379 }
380 i = 0;
381 column = work->particles;
382 do {
383 if (frame == i * 4 + 5)
384 work->shakeFrames = 2;
385
386 // Grow 4 pixels a frame up to 32, and shrink from frame i * 2 + 32,
387 // gone by i * 2 + 40. Each vine stands on row 104 + (i & 7) and steps
388 // through the five 32x32 pictures every 4 frames from its own start.
389 offset = i * 2;
390 if (frame > offset + 4) {
391 cell = (frame / 4 + i) % 5;
392 if (frame < offset + 32) {
393 height = (frame - offset) * 4 - 16;
394 if (height > 32)
395 height = 32;
396 } else {
397 height = 160 - (frame - offset) * 4;
398 }
399 if (height > 0)
400 draw[i & 1](canvas, work->sheet + (cell << 10), column->x - 16,
401 (i & 7) - height + 104, 32, height);
402 }
403 i++;
404 column++;
405 } while (i != VINE_COLUMNS);
406 Camera_ApplyShake(4, 4);
407 EFFECT_END_FRAME(work);
408 frame++;
409 } while (frame != VINE_FRAMES);
411}
412
413/// Rising thorns: thorns burst from the ground one every 8 frames, throwing up
414/// dust from their roots.
415///
416/// Abilities: Thorn, Briar, Nettle (kind 5).
417///
418/// Thorn i appears on frame 8i + 9, shaking the screen, and throws up a puff
419/// of dust on each of its first two frames; on frame 8i + 12 the targets
420/// react with a sound. The battle moves on to the results 64 frames before
421/// the end, and the scene fades out over its last 16 frames.
422///
423/// effect: the targets; variant picks the number of thorns
424/// (gGrowth_Counts). gGrowth_Kinds gives each
425/// thorn's size and direction.
426///
427/// PARTICLES holds the dust, 64 puffs. Writes REG_BG2PA, REG_BLDCNT,
428/// REG_BLDALPHA and, on side 1, REG_BG2X; sets work->shakeFrames as each
429/// thorn appears. Ends with the transfer callback removed, the blitters freed
430/// and the canvas layer closed.
432 void *canvas;
433 s32 frame;
434 DrawRectangle drawFlip;
435 DrawRectangle draw;
436 s32 frameCount;
437 u32 *slots;
438 u32 *cursor;
439 struct BattleEffectWork *work;
440 s32 i;
441 s32 j;
442 s32 age;
443 s32 start;
444
446 cursor = slots;
447 work = (struct BattleEffectWork *)*cursor++;
448 canvas = (void *)*cursor;
449 work->effect = effect;
451 REG_BG2PA = Q_8_8(1); // the canvas at its own width
452 REG_BLDCNT = 0;
453 REG_BLDALPHA = BLEND_ALPHA(16, 16);
455 if (work->effect->side == 1) {
456 REG_BG2X = -0x7000; // 112 pixels right
457 }
464 work->transferMode = CANVAS_COPY_AND_CLEAR; // clear the canvas every frame
465 work->transferValue = 0;
466 drawFlip = ((DrawRectangle *)
470 frameCount = gGrowth_Counts[work->effect->variant] * 8 + 56;
471
472 // Mark the dust free: 1024 records, though only the first 64 are used.
473 for (i = 0; i != 1024; i++) {
474 PARTICLES[i].variant = -1;
475 }
476
477 for (frame = 0; frame != frameCount; frame++) {
478 if (frame == frameCount - 64) {
480 }
481 if (frame >= frameCount - 16) {
482 // Fade out over the last 16 frames, the canvas's share falling from
483 // 15/16 to nothing.
485 REG_BLDALPHA = BLEND_ALPHA(frameCount - frame - 1, 16);
486 }
487
488 for (i = 0; i != gGrowth_Counts[work->effect->variant]; i++) {
489 start = i * 8 + 8;
490 age = frame - (i * 8 + 8);
491 if (frame > start) {
492 s32 height;
493 s32 lean;
494
495 // Kinds 0 and 1 are big thorns (48 wide), 2 and 3 small ones (32 wide);
496 // odd kinds are mirrored. A thorn leans sideways as it grows: a big
497 // one 16 pixels up and 6 across a frame to 80 and 30, a small one 8
498 // up and 1 across to 64 and 8. Both stand on row 108.
499 if (gGrowth_Kinds[i] < 2) {
500 height = age * 16;
501 lean = age * 6;
502 if (height > 80) {
503 height = 80;
504 }
505 if (lean > 30) {
506 lean = 30;
507 }
508 if (gGrowth_Kinds[i] & 1) {
509 drawFlip(canvas, work->sheet, gGrowth_X[i] - lean, 108 - height, 48,
510 height);
511 } else {
512 draw(canvas, work->sheet, gGrowth_X[i] + lean, 108 - height, 48,
513 height);
514 }
515 } else {
516 height = age * 8;
517 lean = age;
518 if (height > 64) {
519 height = 64;
520 }
521 if (age > 8) {
522 lean = 8;
523 }
524 if (gGrowth_Kinds[i] & 1) {
525 drawFlip(canvas, work->sheet + THORN_SMALL_CELLS,
526 gGrowth_X[i] - lean, 108 - height, 32, height);
527 } else {
528 draw(canvas, work->sheet + THORN_SMALL_CELLS, gGrowth_X[i] + lean,
529 108 - height, 32, height);
530 }
531 }
532 if (frame == start + 1) {
533 work->shakeFrames = 3;
534 }
535
536 // For 2 frames after the thorn appears, add a puff of dust each frame
537 // in the first free slot: 32 to 63 pixels right of the thorn's x, no
538 // further than 96, on rows 72 to 103.
539 if (frame < start + 3) {
540 s32 y = (Random16() & 31) + 72;
541 struct EffectStep *puff;
542 for (j = 0; j != 64; j++) {
543 puff = &PARTICLES[j];
544 if (puff->variant == -1) {
545 puff->x = gGrowth_X[i] + (Random16() & 31) + 32;
546 if (puff->x > 96) {
547 puff->x = 96;
548 }
549 puff->y = y;
550 puff->variant = 0;
551 break;
552 }
553 }
554 }
555 }
557 if (frame == start + 4) {
560 POSE_DAMAGE, j, 3);
561 }
562 }
563 }
564
565 // Dust, drawn over the thorns.
566 for (i = 0; i != 64; i++) {
567 if (PARTICLES[i].variant >= 0) {
568 s32 cell = PARTICLES[i].variant / 2;
569 draw(canvas, work->sheet + gGrowth_ThornPuffCells[cell],
571 PARTICLES[i].y - (s8)gGrowth_ThornPuffHeights[cell] / 2,
573 drawFlip(
574 canvas, work->sheet + gGrowth_ThornPuffCells[cell], PARTICLES[i].x,
575 PARTICLES[i].y - (s8)gGrowth_ThornPuffHeights[cell] / 2,
577 if (++PARTICLES[i].variant == 14) {
578 PARTICLES[i].variant = -1;
579 }
580 }
581 }
582 Camera_ApplyShake(8, 8);
583 EFFECT_END_FRAME(work);
584 }
585
587}
588
589#undef GROWING_COLUMNS_VINE_DUST_CELLS
590#undef GROWING_COLUMNS_PILLAR_DUST_CELLS
591#undef THORN_SMALL_CELLS
592#undef VINE_COLUMNS
593#undef VINE_FRAMES
@ SPRITE_COLOR_WHITE
solid colour 15, white
Definition animspr.h:26
@ POSE_DAMAGE
taking damage
Definition battle.h:176
@ COMPOSITE_FLIP_X
@ COMPOSITE_TRANSPARENT
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...
Definition canvas.c:103
void BattleFx_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
Definition canvas.c:314
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.
Definition dispatch.c:254
#define GROWING_COLUMNS_VINE_DUST_CELLS
The dust pictures in the vine sheet, after the vines.
Definition growth.c:15
void BattleFx_RunVine(struct BattleEffectArgument *effect)
Rising vines: sixteen green vines grow from the middle of the row of targets, 2 frames apart,...
Definition growth.c:325
void BattleFx_RunThorn(struct BattleEffectArgument *effect)
Rising thorns: thorns burst from the ground one every 8 frames, throwing up dust from their roots.
Definition growth.c:431
#define GROWING_COLUMNS_PILLAR_DUST_CELLS
The dust pictures in the pillar sheet, after the pillars.
Definition growth.c:17
#define VINE_COLUMNS
columns that rise
Definition growth.c:308
#define THORN_SMALL_CELLS
The small thorn in the thorn sheet, after the 48x80 big one.
Definition growth.c:19
void BattleFx_RunPunji(struct BattleEffectArgument *effect)
Grows green pillars from the ground, scattering dust from each root.
Definition growth.c:42
void BattleFx_RunGrowingColumns(struct BattleEffectArgument *effect, s32 mode)
Vines (mode 0) or green pillars (mode 1) grow one every 4 frames, alternately mirrored,...
Definition growth.c:63
#define VINE_FRAMES
Definition growth.c:309
void BattleFx_RunGrowth(struct BattleEffectArgument *effect)
Grows vines from the ground, scattering dust from each root.
Definition growth.c:36
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...
u16 gGrowth_PuffCells[]
u8 gGrowth_VineWidths[]
s8 gGrowth_PuffWidths[]
u8 gGrowth_HeightLimits[]
u16 gGrowth_ThornPuffCells[]
s8 gGrowth_ColumnOffsets[]
Each vine's root, across from the middle of the targets.
s8 gGrowth_X[]
u8 gGrowth_Counts[]
Thorns by variant.
u8 gGrowth_ThornPuffHeights[]
u8 gGrowth_Kinds[]
u8 gGrowth_PuffHeights[]
u8 gGrowth_ColumnX[]
s8 gGrowth_PillarHeights[]
u16 gGrowth_VineCells[]
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 ...
Definition hail.c:364
@ HEAP_SLOT_BATTLE_EFFECT
Definition heap_state.h:42
@ HEAP_SLOT_BLITTER_ALTERNATE
Definition heap_state.h:47
@ HEAP_SLOT_BLITTER
Definition heap_state.h:46
#define Q_8_8(n)
The BG2/BG3 affine matrix entries are signed 8.8 fixed point: texels stepped per screen pixel.
Definition io_reg.h:59
#define BLDCNT_TGT1_BG2
Definition io_reg.h:125
#define REG_BG2X
Definition io_reg.h:65
#define BLDCNT_EFFECT_BLEND
weighted by REG_BLDALPHA
Definition io_reg.h:131
#define BLDCNT_TGT2_ALL
Definition io_reg.h:140
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
Definition io_reg.h:145
#define REG_BLDALPHA
Definition io_reg.h:142
#define REG_BG2PA
Definition io_reg.h:61
#define REG_BLDCNT
Definition io_reg.h:119
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
Definition math.c:10
void EffectPosition_ProjectScaledBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, scaled for the battle view, 16 pixels higher.
Definition positions.c:88
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...
Definition projectiles.c:29
#define Ram_MapCellBuffer
Definition ram_buffer.h:10
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...
Definition scheduler.c:102
#define SE_133
Definition songs.h:126
#define SE_143
Definition songs.h:136
#define SE_132
Definition songs.h:125
void * gWorkSlot[]
#define offsetof(type, member)
Definition stddef.h:19
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.
Definition growth.c:22
s32 velocityX
Definition growth.c:26
s32 x
the root, in canvas pixels
Definition growth.c:23
s32 velocityZ
the EffectStep's, unused here
Definition growth.c:28
s32 y
the root's row: 108 to 115, lower for later columns
Definition growth.c:24
s32 z
the EffectStep's z and velocityX, unused here
Definition growth.c:25
s32 start
The frame it starts to grow; set, but the frame loop computes its own.
Definition growth.c:30
s32 height
the full length, 55 to 118 capped by its shape
Definition growth.c:27
A point projected onto the screen, with its depth.
Definition effect_step.h:46
s32 x
screen pixels
Definition effect_step.h:58
A moving point of an effect: its position, its velocity and a value each effect uses its own way (a s...
Definition effect_step.h:13
s32 variant
each effect's own: a size, a countdown, -1 for idle
Definition effect_step.h:31
s32 x
16.16 fixed-point pixels
Definition effect_step.h:24
s32 y
16.16 fixed-point pixels
Definition effect_step.h:25
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed char s8
Definition types.h:10
unsigned char u8
Definition types.h:11
#define EFFECT_CLIP_BOUNDS
Clips overflow on all four sides.
Definition effect.h:224
#define PARTICLES
The map cell buffer (gMapCellBuffer), which the effects borrow, has two views here: Ram_MapCellBuffer...
Definition effect.h:221
DrawRectangle BlitterPair[2]
A blitter pair: [0] built in HEAP_SLOT_BLITTER and [1] in HEAP_SLOT_BLITTER_ALTERNATE (BattleFx_Fetch...
Definition effect.h:244