Running a field Psynergy by its kind, and helpers its effects share. More...
Go to the source code of this file.
Functions | |
| 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 (secondObjectId), 2 finishes it and 3 runs its kind's extra handler. | |
| void | _call_via_r3 (s32, s32) |
| void | BattleFx_Run (void) |
| Casts the current Psynergy effect with no target: runs the body of its kind (scene->fieldKind). | |
| void | BattleFx_DispatchRequestKind (void) |
| Casts the current Psynergy effect on its target (secondObjectId): runs the handler of its kind. | |
| void | BattleFx_ClearChildValueOnMismatch (void) |
| Finishes the current effect when it is Mind Read: ends the effect and lets its target move again, unless the target is the object kept stopped. | |
| void | FieldEvent_RunTypeHandler (void) |
| The extra handler of Reveal, Cloak and Avoid: what each does when it ends. | |
| 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 is a routine, called with param and target (through r3). | |
| 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 | 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 move target. | |
| s32 | ResourceTable_CountFreeBlocks (void) |
| Counts the free blocks (owner 0xff) of the 512 resource blocks. | |
| 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 its block. | |
| 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 1. | |
| 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. | |
Running a field Psynergy by its kind, and helpers its effects share.
Part of psynergy_effects.c, compiled only through it.
Definition in file dispatch.c.
| 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 (secondObjectId), 2 finishes it and 3 runs its kind's extra handler.
Exported as Field_DispatchTypeHandlerFar; Goma Cave's entrance imports it and passes 1 to play Whirlwind on the stump's ivy from its own event.
Definition at line 15 of file dispatch.c.
Referenced by Djinn_ResolvePendingEvent(), Field_DispatchTypeHandler(), and GomaCaveEntrance_WhirlwindOnStumpIvy().
| void BattleFx_Run | ( | void | ) |
Casts the current Psynergy effect with no target: runs the body of its kind (scene->fieldKind).
Called by Field_UsePsynergy when no scene event names a target (FLAG_PSYNERGY_TARGET clear), by Field_UseItem for an item with a field action, and by Field_DispatchTypeHandler(0). Halt also moves gGameState.pausedObject to the actor it stops.
Definition at line 35 of file dispatch.c.
Referenced by BattleFx_Run(), Djinn_ResolvePendingEvent(), Field_DispatchTypeHandler(), Field_UseItem(), and Field_UsePsynergy().
| void BattleFx_DispatchRequestKind | ( | void | ) |
Casts the current Psynergy effect on its target (secondObjectId): runs the handler of its kind.
Called by Field_UsePsynergy when a scene event names the target (FLAG_PSYNERGY_TARGET still set after the before event), and by Field_DispatchTypeHandler(1). Clears scene->enabled first: that is how the runners BattleFx_Run shares (Force, Frost, Ply, Whirlwind, Catch) tell that a scene event decides what happens to the target. Halt also moves gGameState.pausedObject to the target.
Definition at line 127 of file dispatch.c.
Referenced by BattleFx_DispatchRequestKind(), Djinn_ResolvePendingEvent(), Field_DispatchTypeHandler(), and Field_UsePsynergy().
| void BattleFx_ClearChildValueOnMismatch | ( | void | ) |
Finishes the current effect when it is Mind Read: ends the effect and lets its target move again, unless the target is the object kept stopped.
Called by Field_UsePsynergy after the after event, and by Field_DispatchTypeHandler(2): Mind Read is the one kind whose effect stays up through the after event, the conversation it reads.
Definition at line 202 of file dispatch.c.
Referenced by BattleFx_ClearChildValueOnMismatch(), Djinn_ResolvePendingEvent(), Field_DispatchTypeHandler(), and Field_UsePsynergy().
| void FieldEvent_RunTypeHandler | ( | void | ) |
The extra handler of Reveal, Cloak and Avoid: what each does when it ends.
Called by Field_RunPsynergyEvents, which ends a Psynergy that runs out by itself, and by Field_DispatchTypeHandler(3).
Definition at line 216 of file dispatch.c.
Referenced by Djinn_ResolvePendingEvent(), Field_DispatchTypeHandler(), Field_RunPsynergyEvents(), and FieldEvent_RunTypeHandler().
Runs the event tied to an effect: a result below 0x10000 is a message, shown at target; a larger one is a routine, called with param and target (through r3).
Afterwards, with FLAG_NOTHING_HAPPENS set, says "But nothing happens.". Returns 0.
Called by Field_UsePsynergy and Field_RunPsynergyEvents for the before and after events, and by Force, Frost and Reveal for the events of their own phases.
Definition at line 242 of file dispatch.c.
Referenced by Djinn_ResolvePendingEvent(), Field_RunEventAction(), Field_RunPsynergyEvents(), Field_UsePsynergy(), FieldFx_RunForce(), FieldFx_RunFrost(), FieldFx_RunReveal(), and ResetSceneTransitionEffect().
| 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.
Assigned to the target while Move, Lift, Carry or Retreat holds it.
Definition at line 270 of file dispatch.c.
Referenced by BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), Djinn_ResolvePendingEvent(), FieldFx_RunLiftOnTarget(), FieldFx_RunRetreat(), and ObjectGroup_ApplyRandomChildValues().
| 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 move target.
Carry, Lift, Douse, Move and the Djinni's hop into battle throw things this way.
Definition at line 308 of file dispatch.c.
Referenced by BattleFx_RunVenusDjinnCapture(), BattleFx_StartItemBreak(), BattleFx_SteerLiftedTarget(), Djinn_ResolvePendingEvent(), Djinn_RunBattleStartHop(), FieldFx_RunLiftOnTarget(), FieldFx_RunPly(), FieldFx_SpawnRandomAngleTriplet(), Motion_SetTargetPositionFromMagnitudeAngle(), SpawnHeavyImpactEffect(), and UpdateRisingParticleBurst().
| s32 ResourceTable_CountFreeBlocks | ( | void | ) |
Counts the free blocks (owner 0xff) of the 512 resource blocks.
BattleFx_LoadActionEffectResources subtracts this from VRAM_BLOCK_COUNT to record the blocks already occupied before the effect starts.
Definition at line 324 of file dispatch.c.
Referenced by BattleFx_LoadActionEffectResources(), Djinn_ResolvePendingEvent(), and ResourceTable_CountFreeBlocks().
| 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 its block.
Retains the shared cache entry and returns the sprite whose block is shared from now on (sharedSprite, or sourceSprite when there was none), or NULL for no sourceSprite. Chains of afterimages pass one block along this way. Each sprite retains the entry so releasing an afterimage cannot free graphics still used by the others. Sprite teardown leaves the shared entry for the caller to release.
Definition at line 346 of file dispatch.c.
Referenced by BattleFx_RunMercuryDjinnCapture(), Djinn_ResolvePendingEvent(), Djinn_RunBattleStartHop(), FieldFx_RunForce(), FieldFx_RunPly(), KolimaForestTree_SpawnOrbitSparks(), Sprite_ShareVramCache(), and TretTreeInteriors_SpawnSwirlSparks().
| 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 1.
An object without animation is released and NULL returned. The effects spawn their orbs, hands and particles through it, and check for NULL: the object table may be full.
Definition at line 371 of file dispatch.c.
Referenced by BattleEffect_RunFallbackObjectTransition(), BattleEffect_SpawnBurstParticleField(), BattleFx_RunSparkEmitter(), BattleFx_RunVenusDjinnCapture(), BattleFx_SpawnFallingParticles(), BattleFx_SpawnItemBreakMode1(), BattleFx_SpawnItemBreakMode3(), BattleFx_StartItemBreak(), BattleFx_SteerLiftedTarget(), BattleFx_UpdateItemBreakFragment(), Djinn_ResolvePendingEvent(), FieldFx_RunCatch(), FieldFx_RunDouse(), FieldFx_RunForce(), FieldFx_RunFrost(), FieldFx_RunGrowth(), FieldFx_RunPly(), FieldFx_RunWhirlwind(), FieldFx_SpawnRandomAngleTriplet(), ItemDisplay_EmitSparkles(), Object_Spawn(), RevealMarker_EmitSparkles(), SpawnHeavyImpactEffect(), and UpdateRisingParticleBurst().
| 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.
EventObject_Initialize stops them (state 1, speed 0) while an effect plays and lets them go again (state 0, speed 0x10).
Definition at line 395 of file dispatch.c.
Referenced by Djinn_ResolvePendingEvent(), EventObject_Initialize(), and ObjectGroup_SetActionForOthers().