Skip to Content
The Alchemy Project

src/field/script_commands_psynergy_dispatch.c

Running a field Psynergy by its kind, and the priority and depth its sprites take to be drawn with an actor. More…

Included by script_commands.c.

Macros

NameDescription
#defineWORLD_MAP_GROUND_DEPTH 512On the world map a sprite's depth slot is one more for each two pixels its point is nearer the camera than 512, about the camera's distance from the ground it looks at, where the slot is 128, as fdRenderPlaceProjectedSprite sorts a projected sprite.
#defineWORLD_MAP_GROUND_SLOT 128

Functions

NameDescription
voidfdPsynergyHaltOnTarget (Sint32 id)Pauses the target (effectState->child) and runs fdPsynergyHalt.
voidfdPsynergyForceOnTarget (Sint32 unused)Runs Force cast on a target, through fdPsynergyForce.
voidfdPsynergyDouseOnTarget (Sint32 unused)Runs Douse cast on a target, through fdPsynergyDouse.
voidfdPsynergyFrostOnTarget (Sint32 unused)Frost cast on a target.
voidfdPsynergyWhirlwindOnTarget (Sint32 unused)Runs Whirlwind cast on a target, using the target already stored in the field effect.
voidfdPsynergyCatchOnTarget (Sint32 targetId)Catch cast on a target: runs fdPsynergyCatch.
voidfdPsynergySandOnTarget (Sint32 targetId)Sand cast on a target: runs fdPsynergySand.
voidfdPsynergyBlazeOnTarget (Sint32 targetId)Blaze cast on a target: runs fdPsynergyBlaze.
voidfdPsynergyCycloneOnTarget (Sint32 targetId)Cyclone cast on a target: runs fdPsynergyCyclone.
voidfdPsynergyScoopOnTarget (Sint32 targetId)Scoop cast on a target: runs fdPsynergyScoop.
voidfdPsynergyTremorOnTarget (Sint32 targetId)Tremor ("Shake objects left and right.") on the chosen object: sways the view from side to side, as fdPsynergyTremor does with no object: the swing grows from SWAY_START to STRONG_SWAY_PEAK, holds STRONG_SWAY_HOLD_TICKS, shrinks back and stops.
voidfdPsynergyGrindOnTarget (Sint32 targetId)Grind ("Pulverize large objects."): the screen shakes harder and harder while spray rises round the target, or round the spot 32 pixels before the caster.
voidfdPsynergyHoverOnTarget (Sint32 targetId)Hover cast on a target: runs fdPsynergyHover.
voidfdPsynergyTeleportOnTarget (Sint32 targetId)Teleport cast on a target: does nothing.
voidfdPsynergyParchOnTarget (Sint32 targetId)Parch cast on a target: runs fdPsynergyParch.
voidfdPsynergyBurstOnTarget (Sint32 targetId)Burst cast on a target: runs fdPsynergyBurst.
voidfdPsynergyPoundOnTarget (Sint32 targetId)Pound cast on a target: runs fdPsynergyPound.
voidfdPsynergyRunHandler (Sint32 kind)Runs one step of the scene's field Psynergy: cast with no target, cast on the chosen target (secondActorId), Mind Read's end, or what a lasting Psynergy does when it ends.
voidfdPsynergyRun (void)Runs the field Psynergy animation the scene names, with no target chosen yet: each kind runs its effect to the end.
voidfdPsynergyDispatch (void)Runs the field Psynergy animation the scene names on the target the player chose (FIELD_EFFECT_STATE.targetId).
voidfdPsynergyFinishMindRead (void)Finishes the current field Psynergy when it is Mind Read: ends it and lets its target move again, unless the target is the actor kept stopped.
voidfdPsynergyRunEnd (void)Ends the current field Psynergy when it is Reveal, Cloak, Avoid, Sand, Hover or the Ring: what each does as it ends.
voidfdActorCycleSpriteColors (ACTOR *actor)Per-tick update: sets every part of an actor's sprite to the next of the six orders of its colour channels (SPRITE_COLOR_NORMAL to SPRITE_COLOR_BRG).
voidfdActorSetTargetPosFromMagnitudeAngle (ACTOR *actor, Sint32 magnitude, Sint32 angle)Sends the actor toward the point magnitude away from it at angle.
Sint32fdPsynergyGetCanvasPriority (ACTOR *actor, Sint32 facing)The OBJ priority a Psynergy's canvas takes: the caster's own when it casts facing away (FACING_NORTH), else 0, in front of everything.
Sint32fdActorGetSpritePriority (ACTOR *actor)Returns the OBJ priority of the actor's sprite.
Sint32fdActorGetSpriteDepth (ACTOR *actor)Returns the depth slot the actor's sprite takes, so that a sprite drawn with it sorts with it: from its projected depth on the world map, otherwise from its screen row.
voidfdPsynergyDrawCanvasSprite (void)Draws the Psynergy's canvas sprite (FIELD_EFFECT_STATE.sprite) each tick.
voidfdPsynergyStartSceneSprite (void)When the caster faces away (FACING_NORTH), starts the Psynergy's canvas sprite (FIELD_EFFECT_STATE.sprite): a blank 32x32 sprite of its own VRAM cache entry, twice as tall, 28 pixels above the caster in front of everything, drawn each tick by fdPsynergyDrawCanvasSprite until fdPsynergyReleaseSceneSprite.

Description

Running a field Psynergy by its kind, and the priority and depth its sprites take to be drawn with an actor. Part of script_commands.c.

Macros in detail

WORLD_MAP_GROUND_DEPTH

#define WORLD_MAP_GROUND_DEPTH 512

On the world map a sprite's depth slot is one more for each two pixels its point is nearer the camera than 512, about the camera's distance from the ground it looks at, where the slot is 128, as fdRenderPlaceProjectedSprite sorts a projected sprite.

Referenced by fdActorGetSpriteDepth().

Definition at line 323 of file script_commands_psynergy_dispatch.c.

WORLD_MAP_GROUND_SLOT

#define WORLD_MAP_GROUND_SLOT 128

Referenced by fdActorGetSpriteDepth().

Definition at line 324 of file script_commands_psynergy_dispatch.c.

Functions in detail

fdPsynergyRunHandler

void fdPsynergyRunHandler(Sint32 kind)

Runs one step of the scene's field Psynergy: cast with no target, cast on the chosen target (secondActorId), Mind Read's end, or what a lasting Psynergy does when it ends.

References fdPsynergyDispatch(), fdPsynergyFinishMindRead(), fdPsynergyRun(), fdPsynergyRunEnd() and Sint32.

Referenced by scDehkanPlateauCannonCastsPound(), scDehkanPlateauCannonCastsPoundOnLeader(), scGarohWerewolfPeersFromCave(), scIzumoRoomsShowMove(), scKandoreanTempleCastLash(), scKibomboAkafubuCastsOnCrystal(), scKibomboCastScoop(), scMadraRoomsPiersUsesPsynergy(), scMadraRoomsShinAngersPiers(), scMagmaRockInsidePlayBurst(), scMagmaRockPlayBurst(), scVenusLighthouseFelixMovesStatue() and scYampiDesertScorpionUsesScoop().

Definition at line 27 of file script_commands_psynergy_dispatch.c.

fdPsynergyRun

void fdPsynergyRun(void)

Runs the field Psynergy animation the scene names, with no target chosen yet: each kind runs its effect to the end.

References fdFindActorTalkCue(), fdFindNearbyPsynergyTarget(), fdPsynergyArrow(), fdPsynergyAvoid(), fdPsynergyBlaze(), fdPsynergyBurst(), fdPsynergyCarry(), fdPsynergyCatch(), fdPsynergyCyclone(), fdPsynergyDouse(), fdPsynergyEndReveal(), fdPsynergyFilterHaltTarget(), fdPsynergyForce(), fdPsynergyFrost(), fdPsynergyGrind(), fdPsynergyGrowth(), fdPsynergyHalt(), fdPsynergyHaltActor(), fdPsynergyHaltOnTarget(), fdPsynergyHover(), fdPsynergyLash(), fdPsynergyLift(), fdPsynergyMove(), fdPsynergyParch(), fdPsynergyPly(), fdPsynergyPound(), fdPsynergyResumeHaltedActor(), fdPsynergyRetreat(), fdPsynergyReveal(), fdPsynergyRing(), fdPsynergySand(), fdPsynergyScoop(), fdPsynergySetupActorPair(), fdPsynergyStartCloak(), fdPsynergyStartMindReadWave(), fdPsynergyTeleport(), fdPsynergyTremor(), fdPsynergyWhirlwind(), MainRoutineStateWork and Sint32.

Referenced by fdPsynergyRunHandler(), fdUseItem() and fdUsePsynergy().

Definition at line 41 of file script_commands_psynergy_dispatch.c.

fdPsynergyDispatch

void fdPsynergyDispatch(void)

Runs the field Psynergy animation the scene names on the target the player chose (FIELD_EFFECT_STATE.targetId).

References fdPsynergyAvoid(), fdPsynergyBlazeOnTarget(), fdPsynergyBurstOnTarget(), fdPsynergyCatchOnTarget(), fdPsynergyCycloneOnTarget(), fdPsynergyDouseOnTarget(), fdPsynergyEndReveal(), fdPsynergyForceOnTarget(), fdPsynergyFrostOnTarget(), fdPsynergyGrindOnTarget(), fdPsynergyGrowthOnTarget(), fdPsynergyHaltActor(), fdPsynergyHaltOnTarget(), fdPsynergyHoverOnTarget(), fdPsynergyLashOnTarget(), fdPsynergyLiftOnTarget(), fdPsynergyParchOnTarget(), fdPsynergyPlyOnTarget(), fdPsynergyPoundOnTarget(), fdPsynergyResumeHaltedActor(), fdPsynergyRetreat(), fdPsynergyReveal(), fdPsynergyRing(), fdPsynergySandOnTarget(), fdPsynergyScoopOnTarget(), fdPsynergyStartCloak(), fdPsynergyStartMindReadWave(), fdPsynergySteerLiftedTarget(), fdPsynergySteerPushedTarget(), fdPsynergyTeleportOnTarget(), fdPsynergyTremorOnTarget(), fdPsynergyWhirlwindOnTarget(), MainRoutineStateWork and Sint32.

Referenced by fdPsynergyRunHandler() and fdUsePsynergy().

Definition at line 143 of file script_commands_psynergy_dispatch.c.

fdPsynergyFinishMindRead

void fdPsynergyFinishMindRead(void)

Finishes the current field Psynergy when it is Mind Read: ends it and lets its target move again, unless the target is the actor kept stopped.

References fdPsynergyStopMindReadWave() and MainRoutineStateWork.

Referenced by fdPsynergyRunHandler() and fdUsePsynergy().

Definition at line 236 of file script_commands_psynergy_dispatch.c.

fdPsynergyRunEnd

void fdPsynergyRunEnd(void)

Ends the current field Psynergy when it is Reveal, Cloak, Avoid, Sand, Hover or the Ring: what each does as it ends.

References fdPsynergyEndCloak(), fdPsynergyEndHover(), fdPsynergyEndReveal(), fdPsynergyEndRing(), fdPsynergyEndSand() and fdPsynergyShowAvoidWoreOff().

Referenced by fdPsynergyRunHandler() and fdRunPsynergyEndScripts().

Definition at line 252 of file script_commands_psynergy_dispatch.c.

fdActorCycleSpriteColors

void fdActorCycleSpriteColors(ACTOR *actor)

Per-tick update: sets every part of an actor's sprite to the next of the six orders of its colour channels (SPRITE_COLOR_NORMAL to SPRITE_COLOR_BRG).

References Sint32 and TickCount.

Referenced by fdPsynergyLiftOnTarget(), fdPsynergyRetreat(), fdPsynergySteerLiftedTarget(), fdPsynergySteerPushedTarget(), fdTeleportPlaySparks() and scAlhafranCaveCycleKeyColors().

Definition at line 269 of file script_commands_psynergy_dispatch.c.

fdActorSetTargetPosFromMagnitudeAngle

void fdActorSetTargetPosFromMagnitudeAngle(ACTOR *actor, Sint32 magnitude, Sint32 angle)

Sends the actor toward the point magnitude away from it at angle.

References Sint32 and syVectorAddPolarOffset().

Referenced by fdBattleEffectSpawnScatterParticle(), fdDjinnRunBattleStartHop(), fdDjinnRunVenusJoinEffect(), fdEffectBurstHand(), fdEffectSpawnHeavyImpact(), fdEffectSpawnMoveHand(), fdPsynergyCarry(), fdPsynergyLift(), fdPsynergyLiftOnTarget(), fdPsynergyPly() and fdPsynergySteerLiftedTarget().

Definition at line 290 of file script_commands_psynergy_dispatch.c.

fdPsynergyGetCanvasPriority

Sint32 fdPsynergyGetCanvasPriority(ACTOR *actor, Sint32 facing)

The OBJ priority a Psynergy's canvas takes: the caster's own when it casts facing away (FACING_NORTH), else 0, in front of everything.

References Sint32.

Referenced by fdPsynergyBurst() and fdPsynergyParch().

Definition at line 306 of file script_commands_psynergy_dispatch.c.

fdActorGetSpritePriority

Sint32 fdActorGetSpritePriority(ACTOR *actor)

Returns the OBJ priority of the actor's sprite.

References Sint32.

Referenced by dbPsynergyTestStartRings(), fdActorAppearInSparks(), fdBattleEffectSpawnScaledArcObjects(), fdHoverGlowUpdate(), fdPsynergyArrow(), fdPsynergyBlaze(), fdPsynergyGrindOnTarget(), fdPsynergyPound(), fdPsynergyScoop(), fdSandInitLeaderSprite(), fdSandSpawnGrain(), scContigoPauseWhenFaced(), scContigoStartSparkle(), scJupiterLighthouseStartSparkRing(), scLemuriaNoticeLeader(), scLightSpritesDraw(), scMarsLighthouseAerieStartRisingRings(), scVenusLighthouseEntranceBlastActorSkyward() and scVenusLighthouseEntranceEmitDust().

Definition at line 314 of file script_commands_psynergy_dispatch.c.

fdActorGetSpriteDepth

Sint32 fdActorGetSpriteDepth(ACTOR *actor)

Returns the depth slot the actor's sprite takes, so that a sprite drawn with it sorts with it: from its projected depth on the world map, otherwise from its screen row.

References fdMapStateView(), Sint32 and syConvert3Dto2D().

Referenced by dbPsynergyTestUpdateRings(), fdActorAppearInSparks(), fdBattleEffectUpdateArcEffect(), fdBlazeUpdateSpray(), fdHoverGlowUpdate(), fdPsynergyArrow(), fdPsynergyBlaze(), fdPsynergyBurst(), fdPsynergyGrindOnTarget(), fdPsynergyScoop(), fdSandInitLeaderSprite(), fdSandSpawnGrain(), scContigoRaiseSparkle(), scJupiterLighthouseStartSparkRing(), scMarsLighthouseAerieUpdateRisingRings(), scVenusLighthouseEntranceBlastActorSkyward() and scVenusLighthouseEntranceEmitDust().

Definition at line 329 of file script_commands_psynergy_dispatch.c.

fdPsynergyDrawCanvasSprite

void fdPsynergyDrawCanvasSprite(void)

Draws the Psynergy's canvas sprite (FIELD_EFFECT_STATE.sprite) each tick.

References fdEffectSpriteDraw().

Referenced by fdPsynergyReleaseSceneSprite() and fdPsynergyStartSceneSprite().

Definition at line 359 of file script_commands_psynergy_dispatch.c.

fdPsynergyStartSceneSprite

void fdPsynergyStartSceneSprite(void)

When the caster faces away (FACING_NORTH), starts the Psynergy's canvas sprite (FIELD_EFFECT_STATE.sprite): a blank 32x32 sprite of its own VRAM cache entry, twice as tall, 28 pixels above the caster in front of everything, drawn each tick by fdPsynergyDrawCanvasSprite until fdPsynergyReleaseSceneSprite.

References fdCameraWorldToScreen(), fdEffectSpriteInit(), fdPsynergyDrawCanvasSprite(), Sint32, syHeapAllocate(), syHeapRelease(), sySetEvent(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by fdPsynergyPound() and fdPsynergyScoop().

Definition at line 370 of file script_commands_psynergy_dispatch.c.