Skip to Content
The Alchemy Project

src/field/field_psynergy_cyclone.c

Cyclone and the whirlwinds: Cyclone's 96 leaves, the leader carried or lifted to a Cyclone metatile, Cyclone itself, an actor arriving in a whirlwind, spinning down from above (fdActorDescendInWhirlwind) or appearing in it (fdActorAppearInWhirlwind), then Blaze's jet of flame and the smoke it leaves. More…

Included by field_psynergy.c.

Structures

NameDescription
structBLAZE_STATEBlaze's state (heap slot HEAP_SLOT_BATTLE_EFFECT): the flame tiles, 16 flames and 16 smoke puffs with their motion, where the jet starts and where it points, and the actor it has reached.

Macros

NameDescription
#defineWHIRLWIND_ANIMATION_SPIN 2SPRITE_WHIRLWIND's animations (whirlwind.tsv): its five pictures spinning, and its last four pictures as it blows away, then nothing.
#defineWHIRLWIND_ANIMATION_VANISH 6
#defineCYCLONE_CARRY_TICKS 128The ticks the whirlwind takes to carry or lift the leader.
#defineCYCLONE_CARRY_TURN_STEP (TRIG_TURN * 5 / 256)How far the whirlwind turns the leader round each tick of the ride.
#defineCYCLONE_WHIRLWIND_RISE_TICKS 20The ticks the Cyclone's whirlwind takes to rise to full height, the ticks its whirl of wind spreads round the caster, and the ticks it whirls on before the Cyclone acts.
#defineCYCLONE_WHIRL_TICKS 60
#defineCYCLONE_SPIN_TICKS 16
#defineCYCLONE_TOUCH_TICK 30The tick of the Cyclone's ending on which the scripts of the metatiles it touched run.
#defineWHIRLWIND_RESIZE_STEP (toFIXED(1) / 32)A whirlwind widens or narrows by WHIRLWIND_RESIZE_STEP of its width a tick, and an actor by the same of its size: the ticks for the whole whirlwind and for half an actor.
#defineWHIRLWIND_RESIZE_TICKS 32
#defineACTOR_RESIZE_TICKS 16
#defineCYCLONE_SPREAD_KEPT 123The whirl's arcs spread by a step that keeps CYCLONE_SPREAD_KEPT of every CYCLONE_SPREAD_SCALE parts of itself each tick.
#defineCYCLONE_SPREAD_SCALE 128
#defineDESCEND_TICKS 128The ticks fdActorDescendInWhirlwind's actor spins down in its whirlwind, and how high above where it lands and how far out it starts, in pixels.
#defineDESCEND_HEIGHT 96
#defineDESCEND_RADIUS 32
#defineBLAZE_FLAMES 16The flames of Blaze's jet, and the smoke puffs they leave.
#defineBLAZE_LONG_FLAME_TICKS 33The ticks a flame of the jet lives, in BLAZE_LONG_SPRAY and otherwise.
#defineBLAZE_FLAME_TICKS 25

Enumerations

NameDescription
enumanonymous enum { CYCLONE_RIDE_CARRIED, CYCLONE_RIDE_ARRIVED, CYCLONE_RIDE_RIS … }The stages of the leader's ride on Cyclone's whirlwind (CYCLONE_STATE.state).
enumBLAZE_MODE { BLAZE_FLICKER, BLAZE_LIGHT_TORCH, BLAZE_SPRAY, BLAZE_LONG_SP … }What Blaze does (BLAZE_STATE.mode).

Functions

NameDescription
voidfdParticleBurstUpdate (void)Each tick of Cyclone's 96 leaves (fdParticleBurstStart): once its delay has run out a leaf shows for 64 ticks, 48 pixels out along its heading, whirling round ever faster as it rises.
voidfdParticleBurstEnd (void)Ends the particle burst (fdParticleBurstStart): stops its event and frees its tiles.
voidfdCycloneCarryLeader (void)Each tick of Cyclone's ride: the whirlwind carries the leader over 128 ticks from where it stood to the nearby CYCLONE_METATILE_CARRY metatile (a Cyclone teleporter), circling and arcing up and down on the way, its follower with it.
voidfdCycloneLiftLeader (void)fdCycloneCarryLeader for a CYCLONE_METATILE_LIFT metatile: the leader is carried there 32 pixels up, circling, without the arc, settles for 40 ticks, and unless the scene asks to keep the leader there (sceneVariant 1) is swept 152 pixels up over 40 more.
voidfdActorUpdateSpin (MOTION_OBJECT *actor)An actor's update while it is in a whirlwind: it spins on the spot, a sixteenth of a turn a tick.
voidfdPsynergyCycloneOnTarget (void)Cyclone cast on a target: runs fdPsynergyCyclone.
voidfdPsynergyCyclone (void)Cyclone ("Conjure wind to scatter weeds."): the caster spins in a whirlwind of blue and white drawn on the canvas sprite, and the weeds on the metatiles round it (fdPsynergyGatherNearbyMetatiles) are scattered.
voidfdActorDescendInWhirlwind (Sint32 actorId)The actor arrives in a whirlwind (SPRITE_WHIRLWIND) that spins down from above, as the leader does at a teleporter's end in Jupiter Lighthouse and Mars Lighthouse: as the screen transition starts it circles inside it for DESCEND_TICKS, from DESCEND_HEIGHT up and DESCEND_RADIUS out down to where it stands, then the whirlwind vanishes with a whoosh and the camera follows the actor again.
voidfdActorAppearInWhirlwind (Sint32 actorId)The actor appears in a whirlwind, as the leader does at a teleporter's end in Jupiter Lighthouse: once the screen transition is done, a whirlwind (SPRITE_WHIRLWIND) widens on the unseen, spinning actor for WHIRLWIND_RESIZE_TICKS, then vanishes with a whoosh as the actor grows back from half its size and shows again.
voidfdBlazeUpdateSpray (void)Each tick of Blaze's jet of flame (fdPsynergyBlaze): while it flows a flame leaves the caster every fourth tick, growing and falling as it flies, and burns out at the end of its life or on meeting a wall or a solid actor, every other flame leaving a puff of smoke that rises for 32 ticks.
voidfdPsynergyBlazeOnTarget (void)Blaze cast on a target: runs fdPsynergyBlaze.

Description

Cyclone and the whirlwinds: Cyclone's 96 leaves, the leader carried or lifted to a Cyclone metatile, Cyclone itself, an actor arriving in a whirlwind, spinning down from above (fdActorDescendInWhirlwind) or appearing in it (fdActorAppearInWhirlwind), then Blaze's jet of flame and the smoke it leaves. Part of field_psynergy.c.

Macros in detail

WHIRLWIND_ANIMATION_SPIN

#define WHIRLWIND_ANIMATION_SPIN 2

SPRITE_WHIRLWIND's animations (whirlwind.tsv): its five pictures spinning, and its last four pictures as it blows away, then nothing.

Referenced by fdActorAppearInWhirlwind(), fdActorDescendInWhirlwind() and fdPsynergyCyclone().

Definition at line 9 of file field_psynergy_cyclone.c.

WHIRLWIND_ANIMATION_VANISH

#define WHIRLWIND_ANIMATION_VANISH 6

Referenced by fdActorAppearInWhirlwind(), fdActorDescendInWhirlwind() and fdPsynergyCyclone().

Definition at line 10 of file field_psynergy_cyclone.c.

CYCLONE_CARRY_TICKS

#define CYCLONE_CARRY_TICKS 128

The ticks the whirlwind takes to carry or lift the leader.

Referenced by fdCycloneCarryLeader() and fdCycloneLiftLeader().

Definition at line 75 of file field_psynergy_cyclone.c.

CYCLONE_CARRY_TURN_STEP

#define CYCLONE_CARRY_TURN_STEP (TRIG_TURN * 5 / 256)

How far the whirlwind turns the leader round each tick of the ride.

Referenced by fdCycloneCarryLeader() and fdCycloneLiftLeader().

Definition at line 78 of file field_psynergy_cyclone.c.

CYCLONE_WHIRLWIND_RISE_TICKS

#define CYCLONE_WHIRLWIND_RISE_TICKS 20

The ticks the Cyclone's whirlwind takes to rise to full height, the ticks its whirl of wind spreads round the caster, and the ticks it whirls on before the Cyclone acts.

Referenced by fdPsynergyCyclone().

Definition at line 202 of file field_psynergy_cyclone.c.

CYCLONE_WHIRL_TICKS

#define CYCLONE_WHIRL_TICKS 60

Referenced by fdPsynergyCyclone().

Definition at line 203 of file field_psynergy_cyclone.c.

CYCLONE_SPIN_TICKS

#define CYCLONE_SPIN_TICKS 16

Referenced by fdPsynergyCyclone().

Definition at line 204 of file field_psynergy_cyclone.c.

CYCLONE_TOUCH_TICK

#define CYCLONE_TOUCH_TICK 30

The tick of the Cyclone's ending on which the scripts of the metatiles it touched run.

Referenced by fdPsynergyCyclone().

Definition at line 207 of file field_psynergy_cyclone.c.

WHIRLWIND_RESIZE_STEP

#define WHIRLWIND_RESIZE_STEP (toFIXED(1) / 32)

A whirlwind widens or narrows by WHIRLWIND_RESIZE_STEP of its width a tick, and an actor by the same of its size: the ticks for the whole whirlwind and for half an actor.

Referenced by fdActorAppearInWhirlwind() and fdPsynergyCyclone().

Definition at line 211 of file field_psynergy_cyclone.c.

WHIRLWIND_RESIZE_TICKS

#define WHIRLWIND_RESIZE_TICKS 32

Referenced by fdActorAppearInWhirlwind() and fdPsynergyCyclone().

Definition at line 212 of file field_psynergy_cyclone.c.

ACTOR_RESIZE_TICKS

#define ACTOR_RESIZE_TICKS 16

Referenced by fdActorAppearInWhirlwind() and fdPsynergyCyclone().

Definition at line 213 of file field_psynergy_cyclone.c.

CYCLONE_SPREAD_KEPT

#define CYCLONE_SPREAD_KEPT 123

The whirl's arcs spread by a step that keeps CYCLONE_SPREAD_KEPT of every CYCLONE_SPREAD_SCALE parts of itself each tick.

Referenced by fdPsynergyCyclone().

Definition at line 216 of file field_psynergy_cyclone.c.

CYCLONE_SPREAD_SCALE

#define CYCLONE_SPREAD_SCALE 128

Referenced by fdPsynergyCyclone().

Definition at line 217 of file field_psynergy_cyclone.c.

DESCEND_TICKS

#define DESCEND_TICKS 128

The ticks fdActorDescendInWhirlwind's actor spins down in its whirlwind, and how high above where it lands and how far out it starts, in pixels.

Referenced by fdActorDescendInWhirlwind().

Definition at line 460 of file field_psynergy_cyclone.c.

DESCEND_HEIGHT

#define DESCEND_HEIGHT 96

Referenced by fdActorDescendInWhirlwind().

Definition at line 461 of file field_psynergy_cyclone.c.

DESCEND_RADIUS

#define DESCEND_RADIUS 32

Referenced by fdActorDescendInWhirlwind().

Definition at line 462 of file field_psynergy_cyclone.c.

BLAZE_FLAMES

#define BLAZE_FLAMES 16

The flames of Blaze's jet, and the smoke puffs they leave.

Referenced by fdBlazeUpdateSpray() and fdPsynergyBlaze().

Definition at line 584 of file field_psynergy_cyclone.c.

BLAZE_LONG_FLAME_TICKS

#define BLAZE_LONG_FLAME_TICKS 33

The ticks a flame of the jet lives, in BLAZE_LONG_SPRAY and otherwise.

Referenced by fdBlazeUpdateSpray().

Definition at line 586 of file field_psynergy_cyclone.c.

BLAZE_FLAME_TICKS

#define BLAZE_FLAME_TICKS 25

Referenced by fdBlazeUpdateSpray().

Definition at line 587 of file field_psynergy_cyclone.c.

Enumerations in detail

anonymous enum

enum { CYCLONE_RIDE_CARRIED, CYCLONE_RIDE_ARRIVED, CYCLONE_RIDE_RISES }

The stages of the leader's ride on Cyclone's whirlwind (CYCLONE_STATE.state).

EnumeratorValueDescription
CYCLONE_RIDE_CARRIED0carried round and along to the metatile
CYCLONE_RIDE_ARRIVED1a lifted leader settles on the metatile
CYCLONE_RIDE_RISES2then is swept up out of sight

Definition at line 67 of file field_psynergy_cyclone.c.

BLAZE_MODE

enum BLAZE_MODE

What Blaze does (BLAZE_STATE.mode).

EnumeratorValueDescription
BLAZE_FLICKER0cast at nothing with no torch in reach: a flicker
BLAZE_LIGHT_TORCH1cast at nothing: lights the nearest torch in reach
BLAZE_SPRAY2cast at a target: the jet of flame
BLAZE_LONG_SPRAY3the jet, faster and longer (FIELD_STATE.blazeLongSpray)

Definition at line 574 of file field_psynergy_cyclone.c.

Functions in detail

fdParticleBurstUpdate

void fdParticleBurstUpdate(void)

Each tick of Cyclone's 96 leaves (fdParticleBurstStart): once its delay has run out a leaf shows for 64 ticks, 48 pixels out along its heading, whirling round ever faster as it rises. The burst flashes on tick 30 and ends on tick 112.

References fdCameraWorldToScreen(), fdEffectSpriteDraw(), Sint32 and syVectorAddPolarOffset().

Referenced by fdParticleBurstEnd() and fdParticleBurstStart().

Definition at line 16 of file field_psynergy_cyclone.c.

fdParticleBurstEnd

void fdParticleBurstEnd(void)

Ends the particle burst (fdParticleBurstStart): stops its event and frees its tiles.

References fdParticleBurstUpdate(), syCloseEvent() and syVRAMCacheFreeEntry().

Referenced by fdPsynergyCyclone().

Definition at line 58 of file field_psynergy_cyclone.c.

fdCycloneCarryLeader

void fdCycloneCarryLeader(void)

Each tick of Cyclone's ride: the whirlwind carries the leader over 128 ticks from where it stood to the nearby CYCLONE_METATILE_CARRY metatile (a Cyclone teleporter), circling and arcing up and down on the way, its follower with it.

References Sint32, sySin() and syVectorAddPolarOffset().

Referenced by fdPsynergyCyclone().

Definition at line 84 of file field_psynergy_cyclone.c.

fdCycloneLiftLeader

void fdCycloneLiftLeader(void)

fdCycloneCarryLeader for a CYCLONE_METATILE_LIFT metatile: the leader is carried there 32 pixels up, circling, without the arc, settles for 40 ticks, and unless the scene asks to keep the leader there (sceneVariant 1) is swept 152 pixels up over 40 more.

References Sint32, sySin() and syVectorAddPolarOffset().

Referenced by fdPsynergyCyclone().

Definition at line 130 of file field_psynergy_cyclone.c.

fdActorUpdateSpin

void fdActorUpdateSpin(MOTION_OBJECT *actor)

An actor's update while it is in a whirlwind: it spins on the spot, a sixteenth of a turn a tick.

Referenced by fdActorAppearInWhirlwind(), fdActorDescendInWhirlwind() and fdPsynergyCyclone().

Definition at line 188 of file field_psynergy_cyclone.c.

fdPsynergyCycloneOnTarget

void fdPsynergyCycloneOnTarget(void)

Cyclone cast on a target: runs fdPsynergyCyclone.

References fdPsynergyCyclone().

Referenced by fdPsynergyDispatch().

Definition at line 194 of file field_psynergy_cyclone.c.

fdPsynergyCyclone

void fdPsynergyCyclone(void)

Cyclone ("Conjure wind to scatter weeds."): the caster spins in a whirlwind of blue and white drawn on the canvas sprite, and the weeds on the metatiles round it (fdPsynergyGatherNearbyMetatiles) are scattered.

References fdActorReleaseStub(), fdActorSelectAnimationStub(), fdActorSetPosAndResetMotionStub(), fdActorSetSpriteFlagsStub(), fdActorSetSpritePriority(), fdActorSpawn(), fdActorUpdateSpin(), fdBattleEffectEndCanvasSprite(), fdBattleEffectSetObjectUpdateMode(), fdBattleEffectStartCanvasSprite(), fdCameraMoveWithinMapBounds(), fdCameraWorldToScreen(), fdCycloneCarryLeader(), fdCycloneLiftLeader(), fdCyclonePlotArc(), fdEffectSpriteInit(), fdParticleBurstEnd(), fdParticleBurstStart(), fdPsynergyFadeFromCastColor(), fdPsynergyFadeToCastColor(), fdPsynergyGatherNearbyMetatiles(), fdPsynergyRunTouchedScripts(), Sint32, syCloseEvent(), syHeapSlotAllocate(), syHeapSlotRelease(), syRandom(), sySetEvent(), sySoundPlayStub() and sySynch().

Referenced by fdPsynergyCycloneOnTarget() and fdPsynergyRun().

Definition at line 222 of file field_psynergy_cyclone.c.

fdActorDescendInWhirlwind

void fdActorDescendInWhirlwind(Sint32 actorId)

The actor arrives in a whirlwind (SPRITE_WHIRLWIND) that spins down from above, as the leader does at a teleporter's end in Jupiter Lighthouse and Mars Lighthouse: as the screen transition starts it circles inside it for DESCEND_TICKS, from DESCEND_HEIGHT up and DESCEND_RADIUS out down to where it stands, then the whirlwind vanishes with a whoosh and the camera follows the actor again.

References fdActorGetById(), fdActorReleaseStub(), fdActorSelectAnimationStub(), fdActorSetPosAndResetMotionStub(), fdActorSpawn(), fdActorUpdateSpin(), fdCameraFollowActor(), fdCameraMoveWithinMapBounds(), fdScriptEndLastingPsynergy(), fdScriptStart(), fdScriptStartScreenTransition(), fdScriptWait(), Sint32, syCos(), sySoundPlayStub(), sySynch() and syVectorAddPolarOffset().

Referenced by scInit().

Definition at line 470 of file field_psynergy_cyclone.c.

fdActorAppearInWhirlwind

void fdActorAppearInWhirlwind(Sint32 actorId)

The actor appears in a whirlwind, as the leader does at a teleporter's end in Jupiter Lighthouse: once the screen transition is done, a whirlwind (SPRITE_WHIRLWIND) widens on the unseen, spinning actor for WHIRLWIND_RESIZE_TICKS, then vanishes with a whoosh as the actor grows back from half its size and shows again.

References fdActorGetById(), fdActorReleaseStub(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorSpawn(), fdActorUpdateSpin(), fdScriptEndLastingPsynergy(), fdScriptStart(), fdScriptStartScreenTransition(), fdScriptWait(), fdScriptWaitTransitionTicks(), Sint32, sySoundPlayStub() and sySynch().

Referenced by scInit().

Definition at line 531 of file field_psynergy_cyclone.c.

fdBlazeUpdateSpray

void fdBlazeUpdateSpray(void)

Each tick of Blaze's jet of flame (fdPsynergyBlaze): while it flows a flame leaves the caster every fourth tick, growing and falling as it flies, and burns out at the end of its life or on meeting a wall or a solid actor, every other flame leaving a puff of smoke that rises for 32 ticks. The jet swings toward its aim (targetAngle) by at most 1/64 turn a tick.

References fdActorGetSpriteDepth(), fdAdvanceWithGravity3D(), fdCameraWorldToScreen(), fdEffectSpriteDraw(), fdEffectSpriteDrawAtWorldPos(), fdMapGridCheckCollisionStub(), fdPsynergyCheckOverlap(), Sint32, syRandom(), syVectorAddPolarOffset() and TickCount.

Referenced by fdPsynergyBlaze().

Definition at line 619 of file field_psynergy_cyclone.c.

fdPsynergyBlazeOnTarget

void fdPsynergyBlazeOnTarget(void)

Blaze cast on a target: runs fdPsynergyBlaze.

References fdPsynergyBlaze().

Referenced by fdPsynergyDispatch().

Definition at line 788 of file field_psynergy_cyclone.c.