249 if (script < 0x10000) {
281 volatile u32 *frameCount;
288 initialCount = animation->
count;
289 if (initialCount != 0) {
292 remainingParts = initialCount;
294 spritePart = *parts++;
295 param = *frameCount % 6;
298 }
while (remainingParts != 0);
300 animation->
dirty = 1;
309 s32 magnitude,
s32 angle) {
334 }
while (remaining != 0);
351 sprite = sourceSprite;
353 if (sprite !=
NULL) {
354 if (sharedSprite ==
NULL) {
360 sprite = sharedSprite;
376 if (
object !=
NULL) {
381 object->terrainHeight =
384 object->priorityFlags = 4;
405 if (actorId != *player &&
object !=
NULL &&
object != except) {
406 object->movementState = state;
void Event_SetMessageId(s32 message)
The event command "set message": the number of the event's next message, written to work->message.
void * ObjectTable_Get(u32 actorIndex)
Returns the actor in slot index (0 to 65), or NULL.
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 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,...
void FieldFx_RunCarry(void)
Carry cast with no target: objects appear above the caster and to either side, move apart and scatter...
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.
void FieldFx_StartCloak(void)
The leader blinks 10 times and hides (cloaked set), and the tile check starts; where the leader canno...
void FieldFx_EndCloak(void)
Ends Cloak: stops the tile check and makes the leader blink back into sight, clearing cloaked.
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 FieldFx_RunDouseOnTarget(s32 unused)
Runs Douse cast on a target, through FieldFx_RunDouse.
struct ObjectRuntime * Object_CreateFar(s32 id, s32 x, s32 y, s32 z)
Far call to FieldObject_Create.
void ObjectDispatch_ReleaseFar(struct DispatchObject *obj)
void ObjectDispatch_SetSingleChildFlagsFar(struct DispatchObject *obj, u32 flags)
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void ObjectDispatch_SetAnimationSpeedFar(struct DispatchObject *obj, s32 val)
void Object_SetMoveTargetFar(struct ObjectRuntime *object, s32 x, s32 y, s32 z)
s32 GameFlag_TestFar(s32 flag)
void UiText_ShowPositionedMessageAndWaitFar(s32 no, s32 flags)
#define FLAG_NOTHING_HAPPENS
Set before an action on the field; still set afterwards, nothing came of it and the game says so.
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.
volatile u32 gFrameCount
Frames WaitFrames has finished.
struct GameState gGameState
void * gEffectWork
Slot 56: points to a scene-specific structure.
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 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 FieldFx_RunLift(void)
Lift cast with no target: objects appear above the caster and to either side, move apart and scatter ...
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...
#define SET_VECTOR(v, x, y, z)
Sets the x, y and z of a three-part vector: a position about to be projected, a per-frame step,...
void Vector_AddPolarOffset(s32 radius, s32 angle, void *position)
Moves the point position by radius in direction angle on the ground plane: x by the cosine,...
void RunSceneTransitionEffect(s32 x, s32 y)
Starts the wave effect of caster sourceId on target targetId: fades the palettes toward a hue that sh...
void BattleFx_FinishSceneAndReleaseHeapBlock(void)
Stops the wave effect: restores the caster's colours and the palettes and releases the effect's work.
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.
s32 Scene_FindActorTalkEvent(s32 id)
Returns the talk event of actor id: for the actor the party has stopped, its kind 7 event if it has o...
s32 Field_FindNearbyPsynergyTarget(s32 id, s32 kind)
Returns the actor nearest in front of actor id that a field Psynergy of the given kind can reach,...
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.
void FieldEvent_End(void)
Ends an event: stops the debug fast-forward callback, gives the camera back to the leader and refresh...
void FieldEvent_Begin(void)
The event command "begin event": closes any timed notice, stops the leader, resets the message and ti...
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 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.
void FieldEvent_ShowMessageAndWait(s32 actor, s32 flags)
The event command "show message": opens the current message at actor (UiText_OpenMessageAtObject) and...
void BattleFx_SetupObjectPair(s32 userId, s32 targetId)
Records the caster and the target of an effect.
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.
@ FIELD_KIND_WHIRLWIND
Whirlwind and Gale.
What every part of psynergy_effects.c shares: its includes and the macros and types more than one par...
#define HEAP_SLOT_FX
the Psynergy effect's work (gWorkSlot[56], gEffectWork)
void FieldFx_RunRetreat(void)
Spins the main object and shrinks it while 24 particles fly out, one a frame.
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 ...
s32 _call_via_r3(s32, s32, s32, s32)
One animation layer of a sprite: its animation id, frames, running script and timer.
u8 param
SpriteColorMode its pixels are drawn with; 0 when taken.
u8 pos
byte offset of the next command in script
u8 kind
The facing table its frames follow (from the metadata, or ANIM_CMD_SET_KIND); zero marks a free layer...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart image
u8 slot
VRAM cache entry holding its tiles.
struct AnimationEntry * entries[4]
its layers; empty ones null
u8 count
layers in use, up to the last one present
u8 retainCacheEntry
Keeps the VRAM cache entry when it is released or off screen.
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
u16 priority
2 when created
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
s16 firstObjectId
the caster's object id
void * mainObject
the caster's object
s16 fieldKind
the ability's field kind (FIELD_KIND_)
void * child
the target's object, or NULL
s8 enabled
Set at the start: Force then aims in front of the caster; cleared once the target has been dispatched...
s16 secondObjectId
the target's object id, -1 for none
A field object as the object dispatcher's far calls take it.
One of the scene's events (the same 12 bytes as struct SceneEvent).
s32 result
below 0x10000 a message, else a function to call
Full event work allocated by Field_RunScene (heap slot 27).
s16 revealActive
nonzero while Reveal is active
s16 pausedObject
Halt: the stopped object; -1 for none.
s32 selectedActor
the leader: its unit and its actor
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
s32 terrainHeight
16.16 fixed-point pixels
u8 movementState
nonzero skips its script and motion (paused)
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
u8 animationKind
Low four bits: 0 no sprite, 1 one sprite, 2 a group of up to four.
An object on the field, read as an actor or as an effect.
#define OBJ_LAST
the last actor slot searched
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
u8 gResourceBlockOwners[VRAM_BLOCK_COUNT]
void FieldFx_RunWhirlwind(void)
An orb is carried from the caster to 4 pixels above the effect's position over 10 frames,...
void FieldFx_RunWhirlwindOnTarget(s32 unused)
Runs Whirlwind using the target already stored in the effect scene.