20 }
while (callIndex != count);
51 if (effect->
kind == 0) {
54 switch (effect->
kind) {
158 for (scanline = 0; scanline != 160; scanline++) {
159 if (scanline >= 8 && scanline <= 135) {
160 rightEdge = *baseRightEdge - edgeOffsets[scanline - 8];
161 CLAMP(rightEdge, 0, 240);
162 scanlineEdges[scanline] = rightEdge;
164 scanlineEdges[scanline] = 0xfff1;
191 for (i = 0; i != 6; i++) {
198 for (i = 0; i != 8; i++) {
255 s32 timerSlot,
s32 timerFrames) {
267 if (timerSlot != -1) {
275 if (group->
count != 0) {
290 part->
param = palette;
294 }
while (partIndex != group->
count);
void BattleFx_RunAtalanta(struct BattleEffectArgument *effect)
Rain of blades: under a violet sky, a 3x3 formation of objects flies along a stored path while sixtee...
void BattleFx_RunBoreas(struct BattleEffectArgument *effect)
Rocks and ice blocks: a window opens on rocks that crumble, a big ice block drops and throws up spray...
void BattleFx_EndCanvasLayer(void)
Closes the canvas layer: plays the closing sound, restores BG1's scroll and the projection centre,...
void BattleFx_BeginTiledCanvas(s32 bgControl)
Opens the canvas layer with BG2 a wrapping 256x256 map: each row of the map is the canvas's 16 tiles ...
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 Dma_Fill32Cell(cell, value, destination, size)
Dma_Fill32 through the caller's own volatile word cell, so a function that fills several blocks keeps...
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
void BattleFx_CallDoNothing(s32 count)
Calls the empty BattleFx_DoNothing count times, without waiting for a frame: a busy delay that change...
void BattleFx_RunTableEffect(struct BattleEffectArgument *effect)
Runs an ordinary battle effect: takes the effect's sheet, work and canvas, runs the entry of gBattleF...
void ObjectGroup_UpdateMembers(s32 actorId, s32 palette, s32 animation, s32 timerSlot, s32 timerFrames)
Updates every animation group of one battler's object.
void BattleFx_BuildWindowEdgeTable(void)
Builds window 0's right edge for every scanline and restarts the HBlank DMA that writes it to WIN0H e...
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...
void BattleFx_RunSceneEffect(struct BattleEffectArgument *effect)
Runs one of the large battle effects, the ones whose presentation flags have bit 15 set: takes the ef...
UNUSED void BattleFx_InitTilemapAndFlushQueue(void)
Writes the tiled canvas tilemap for BG2 (priority 1), then closes the canvas layer again,...
What every part of the battle effect object shares: its includes, macros and frame-loop helpers.
#define CANVAS_BYTES
The canvas: 128x128 pixels, one byte each, in its heap slot and in VRAM at BG_CHAR_BLOCK(1).
#define MOTE_SET_BYTES
The bytes of one set of the ten mote cells: 2 * (1 + 4 + ... + 100).
static void Dma_Stop(volatile u16 *channel)
Stops a DMA channel: clears its repeat and start timing bits, then its enable bit,...
#define EFFECT_DISPCNT
The battle screen's display mode while an effect plays: background mode 1 with BG0 to BG2,...
BattleFxHandler gBattleFx_EffectHandlers[BATTLE_FX_KIND_COUNT - 1]
The effect handlers, indexed by effect kind minus one, which BattleFx_RunTableEffect calls; kind zero...
void BattleFx_DoNothing(void)
Does nothing.
s32 BattleMotion_GetSlotPaletteFar(s32 id)
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
void BattleActor_SpawnObjectsForListFar(s16 *list, s32 refresh)
void * GetMotionRecordFar(struct MotionObject *object, s32 record_index)
void BattleBackground_LoadFar(s32 mode, s32 resource, s32 level)
s32 AnimationObjects_SelectAnimationFar(struct AnimationObject *state, s32 flags)
struct BattleUnit * UnitGetFar(u32 owner)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
@ HEAP_SLOT_BATTLE_EFFECT
@ HEAP_SLOT_BATTLE_CANVAS
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
#define DMA_HBLANK_HALFWORD_PER_LINE
@ DISPCNT_MODE_1
BG0 and BG1 text, BG2 affine.
#define BLDCNT_EFFECT_BLEND
weighted by REG_BLDALPHA
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
void BattleFx_RunJudgment(struct BattleEffectArgument *effect)
The battle wipes away to a violet sky where a formation flies forward while motes gather into it,...
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...
#define CLAMP(v, low, high)
Keeps v within low to high, the low bound tested first.
void Runtime_ReleaseHeapBlock(s32 slot)
void BattleFx_RunNeptune(struct BattleEffectArgument *effect)
Over dusk clouds a formation of objects flies in through rising spray, gathers a ring of flares into ...
void BattleFx_RunNereid(struct BattleEffectArgument *effect)
A formation of twelve objects sweeps in among embers and columns of fire, and explodes.
void BattleFx_RunMeteor(struct BattleEffectArgument *effect)
A formation rises out of a dissolving starfield and bursts into embers and flashes: the particle stre...
void BattleFx_RunProcne(struct BattleEffectArgument *effect)
A whirlwind lifts the targets, then comets from a block of objects in a violet sky strike them.
struct Projection gProjection
#define Ram_MapCellBuffer
void BattleFx_RunRamses(struct BattleEffectArgument *effect)
Over the desert backdrop a formation stands while an orb circles above it, drops three times throwing...
One animation layer of a sprite: its animation id, frames, running script and timer.
u8 param
SpriteColorMode its pixels are drawn with; 0 when taken.
u8 frame
frame shown, frameBase plus the facing offset; 255 none
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationEntry * entries[4]
its layers; empty ones null
u8 count
layers in use, up to the last one present
The command shared by an effect's caller, dispatcher and handlers.
s32 kind
handler table index; 200 more for a critical hit
s16 actors[8]
the targets' unit ids, count of them
s32 variant
the ability's size, from 0 (Quake, then Earthquake)
The running battle effect's work: its canvas image, 64 particles, the display registers it stages and...
u8 actorTimers[8]
Each target's flash timer in frames, for effect->actors[n]: set by ObjectGroup_UpdateMembers,...
struct BattleEffectArgument * effect
the command being run
A unit's place on the battlefield: its sprite object, resources and animations, its anchor spot and s...
struct SpriteEntry * effectEntry
the effect sprite, or NULL
struct MotionObject * object
NULL once released.
s16 fading
set while a fallen enemy's picture is being removed
struct SpriteEntry * animationEntry
the status icon's sprite, or NULL
The battle's own work: its enemies, units and their objects, the turn's actions, the spoils,...
u16 background
the battle background's id
struct BattleObj slots[14]
u16 palette[128]
the backdrop's colours, before scaling
void BattleFx_RunThor(struct BattleEffectArgument *effect)
The scene plays in two parts on the effect canvas.
void BattleFx_RunTiamat(struct BattleEffectArgument *effect)
The rising embers with a formation of eight objects that sweeps in and explodes at the end.
@ SCENE_EFFECT_BOREAS
BattleFx_RunBoreas (boreas.c).
@ SCENE_EFFECT_NEPTUNE
BattleFx_RunNeptune (neptune.c).
@ SCENE_EFFECT_JUDGMENT
BattleFx_RunJudgment (judgment.c).
@ SCENE_EFFECT_CYBELE
BattleFx_RunCybele (cybele.c).
@ SCENE_EFFECT_NEREID
BattleFx_RunNereid (nereid.c).
@ SCENE_EFFECT_THOR
BattleFx_RunThor (thor.c).
@ SCENE_EFFECT_TIAMAT
BattleFx_RunTiamat (tiamat.c).
@ SCENE_EFFECT_KIRIN
BattleFx_RunKirin (kirin.c).
@ SCENE_EFFECT_RAMSES
BattleFx_RunRamses (ramses.c).
@ SCENE_EFFECT_METEOR
BattleFx_RunMeteor (particle_streams.c).
@ SCENE_EFFECT_PROCNE
BattleFx_RunProcne (procne.c).
@ SCENE_EFFECT_ATALANTA
BattleFx_RunAtalanta (atalanta.c).