77 if (work->
delay != 0) {
85 for (scanline = 0; scanline < 160; scanline++)
90 if (work->
page != 0) {
104 if (caster != 0 && target != 0) {
109 from.
y = caster->
y.
fixed + ((
s8)meta->
boxX << 16) - (2 << 16);
120 particle->
speed = 0xa3d7;
141#define MIND_READ_GREY RGB(28, 28, 28)
155 (
volatile u32 *)dma);
175 pr = (
u8 *)work + offset;
178 pg = (
u8 *)work + offset;
181 pb = (
u8 *)work + offset;
190 if (work->
hue >= 360) {
207 if (angle < 60 << 16)
209 if (angle >= 60 << 16 && angle < 180 << 16)
211 if (angle >= 180 << 16 && angle < 240 << 16)
222 if (divisor & 0xf0000000)
226 return value -
Iwram_MulQ16(quot & 0xffff0000, divisor);
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
struct WaveFxWork * gBattleBgFxWork
const s32 gBattleFx_UntargetedObjectScript[]
void BattleFx_ApplyColorToTargetBuffer(s32 mode, s32 half)
Sets the colours the buffer moves toward (see BattleFx_BuildBuffer); does nothing without a colour bu...
void BattleFx_StartBufferInterpolation(s32 frames)
Starts moving the shown colours to the target colours over frames frames: sets work->duration,...
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...
#define Dma_Fill32(value, destination, size)
Fills size bytes at destination with the word value by DMA3.
struct ObjectRuntime * Object_CreateFar(s32 id, s32 x, s32 y, s32 z)
Far call to FieldObject_Create.
void ObjectDispatch_InitializeFar(struct DispatchObject *obj, const s32 *script)
void Object_SetMoveTargetFar(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
struct AnimationMetadata * Resource_GetMetadataRecordFar(u32 number)
void AudioCommand_PlayFar(s32 id)
void PaletteGlow_UpdateFar(s32 phase, s32 brightness)
volatile u32 gFrameCount
Frames WaitFrames has finished.
struct GameState gGameState
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
#define DMA_HBLANK_HALFWORD_PER_LINE
#define RGB(r, g, b)
A 15-bit colour from its red, green and blue levels (0 to 31 each), as the palette stores it: blue in...
#define DMA_START_TIMING_DRQ_REPEAT
A DMA control's start timing (bits 12 and 13), cartridge request (bit 11) and repeat (bit 9): the bit...
#define BG_PLTT_COLOR(palette, color)
static s32 Iwram_RatioMulQ14(s32 divisor, s32 value)
All calls go through this layer.
#define Iwram_MulQ16(left, right)
s32 ArcTan2(s32 x, s32 y)
Returns the angle of the vector (x, y), in 1/65536 turns, measured from the y axis: 0 along +y,...
void Runtime_ReleaseHeapBlock(s32 slot)
void BattleFx_SetCallbackWhenTargetUnset(union FieldObject *fieldObject)
Per-frame update: once the object has arrived (no destination left), runs the script for untargeted o...
s32 Fixed_Remainder(s32 value, s32 divisor)
The 16.16 remainder of value divided by divisor (0 for a zero divisor).
void FieldFx_ComputeHueChannels(s32 hue, s32 *r, s32 *g, s32 *b)
Works out red, green and blue (0 to 31 each, 16.16) for a hue in degrees (16.16).
void BattleFx_ArmBg0HBlankDma(void)
Scheduler callback: restarts the HBlank DMA that writes BG0's horizontal scroll for each scanline fro...
void Ui_SetBank15PaletteAndClearRenderMode(void)
Stops the BG0 scanline scroll and restores BG palette 15.
void Ui_FillBank15PaletteGrey(void)
Turns colours 1 and 3 to 12 of BG palette 15 grey and starts the BG0 scanline scroll (BattleFx_ArmBg0...
void RunSceneTransitionEffect(s32 x, s32 y)
Starts the wave effect of caster sourceId on target targetId: fades the palettes toward a hue that sh...
s32 BattleFx_HueChannelRamp(s32 angle, s32 low, s32 high)
One colour channel's strength at a hue angle: rising from 0 to 60 degrees, high from 60 to 180,...
void FieldFx_UpdateMindReadWave(void)
Scheduler callback of the wave effect: once its delay has run out, writes the next page of scanline o...
void BattleFx_AdvanceHueCycle(void)
Moves the wave's hue on 4 degrees and works out its colour, each channel 4 to 11.
void BattleFx_FinishSceneAndReleaseHeapBlock(void)
Stops the wave effect: restores the caster's colours and the palettes and releases the effect's work.
struct ScenePlacement * Scene_FindActorPlacement(s32 id)
Returns the placement of actor id in the scene's placement tables, or NULL: for a party character (0 ...
void Animation_ApplyChildPalette(struct MotionObject *object, s32 palette)
Gives every part of a motion object's sprite (but those at palette 15) palette - 1,...
void BattleEffect_InitializeSharedScene(void)
Saves the palettes for the effect (once, unless an effect is already shown) and fades them toward one...
void BattleFx_PrepareBufferInterpolation(void)
Fades the palettes back from an effect's colours to the saved ones (or to palette 0x10001 while an ef...
What every part of psynergy_effects.c shares: its includes and the macros and types more than one par...
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...
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
A field object as the object dispatcher's far calls take it.
A world position, as Camera_WorldToScreen converts it to the screen.
s32 y
16.16 fixed-point pixels
s32 z
16.16 fixed-point pixels
s32 x
16.16 fixed-point pixels
A field actor: a person or thing on the field with a position, motion toward a target,...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
union FieldCoordinate y
16.16 fixed-point pixels
union FieldCoordinate z
16.16 fixed-point pixels
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
u8 paletteGlow[2]
window hue (0 to 24), brightness
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
s32 targetZ
16.16 fixed-point pixels; 0x80000000 when unset
s32 targetY
16.16 fixed-point pixels; 0x80000000 when unset
s32 targetX
16.16 fixed-point pixels; 0x80000000 when unset
s16 sprite
The actor's sprite; 0 to 7 are the party's characters, each in its own actor slot,...
The window system's work: the windows' tilemap, the windows, the three text channels,...
u8 mode
Set while Mind Read shows thoughts: round frame corners, colour 8 text with no shadow,...
A particle's sprite, seen as the two fields Douse and Mind Read set on it.
Work slot 22 of the wave effect, 0x298 bytes (RunSceneTransitionEffect).
u8 counter
particle spawn cycle (0 to 60)
s8 red
the hue as a colour (red, green, blue, 4 to 11 each)
u8 page
the page being written
u16 lines[2][162]
each scanline's offset, two pages written in turn
u16 phase
the wave's phase
u8 delay
frames before it starts
u16 hue
hue, 0 to 359 degrees
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.