9 BattleFx_MoveAfterimageHalfway(fieldObject);
12#define DJINNI_CLONE_MAX 8
43 djinni->sprite->image.priority = 0;
69 sprite = djinni->sprite->entries[0]->animId;
91 copy->sprite->image.priority = 0;
96 copy->linkedObject = prev;
103 64 << 16, dir + 0x8000);
115 djinni->sprite->image.priority = 2;
145 else if (element == 1)
147 else if (element == 2)
149 else if (element == 3)
174 flags =
event & 0x800;
177 for (
id = 8;
id <= 65;
id++) {
195 leader->
z - (32 << 16));
212 s32 kind = *pending & 0xf000;
213 s32 flag = *pending & 0xfff;
218 if (flag < DJINNI_0 || flag >
DJINNI_0 + 80)
224 }
else if (kind == 0x1000) {
237 s32 element = djinni / 20;
238 s32 index = djinni % 20;
241 for (actor = 8; actor <= 65; actor++) {
278 slot = &scene->
slots[i];
289 object->angle += 0x2000;
300 if (particle->
state == 0) {
303 if ((
s16)particle->
age == 60) {
305 particle->
state += 1;
307 }
else if (particle->
state == 1) {
309 if ((
s16)particle->
age == 40) {
311 particle->
state += 1;
313 }
else if (particle->
state == 2) {
315 position.
x = target->
x;
316 position.
y = target->
y + 0x140000;
317 position.
z = target->
z;
321 if ((
s16)particle->
age == 40) {
323 particle->
state += 1;
325 }
else if (particle->
state == 3) {
328 if ((
s16)particle->
age == 60) {
330 particle->
state += 1;
332 }
else if (particle->
state == 4) {
339 particle->
x = position.
x;
340 particle->
z = position.
z;
343#undef DJINNI_CLONE_MAX
void Motion_SetVarCbAndRefresh(u32 objectId, s32 count)
The event command "run repeated motion": as ObjectMotion_SetVariantCallback, then waits for it to end...
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 ObjectMotion_ArmCallback(s32 objectId, s32 angle, s32 wait)
The event command "actor face direction": the actor turns toward angle (0x10000 a full turn; ObjectMo...
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
void * ObjectTable_Get(u32 actorIndex)
Returns the actor in slot index (0 to 65), or NULL.
void BattleEffect_ClearOutOfBoundsObjects(void)
Destroys the placed actors far from the view's centre: more than 160 pixels to either side,...
void BattleEffect_ClearAllObjects(void)
Destroys every placed actor and places the scene's actors again from its first placement table after ...
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...
#define DJINNI_CLONE_MAX
afterimages of the leaping Djinni
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,...
#define Dma_Fill32(value, destination, size)
Fills size bytes at destination with the word value by DMA3.
void BattleFx_ClearOwnedSlot(struct EffectSlot *slot)
Frees an effect slot and its sprite.
struct ObjectRuntime * Object_CreateFar(s32 id, s32 x, s32 y, s32 z)
Far call to FieldObject_Create.
void Object_SetPositionAndResetMotionFar(struct ObjectRuntime *obj, s32 x, s32 y, s32 z)
void ObjectDispatch_SetSingleChildFlagsFar(struct DispatchObject *obj, u32 flags)
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void Animation_ApplyChildValuesFar(struct DispatchObject *obj, u32 val)
void FieldObject_WaitForMoveFar(void *fieldObject)
s32 GameFlag_TestFar(s32 flag)
s32 GameFlag_SetBitFar(s32 flag)
s32 Djinn_AddToLeastLoadedOwnerFar(s32 element, s32 djinn)
void AudioCommand_PlayFar(s32 id)
void Djinn_ShowJoinedMessageFar(s32 pc, s32 element, s32 djinn)
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
#define FLAG_DJINN_TUTORIAL
#define FLAG_KEEP_PARTY_POSITION
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
struct GameState gGameState
void * gEffectWork
Slot 56: points to a scene-specific structure.
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
void Djinn_RunJupiterJoinEffect(s32 djinniId)
A Jupiter Djinni joins the party: it bounces three times, spins, leaps out of sight and bursts into 2...
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 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 Runtime_ReleaseHeapBlock(s32 slot)
void BattleFx_RunMercuryDjinnCapture(s32 djinniId)
A Mercury Djinni joins the party: the screen is tinted blue, the Djinni bounces twice and hops three ...
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 ...
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 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 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 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...
What every part of psynergy_effects.c shares: its includes and the macros and types more than one par...
#define DJINNI_0
gGameState.pendingDjinnEvent of Djinni 0 (requests.c, djinni.c).
#define HEAP_SLOT_FX
the Psynergy effect's work (gWorkSlot[56], gEffectWork)
#define PSYNERGY_EFFECT_SLOT_COUNT
The effect slots of a Psynergy effect's scene (gEffectWork->slots).
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,...
#define SE_JUMP
An actor jumps: ObjectMotion_Launch plays the high jump above 5 pixels a frame.
struct EventWork * gEventWork
void WorldMap_EndEvent(void)
Ends what WorldMap_BeginEvent started: on the world map, reloads the area's graphics and sets the cam...
void WorldMap_BeginEvent(void)
Starts an event or menu on the world map: ends any colour ratio transition in progress,...
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
struct EffectSlot slots[24]
A field object as the object dispatcher's far calls take it.
A particle a Psynergy effect moves and draws: its sprite, its position and target,...
s8 state
the callback's own step; 0 when it is given
s32 originX
16.16 fixed-point pixels; where the slot started
s32 z
16.16 fixed-point pixels
s32 x
16.16 fixed-point pixels
s32 originZ
16.16 fixed-point pixels; where the slot started
s8 active
nonzero while the slot is in use
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 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
u8 steeringFlags
ActorSteeringFlag bits.
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
s32 velocityX
16.16 fixed-point pixels per frame
union FieldCoordinate y
16.16 fixed-point pixels
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
s32 velocityY
16.16 fixed-point pixels per frame
union FieldCoordinate z
16.16 fixed-point pixels
s32 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 scaleY
16.16 fixed point, 0x10000 full size
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
s32 velocityZ
16.16 fixed-point pixels per frame
Full event work allocated by Field_RunScene (heap slot 27).
s16 event
A raised event for Scene_RunRaisedEvent, or -1 when characters fell to poison or hazard damage,...
s16 mode
MODE_WORLD_MAP (3) on the world map.
struct FieldActor * actors[66]
The actors by id: 0 to 7 the party's characters, 8 on the placed actors.
The game's state: play time, coins, the scene and the leader's position, the active party and the opt...
s16 pendingDjinnEvent
The Djinni battle pending (DJINNI_0 plus its number, flags in bits 15 to 11), resolved on returning t...
s16 sceneChangeReason
the last battle's result; -1 for a defeat
s32 selectedActor
the leader: its unit and its actor
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 terrainHeight
16.16 fixed-point pixels
s32 z
16.16 fixed-point pixels
u8 flags
FieldActor.motionFlags: 3 when created, 4 for a placed actor above the ground; zero is free flight in...
s32 x
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
s32 x
16.16 fixed-point pixels
s16 condition
-1 always, a flag | 0x1000 set, else the flag clear; off the world map, 48 to 127 also need condition...
s32 z
16.16 fixed-point pixels
s32 y
16.16 fixed-point pixels
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
#define MODE_WORLD_MAP
the world map
void BattleFx_RunVenusDjinnCapture(s32 djinniId)
A Venus Djinni joins the party: it hops twice, spins and leaps, then shrinks away; the leader turns t...