7#define PRISM_GROUND_Y 0x380000
8#define PRISM_SHARD_CELLS (32 * 64)
86 speed = 2496 - frame * 24;
103 if (crystal->
z == 1) {
111 for (j = 0; j != 16; j++) {
112 cell = (j % 5) * 3 + (shards[i * 16 + j].variant / 96) % 3;
113 shard = &shards[i * 16 + j];
122 if (shard->
z > 1 && (frame & 1))
125 }
else if (frame >= crystal->
variant) {
134 for (j = 0; j != 16; j++) {
135 shard = &shards[i * 16 + j];
193 phase = frame * 0x400;
194 redOffset = (
Trig_Sin(phase + redPhase) * 16) >> 15;
195 greenOffset = (
Trig_Sin(phase + greenPhase) * 16) >> 15;
196 blueOffset = (
Trig_Sin(phase + bluePhase) * 16) >> 15;
200 output = &palette[1];
206 red = (index + redOffset) / 2;
207 green = (index + greenOffset) / 2;
208 blue = (index + blueOffset) / 2;
214 *output++ =
RGB(red, green, blue);
216 }
while (index != 64);
222#undef PRISM_SHARD_CELLS
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ POSE_DAMAGE
taking damage
struct BattleCamera * gCameraWork
#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 ...
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_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_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_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_END_FRAME(work)
The usual end of an effect frame: counts down the targets' flash timers (ObjectGroup_TickMemberTimers...
u8 gPrism_ShardStarts[][2]
Where each of the 16 shards starts in the crystal: x, then y.
s32 gPrism_ShardOffsets[]
u8 gPrism_Counts[][2]
Prism, by variant: crystals and frames.
@ PRISM_CRYSTAL_COUNT
crystals drawn
@ PRISM_FRAMES
the effect's frames
@ PRISM_SHARD_START_X
pixels from the crystal's left
@ PRISM_SHARD_START_Y
pixels from its top
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_BATTLE_EFFECT
#define RGB(r, g, b)
A 15-bit colour from its red, green and blue levels (0 to 31 each), as the palette stores it: blue in...
#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)
#define CLAMP(v, low, high)
Keeps v within low to high, the low bound tested first.
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,...
void Graphics_UpdatePhasePalette(s32 frame, s32 redPhase, s32 greenPhase, s32 bluePhase)
Rebuilds the background palette's first ramp as a grey ramp whose red, green and blue each sway with ...
#define PRISM_GROUND_Y
y 56, where the crystals shatter
void BattleFx_RunPrism(struct BattleEffectArgument *effect)
Crystals drop out of the sky onto the targets' side, 8 frames apart, and shatter on the ground into 1...
#define PRISM_SHARD_CELLS
the shards, after the 32x64 crystal
char ResourceId_CrystalSheet
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 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
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
#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...