12#define TARGET_STRIKE_SPARKS ((struct EffectStep *)(Ram_MapCellBuffer + 0x3800))
15#define TARGET_STRIKE_SMOKE_CELLS 0x3200
18#define TARGET_STRIKE_VALUE(mode, field) gTargetStrike_Records[(mode)][(field)]
175 work->sheet + 0xc80, 0, 0);
178 work->sheet + 0xc80, 0, 0);
208 for (k = 0; k != 1; k++) {
210 for (i = 0; i != 64; i++) {
216 ((
Random16() & 255) - 128) << 9, 0);
219 for (i = 0; i != 128; i++) {
228 for (i = 0; i != 512; i++) {
264 targetPosition.
y += (alternate.
y - targetPosition.
y) / 2;
273 s32 length = span * 4;
279 if (frame < span * 6) {
318 for (i = 0; i != 512; i++)
324 for (i = 0; i != 32; i++) {
337 for (i = 0; i != 8; i++) {
352 if (frame >= 12 && frame <= 31)
354 }
else if (frame < length + 4) {
360 if (frame < length) {
373 canvas, work->sheet + stage * (18 * 48) + 0xc80,
374 targetPosition.
x / 2 - 18, 56, 18, 48);
380 canvas, work->sheet + stage * (18 * 48) + 0xc80, targetPosition.
x / 2,
400 for (i = 0; i != 64; i++) {
411 for (i = 0; i != 8; i++) {
422 for (i = 0; i != 16; i++)
438 for (i = 0; i != 3; i++) {
439 s32 image = frame & 3;
446 x = targetPosition.
x / 2 + (
Trig_Sin(angle) * (radius + 4) >> 17) -
448 y = targetPosition.
y - (
Trig_Cos(angle) * (radius + 4) >> 17) -
468 for (k = 0; k != 1; k++) {
472 for (i = 0; i != 64; i++) {
478 draw[i & 1](canvas, work->sheet + picture * (24 * 48) + wispSheet,
500 for (i = 0; i != 64; i++) {
507 position.
x - ((
u32)size >> 1), position.
y - size, size,
512 s32 dx = (source->
x - step->
x) >> 8;
513 s32 dy = (source->
y - step->
y + 0x140000) >> 8;
514 s32 dz = (source->
z - step->
z) >> 8;
519 if ((dx >= -0xfff && dx <= 0xfff) &&
520 (dz >= -0xfff && dz <= 0xfff))
528 for (i = 0; i != 128; i++) {
558#undef TARGET_STRIKE_SPARKS
559#undef TARGET_STRIKE_VALUE
560#undef TARGET_STRIKE_SMOKE_CELLS
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ POSE_DAMAGE
taking damage
BattleEffectDrawRectangle DrawRectangle
void BattleFx_ProcessPendingGraphicsTransfer(void)
Copies the canvas to VRAM once the effect has finished drawing a frame (transferPending): the 128x128...
void BattleFx_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
void BattleFx_EndCanvasLayer(void)
Closes the canvas layer: plays the closing sound, restores BG1's scroll and the projection centre,...
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_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_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_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_VIEW_FROM_CAMERA(camera)
Starts a frame's 3D projection from the battle camera: resets the transform, then looks from camera->...
#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...
u8 gTargetStrike_Heights[]
u8 gBattleFx_GlintCellHeights[]
u16 gBattleFx_MoteCells[]
Mote cells: particle sheets hold ten, cell n (from 0) n + 1 pixels wide and twice that tall.
u16 gTargetStrike_Offsets[]
u8 gTargetStrike_Widths[]
u16 gBattleFx_GlintCells[]
u8 gTargetStrike_GlintDrawFlags[]
The flips a glint may be drawn in.
u8 gBattleFx_GlintCellWidths[]
u8 gTargetStrike_ColumnStages[]
The column stage shown by each picture of a rise.
#define STRIKE_KIND_SLASH
sideways slashes
#define STRIKE_HEAVY
one heavy hit: a big shake and the target recoils
#define STRIKE_GLINTS
glints sparkle around the target
#define STRIKE_SMOKE
each hit raises smoke puffs from the target's feet
#define STRIKE_ABSORB
motes fly out of the target and back into the user
#define STRIKE_SPARKS
each hit scatters sparks
#define STRIKE_KIND_COLUMN
columns of light
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
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)
#define SET_VELOCITY(p, vx, vy, vz)
#define SET_POSITION(p, px, py, pz)
Sets the position or the velocity of a particle, a piece of debris or an object in one statement.
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
void Runtime_ReleaseHeapBlock(s32 slot)
void EffectPosition_ProjectBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, 16 pixels higher.
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,...
void EffectStep_AdvanceWithGravity3D(struct EffectStep *step, s32 damping, s32 gravity)
Moves a particle one frame in three dimensions: adds its velocity, then gravity to its vertical speed...
s32 EffectPosition_ProjectPoint(const void *point, struct EffectPosition *position)
Projects a point in the current transform onto the screen, 16 pixels higher, and returns the projecti...
char ResourceId_BlueBeamSheet
char ResourceId_PinkPalette
char ResourceId_TornadoSheet
char ResourceId_LimePalette
char ResourceId_BeamSequenceImage
char ResourceId_MarsDjinnSheet
char ResourceId_LightningBoltSheet
char ResourceId_TwelveModeImage
char ResourceId_SmokeSheet
char ResourceId_ParticleSpritesA
char ResourceId_EmberStreakSheet
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
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 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
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
struct MotionObject * object
NULL once released.
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 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
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
s32 z
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
s32 x
16.16 fixed-point pixels
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
void BattleFx_RunDrainFang(struct BattleEffectArgument *effect)
Three additive columns that drain the target with large motes, Mars Djinn colours.
#define TARGET_STRIKE_VALUE(mode, field)
Column field of style mode's row of gTargetStrike_Records.
void BattleFx_RunTargetStrike(struct BattleEffectArgument *effect, s32 mode)
Strikes the first target TARGET_STRIKE_HITS times with a sideways slash or a column of light,...
@ TARGET_STRIKE_KIND
STRIKE_KIND_SLASH or STRIKE_KIND_COLUMN.
@ TARGET_STRIKE_IMAGE_FRAMES
frames each strike image is shown
@ TARGET_STRIKE_FLAGS
STRIKE_SMOKE and so on.
@ TARGET_STRIKE_COMPOSITE
how the columns are drawn (COMPOSITE_MAX or _ADDITIVE)
@ TARGET_STRIKE_COLOUR
background palette, 0 to 5 (see below)
@ TARGET_STRIKE_FRAMES
length of the effect in frames
@ TARGET_STRIKE_HITS
how many times the target is struck
#define TARGET_STRIKE_SPARKS
The strike sparks, 512 of them, live after the motes in PARTICLES.
@ TARGET_STRIKE_STYLE_PINK_SMOKE_COLUMNS
@ TARGET_STRIKE_STYLE_LIGHTNING_GLINT_SLASH
@ TARGET_STRIKE_STYLE_LIGHTNING_SPARK_SLASHES
@ TARGET_STRIKE_STYLE_LIGHTNING_GLINT_COLUMNS
@ TARGET_STRIKE_STYLE_MARS_ADDITIVE_DRAIN_COLUMNS
@ TARGET_STRIKE_STYLE_MARS_DRAIN_COLUMNS
@ TARGET_STRIKE_STYLE_MARS_SMOKE_COLUMN
@ TARGET_STRIKE_STYLE_EMBER_DRAIN_COLUMNS
@ TARGET_STRIKE_STYLE_BLUE_SPARK_COLUMNS
@ TARGET_STRIKE_STYLE_MARS_HEAVY_SLASH
@ TARGET_STRIKE_STYLE_LIME_SMOKE_COLUMN
@ TARGET_STRIKE_STYLE_LIME_SMOKE_SLASH
void BattleFx_RunElectricBite(struct BattleEffectArgument *effect)
Three lightning columns with glints.
void BattleFx_RunTwinBeaks(struct BattleEffectArgument *effect)
Two slashes with sparks, lightning colours.
#define TARGET_STRIKE_SMOKE_CELLS
The smoke pictures in the sheet: six 24x48 puffs.
void BattleFx_RunRabidFang(struct BattleEffectArgument *effect)
One column with smoke, Mars Djinn colours.
void BattleFx_RunAcidBite(struct BattleEffectArgument *effect)
Three pink columns with smoke.
void BattleFx_RunPoisonousBite(struct BattleEffectArgument *effect)
One lime column with smoke.
void BattleFx_RunPoisonTail(struct BattleEffectArgument *effect)
One lime slash with smoke.
void BattleFx_RunNumbingSting(struct BattleEffectArgument *effect)
One slash with glints, lightning colours.
void BattleFx_RunVampiricFang(struct BattleEffectArgument *effect)
Three columns that drain the target, Mars Djinn colours.
void BattleFx_RunDoubleFang(struct BattleEffectArgument *effect)
Two blue columns with sparks.
void BattleFx_RunCannibalFang(struct BattleEffectArgument *effect)
Three ember columns that drain the target into the user.
void BattleFx_RunMortalBlow(struct BattleEffectArgument *effect)
One heavy slash with sparks, Mars Djinn colours.
#define EFFECT_BLITTERS
The work slots read as blitters: EFFECT_BLITTERS[HEAP_SLOT_BLITTER] and EFFECT_BLITTERS[HEAP_SLOT_BLI...
#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...