7#define HAIL_CHIP_COUNT 64
9#define HAIL_CHIP_CELLS 0x400
10#define HAIL_DJINNI_CELLS 0x65c0
62 angle = (
Random16() & 0x7fff) + 0x4000;
93 x = (((-
Trig_Sin(orbit) * 4)) >> 16) + screenX / 2 - 10;
94 y = (((
Trig_Cos(orbit) * 2)) >> 16) + screenY - 22;
97 y = (
y - frame * 2) + 138;
106 if (frame >= i / 4 + 4) {
111 cell = (chip->
z / 128) & 3;
147 for (i = 0; i != 5; i++)
148 draw[0](canvas, work->sheet, (i << 5) - (frame / 4 & 31), 120 - rise,
151 for (i = 0; i != 5; i++)
152 draw[0](canvas, work->sheet, ((i << 5) + (frame / 4 & 31)) - 32,
164#define GROUND_DJINNI_CELLS 0x65c0
166#define GROUND_FRAMES 96
167#define GROUND_LAUNCHED 8
168#define GROUND_CHIPS 32
169#define GROUND_ROCKS 6
170#define GROUND_CHIPS_PER_ROCK 4
242 s32 angle = frame << 11;
243 s32 x = (((-
Trig_Sin(angle) * 4)) >> 16) + screenX / 2 - 10;
247 y =
y - frame * 2 + 32;
263 if ((frame & 1) == 0) {
285 draw[0](canvas, work->sheet,
x,
y, 24, 48);
287 if ((frame & 3) <= 1)
328 if (frame > i * 2 + 16) {
332 if (frame < i * 2 + 85) {
336 if (rock->
y < 0x140000) {
369 s32 halfRange = (
s32)rangeY / 2;
370 s32 offsetY = ((rangeY - 1) &
Random16()) - halfRange;
371 s32 offsetX = randomX - halfRange;
386#undef HAIL_CHIP_COUNT
387#undef HAIL_CHIP_CELLS
388#undef HAIL_DJINNI_CELLS
390#undef GROUND_DJINNI_CELLS
392#undef GROUND_LAUNCHED
395#undef GROUND_CHIPS_PER_ROCK
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ POSE_DAMAGE
taking damage
BattleEffectDrawRectangle DrawRectangle
void BattleFx_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
void BattleFx_StepPaletteToResource(s32 resourceId)
Moves each RGB555 channel of background colours 0 to 63 one level towards the resource palette.
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.
@ 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_FINISH_CANVAS_ONE_BLITTER()
The same for an effect that drew through one blitter.
#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 gHail_ChipFlips[]
The composite flips a chip may take.
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
void BattleMotion_ApplyVariantMotionFar(s32 id, s32 variant)
void AudioCommand_PlayFar(s32 id)
#define HAIL_CHIP_COUNT
ice chips
void BattleFx_RunHail(struct BattleEffectArgument *effect)
Water burst: after a Mercury Djinni enters, ice chips burst out of the first target and waves rise al...
#define GROUND_DJINNI_CELLS
The small Venus Djinni in the rock toss's sheet.
#define HAIL_DJINNI_CELLS
the small Mercury Djinni
#define GROUND_CHIPS
chip slots
#define GROUND_LAUNCHED
rocks launched
#define GROUND_ROCKS
rocks thrown
#define GROUND_CHIPS_PER_ROCK
chips each rock sheds
void BattleFx_RunGround(struct BattleEffectArgument *effect)
Venus Djinni rock toss: after a Venus Djinni enters, six rocks rise from the user shedding chips,...
void Camera_ApplyShake(s32 rangeX, u32 rangeY)
Shakes the battle view while gBattleFxWork's shakeFrames lasts, moving BG1 and the projection centre ...
#define HAIL_CHIP_CELLS
the ice chips, after the 32x32 wave
@ HEAP_SLOT_BATTLE_EFFECT
@ HEAP_SLOT_BLITTER_ALTERNATE
@ HEAP_SLOT_BATTLE_CANVAS
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
#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 BattleFx_FetchRectangleBlitters(s32 flip, BlitterPair out)
Builds the two usual routines that draw onto the 128x128 canvas, both clipped on both axes.
void EffectPosition_ProjectBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, 16 pixels higher.
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...
struct Projection gProjection
void BattleFx_RunDjinniEntrance(struct BattleEffectArgument *effect, s32 mode, s32 side, s32 anchor, s32 *outX, s32 *outY)
Djinni entrance: sparks swirl around a point that travels from the user to the goal and gather into t...
char ResourceId_VenusDjinnSmallSheet
char ResourceId_MercuryDjinnSmallSheet
char ResourceId_PortalSheet
char ResourceId_IceChipSheet
char ResourceId_WaterSpraySheet
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
s32 prelude
1 plays a prelude: in some effects a Djinni appears
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 savedBg1Y
BG1 scroll restored when a shake ends.
s32 savedBg1X
BG1 scroll restored when a shake ends.
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 x
16.16 fixed-point pixels
#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...