20#define PALETTE_PARTICLES_FRAMES 208
22#define PALETTE_PARTICLES_STREAKS 16
24#define PALETTE_PARTICLES_FIRST_STREAK 24
25#define PALETTE_PARTICLES_FIRST_SPARK 40
26#define PALETTE_PARTICLES_EMBERS 512
27#define PALETTE_PARTICLES_FLASHES 24
28#define PALETTE_PARTICLES_SPARKS 24
30#define PALETTE_PARTICLES_STREAK_IMAGES 0x3000
128 focus.
y = -(60 << 16);
179 }
else if (frame >= 160 && frame <= 175) {
190 if (frame >= 33 && frame <= 175) {
200 grain->
x = ((
Random16() & 255) - 32) << 16;
201 grain->
y = 112 << 16;
208 if (spawned == limit)
214 if (frame >= 41 && frame <= 127) {
227 spark->
x = ((
Random16() & 7) + 78) << 16;
230 spark->
x = ((
Random16() & 7) + origin.
x - 8) << 16;
231 spark->
y = origin.
y << 16;
248 if (frame >= 129 && frame <= 175) {
262 flash->
x = origin.
x << 16;
263 flash->
y = origin.
y << 16;
283 draw[0](canvas, work->sheet + ((flash->
variant >> 2) << 11),
322 s32 height = size * 2;
347 if (mode == 0 && frame == 48)
352 if (frame >= 40 && frame <= 47) {
353 focus.
x += -(8 << 16);
386 if (streak->
y > 55) {
400 }
else if (streak->
variant == 0) {
403 streak->
x -= dir * 6;
405 if (frame <= 47 && streak->
y > 55)
408 streak->
x - size / 2, streak->
y + 30, size, size * 2);
423 for (i = 0; i != 8; i++)
429#undef PALETTE_PARTICLES_FRAMES
430#undef PALETTE_PARTICLES_STREAKS
431#undef PALETTE_PARTICLES_FIRST_STREAK
432#undef PALETTE_PARTICLES_FIRST_SPARK
433#undef PALETTE_PARTICLES_EMBERS
434#undef PALETTE_PARTICLES_FLASHES
435#undef PALETTE_PARTICLES_SPARKS
436#undef PALETTE_PARTICLES_STREAK_IMAGES
@ SPRITE_COLOR_RED_TINT
red raised to full
@ 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_SET_TRANSFER(work, mode, value)
Sets how the canvas transfer treats what is left in the canvas after each copy: mode with value (see ...
@ CANVAS_COPY_AND_CLEAR
copy, then fill the canvas with transferValue
@ 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_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...
#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_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->...
u8 gTiamat_DropSpeeds[]
Ember speeds, by ember index & 3.
u16 gBattleFx_MoteCells[]
Mote cells: particle sheets hold ten, cell n (from 0) n + 1 pixels wide and twice that tall.
u8 gTiamat_StreakWidths[]
u16 gTiamat_StreakOffsets[]
u8 gTiamat_DropSizes[]
Ember sizes, by ember index & 3.
u8 gTiamat_SparkPixels[]
A spark's 1x2 picture.
u8 gTiamat_StreakHeights[]
void BattleFx_SpawnObjects(s32 entryCount, s32 source, u32 priority)
Creates the effect's animation objects in gBattleFxWork's objects.
void BattleMotion_ApplyVariantMotionFar(s32 id, s32 variant)
s32 AnimationObjects_SelectAnimationFar(struct AnimationObject *state, s32 flags)
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.
void Camera_ApplyShake(s32 rangeX, u32 rangeY)
Shakes the battle view while gBattleFxWork's shakeFrames lasts, moving BG1 and the projection centre ...
@ HEAP_SLOT_BATTLE_EFFECT
@ HEAP_SLOT_BLITTER_ALTERNATE
@ 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 BGCNT_CHAR_BASE(block)
#define BGCNT_PRIORITY(n)
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
#define BGCNT_SCREEN_BASE(block)
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 Palette_BrightenBgEntries(s32 blueStep, s32 greenStep, s32 redStep)
Adds per-channel steps to background colours 1 to 63, capped at 31.
void EffectPosition_ProjectScaledBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, scaled for the battle view, 16 pixels higher.
char ResourceId_LightningBoltSheet
char ResourceId_ParticleSpritesA
char ResourceId_FlashBurstSheet
char ResourceId_EmberStreakSheet
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 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
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 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
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
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 PALETTE_PARTICLES_EMBERS
embers in PARTICLES
#define PALETTE_PARTICLES_FRAMES
#define PALETTE_PARTICLES_FIRST_SPARK
the first spark in work->particles
void BattleFx_RunTiamat(struct BattleEffectArgument *effect)
The rising embers with a formation of eight objects that sweeps in and explodes at the end.
void BattleFx_RunDragonDriver(struct BattleEffectArgument *effect)
The rising embers from the user's side, in the LightningBolt colours.
#define PALETTE_PARTICLES_FLASHES
flashes, work->particles 0 to 23
#define PALETTE_PARTICLES_SPARKS
sparks, work->particles 40 to 63
#define PALETTE_PARTICLES_STREAKS
Falling streaks, work->particles 24 to 39.
void BattleFx_RunPaletteParticles(struct BattleEffectArgument *effect, s32 mode)
A 208-frame effect of embers rising from the ground; pressing A or B during frames 49 to 159 skips to...
#define PALETTE_PARTICLES_FIRST_STREAK
The first streak in work->particles.
#define PALETTE_PARTICLES_STREAK_IMAGES
The streak pictures in the sheet.
#define EFFECT_CLIP_BOUNDS
Clips overflow on all four sides.
#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...