Alchemy
Loading...
Searching...
No Matches

target_motes.c

Go to the documentation of this file.
1/// @file
2/// Status motes: Taint, Delude, Paralyze, Sleep, Curse ....
3/// Part of effect.c, the battle effect object, compiled only through it.
4
6
7// Swirling motes around each target, in eight styles of one runner,
8// BattleFx_RunTargetMotes. Each mote cycles through six images, 4 frames
9// each, and then starts again: a closing mote where it is, a rising one at a
10// new random point below.
11//
12// The motes live in PARTICLES, 64 slots for each target, of which the first
13// 16, 24 or 32 are drawn; their variant counts the frames of the current
14// image cycle. The bouncing sheep (Sleep) that follow keep theirs in
15// PARTICLES too, and the flames of Curse in work->particles.
16
17/// Lime smoke (effect->variant 0) or pink smoke.
18///
19/// Abilities: Taint, Poison (kind 32).
21 if (effect->variant == 0) {
22 BattleFx_RunTargetMotes(effect, 0);
23 return;
24 }
25 BattleFx_RunTargetMotes(effect, 1);
26}
27
28/// Pink smoke; no ☀️ effect table entry points here.
30 BattleFx_RunTargetMotes(effect, 1);
31}
32
33/// Cyan smoke that rises.
34///
35/// Abilities: Delude, Confuse, Mist (kind 33).
37 BattleFx_RunTargetMotes(effect, 2);
38}
39/// Rising smoke with glints.
40///
41/// Abilities: Paralyze (kind 36).
43 BattleFx_RunTargetMotes(effect, 3);
44}
45/// Hearts.
46///
47/// Abilities: Heartrender (kind 346); kind 35 is used by no ability.
49 BattleFx_RunTargetMotes(effect, 4);
50}
51/// Glowing orbs.
52///
53/// Abilities: Mystic Flame (kind 312).
55 BattleFx_RunTargetMotes(effect, 5);
56}
57/// Glowing orbs in Mars Djinn colours, and the user strikes.
58///
59/// Abilities: Demon Fire (kind 64).
61 BattleFx_RunTargetMotes(effect, 7);
62}
63/// Vortex motes.
64///
65/// Abilities: Drown (kind 66).
67 BattleFx_RunTargetMotes(effect, 6);
68}
69/// Styles whose motes start in a wide ball and last 64 frames more.
70#define TARGET_MOTES_START_WIDE(mode) \
71 ((mode) <= 1 || (mode) == 4 || (mode) == 5 || (mode) == 6 || (mode) == 7)
72/// Styles whose motes close in on the target; the others rise.
73#define TARGET_MOTES_CLOSE_IN(mode) \
74 ((mode) <= 1 || (mode) == 4 || (mode) == 5 || (mode) == 6)
75
76/// Modes other than 0, 1 and 3 ripple the canvas: BG2's x is set line by
77/// line from work->bg2xLines (BattleFx_ArmBg2AffineHBlankDma).
78#define TARGET_MOTES_RIPPLE(mode) (!((mode) <= 1 || (mode) == 3))
79
80/// Where mode 3 keeps its glint images in work->sheet.
81enum { TARGET_MOTES_GLINT_CELLS = 0x2580 };
82
83#define TARGET_MOTES 512 ///< motes scattered at the start
84#define TARGET_MOTES_SLOTS 64 ///< particles reserved for each target
85#define TARGET_MOTES_CYCLE 24 ///< frames of a mote's image cycle
86
87/// Around each target in turn, 8 frames apart, motes (smoke, hearts, orbs)
88/// turn about a point 20 pixels up, either closing in on it or rising, and
89/// the target flashes until the end; the battle shows the damage 32 frames
90/// before the end. The effect layer ripples, except in modes 0, 1 and 3.
91/// mode : 0 lime smoke, 1 pink smoke, 2 cyan smoke, 3 smoke with glints,
92/// 4 hearts, 5 glowing orbs, 6 vortex motes, 7 orbs in Mars Djinn
93/// colours, with the user stepping up to strike the first target.
94///
95/// Called by the wrappers above: BattleFx_RunTaint (mode 0 or 1),
96/// BattleFx_RunDelude (2), BattleFx_RunParalyze (3), BattleFx_RunHeartrender
97/// (4), BattleFx_RunMysticFlame (5), BattleFx_RunDrown (6) and
98/// BattleFx_RunDemonFire (7).
99///
100/// Overwrites PARTICLES 0 to 511, loads the mode's palette into the first 64
101/// background colours, and in the rippling modes writes work->bg2xLines each
102/// frame for BattleFx_ArmBg2AffineHBlankDma, which it schedules and removes.
103/// It builds both blitters afresh for each target every frame and releases
104/// them again, mode 3 a mirrored one for each glint too, so it ends with
105/// none held. Mode 7 sets work->shakeFrames.
107 void **cursor;
108 struct BattleEffectWork *work;
109 void *canvas;
110 s32 frame;
111 s32 total;
112 s32 member;
113 s32 count;
114 struct EffectPosition screen;
115 s32 point[3];
116 struct EffectPosition base;
117 BlitterPair draw;
118 void *palette;
119 s32 *row;
120 s32 i;
121
122 cursor = gBattleFxWork;
123 EFFECT_GET_WORK_AND_CANVAS(cursor, work, canvas);
124 count = 16;
125 work->effect = effect;
128 if (mode == 0) {
130 } else if (mode == 1) {
132 } else if (mode == 2) {
134 } else if (mode == 3) {
136 } else if (mode == 4) {
138 } else if (mode == 5) {
140 0);
142 } else if (mode == 7) {
143 count = 24;
145 0);
147 } else {
148 count = 32;
151 }
152 Iwram_CopyWords((void *)BG_PLTT, palette, 128);
153 if (mode == 4)
155 if (mode == 3)
157 work->sheet + TARGET_MOTES_GLINT_CELLS, 1, 0);
158
159 // Wide styles scatter the motes within 64 pixels across and in depth and
160 // 32 up or down; the others within 16 across and in depth and up to 32
161 // below.
162 for (i = 0; i != TARGET_MOTES; i++) {
163 struct EffectStep *mote = &PARTICLES[i];
164
165 if (TARGET_MOTES_START_WIDE(mode)) {
166 SET_POSITION(mote, ((Random16() & 0xff) - 127) << 15,
167 ((Random16() & 0xff) - 127) << 14,
168 ((Random16() & 0xff) - 127) << 15);
169 } else {
170 SET_POSITION(mote, ((Random16() & 0xff) - 127) << 13,
171 ((Random16() & 0xff) - 255) << 13,
172 ((Random16() & 0xff) - 127) << 13);
173 }
174 mote->variant = 0;
175 }
176
177 if (TARGET_MOTES_START_WIDE(mode))
178 total = work->effect->count * 8 + 64;
179 else
180 total = work->effect->count * 8 + 32;
181 if (TARGET_MOTES_RIPPLE(mode))
184 // Trails keep 75% of each pixel a frame.
187
188 // Target n's turn starts on frame n * 8; the effect ends 64 frames (wide
189 // styles) or 32 after the last one starts.
190 for (frame = 0; frame != total; frame++) {
191 struct BattleCamera *camera = gCameraWork;
192
193 // Mode 7: the user steps up to the first target 46 frames before the
194 // end and strikes it 32 frames before the end, shaking the screen.
195 if (mode == 7) {
196 if (frame == total - 46)
198 work->effect->actors[0], 16, 0);
199 if (frame == total - 32) {
202 work->shakeFrames = 8;
203 }
204 } else if (frame == total - 32) {
206 }
207 // Ripple the canvas sideways, line by line: BG2's x (20.8) sways 0 to 2
208 // pixels, a wave of 1/32 turn a line that moves 1/16 turn a frame. The
209 // table is filled in every mode but read only where the HBlank DMA runs.
210 row = work->bg2xLines;
211 for (i = 0; i != 160; i++)
212 *row++ = (0x40000 - ((Trig_Sin((frame << 12) + i * 0x800) * 4))) >> 10;
213
214 EFFECT_FOR_EACH_TARGET(member, work->effect) {
215 struct MotionObject *object =
217
218 // Mode 3: two glints a frame, 4 to 35 pixels from the target in a
219 // random direction, each mirrored at random.
220 if (mode == 3 && frame > member * 8 && frame < member * 8 + 32) {
222 &base);
223 for (i = 0; i != 2; i++) {
224 s32 angle;
225 s32 radius;
226 s32 x;
227 s32 y;
228
229 angle = Random16() & 0xffff;
230 radius = (Random16() & 31) + 4;
231 x = base.x / 2 + ((Trig_Sin(angle) * radius) >> 17) -
232 (gBattleFx_GlintCellWidths[frame & 3] >> 1);
233 y = base.y - ((Trig_Cos(angle) * radius) >> 16) -
234 (gBattleFx_GlintCellHeights[frame & 3] >> 1);
240 canvas,
241 work->sheet + gBattleFx_GlintCells[frame & 3] +
243 x, y + 16, gBattleFx_GlintCellWidths[frame & 3],
244 gBattleFx_GlintCellHeights[frame & 3]);
246 }
247 }
250 draw[0] = gWorkSlot[HEAP_SLOT_BLITTER];
255 SET_VECTOR(point, object->x, 160 << 13, object->z);
257 // Turn the group about the vertical axis, and in modes 0, 1 and 4
258 // about the horizontal one too; mote i joins i frames after the
259 // target's turn starts and takes a new image every 4 frames.
260 if (frame > member * 8) {
261 SceneTransform_ApplyYaw(frame << 9);
262 if (mode <= 1 || mode == 4)
263 SceneTransform_ApplyPitch(frame << 9);
264 for (i = 0; i != count; i++) {
265 struct EffectStep *mote = &PARTICLES[member * TARGET_MOTES_SLOTS + i];
266 s32 distance;
267
268 if (frame > member * 8 + i) {
269 s32 xx = (mote->x >> 8) * (mote->x >> 8);
270 s32 yy = (mote->y >> 8) * (mote->y >> 8);
271 s32 zz = (mote->z >> 8) * (mote->z >> 8);
272
273 distance = Iwram_Sqrt(xx + yy + zz) >> 9;
274 if (distance != 0 && mote->variant <= 23) {
275 s32 cell = mote->variant / 4;
276
277 EffectPosition_ProjectPoint(mote, &screen);
278 screen.x >>= 1;
279 // Orbs 40x40, vortex motes 12x24, a heart 22x42, smoke 24x48;
280 // smoke draws one mote in four additively. A mote that has
281 // reached the centre is no longer drawn.
282 if (mode == 5 || mode == 7)
283 draw[1](canvas, work->sheet + cell * (40 * 40), screen.x - 20,
284 screen.y - 20, 40, 40);
285 else if (mode == 6)
286 draw[1](canvas, work->sheet + 0xc00, screen.x - 6,
287 screen.y - 12, 12, 24);
288 else if (mode == 4)
289 draw[1](canvas, work->sheet, screen.x - 11, screen.y - 21, 22,
290 42);
291 else
292 draw[(i & 3) != 0](canvas, work->sheet + cell * (24 * 48),
293 screen.x - 12, screen.y - 24, 24, 48);
294 // Closing motes step 2 pixels towards the centre and start their
295 // cycle again where they are; rising motes rise 1 pixel a frame
296 // and start again at a new random point below.
297 if (TARGET_MOTES_CLOSE_IN(mode)) {
298 mote->x -= mote->x / distance;
299 mote->y -= mote->y / distance;
300 mote->z -= mote->z / distance;
301 } else {
302 mote->y += 0x10000;
303 }
304 mote->variant++;
305 if (mote->variant == TARGET_MOTES_CYCLE) {
306 if (TARGET_MOTES_CLOSE_IN(mode)) {
307 mote->variant = 0;
308 } else {
309 SET_POSITION(mote, ((Random16() & 0xff) - 127) << 13,
310 ((Random16() & 0xff) - 255) << 12,
311 ((Random16() & 0xff) - 127) << 13);
312 }
313 }
314 }
315 }
316 }
317 }
319 // The target flashes white from 16 frames after its turn starts until
320 // the end, for at most 31 frames.
321 if (frame == member * 8 + 16) {
322 s32 delay = total - frame;
323
324 if (delay > 31)
325 delay = 31;
328 delay);
329 }
330 }
331 Camera_ApplyShake(16, 16);
332 EFFECT_END_FRAME(work);
333 }
334
336 if (TARGET_MOTES_RIPPLE(mode))
339}
340
341#define SLEEP_FRAMES 148
342#define SLEEP_SEEDED 32 ///< particles cleared at the start
343#define SLEEP_SHEEP 12 ///< sheep dropped
344
345/// Twelve sheep drop onto the targets' side, one every 4 frames, tumbling
346/// through eight images (the last four mirrored both ways); each target takes
347/// its damage pose in turn from frame 64, and the battle shows the result on
348/// frame 80.
349///
350/// Abilities: Sleep (kind 37).
351///
352/// 148 frames. PARTICLES 0 to 31 are the sheep, canvas pixels in 16.16; only
353/// the first twelve fall. Loads the sheep palette into the first 64
354/// background colours and sets REG_BLDCNT and BG2's affine registers (the
355/// narrow canvas, moved over the party's side when side is 1).
357 void **slots;
358 void **cursor;
359 struct BattleEffectWork *work;
360 void *canvas;
361 s32 anchor[3];
362 struct EffectStep *current;
363 struct EffectStep *sheep;
364 s32 particleIndex;
365 s32 frame;
366 DrawRectangle drawFlipped;
367 DrawRectangle drawUpright;
368 s32 targetIndex;
369
370 sheep = PARTICLES;
371 EFFECT_GET_SLOTS(slots, cursor, work, canvas);
372 work->effect = effect;
374 // Drawn solid.
375 REG_BLDCNT = 0;
379 drawUpright = (DrawRectangle)EFFECT_SLOT(slots, HEAP_SLOT_BLITTER);
384
385 // Seed SLEEP_SEEDED sheep, of which SLEEP_SHEEP fall. Each starts above
386 // the canvas at a random x, with a random tumble speed (z) and starting
387 // image; the fall speed draws a random number but always starts at 0.
388 for (particleIndex = 0; particleIndex != SLEEP_SEEDED; particleIndex++) {
389 current = &sheep[particleIndex];
390 current->x = ((Random16() & 63) + 32) << 16;
391 current->y = -0x200000;
392 current->velocityY = Random16() & 0;
393 current->z = Random16() & 3;
394 current->variant = Random16() & 255;
395 }
396 // Over the party's side: the canvas moves 112 pixels right.
397 if (work->effect->side == 1)
398 REG_BG2X = -0x7000;
399 // Redraw from blank each frame.
402 for (frame = 0; frame != SLEEP_FRAMES; frame++) {
403 struct BattleCamera *camera;
404
405 camera = gCameraWork;
406 if (frame == 80)
408 EFFECT_FOR_EACH_TARGET(targetIndex, work->effect) {
409 struct MotionObject *target;
410
411 target =
412 GetBattleObjectSlotFar(work->effect->actors[targetIndex])->object;
414 SET_VECTOR(anchor, target->x, 160 << 14, target->z);
416 if (frame == targetIndex * 16 + 64)
417 ObjectGroup_UpdateMembers(work->effect->actors[targetIndex], 0,
418 POSE_DAMAGE, -1, 0);
419 }
420 current = sheep;
421 for (particleIndex = 0; particleIndex != SLEEP_SHEEP;
422 particleIndex++, current++) {
423 if (frame > particleIndex * 4 && current->y <= 0x7fffff) {
424 s32 cell;
425
426 // Eight 32x32 images (1024 bytes each), the last four drawn from the
427 // first four mirrored both ways; z sets how fast a sheep tumbles.
428 cell = (current->variant / 16) & 7;
429 if (cell < 4)
430 drawUpright(canvas, work->sheet + (cell << 10),
431 (current->x >> 16) - 16, (current->y >> 16) - 16, 32, 32);
432 else
433 drawFlipped(canvas, work->sheet + (cell << 10) - 0x1000,
434 (current->x >> 16) - 16, (current->y >> 16) - 16, 32, 32);
435 current->y += current->velocityY;
436 current->velocityY += 0x2000;
437 current->variant += current->z;
438 // BUG: meant to bounce a sheep off the ground (y 92), tumbling faster,
439 // but it tests for a speed of exactly 0 just after gravity was added,
440 // so the sheep almost always fall on through. BUGFIX bounces any sheep
441 // that is falling.
442#ifdef BUGFIX
443 if (current->y > 0x5c0000 && current->velocityY > 0) {
444#else
445 if (current->y > 0x5c0000 && current->velocityY == 0) {
446#endif
447 s32 speed = current->velocityY + 1;
448 current->y = 0x5c0000;
449 current->z += 4;
450 current->velocityY = -speed / 2;
451 }
452 }
453 }
455 }
457}
458
459#define CURSE_MARKER_CELLS 1728 ///< the marker picture in the sheet
460
461/// A small flame burns above each target in turn, 16 frames apart, for 72
462/// frames each, over a marker at its feet; the battle shows the result on frame
463/// 32.
464///
465/// Abilities: Curse (kind 41); Lucid Prophecy (kind 354).
466///
467/// work->particles' variants give each flame its starting point in its
468/// animation. Loads the flame column palette into the first 64 background
469/// colours and sets REG_BLDCNT and BG2's affine registers (the narrow canvas,
470/// moved over the party's side when side is 1).
472 void **slot;
473 struct BattleEffectWork *work;
474 void *canvas;
475 /* FAKEMATCH: the family's blitter pair: this effect loads
476 * only one. A single blitter, as draw[1] or a plain pointer: differ 202. */
477 BlitterPair draw;
478 struct EffectStep *marker;
479 s32 i;
480 s32 frame;
481 s32 start;
482 s32 cell;
483 s32 y;
484 struct EffectPosition screenPosition;
485
487 canvas = slot[0];
488 work = slot[-1];
489 work->effect = effect;
491 // Drawn solid.
492 REG_BLDCNT = 0;
494 1);
495 // Over the party's side: the canvas moves 112 pixels right, and the
496 // targets' x is moved back by the same below.
497 if (work->effect->side == 1) {
498 REG_BG2X = -0x7000;
499 }
502 // Redraw from blank each frame.
504 work->transferValue = 0;
508 // Each flame starts at a random point of its animation.
510 work->particles[i].variant = Random16() & 63;
511 }
512 frame = 0;
513 while (frame != (work->effect->count << 5) + 32) {
514 if (frame == 32) {
516 }
517 i = 0;
518 if (work->effect->count != 0) {
519 marker = work->particles;
520 do {
521 start = i << 4;
522 if (frame == start) {
524 }
525 if (frame >= start && frame < start + 72) {
527 &screenPosition);
528 if (work->effect->side == 1) {
529 screenPosition.x -= 112;
530 }
531 y = screenPosition.y;
532 screenPosition.y = y - 16;
533 // The marker (16x20), then the flame (16x12) above it, cycling
534 // through nine images six frames each.
535 draw[0](canvas, work->sheet + CURSE_MARKER_CELLS,
536 screenPosition.x - 8, y - 20, 16, 20);
537 if (frame >= start) {
538 cell = ((frame - start) + marker->variant) / 6 % 9;
539 draw[0](canvas, work->sheet + cell * (16 * 12),
540 screenPosition.x - 8, screenPosition.y - 16, 16, 12);
541 }
542 }
543 marker++;
544 i++;
545 } while (i != work->effect->count);
546 }
548 frame += 1;
549 }
551}
552
553#undef TARGET_MOTES_START_WIDE
554#undef TARGET_MOTES_CLOSE_IN
555#undef TARGET_MOTES_RIPPLE
556#undef TARGET_MOTES
557#undef TARGET_MOTES_SLOTS
558#undef TARGET_MOTES_CYCLE
559#undef SLEEP_FRAMES
560#undef SLEEP_SEEDED
561#undef SLEEP_SHEEP
562#undef CURSE_MARKER_CELLS
@ SPRITE_COLOR_WHITE
solid colour 15, white
Definition animspr.h:26
void * gBattleFxWork[]
@ POSE_DAMAGE
taking damage
Definition battle.h:176
struct BattleCamera * gCameraWork
@ COMPOSITE_FLIP
@ COMPOSITE_ADDITIVE
@ 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_ArmBg2AffineHBlankDma(void)
Arms DMA 0 to copy one word of gBattleFxWork's bg2xLines table into BG2X at each horizontal blank,...
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 BattleFx_EndCanvasLayer(void)
Closes the canvas layer: plays the closing sound, restores BG1's scroll and the projection centre,...
Definition canvas.c:490
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
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.
#define EFFECT_PRESENT_FRAME(work)
Ends a frame of a canvas effect: marks the canvas ready for the transfer callback,...
@ 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 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_FINISH_CANVAS_ONE_BLITTER()
The same for an effect that drew through one blitter.
#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 CANVAS_SLOT(slots, slot)
A work slot read through a pointer to the canvas slot, gWorkSlot[HEAP_SLOT_BATTLE_CANVAS],...
#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...
#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...
u8 gTargetMotes_GlintFlips[]
Glint orientations: none, and mirrored each way and both.
u8 gBattleFx_GlintCellHeights[]
u16 gBattleFx_GlintCells[]
u8 gBattleFx_GlintCellWidths[]
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
void BattleMotion_ApproachTargetFar(s32 actorId, s32 targetId, s32 travel_divisor, s32 initial_velocity_y)
void BattleMotion_ApplyVariantMotionFar(s32 id, s32 variant)
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
@ HEAP_SLOT_BATTLE_CANVAS
Definition heap_state.h:43
#define REG_BG2X
Definition io_reg.h:65
#define BG_PLTT
Definition io_reg.h:157
#define REG_BLDCNT
Definition io_reg.h:119
static s32 Iwram_CopyWords(volatile void *destination, const volatile void *source, s32 size)
Definition iwram_call.h:85
static s32 Iwram_Sqrt(s32 value)
Definition iwram_call.h:63
#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 Runtime_ReleaseHeapBlock(s32 slot)
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
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
char ResourceId_PinkBurstSheet
char ResourceId_CyanPalette
char ResourceId_TornadoSheet
char ResourceId_LimePalette
char ResourceId_HeartSheet
char ResourceId_VortexSheet
char ResourceId_MarsDjinnSheet
char ResourceId_BlastSheet
char ResourceId_FlameColumnSheet
char ResourceId_SmokeSheet
char ResourceId_SheepSheet
char ResourceId_GlowOrbSheet
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
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
Definition scheduler.c:146
#define SE_133
Definition songs.h:126
#define SE_143
Definition songs.h:136
#define SE_142
Definition songs.h:135
#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.
s32 actor
the user's unit id
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
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 z
16.16 fixed-point pixels
Definition effect_step.h:26
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
u16 angle
1/65536 turns
Definition motobj.h:22
s32 x
16.16 fixed-point pixels
Definition motobj.h:23
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
Definition system.c:150
void BattleFx_RunDelude(struct BattleEffectArgument *effect)
Cyan smoke that rises.
#define TARGET_MOTES
motes scattered at the start
UNUSED void BattleFx_RunTargetMotesMode1(struct BattleEffectArgument *effect)
Pink smoke; no ☀️ effect table entry points here.
void BattleFx_RunParalyze(struct BattleEffectArgument *effect)
Rising smoke with glints.
void BattleFx_RunSleep(struct BattleEffectArgument *effect)
Twelve sheep drop onto the targets' side, one every 4 frames, tumbling through eight images (the last...
#define SLEEP_FRAMES
void BattleFx_RunHeartrender(struct BattleEffectArgument *effect)
Hearts.
void BattleFx_RunDemonFire(struct BattleEffectArgument *effect)
Glowing orbs in Mars Djinn colours, and the user strikes.
#define CURSE_MARKER_CELLS
the marker picture in the sheet
void BattleFx_RunTargetMotes(struct BattleEffectArgument *effect, u32 mode)
Around each target in turn, 8 frames apart, motes (smoke, hearts, orbs) turn about a point 20 pixels ...
#define TARGET_MOTES_SLOTS
particles reserved for each target
#define TARGET_MOTES_START_WIDE(mode)
Styles whose motes start in a wide ball and last 64 frames more.
#define TARGET_MOTES_RIPPLE(mode)
Modes other than 0, 1 and 3 ripple the canvas: BG2's x is set line by line from work->bg2xLines (Batt...
#define TARGET_MOTES_CYCLE
frames of a mote's image cycle
#define TARGET_MOTES_CLOSE_IN(mode)
Styles whose motes close in on the target; the others rise.
@ TARGET_MOTES_GLINT_CELLS
#define SLEEP_SEEDED
particles cleared at the start
void BattleFx_RunMysticFlame(struct BattleEffectArgument *effect)
Glowing orbs.
void BattleFx_RunDrown(struct BattleEffectArgument *effect)
Vortex motes.
#define SLEEP_SHEEP
sheep dropped
void BattleFx_RunTaint(struct BattleEffectArgument *effect)
Lime smoke (effect->variant 0) or pink smoke.
void BattleFx_RunCurse(struct BattleEffectArgument *effect)
A small flame burns above each target in turn, 16 frames apart, for 72 frames each,...
void SceneTransform_ApplyYaw(s32 angle)
Rotates gTransform about the Y axis by angle.
Definition transform.c:113
void SceneTransform_ApplyPitch(s32 angle)
Rotates gTransform about the X axis by angle.
Definition transform.c:97
void SceneTransform_ApplyPosition(const s32 *position)
Translates gTransform by position (x, y, z in 16.16).
Definition transform.c:145
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
#define UNUSED
Definition types.h:22
#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