Alchemy
Loading...
Searching...
No Matches

cybele.c

Go to the documentation of this file.
1/// @file
2/// The Cybele summon.
3/// Part of effect.c, the battle effect object, compiled only through it.
4
6
7// Cybele reuses work->particles over the scene:
8// - 0 to 15: vines (only the first ten are drawn).
9// - 32 to 47: thorns, until frame 127.
10// - 16 to 63: chips, thrown on frame 128 (only 32 to 63 are drawn); from
11// frame 128 the sparks, six per target from 16 on, share these slots.
12// - 0 on: embers, ten per target, from frame 302.
13#define CYBELE_FRAMES 366
14#define CYBELE_CHIP_COUNT 48 ///< chips thrown by the thorns
15#define CYBELE_VINES 10 ///< vines drawn
16#define CYBELE_BLAST_CELLS 0x1680 ///< the blast pictures, after the yellow ring
17#define CYBELE_FIRST_SPARK 16 ///< the first spark in work->particles
18#define CYBELE_FIRST_THORN 32 ///< the first thorn in work->particles
19#define CYBELE_FIRST_CHIP 16 ///< the first chip in work->particles
20#define CYBELE_EMBER_CELL 6 ///< the ember picture in gCybele_EmberOffsets
21
22/// Thorn vines: thorns fly in from the right, vines grow out of the ground and
23/// lift the targets while sparks flash around them, the picture dissolves pixel
24/// by pixel, and the targets drop and explode.
25///
26/// Abilities: Cybele (scene kind 5).
27///
28/// 366 frames:
29///
30/// - 0 to 127: the formation objects drop in, landing on frame 31; from 72
31/// a thorn flies in from the right each frame.
32/// - 128 to 224: vines grow out of the ground, shaking the screen, while
33/// chips fly; sparks flash around the targets, which rise from 161.
34/// - 224 to 247: the first 64 background colours fade to grey.
35/// - 233 on: the canvas dissolves from the top, two rows a frame.
36/// - 286 on: the targets drop, 5 frames apart.
37/// - 302 on: each target is hit 16 frames after it drops and bursts into a
38/// blast and embers.
39///
40/// Pressing A or B between frames 191 and 285 skips to the drop. At the end
41/// the battle shows the damage and an impact burst (BattleFx_RunImpactBurst)
42/// explodes at the formation.
43///
44/// Besides the canvas and work->particles (above), it writes the dissolve
45/// order into the first 1024 bytes of Ram_MapCellBuffer, greys the first 64
46/// background colours, lifts and drops the targets' objects (their y and
47/// gravity), and sets REG_BG2X, REG_BG2PA, REG_BLDCNT and work->shakeFrames.
48/// It spawns eight formation objects and releases them, the transfer callback
49/// and the blitters before it closes the canvas layer.
51 void **cursor;
52 struct BattleEffectWork *work;
53 u8 *canvas;
54 s32 frame;
55 s32 height;
56 s32 speed;
57 s32 phase;
58 s32 rise;
59 s32 i;
60 s32 j;
61 u8 *order;
62 s32 point[3];
63 struct EffectPosition screen;
64 BlitterPair draw;
65
66 cursor = gBattleFxWork;
67 EFFECT_GET_WORK_AND_CANVAS(cursor, work, canvas);
68 work->effect = effect;
69 BattleFx_SpawnObjects(8, 0x177, 1);
70
71 // Setup. The dissolve order: eight shuffled runs of the columns 0 to 127,
72 // each shuffled by 128 random swaps.
73 order = Ram_MapCellBuffer;
74 for (i = 0; i != 1024; i++)
75 order[i] = i & 127;
76 for (i = 0; i != 8; i++) {
77 for (j = 0; j != 128; j++) {
78 s32 a = Random16() & 127;
79 s32 b = Random16() & 127;
80 u8 *to = &order[i * 128 + b];
81 u8 *from = &order[i * 128 + a];
82 u8 t = *to;
83
84 *to = *from;
85 *from = t;
86 }
87 }
88
90 REG_BLDCNT = 0;
92 1);
101 REG_BG2X = -0x2000; // 32 pixels left (20.8 fixed point)
102
103 // Vines (0 to 15): x, the y of the root, the growth speed and the frames
104 // before the vine starts to grow.
105 for (i = 0; i != 16; i++) {
106 struct EffectStep *vine = &work->particles[i];
107
108 if (i <= 4) {
109 vine->x = i * 20;
110 vine->y = (Random16() & 7) + 104;
111 } else {
112 vine->x = i * 20 - 90;
113 vine->y = (Random16() & 7) + 108;
114 }
115 vine->velocityY = (Random16() & 7) + 4;
116 vine->variant = (Random16() & 15) + 16;
117 }
118 // Sparks (16 to 31): a negative variant is the wait before one appears.
119 for (i = 0; i != 16; i++) {
120 struct EffectStep *spark = &work->particles[CYBELE_FIRST_SPARK + i];
121
122 spark->x = (Random16() & 63) + 32;
123 spark->y = (Random16() & 31) + 64;
124 spark->variant = -(Random16() & 7) - 8;
125 }
126 // Thorns (32 to 47): fly left from the top right.
127 for (i = 0; i != 16; i++) {
128 struct EffectStep *thorn = &work->particles[CYBELE_FIRST_THORN + i];
129
130 thorn->x = 128 << 16;
131 thorn->y = 64 << 16;
132 thorn->velocityX = -((Random16() & 255) + 200) << 9;
133 thorn->velocityY = 0;
134 thorn->variant = 0;
135 }
137
138 height = -(64 << 16);
139 speed = 0;
140 for (frame = 0; frame != CYBELE_FRAMES; frame++) {
141 struct BattleCamera *camera = gCameraWork;
142
143 // A or B skips the vines straight to the drop.
144 if ((gKeysRepeat & (KEY_A | KEY_B)) != 0 && frame > 190 && frame <= 285) {
146 frame = 286;
147 }
148 // From frame 224 the canvas keeps what is drawn, so the picture holds
149 // while it greys and dissolves.
150 if (frame == 224)
153 // Frame 31: the formation lands; the screen shakes and the targets
154 // flinch.
155 if (frame == 31) {
156 work->shakeFrames = 8;
160 }
161 if (frame == 72)
163 if (frame == 140)
165
166 // Drop the formation objects to a height of 64 pixels, and from frame
167 // 48 to 96 wave objects 3 and 4 through three poses.
168 speed += 0x4000;
169 height += speed;
170 if (height > 64 << 16)
171 height = 64 << 16;
172 BattleFx_PlaceFormationObjects(2, 128 << 16, height);
173 if (frame >= 48 && frame <= 96) {
174 s32 pose = (frame - 48) / 24 % 3;
175
180 }
181
182 // Frames 72 to 127: thorn i flies from frame 72 + i until it reaches
183 // the ground at y 104, its picture changing every 4 frames.
184 if (frame >= 72 && frame <= 127) {
185 for (i = 0; i != 16; i++) {
186 struct EffectStep *thorn = &work->particles[CYBELE_FIRST_THORN + i];
187
188 if (frame >= i + 72 && thorn->y < (104 << 16)) {
189 s32 cellIndex = (frame + i) / 4 % 5;
190 s32 x = Q_16_16_TO_INT(thorn->x);
191 s32 y = thorn->y >> 16;
192 u8 *cell = work->sheet + gCybele_ThornOffsets[cellIndex];
193 u32 width = gCybele_ThornWidths[cellIndex];
194 u32 tall;
195
196 x -= width >> 1;
197 tall = gCybele_ThornHeights[cellIndex];
198 y -= tall >> 1;
199 draw[0](canvas, cell, x, y, width, tall);
200 EffectStep_AdvanceWithGravity2D(thorn, 64, 0x1000);
201 }
202 }
203 }
204 // Frame 128: throw the chips (16 to 63) up from the ground, each
205 // waiting 16 to 31 frames to appear, and undo the canvas's 32-pixel
206 // shift.
207 if (frame == 128) {
208 for (i = 0; i != CYBELE_CHIP_COUNT; i++) {
209 struct EffectStep *chip = &work->particles[CYBELE_FIRST_CHIP + i];
210
211 chip->x = (Random16() % 96) << 16;
212 chip->y = ((Random16() & 7) + 88) << 16;
213 chip->velocityX = ((Random16() & 255) - 128) << 11;
214 chip->velocityY = -(Random16() & 255) << 11;
215 chip->variant = -(Random16() & 15) - 16;
216 }
217 REG_BG2X = 0;
218 }
219
220 // Frames 128 to 224: grow the vines, shaking the screen while they
221 // grow. A vine is a 24x8 tip on a stem of three 24x64 pieces; its
222 // height wraps every 64 pixels past 184, so a grown vine keeps its
223 // length. Odd vines are mirrored and carry a leaf; vines 6 to 9 use the
224 // second stem picture.
225 phase = frame - 128;
226 if (phase >= 0 && phase <= 96) {
227 rise = phase;
228 if (rise > 80)
229 rise = 80;
230 else
231 work->shakeFrames = 2;
232 for (i = 0; i != CYBELE_VINES; i++) {
233 struct EffectStep *vine = &work->particles[i];
234
235 if (rise > vine->variant) {
236 u8 *sheet = work->sheet;
237 s32 top;
238 s32 wrap;
239 s32 k;
240
241 // The second picture follows the first's tip and stem.
242 if (i > 5)
243 sheet = work->sheet + 24 * (8 + 64);
244 // velocityY is the vine's growth in pixels a frame, variant its
245 // delay.
246 top = (rise - vine->variant) * vine->velocityY;
247 for (wrap = top; wrap > 184; wrap -= 64)
248 ;
249 // The tip (24x8).
250 if (wrap <= 119)
251 draw[i & 1](canvas, sheet, vine->x, vine->y - wrap - 8, 24, 8);
252 // The stem: three 24x64 pieces, clipped at the top of the screen and
253 // at the root.
254 for (k = 0; k != 3; k++) {
255 s32 y = vine->y - wrap + k * 64;
256 s32 skip = 0;
257 s32 rows = 64;
258
259 if (y >= -64) {
260 if (y < 0) {
261 skip = -y * 24;
262 rows = y + 64;
263 y = 0;
264 }
265 if (y + rows > vine->y)
266 rows -= y + rows - vine->y;
267 draw[i & 1](canvas, sheet + skip + 192, vine->x, y, 24, rows);
268 }
269 }
270 // A leaf, on the odd vines only.
271 if ((i & 1) != 0) {
272 s32 y = ((vine->y - top) & 127) - 16;
273 s32 kind = i % 3;
274 s32 full = gCybele_LeafSizes[kind];
275 s32 rows = full;
276
277 if (y + rows > vine->y)
278 rows -= y + rows - vine->y;
279 if (rows > 0)
280 draw[i & 1](canvas, work->sheet + gCybele_LeafOffsets[kind],
281 vine->x + 8, y, full, rows);
282 }
283 }
284 }
285 }
286 // Chips: until frame 159, one that leaves the screen is thrown up again.
287 if (phase >= 0 && phase <= 95) {
288 for (i = 0; i != 32; i++) {
289 struct EffectStep *chip = &work->particles[32 + i];
290
291 if (chip->variant >= 0) {
292 s32 cellIndex = i % 5;
293
294 draw[0](canvas, work->sheet + gCybele_ChipOffsets[cellIndex],
295 Q_16_16_TO_INT(chip->x), Q_16_16_TO_INT(chip->y),
296 gCybele_ChipWidths[cellIndex],
297 gCybele_ChipHeights[cellIndex]);
298 chip->x += chip->velocityX;
299 chip->y += chip->velocityY;
300 chip->velocityY += 0x4000;
301 if ((chip->y < 0 || chip->y > 120 << 16) && frame <= 159) {
302 chip->x = (Random16() % 96) << 16;
303 chip->y = ((Random16() & 7) + 88) << 16;
304 chip->velocityX = ((Random16() & 255) - 128) << 11;
305 chip->velocityY = -(Random16() & 255) << 11;
306 }
307 }
308 chip->variant++;
309 }
310 }
311
312 // Every 4 frames, move the 64 background colours one step towards grey.
313 if (frame >= 224 && frame <= 247 && (frame & 3) == 0) {
314 u16 *color = (u16 *)BG_PLTT;
315
316 for (i = 0; i != 64; i++) {
317 s32 red = *color & 31;
318 s32 green = (*color >> 5) & 31;
319 s32 blue = (*color >> 10) & 31;
320 s32 grey = (red + green + blue) / 3;
321
322 if (red > grey)
323 red--;
324 if (red < grey)
325 red++;
326 if (green > grey)
327 green--;
328 if (green < grey)
329 green++;
330 if (blue > grey)
331 blue--;
332 if (blue < grey)
333 blue++;
334 *color++ = RGB(red, green, blue);
335 }
336 }
337
338 // Frames 128 to 300: six sparks keep flashing around each target's
339 // body. Each lasts five frames, then until frame 199 waits up to 7
340 // frames and flashes somewhere else.
341 if (phase >= 0 && phase <= 172) {
343 struct MotionObject *object =
345
346 SET_VECTOR(point, object->x, object->y, object->z);
347 EffectPosition_ProjectPoint(point, &screen);
348 for (j = 0; j != 6; j++) {
349 struct EffectStep *spark =
350 &work->particles[CYBELE_FIRST_SPARK + i * 6 + j];
351
352 if (spark->variant == 0) {
353 spark->x = screen.x + (Random16() & 15) - 8;
354 spark->y = screen.y + (Random16() & 15) - 40;
355 }
356 if (spark->variant >= 0 && spark->variant <= 4) {
357 u8 *cell = work->sheet + gCybele_SparkOffsets[spark->variant];
358 u32 size = gCybele_SparkSizes[spark->variant];
359 u32 half = size >> 1;
360
361 draw[0](canvas, cell, spark->x - half, spark->y - half, size, size);
362 }
363 spark->variant++;
364 if (frame <= 199 && spark->variant == 5)
365 spark->variant = -(Random16() & 7);
366 }
367 }
368 }
369
370 // Dissolve the 128x128 canvas from the top, two rows a frame, clearing
371 // the pixels in the shuffled order: each row loses four pixels at a
372 // time over 16 frames, its columns taken from run y & 7 of the order.
373 if (frame > 232) {
374 s32 row = frame * 2 - 496;
375
376 for (i = 0; i != 32; i++) {
377 for (j = 0; j != 4; j++) {
378 s32 y = row + i;
379
380 if (y >= 0 && y <= 127) {
381 s32 x = order[((y & 7) * 32 + i) * 4 + j];
382
383 canvas[((y / 8 * 16 + x / 8) * 8 + (y & 7)) * 8 + (x & 7)] = 0;
384 }
385 }
386 }
387 row++;
388 for (i = 0; i != 32; i++) {
389 for (j = 0; j != 4; j++) {
390 s32 y = row + i;
391
392 if (y >= 0 && y <= 127) {
393 s32 x = order[((y & 7) * 32 + i) * 4 + j];
394
395 canvas[((y / 8 * 16 + x / 8) * 8 + (y & 7)) * 8 + (x & 7)] = 0;
396 }
397 }
398 }
399 }
400
401 // Lift the targets to a height of 128 pixels, 8 frames apart.
402 if (frame >= 161 && frame <= 223) {
404 if (frame > i * 8 + 160) {
405 struct BattleObj *slot =
407 struct MotionObject *object = slot->object;
408 void *record;
409 s32 n;
410
411 object->y += 8 << 16;
412 if (object->y > 128 << 16)
413 object->y = 128 << 16;
414 object->verticalMotionStrength = 0;
415 for (n = 0; (record = GetMotionRecordFar(slot->object, n)) != 0; n++)
417 }
418 }
419 }
420 // Drop the targets from 96 pixels, 5 frames apart, and hit each one 16
421 // frames later.
423 if (frame == i * 5 + 286) {
424 struct MotionObject *object =
426
427 // 0xab85 is the battle units' usual gravity, which the lift
428 // cleared (battle/motion.c sets the same).
429 object->y = 96 << 16;
430 object->verticalMotionStrength = 0xab85;
431 }
432 if (frame == i * 5 + 302) {
434 -1, i, 8);
436 work->shakeFrames = 8;
437 }
438 }
439
440 // Frame 302: switch to the blast sheet, brightest-wins blitters and a
441 // canvas that keeps 75% of each frame, and give each target ten
442 // embers, 72 degrees apart (two rings of five).
443 if (frame == 302) {
446 1, 0);
448 work->sheet + CYBELE_BLAST_CELLS, 1, 1);
456 REG_BG2PA = Q_8_8(0.5);
457 REG_BG2X = 0;
460 struct MotionObject *object =
462
463 for (j = 0; j != 10; j++) {
464 struct EffectStep *ember = &work->particles[i * 10 + j];
465
466 SET_POSITION(ember, object->x, 20 << 16, object->z);
467 SET_VELOCITY(ember, (Trig_Sin(j * 0x3334) * 4),
468 (Random16() & 0x7fff) + (1 << 16),
469 (Trig_Cos(j * 0x3334) * 4));
470 ember->variant = 0;
471 }
472 }
473 }
474 // Target i's blast plays from frame 302 + 4i: six 40x24 pictures, two
475 // frames each, drawn as two mirrored halves. Six frames in, the first
476 // five of its embers fly out and fall for 27 frames. The canvas is now
477 // shown at twice its width, so x positions are halved.
478 if (frame > 301) {
480 s32 start = i * 4 + 302;
481
482 if (frame >= start && frame < i * 4 + 314) {
483 s32 cellIndex = (frame - start) / 2;
484 struct MotionObject *object =
486
487 SET_VECTOR(point, object->x, 0, object->z);
488 EffectPosition_ProjectPoint(point, &screen);
489 screen.x >>= 1;
490 draw[0](canvas, work->sheet + cellIndex * (20 * 24), screen.x - 20,
491 screen.y - 24, 20, 24);
492 draw[1](canvas, work->sheet + cellIndex * (20 * 24), screen.x,
493 screen.y - 24, 20, 24);
494 }
495 if (frame >= start + 6) {
496 for (j = 0; j != 5; j++) {
497 struct EffectStep *ember = &work->particles[i * 10 + j];
498
499 EffectPosition_ProjectPoint(&ember->x, &screen);
500 screen.x >>= 1;
501 if (ember->variant >= 0 && ember->variant <= 26) {
502 s32 cellIndex = CYBELE_EMBER_CELL;
503 s32 offset = gCybele_EmberOffsets[cellIndex];
504 u32 size = gCybele_EmberSizes[cellIndex];
505
506 draw[0](canvas, work->sheet + offset, screen.x - (size >> 1),
507 screen.y - (size >> 1), size, size);
508 }
509 EffectStep_AdvanceWithGravity2D(ember, 60, 0x1000);
510 ember->variant++;
511 }
512 }
513 }
514 }
515
516 // The camera shake, by phase: the formation and thorns, the vines and
517 // the dissolve, the blasts.
518 if (frame <= 127)
519 Camera_ApplyShake(4, 16);
520 else if (frame <= 301)
521 Camera_ApplyShake(2, 2);
522 else
523 Camera_ApplyShake(4, 8);
524 EFFECT_END_FRAME(work);
525 }
526
527 // The end: the impact burst builds its own blitters and starts its own
528 // transfer, so the scene's are released first.
532 BattleFx_RunImpactBurst(2, 128 << 16, height);
533 for (i = 0; i != 8; i++)
536}
537
538#undef CYBELE_FRAMES
539#undef CYBELE_CHIP_COUNT
540#undef CYBELE_VINES
541#undef CYBELE_FIRST_SPARK
542#undef CYBELE_FIRST_THORN
543#undef CYBELE_FIRST_CHIP
544#undef CYBELE_EMBER_CELL
545#undef CYBELE_BLAST_CELLS
@ SPRITE_COLOR_WHITE
solid colour 15, white
Definition animspr.h:26
void * gBattleFxWork[]
struct BattleCamera * gCameraWork
@ COMPOSITE_FLIP_X
@ COMPOSITE_TRANSPARENT
@ COMPOSITE_MAX
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_EndCanvasLayer(void)
Closes the canvas layer: plays the closing sound, restores BG1's scroll and the projection centre,...
Definition canvas.c:490
#define CYBELE_FIRST_SPARK
the first spark in work->particles
Definition cybele.c:17
void BattleFx_RunCybele(struct BattleEffectArgument *effect)
Thorn vines: thorns fly in from the right, vines grow out of the ground and lift the targets while sp...
Definition cybele.c:50
#define CYBELE_CHIP_COUNT
chips thrown by the thorns
Definition cybele.c:14
#define CYBELE_BLAST_CELLS
the blast pictures, after the yellow ring
Definition cybele.c:16
#define CYBELE_EMBER_CELL
the ember picture in gCybele_EmberOffsets
Definition cybele.c:20
#define CYBELE_FIRST_CHIP
the first chip in work->particles
Definition cybele.c:19
#define CYBELE_FRAMES
Definition cybele.c:13
#define CYBELE_FIRST_THORN
the first thorn in work->particles
Definition cybele.c:18
#define CYBELE_VINES
vines drawn
Definition cybele.c:15
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
void BattleFx_SelectLivingTargets(struct BattleEffectArgument *effect)
Shows the battle objects of every unit with HP left on the targets' side: the enemies (units 128 to 1...
Definition dispatch.c:184
What every part of the battle effect object shares: its includes, macros and frame-loop helpers.
#define EFFECT_RELEASE_BLITTERS()
Frees the two blitters, the alternate first.
@ CANVAS_COPY
copy as drawn
@ CANVAS_COPY_AND_CLEAR
copy, then fill the canvas with transferValue
@ CANVAS_COPY_AND_FADE
copy, keeping 50% or 75% (transferValue) of each pixel in the canvas for the next frame
#define EFFECT_GET_WORK_AND_CANVAS(cursor, work, canvas)
The work block and canvas occupy adjacent slots, starting at HEAP_SLOT_BATTLE_EFFECT.
#define CANVAS_BYTES
The canvas: 128x128 pixels, one byte each, in its heap slot and in VRAM at BG_CHAR_BLOCK(1).
#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_END_FRAME(work)
The usual end of an effect frame: counts down the targets' flash timers (ObjectGroup_TickMemberTimers...
#define EFFECT_VIEW_FROM_CAMERA(camera)
Starts a frame's 3D projection from the battle camera: resets the transform, then looks from camera->...
#define EFFECT_BEGIN_NARROW_CANVAS(bgControl)
Opens the canvas layer at the canvas's own width, one texel per pixel, where BattleFx_BeginCanvasLaye...
u16 gCybele_ThornOffsets[]
u8 gCybele_ThornHeights[]
u8 gCybele_ChipHeights[]
u16 gCybele_ChipOffsets[]
u8 gCybele_ThornWidths[]
u16 gCybele_EmberSizes[]
u8 gCybele_ChipWidths[]
u16 gCybele_LeafOffsets[]
u8 gCybele_LeafSizes[]
u8 gCybele_ObjectPoses[][2]
Poses of objects 3 and 4 while they wave, three pairs.
u8 gCybele_SparkSizes[]
u16 gCybele_SparkOffsets[]
u16 gCybele_EmberOffsets[]
@ CYBELE_POSE_OBJECT4
object 4's animation
@ CYBELE_POSE_OBJECT3
object 3's animation
void BattleFx_SpawnObjects(s32 entryCount, s32 source, u32 priority)
Creates the effect's animation objects in gBattleFxWork's objects.
Definition eruption.c:220
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
void BattleMotion_ApplyVariantMotionFar(s32 id, s32 variant)
void * GetMotionRecordFar(struct MotionObject *object, s32 record_index)
s32 AnimationObjects_SelectAnimationFar(struct AnimationObject *state, s32 flags)
void ResourceObject_ReleaseFar(struct AnimationObject *sprite)
void AudioCommand_PlayFar(s32 id)
s32 Trig_Cos(s32 angle)
s32 Trig_Sin(s32 angle)
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_BLITTER_ALTERNATE
Definition heap_state.h:47
@ HEAP_SLOT_BLITTER
Definition heap_state.h:46
void BattleFx_RunImpactBurst(s32 formation, s32 x, s32 y)
Opens an impact flash and scatters sparks and fragments, keeping the effect's objects in formation fo...
void BattleFx_PlaceFormationObjects(s32 formation, s32 x, s32 z)
Arranges work->objects in a formation; x and z are its origin in 16.16 pixels.
#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 RGB(r, g, b)
A 15-bit colour from its red, green and blue levels (0 to 31 each), as the palette stores it: blue in...
Definition io_reg.h:164
#define BLDCNT_TGT1_BG2
Definition io_reg.h:125
@ KEY_B
Definition io_reg.h:244
@ KEY_A
Definition io_reg.h:243
#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 BLDCNT_TGT1_BG1
Definition io_reg.h:124
#define BG_PLTT
Definition io_reg.h:157
#define REG_BG2PA
Definition io_reg.h:61
#define REG_BLDCNT
Definition io_reg.h:119
static s32 Iwram_ClearWords(void *destination, s32 size)
Definition iwram_call.h:55
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
#define SET_VELOCITY(p, vx, vy, vz)
Definition macros.h:18
#define SET_POSITION(p, px, py, pz)
Sets the position or the velocity of a particle, a piece of debris or an object in one statement.
Definition macros.h:16
#define SET_VECTOR(v, x, y, z)
Sets the x, y and z of a three-part vector: a position about to be projected, a per-frame step,...
Definition macros.h:12
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
Definition math.c:10
void EffectStep_AdvanceWithGravity2D(struct EffectStep *step, s32 damping, s32 gravity)
Moves a particle one frame on the screen: adds its velocity, then gravity to its vertical speed,...
Definition positions.c:46
s32 EffectPosition_ProjectPoint(const void *point, struct EffectPosition *position)
Projects a point in the current transform onto the screen, 16 pixels higher, and returns the projecti...
Definition positions.c:64
#define Ram_MapCellBuffer
Definition ram_buffer.h:10
char ResourceId_ThornVineSheet
char ResourceId_BlastSheet
char ResourceId_YellowRingSheet
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
Definition scheduler.c:146
#define SE_156
Definition songs.h:151
#define SE_GATE_MOVE
Definition songs.h:152
#define SE_136
Definition songs.h:129
#define SE_HEAVY_IMPACT
Definition songs.h:127
void * gWorkSlot[]
The battle camera: its eye, the focus it turns about, and its pitch, yaw and distance.
The command shared by an effect's caller, dispatcher and handlers.
s16 actors[8]
the targets' unit ids, count of them
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
struct AnimationObject * objects[16]
the effect's animation objects
s32 transferMode
How the canvas transfer callbacks treat the canvas after each copy (enum CanvasTransferMode in effect...
struct BattleEffectArgument * effect
the command being run
struct EffectStep particles[64]
free while variant is -1
A unit's place on the battlefield: its sprite object, resources and animations, its anchor spot and s...
struct MotionObject * object
NULL once released.
A point projected onto the screen, with its depth.
Definition effect_step.h:46
s32 y
screen pixels
Definition effect_step.h:59
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 velocityX
16.16 fixed-point pixels per frame
Definition effect_step.h:28
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
s32 velocityY
16.16 fixed-point pixels per frame
Definition effect_step.h:29
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
Definition motobj.h:20
s32 z
16.16 fixed-point pixels
Definition motobj.h:25
s32 y
16.16 fixed-point pixels
Definition motobj.h:24
s32 x
16.16 fixed-point pixels
Definition motobj.h:23
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
#define EFFECT_CLIP_BOUNDS
Clips overflow on all four sides.
Definition effect.h:224
#define Q_16_16_TO_INT(v)
Definition effect.h:231
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