Alchemy
Loading...
Searching...
No Matches

helm_splitter.c

Go to the documentation of this file.
1/// @file
2/// Helm Splitter, formations and the impact burst.
3/// Part of effect.c, the battle effect object, compiled only through it.
4
6
7// - Helm Splitter's fire swirl charge leaps the user at the first target,
8// plays the swirl over it and scatters bouncing sparks. The sparks live in
9// PARTICLES, whose 1024 slots are cleared first.
10// - The impact burst plays a flash with large and small sparks and three
11// fragments, while the effect's objects settle into one of the formations
12// of BattleFx_PlaceFormationObjects. Large sparks and the fragments use
13// work->particles (0 to 63 and 61 to 63, the fragments overwriting the last
14// large sparks), small sparks PARTICLES.
15
16#define HELM_SPLITTER_FRAMES 70
17#define HELM_SPLITTER_STRIKE_FRAME 18 ///< the swirl strikes the target
18/// The pink star animation, after the swirl.
19#define HELM_SPLITTER_STAR_CELLS 0x3e80
20#define HELM_SPLITTER_CLEARED_SLOTS 1024 ///< PARTICLES slots freed first
21#define HELM_SPLITTER_SPARKS 16 ///< sparks scattered by the strike
22#define HELM_SPLITTER_SPARK_SLOTS 128 ///< spark slots moved and drawn
23
24/// The user leaps at the first target and strikes through a fire swirl; on
25/// frame 18 the target flashes and reels and 16 sparks scatter, bouncing off
26/// the ground.
27///
28/// Abilities: Helm Splitter (kind 51).
30 void **slots;
31 void **cursor;
32 struct BattleEffectWork *work;
33 void *canvas;
34 u8 *graphics;
35 DrawRectangle draw[2];
36 struct EffectPosition position;
37
38 struct EffectStep *sparks;
39 struct EffectStep *spark;
40 s32 *particleLife;
41 s32 frame;
42 s32 i;
43
44 EFFECT_GET_SLOTS(slots, cursor, work, canvas);
45 graphics = EFFECT_SLOT(slots, HEAP_SLOT_BATTLE_SHEET);
46 work->effect = effect;
50 1);
52 work->sheet + HELM_SPLITTER_STAR_CELLS, 1, 0);
55
56 // Free the spark pool before moving the user: the pointer walks the
57 // variant word of each seven-word EffectStep. Only the first 16 sparks are
58 // ever launched, and the first 128 moved.
59 particleLife = &PARTICLES->variant;
60 for (i = 0; i != HELM_SPLITTER_CLEARED_SLOTS; i++) {
61 *particleLife = 0;
62 particleLife += 7;
63 }
64 sparks = PARTICLES;
65
66 // The user leaps 80% of the way to the first target over 20 frames. The
67 // distance is taken in 1/256 pixels so the squares fit in 32 bits.
68 {
69 struct MotionObject *object =
71 struct MotionObject *target =
73 s32 diffX = target->x - object->x;
74 s32 startX = object->x;
75 s32 deltaX = diffX * 80 / 100;
76 s32 diffZ = target->z - object->z;
77 s32 startZ = object->z;
78 s32 deltaZ = diffZ * 80 / 100;
79 s32 x = startX + deltaX;
80 s32 z = startZ + deltaZ;
81 s32 shortX = deltaX >> 8;
82 s32 shortZ = deltaZ >> 8;
83 s32 distance;
84
85 distance = Iwram_Sqrt(shortX * shortX + shortZ * shortZ);
86 distance = (distance << 8) / 20;
87 object->acceleration = distance;
88 object->speedLimit = distance;
89 object->snapToTarget = 1;
90 object->velocityY = 0x70000;
91 object->verticalMotionStrength = 0xdeb8;
92 object->verticalMotionPhase = 0;
93 object->autoFaceMotion = 1;
95 Object_SetMoveTargetFar((struct ObjectRuntime *)object, x, 0, z);
97 }
98
99 // Play the swirl and impact, then let the sparks bounce and fade.
100 for (frame = 0; frame != HELM_SPLITTER_FRAMES; frame++) {
101 // The canvas follows the user across the screen: canvas column 80 is
102 // kept under the user.
103 EffectPosition_ProjectBattler(work->effect->actor, &position);
104 REG_BG2X = (80 - position.x) << 8;
105 // Frames 8 to 23: the swirl plays its seven pictures, two frames each,
106 // at the user's height, placed from the other edge on side 1.
107 if (frame >= 8 && frame <= 23) {
108 s32 cell = (frame - 8) / 2;
109
110 if (cell > 6)
111 cell = 6;
112 if (work->effect->side == 0) {
113 draw[0](canvas, work->sheet + gHelmSplitter_Cells[cell],
114 gHelmSplitter_CellBiasX[cell] + 30,
115 gHelmSplitter_CellBiasY[cell] + position.y - 60,
118 } else {
119 draw[0](canvas, work->sheet + gHelmSplitter_Cells[cell],
121 gHelmSplitter_CellWidths[cell] + 108,
122 gHelmSplitter_CellBiasY[cell] + position.y - 60,
125 }
126 }
127 // The strike: the battle shows the damage, the target flashes and
128 // reels, the camera shakes and 16 sparks fly from (64, 80), each living
129 // 16 to 31 frames.
130 if (frame == HELM_SPLITTER_STRIKE_FRAME) {
133 POSE_DAMAGE, 0, 8);
135 work->shakeFrames = 4;
136 for (i = 0; i != HELM_SPLITTER_SPARKS; i++) {
137 s32 force = (Random16() & 63) + 256;
138 s32 angle = Random16() & 0xffff;
139
140 spark = &sparks[i];
141 spark->x = 0x400000;
142 spark->y = 0x500000;
143 spark->velocityX = (Trig_Sin(angle) * force) >> 7;
144 spark->velocityY = -(Trig_Cos(angle) * force) >> 6;
145 spark->variant = (Random16() & 15) + 16;
146 }
147 }
148 // A spark below row 104 bounces up at half its speed instead of being
149 // drawn; one on the canvas is drawn with the pink star animation, each
150 // spark at its own point of the six-picture cycle.
151 for (i = 0; i != HELM_SPLITTER_SPARK_SLOTS; i++) {
152 spark = &sparks[i];
153 if (spark->variant > 0) {
154 spark->variant--;
156 if (spark->y > 0x680000) {
157 spark->velocityY = -spark->velocityY / 2;
158 } else if ((spark->x >= 0 && spark->x <= 0x7effff) && spark->y >= 0) {
159 s32 sx = spark->x >> 16;
160 s32 sy = spark->y >> 16;
161
162 draw[0](canvas,
163 work->sheet + HELM_SPLITTER_STAR_CELLS +
164 (((frame + i) / 4 % 6) << 8),
165 sx - 8, sy - 8, 16, 16);
166 }
167 }
168 }
169 Camera_ApplyShake(8, 8);
170 EFFECT_END_FRAME(work);
171 }
172
174}
175
176/// Arranges work->objects in a formation; x and z are its origin in 16.16
177/// pixels.
178///
179/// Each summon that ends in an impact burst keeps its objects in its own
180/// formation, every frame while it plays and then through
181/// BattleFx_RunImpactBurst. Places the objects through
182/// Object_ApplyProjectedPlacementFar and changes nothing else.
183///
184/// formation: 0 = nine in a 3x3 grid at 32-pixel spacing (Thor);
185/// 1 = twelve in rows of 1, 3, 4 and 4, from 16 left and 32 up
186/// (Nereid);
187/// 2 = eight in rows of 3, 2 and 3, from 16 right (Cybele);
188/// 3 = eight drawn at 1.25 times their size (Tiamat's
189/// BattleFx_RunPaletteParticles).
190/// Any other value places nothing.
192 static struct SpriteScale normalScale = {{{0x10000, 0x10000}}};
193 static struct SpriteScale largeScale = {{{0x14000, 0x14000}}};
195 struct SpriteScale normal = normalScale;
196 struct SpriteScale big = largeScale;
197 struct SpritePlacement pos;
198 s32 i;
199
200 pos.groundHeight = 0;
201 pos.height = 255 << 16;
202 // XXX: what a height of 255 means to the placement; the field objects'
203 // use of SpritePlacement.height would settle it.
204 switch (formation) {
205 // 1 << 21 is 32 pixels in 16.16.
206 case 0:
207 for (i = 0; i != 9; i++) {
208 pos.x = (i % 3 << 21) + x;
209 pos.y = (i / 3 << 21) + z;
210 Object_ApplyProjectedPlacementFar(work->objects[i], &pos, &normal, 0);
211 }
212 break;
213 case 1:
214 for (i = 0; i != 12; i++) {
215 pos.x = (gHelmSplitter_TwelveX[i] << 16) + x - (16 << 16);
216 pos.y = (gHelmSplitter_TwelveZ[i] << 16) + z - (32 << 16);
217 Object_ApplyProjectedPlacementFar(work->objects[i], &pos, &normal, 0);
218 }
219 break;
220 case 2:
221 for (i = 0; i != 8; i++) {
222 pos.x = (gHelmSplitter_RightEightX[i] << 16) + x + (16 << 16);
223 pos.y = (gHelmSplitter_RightEightZ[i] << 16) + z;
224 Object_ApplyProjectedPlacementFar(work->objects[i], &pos, &normal, 0);
225 }
226 break;
227 case 3:
228 for (i = 0; i != 8; i++) {
229 pos.x = (gHelmSplitter_SmallEightX[i] << 16) + x;
230 pos.y = (gHelmSplitter_SmallEightZ[i] << 16) + z;
231 Object_ApplyProjectedPlacementFar(work->objects[i], &pos, &big, 0);
232 }
233 break;
234 }
235}
236
237/// The fragment pictures in the sheet, four of 12x24, after the flash.
238#define IMPACT_BURST_SHARD_CELLS 0x59d8
239#define IMPACT_BURST_FRAGMENT_WIDTH 12 ///< each fragment picture's width
240#define IMPACT_BURST_FRAGMENT_HEIGHT 24 ///< and height
241
242#define IMPACT_BURST_FRAMES 72
243#define IMPACT_BURST_FRAGMENTS 3 ///< fragments, work->particles 61 to 63
244#define IMPACT_BURST_DRAWN_LARGE 30 ///< large sparks drawn
245#define IMPACT_BURST_DRAWN_SMALL 60 ///< small sparks drawn
246#define IMPACT_BURST_LARGE_SPARKS 64 ///< large sparks thrown
247#define IMPACT_BURST_SMALL_SPARKS 64 ///< small sparks thrown
248/// the first fragment in work->particles
249#define IMPACT_BURST_FIRST_FRAGMENT 61
250
251/// Opens an impact flash and scatters sparks and fragments, keeping the
252/// effect's objects in formation for the first 36 frames.
253///
254/// The close of four summons: Thor, Nereid, Cybele and Tiamat's
255/// BattleFx_RunPaletteParticles call it once their own frames are over, each
256/// with its own formation. Builds and frees both blitters, starts and stops
257/// the canvas transfer, sets REG_BG2PA, REG_BG2X and REG_BLDCNT, loads
258/// pictures into the sheet slot and work->sheet and overwrites
259/// work->particles 0 to 63 and PARTICLES 0 to 63. It leaves the canvas's
260/// VRAM cleared; ending the canvas layer is left to the caller.
261///
262/// formation: the layout for BattleFx_PlaceFormationObjects.
263/// x, y: the formation's origin in 16.16 pixels; the burst is drawn 40 pixels
264/// right of x, halved for the wide canvas.
266 void **slots;
267 void **cursor;
268 struct BattleEffectWork *work;
269 void *canvas;
270 DrawRectangle additive;
271 DrawRectangle maxBlend;
272 u8 *sheet;
273 s32 orgX;
274 struct EffectStep *particle;
275 s32 frame;
276 s32 i;
277
278 // BG2 shows the canvas at twice its width, and BG1 and BG2 blend over the
279 // layers below.
280 EFFECT_GET_SLOTS(slots, cursor, work, canvas);
282 orgX = x;
283 x += 40 << 16;
284 x /= 2;
285 REG_BG2PA = Q_8_8(0.5);
286 REG_BG2X = 0;
287 REG_BLDCNT =
290 maxBlend = slots[HEAP_SLOT_BLITTER - HEAP_SLOT_BATTLE_EFFECT];
297 work->sheet + IMPACT_BURST_SHARD_CELLS, 0, 0);
299
300 // Large sparks: speed 256-511, lifetime 16-31 frames; use the first 30.
301 for (i = 0; i != IMPACT_BURST_LARGE_SPARKS; i++) {
302 s32 speed = (Random16() & 255) + 256;
303 s32 angle = Random16() & 0xffff;
304
305 work->particles[i].x = x;
306 work->particles[i].y = y;
307 work->particles[i].velocityX = (Trig_Sin(angle) * speed) >> 7;
308 work->particles[i].velocityY = -((Trig_Cos(angle) * speed) >> 6);
309 work->particles[i].variant = (Random16() & 15) + 16;
310 }
311
312 // Three fragments, 120 degrees apart.
313 for (i = 0; i != IMPACT_BURST_FRAGMENTS; i++) {
317 (Trig_Sin(i * 0x5555) * 32) >> 6;
319 -((Trig_Cos(i * 0x5555) * 32) >> 5);
320 }
321
322 // Small sparks: speed 32-287, lifetime 20-35 frames.
323 for (i = 0; i != IMPACT_BURST_SMALL_SPARKS; i++) {
324 s32 speed = (Random16() & 255) + 32;
325 s32 angle = Random16() & 0xffff;
326
327 PARTICLES[i].x = x;
328 PARTICLES[i].y = y;
329 PARTICLES[i].velocityX = (Trig_Sin(angle) * speed) >> 6;
330 PARTICLES[i].velocityY = -((Trig_Cos(angle) * speed) >> 5);
331 PARTICLES[i].variant = (Random16() & 15) + 20;
332 }
333
334 // Frames 0 to 47 show the flash, and the large sparks join from frame 1.
335 // From frame 36 the formation stays where it is, the small sparks fly and
336 // the fragments tumble until frame 63.
337 for (frame = 0; frame != IMPACT_BURST_FRAMES; frame++) {
338 if (frame == 4)
340 if (frame == 32)
342
343 // The flash: its first picture until frame 12, then the next every five
344 // frames, eight in all.
345 if (frame <= 47) {
346 s32 cell = (frame - 8) / 5;
347 u32 width;
348 u32 height;
349
350 if (cell < 0)
351 cell = 0;
352 // UB: width is assigned in one argument and read in another.
353#ifdef UBFIX
356 maxBlend(canvas, work->sheet + gHelmSplitter_ImpactBurstCells[cell],
357 (x >> 16) - (width >> 1), (y >> 16) - (height >> 1), width,
358 height);
359#else
360 maxBlend(canvas, work->sheet + gHelmSplitter_ImpactBurstCells[cell],
361 (x >> 16) -
362 ((width = gHelmSplitter_ImpactBurstCellWidths[cell]) >> 1),
363 (y >> 16) -
364 ((height = gHelmSplitter_ImpactBurstCellHeights[cell]) >> 1),
365 width, height);
366#endif
367 }
368
369 // Large sparks: the first 30 join two every other frame, their motes
370 // shrinking with the life they have left.
371 for (i = 0, particle = work->particles; i != IMPACT_BURST_DRAWN_LARGE;
372 i++, particle++) {
373 if (frame > i / 2 && particle->variant > 0) {
374 s32 size;
375 s32 px;
376 s32 py;
377
378 particle->variant--;
379 EffectStep_AdvanceWithGravity2D(particle, 60, 0);
380 size = particle->variant / 16 + 3;
381 px = Q_16_16_TO_INT(particle->x);
382 py = Q_16_16_TO_INT(particle->y);
383 EFFECT_DRAW_MOTE(additive, canvas, sheet, px, py, size);
384 }
385 }
386
387 // Small sparks start at frame 36.
388 for (i = 0, particle = PARTICLES; i != IMPACT_BURST_DRAWN_SMALL;
389 i++, particle++) {
390 if (frame > 35 && particle->variant > 0) {
391 s32 size;
392 s32 px;
393 s32 py;
394
395 particle->variant--;
396 EffectStep_AdvanceWithGravity2D(particle, 60, 0);
397 size = particle->variant / 16 + 1;
398 px = Q_16_16_TO_INT(particle->x);
399 py = Q_16_16_TO_INT(particle->y);
400 EFFECT_DRAW_MOTE(additive, canvas, sheet, px, py, size);
401 }
402 }
403
404 // Fragments run on frames 36-63; advance the image every seven frames.
405 for (i = 0; i != IMPACT_BURST_FRAGMENTS; i++) {
406 struct EffectStep *shard =
408
409 if (frame >= 36 && frame <= 63) {
410 s32 cell;
411 s32 px;
412 s32 py;
413
415 cell = (frame - 36) / 7;
416 px = Q_16_16_TO_INT(shard->x);
417 py = Q_16_16_TO_INT(shard->y);
418 maxBlend(canvas,
419 work->sheet +
426 }
427 }
428
429 if (frame <= 35)
430 BattleFx_PlaceFormationObjects(formation, orgX, y);
432 }
433
434 // Clear the canvas in VRAM (character block 1), so nothing is left on BG2.
438}
439
440#undef HELM_SPLITTER_FRAMES
441#undef HELM_SPLITTER_STRIKE_FRAME
442#undef HELM_SPLITTER_STAR_CELLS
443#undef HELM_SPLITTER_CLEARED_SLOTS
444#undef HELM_SPLITTER_SPARKS
445#undef HELM_SPLITTER_SPARK_SLOTS
446#undef IMPACT_BURST_SHARD_CELLS
447#undef IMPACT_BURST_FRAGMENT_WIDTH
448#undef IMPACT_BURST_FRAGMENT_HEIGHT
449#undef IMPACT_BURST_FRAMES
450#undef IMPACT_BURST_FRAGMENTS
451#undef IMPACT_BURST_DRAWN_LARGE
452#undef IMPACT_BURST_DRAWN_SMALL
453#undef IMPACT_BURST_LARGE_SPARKS
454#undef IMPACT_BURST_SMALL_SPARKS
455#undef IMPACT_BURST_FIRST_FRAGMENT
@ SPRITE_COLOR_WHITE
solid colour 15, white
Definition animspr.h:26
@ POSE_DAMAGE
taking damage
Definition battle.h:176
@ COMPOSITE_ADDITIVE
@ COMPOSITE_MAX
BattleEffectDrawRectangle DrawRectangle
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 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_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_FADE
copy, keeping 50% or 75% (transferValue) of each pixel in the canvas for the next frame
#define CANVAS_BYTES
The canvas: 128x128 pixels, one byte each, in its heap slot and in VRAM at BG_CHAR_BLOCK(1).
#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_BEGIN_NARROW_CANVAS(bgControl)
Opens the canvas layer at the canvas's own width, one texel per pixel, where BattleFx_BeginCanvasLaye...
u8 gHelmSplitter_RightEightZ[]
u8 gHelmSplitter_SmallEightZ[]
u8 gHelmSplitter_RightEightX[]
u8 gHelmSplitter_ImpactBurstCellHeights[]
u8 gHelmSplitter_TwelveZ[]
u8 gHelmSplitter_TwelveX[]
u8 gHelmSplitter_CellHeights[]
u8 gHelmSplitter_CellWidths[]
s8 gHelmSplitter_CellBiasY[]
u16 gHelmSplitter_Cells[]
u8 gHelmSplitter_ImpactBurstCellWidths[]
s8 gHelmSplitter_CellBiasX[]
u8 gHelmSplitter_SmallEightX[]
u16 gHelmSplitter_ImpactBurstCells[]
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
void BattleMotion_ApplyVariantMotionFar(s32 id, s32 variant)
void Object_ApplyProjectedPlacementFar(struct AnimationObject *sprite, const struct SpritePlacement *position, const struct SpriteScale *scale, s32 facing)
Far call to Render_ApplyProjectedPlacement.
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_BATTLE_EFFECT
Definition heap_state.h:42
@ 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 WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
Definition heap_state.h:14
#define HELM_SPLITTER_SPARK_SLOTS
spark slots moved and drawn
#define IMPACT_BURST_FRAMES
#define HELM_SPLITTER_STAR_CELLS
The pink star animation, after the swirl.
#define IMPACT_BURST_DRAWN_SMALL
small sparks drawn
#define IMPACT_BURST_LARGE_SPARKS
large sparks thrown
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...
#define HELM_SPLITTER_SPARKS
sparks scattered by the strike
#define IMPACT_BURST_FRAGMENTS
fragments, work->particles 61 to 63
#define IMPACT_BURST_SMALL_SPARKS
small sparks thrown
#define IMPACT_BURST_FRAGMENT_WIDTH
each fragment picture's width
#define HELM_SPLITTER_FRAMES
#define IMPACT_BURST_DRAWN_LARGE
large sparks drawn
#define HELM_SPLITTER_CLEARED_SLOTS
PARTICLES slots freed first.
#define IMPACT_BURST_FRAGMENT_HEIGHT
and height
void BattleFx_RunHelmSplitter(struct BattleEffectArgument *effect)
The user leaps at the first target and strikes through a fire swirl; on frame 18 the target flashes a...
#define IMPACT_BURST_FIRST_FRAGMENT
the first fragment in work->particles
#define IMPACT_BURST_SHARD_CELLS
The fragment pictures in the sheet, four of 12x24, after the flash.
#define HELM_SPLITTER_STRIKE_FRAME
the swirl strikes the target
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 BLDCNT_TGT1_BG2
Definition io_reg.h:125
#define BG_CHAR_BLOCK(n)
Definition io_reg.h:166
#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 REG_BG2PA
Definition io_reg.h:61
#define REG_BLDCNT
Definition io_reg.h:119
static s32 Iwram_Sqrt(s32 value)
Definition iwram_call.h:63
static s32 Iwram_ClearWords(void *destination, s32 size)
Definition iwram_call.h:55
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
Definition math.c:10
void BattleFx_FetchRectangleBlitters(s32 flip, BlitterPair out)
Builds the two usual routines that draw onto the 128x128 canvas, both clipped on both axes.
void EffectPosition_ProjectBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, 16 pixels higher.
Definition positions.c:100
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
char ResourceId_FlareImage
char ResourceId_PinkStarSheet
char ResourceId_FireSwirlSheet
char ResourceId_FlareSheet
char ResourceId_ParticleSpritesA
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
Definition scheduler.c:146
#define SE_CAST
Definition songs.h:149
#define SE_212
Definition songs.h:207
#define SE_HEAVY_IMPACT
Definition songs.h:127
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
The running battle effect's work: its canvas image, 64 particles, the display registers it stages and...
s32 shakeFrames
shake frames left; Camera_ApplyShake counts down
struct AnimationObject * objects[16]
the effect's animation objects
struct BattleEffectArgument * effect
the command being run
struct EffectStep particles[64]
free while variant is -1
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 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
u16 angle
1/65536 turns
Definition motobj.h:22
s32 x
16.16 fixed-point pixels
Definition motobj.h:23
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
A sprite's screen position and its two vertical offsets, in 16.16 pixels.
s32 x
screen x of the sprite's centre
s32 y
screen y at the ground; sets the depth slot
s32 groundHeight
how far the shadow is raised above y
s32 height
how far the image is raised above y
Horizontal and vertical sprite scale; 0x10000 is the original size.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
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
#define PARTICLES
The map cell buffer (gMapCellBuffer), which the effects borrow, has two views here: Ram_MapCellBuffer...
Definition effect.h:221