9#define KIRIN_BLOB_BYTES (48 * 32)
29 static struct SpriteScale sweepScale = {{{0x10000, 0x10000}}};
30 static struct SpriteScale riseScale = {{{0x10000, 0x10000}}};
110 for (frame = 0; frame != 120; frame++) {
133 if (frame >= 24 && frame <= 55) {
155 lift = frame * 16 - 1664;
157 if (frame >= 8 && frame <= 31) {
158 baseX = baseX + shift - 8;
170 ang = (frame * 1024 - 0x2000) & 0xFFFF;
175 if ((frame & 31) == 8) {
184 place.
y = ((
gKirin_Rows[i] - wave) << 16) + (144 << 15);
194 s32 count = frame * 8;
202 for (i = 0; i != count; i++) {
204 s32 x = ((
Trig_Sin(ang) * (grow * 2 + 8)) >> 16) + grow + 96;
205 s32 y = ((
Trig_Cos(ang) * (grow * 12 + 48)) >> 16) + 64;
227 s32 size = i % 3 + 1;
237 if (fire->
x > 128 || fire->
variant == 1) {
238 fire->
x = (
Random16() & 31) + baseX + 172;
239 fire->
y = ((
Random16() & 31) - wave + 56) << 16;
249 s32 rise = (frame - 32) / 2;
259 120 - rise,
y, 48, 32);
314 }
while (i != 160 << 1);
332 ang = frame * 2048 + 0x4000;
336 rise = ((
Trig_Sin(ang) * 64)) >> 16;
338 ang = frame * 2048 + 0x4000;
342 rise = ((
Trig_Sin(ang) * 32)) >> 16;
345 risePlace.
height = 255 << 16;
349 risePlace.
y = ((
gKirin_Rows[i] - rise) << 16) + (144 << 15);
384 burst->
x = unit.
x << 15;
385 burst->
y = (unit.
y - 16) << 16;
390 burst->
y += up << 13;
424 s32 slide = (frame - 40) * 12;
432 jitter[i] - slide + 120,
y, 48, 32);
451 }
while (frame != 96);
466#undef KIRIN_BLOB_BYTES
@ SPRITE_COLOR_BLACK
solid colour 1, black
@ POSE_DAMAGE
taking damage
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_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
void BattleFx_WipeCanvas(s32 mode, s32 value)
Wipes the whole canvas to one colour with a ragged edge: each row (or column) lags a random 0 to 63 p...
void BattleFx_ConfigureEffectDisplay(void)
Puts the battle screen back into the display state every effect starts from and ends with: no blendin...
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_SetupBlendedDisplay(void)
Shows the BG1 battle background behind a cleared canvas: clears the canvas buffer and the 16 KiB of V...
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_SHOW_WIDE_CANVAS(top)
Shows the canvas: the effect display mode, BG2 stretched to twice its width (the 128-pixel canvas sho...
#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,...
#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
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_CALLBACK_ORDER
The scheduler order of every per-frame effect callback (Scheduler_AddOrUpdateCallback sorts the frame...
#define EFFECT_FINISH_CANVAS_ONE_BLITTER()
The same for an effect that drew through one blitter.
#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_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_WIN0_LAYERS
Window 0, the battle view, shows BG0 to BG2, sprites and blending.
#define EFFECT_END_FRAME(work)
The usual end of an effect frame: counts down the targets' flash timers (ObjectGroup_TickMemberTimers...
u16 gBattleFx_MoteCells[]
Mote cells: particle sheets hold ten, cell n (from 0) n + 1 pixels wide and twice that tall.
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)
void BattleBackground_LoadFar(s32 mode, s32 resource, s32 level)
void Object_ApplyProjectedPlacementFar(struct AnimationObject *sprite, const struct SpritePlacement *position, const struct SpriteScale *scale, s32 facing)
Far call to Render_ApplyProjectedPlacement.
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_BATTLE_BACKGROUND
@ HEAP_SLOT_BATTLE_CANVAS
#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)
#define WIN_RANGE(start, end)
A REG_WINxH or REG_WINxV value: the window covers start up to, but not including, end.
#define BG_PLTT_COLOR(palette, color)
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
#define KIRIN_BLOB_BYTES
One 48x32 fire blob picture; the fire sheet holds four.
#define KIRIN_OBJECTS
objects in the row, work->objects[0] to [8]
void BattleFx_RunKirin(struct BattleEffectArgument *effect)
Over a scrolling forest a row of objects rides in on a wave trailing fire, then sweeps across the tar...
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
void EffectPosition_ProjectBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, 16 pixels higher.
struct Projection gProjection
char ResourceId_ForestBackdrop
char ResourceId_ParticleSpritesA
char ResourceId_FireBlobSheet
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...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart image
u16 priority
2 when created
The battle background's work slot as the background code reads it: its display mode (2 draws it as an...
s32 busy
while set, BattleCamera_SetRange leaves BG1's scroll
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 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 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
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.
#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...