27 to = (
u8 *)(column + (
u32)dst - 1);
28 from = (
const u8 *)(offset + (
u32)src);
46#define MERCURY_FRAMES 96
49#define DJINN_ATTACKS_FLAME2_CELLS (17 * 104)
51#define MERCURY_TALL_FLAME_CELLS 0x2a8
52#define MERCURY_FLAME_CELLS 0x990
53#define MERCURY_FLAMES 5
56#define MERCURY_MOTE_SLOTS 256
62#define DJINN_ATTACKS_MOTES_PER_FLAME 32
63#define DJINN_ATTACKS_MOTE_SLOTS 512
126 flame->
y - 17, 65, 34);
142 mote->
x = flame->
x << 16;
143 mote->
y = flame->
y << 16;
156 s32 x = ((
Trig_Sin(frame << 11) * (64 - frame * 2)) >> 17) + 96;
157 s32 y = ((
Trig_Cos(frame << 11) * (64 - frame * 2)) >> 16) + 60;
159 draw[1](canvas, work->sheet,
x - 10,
y - 17, 20, 34);
203#define JUPITER_FRAMES 96
204#define JUPITER_FLAMEBALLS 8
205#define JUPITER_GROUND_Y 95
206#define JUPITER_FLAMEBALL_CELLS 0x320
252 for (i = 0; i != 32; i++) {
272 blit[0](canvas, work->sheet,
x + 86,
y + 28, 20, 40);
282 ball->
y - 32, 40, 64);
293 mote->
x = ball->
x << 16;
294 mote->
y = ball->
y << 16;
341 if (copyPalette != 0)
343 if (skipPalette != 0)
348#define VENUS_FRAMES 96
349#define VENUS_COLUMNS 10
351#define VENUS_FLAME_SHEET 0x2f8
352#define VENUS_COLUMN_CELLS (VENUS_FLAME_SHEET + DJINN_ATTACKS_FLAME2_CELLS)
399 for (i = 0; i != 32; i++) {
416 draw[1](canvas, work->sheet,
x + 22,
y + 29, 20, 38);
425 if (frame >= i * 4 + 16) {
427 column->
y - 32, 34, 65);
428 if (frame == i * 4 + 16) {
429 for (j = 0; j != 16; j++) {
434 direction = (
Random16() & 0x7fff) + 0x4000;
436 mote->
x = column->
x << 16;
437 mote->
y = (column->
y + 16) << 16;
472#define MARS_FRAMES 112
473#define MARS_STRIKE_FRAME 32
475#define MARS_EMBERS_PER_FLAME 16
476#define MARS_ORB_CELLS 0x320
532 s32 angle = index << 11;
535 step->
y = ((
Trig_Cos(angle) * 4) >> 16) + 52;
537 step->
x = 32 - step->
x;
543 mote->
x = (((
Random16() & 15) + step->
x) - 8) << 16;
573 if (frame >= 20 && frame <= 31) {
575 draw[1](canvas, work->sheet, 146 - frame * 4, diveY, 20, 40);
577 blitters[0](canvas, work->sheet, 50, 20, 20, 40);
602 step->
x - (width >> 1),
630 size = (index & 1) + 3;
637 step->
z = angle + 0x800;
638 if (step->
z > 0xffff)
639 step->
z = angle + 0x800 - 0xffff;
661#undef DJINN_ATTACKS_MOTES_PER_FLAME
662#undef DJINN_ATTACKS_MOTE_SLOTS
664#undef JUPITER_FLAMEBALLS
665#undef JUPITER_GROUND_Y
669#undef MARS_STRIKE_FRAME
671#undef MARS_EMBERS_PER_FLAME
672#undef DJINN_ATTACKS_FLAME2_CELLS
673#undef MERCURY_TALL_FLAME_CELLS
674#undef MERCURY_FLAME_CELLS
675#undef JUPITER_FLAMEBALL_CELLS
676#undef VENUS_FLAME_SHEET
677#undef VENUS_COLUMN_CELLS
679#undef MERCURY_MOTE_SLOTS
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_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
#define MERCURY_FLAMES
flames thrown
#define DJINN_ATTACKS_MOTE_SLOTS
void BattleFx_RunMars(struct BattleEffectArgument *effect)
Mars Djinni flames: a glowing orb flares, the small Mars Djinni dives to the ground,...
#define MARS_STRIKE_FRAME
the Djinni strikes the ground
#define VENUS_FLAME_SHEET
The blue flame sheet, after the 20x38 Djinni, and its second flame.
#define JUPITER_GROUND_Y
where the flameballs land
void Graphics_TransposeCopy(const u8 *src, u8 *dst, s32 w, s32 h)
Copies a w x h byte picture into an h x w one turned 90 degrees clockwise: the top row of src becomes...
#define DJINN_ATTACKS_MOTES_PER_FLAME
slots for each flame's motes
#define MERCURY_MOTE_SLOTS
The mote slots Mercury walks: room for more than MERCURY_FLAMES * DJINN_ATTACKS_MOTES_PER_FLAME.
#define DJINN_ATTACKS_FLAME2_CELLS
The blue flame sheet holds a 17x104 flame, then a 34x65 one; Mercury turns both on their side after i...
void BattleFx_RunMercury(struct BattleEffectArgument *effect)
Mercury Djinni flames: the small Mercury Djinni spirals around (96, 60) and fires five blue flames to...
#define JUPITER_FLAMEBALLS
flameballs that fall
#define VENUS_COLUMNS
columns of flame that rise
void BattleFx_RunJupiter(struct BattleEffectArgument *effect)
Jupiter Djinni fall: the small Jupiter Djinni spirals while eight flameballs fall from the top right ...
void Resource_LoadAndDecompress(s32 id, void *dst, s32 skipPalette, s32 copyPalette)
Decompresses a resource whose first 128 bytes may be a palette.
#define MARS_FLAMES
flames along the arc
#define JUPITER_FLAMEBALL_CELLS
after the 20x40 Djinni
#define MARS_ORB_CELLS
six 40x40 orb pictures, after the Djinni
#define VENUS_COLUMN_CELLS
#define MERCURY_FLAME_CELLS
65x34
#define MARS_EMBERS_PER_FLAME
embers in each flame
void BattleFx_RunVenus(struct BattleEffectArgument *effect)
Venus Djinni columns: the small Venus Djinni sways while ten columns of flame in its colours rise fro...
#define MERCURY_TALL_FLAME_CELLS
The first flame turned, 104x17, after the 20x34 Djinni; never drawn.
What every part of the battle effect object shares: its includes, macros and frame-loop helpers.
#define EFFECT_DRAW_MOTE(draw, canvas, sheet, x, y, size)
Particle sheets hold ten mote cells, 1x2 to 10x20 pixels.
@ CANVAS_COPY_AND_FADE
copy, keeping 50% or 75% (transferValue) of each pixel in the canvas for the next 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_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 EFFECT_GET_SLOTS(slots, cursor, work, canvas)
Starts at the effect's entry in the whole work-slot array.
#define EFFECT_END_FRAME(work)
The usual end of an effect frame: counts down the targets' flash timers (ObjectGroup_TickMemberTimers...
#define EFFECT_STRIKE_TARGET(effect, i, frames, motion)
Strikes target i: it flashes white in its damage pose for frames frames and plays battle motion motio...
u16 gBattleFx_PuffArcCells[]
u8 gBattleFx_PuffArcCellHeights[]
u8 gBattleFx_PuffArcCellBiasY[]
u16 gBattleFx_MoteCells[]
Mote cells: particle sheets hold ten, cell n (from 0) n + 1 pixels wide and twice that tall.
u8 gBattleFx_PuffArcCellWidths[]
u8 gDjinnAttacks_LaunchFrames[]
The frames on which the Djinni fires each of its five flames.
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 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)
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.
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_VenusDjinnSmallSheet
char ResourceId_MarsDjinnSmallSheet
char ResourceId_MercuryDjinnSmallSheet
char ResourceId_BlueFlameSheet
char ResourceId_ParticleSpritesA
char ResourceId_JupiterDjinnSmallSheet
char ResourceId_EmberStreakSheet
char ResourceId_FlameballSheet
char ResourceId_GlowOrbSheet
s32 Resource_DecodeType01(const void *source, void *destination)
Decodes a type-01 resource and returns its unpacked byte count.
The command shared by an effect's caller, dispatcher and handlers.
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 BattleEffectArgument * effect
the command being run
struct EffectStep particles[64]
free while variant is -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 z
16.16 fixed-point pixels
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
s32 velocityZ
16.16 fixed-point pixels per frame
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
#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...