13#define CYBELE_FRAMES 366
14#define CYBELE_CHIP_COUNT 48
15#define CYBELE_VINES 10
16#define CYBELE_BLAST_CELLS 0x1680
17#define CYBELE_FIRST_SPARK 16
18#define CYBELE_FIRST_THORN 32
19#define CYBELE_FIRST_CHIP 16
20#define CYBELE_EMBER_CELL 6
74 for (i = 0; i != 1024; i++)
76 for (i = 0; i != 8; i++) {
77 for (j = 0; j != 128; j++) {
80 u8 *to = &order[i * 128 + b];
81 u8 *from = &order[i * 128 + a];
105 for (i = 0; i != 16; i++) {
112 vine->
x = i * 20 - 90;
119 for (i = 0; i != 16; i++) {
127 for (i = 0; i != 16; i++) {
130 thorn->
x = 128 << 16;
138 height = -(64 << 16);
170 if (height > 64 << 16)
173 if (frame >= 48 && frame <= 96) {
174 s32 pose = (frame - 48) / 24 % 3;
184 if (frame >= 72 && frame <= 127) {
185 for (i = 0; i != 16; i++) {
188 if (frame >= i + 72 && thorn->
y < (104 << 16)) {
189 s32 cellIndex = (frame + i) / 4 % 5;
191 s32 y = thorn->
y >> 16;
199 draw[0](canvas, cell,
x,
y, width, tall);
226 if (phase >= 0 && phase <= 96) {
236 u8 *sheet = work->sheet;
243 sheet = work->sheet + 24 * (8 + 64);
247 for (wrap = top; wrap > 184; wrap -= 64)
251 draw[i & 1](canvas, sheet, vine->
x, vine->
y - wrap - 8, 24, 8);
254 for (k = 0; k != 3; k++) {
255 s32 y = vine->
y - wrap + k * 64;
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);
272 s32 y = ((vine->
y - top) & 127) - 16;
277 if (
y + rows > vine->
y)
278 rows -=
y + rows - vine->
y;
281 vine->
x + 8,
y, full, rows);
287 if (phase >= 0 && phase <= 95) {
288 for (i = 0; i != 32; i++) {
292 s32 cellIndex = i % 5;
301 if ((chip->
y < 0 || chip->
y > 120 << 16) && frame <= 159) {
313 if (frame >= 224 && frame <= 247 && (frame & 3) == 0) {
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;
334 *color++ =
RGB(red, green, blue);
341 if (phase >= 0 && phase <= 172) {
348 for (j = 0; j != 6; j++) {
359 u32 half = size >> 1;
361 draw[0](canvas, cell, spark->
x - half, spark->
y - half, size, size);
364 if (frame <= 199 && spark->
variant == 5)
374 s32 row = frame * 2 - 496;
376 for (i = 0; i != 32; i++) {
377 for (j = 0; j != 4; j++) {
380 if (
y >= 0 &&
y <= 127) {
381 s32 x = order[((
y & 7) * 32 + i) * 4 + j];
383 canvas[((
y / 8 * 16 +
x / 8) * 8 + (
y & 7)) * 8 + (
x & 7)] = 0;
388 for (i = 0; i != 32; i++) {
389 for (j = 0; j != 4; j++) {
392 if (
y >= 0 &&
y <= 127) {
393 s32 x = order[((
y & 7) * 32 + i) * 4 + j];
395 canvas[((
y / 8 * 16 +
x / 8) * 8 + (
y & 7)) * 8 + (
x & 7)] = 0;
402 if (frame >= 161 && frame <= 223) {
404 if (frame > i * 8 + 160) {
411 object->y += 8 << 16;
412 if (object->
y > 128 << 16)
413 object->y = 128 << 16;
414 object->verticalMotionStrength = 0;
423 if (frame == i * 5 + 286) {
429 object->
y = 96 << 16;
430 object->verticalMotionStrength = 0xab85;
432 if (frame == i * 5 + 302) {
463 for (j = 0; j != 10; j++) {
480 s32 start = i * 4 + 302;
482 if (frame >= start && frame < i * 4 + 314) {
483 s32 cellIndex = (frame - start) / 2;
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);
495 if (frame >= start + 6) {
496 for (j = 0; j != 5; j++) {
506 draw[0](canvas, work->sheet + offset, screen.
x - (size >> 1),
507 screen.
y - (size >> 1), size, size);
520 else if (frame <= 301)
533 for (i = 0; i != 8; i++)
539#undef CYBELE_CHIP_COUNT
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
struct BattleCamera * gCameraWork
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...
void BattleFx_EndCanvasLayer(void)
Closes the canvas layer: plays the closing sound, restores BG1's scroll and the projection centre,...
#define CYBELE_FIRST_SPARK
the first spark in work->particles
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...
#define CYBELE_CHIP_COUNT
chips thrown by the thorns
#define CYBELE_BLAST_CELLS
the blast pictures, after the yellow ring
#define CYBELE_EMBER_CELL
the ember picture in gCybele_EmberOffsets
#define CYBELE_FIRST_CHIP
the first chip in work->particles
#define CYBELE_FIRST_THORN
the first thorn in work->particles
#define CYBELE_VINES
vines drawn
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.
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...
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[]
u16 gCybele_ChipOffsets[]
u16 gCybele_LeafOffsets[]
u8 gCybele_ObjectPoses[][2]
Poses of objects 3 and 4 while they wave, three pairs.
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.
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)
void Camera_ApplyShake(s32 rangeX, u32 rangeY)
Shakes the battle view while gBattleFxWork's shakeFrames lasts, moving BG1 and the projection centre ...
@ HEAP_SLOT_BLITTER_ALTERNATE
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.
#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...
#define BLDCNT_EFFECT_BLEND
weighted by REG_BLDALPHA
static s32 Iwram_ClearWords(void *destination, s32 size)
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
#define SET_VELOCITY(p, vx, vy, vz)
#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.
#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,...
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
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,...
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...
#define Ram_MapCellBuffer
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,...
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.
A moving point of an effect: its position, its velocity and a value each effect uses its own way (a s...
s32 velocityX
16.16 fixed-point pixels per frame
s32 variant
each effect's own: a size, a countdown, -1 for idle
s32 x
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
s32 velocityY
16.16 fixed-point pixels per frame
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
s32 z
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
s32 x
16.16 fixed-point pixels
#define EFFECT_CLIP_BOUNDS
Clips overflow on all four sides.
#define Q_16_16_TO_INT(v)
DrawRectangle BlitterPair[2]
A blitter pair: [0] built in HEAP_SLOT_BLITTER and [1] in HEAP_SLOT_BLITTER_ALTERNATE (BattleFx_Fetch...