8#define BURST_SHOWER_CELLS 0xC56
9#define BURST_SHOWER_BURSTS 48
10#define BURST_SHOWER_BURST_LIFE 24
36 (
volatile u32 *)channel);
87#define BURST_SHOWER_FRAMES 64
130 canvas = (
void *)slots[0];
166 for (i = 0, color = (
u16 *)
BG_PLTT; i != 64; i++) {
168 *color = ((level << 10) | (level << 5)) | level;
204 for (i = 0; i != 64; i++) {
229 origin.
x = origin.
x / 3;
265 origin.
x - 2, origin.
y - 32, 72, 62);
269 origin.
x - 70, origin.
y - 32, 72, 62);
274 aim[0] = (targetSpots[target].
x + (
Random16() & 31)) - 16;
275 aim[1] = (targetSpots[target].
y + (
Random16() & 63)) - 16;
339 if ((frame >= (i * 4) + 2) && ((frame & 7) == i)) {
350 if ((frame >= (i * 4) + 16) && ((frame & 7) == i)) {
378#undef BURST_SHOWER_CELLS
379#undef BURST_SHOWER_BURSTS
380#undef BURST_SHOWER_BURST_LIFE
381#undef BURST_SHOWER_FRAMES
@ SPRITE_COLOR_BLACK
solid colour 1, black
@ SPRITE_COLOR_WHITE
solid colour 15, white
@ POSE_DAMAGE
taking damage
BattleEffectDrawRectangle DrawRectangle
void BattleFx_RunDeadlyGas(struct BattleEffectArgument *effect)
The user fires a stream of Mars-coloured bursts at the targets, from 28 pixels in front of it.
void BattleFx_ArmBg2AffineHBlankDma(void)
Arms DMA 0 to copy one word of gBattleFxWork's bg2xLines table into BG2X at each horizontal blank,...
void BattleFx_RunBurstShower(struct BattleEffectArgument *effect, s32 mode)
Burst shower: for 48 frames the user fires one burst a frame at a random point near one of the target...
#define BURST_SHOWER_BURSTS
one fired a frame from frame 0
#define BURST_SHOWER_BURST_LIFE
frames each burst lives
void BattleFx_RunStormBlessing(struct BattleEffectArgument *effect)
Shows violet lightning between the user and targets instead of bursts: a bolt flickers through three ...
void BattleFx_RunFireBlessing(struct BattleEffectArgument *effect)
The user fires a stream of flash bursts at the targets, one a frame, each towards a random point near...
#define BURST_SHOWER_FRAMES
void BattleFx_RunEvilBlessing(struct BattleEffectArgument *effect)
The user fires a stream of demon faces at the targets, from 16 pixels in front of it.
#define BURST_SHOWER_CELLS
void BattleFx_RunAcidBlessing(struct BattleEffectArgument *effect)
Fires pink bursts from 16 pixels below the normal origin.
void BattleFx_RunDarkBlessing(struct BattleEffectArgument *effect)
The user fires a stream of grey bursts at the targets, which turn solid black and stay so.
void BattleFx_RunWaterBlessing(struct BattleEffectArgument *effect)
The user fires a stream of bursts at the targets in the water-spray palette.
BurstShowerMode
The burst shower's styles, its mode argument.
@ BURST_SHOWER_MODE_DJINNI
Mars djinni palette, 28 pixels in front.
@ BURST_SHOWER_MODE_FACES
demon faces from 16 pixels in front
@ BURST_SHOWER_MODE_PINK
pink, fired from 16 pixels lower
@ BURST_SHOWER_MODE_SPRAY
in the water spray palette
@ BURST_SHOWER_MODE_LIGHTNING
no bursts: a violet lightning bolt
@ BURST_SHOWER_MODE_FLASH
flash bursts
@ BURST_SHOWER_MODE_ICE
in the ice block palette
@ BURST_SHOWER_MODE_GREY
grey; the targets stay solid black
void ObjectGroup_TickMemberTimers(void)
Counts down each target's flash timer, which ObjectGroup_UpdateMembers starts; when one runs out,...
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 Resource_LoadAndDecompress(s32 id, void *dst, s32 skipPalette, s32 copyPalette)
Decompresses a resource whose first 128 bytes may be a palette.
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
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_PRESENT_FRAME(work)
Ends a frame of a canvas effect: marks the canvas ready for the transfer callback,...
#define EFFECT_SET_TRANSFER(work, mode, value)
Sets how the canvas transfer treats what is left in the canvas after each copy: mode with value (see ...
@ CANVAS_COPY_AND_FADE
copy, keeping 50% or 75% (transferValue) of each pixel in the canvas for the next frame
#define EFFECT_CALLBACK_ORDER
The scheduler order of every per-frame effect callback (Scheduler_AddOrUpdateCallback sorts the frame...
static void Dma_Stop(volatile u16 *channel)
Stops a DMA channel: clears its repeat and start timing bits, then its enable bit,...
#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_LOAD_BLITTER(slot, flags, mode)
Builds a blitter for the 128x128 canvas (1 << 7 pixels each way) in work slot slot: BattleFx_BuildBli...
#define CANVAS_SLOT(slots, slot)
A work slot read through a pointer to the canvas slot, gWorkSlot[HEAP_SLOT_BATTLE_CANVAS],...
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 DMA_HBLANK_WORD_PER_LINE
#define Q_8_8(n)
The BG2/BG3 affine matrix entries are signed 8.8 fixed point: texels stepped per screen pixel.
#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)
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_ProjectScaledBattler(s32 id, struct EffectPosition *position)
The screen position of a battler, scaled for the battle view, 16 pixels higher.
void EffectPosition_ProjectSprite(s32 id, struct EffectPosition *position)
The screen position of a battler's sprite, at its scaled height, 16 pixels higher.
char ResourceId_PinkPalette
char ResourceId_TornadoSheet
char ResourceId_MarsDjinnSheet
char ResourceId_VioletLightningSheetA
char ResourceId_DemonFaceSheet
char ResourceId_WaterSpraySheet
char ResourceId_ParticleSpritesA
char ResourceId_IceBlockSheet
char ResourceId_FlashBurstSheet
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
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 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
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)
DrawRectangle BlitterPair[2]
A blitter pair: [0] built in HEAP_SLOT_BLITTER and [1] in HEAP_SLOT_BLITTER_ALTERNATE (BattleFx_Fetch...