11#define FALLING_BUILD_SLANTED_WINDOW(line, i, last, slant, span) \
12 for ((i) = 0; (i) != 160; (i)++) { \
13 if ((i) >= 8 && (i) <= (last)) \
14 (line)[i] = (slant); \
15 else if ((i) <= 135) \
18 (line)[i] = WINDOW_SPAN_INVERTED; \
39#define FALLING_LAND_Y 0x27f
88 y -= 64, i++, slant -= 8) {
164 s32 x = shard->
x / 8;
165 s32 y = shard->
y / 8;
167 draw[work->
effect->
variant == 2 ? 1 : 0](canvas, work->sheet,
x,
y, 32,
189 s32 x = shard->
x / 8;
190 s32 y = shard->
y / 8;
197 canvas, work->sheet + 0x400 + ((shard->
variant / 3) << 10),
x,
y,
207 puff->
x = (((
Random16() & 31) + shard->
x / 8) << 3) + 8;
208 puff->
y = ((
Random16() & 15) + shard->
y / 8 - 15) << 3;
263#define FALLING_BOLT_SPARKS ((struct BoltSparkBuffer *)Ram_MapCellBuffer)
265#define DOUSE_FALLING_CELL 0x604
266#define DOUSE_FLASH_CELL 0x844
267#define DOUSE_BURST_CELL 0xa84
342 ((0x34 - i / 2) << 8) | (0xb4 - i / 2),
347 line, i, 103, ((i / 2 + 60) << 8) | (i / 2 + 188),
WIN_RANGE(112, 240));
403 spark->
x = (
x + 12) << 16;
455#undef FALLING_BUILD_SLANTED_WINDOW
457#undef FALLING_BOLT_SPARKS
458#undef DOUSE_FALLING_CELL
459#undef DOUSE_FLASH_CELL
460#undef DOUSE_BURST_CELL
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ SPRITE_COLOR_BLUE_TINT
blue raised to full
@ 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 ObjectGroup_TickMemberTimers(void)
Counts down each target's flash timer, which ObjectGroup_UpdateMembers starts; when one runs out,...
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,...
void BattleFx_ConfigureEffectDisplay(void)
Puts the battle screen back into the display state every effect starts from and ends with: no blendin...
void BattleFx_ArmWin0HBlankDma(void)
Restarts DMA 0 as an HBlank transfer of one WIN0H value a line from PARTICLES (Ram_MapCellBuffer),...
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.
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_PRESENT_FRAME(work)
Ends a frame of a canvas effect: marks the canvas ready for the transfer callback,...
#define EFFECT_DRAW_FLARE(draw, canvas, sheet, x, y, size)
Draws flare cell size of sheet, a square size pixels from its centre to each edge,...
#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_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_SLOT(slots, slot)
A work slot read through a pointer to the effect's own slot, gWorkSlot[HEAP_SLOT_BATTLE_EFFECT].
#define EFFECT_FINISH_CANVAS()
The usual end of a canvas effect: stops the transfer callback before freeing what it reads,...
#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_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 EFFECT_GET_SLOTS(slots, cursor, work, canvas)
Starts at the effect's entry in the whole work-slot array.
#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...
#define EFFECT_BEGIN_NARROW_CANVAS(bgControl)
Opens the canvas layer at the canvas's own width, one texel per pixel, where BattleFx_BeginCanvasLaye...
u8 gBattleFx_PuffSizes[]
Each puff cell's side.
u8 gFalling_IceCounts[][2]
Ice, by variant: shards and frames (ICE_SHARD_COUNT, ICE_FRAMES).
u16 gBattleFx_PuffCells[]
Nine square puff cells, read by the falling, frost, healing, Djinni heal and Boreas parts.
u8 gFalling_Counts[][4]
Douse, by variant: the FALLING_BOLT_ columns.
@ FALLING_BOLT_DURATION
the effect's frames
@ FALLING_BOLT_WAVE_COUNT
bolts that drop, of the 64 placed
@ FALLING_BOLT_SPACING
pixels between bolts along the slant
@ FALLING_BOLT_SPARKS_PER_BOLT
sparks each bolt throws
@ ICE_FRAMES
the effect's frames; the damage shows 16 before
@ ICE_SHARD_COUNT
shards that fall
void BattleFx_RunIce(struct BattleEffectArgument *effect)
Ice shards rain down diagonally onto the targets' side of the field and shatter into puffs of sparkle...
@ FALLING_SHARD_PUFF_COUNT
#define FALLING_BUILD_SLANTED_WINDOW(line, i, last, slant, span)
Fills window 0's per-scanline edges for the falling shards and bolts: lines 8 to last take slant,...
#define FALLING_BOLT_SPARKS
Ram_MapCellBuffer seen as Douse's struct BoltSparkBuffer.
@ FALLING_BOLT_SPARK_COUNT
#define DOUSE_FLASH_CELL
the landing flash picture in the sheet
#define FALLING_LAND_Y
A falling shard or bolt keeps falling while its y (in eighths of a pixel) is at most this,...
#define DOUSE_BURST_CELL
the 42x42 burst picture in the sheet
void BattleFx_RunDouse(struct BattleEffectArgument *effect)
Blue bolts streak down diagonally onto the targets' side of the field, each bursting into a fountain ...
#define DOUSE_FALLING_CELL
the falling bolt picture in the sheet
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
#define BGCNT_PRIORITY(n)
#define BLDCNT_EFFECT_BLEND
weighted by REG_BLDALPHA
#define WIN_RANGE(start, end)
A REG_WINxH or REG_WINxV value: the window covers start up to, but not including, end.
#define BGCNT_WRAP
Affine backgrounds only: wrap around instead of showing the backdrop.
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,...
#define Ram_MapCellBuffer
char ResourceId_BlueBeamSheet
char ResourceId_SparkleDots
char ResourceId_IceShardSheet
char ResourceId_ParticleSpritesD
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...
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.
s32 side
1 when the targets are the party, 0 for enemies
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...
s32 frame
frame counter some effects keep, from 0
s32 shakeFrames
shake frames left; Camera_ApplyShake counts down
s32 transferMode
How the canvas transfer callbacks treat the canvas after each copy (enum CanvasTransferMode in effect...
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
Ram_MapCellBuffer as the falling bolts use it: window 0's scanline table, then the bolts' sparks.
u16 lines[160]
WIN0H for each screen line, read by the HBlank DMA.
struct EffectStep sparks[FALLING_BOLT_SPARK_COUNT]
free while -1
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
The heap's 64 work slots, the first two holding the next free EWRAM and IWRAM addresses.
#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...