14#define PLASMA_SPARK_COUNT 1024
16#define PLASMA_SPACING 8
17#define PLASMA_SECOND_IMAGE 0x1500
20#define PLASMA_COLUMN_X(side, pillar) gPlasma_Columns[(side)][(pillar)]
88 for (frame = 0; frame != count * 8 - count + 48; frame++) {
97 speed = 704 - frame * 8;
108 for (i = 0; i != count; i++) {
111 if (frame == start) {
115 if (frame >= start && frame < start + 9) {
116 if (frame >= start + 1 && frame < start + 2)
117 draw[0](canvas, work->sheet,
119 if (frame >= start + 2 && frame < start + 4)
126 if (frame == start + 2) {
136 angle = (
Random16() & 0x7fff) - 0x4000;
139 spark->
y = 104 << 16;
154 if (frame == start + 4) {
170 if (spark->
y > 104 << 16) {
173 s32 x = spark->
x >> 16;
177 if (spark->
x >= 0 && x <= 119 && spark->y >= 0) {
207#define SPARK_GROUPS_FLASHES 16
208#define SPARK_GROUPS_SPACING 8
209#define SPARK_GROUPS_RING 12
210#define SPARK_GROUPS_FLASH_DRAWN 18
261 }
else if (mode == 1) {
268 originX = screenPosition.
x / 2;
269 originY = screenPosition.
y + 48;
284 }
else if (mode == 2) {
332 spark->
y = originY << 16;
360 if (mode == 1 || mode == 2) {
379 if (frame >= start && frame < start + 2) {
381 draw[0](canvas, work->sheet,
386 originY - 32, 32, 64);
388 draw[0](canvas, work->sheet,
393 originY - 32, 32, 64);
395 if (frame >= start) {
417 x - 16, y - 32, 32, 64);
427 if (frame > start + 5) {
443 if (spark->
y > 0x6c0000) {
445 }
else if (spark->
x >= 0 && spark->
x < 0x7f0000 && spark->
y >= 0) {
446 s32 y = spark->
y >> 16;
447 s32 x = spark->
x >> 16;
456 if (frame == start + 6) {
470#undef PLASMA_SPARK_COUNT
472#undef PLASMA_SECOND_IMAGE
473#undef PLASMA_COLUMN_X
474#undef SPARK_GROUPS_FLASHES
475#undef SPARK_GROUPS_SPACING
476#undef SPARK_GROUPS_RING
477#undef SPARK_GROUPS_FLASH_DRAWN
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ POSE_DAMAGE
taking damage
struct BattleCamera * gCameraWork
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 ...
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_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_GET_WORK_AND_CANVAS(cursor, work, canvas)
The work block and canvas occupy adjacent slots, starting at HEAP_SLOT_BATTLE_EFFECT.
#define CANVAS_BYTES
The canvas: 128x128 pixels, one byte each, in its heap slot and in VRAM at BG_CHAR_BLOCK(1).
#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_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_END_FRAME(work)
The usual end of an effect frame: counts down the targets' flash timers (ObjectGroup_TickMemberTimers...
u8 gPlasma_FlashCells[]
The flash picture for each three frames at the end of a flash's life.
u16 gPlasma_Sparks[][2]
Plasma, by variant: sparks per pillar and shake frames.
u16 gPlasma_Shapes[][5]
The spark groups, by variant: the SPARK_GROUPS_ columns.
u8 gPlasma_Counts[]
How many pillars strike, by variant.
@ SPARK_GROUPS_BURSTS
bursts, 8 frames apart
@ SPARK_GROUPS_SPARKS
sparks each burst throws
@ SPARK_GROUPS_OFFSET
burst i's offset across, in pixels, at [2 + i]
@ PLASMA_SHAKE_FRAMES
frames the screen shakes at each strike
@ PLASMA_SPARKS
sparks each lightning pillar throws
void BattleMotion_ApplyVariantMotionFar(s32 id, s32 variant)
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
@ 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)
static s32 Iwram_FillWords(void *destination, s32 size, u32 value)
#define Iwram_FillWordsEntry
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
#define PLASMA_SPACING
frames between pillars
#define PLASMA_SPARK_COUNT
sparks
void BattleFx_RunNova(struct BattleEffectArgument *effect)
Bursts at (60, 48), the canvas behind the battle's first layer (priority 1).
#define SPARK_GROUPS_FLASH_DRAWN
a flash is drawn for its last 18 frames
#define SPARK_GROUPS_FLASHES
flashes kept per burst
void BattleFx_RunPlasma(struct BattleEffectArgument *effect)
Pillars of lightning strike one every 8 frames, each with a white flash, throwing sparks up from the ...
void BattleFx_RunSparkGroups(struct BattleEffectArgument *effect, s32 mode)
One to three bursts, 8 frames apart: each flashes, rings itself with twelve smaller flashes that fade...
#define PLASMA_SECOND_IMAGE
the second picture in the sheet
void BattleFx_RunDynamite(struct BattleEffectArgument *effect)
Orange bursts at (60, 64), the canvas in front (priority 0).
#define SPARK_GROUPS_RING
of which drawn as the ring
#define SPARK_GROUPS_SPACING
frames between bursts
#define PLASMA_COLUMN_X(side, pillar)
gPlasma_Columns has seven pillars for each side.
void EffectPosition_ProjectScaledBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, scaled for the battle view, 16 pixels higher.
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,...
char ResourceId_VioletPaletteB
char ResourceId_OrangePaletteB
char ResourceId_LightningBoltSheet
char ResourceId_ParticleSpritesA
char ResourceId_LightningPillarSheet
char ResourceId_FlashBurstSheet
The command shared by an effect's caller, dispatcher and handlers.
s32 actor
the user's unit id
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
The battle camera (struct BattleCamera) as the effects that swing it see it.
u16 scroll
the camera's yaw, in 1/65536 turns
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
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...