12#define NEREID_FRAMES 124
14#define NEREID_OBJECTS 12
15#define NEREID_COLUMNS 3
16#define NEREID_EMBERS 1024
17#define NEREID_COLUMN_IMAGE 0x6e4
82 velocity.
x = -(16 << 16);
83 velocity.
y = -(4 << 16);
87 for (k = 0; k != 16; k++) {
115 focus.
x += velocity.
x;
116 focus.
y += velocity.
y;
117 velocity.
x = velocity.
x * 58 / 64;
118 velocity.
y = velocity.
y * 56 / 64;
119 if (focus.
x < 120 << 16)
120 velocity.
x += 0x8000;
128 for (k = 0; k != 256; k++) {
134 spark->
x = ((
Trig_Sin(angle) * radius) >> 3) + (32 << 16);
135 spark->
y = ((
Trig_Cos(angle) * radius) >> 2) + (96 << 16);
142 if (frame >= 32 && frame < 80) {
151 spark->
x = ((
Trig_Sin(angle) * radius) >> 3) + (32 << 16);
152 spark->
y = ((
Trig_Cos(angle) * radius) >> 2) + (96 << 16);
171 if (frame >= 32 && frame < 80) {
173 s32 span = (frame * 16 - 256 + k * 25) % 104;
187 for (k = 0; k != 5; k++)
188 draw[0](canvas, work->sheet, k * 32 + ((frame / 4) & 31) - 32,
200 s32 size = k % 3 + 2;
204 if (frame > 68 && size <= 5)
206 if (frame > 70 && size <= 6)
208 if (frame > 72 && size <= 7)
210 if (frame > 74 && size <= 8)
236 s32 phase = frame % 12;
270#undef NEREID_COLUMN_IMAGE
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ POSE_DAMAGE
taking damage
#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_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
void BattleFx_EndCanvasLayer(void)
Closes the canvas layer: plays the closing sound, restores BG1's scroll and the projection centre,...
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.
#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 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_FREE_PARTICLES(i, particles, count)
Marks particles[0] to particles[count - 1] free: a particle whose variant is -1 is not drawn or moved...
s32 gNereid_Gravity[]
Ember gravity while falling, by ember index & 3.
u8 gNereid_Columns[][2]
Nereid's four columns of fire (NEREID_COLUMN_X, NEREID_COLUMN_Y).
@ NEREID_COLUMN_Y
canvas y of its foot
@ NEREID_COLUMN_X
canvas x of the column's middle
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 ResourceObject_ReleaseFar(struct AnimationObject *sprite)
void AudioCommand_PlayFar(s32 id)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
@ HEAP_SLOT_BATTLE_EFFECT
@ HEAP_SLOT_BATTLE_CANVAS
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 BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
static s32 Iwram_CopyWords(volatile void *destination, const volatile void *source, s32 size)
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
void BattleFx_FetchRectangleBlitters(s32 flip, BlitterPair out)
Builds the two usual routines that draw onto the 128x128 canvas, both clipped on both axes.
#define NEREID_EMBERS
embers in PARTICLES
#define NEREID_COLUMN_IMAGE
the column of fire in the sheet
void BattleFx_RunNereid(struct BattleEffectArgument *effect)
A formation of twelve objects sweeps in among embers and columns of fire, and explodes.
#define NEREID_COLUMNS
wrapping columns of fire
#define NEREID_OBJECTS
objects in the sweeping formation
char ResourceId_FirePillarSheetA
char ResourceId_WaterSpraySheet
char ResourceId_ParticleSpritesA
s32 Resource_DecodeType01(const void *source, void *destination)
Decodes a type-01 resource and returns its unpacked byte count.
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
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...
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 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 velocityY
16.16 fixed-point pixels per frame
s32 verticalMotionStrength
Gravity: taken from velocityY each frame above the ground with motionFlags bit 1, in 16....
Two-dimensional {x, y} pair for position or velocity, a local of the summon scenes (Nereid,...
s32 x
16.16 pixels in every scene that uses it
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
#define Q_16_16_TO_INT(v)
#define PARTICLES
The map cell buffer (gMapCellBuffer), which the effects borrow, has two views here: Ram_MapCellBuffer...
DrawRectangle BlitterPair[2]
A blitter pair: [0] built in HEAP_SLOT_BLITTER and [1] in HEAP_SLOT_BLITTER_ALTERNATE (BattleFx_Fetch...