13#define STREAKS_VALUE(mode, n) gStreaks_Records[(mode)][(n)]
14#define STREAKS_ANIMATE 0
16#define STREAKS_MOTION 2
18#define STREAKS_SHAKE 3
81#define STREAKS_SPACING 6
82#define STREAKS_FLIGHT 24
83#define STREAKS_TARGET_DELAY 32
178 for (streakIndex = 0; streakIndex != streaks; streakIndex++) {
189 for (frame = 0; frame != totalFrames; frame++) {
190 s32 *row = work->bg2xLines;
196 for (k = 0; k != 160; k++)
197 *row++ = (0x80000 -
Trig_Sin((frame + k) << 12) * 2) >> 10;
199 if (frame > totalFrames - 16)
204 for (streakIndex = 0; streakIndex != streaks; streakIndex++) {
208 &work->
particles[k * streaks + streakIndex];
219 u8 *cell = &work->sheet[step * 800 + frame / 2 % 3 * 4800];
221 drawUpper(canvas, cell, position.
x - 10, position.
y - 40, 20,
223 drawLower(canvas, cell, position.
x - 10, position.
y, 20, 40);
225 u8 *cell = &work->sheet[step * 800 + 2 * 4800];
227 drawUpper(canvas, cell, position.
x - 10, position.
y - 40, 20,
229 drawLower(canvas, cell, position.
x - 10, position.
y, 20, 40);
315#define MOTE_FOUNTAIN_FOUNTAIN_FRAMES 128
385 -(
Trig_Cos(angle) * (speed + 32) << 1) >> 8);
398 if (frame >= i / 32 * 8 && mote->
variant >= 0) {
409 if (position.
depth <= 313)
410 position.
depth = 314;
411 if (position.
depth > 634)
412 position.
depth = 634;
413 size = 6 - (position.
depth - 314) / 64;
430 if (frame == i * 8 + 48) {
438 if (frame == i * 8 + 48) {
453#undef STREAKS_ANIMATE
458#undef STREAKS_SPACING
460#undef STREAKS_TARGET_DELAY
461#undef MOTE_FOUNTAIN_FOUNTAIN_FRAMES
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ POSE_DAMAGE
taking damage
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_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_VIEW_FROM_CAMERA(camera)
Starts a frame's 3D projection from the battle camera: resets the transform, then looks from camera->...
s8 gStreaks_Tremble[]
Pixels the target trembles by, frame by frame.
struct BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
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
@ 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.
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.
#define SET_VECTOR(v, x, y, z)
Sets the x, y and z of a three-part vector: a position about to be projected, a per-frame step,...
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
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_CyanPalette
char ResourceId_FiveModeImage
char ResourceId_VioletPaletteD
char ResourceId_LimePalette
char ResourceId_EarthWallSheet
char ResourceId_ParticleSpritesA
char ResourceId_RedPaletteB
char ResourceId_OrangePaletteA
char ResourceId_EmberStreakSheet
#define STREAKS_VALUE(mode, n)
Column n of style mode's row of gStreaks_Records, four flags a style.
#define STREAKS_SPACING
frames between streaks
void BattleFx_RunWickedHowl(struct BattleEffectArgument *effect)
Red streaks.
void BattleFx_RunStreakVolley(struct BattleEffectArgument *effect, s32 mode)
Fires STREAKS_MAX streaks at each target from 20 pixels above the user, one every 6 frames,...
#define STREAKS_TARGET_DELAY
frames between targets
#define MOTE_FOUNTAIN_FOUNTAIN_FRAMES
#define STREAKS_MAX
streaks fired at each target
void BattleFx_RunSleepStar(struct BattleEffectArgument *effect)
Rising motes that drift onto the targets and strike.
void BattleFx_RunBansheeHowl(struct BattleEffectArgument *effect)
Violet streaks.
void BattleFx_RunShriek(struct BattleEffectArgument *effect)
Lime streaks.
#define STREAKS_SHAKE
nonzero: the struck target trembles from side to side
#define STREAKS_FLIGHT
frames from user to target
UNUSED void BattleFx_RunLimeStreaks(struct BattleEffectArgument *effect)
The streak volley in lime. UNUSED: no effect table entry points here.
@ MOTE_FOUNTAIN_INITIALIZED_COUNT
StreakStyle
The streak volley's styles: its colour and its row of gStreaks_Records.
#define STREAKS_HIT
nonzero: play the hit sound and flash the target
void BattleFx_RunSonicWave(struct BattleEffectArgument *effect)
Ember streaks.
#define STREAKS_ANIMATE
nonzero: the streak cycles through three images
MoteFountainMode
The mote fountain's modes (BattleFx_RunMoteFountain).
@ MOTE_FOUNTAIN_FOUNTAIN_HEALING
Soothing Star.
@ MOTE_FOUNTAIN_DRIFTING
Sleep Star.
void BattleFx_RunMoteFountain(struct BattleEffectArgument *effect, s32 mode)
Motes burst out of the user in every direction and float upwards, wobbling, for 128 frames; a new gro...
#define STREAKS_MOTION
the target's recoil motion on the hit (-1: none)
void BattleFx_RunSoothingStar(struct BattleEffectArgument *effect)
Rising healing motes.
void BattleFx_RunWarCry(struct BattleEffectArgument *effect)
Cyan streaks.
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 count
targets in actors, at least 1
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 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.
s32 depth
projected depth, larger further away
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 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.
#define EFFECT_CLIP_BOUNDS
Clips overflow on all four sides.
#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...