Alchemy
Loading...
Searching...
No Matches

effect_internal.h File Reference

What every part of the battle effect object shares: its includes, macros and frame-loop helpers. More...

Go to the source code of this file.

Macros

#define EFFECT_DISPCNT
 The battle screen's display mode while an effect plays: background mode 1 with BG0 to BG2, sprites and both windows on.
#define EFFECT_WIN0_LAYERS
 Window 0, the battle view, shows BG0 to BG2, sprites and blending.
#define EFFECT_WINOUT   (WINOUT_WIN01_BG0 | WINOUT_WIN01_CLR | WINOUT_WINOBJ_ALL)
 Outside the battle view: BG0 and blending only.
#define EFFECT_SLOT(slots, slot)
 A work slot read through a pointer to the effect's own slot, gWorkSlot[HEAP_SLOT_BATTLE_EFFECT].
#define CANVAS_SLOT(slots, slot)
 A work slot read through a pointer to the canvas slot, gWorkSlot[HEAP_SLOT_BATTLE_CANVAS], just after the effect's own.
#define DMA_CONTROL_HALF   5
 Index of DMAxCNT_H, the control half, in a channel's 16-bit registers.
#define DMA_FILL_WORDS(n)
 DMA control word that fills n words from one fixed source word.
#define EFFECT_GET_WORK_AND_CANVAS(cursor, work, canvas)
 The work block and canvas occupy adjacent slots, starting at HEAP_SLOT_BATTLE_EFFECT.
#define EFFECT_GET_SLOTS(slots, cursor, work, canvas)
 Starts at the effect's entry in the whole work-slot array.
#define EFFECT_FREE_PARTICLES(i, particles, count)
 Marks particles[0] to particles[count - 1] free: a particle whose variant is -1 is not drawn or moved until an effect gives it a life.
#define EFFECT_VIEW_FROM_CAMERA(camera)
 Starts a frame's 3D projection from the battle camera: resets the transform, then looks from camera->eye towards camera->pos.
#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 motion (BattleMotion_ApplyVariantMotionFar).
#define EFFECT_SHOW_DAMAGE(hitSound)
 Lets the battle show the damage: resumes its paused playback, which plays hitSound (an SE_ id; 0 keeps the one already queued) as the targets react.
#define CANVAS_BYTES   (128 * 128)
 The canvas: 128x128 pixels, one byte each, in its heap slot and in VRAM at BG_CHAR_BLOCK(1).
#define EFFECT_BEGIN_NARROW_CANVAS(bgControl)
 Opens the canvas layer at the canvas's own width, one texel per pixel, where BattleFx_BeginCanvasLayer stretches it to twice the width.
#define EFFECT_LOAD_BLITTER(slot, flags, mode)
 Builds a blitter for the 128x128 canvas (1 << 7 pixels each way) in work slot slot: BattleFx_BuildBlitter's drawing routine for one clip, mirror and blend mode.
#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 enum CanvasTransferMode).
#define EFFECT_START_TRANSFER(work, mode, value)
 Sets the transfer, then starts copying the canvas to VRAM once a frame.
#define EFFECT_PRESENT_FRAME(work)
 Ends a frame of a canvas effect: marks the canvas ready for the transfer callback, then waits for the next frame.
#define EFFECT_END_FRAME(work)
 The usual end of an effect frame: counts down the targets' flash timers (ObjectGroup_TickMemberTimers), then presents the canvas.
#define EFFECT_RELEASE_BLITTERS()
 Frees the two blitters, the alternate first.
#define EFFECT_FINISH_CANVAS()
 The usual end of a canvas effect: stops the transfer callback before freeing what it reads, then the blitters, then the canvas layer.
#define EFFECT_FINISH_CANVAS_ONE_BLITTER()
 The same for an effect that drew through one blitter.
#define MOTE_SET_BYTES   770
 The bytes of one set of the ten mote cells: 2 * (1 + 4 + ... + 100).
#define EFFECT_DRAW_MOTE(draw, canvas, sheet, x, y, size)
 Particle sheets hold ten mote cells, 1x2 to 10x20 pixels.
#define EFFECT_DRAW_FLARE(draw, canvas, sheet, x, y, size)
 Draws flare cell size of sheet, a square size pixels from its centre to each edge, centred on (x, y): Douse's sparks and the glowing points of the element pillar and burst, stat boosts, beams and rings.
#define EFFECT_SHOW_WIDE_CANVAS(top)
 Shows the canvas: the effect display mode, BG2 stretched to twice its width (the 128-pixel canvas shown 256 pixels wide) and blended over everything below: top sixteenths of the canvas's colour are added to all of what lies under it, so the canvas brightens what it covers.
#define WINDOW_SPAN_INVERTED   WIN_RANGE(1, 0)
 A WIN0H value whose left edge is past its right edge.
#define EFFECT_CALLBACK_ORDER   0x480
 The scheduler order of every per-frame effect callback (Scheduler_AddOrUpdateCallback sorts the frame's callbacks by order).
#define EFFECT_PLAYBACK_ORDER   0xc80
 The order where the battle's own playback runs, which the palette fade and the element streaks take.
#define BLUE_RAMP_PIXELS   Ram_MapCellBuffer
 The full-screen picture Graphics_ConvertBackgroundToBlueRamp (bind.c) works on, which Condemn draws too.
#define EFFECT_CAP_LEVEL(level, cap)
 Caps a colour level at cap, and at 0 from below.
#define LIGHTNING_BOLT_CELL_BYTES   2880
 Closing bolts and lightning columns use the same 24x120 picture cells.
#define EFFECT_SET_BATTLE_WINDOWS()
 Windows 0 and 1 both cover the battle view: the full width, lines 16 to.
#define EFFECT_SET_CANVAS_AFFINE()
 BG2 shows the canvas from screen line 16 down (BG2Y is -16.0), stretched to twice its width: the 128x128 canvas across the battle view.
#define EFFECT_WRITE_CANVAS_MAP_ROW(row, column, offset)
 Writes one row of BG2's map for the canvas: its 16 tiles of row row in order.

Enumerations

enum  CanvasTransferMode {
  CANVAS_COPY , CANVAS_COPY_AND_CLEAR , CANVAS_COPY_AND_FADE , CANVAS_COPY_AND_DARKEN ,
  CANVAS_COPY_AND_BRIGHTEN
}
 How BattleFx_ProcessPendingGraphicsTransfer moves the effect's 128x128 canvas into VRAM once a frame (work->transferMode); the canvas pixels are indices into a palette ramp, so scaling them fades a trail. More...

Functions

static void Dma_Stop (volatile u16 *channel)
 Stops a DMA channel: clears its repeat and start timing bits, then its enable bit, and reads the control register back so the stop takes effect before the channel is set up again.

Detailed Description

What every part of the battle effect object shares: its includes, macros and frame-loop helpers.

effect.c includes it before the parts, and each part includes it too, so that a part read on its own still resolves.

Definition in file effect_internal.h.

Macro Definition Documentation

◆ EFFECT_DISPCNT

#define EFFECT_DISPCNT
Value:
@ DISPCNT_OBJ_ON
Definition io_reg.h:44
@ DISPCNT_WIN0_ON
Definition io_reg.h:45
@ DISPCNT_BG0_ON
Definition io_reg.h:40
@ DISPCNT_OBJ_1D_MAP
Definition io_reg.h:39
@ DISPCNT_MODE_1
BG0 and BG1 text, BG2 affine.
Definition io_reg.h:37
@ DISPCNT_WIN1_ON
Definition io_reg.h:46
@ DISPCNT_BG2_ON
Definition io_reg.h:42
@ DISPCNT_BG1_ON
Definition io_reg.h:41

The battle screen's display mode while an effect plays: background mode 1 with BG0 to BG2, sprites and both windows on.

Definition at line 83 of file effect_internal.h.

Referenced by BattleFx_BeginCanvasLayer(), BattleFx_ConfigureEffectDisplay(), BattleFx_OpenCanvasLayer(), BattleFx_RunAtalanta(), BattleFx_RunShatteringOpening(), BattleFx_SetupBlendedDisplay(), and BattleFx_SetupCanvasTileMap().

◆ EFFECT_WIN0_LAYERS

#define EFFECT_WIN0_LAYERS
Value:
#define WININ_WIN0_BG1
Definition io_reg.h:87
#define WININ_WIN0_CLR
Definition io_reg.h:91
#define WININ_WIN0_BG0
Definition io_reg.h:86
#define WININ_WIN0_OBJ
Definition io_reg.h:90
#define WININ_WIN0_BG2
Definition io_reg.h:88

Window 0, the battle view, shows BG0 to BG2, sprites and blending.

Effects pick window 1's layers themselves.

Definition at line 89 of file effect_internal.h.

Referenced by BattleFx_BeginCanvasLayer(), BattleFx_ConfigureEffectDisplay(), BattleFx_OpenCanvasLayer(), BattleFx_RunBoreas(), BattleFx_RunDouse(), BattleFx_RunIce(), BattleFx_RunKirin(), BattleFx_RunNeptune(), BattleFx_RunRamses(), BattleFx_RunShatteringOpening(), and BattleFx_SetupCanvasTileMap().

◆ EFFECT_WINOUT

#define EFFECT_WINOUT   (WINOUT_WIN01_BG0 | WINOUT_WIN01_CLR | WINOUT_WINOBJ_ALL)

◆ EFFECT_SLOT

#define EFFECT_SLOT ( slots,
slot )
Value:
((slots)[(slot) - HEAP_SLOT_BATTLE_EFFECT])
@ HEAP_SLOT_BATTLE_EFFECT
Definition heap_state.h:42

A work slot read through a pointer to the effect's own slot, gWorkSlot[HEAP_SLOT_BATTLE_EFFECT].

Definition at line 98 of file effect_internal.h.

Referenced by BattleFx_ProcessPendingGraphicsTransfer(), BattleFx_RunAnnihilation(), BattleFx_RunBeamSequence(), BattleFx_RunBind(), BattleFx_RunBladeRain(), BattleFx_RunBolt(), BattleFx_RunBreak(), BattleFx_RunCastingImpact(), BattleFx_RunCondemn(), BattleFx_RunDeathPlunge(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunDouse(), BattleFx_RunDragonCloud(), BattleFx_RunDrain(), BattleFx_RunFire(), BattleFx_RunFlare(), BattleFx_RunFrost(), BattleFx_RunGaia(), BattleFx_RunGatheringLights(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunHelmSplitter(), BattleFx_RunIce(), BattleFx_RunJupiter(), BattleFx_RunLobbedShells(), BattleFx_RunMars(), BattleFx_RunMercury(), BattleFx_RunOrbitingSpirals(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunProjectileVolley(), BattleFx_RunRagnarok(), BattleFx_RunRay(), BattleFx_RunRingAndSparkScene(), BattleFx_RunRushingStrike(), BattleFx_RunSleep(), BattleFx_RunSparkGroups(), BattleFx_RunSpire(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlSwipe(), BattleFx_RunTargetBursts(), BattleFx_RunTargetStrike(), BattleFx_RunTriangleStrike(), BattleFx_RunVenus(), BattleFx_RunVine(), BattleFx_RunVolcano(), BattleFx_RunWhirlwind(), and Camera_ApplyPhasedDelta().

◆ CANVAS_SLOT

#define CANVAS_SLOT ( slots,
slot )
Value:
((slots)[(slot) - HEAP_SLOT_BATTLE_CANVAS])
@ HEAP_SLOT_BATTLE_CANVAS
Definition heap_state.h:43

A work slot read through a pointer to the canvas slot, gWorkSlot[HEAP_SLOT_BATTLE_CANVAS], just after the effect's own.

Definition at line 101 of file effect_internal.h.

Referenced by BattleFx_RunBoreas(), BattleFx_RunBurstShower(), BattleFx_RunCurse(), BattleFx_RunJudgment(), BattleFx_RunNeptune(), BattleFx_RunPaletteParticles(), and BattleFx_RunProcne().

◆ DMA_CONTROL_HALF

#define DMA_CONTROL_HALF   5

Index of DMAxCNT_H, the control half, in a channel's 16-bit registers.

Definition at line 104 of file effect_internal.h.

Referenced by Dma_Stop().

◆ DMA_FILL_WORDS

#define DMA_FILL_WORDS ( n)
Value:
((DMA_ENABLE | DMA_32BIT | DMA_SRC_FIXED) << 16 | (n))
#define DMA_32BIT
Definition io_reg.h:210
#define DMA_SRC_FIXED
Definition io_reg.h:207
#define DMA_ENABLE
Definition io_reg.h:217

DMA control word that fills n words from one fixed source word.

Definition at line 107 of file effect_internal.h.

Referenced by BattleFx_RunParticleStreams().

◆ EFFECT_GET_WORK_AND_CANVAS

◆ EFFECT_GET_SLOTS

◆ EFFECT_FREE_PARTICLES

#define EFFECT_FREE_PARTICLES ( i,
particles,
count )
Value:
for ((i) = 0; (i) != (count); (i)++) \
(particles)[i].variant = -1

Marks particles[0] to particles[count - 1] free: a particle whose variant is -1 is not drawn or moved until an effect gives it a life.

Definition at line 144 of file effect_internal.h.

Referenced by BattleFx_RunBolt(), BattleFx_RunBreak(), BattleFx_RunDouse(), BattleFx_RunDrain(), BattleFx_RunGatheringLights(), BattleFx_RunJupiter(), BattleFx_RunLobbedShells(), BattleFx_RunMercury(), BattleFx_RunNereid(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunRamses(), and BattleFx_RunVenus().

◆ EFFECT_VIEW_FROM_CAMERA

#define EFFECT_VIEW_FROM_CAMERA ( camera)
Value:
Transform_SetLookAt((camera)->eye, (camera)->pos))
void Render_ResetTransformState(void)
Allocates the one-level save area (heap slot HEAP_SLOT_TRANSFORM_STACK), clears gTransformStackDepth ...
Definition transform.c:19

Starts a frame's 3D projection from the battle camera: resets the transform, then looks from camera->eye towards camera->pos.

Effects that place pictures at battle positions do this before projecting them.

Definition at line 151 of file effect_internal.h.

Referenced by BattleFx_RunAnnihilation(), BattleFx_RunAstralBlast(), BattleFx_RunBeamSequence(), BattleFx_RunBind(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunCastingImpact(), BattleFx_RunCybele(), BattleFx_RunDeathPlunge(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunDragonCloud(), BattleFx_RunDrain(), BattleFx_RunElementPillar(), BattleFx_RunEruption(), BattleFx_RunFire(), BattleFx_RunFroth(), BattleFx_RunGatheringLights(), BattleFx_RunGround(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunJudgment(), BattleFx_RunLobbedShells(), BattleFx_RunMoteFountain(), BattleFx_RunOrbitingSkulls(), BattleFx_RunOrbitingSpirals(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunPlanetDiver(), BattleFx_RunProcne(), BattleFx_RunProjectileVolley(), BattleFx_RunQuake(), BattleFx_RunRingAndSparkScene(), BattleFx_RunRushingStrike(), BattleFx_RunShiningStar(), BattleFx_RunSleep(), BattleFx_RunStatBoost(), BattleFx_RunStatReduction(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlingStars(), BattleFx_RunTargetBursts(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunTriangleStrike(), BattleFx_RunVolcano(), and BattleUnit_ProjectToScreen().

◆ EFFECT_STRIKE_TARGET

#define EFFECT_STRIKE_TARGET ( effect,
i,
frames,
motion )
Value:
POSE_DAMAGE, i, frames), \
BattleMotion_ApplyVariantMotionFar((effect)->actors[i], motion))
@ SPRITE_COLOR_WHITE
solid colour 15, white
Definition animspr.h:26
@ POSE_DAMAGE
taking damage
Definition battle.h:176
void ObjectGroup_UpdateMembers(s32 actorId, s32 palette, s32 animation, s32 timerSlot, s32 timerFrames)
Updates every animation group of one battler's object.
Definition dispatch.c:254

Strikes target i: it flashes white in its damage pose for frames frames and plays battle motion motion (BattleMotion_ApplyVariantMotionFar).

Definition at line 158 of file effect_internal.h.

Referenced by BattleFx_RunGround(), BattleFx_RunJupiter(), BattleFx_RunMars(), BattleFx_RunMercury(), BattleFx_RunTargetStrike(), and BattleFx_RunVenus().

◆ EFFECT_SHOW_DAMAGE

#define EFFECT_SHOW_DAMAGE ( hitSound)
Value:
void BattleEventRuntime_BeginPhaseFar(s32 cue)

Lets the battle show the damage: resumes its paused playback, which plays hitSound (an SE_ id; 0 keeps the one already queued) as the targets react.

Definition at line 170 of file effect_internal.h.

Referenced by BattleFx_RunAnnihilation(), BattleFx_RunAstralBlast(), BattleFx_RunBeamSequence(), BattleFx_RunBind(), BattleFx_RunBolt(), BattleFx_RunBoreas(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunBurstShower(), BattleFx_RunCastingImpact(), BattleFx_RunCurse(), BattleFx_RunCybele(), BattleFx_RunDeathPlunge(), BattleFx_RunDjinnBeams(), BattleFx_RunDouse(), BattleFx_RunDragonCloud(), BattleFx_RunDrain(), BattleFx_RunEruption(), BattleFx_RunFire(), BattleFx_RunFlare(), BattleFx_RunFlashingStrike(), BattleFx_RunFrost(), BattleFx_RunFroth(), BattleFx_RunGaia(), BattleFx_RunGatheringLights(), BattleFx_RunGrowingColumns(), BattleFx_RunHail(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunHelmSplitter(), BattleFx_RunIce(), BattleFx_RunJudgment(), BattleFx_RunJupiter(), BattleFx_RunKirin(), BattleFx_RunLobbedShells(), BattleFx_RunMars(), BattleFx_RunMercury(), BattleFx_RunMirroredWall(), BattleFx_RunMoteFountain(), BattleFx_RunNeptune(), BattleFx_RunNereid(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunPrism(), BattleFx_RunProcne(), BattleFx_RunProjectileVolley(), BattleFx_RunQuake(), BattleFx_RunRagnarok(), BattleFx_RunRamses(), BattleFx_RunRay(), BattleFx_RunRingAndSparkScene(), BattleFx_RunRushingStrike(), BattleFx_RunShiningStar(), BattleFx_RunSleep(), BattleFx_RunSparkGroups(), BattleFx_RunSpiderWeb(), BattleFx_RunSpire(), BattleFx_RunStatBoost(), BattleFx_RunStatReduction(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlSwipe(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunThor(), BattleFx_RunThorn(), BattleFx_RunTitanBlade(), BattleFx_RunTriangleStrike(), BattleFx_RunUndeadSword(), BattleFx_RunVenus(), BattleFx_RunVolcano(), and BattleFx_RunWhirlwind().

◆ CANVAS_BYTES

◆ EFFECT_BEGIN_NARROW_CANVAS

#define EFFECT_BEGIN_NARROW_CANVAS ( bgControl)
Value:
void BattleFx_BeginCanvasLayer(s32 bgControl)
Opens the canvas layer: starts the background palette fade, makes BG2 the canvas, alpha-blended over ...
Definition canvas.c:314
#define Q_8_8(n)
The BG2/BG3 affine matrix entries are signed 8.8 fixed point: texels stepped per screen pixel.
Definition io_reg.h:59
#define REG_BG2PA
Definition io_reg.h:61

Opens the canvas layer at the canvas's own width, one texel per pixel, where BattleFx_BeginCanvasLayer stretches it to twice the width.

Definition at line 178 of file effect_internal.h.

Referenced by BattleFx_RunAtalanta(), BattleFx_RunBladeRain(), BattleFx_RunCurse(), BattleFx_RunCybele(), BattleFx_RunDouse(), BattleFx_RunFrost(), BattleFx_RunHelmSplitter(), BattleFx_RunIce(), BattleFx_RunJudgment(), BattleFx_RunOrbitingSkulls(), BattleFx_RunOrbitingSpirals(), BattleFx_RunParticleStreams(), BattleFx_RunSleep(), BattleFx_RunSpire(), BattleFx_RunStatReduction(), BattleFx_RunSwirlSwipe(), BattleFx_RunThor(), BattleFx_RunTriangleStrike(), and BattleFx_RunUndeadSword().

◆ EFFECT_LOAD_BLITTER

#define EFFECT_LOAD_BLITTER ( slot,
flags,
mode )
Value:
BattleFx_BuildBlitter(slot, 7, 7, flags, mode)
s32 BattleFx_BuildBlitter(s32 slot, s32 widthShift, s32 heightShift, s32 flags, u32 mode)
Writes a drawing routine for the canvas into heap slot slot, built from the template BattleFx_Composi...
Definition blitter.c:281

Builds a blitter for the 128x128 canvas (1 << 7 pixels each way) in work slot slot: BattleFx_BuildBlitter's drawing routine for one clip, mirror and blend mode.

Every canvas effect draws through one or two of these.

Definition at line 184 of file effect_internal.h.

Referenced by BattleFx_FetchRectangleBlitters(), BattleFx_RunAnnihilation(), BattleFx_RunAstralBlast(), BattleFx_RunAtalanta(), BattleFx_RunBeamSequence(), BattleFx_RunBind(), BattleFx_RunBladeRain(), BattleFx_RunBolt(), BattleFx_RunBoreas(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunBurstShower(), BattleFx_RunCastingImpact(), BattleFx_RunCondemn(), BattleFx_RunCurse(), BattleFx_RunCybele(), BattleFx_RunDeathPlunge(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinniEntrance(), BattleFx_RunDouse(), BattleFx_RunDrain(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunEruption(), BattleFx_RunFire(), BattleFx_RunFlare(), BattleFx_RunFlashingStrike(), BattleFx_RunFroth(), BattleFx_RunGaia(), BattleFx_RunGround(), BattleFx_RunGrowingColumns(), BattleFx_RunHaunt(), BattleFx_RunIce(), BattleFx_RunImpactBurst(), BattleFx_RunJudgment(), BattleFx_RunKirin(), BattleFx_RunLobbedShells(), BattleFx_RunMirroredWall(), BattleFx_RunMoteFountain(), BattleFx_RunNeptune(), BattleFx_RunOrbitingSkulls(), BattleFx_RunOrbitingSpirals(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunProcne(), BattleFx_RunProjectileVolley(), BattleFx_RunQuake(), BattleFx_RunRamses(), BattleFx_RunRay(), BattleFx_RunRingAndSparkScene(), BattleFx_RunRushingStrike(), BattleFx_RunShatteringOpening(), BattleFx_RunShiningStar(), BattleFx_RunSleep(), BattleFx_RunSparkGroups(), BattleFx_RunSpiderWeb(), BattleFx_RunSpire(), BattleFx_RunStatBoost(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlSwipe(), BattleFx_RunTargetBursts(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunThor(), BattleFx_RunThorn(), BattleFx_RunTitanBlade(), BattleFx_RunTriangleStrike(), BattleFx_RunUndeadSword(), BattleFx_RunVenus(), BattleFx_RunVine(), BattleFx_RunVolcano(), and BattleFx_RunWhirlwind().

◆ EFFECT_SET_TRANSFER

#define EFFECT_SET_TRANSFER ( work,
mode,
value )

◆ EFFECT_START_TRANSFER

#define EFFECT_START_TRANSFER ( work,
mode,
value )
Value:
(EFFECT_SET_TRANSFER(work, mode, value), \
Scheduler_AddOrUpdateCallback(BattleFx_ProcessPendingGraphicsTransfer, \
void BattleFx_ProcessPendingGraphicsTransfer(void)
Copies the canvas to VRAM once the effect has finished drawing a frame (transferPending): the 128x128...
Definition canvas.c:103
#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 ...
#define EFFECT_CALLBACK_ORDER
The scheduler order of every per-frame effect callback (Scheduler_AddOrUpdateCallback sorts the frame...

Sets the transfer, then starts copying the canvas to VRAM once a frame.

Definition at line 193 of file effect_internal.h.

Referenced by BattleFx_RunBeamSequence(), BattleFx_RunBind(), BattleFx_RunBladeRain(), BattleFx_RunBolt(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunCondemn(), BattleFx_RunCybele(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunDragonCloud(), BattleFx_RunDrain(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunEruption(), BattleFx_RunFire(), BattleFx_RunFlashingStrike(), BattleFx_RunFrost(), BattleFx_RunFroth(), BattleFx_RunGaia(), BattleFx_RunGatheringLights(), BattleFx_RunGround(), BattleFx_RunGrowingColumns(), BattleFx_RunHail(), BattleFx_RunHaunt(), BattleFx_RunHelmSplitter(), BattleFx_RunImpactBurst(), BattleFx_RunJupiter(), BattleFx_RunLobbedShells(), BattleFx_RunMars(), BattleFx_RunMercury(), BattleFx_RunMirroredWall(), BattleFx_RunMoteFountain(), BattleFx_RunNereid(), BattleFx_RunOrbitingSpirals(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunPrism(), BattleFx_RunProcne(), BattleFx_RunQuake(), BattleFx_RunRagnarok(), BattleFx_RunRay(), BattleFx_RunRingAndSparkScene(), BattleFx_RunRushingStrike(), BattleFx_RunShatteringOpening(), BattleFx_RunSleep(), BattleFx_RunSparkGroups(), BattleFx_RunSpiderWeb(), BattleFx_RunSpire(), BattleFx_RunStatReduction(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlingStars(), BattleFx_RunSwirlSwipe(), BattleFx_RunTargetBursts(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunTitanBlade(), BattleFx_RunTorch(), BattleFx_RunTriangleStrike(), BattleFx_RunUndeadSword(), BattleFx_RunVenus(), BattleFx_RunVine(), BattleFx_RunVolcano(), and BattleFx_RunWhirlwind().

◆ EFFECT_PRESENT_FRAME

◆ EFFECT_END_FRAME

#define EFFECT_END_FRAME ( work)
Value:
void ObjectGroup_TickMemberTimers(void)
Counts down each target's flash timer, which ObjectGroup_UpdateMembers starts; when one runs out,...
Definition canvas.c:275
#define EFFECT_PRESENT_FRAME(work)
Ends a frame of a canvas effect: marks the canvas ready for the transfer callback,...

The usual end of an effect frame: counts down the targets' flash timers (ObjectGroup_TickMemberTimers), then presents the canvas.

Definition at line 204 of file effect_internal.h.

Referenced by BattleFx_RunAnnihilation(), BattleFx_RunAstralBlast(), BattleFx_RunAtalanta(), BattleFx_RunBladeRain(), BattleFx_RunBolt(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunCastingImpact(), BattleFx_RunCybele(), BattleFx_RunDouse(), BattleFx_RunDragonCloud(), BattleFx_RunDrain(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunEruption(), BattleFx_RunFire(), BattleFx_RunFlare(), BattleFx_RunFlashingStrike(), BattleFx_RunFroth(), BattleFx_RunGaia(), BattleFx_RunGatheringLights(), BattleFx_RunGround(), BattleFx_RunGrowingColumns(), BattleFx_RunHail(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunHelmSplitter(), BattleFx_RunJupiter(), BattleFx_RunKirin(), BattleFx_RunLobbedShells(), BattleFx_RunMars(), BattleFx_RunMercury(), BattleFx_RunMirroredWall(), BattleFx_RunMoteFountain(), BattleFx_RunNeptune(), BattleFx_RunPaletteParticles(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunPrism(), BattleFx_RunProcne(), BattleFx_RunProjectileVolley(), BattleFx_RunQuake(), BattleFx_RunRagnarok(), BattleFx_RunRamses(), BattleFx_RunRay(), BattleFx_RunRushingStrike(), BattleFx_RunShatteringOpening(), BattleFx_RunShiningStar(), BattleFx_RunSparkGroups(), BattleFx_RunSpire(), BattleFx_RunStatBoost(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlSwipe(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunThor(), BattleFx_RunThorn(), BattleFx_RunTitanBlade(), BattleFx_RunUndeadSword(), BattleFx_RunVenus(), BattleFx_RunVine(), BattleFx_RunVolcano(), and BattleFx_RunWhirlwind().

◆ EFFECT_RELEASE_BLITTERS

◆ EFFECT_FINISH_CANVAS

#define EFFECT_FINISH_CANVAS ( )
Value:
EFFECT_RELEASE_BLITTERS(), BattleFx_EndCanvasLayer())
void BattleFx_EndCanvasLayer(void)
Closes the canvas layer: plays the closing sound, restores BG1's scroll and the projection centre,...
Definition canvas.c:490
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
Definition scheduler.c:146

The usual end of a canvas effect: stops the transfer callback before freeing what it reads, then the blitters, then the canvas layer.

Definition at line 214 of file effect_internal.h.

Referenced by BattleFx_RunAstralBlast(), BattleFx_RunAtalanta(), BattleFx_RunBladeRain(), BattleFx_RunBurstShower(), BattleFx_RunCastingImpact(), BattleFx_RunDjinnHeal(), BattleFx_RunDouse(), BattleFx_RunDragonCloud(), BattleFx_RunFroth(), BattleFx_RunGrowingColumns(), BattleFx_RunHail(), BattleFx_RunHealingMotes(), BattleFx_RunHelmSplitter(), BattleFx_RunJupiter(), BattleFx_RunLobbedShells(), BattleFx_RunMars(), BattleFx_RunMercury(), BattleFx_RunMirroredWall(), BattleFx_RunMoteFountain(), BattleFx_RunNeptune(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunPrism(), BattleFx_RunProcne(), BattleFx_RunRagnarok(), BattleFx_RunRamses(), BattleFx_RunRay(), BattleFx_RunRushingStrike(), BattleFx_RunShiningStar(), BattleFx_RunSleep(), BattleFx_RunSparkGroups(), BattleFx_RunStatReduction(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlingStars(), BattleFx_RunTargetBursts(), BattleFx_RunThorn(), BattleFx_RunTitanBlade(), BattleFx_RunTorch(), BattleFx_RunVenus(), and BattleFx_RunVine().

◆ EFFECT_FINISH_CANVAS_ONE_BLITTER

◆ MOTE_SET_BYTES

#define MOTE_SET_BYTES   770

◆ EFFECT_DRAW_MOTE

#define EFFECT_DRAW_MOTE ( draw,
canvas,
sheet,
x,
y,
size )
Value:
(draw)(canvas, (sheet) + gBattleFx_MoteCells[(size) - 1], (x) - (size) / 2, \
(y) - (size), size, (size) * 2)
u16 gBattleFx_MoteCells[]
Mote cells: particle sheets hold ten, cell n (from 0) n + 1 pixels wide and twice that tall.

Particle sheets hold ten mote cells, 1x2 to 10x20 pixels.

Draws mote cell size (size pixels wide, twice that tall) of sheet through blitter draw, centred across x and standing on y: the motes, sparks and dust of 32 effects, from the mote fountain to the summons.

Definition at line 230 of file effect_internal.h.

Referenced by BattleFx_RunAnnihilation(), BattleFx_RunAstralBlast(), BattleFx_RunBolt(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunCastingImpact(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunDragonCloud(), BattleFx_RunDrain(), BattleFx_RunFire(), BattleFx_RunGaia(), BattleFx_RunHealingMotes(), BattleFx_RunImpactBurst(), BattleFx_RunJudgment(), BattleFx_RunJupiter(), BattleFx_RunKirin(), BattleFx_RunMercury(), BattleFx_RunMoteFountain(), BattleFx_RunNeptune(), BattleFx_RunNereid(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunProcne(), BattleFx_RunProjectileVolley(), BattleFx_RunRamses(), BattleFx_RunRay(), BattleFx_RunRushingStrike(), BattleFx_RunShiningStar(), BattleFx_RunSparkGroups(), BattleFx_RunTargetStrike(), BattleFx_RunThor(), BattleFx_RunTitanBlade(), BattleFx_RunVenus(), and BattleFx_RunVolcano().

◆ EFFECT_DRAW_FLARE

#define EFFECT_DRAW_FLARE ( draw,
canvas,
sheet,
x,
y,
size )
Value:
(draw)(canvas, (sheet) + gBattleFx_FlareCells[(size) - 1], (x) - (size), \
(y) - (size), (size) * 2, (size) * 2)
u16 gBattleFx_FlareCells[]
Flare cells: the first ten are squares 2x2 to 20x20, cell n (from 0) n + 1 pixels from its centre to ...

Draws flare cell size of sheet, a square size pixels from its centre to each edge, centred on (x, y): Douse's sparks and the glowing points of the element pillar and burst, stat boosts, beams and rings.

Definition at line 237 of file effect_internal.h.

Referenced by BattleFx_RunBeamSequence(), BattleFx_RunDouse(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunRingAndSparkScene(), and BattleFx_RunStatBoost().

◆ EFFECT_SHOW_WIDE_CANVAS

#define EFFECT_SHOW_WIDE_CANVAS ( top)
Value:
REG_BLDALPHA = BLEND_ALPHA(top, 16), \
#define EFFECT_DISPCNT
The battle screen's display mode while an effect plays: background mode 1 with BG0 to BG2,...
#define BLDCNT_TGT1_BG2
Definition io_reg.h:125
#define REG_DISPCNT
Definition io_reg.h:9
#define BLDCNT_EFFECT_BLEND
weighted by REG_BLDALPHA
Definition io_reg.h:131
#define BLDCNT_TGT2_ALL
Definition io_reg.h:140
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
Definition io_reg.h:145
#define REG_BLDALPHA
Definition io_reg.h:142
#define REG_BLDCNT
Definition io_reg.h:119

Shows the canvas: the effect display mode, BG2 stretched to twice its width (the 128-pixel canvas shown 256 pixels wide) and blended over everything below: top sixteenths of the canvas's colour are added to all of what lies under it, so the canvas brightens what it covers.

Definition at line 245 of file effect_internal.h.

Referenced by BattleFx_RunAtalanta(), BattleFx_RunBoreas(), BattleFx_RunJudgment(), BattleFx_RunKirin(), BattleFx_RunNeptune(), BattleFx_RunRamses(), and BattleFx_RunThor().

◆ WINDOW_SPAN_INVERTED

#define WINDOW_SPAN_INVERTED   WIN_RANGE(1, 0)

A WIN0H value whose left edge is past its right edge.

The hardware then takes the right edge as 240, so the span is not empty in itself; the effects write it only on lines outside window 0's vertical range.

Definition at line 253 of file effect_internal.h.

◆ EFFECT_CALLBACK_ORDER

◆ EFFECT_PLAYBACK_ORDER

#define EFFECT_PLAYBACK_ORDER   0xc80

The order where the battle's own playback runs, which the palette fade and the element streaks take.

Definition at line 260 of file effect_internal.h.

Referenced by BattleFx_BeginCanvasLayer(), BattleFx_OpenCanvasLayer(), BattleFx_RunRingAndSparkScene(), and BattleFx_StartElementStreaks().

◆ BLUE_RAMP_PIXELS

#define BLUE_RAMP_PIXELS   Ram_MapCellBuffer

The full-screen picture Graphics_ConvertBackgroundToBlueRamp (bind.c) works on, which Condemn draws too.

Definition at line 264 of file effect_internal.h.

Referenced by Graphics_ConvertBackgroundToBlueRamp().

◆ EFFECT_CAP_LEVEL

#define EFFECT_CAP_LEVEL ( level,
cap )
Value:
{ \
if ((level) > (cap)) \
(level) = (cap); \
if ((level) < 0) \
(level) = 0; \
}

Caps a colour level at cap, and at 0 from below.

Fades draw from darker copies of a picture built before the first frame, copy i capped at 64 - 7i.

Definition at line 269 of file effect_internal.h.

Referenced by BattleFx_RunJudgment(), BattleFx_RunStatReduction(), and BattleFx_RunThor().

◆ LIGHTNING_BOLT_CELL_BYTES

#define LIGHTNING_BOLT_CELL_BYTES   2880

Closing bolts and lightning columns use the same 24x120 picture cells.

Definition at line 278 of file effect_internal.h.

Referenced by BattleFx_RunBolt(), BattleFx_RunCastingImpact(), and BattleFx_RunRay().

◆ EFFECT_SET_BATTLE_WINDOWS

#define EFFECT_SET_BATTLE_WINDOWS ( )
Value:
(REG_WIN0H = WIN_RANGE(0, 240), REG_WIN0V = WIN_RANGE(16, 136), \
REG_WIN1H = WIN_RANGE(0, 240), REG_WIN1V = WIN_RANGE(16, 136))
#define REG_WIN1H
Definition io_reg.h:75
#define REG_WIN0H
Definition io_reg.h:74
#define WIN_RANGE(start, end)
A REG_WINxH or REG_WINxV value: the window covers start up to, but not including, end.
Definition io_reg.h:80
#define REG_WIN1V
Definition io_reg.h:77
#define REG_WIN0V
Definition io_reg.h:76

Windows 0 and 1 both cover the battle view: the full width, lines 16 to.

Definition at line 282 of file effect_internal.h.

Referenced by BattleFx_BeginCanvasLayer(), BattleFx_ConfigureEffectDisplay(), BattleFx_OpenCanvasLayer(), BattleFx_RunShatteringOpening(), and BattleFx_SetupCanvasTileMap().

◆ EFFECT_SET_CANVAS_AFFINE

#define EFFECT_SET_CANVAS_AFFINE ( )
Value:
(REG_BG2X = 0, REG_BG2Y = -0x1000, REG_BG2PA = Q_8_8(0.5), REG_BG2PB = 0, \
#define REG_BG2PD
Definition io_reg.h:64
#define REG_BG2PC
Definition io_reg.h:63
#define REG_BG2X
Definition io_reg.h:65
#define REG_BG2Y
Definition io_reg.h:66
#define REG_BG2PB
Definition io_reg.h:62

BG2 shows the canvas from screen line 16 down (BG2Y is -16.0), stretched to twice its width: the 128x128 canvas across the battle view.

Definition at line 288 of file effect_internal.h.

Referenced by BattleFx_BeginCanvasLayer(), BattleFx_OpenCanvasLayer(), and BattleFx_RunShatteringOpening().

◆ EFFECT_WRITE_CANVAS_MAP_ROW

#define EFFECT_WRITE_CANVAS_MAP_ROW ( row,
column,
offset )
Value:
for ((column) = 0; (column) != 8; (column)++, (offset) += 2) { \
s32 tileIndex; \
s16 pair; \
\
tileIndex = (row) * 16 + (column) * 2; \
pair = ((tileIndex + 1) << 8) | tileIndex; \
*(volatile s16 *)((u8 *)BG_CANVAS_MAP + (offset)) = pair; \
}
#define BG_CANVAS_MAP
Definition io_reg.h:148
signed int s32
Definition types.h:14
signed short s16
Definition types.h:12
unsigned char u8
Definition types.h:11

Writes one row of BG2's map for the canvas: its 16 tiles of row row in order.

An affine map has one byte per tile, so they are written two at a time, eight halfwords from offset on.

Definition at line 295 of file effect_internal.h.

Referenced by BattleFx_BeginCanvasLayer(), BattleFx_BeginTiledCanvas(), and BattleFx_OpenCanvasLayer().

Enumeration Type Documentation

◆ CanvasTransferMode

How BattleFx_ProcessPendingGraphicsTransfer moves the effect's 128x128 canvas into VRAM once a frame (work->transferMode); the canvas pixels are indices into a palette ramp, so scaling them fades a trail.

Enumerator
CANVAS_COPY 

copy as drawn

CANVAS_COPY_AND_CLEAR 

copy, then fill the canvas with transferValue

CANVAS_COPY_AND_FADE 

copy, keeping 50% or 75% (transferValue) of each pixel in the canvas for the next frame

CANVAS_COPY_AND_DARKEN 

copy, then darken the canvas by transferValue

CANVAS_COPY_AND_BRIGHTEN 

copy, then brighten the canvas by transferValue

Definition at line 122 of file effect_internal.h.

Function Documentation

◆ Dma_Stop()

void Dma_Stop ( volatile u16 * channel)
inlinestatic

Stops a DMA channel: clears its repeat and start timing bits, then its enable bit, and reads the control register back so the stop takes effect before the channel is set up again.

The HBlank DMA arms in display.c, dispatch.c, burst_shower.c and particle_streams.c call it first.

Definition at line 113 of file effect_internal.h.

Referenced by BattleFx_ArmBg2AffineHBlankDma(), BattleFx_ArmPaletteHBlankDma(), BattleFx_ArmWin0HBlankDma(), BattleFx_BuildWindowEdgeTable(), and Dma_Stop().