Skip to Content
The Alchemy Project

src/field/script_commands_field_particles.c

Field effect sprites: the particles field Psynergy moves and draws. More…

Included by script_commands.c.

Functions

NameDescription
voidfdParticleUpdate (FIELD_PARTICLE *effect)Updates one field effect sprite: counts its age, runs its callback (after any delay), moves it and draws it.
voidfdParticleDraw (FIELD_PARTICLE *particle)Draws a field effect sprite at its screen position and scale, when it is near the screen: x from -32 to 272 pixels and z from -32 to 224, both exclusive.
voidfdParticleUpdateMotion (FIELD_PARTICLE *effect)Moves a field effect sprite toward its target, turning at most turnStepMax a tick when turnStepLimited is set and speeding up by acceleration to speedMax.
Uint32fdParticleHasPendingTarget (FIELD_PARTICLE *effect)Returns 1 while a field effect sprite that stops at its target still has one (it has not arrived), 0 once it has arrived or when it never stops.
voidfdParticleSetPos (FIELD_PARTICLE *effect, Sint32 x, Sint32 z)Places a field effect sprite at (x, z), at rest with no target.
voidfdParticleSetAnimation (FIELD_PARTICLE *effect, Sint32 mode)Sets the animation of a field effect sprite.
voidfdParticleSetCallback (FIELD_PARTICLE *effect, EFFECT_CALLBACK callback)Gives a field effect sprite its per-tick callback, starting at state 0.
voidfdParticleInit (FIELD_PARTICLE *effect, Sint32 kind, Sint32 x, FIXED z)Gives a field effect sprite a new sprite of kind at (x, z): stopping at its target, top speed 2, acceleration and scale 1, drawn, animation 1.
voidfdParticleFree (FIELD_PARTICLE *effect)Frees a field effect sprite and its sprite, clearing it to zero (inactive).

Description

Field effect sprites: the particles field Psynergy moves and draws. Part of script_commands.c.

Functions in detail

fdParticleUpdate

void fdParticleUpdate(FIELD_PARTICLE *effect)

Updates one field effect sprite: counts its age, runs its callback (after any delay), moves it and draws it.

References fdParticleDraw() and fdParticleUpdateMotion().

Referenced by fdEffectUpdateEffectSlots().

Definition at line 8 of file script_commands_field_particles.c.

fdParticleDraw

void fdParticleDraw(FIELD_PARTICLE *particle)

Draws a field effect sprite at its screen position and scale, when it is near the screen: x from -32 to 272 pixels and z from -32 to 224, both exclusive.

References fdRenderApplyProjectedPlacementStub() and syMulFX().

Referenced by fdParticleUpdate().

Definition at line 31 of file script_commands_field_particles.c.

fdParticleUpdateMotion

void fdParticleUpdateMotion(FIELD_PARTICLE *effect)

Moves a field effect sprite toward its target, turning at most turnStepMax a tick when turnStepLimited is set and speeding up by acceleration to speedMax. One that stops at its target lands on it once within 8 pixels.

References fdParticleSetPos(), Sint32, syAtan(), syCos(), syMulFX(), sySin(), sySquartFX() and sySquartIWRAM().

Referenced by fdParticleUpdate().

Definition at line 56 of file script_commands_field_particles.c.

fdParticleHasPendingTarget

Uint32 fdParticleHasPendingTarget(FIELD_PARTICLE *effect)

Returns 1 while a field effect sprite that stops at its target still has one (it has not arrived), 0 once it has arrived or when it never stops.

Referenced by fdEffectUpdateHaltParticle(), fdEffectUpdateMarsSpark(), fdEffectUpdateOutAndBack(), fdEffectUpdateRadialBurst(), fdEffectUpdateRadialSpread(), fdEffectUpdateRandomTargetParticle(), fdRetreatUpdateSpark() and scAltmillerCaveUpdateWallFragment().

Definition at line 121 of file script_commands_field_particles.c.

fdParticleSetPos

void fdParticleSetPos(FIELD_PARTICLE *effect, Sint32 x, Sint32 z)

Places a field effect sprite at (x, z), at rest with no target.

References Sint32.

Referenced by fdParticleInit() and fdParticleUpdateMotion().

Definition at line 133 of file script_commands_field_particles.c.

fdParticleSetAnimation

void fdParticleSetAnimation(FIELD_PARTICLE *effect, Sint32 mode)

Sets the animation of a field effect sprite.

References fdSpriteStartAnimationStub() and Sint32.

Referenced by fdDjinnRunJupiterJoinEffect(), fdDjinnRunMarsJoinEffect(), fdDjinnRunMercuryJoinEffect(), fdDjinnRunVenusJoinEffect(), fdParticleInit(), fdPsynergyForce(), fdPsynergyRetreat() and scAltmillerCaveReleaseWallBurst().

Definition at line 143 of file script_commands_field_particles.c.

fdParticleSetCallback

void fdParticleSetCallback(FIELD_PARTICLE *effect, EFFECT_CALLBACK callback)

Gives a field effect sprite its per-tick callback, starting at state 0.

Referenced by fdDjinnRunJupiterJoinEffect(), fdDjinnRunMarsJoinEffect(), fdDjinnRunMercuryJoinEffect(), fdDjinnRunVenusJoinEffect(), fdPsynergyForce(), fdPsynergyHalt(), fdPsynergyRetreat() and scAltmillerCaveReleaseWallBurst().

Definition at line 149 of file script_commands_field_particles.c.

fdParticleInit

void fdParticleInit(FIELD_PARTICLE *effect, Sint32 kind, Sint32 x, FIXED z)

Gives a field effect sprite a new sprite of kind at (x, z): stopping at its target, top speed 2, acceleration and scale 1, drawn, animation 1.

References fdParticleSetAnimation(), fdParticleSetPos(), fdSpriteCreateStub(), Sint32 and syRandom().

Referenced by fdDjinnRunJupiterJoinEffect(), fdDjinnRunMarsJoinEffect(), fdDjinnRunMercuryJoinEffect(), fdDjinnRunVenusJoinEffect(), fdPsynergyForce(), fdPsynergyHalt(), fdPsynergyRetreat() and scAltmillerCaveReleaseWallBurst().

Definition at line 159 of file script_commands_field_particles.c.

fdParticleFree

void fdParticleFree(FIELD_PARTICLE *effect)

Frees a field effect sprite and its sprite, clearing it to zero (inactive).

References fdSpriteDestroyStub().

Referenced by fdEffectReleaseSlots(), fdEffectRunAngledApproachPhases(), fdEffectUpdateHaltParticle(), fdEffectUpdateMarsSpark(), fdEffectUpdateOutAndBack(), fdEffectUpdateRadialBurst(), fdEffectUpdateRadialSpread(), fdEffectUpdateRandomTargetParticle(), fdPsynergyEnd(), fdRetreatUpdateSpark() and scAltmillerCaveUpdateWallFragment().

Definition at line 194 of file script_commands_field_particles.c.