1#ifndef ALCHEMY_UNIT_OBJECT_PSYNERGY_EFFECTS_H
2#define ALCHEMY_UNIT_OBJECT_PSYNERGY_EFFECTS_H
76#define DJINN_NO_HOP 0x800
93#define ACTOR_ACTION_IDLE 1
94#define ACTOR_ACTION_FOLLOW_LINKED_OBJECT 5
95#define ACTOR_ACTION_FACE_SELECTED_ACTOR 6
97#define ACTOR_ACTION_RESET 7
165 s32 firstPortraitX,
s32 firstPortraitY,
167 s32 secondPortraitX,
s32 secondPortraitY);
270 s32 magnitude,
s32 angle);
void ObjectMotion_SetSpeedParameters(u32 objectId, s32 speedLimit, s32 acceleration)
The event command "set actor speed": its top speed and acceleration, 16.16 pixels per frame.
void ObjectVisual_CopyAttributes(u32 targetId, u32 sourceId)
Makes the target actor's sprite show the source actor's graphics (its VRAM block and tile).
void ObjectMotion_CommitCurrentPositionAndActivate(u32 objectId)
The event command "wait for actor": waits (at most 600 frames) for the actor to arrive and stands it ...
void ObjectMotion_ResetAndSetPositionInMode2(u32 objectId, s32 x, s32 z)
The event command "walk actor to": the actor walks (animation 2) toward (x, z), in pixels.
void Motion_SetVarCbAndRefresh(u32 objectId, s32 count)
The event command "run repeated motion": as ObjectMotion_SetVariantCallback, then waits for it to end...
void ObjectMotion_NoOp(void)
An empty function, reached only through an unnamed veneer in the object bank's far-call table; nothin...
void Object_LinkPair(s32 firstId, s32 secondId, s32 wait)
The event command "actors face each other": turns two actors toward each other, then waits wait frame...
s32 ObjectMotion_StepAngle(struct ObjectRuntime *object)
Script step that turns an actor toward the angle kept in its action: the whole way when within 1/16 t...
void ObjectMotion_Launch(u32 objectId, s32 speed, s32 frames)
The event command "actor jump": throws the actor upward at speed pixels per frame with a jump sound (...
void Object_ResetTargetAndSetMode1(u32 objectId)
Clears an actor's destination, puts it under event control and stands it still.
void ObjectTable_DestroyById(s32 index)
The event command "destroy actor": releases the actor and frees its slot, writing NULL to its place i...
s32 ObjectTable_ReadActiveValue(s32 actor)
Returns the sprite (the first animation's id) of the actor in the low 12 bits of actor,...
void FieldFx_UpdateParticleLinearMotion(union FieldObject *fieldObject)
Moves a dust puff of FieldFx_SpawnBurstParticle: it drifts with its x and z velocity (kept in speed a...
void ObjectMotion_CenterOnColumn(u32 objectId, s32 priority, s32 zOffset)
The event command "center actor and walk": walks the actor sideways to the middle of its 16-pixel col...
void ObjectGroup_SetChildValue(struct FieldActor *actor, s32 param)
Sets the param byte of every animated part of an actor's sprite.
void Object_SetActionCallbackAndRefreshById(u32 objectId, s32 action)
Starts a built-in action or supplied script, then waits up to 300 frames for its script to end.
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
void ObjectMotion_SetHorizontalPositionWithTerrain(u32 objectId, s32 x, s32 z)
The event command "set actor position": puts the actor at (x, z), 16.16 pixels, at rest.
UNUSED void ObjectVisual_ReservedNoOp(void)
void ObjectMotion_ResetAndSetPosition(u32 objectId, s32 x, s32 z)
The event command "set actor destination": the actor heads for (x, z), in pixels, keeping its current...
void Motion_SetModeAndWaitAnimation(u32 objectId, s32 animation)
The event command "set actor animation and wait": plays the animation and waits for it to end.
void ObjectGroup_ApplyIndexedChildValue(union FieldObject *fieldObject)
Per-frame hook of a blinking actor: sets its sprite parts' param from gObjectGroup_BlinkChildValues (...
void ObjectMotion_EnableActionAndSetCallback(u32 objectId, s32 action)
Gives an actor an action script (ObjectMotion_SetActionCallback) and lets it run: sets bit 0 of its a...
void ObjectMotion_ArmCallback(s32 objectId, s32 angle, s32 wait)
The event command "actor face direction": the actor turns toward angle (0x10000 a full turn; ObjectMo...
void FieldFx_SpawnBurstParticle(struct FieldActor *source, s32 param)
Kicks up a dust puff (object 222) where source stands: it flies off toward the back at 0....
void Actor_JumpDownLedge(s32 actor, s32 pose, s32 param)
Makes an actor jump down off a ledge in front of it (the field runs it for the leader when the player...
void Object_SetTargetAndCallback(u32 objectId, s32 targetId, const void *script)
Links an actor to the actor in the low 8 bits of targetId and starts script on it.
void ObjectMotion_CommitPositionAndActivate(u32 objectId, s32 xOffset, s32 zOffset)
Walks the actor (xOffset, zOffset) pixels, waits for it to arrive and stands it still.
void ObjectMotion_OffsetPositionAndResetMotion(u32 objectId, s32 xOffset, s32 zOffset)
The event command "set actor destination offset": the actor heads (xOffset, zOffset) pixels from wher...
void Object_LinkObjectAndSetCallback(u32 objectId, u32 linkedObjectId)
Makes an actor follow another (the linked action script): writes its linkedObject.
void ObjectMotion_SetVariantCallback(u32 objectId, s32 count)
The event command "start repeated motion": the actor squashes and springs back count times (1 to 3),...
void Motion_LaunchFromFocusedObject(u32 objectId, s32 xOffset, s32 zOffset, s32 action)
Places an actor on the leader and sends it walking (xOffset, zOffset) pixels away at speed 0....
s32 ObjectTable_FindActiveByValue(s32 sprite)
Returns the first scene actor (8 to 65) showing sprite, or -1.
void ObjectMotion_SetPositionWithTerrain(u32 objectId, s32 x, s32 y, s32 z)
Puts the actor at (x, y, z), 16.16 pixels, at rest; an actor that follows the ground (flag 1) is rais...
void FacingObject_TurnPairToFaceEachOther(struct FacingObject *firstObject, struct FacingObject *secondObject)
Turns two actors to face each other, at most 1/16 turn a frame each, until both do (at most 60 frames...
void ObjectMotion_SetPositionAndReset(u32 objectId, s32 x, s32 z)
The event command "walk actor to and wait": walks the actor to (x, z), in pixels, waits for it to arr...
void Event_SetMessageId(s32 message)
The event command "set message": the number of the event's next message, written to work->message.
void ObjectMotion_WaitForAnimationChange(u32 objectId)
Waits, at most 90 frames, for an actor's animation to change.
void ObjectMotion_OffsetPositionAndReset(u32 objectId, s32 xOffset, s32 zOffset)
Walks the actor (animation 2) (xOffset, zOffset) pixels from where it stands.
void ObjectMotion_SetPositionAndCommit(u32 objectId, s32 x, s32 z)
The event command "move actor and wait": as ObjectMotion_ResetAndSetPosition, then waits (at most 600...
void ObjectMotion_EnableActionAndResetMotion(u32 objectId)
The event command "stop actor": stops its action and puts it back under event control (dispatch scrip...
void Object_SetActionById(u32 objectId, s32 steps)
Sets the animation timer steps of each of an actor's sprites (AnimationObjects_SetActiveTimerSteps).
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
void ObjectMotion_SetAngleToward(s32 firstId, s32 secondId, s32 wait)
The event command "actor face actor": turns the first actor at once to face the second,...
UNUSED void ObjectTable_DestroyNoOp(void)
void Object_SetModeById(u32 objectId, s32 animation)
The event command "set actor animation" (1 stands, 2 walks, 3 nods, 4 shakes the head and so on).
void ObjectGroup_ConfigureChildValue(s32 objectId, s32 param)
The event command "set actor sprite param": gives every sprite part of the actor param (ObjectGroup_S...
void ObjectMotion_SetActionVariant(s32 objectId, s32 priority)
The event command "set actor sprite priority": fixes the priority of the actor's sprite,...
struct ObjectRuntime * Object_FindNearestFacingTarget(struct ObjectRuntime *self, s32 sprite)
Finds the nearest animated object to self within 40 pixels and 48 pixels of height,...
s32 Object_ClearChildAndCollisionFlags(void *obj)
Script step: clears an object's sprite flags and its collision flags.
void ObjectMotion_SetActionCallback(struct ObjectRuntime *object, s32 action)
Starts an actor's action script: 1 to 4 the fixed action scripts, 5 follow the linked object,...
s32 ObjectMotion_TurnTowardLinkedTarget(struct ObjectRuntime *object)
Script step of action 6: turns the object toward its linked object, at most 1/16 turn a frame.
s32 ObjectMotion_MoveTowardTarget(struct ObjectRuntime *object)
Script step of action 5: follows the linked object.
void BattleFx_FlickerObjectAndTick(union FieldObject *fieldObject)
Per-frame update: flashes an object between sprite param 7 and 0 every 2 frames and spawns the swelli...
void FieldFx_CycleObjectValueByCounter(union FieldObject *fieldObject)
Per-frame update: cycles an object through sprite params 0 to 5, one step every 2 frames,...
void FieldFx_UpdateScaledArcObjectA(union FieldObject *fieldObject)
Per-frame update of arc A: over 32 frames it swells and shrinks again (scale sin(frame / 64 turn)) wh...
void BattleFx_SpawnScaledArcObjects(struct FieldActor *linked)
Spawns the two swelling arcs (object 26) on an object, A and B (B upside down); they follow it for 32...
void FieldFx_UpdateScaledArcObjectB(union FieldObject *fieldObject)
Per-frame update of arc B: arc A upside down, 16 pixels in front of the object and up to 5 pixels nea...
void FieldFx_RunAvoid(void)
The caster spins and flashes, then blinks, and encounters are kept away until Avoid wears off.
void FieldEvent_ShowStatusMessage(void)
Avoid (or the Sacred Feather) has worn off, and the game says so.
void FieldFx_BlinkAvoidCaster(void)
End of the effect: switches the caster's display flags between 3 and 1 on a 5-frame cycle.
void BattleFx_UpdatePairedArcSpawner(union FieldObject *fieldObject)
The caster during the effect: sheds a pair of falling arcs every 5 frames (7 on the world map),...
void Camera_MoveWithinMapBounds(s32 requestedX, s32 requestedY, s32 requestedZ, s32 glide)
The event command "camera move to": sends the camera to the requested axes, 16.16 pixels (-1 keeps th...
void Camera_WaitForArrival(void)
The event command "camera wait for move": waits (at most 600 frames) for the camera to arrive,...
void Camera_SetSpeedParameters(s32 speedLimit, s32 acceleration)
The event command "camera set speed": the camera's top speed and acceleration, 16....
struct FieldActor * Camera_GetEventObject(void)
The event command "get view centre": returns the camera object.
void Camera_FollowActor(s32 actor, s32 keepPosition)
The event command "camera follow actor": the camera (the event's view centre) follows actor.
UNUSED void Camera_FollowObject(struct ObjectRuntime *target, s32 keepCurrentPosition)
Makes the camera follow target; unless keepCurrentPosition is set it jumps there at once.
void Object_PlaceCurrentWithinCameraBounds(s32 actor, s32 glide)
The event command "camera move to actor": Camera_MoveWithinMapBounds to the actor's x and z.
void BattleFx_SteerLiftedTarget(s32 targetId)
Two hands lift it to 24 pixels above the ground; the d-pad moves it 16 pixels at a time and A,...
struct MotionObject * BattleFx_SpawnItemBreakMode1(s32 x, s32 y, s32 z, s32 angle)
Spawns object 215 with the item break sound, in animation 1, and grows it, spinning,...
void BattleFx_SpawnFallingParticles(void)
Per-frame update: drops one particle round the lifted object, 8 to 24 pixels above it and 0 to 48 pix...
void FieldFx_RunCatch(void)
Carries object 215 from 16 pixels above the caster to the goal in 10 steps, growing from a quarter to...
void FieldFx_RunCatchOnTarget(s32 unused)
Abilities: Catch (field kind 13), cast on a target.
s32 Field_ClimbUp(void)
Climbing up (the player presses up at a climbable wall).
s32 Field_ClimbDown(void)
Climbing down (the player presses down at a climbable wall).
s32 Field_TryJumpForward(void)
Makes the leader jump two tiles forward, over the tile in front, when the map allows it (Map_CheckObj...
void FieldFx_StartCloak(void)
The leader blinks 10 times and hides (cloaked set), and the tile check starts; where the leader canno...
void FieldFx_ResumeCloakCheck(void)
Starts the Cloak tile check if the leader is hidden.
void FieldFx_EndCloak(void)
Ends Cloak: stops the tile check and makes the leader blink back into sight, clearing cloaked.
void FieldFx_CheckCloakTile(void)
Scheduler callback of Cloak: when the tile under the leader is not CLOAK_TILE, requests CLOAK_END.
s32 Object_GetScreenPosition(s32 objectId, s32 *position)
Finds where an actor is on screen: position[0] and position[1] receive its x and y in pixels,...
void ObjectEffect_PrepareContextEffect(s32 animation)
Starts the leader's animation for leaving through an exit: centres it on its tile,...
s32 Field_StartEncounterTransition(s32 unused)
Starts the transition into a random battle: plays the scene's battle cue and the encounter sounds,...
void ObjectEffect_EndContextEffect(s32 animation)
Plays the leader's arrival animation through an exit: centred on its tile at the tile's north edge,...
void ObjectEffect_BeginContextEffect25(void)
Leaves through an exit of kind 0x30 (animation 25), recorded in flag 0x121.
void ObjectEffect_BeginContextEffect26(void)
Leaves through an exit of kind 0x20 (animation 26); flag 0x120 makes the next scene play the matching...
UNUSED void ObjectEffect_ReservedNoOp941DC(void)
s32 ObjectEffect_RunPendingFlagEvent(void)
Plays the leader's arrival for the way the last scene was left: through an exit of kind 0x20 (flag 0x...
void ObjectMotion_MoveHalfwayTowardTarget(union FieldObject *fieldObject)
Update hook shared by the Djinni battle-start and Mercury afterimages.
void Djinn_ResolvePendingEvent(s32 shown)
Settles a pending Djinni battle as a scene loads.
void BattleFx_InitializeSlots(void)
Allocates and clears the effect slots (heap block 56) and starts their update callback.
void Djinn_RunBattleStartHop(s32 djinniId)
A Djinni's battle start: the Djinni (actor id) bounces twice, turns to face the leader,...
void BattleFx_RunAngledApproachPhases(struct EffectSlot *particle)
Effect slot callback of a Jupiter Djinni's light particles: each circles its centre while it widens f...
void BattleFx_AdvanceSpinAngle(union FieldObject *fieldObject)
Per-frame update: spins an object 1/8 turn a frame.
void BattleFx_ClearActiveSlotsAndScheduleUpdates(void)
Stops the effect slots: removes their callback, frees every slot still in use and releases their heap...
void BattleFx_UpdateAllSlots(void)
Scheduler callback: updates the 24 effect slots.
void FieldObject_PlaceSceneActors(void)
Puts a Djinni's actor back where its battle started from: for a pending Djinni battle (pendingDjinnEv...
void Djinn_JoinParty(s32 slot, s32 element, s32 djinn)
A Djinni joins the party: djinn (0 to 19) of element goes to the member with the fewest Djinn,...
void FieldFx_SpawnRandomAngleTriplet(union FieldObject *fieldObject)
Per-frame update of a falling particle: on reaching altitude, it scatters three small particles.
void FieldFx_RunDouse(void)
An orb of light rises from 16 pixels above the target to 32 pixels above the destination (80 with var...
void BattleFx_UpdateDriftingFallObject(union FieldObject *fieldObject)
Per-frame update: drifts from side to side as it slowly falls, and is released on reaching the ground...
void FieldFx_RunDouseOnTarget(s32 unused)
Runs Douse cast on a target, through FieldFx_RunDouse.
u32 EffectSlot_HasPendingTarget(struct EffectSlot *effect)
Returns nonzero while an effect slot that stops at its target still has one (it has not arrived),...
void BattleFx_ClearOwnedSlot(struct EffectSlot *slot)
Frees an effect slot and its sprite.
void EffectSlot_UpdateMotion(struct EffectSlot *effect)
Moves an effect slot toward its target, turning at most maxTurnStep a frame when limitTurnStep is set...
void EffectSlot_SetPosition(struct EffectSlot *effect, s32 x, s32 z)
Places an effect slot at (x, z), at rest with no target.
void EffectSlot_Update(struct EffectSlot *effect)
Updates one effect slot: counts its age, runs its callback (after any delay), moves it and draws it.
void EffectSlot_Initialize(struct EffectSlot *effect, s32 kind, s32 x, s32 z)
Fills an effect slot with a new sprite of kind at (x, z): stopping at its target, top speed 2,...
void BattleFx_DrawScaledObject(struct EffectSlot *object)
Draws an effect slot's sprite at its screen position and scale, when it is near the screen.
void EffectSlot_SetCallback(struct EffectSlot *effect, EffectCallback callback)
Gives an effect slot its per-frame callback, starting at state 0.
void EffectSlot_SetObjectMode(struct EffectSlot *effect, s32 mode)
Sets the animation of an effect slot's sprite.
Effect slots: the particles Psynergy effects move and draw.
void(*) EffectCallback(struct EffectSlot *)
void FieldFx_RunForce(void)
A shot appears in front of the caster, grows and flies forward with three afterimages; what it hits (...
void FieldFx_RunForceOnTarget(s32 unused)
Runs Force cast on a target, through FieldFx_RunForce.
const struct SparkleFrame gFieldFx_SparkleFrames[32]
{dy, tile}
void BattleFx_UpdateRadialCamera(struct EffectSlot *effect)
Effect slot callback: state 0 heads for a point 40 to 70 pixels from where the particle appeared; sta...
void BattleFx_ResumeObject(s32 actorId)
Resumes object id with the update and param kept by BattleEffect_PauseObject.
s32 BattleFx_FilterObjectIdByFlags(s32 id)
Returns id, or -1 (no target) when the current effect's definition has flags 0xff.
void BattleEffect_RunFallbackObjectTransition(void)
Throws an object from the caster to the effect's position over 10 frames and scatters it into 16 part...
void BattleEffect_SetRandomTableValueOnObject(union FieldObject *fieldObject)
Per-frame update of a paused object: gives its sprite one of the table's eight params at random.
void BattleFx_MarkChildAndRunFallbackTransition(s32 unused)
Pauses the target (scene->child) and runs BattleEffect_RunFallbackObjectTransition.
void BattleEffect_PauseObject(s32 actorId)
Pauses object id, keeping its per-frame update and, if it is animated, its first animation's param in...
void BattleFx_SetObjectAlternatingWords(union FieldObject *fieldObject)
Per-frame update: makes an object pulse, switching its scale between the two values of gBattleFx_Puls...
void BattleEffect_UpdatePhasedRadialParticle(struct EffectSlot *effect)
Effect slot callback of a Mars Djinni's sparks.
void BattleFx_AdvanceAngleWithRamp(union FieldObject *fieldObject)
Per-frame update: spins an object ever faster, from 1/16 turn a frame up to 1/8.
void Djinn_RunJupiterJoinEffect(s32 djinniId)
A Jupiter Djinni joins the party: it bounces three times, spins, leaps out of sight and bursts into 2...
s32 SpawnHeavyImpactEffect(struct ScriptInterpreter *interpreter)
A heavy impact: places object 0x11b 32 pixels below the source and scatters 12 shards from it.
void FieldFx_RunLiftOnTarget(s32 unused)
An object appears 32 pixels to either side, each moves 14 pixels in, and they lift the target 32 pixe...
struct MotionObject * BattleFx_SpawnItemBreakMode3(s32 x, s32 y, s32 z, s32 angle)
Spawns object 215 and grows it, spinning, from a quarter to full size over 24 frames; angle is the wa...
void BattleFx_UpdateRadialBurst(struct EffectSlot *slot)
Effect slot callback of a particle that scatters 25 pixels from its origin in a random direction,...
void BattleFx_UpdateDescendingOrbitObject(union FieldObject *fieldObject)
Per-frame update of a Venus Djinni's falling motes: each circles the leader on a shrinking spiral (ra...
void Djinn_RunMarsJoinEffect(s32 djinniId)
A Mars Djinni joins the party: it turns to the camera, bounces three times, spins ever faster and shr...
void BattleFx_UpdateRadialSpread(struct EffectSlot *effect)
Effect slot callback of a Venus Djinni's particles: each starts on screen at a random point 10 to 20 ...
void BattleFx_RunMercuryDjinnCapture(s32 djinniId)
A Mercury Djinni joins the party: the screen is tinted blue, the Djinni bounces twice and hops three ...
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.
void BattleFx_UpdateItemBreakFragment(union FieldObject *fieldObject)
Per-frame update of a broken item's main fragment: turns it toward the object it is linked to,...
s32 Input_GetDpadAngle(u32 unused)
Returns the direction of the d-pad (0x10000 a full turn): right 0, down 0x4000, left 0x8000,...
void * BattleFx_StartItemBreak(void *object)
Spawns the broken item (object 215) 16 pixels above object and moves it 16 pixels the way object face...
void UpdateRisingParticleBurst(void *object)
Per-frame update: the object spins as it rises for 31 frames, shrinks, and bursts into 8 particles.
void BattleFx_UpdateOrbitAndReturn(struct EffectSlot *slot)
Effect slot callback of a particle that flies 30 pixels out from where it started,...
void BattleFx_SnapScaleToFull(struct MotionObject *obj)
Per-frame update: grows an object's scale by 1/16 a frame up to full size and fixes its position.
void BattleFx_SteerPushedTarget(s32 targetId)
Puts the pushing hand beside the target and pushes the target 16 pixels the way the d-pad points,...
void FieldFx_RunMove(void)
Shows the broken item beside the caster for 30 frames, then turns it into particles.
void FieldEvent_RunTypeHandler(void)
The extra handler of Reveal, Cloak and Avoid: what each does when it ends.
void ObjectGroup_SetActionForOthers(struct ObjectRuntime *except, s32 state, s32 value)
Sets the movement state and animation timer steps of every object but the player's and except.
s32 ResourceTable_CountFreeBlocks(void)
Counts the free blocks (owner 0xff) of the 512 resource blocks.
void BattleFx_DispatchRequestKind(void)
Casts the current Psynergy effect on its target (secondObjectId): runs the handler of its kind.
s32 Field_RunEventAction(const void *event, s32 param, s32 target)
Runs the event tied to an effect: a result below 0x10000 is a message, shown at target; a larger one ...
struct AnimationObject * Sprite_ShareVramCache(struct AnimationObject *sourceSprite, struct AnimationObject *sharedSprite)
Makes sourceSprite share sharedSprite's VRAM block, releasing its own; with no sharedSprite it keeps ...
void BattleFx_ClearChildValueOnMismatch(void)
Finishes the current effect when it is Mind Read: ends the effect and lets its target move again,...
void Motion_SetTargetPositionFromMagnitudeAngle(struct ObjectRuntime *object, s32 magnitude, s32 angle)
Sends an object toward the point magnitude (16.16 pixels) away from it in direction angle: sets its m...
void Field_DispatchTypeHandler(s32 kind)
Runs one step of the current Psynergy effect: 0 casts it with no target, 1 casts it on its target (se...
void BattleFx_Run(void)
Casts the current Psynergy effect with no target: runs the body of its kind (scene->fieldKind).
struct ObjectRuntime * Object_Spawn(s32 kind, s32 x, s32 y, s32 z)
Creates an object for an effect, at the caster's ground height, with sprite priority 0 and animation ...
void ObjectGroup_ApplyRandomChildValues(union FieldObject *fieldObject)
Per-frame update: sets every part of an object's sprite to param frame % 6, which cycles its colours.
s32 Event_AskYesNoWithActorAnimation(s32 actor, s32 forceBottom)
The event command "choose yes or no": once the message on screen has been read, asks yes or no below ...
void Event_SetExitRequest(u16 request)
The event command "request exit": sets the field's exit request (999 leaves for gGameState's scene an...
void Event_SetSavedDestination(u16 scene, u16 entrance)
Makes the event leave and records scene and entrance as the saved destination.
void Actor_WaitForAnimationEnd(s32 actor, s32 animation)
Waits, at most 90 frames, for an actor's animation to stop being animation: the actor has finished a ...
s32 Menu_AskYesNo(s32 atBottom)
Asks yes or no at the top of the screen, or at the bottom with atBottom set.
s32 PartyInventory_GiveItem(s32 item, s32 unused)
The event command "give item": gives item to the first party member with room for it and says so.
UNUSED void Event_NoOpHookA(void)
Nothing calls it.
void Leader_StopMoving(void)
Stops the leader where it stands: no horizontal velocity, the normal walking speed (1....
void FieldEvent_End(void)
Ends an event: stops the debug fast-forward callback, gives the camera back to the leader and refresh...
void Event_UpdateDebugSkip(void)
Debug only: while debug mode is on, R makes every event wait (FieldEvent_WaitFrames) end at once and ...
void Event_FinishScreenTransition(void)
The event command "close screen": finishes the event's screen transition and clears work->transitionA...
void Event_SetSceneEvents(const struct SceneEvent *events)
Sets the scene's event table, which the field checks as the leader moves: writes work->events.
void Inventory_NoOpCallback(void)
An empty function; nothing in ☀️ calls it.
void Event_ClearInvalidPackedValues(void)
Clears each button shortcut whose Psynergy can no longer be cast: zeroes gGameState....
void Event_WaitTransitionFrames(void)
The event command "wait for screen": waits as long as the transition runs (work->transitionFrames).
void FieldEvent_WaitFrames(s32 frames)
The event command "wait": waits the requested frames, unless debug fast forward (Event_UpdateDebugSki...
s32 Party_CheckItemLimit(s32 item)
Checks whether the party can carry one more of item: each member carries at most 30 of one item.
void Event_PrepareTwoObjectsAndApply(s32 first, s32 second)
Adds two units to the party and announces them together.
void Party_RemoveOwnerRestored(s32 unit)
Takes unit out of the party, fully restoring its HP and PP and curing its poison.
void Event_RunObjectHookAndWait(struct ScenePlacement *table)
Respawns the scene's actors from a placement table and waits one frame for them to appear.
void Event_StartScreenTransition(void)
The event command "open screen": starts the event's screen transition and sets work->transitionActive...
s32 Inventory_TryAddAndReturnOwner(s32 item, s32 unused, s32 unit)
Gives item to one party member.
void Event_SetDestination(s32 scene, s32 entrance)
Makes the event leave for the given entrance of the given scene: raises the exit request 999 and writ...
void Event_CallWithLastActiveObjectId(struct ScenePlacement *table)
Spawns the actors of a placement table after the last actor in use.
void FieldEvent_Begin(void)
The event command "begin event": closes any timed notice, stops the leader, resets the message and ti...
s32 Event_ValidatePackedId(u32 shortcut)
Checks an L or R button shortcut, packed as the member in bits 10 to 13 and the Psynergy in bits 0 to...
void Event_NoOpHook(void)
An empty hook; it does nothing in the released game.
void Event_PrepareObjectAndApplyValue(s32 unit, s32 announce)
Adds unit to the party.
void Inventory_ReservedNoOp(void)
An empty function; nothing in ☀️ calls it.
void Party_LearnAbility(s32 unit, s32 ability)
Teaches unit the Psynergy ability and says so with its jingle, waiting for the player to read it.
void BattleFx_UpdateOrbitingParticleLeft(union FieldObject *fieldObject)
Spirals anticlockwise at twice the frames left in pixels, then fades.
void FieldFx_RunFrost(void)
16 particles spiral in on the effect's position and make the target flash 16 times; without childOpti...
void FieldFx_RunFrostOnTarget(s32 unused)
Runs Frost cast on a target.
void BattleFx_UpdateOrbitingParticleMain(union FieldObject *fieldObject)
Per-frame update: flashes (animation 2) for 2 frames in every 8.
void BattleFx_UpdateOrbitingParticleFade(union FieldObject *fieldObject)
Per-frame update: shrinks by 1/16 a frame and is released at 1/16.
void BattleFx_UpdateOrbitingParticleRight(union FieldObject *fieldObject)
Per-frame update: as BattleFx_UpdateOrbitingParticleLeft, clockwise.
void BattleEffect_SpawnBurstParticleField(void)
Sends 24 particles, one every 2 frames, from in front of the caster to points round the effect's posi...
void FieldFx_RunGrowthOnTarget(s32 unused)
Particles round the target, which takes the sprite priority of the ground under it.
void FieldFx_RunGrowth(void)
The particles, then five falling objects 4 to 10 pixels round the effect's position.
struct UiWindow * UiText_OpenMessageAtObject(s32 actor, s32 unused)
The event command "open message": opens the event's current message in a speech window next to the sp...
void Ui_SetMessageVoiceFromActor(s32 actor)
Sets the voice of the messages that follow to that of actor's sprite, at the rate the message speed o...
void ObjectTable_RunIfActive(s32 actor)
Closes the portrait of an actor's sprite, if it has one.
void Event_ShowSpeakerMessage(s32 speaker)
A speaker-message entry point retained by its overlay veneer, with no current scene caller.
void ObjectTable_CallRefreshHook(s32 unused0, s32 unused1, s32 x, s32 y)
Retained by its overlay veneer; no current caller establishes the coordinates forwarded to Event_Show...
void BattleEventRuntime_EmptyCallback(void)
void Event_ShowMessageAtPosition(s32 unused0, s32 unused1, s32 x, s32 y)
A retained coordinate-message entry point: waits for the message and advances the event's message ind...
void FieldEvent_ShowMessageAndWait(s32 actor, s32 flags)
The event command "show message": opens the current message at actor (UiText_OpenMessageAtObject) and...
void BattlePres_RunActionThenWaitIfModeZero(s32 actor, s32 flags, s32 wait)
The event command "show message and wait": shows the message, then waits wait frames.
void Battle_ShowPairedUnitWorkAndWait(s32 first, s32 firstX, s32 firstY, s32 firstPortraitX, s32 firstPortraitY, s32 second, s32 secondX, s32 secondY, s32 secondPortraitX, s32 secondPortraitY)
The event command "show two messages and wait": two actors speak at once, each message at its own (x,...
s32 FieldEvent_AskYesNoAndShowResponse(s32 actor, s32 flags)
The event command "ask yes or no": opens the question at actor, lets the leader answer,...
void BattleFx_UpdateAllEffectSlots(void)
Scheduler callback: updates the 24 effect slots.
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...
void BattleFx_SetupObjectPair(s32 userId, s32 targetId)
Records the caster and the target of an effect.
void EffectRuntime_StopCurrentObject(void)
Stops the caster's per-frame hook and restores its colours.
void BattleEffect_CleanupSceneObjects(void)
Ends a Psynergy effect: frees the effect slots still in use and, unless another effect is being resol...
void Camera_WorldToScreen(struct EffectVector *position)
Converts a world position (16.16 pixels) to the screen: x and z receive the screen's x and y and y be...
void EventObject_Initialize(void)
Starts casting: the caster takes its casting pose (animation 20) and stops.
void BattleFx_LoadActionEffectResources(s32 abilityId, s32 mode)
Prepares the work of the Psynergy effect for ability (heap slot 56) and loads its spark tiles.
void Map_SetViewBounds(s32 minX, s32 minY, s32 maxX, s32 maxY)
The event command "set view bounds": the camera keeps the screen inside these map coordinates (Camera...
void BattleFx_ScheduleRatioTransition(s32 zoom, s32 frames)
Starts a zoom to zoom (16.16) over frames frames, on the world map (event mode 3) only.
void Event_WaitForZoomTransition(void)
Waits for a zoom transition to end (on the world map only, at most 300 frames).
void BattleFx_SpawnLinked(s32 actor, s32 emote, s32 wait)
The event command "actor show emote": shows an emote bubble (object 21) over an actor,...
void BattleFx_ConfigureLinkedObject(s32 actor, s32 flags)
The event command "actor set attached effect": with mode (the low 2 bits) 0 removes the object attach...
s32 BattleFx_CopyLinkedObjectPosition(union FieldObject *fieldObject)
s32 FieldFx_StepRatioTransition(void)
void BattleFx_RunVisibilityTransition(void)
On the world map, zooms the view out (0x9d89) while L is held, then back.
void Map_UpdateWorldMapMarkers(void)
Scheduler callback of the world map screen: shows a marker at each place whose flag is set,...
void BattleFx_SetupResourcesAndWindow(void)
Sets up the world map screen: the marker tiles and their OAM entries, the cursor where the leader is ...
void Map_ShowWorldMap(s32 picture)
Borrows the map-cell buffer for the still map until A or B closes it.
void Field_UpdateObjectVisibilityBounds(void)
On the world map, shows only the scene actors within 320 pixels sideways, 600 above and 400 below the...
void BattleFx_CleanupResourcesAndWindow(void)
Closes the world map screen: returns its VRAM blocks and removes the place-name window.
void FieldFx_RunPlyOnTarget(s32 unused)
Runs FieldFx_RunPly, then stops the caster's hook.
void FieldFx_RunPly(void)
Eight particles spiral into the centre, where one appears, sheds sparks and flies far away.
void BattleFx_RunSparkEmitter(union FieldObject *fieldObject)
Per-frame update: sways 6 pixels either side (a 64-frame cycle) 16 pixels above the effect's position...
void BattleFx_SwayParticle(union FieldObject *fieldObject)
Per-frame update: sways 4 pixels either side of anchorX, once every 128 frames.
void BattleFx_UpdateShrinkingOrbitObject(union FieldObject *fieldObject)
Per-frame update: spirals in on a point 10 pixels above the effect's position, at a radius of as many...
FieldKind
A field Psynergy's effect, as the field kind: the type column of games/tbs/src/game/actions....
@ FIELD_KIND_WHIRLWIND
Whirlwind and Gale.
void Field_RequestBattleFromEncounterTable(s32 zoneNo, s32 slotNo)
Sets up a battle with enemy group slot of encounter table zone.
void Event_SetDefeatDestination(s32 scene, s32 entrance)
Sets where the party wakes up after losing a battle (gGameState.defeatScene and defeatEntrance).
void Event_SetNextDestination(s32 scene, s32 entrance)
Sets the scene and entrance that the field goes to next (gGameState.nextScene and nextEntrance).
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any.
void Field_RequestDjinnBattle(s32 flag, s32 no)
Sets up the battle with Djinni number no.
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the...
void Event_RequestDestination(u16 scene, u16 entrance)
Makes the event leave for entrance entrance of scene scene: sets gGameState.scene and entrance and ra...
void FieldFx_RunRetreat(void)
Spins the main object and shrinks it while 24 particles fly out, one a frame.
void FieldFx_UpdateSpinAngle(union FieldObject *fieldObject)
Per-frame update: spins by 0x1000 + timer * 0x50 a frame, speeding up (timer counts up) until timer *...
void BattleFx_UpdateDescendingParticleNegativeArc(union FieldObject *fieldObject)
As BattleFx_UpdateDescendingParticlePositiveArc for the arc drawn upside down, 16 pixels in front of ...
void BattleFx_UpdateDescendingObject(union FieldObject *fieldObject)
Per-frame update: spins 1/8 turn a frame as it shrinks, rising a pixel a frame; released once its sca...
void BattleFx_SpawnDescendingArcParticles(struct FieldActor *arc)
Spawns a pair of falling arcs (one upside down) on arc.
void BattleFx_UpdateDescendingParticlePositiveArc(union FieldObject *fieldObject)
Per-frame update of a falling arc: grows toward full size as it falls 2 pixels a frame on the object ...
void BattleFx_UpdateRadialLaunch(struct EffectSlot *slot)
Effect slot callback: a particle flies 120 pixels from the main object's screen position (8 pixels lo...
void FieldEffect_WatchLeaderDistance(void)
Scheduler callback of the timed effect (kind 8): asks for it to end once the leader is 60 pixels from...
void FieldFx_RunReveal(void)
Starts a screen transition centred on the leader, runs the matching event if there is one,...
void ResetSceneTransitionEffect(void)
Ends Reveal if it is running: stops its watch, brings the colours back from black over 30 frames and ...
void ObjectDispatch_ApplyValueToKind200Children(s32 value)
Passes value (as animation timer steps) to every one of the 64 objects whose first sprite part shows ...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
A field object as Avoid's caster: its facing, its animation records and the phase and frame count of ...
A FieldActor seen with the halfword at 0x64 unsigned and the one at 0x66 signed, as the bytes read th...
A field object as the object dispatcher's far calls take it.
A FieldActor seen with the halfword at 0x5e (here its phase), which FieldActor does not name.
A particle a Psynergy effect moves and draws: its sprite, its position and target,...
A world position, as Camera_WorldToScreen converts it to the screen.
A field object seen as one that turns toward its facing target: its facing, its ground position and t...
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
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....
u16 wait
the object script's wait, in frames (ScriptMotionObject)
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
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
s32 z
16.16 fixed-point pixels
void * animation
its sprite, or its list of four, by animationKind
s32 x
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
A scene event: its kind and detail, the trigger it answers, its condition and its value (a message or...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
The prefix that command handlers read from a field object's 0x70-byte slot.
A FieldActor seen with the halfword at 0x5e (its lifetime), which FieldActor does not name.
One frame of a sparkle: its height offset and tile (fxdata.c).
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
u16 flags
UI_WINDOW_ flags; 0 once closing or free.
The integer types, TRUE, UNUSED and the fixed-address macros.
An object on the field, read as an actor or as an effect.
void BattleFx_UpdateRandomTargetParticle(struct EffectSlot *effect)
Effect slot callback of a Mercury Djinni's droplets: each falls from 100 pixels above to a random poi...
void BattleFx_HalveDistanceToTarget(union FieldObject *fieldObject)
Per-frame update of an afterimage: closes half the distance to the object it is linked to.
void BattleFx_RunVenusDjinnCapture(s32 djinniId)
A Venus Djinni joins the party: it hops twice, spins and leaps, then shrinks away; the leader turns t...
void FieldMotes_Update(void)
Scheduler callback: the floating motes.
void FieldFx_ResumeLightning(void)
Restarts the lightning: the next flash in 128 frames, repeating.
void FieldFx_UpdateLightning(void)
Scheduler callback for the storm: every 150 to 550 frames lightning flashes the palette three times (...
void FieldMotes_Start(void)
Starts the floating motes (FieldMotes_Update): loads their tiles and puts 32 of them under the leader...
void FieldFx_StartLightning(void)
Starts the storm's lightning (FieldFx_UpdateLightning): builds the dark (0x10003) and lit (0x10005) p...
void BattleFx_StartBufferBlend(s32 from, s32 to)
Flashes the palette once, 120 frames from now, from palette from to palette to (BattleFx_BuildBuffer ...
void FieldFx_UpdateGroundParticles(void)
Scheduler callback: animates the ground particles.
void FieldEffect_UpdateSparkles(void)
Scheduler callback: the sparkles.
void FieldFx_StopLightning(void)
Stops the lightning: no flash for 0x7fff frames, and none after.
void FieldEffect_InitSparkles(void)
Starts the sparkles (FieldEffect_UpdateSparkles): loads their tiles and clears the 32 sparkles.
void FieldFx_StartGroundParticles(void)
Starts the ground particles (FieldFx_UpdateGroundParticles) with sound 170: loads their tiles and put...
void FieldFx_LastLightning(void)
One last flash of lightning in 12 frames, then no more.
void BattleFx_ShrinkObjectScaleUntilHalf(union FieldObject *fieldObject)
Shrinks a scene-selected Whirlwind target each frame; below half size, moves it to the origin,...
void BattleFx_WanderAroundAnchor(union FieldObject *fieldObject)
Per-frame update: wanders away from the anchor, 2 to 3 pixels a frame, now and then turning sharply; ...
void FieldFx_RunWhirlwind(void)
An orb is carried from the caster to 4 pixels above the effect's position over 10 frames,...
void BattleFx_CircleAnchor(union FieldObject *fieldObject)
Per-frame update: circles the anchor at 8 pixels; after 121 frames it starts to wander (BattleFx_Wand...
void FieldFx_RunWhirlwindOnTarget(s32 unused)
Runs Whirlwind using the target already stored in the effect scene.
void FieldFx_UpdateParticleMotionAndScale(union FieldObject *object)
Per-frame update of a particle: moves by its velocity, slowing its x and z velocity a little,...
void BattleFx_SpawnRadialParticleRing(struct MotionObject *origin)
Spawns 17 particles that spread from origin in a flat ring, their x velocity 1.5 times their z veloci...