Alchemy
Loading...
Searching...
No Matches

planet_diver.c

Go to the documentation of this file.
1/// @file
2/// Planet Diver, Haunt and the orbiting spirals.
3/// Part of effect.c, the battle effect object, compiled only through it.
4
6
7// - Planet Diver flashes the user, throws it into the air, turns it into a
8// ball of fire that falls on the target and bursts into 256 chips that
9// bounce on the ground. The impact chips reuse the map buffer that other
10// effects address as an array of EffectStep records.
11// - The closing skulls (Haunt) gather around each target in turn, eight
12// skulls scattered in 3D that step towards a point above the target while
13// the group spins. They take 64 slots of PARTICLES per target, of which 8
14// are used.
15// - The orbiting spirals circle above each target in turn, four of them a
16// quarter turn apart.
17//
18// The skulls and spirals ripple the effect layer throughout, through the
19// HBlank DMA of BG2's affine origin.
20
21// The leap that falls as a ball of fire.
22
23/// One chip of the impact, laid over the same 28-byte records as PARTICLES
24/// but with its velocities in other places than struct EffectStep's.
25struct ImpactChip {
26 s32 x; ///< canvas position, 16.16 fixed point
27 s32 y; ///< canvas position, 16.16; the ground is y 112
28 s32 velocityX; ///< 16.16 pixels a frame, damped to 56/64 each frame
29 s32 unused0c; ///< an EffectStep's velocityX; never read
30 s32 velocityY; ///< 16.16 pixels a frame, with 1/8 pixel of gravity
31 s32 unused14; ///< an EffectStep's velocityZ; never read
32 s32 life; ///< frames left; 0 is free
33};
34
35/// Ram_MapCellBuffer seen as Planet Diver's chips.
36#define PLANET_DIVER_IMPACT_CHIPS ((struct ImpactChip *)Ram_MapCellBuffer)
37
38#define PLANET_DIVER_FRAMES 88
39#define PLANET_DIVER_CLEARED_CHIPS 1024 ///< map-buffer chip slots cleared first
40#define PLANET_DIVER_CHIPS 256 ///< chips the fireball bursts into
41
42/// The user flashes and leaps into the air, turns into a ball of fire, falls
43/// onto the first target and bursts into chips that bounce on the ground.
44///
45/// Abilities: Planet Diver (kind 60).
46///
47/// 88 frames. effect->side says which way the ball falls; actors[0] is where it
48/// lands.
49///
50/// Moves the user's object: it leaps on frame 4 and falls from frame 18. The
51/// flash's sheet and palette are replaced by the fireball's on frame 16.
53 struct EffectPosition screenPosition;
54 BlitterPair draw;
55 void **slots;
56 void **cursor;
57 struct BattleEffectWork *work;
58 void *canvas;
59 u8 *sprites;
60 struct MotionObject *target;
61 s32 dx;
62 struct MotionObject *actor;
63 u8 *palette;
64 s32 frame;
65 s32 i;
66
67 EFFECT_GET_SLOTS(slots, cursor, work, canvas);
68 sprites = EFFECT_SLOT(slots, HEAP_SLOT_BATTLE_SHEET);
69 work->effect = effect;
73 // A sheet resource is its palette followed by its packed images.
75 Iwram_CopyWords((void *)BG_PLTT, palette, 128);
76 palette += 128;
77 Resource_DecodeType01(palette, work->sheet);
79 draw[0] = EFFECT_SLOT(slots, HEAP_SLOT_BLITTER);
83 // Trails keep 3/4 a frame.
85
86 // Four times as many chips are freed as the burst uses.
87 for (i = 0; i != PLANET_DIVER_CLEARED_CHIPS; i++)
88 PLANET_DIVER_IMPACT_CHIPS[i].life = 0;
90 target = GetBattleObjectSlotFar(work->effect->actors[0])->object;
91 // The ball falls 15 pixels a frame towards the middle of the field.
92 if (actor->x > 0)
93 dx = -(15 << 16);
94 else
95 dx = 15 << 16;
96
97 for (frame = 0; frame != PLANET_DIVER_FRAMES; frame++) {
98 struct BattleCamera *camera = gCameraWork;
99
101 // Frame loop. The user's screen position is taken on frame 0 and from
102 // frame 18 on, and held in between, so the flash stays where the leap
103 // began.
104 if (frame > 17 || frame == 0) {
105 EffectPosition_ProjectBattler(work->effect->actor, &screenPosition);
106 screenPosition.x /= 2;
107 }
108
109 // The flash: frames 2 and 3 on the user, frames 4 to 15 spreading in
110 // 16 directions through six 32x64 images, two frames each.
111 if (frame >= 2 && frame <= 3)
112 draw[0](canvas, work->sheet, screenPosition.x - 16, screenPosition.y - 64,
113 32, 64);
114 if (frame >= 4 && frame <= 15) {
115 for (i = 0; i != 16; i++) {
116 s32 x = screenPosition.x + (frame * Trig_Sin(i << 12) >> 16);
117 s32 y = screenPosition.y + (frame * Trig_Cos(i << 12) >> 16) - frame;
118
119 draw[0](canvas, work->sheet + ((frame - 4) / 2 << 11), x - 16, y - 64,
120 32, 64);
121 }
122 }
123 // Frame 4: the user leaps, heading out past its own position.
124 if (frame == 4) {
125 actor->velocityY = 20 << 16;
126 actor->acceleration = 1 << 16;
127 actor->speedLimit = 3 << 16;
128 actor->verticalMotionStrength = 0xab85;
129 actor->autoFaceMotion = 0;
130 actor->snapToTarget = 0;
131 Object_SetMoveTargetFar((struct ObjectRuntime *)actor, actor->x * 3, 0,
132 actor->z);
134 // A 4-frame shake: frame is 4 here.
135 work->shakeFrames = frame;
137 }
138 // Frame 16: switch to the fireball images and line the user up with
139 // the target's depth.
140 if (frame == 16) {
142 Iwram_CopyWords((void *)BG_PLTT, palette, 128);
143 palette += 128;
144 Resource_DecodeType01(palette, work->sheet);
145 actor->verticalMotionStrength = 0;
146 actor->velocityX = 0;
147 actor->velocityY = 0;
148 actor->z = target->z;
150 }
151 // From frame 18: fall 15 pixels across and 8 down a frame; on reaching
152 // the ground, throw out 256 chips, and the target recoils and flashes
153 // as the battle shows the damage.
154 if (frame > 17) {
155 if (actor->y > 0) {
156 actor->x += dx;
157 actor->y -= 8 << 16;
158 // The nudge after drawing lasts only to this frame's landing test,
159 // where the chips start; the next frame projects the user afresh.
160 // XXX: likely meant as screenPosition.x += 8, because side 0 moves
161 // x; a capture of an enemy's Planet Diver would show where its chips
162 // start.
163 if (work->effect->side == 0) {
164 draw[0](canvas, work->sheet, screenPosition.x - 20,
165 screenPosition.y - 52, 40, 64);
166 screenPosition.x -= 8;
167 } else {
168 draw[1](canvas, work->sheet, screenPosition.x - 26,
169 screenPosition.y - 52, 40, 64);
170 screenPosition.y += 8;
171 }
172 }
173 if (actor->y < 0) {
174 actor->y = 0;
175 for (i = 0; i != PLANET_DIVER_CHIPS; i++) {
176 struct ImpactChip *chip = &PLANET_DIVER_IMPACT_CHIPS[i];
177 s32 speed;
178 s32 angle;
179
180 /* FAKEMATCH: the mask set before the Random16() call it masks; as
181 * Random16() & 0x3ff, 5 lines of tbs-en effect.s differ. */
182 speed = 0x3ff;
183 speed &= Random16();
184 angle = Random16() & 0xffff;
185 chip->x = screenPosition.x << 16;
186 chip->y = (screenPosition.y - 24) << 16;
187 chip->velocityX = Trig_Sin(angle) * (speed + 32) >> 6;
188 chip->velocityY = -(Trig_Cos(angle) * (speed + 32) << 1) >> 6;
189 chip->life = (Random16() & 7) + 32;
190 }
191 work->shakeFrames = 8;
195 POSE_DAMAGE, 0, 8);
196 }
197 }
198
199 // Chips: slow to 56/64 of their speed each frame, fall, and bounce at
200 // half speed off y 112; only those on the canvas are drawn, shrinking
201 // a size every 8 frames of life.
202 for (i = 0; i != PLANET_DIVER_CHIPS; i++) {
203 struct ImpactChip *chip = &PLANET_DIVER_IMPACT_CHIPS[i];
204 s32 y;
205
206 if (chip->life > 0) {
207 chip->x += chip->velocityX;
208 y = chip->y + chip->velocityY;
209 chip->life--;
210 chip->y = y;
211 chip->velocityX = chip->velocityX * 56 / 64;
212 chip->velocityY = chip->velocityY * 56 / 64 + 0x2000;
213 if (chip->y > 112 << 16) {
214 chip->velocityY = -chip->velocityY / 2;
215 } else if ((chip->x >= 0 && chip->x < 127 << 16) && chip->y >= 0) {
216 s32 size = chip->life / 8 + 1;
217
218 EFFECT_DRAW_MOTE(draw[i & 1], canvas, sprites, (chip->x >> 16),
219 (chip->y >> 16), size);
220 }
221 }
222 }
223 Camera_ApplyShake(16, 16);
224 EFFECT_END_FRAME(work);
225 }
226
228}
229
230// Closing skulls.
231
232#define HAUNT_SCATTERED 512 ///< skull slots scattered at the start
233#define HAUNT_SKULLS 8 ///< skulls drawn around each target
234#define HAUNT_SLOTS 64 ///< particles reserved for each target
235
236/// Skulls close in on each target in turn.
237///
238/// Abilities: Haunt (kind 39).
239///
240/// Around each target, 32 frames apart, eight skulls appear one every 4 frames,
241/// scattered up to 64 pixels away, and close in on a point 20 pixels above the
242/// target while the group spins; the target flashes 32 frames into its turn,
243/// and a skull that reaches the centre is no longer drawn. The effect layer
244/// ripples throughout. PARTICLES holds 64 skulls per target, of which the first
245/// 8 are used.
246///
247/// Adds BattleFx_ArmBg2AffineHBlankDma, which feeds the ripple in
248/// work->bg2xLines to BG2X line by line, and removes it before it returns.
250 struct EffectPosition screenPosition;
251 s32 point[3];
252 void **slots;
253 void **cursor;
254 struct BattleEffectWork *work;
255 void *canvas;
256 s32 frame;
257 BlitterPair draw;
258 struct BattleCamera *camera;
259 u8 *palette;
260 s32 i;
261 s32 k;
262
263 EFFECT_GET_SLOTS(slots, cursor, work, canvas);
264 work->effect = effect;
267 Iwram_CopyWords((void *)BG_PLTT, palette, 128);
268 palette += 128;
269 Resource_DecodeType01(palette, work->sheet);
270 // The skulls are drawn in the pink burst's colours, which replace the
271 // skull sheet's own.
273 Iwram_CopyWords((void *)BG_PLTT, palette, 128);
275 draw[0] = EFFECT_SLOT(slots, HEAP_SLOT_BLITTER);
281 // 4 off every pixel each frame.
283
284 // Every skull starts up to 64 pixels from its centre on each axis.
285 for (i = 0; i != HAUNT_SCATTERED; i++) {
286 PARTICLES[i].x = ((Random16() & 255) - 127) << 15;
287 PARTICLES[i].y = ((Random16() & 255) - 127) << 15;
288 PARTICLES[i].z = ((Random16() & 255) - 127) << 15;
289 }
291
292 for (frame = 0; frame != work->effect->count * 32 + 96; frame++) {
293 s32 *row;
294
295 camera = gCameraWork;
296 // Frame loop: 32 frames a target, then 96 more. The battle shows the
297 // damage on frame 96, whatever the number of targets.
298 if (frame == 96)
300
301 // Ripple the canvas sideways, line by line: a 16.16 value >> 10 is a
302 // quarter of it in BG2X's 20.8, so the sine swings 1.5 texels either
303 // way, about a 1.5-texel offset against the enemies.
304 row = work->bg2xLines;
305 if (work->effect->side == 0) {
306 for (i = 0; i != 160; i++)
307 *row++ = (0x60000 - Trig_Sin((frame + i) << 11) * 6) >> 10;
308 } else {
309 for (i = 0; i != 160; i++)
310 *row++ = Trig_Sin((frame + i) << 11) * 6 >> 10;
311 }
312
314 struct MotionObject *target =
316
317 // Centre on the point 20 pixels above the target and spin the group
318 // about it; target k's turn starts on frame 32k, its skull i on frame
319 // 4 * (8k + i), and it flashes 32 frames into its turn.
321 SET_VECTOR(point, target->x, 20 << 16, target->z);
323 if (frame > k * 32) {
324 SceneTransform_ApplyPitch(frame << 9);
325 if (frame == k * 32 + 32)
327 POSE_DAMAGE, k, 32);
328
329 // Each skull steps one pixel nearer the centre a frame (its
330 // position less itself over its distance in pixels); skulls take
331 // one of three 24x24 images in turn. variant counts its steps but is
332 // never read.
333 for (i = 0; i != HAUNT_SKULLS; i++) {
334 struct EffectStep *skull = &PARTICLES[k * HAUNT_SLOTS + i];
335
336 if (frame > (k * 8 + i) * 4) {
337 s32 x = (skull->x >> 8) * (skull->x >> 8);
338 s32 y = (skull->y >> 8) * (skull->y >> 8);
339 s32 z = (skull->z >> 8) * (skull->z >> 8);
340 s32 dist = Iwram_Sqrt(x + y + z) >> 8;
341
342 if (dist != 0) {
343 EffectPosition_ProjectPoint(skull, &screenPosition);
344 screenPosition.x >>= 1;
345 draw[0](canvas, work->sheet + i % 3 * (24 * 24),
346 screenPosition.x - 12, screenPosition.y - 12, 24, 24);
347 skull->x -= skull->x / dist;
348 skull->y -= skull->y / dist;
349 skull->z -= skull->z / dist;
350 skull->variant++;
351 }
352 }
353 }
354 }
355 }
356 EFFECT_END_FRAME(work);
357 }
358
359 // Finish: both callbacks before the blocks they read.
364}
365
366#define ORBITING_SPIRALS_LIFE 60 ///< frames each target's spirals turn
367
368/// Four spirals circle 40 pixels above each target in turn, 16 frames apart,
369/// for 60 frames each, 16 pixels out from the centre; each target takes its
370/// damage pose halfway through.
371///
372/// Abilities: none (kind 34).
373///
374/// The effect layer ripples throughout, through
375/// BattleFx_ArmBg2AffineHBlankDma, which it adds and removes. It never lets
376/// the battle show damage, and leaves the targets' flash timers alone.
378 void **slots;
379 void **cursor;
380 struct BattleEffectWork *work;
381 void *canvas;
382 void *palette;
383 BlitterPair draw;
384 s32 point[3];
385 struct EffectPosition screen;
386 s32 member;
387 s32 offsetX;
388 s32 frame;
389
390 EFFECT_GET_SLOTS(slots, cursor, work, canvas);
391 work->effect = effect;
394 Iwram_CopyWords((void *)BG_PLTT, palette, 128);
395 Resource_DecodeType01((u8 *)palette + 128, work->sheet);
397 draw[0] = EFFECT_SLOT(slots, HEAP_SLOT_BLITTER);
403 // Trails keep half a frame.
405 // On the party's side the canvas is scrolled 104 texels (BG2X is 20.8),
406 // and the spirals are drawn 112 further left.
407 // XXX: the ripple below rewrites BG2X every line with a 112-texel lead,
408 // so whether this 104 ever shows is unknown; the HBlank DMA's start
409 // timing would settle it.
410 if (work->effect->side == 1) {
411 REG_BG2X = -0x6800;
412 offsetX = -112;
413 } else {
414 offsetX = 0;
415 }
416 for (frame = 0; frame != (work->effect->count * 16) + 48; frame++) {
417 struct BattleCamera *camera;
418 s32 *row;
419 s32 i;
420
421 // Frame loop. Ripple the canvas sideways, line by line, 2 texels either
422 // way (16.16 >> 10 is a quarter in BG2X's 20.8; the products keep the
423 // signed sine out of a left shift).
424 camera = gCameraWork;
425 row = work->bg2xLines;
426 if (work->effect->side == 0) {
427 s32 angle;
428 s32 base;
429
430 for (i = 0, base = 0x80000, angle = frame << 10; i != 160; i++) {
431 *row++ = (base - ((Trig_Sin(angle) * 8))) >> 10;
432 angle += 1024;
433 }
434 } else {
435 s32 angle;
436
437 for (i = 0, angle = frame << 10; i != 160; i++) {
438 *row++ = (((Trig_Sin(angle) * 8)) >> 10) - 0x7000;
439 angle += 1024;
440 }
441 }
443 member = 0;
444 if (work->effect->count != 0) {
445 while (member != work->effect->count) {
446 struct MotionObject *obj;
447
448 obj = GetBattleObjectSlotFar(work->effect->actors[member])->object;
449 // Target `member` has its turn from frame 16 * member, and takes
450 // its damage pose 32 frames in.
451 if (frame > member * 16 &&
452 frame < (member * 16) + ORBITING_SPIRALS_LIFE) {
453 s32 spin;
454
455 if (frame == (member * 16) + 32) {
456 ObjectGroup_UpdateMembers(work->effect->actors[member], 0,
457 POSE_DAMAGE, -1, 0);
458 }
459 SET_VECTOR(point, obj->x, 40 << 16, obj->z);
460 EffectPosition_ProjectPoint(point, &screen);
461
462 // The spirals (32x32) a quarter turn apart, through four images,
463 // turned upside down every other 16 frames.
464 for (i = 0; i != 4; i++) {
465 s32 x;
466 s32 y;
467 s32 half;
468
469 spin = (frame << 9) + (i << 14);
470 x = (screen.x + (((Trig_Sin(spin) * 16)) >> 16)) + offsetX;
471 y = screen.y + (((Trig_Cos(spin) * 16)) >> 16);
472 half = frame / 16;
473 draw[half & 1](canvas,
474 work->sheet + (((frame / 4) - (half * 4)) << 10),
475 x - 16, y - 16, 32, 32);
476 }
477 }
478 member++;
479 }
480 }
482 }
483 // Finish: both callbacks before the blocks they read.
488}
489
490#undef PLANET_DIVER_IMPACT_CHIPS
491#undef PLANET_DIVER_FRAMES
492#undef PLANET_DIVER_CLEARED_CHIPS
493#undef PLANET_DIVER_CHIPS
494#undef HAUNT_SCATTERED
495#undef HAUNT_SKULLS
496#undef HAUNT_SLOTS
497#undef ORBITING_SPIRALS_LIFE
@ SPRITE_COLOR_WHITE
solid colour 15, white
Definition animspr.h:26
@ POSE_DAMAGE
taking damage
Definition battle.h:176
struct BattleCamera * gCameraWork
@ COMPOSITE_FLIP_X
@ COMPOSITE_FLIP
@ COMPOSITE_ADDITIVE
@ COMPOSITE_MAX
#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 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_DRAW_MOTE(draw, canvas, sheet, x, y, size)
Particle sheets hold ten mote cells, 1x2 to 10x20 pixels.
#define EFFECT_PRESENT_FRAME(work)
Ends a frame of a canvas effect: marks the canvas ready for the transfer callback,...
@ CANVAS_COPY_AND_DARKEN
copy, then darken the canvas by transferValue
@ CANVAS_COPY_AND_FADE
copy, keeping 50% or 75% (transferValue) of each pixel in the canvas for the next frame
#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...
#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...
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
void BattleMotion_ApplyVariantMotionFar(s32 id, s32 variant)
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void Object_SetMoveTargetFar(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
void ObjectDispatch_StartIdleFar(struct DispatchObject *obj)
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_BATTLE_SHEET
Definition heap_state.h:44
@ HEAP_SLOT_BLITTER
Definition heap_state.h:46
#define REG_BG2X
Definition io_reg.h:65
#define BG_PLTT
Definition io_reg.h:157
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_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
#define PLANET_DIVER_IMPACT_CHIPS
Ram_MapCellBuffer seen as Planet Diver's chips.
void BattleFx_RunHaunt(struct BattleEffectArgument *effect)
Skulls close in on each target in turn.
#define PLANET_DIVER_CLEARED_CHIPS
map-buffer chip slots cleared first
#define HAUNT_SCATTERED
skull slots scattered at the start
#define HAUNT_SKULLS
skulls drawn around each target
#define PLANET_DIVER_CHIPS
chips the fireball bursts into
#define HAUNT_SLOTS
particles reserved for each target
#define ORBITING_SPIRALS_LIFE
frames each target's spirals turn
void BattleFx_RunOrbitingSpirals(struct BattleEffectArgument *effect)
Four spirals circle 40 pixels above each target in turn, 16 frames apart, for 60 frames each,...
#define PLANET_DIVER_FRAMES
void BattleFx_RunPlanetDiver(struct BattleEffectArgument *effect)
The user flashes and leaps into the air, turns into a ball of fire, falls onto the first target and b...
void EffectPosition_ProjectBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, 16 pixels higher.
Definition positions.c:100
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_SkullSheet
char ResourceId_SpiralSheet
char ResourceId_ParticleSpritesA
char ResourceId_FlashBurstSheet
char ResourceId_FlameballSheet
s32 Resource_DecodeType01(const void *source, void *destination)
Decodes a type-01 resource and returns its unpacked byte count.
Definition decompress.c:31
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_136
Definition songs.h:129
#define SE_142
Definition songs.h:135
#define SE_145
Definition songs.h:138
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 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
struct BattleEffectArgument * effect
the command being run
struct MotionObject * object
NULL once released.
A field object as the object dispatcher's far calls take it.
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
One chip of the impact, laid over the same 28-byte records as PARTICLES but with its velocities in ot...
s32 x
canvas position, 16.16 fixed point
s32 velocityX
16.16 pixels a frame, damped to 56/64 each frame
s32 velocityY
16.16 pixels a frame, with 1/8 pixel of gravity
s32 y
canvas position, 16.16; the ground is y 112
s32 unused14
an EffectStep's velocityZ; never read
s32 life
frames left; 0 is free
s32 unused0c
an EffectStep's velocityX; never read
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
Definition motobj.h:20
s32 speedLimit
16.16 fixed-point pixels per frame
Definition motobj.h:34
s32 velocityX
16.16 fixed-point pixels per frame
Definition motobj.h:31
s32 z
16.16 fixed-point pixels
Definition motobj.h:25
u8 snapToTarget
nonzero: lands exactly on the target, else brakes in
Definition motobj.h:57
s32 y
16.16 fixed-point pixels
Definition motobj.h:24
s32 velocityY
16.16 fixed-point pixels per frame
Definition motobj.h:32
s32 acceleration
Horizontal speed gained each frame towards the target, or lost braking without one,...
Definition motobj.h:37
s32 x
16.16 fixed-point pixels
Definition motobj.h:23
s32 verticalMotionStrength
Gravity: taken from velocityY each frame above the ground with motionFlags bit 1, in 16....
Definition motobj.h:48
u8 autoFaceMotion
bit 0 turns the object to face where it moves
Definition motobj.h:59
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
s32 z
16.16 fixed-point pixels
s32 x
16.16 fixed-point pixels
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
Definition system.c:150
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 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