16#define HELM_SPLITTER_FRAMES 70
17#define HELM_SPLITTER_STRIKE_FRAME 18
19#define HELM_SPLITTER_STAR_CELLS 0x3e80
20#define HELM_SPLITTER_CLEARED_SLOTS 1024
21#define HELM_SPLITTER_SPARKS 16
22#define HELM_SPLITTER_SPARK_SLOTS 128
73 s32 diffX = target->
x -
object->x;
74 s32 startX =
object->x;
75 s32 deltaX = diffX * 80 / 100;
76 s32 diffZ = target->
z -
object->z;
77 s32 startZ =
object->z;
78 s32 deltaZ = diffZ * 80 / 100;
79 s32 x = startX + deltaX;
80 s32 z = startZ + deltaZ;
81 s32 shortX = deltaX >> 8;
82 s32 shortZ = deltaZ >> 8;
85 distance =
Iwram_Sqrt(shortX * shortX + shortZ * shortZ);
86 distance = (distance << 8) / 20;
87 object->acceleration = distance;
88 object->speedLimit = distance;
89 object->snapToTarget = 1;
90 object->velocityY = 0x70000;
91 object->verticalMotionStrength = 0xdeb8;
92 object->verticalMotionPhase = 0;
93 object->autoFaceMotion = 1;
107 if (frame >= 8 && frame <= 23) {
108 s32 cell = (frame - 8) / 2;
156 if (spark->
y > 0x680000) {
158 }
else if ((spark->
x >= 0 && spark->
x <= 0x7effff) && spark->
y >= 0) {
159 s32 sx = spark->
x >> 16;
160 s32 sy = spark->
y >> 16;
164 (((frame + i) / 4 % 6) << 8),
165 sx - 8, sy - 8, 16, 16);
192 static struct SpriteScale normalScale = {{{0x10000, 0x10000}}};
193 static struct SpriteScale largeScale = {{{0x14000, 0x14000}}};
207 for (i = 0; i != 9; i++) {
208 pos.
x = (i % 3 << 21) +
x;
209 pos.
y = (i / 3 << 21) + z;
214 for (i = 0; i != 12; i++) {
221 for (i = 0; i != 8; i++) {
228 for (i = 0; i != 8; i++) {
238#define IMPACT_BURST_SHARD_CELLS 0x59d8
239#define IMPACT_BURST_FRAGMENT_WIDTH 12
240#define IMPACT_BURST_FRAGMENT_HEIGHT 24
242#define IMPACT_BURST_FRAMES 72
243#define IMPACT_BURST_FRAGMENTS 3
244#define IMPACT_BURST_DRAWN_LARGE 30
245#define IMPACT_BURST_DRAWN_SMALL 60
246#define IMPACT_BURST_LARGE_SPARKS 64
247#define IMPACT_BURST_SMALL_SPARKS 64
249#define IMPACT_BURST_FIRST_FRAGMENT 61
319 -((
Trig_Cos(i * 0x5555) * 32) >> 5);
346 s32 cell = (frame - 8) / 5;
357 (
x >> 16) - (width >> 1), (
y >> 16) - (height >> 1), width,
373 if (frame > i / 2 && particle->
variant > 0) {
380 size = particle->
variant / 16 + 3;
390 if (frame > 35 && particle->
variant > 0) {
397 size = particle->
variant / 16 + 1;
409 if (frame >= 36 && frame <= 63) {
415 cell = (frame - 36) / 7;
440#undef HELM_SPLITTER_FRAMES
441#undef HELM_SPLITTER_STRIKE_FRAME
442#undef HELM_SPLITTER_STAR_CELLS
443#undef HELM_SPLITTER_CLEARED_SLOTS
444#undef HELM_SPLITTER_SPARKS
445#undef HELM_SPLITTER_SPARK_SLOTS
446#undef IMPACT_BURST_SHARD_CELLS
447#undef IMPACT_BURST_FRAGMENT_WIDTH
448#undef IMPACT_BURST_FRAGMENT_HEIGHT
449#undef IMPACT_BURST_FRAMES
450#undef IMPACT_BURST_FRAGMENTS
451#undef IMPACT_BURST_DRAWN_LARGE
452#undef IMPACT_BURST_DRAWN_SMALL
453#undef IMPACT_BURST_LARGE_SPARKS
454#undef IMPACT_BURST_SMALL_SPARKS
455#undef IMPACT_BURST_FIRST_FRAGMENT
@ 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 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.
#define EFFECT_PRESENT_FRAME(work)
Ends a frame of a canvas effect: marks the canvas ready for the transfer callback,...
@ CANVAS_COPY_AND_FADE
copy, keeping 50% or 75% (transferValue) of each pixel in the canvas for the next frame
#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_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_BEGIN_NARROW_CANVAS(bgControl)
Opens the canvas layer at the canvas's own width, one texel per pixel, where BattleFx_BeginCanvasLaye...
u8 gHelmSplitter_RightEightZ[]
u8 gHelmSplitter_SmallEightZ[]
u8 gHelmSplitter_RightEightX[]
u8 gHelmSplitter_ImpactBurstCellHeights[]
u8 gHelmSplitter_TwelveZ[]
u8 gHelmSplitter_TwelveX[]
u8 gHelmSplitter_CellHeights[]
u8 gHelmSplitter_CellWidths[]
s8 gHelmSplitter_CellBiasY[]
u16 gHelmSplitter_Cells[]
u8 gHelmSplitter_ImpactBurstCellWidths[]
s8 gHelmSplitter_CellBiasX[]
u8 gHelmSplitter_SmallEightX[]
u16 gHelmSplitter_ImpactBurstCells[]
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
void BattleMotion_ApplyVariantMotionFar(s32 id, s32 variant)
void Object_ApplyProjectedPlacementFar(struct AnimationObject *sprite, const struct SpritePlacement *position, const struct SpriteScale *scale, s32 facing)
Far call to Render_ApplyProjectedPlacement.
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void Object_SetMoveTargetFar(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
void ObjectDispatch_StartIdleFar(struct DispatchObject *obj)
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 WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
#define HELM_SPLITTER_SPARK_SLOTS
spark slots moved and drawn
#define IMPACT_BURST_FRAMES
#define HELM_SPLITTER_STAR_CELLS
The pink star animation, after the swirl.
#define IMPACT_BURST_DRAWN_SMALL
small sparks drawn
#define IMPACT_BURST_LARGE_SPARKS
large sparks thrown
void BattleFx_RunImpactBurst(s32 formation, s32 x, s32 y)
Opens an impact flash and scatters sparks and fragments, keeping the effect's objects in formation fo...
#define HELM_SPLITTER_SPARKS
sparks scattered by the strike
#define IMPACT_BURST_FRAGMENTS
fragments, work->particles 61 to 63
#define IMPACT_BURST_SMALL_SPARKS
small sparks thrown
#define IMPACT_BURST_FRAGMENT_WIDTH
each fragment picture's width
#define HELM_SPLITTER_FRAMES
#define IMPACT_BURST_DRAWN_LARGE
large sparks drawn
#define HELM_SPLITTER_CLEARED_SLOTS
PARTICLES slots freed first.
#define IMPACT_BURST_FRAGMENT_HEIGHT
and height
void BattleFx_RunHelmSplitter(struct BattleEffectArgument *effect)
The user leaps at the first target and strikes through a fire swirl; on frame 18 the target flashes a...
#define IMPACT_BURST_FIRST_FRAGMENT
the first fragment in work->particles
#define IMPACT_BURST_SHARD_CELLS
The fragment pictures in the sheet, four of 12x24, after the flash.
#define HELM_SPLITTER_STRIKE_FRAME
the swirl strikes the target
void BattleFx_PlaceFormationObjects(s32 formation, s32 x, s32 z)
Arranges work->objects in a formation; x and z are its origin in 16.16 pixels.
#define Q_8_8(n)
The BG2/BG3 affine matrix entries are signed 8.8 fixed point: texels stepped per screen pixel.
#define BLDCNT_EFFECT_BLEND
weighted by REG_BLDALPHA
static s32 Iwram_Sqrt(s32 value)
static s32 Iwram_ClearWords(void *destination, 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 EffectPosition_ProjectBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, 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_FlareImage
char ResourceId_PinkStarSheet
char ResourceId_FireSwirlSheet
char ResourceId_FlareSheet
char ResourceId_ParticleSpritesA
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
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 shakeFrames
shake frames left; Camera_ApplyShake counts down
struct AnimationObject * objects[16]
the effect's animation objects
struct BattleEffectArgument * effect
the command being run
struct EffectStep particles[64]
free while variant is -1
struct MotionObject * object
NULL once released.
A field object as the object dispatcher's far calls take it.
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
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
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
A sprite's screen position and its two vertical offsets, in 16.16 pixels.
s32 x
screen x of the sprite's centre
s32 y
screen y at the ground; sets the depth slot
s32 groundHeight
how far the shadow is raised above y
s32 height
how far the image is raised above y
Horizontal and vertical sprite scale; 0x10000 is the original size.
#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...