Skip to Content
The Alchemy Project

src/field/script_commands_retreat.c

Retreat, the caster spinning away in a spray of sparks, and the golden rings that fall round the caster of Avoid. More…

Included by script_commands.c.

Enumerations

NameDescription
enumRETREAT_PARTICLE_STATE { RETREAT_PARTICLE_AIM, RETREAT_PARTICLE_FLYING, RETREAT_PARTI … }The states of a Retreat particle (fdRetreatUpdateSpark).

Functions

NameDescription
voidfdEffectUpdateSpinAngle (ACTOR *actor)Per-tick update: spins by FACING_STEP + timer * 80 a tick, speeding up (timer counts up) until timer * 80 reaches FACING_STEP: from 1/16 turn a tick to just over 1/8 in 52 ticks, as fdEffectAdvanceAngleWithRamp.
voidfdEffectUpdateRetreatCaster (ACTOR *actor)Per-tick update: spins 1/8 turn a tick as it shrinks by 5/512 of its full size, rising a pixel a tick; once its scale falls below 3/16 (84 ticks from full size) its sprites are hidden, but it is not released.
voidfdRetreatUpdateSpark (FIELD_PARTICLE *effect)Field effect sprite callback: a particle flies 120 pixels from the main actor's screen position (8 pixels lower) in a direction within 1/8 turn of up the screen, at up to 5 pixels a tick, and starts again from the main actor on arrival until it takes its last flight.
voidfdPsynergyRetreat (void)Spins the main actor and shrinks it while 24 particles fly out, one a tick.
voidfdEffectUpdateDescendingParticlePositiveArc (ACTOR *particle)Per-tick update of a falling arc: grows toward full size (3/64 a tick) as it falls 2 pixels a tick on the actor it follows, 9 pixels in front of it and up to 5 pixels further while small; released 10 pixels above the ground (4 on the World Map, MAP_INDEX_WORLD).
voidfdEffectUpdateDescendingParticleNegativeArc (ACTOR *particle)As fdEffectUpdateDescendingParticlePositiveArc for the arc drawn upside down, 16 pixels in front of the actor and up to 5 pixels nearer.
voidfdEffectSpawnDescendingArcParticles (ACTOR *src)Avoid's rings: a pair of falling arcs (one upside down) 64 pixels above source, at 0.4 of full size, drawn with the tiles in effectState->arcTileSlot.

Description

Retreat, the caster spinning away in a spray of sparks, and the golden rings that fall round the caster of Avoid. Part of script_commands.c.

Enumerations in detail

RETREAT_PARTICLE_STATE

enum RETREAT_PARTICLE_STATE

The states of a Retreat particle (fdRetreatUpdateSpark).

EnumeratorValueDescription
RETREAT_PARTICLE_AIM0placed on the main actor and aimed
RETREAT_PARTICLE_FLYING1back to RETREAT_PARTICLE_AIM on arrival
RETREAT_PARTICLE_LAST_FLIGHT2Set by fdPsynergyRetreat: freed on arrival

Definition at line 37 of file script_commands_retreat.c.

Functions in detail

fdEffectUpdateSpinAngle

void fdEffectUpdateSpinAngle(ACTOR *actor)

Per-tick update: spins by FACING_STEP + timer * 80 a tick, speeding up (timer counts up) until timer * 80 reaches FACING_STEP: from 1/16 turn a tick to just over 1/8 in 52 ticks, as fdEffectAdvanceAngleWithRamp.

Referenced by fdPsynergyRetreat().

Definition at line 9 of file script_commands_retreat.c.

fdEffectUpdateRetreatCaster

void fdEffectUpdateRetreatCaster(ACTOR *actor)

Per-tick update: spins 1/8 turn a tick as it shrinks by 5/512 of its full size, rising a pixel a tick; once its scale falls below 3/16 (84 ticks from full size) its sprites are hidden, but it is not released. Retreat gives it to the caster.

References Sint32.

Referenced by fdPsynergyRetreat().

Definition at line 23 of file script_commands_retreat.c.

fdRetreatUpdateSpark

void fdRetreatUpdateSpark(FIELD_PARTICLE *effect)

Field effect sprite callback: a particle flies 120 pixels from the main actor's screen position (8 pixels lower) in a direction within 1/8 turn of up the screen, at up to 5 pixels a tick, and starts again from the main actor on arrival until it takes its last flight.

References fdCameraWorldToScreen(), fdParticleFree(), fdParticleHasPendingTarget(), Sint32, state, syRandom(), sySoundPlayStub(), syVectorAddPolarOffset() and TickCount.

Referenced by fdPsynergyRetreat().

Definition at line 49 of file script_commands_retreat.c.

fdPsynergyRetreat

void fdPsynergyRetreat(void)

Spins the main actor and shrinks it while 24 particles fly out, one a tick.

References fdActorCycleSpriteColors(), fdActorFaceDirectionById(), fdActorSelectAnimationStub(), fdActorSetSpriteColorModeStub(), fdActorSetSpriteFlagsStub(), fdCameraMoveWithinMapBounds(), fdCameraWorldToScreen(), fdEffectUpdateRetreatCaster(), fdEffectUpdateSpinAngle(), fdParticleInit(), fdParticleSetAnimation(), fdParticleSetCallback(), fdPsynergyFadeFromCastColor(), fdPsynergyFadeToCastColor(), fdRetreatUpdateSpark(), fdScriptStart(), fdSpriteSetAnimationColorModesStub(), syRandom(), sySoundPlayStub() and sySynch().

Referenced by fdPsynergyDispatch() and fdPsynergyRun().

Definition at line 104 of file script_commands_retreat.c.

fdEffectUpdateDescendingParticlePositiveArc

void fdEffectUpdateDescendingParticlePositiveArc(ACTOR *particle)

Per-tick update of a falling arc: grows toward full size (3/64 a tick) as it falls 2 pixels a tick on the actor it follows, 9 pixels in front of it and up to 5 pixels further while small; released 10 pixels above the ground (4 on the World Map, MAP_INDEX_WORLD).

References fdActorReleaseStub() and MainRoutineStateWork.

Referenced by fdEffectSpawnDescendingArcParticles().

Definition at line 173 of file script_commands_retreat.c.

fdEffectUpdateDescendingParticleNegativeArc

void fdEffectUpdateDescendingParticleNegativeArc(ACTOR *particle)

As fdEffectUpdateDescendingParticlePositiveArc for the arc drawn upside down, 16 pixels in front of the actor and up to 5 pixels nearer.

References fdActorReleaseStub() and MainRoutineStateWork.

Referenced by fdEffectSpawnDescendingArcParticles().

Definition at line 204 of file script_commands_retreat.c.

fdEffectSpawnDescendingArcParticles

void fdEffectSpawnDescendingArcParticles(ACTOR *src)

Avoid's rings: a pair of falling arcs (one upside down) 64 pixels above source, at 0.4 of full size, drawn with the tiles in effectState->arcTileSlot.

References fdActorCreateStub(), fdEffectUpdateDescendingParticleNegativeArc(), fdEffectUpdateDescendingParticlePositiveArc(), fdSpriteStartAnimationStub(), Sint32, syVRAMCacheFreeEntry() and VramCacheEntries.

Referenced by fdEffectUpdateAvoidCaster().

Definition at line 236 of file script_commands_retreat.c.