Alchemy

whirlwind.c

Whirlwind.

games/tbs/src/object/psynergy_effects/whirlwind.c on GitHub

Whirlwind. Part of psynergy_effects.c, compiled only through it.

Functions

FieldFx_UpdateParticleMotionAndScale

void FieldFx_UpdateParticleMotionAndScale(union FieldObject *object)

Per-frame update of a particle: moves by its velocity, slowing its x and z velocity a little, and changes its scale and spin. Assigned by BattleFx_SpawnRadialParticleRing for Carry's landing particles.

Used by BattleFx_SpawnRadialParticleRing.

Line 48

BattleFx_SpawnRadialParticleRing

void BattleFx_SpawnRadialParticleRing(struct MotionObject *origin)

Spawns 17 particles that spread from origin in a flat ring, their x velocity 1.5 times their z velocity, so the ring is wider than deep as the field is drawn. Carry's BattleFx_SteerLiftedTarget spawns it where it sets its load down.

Used by BattleFx_SteerLiftedTarget.

Line 65

BattleFx_WanderAroundAnchor

void BattleFx_WanderAroundAnchor(union FieldObject *fieldObject)

Per-frame update: wanders away from the anchor, 2 to 3 pixels a frame, now and then turning sharply; after 101 frames it hands over to the common particle script. BattleFx_CircleAnchor switches a particle to it. While it wanders, the engine's own motion lifts the particle (the velocity and gravity BattleFx_CircleAnchor gave it); this only moves it across the ground.

Used by BattleFx_CircleAnchor.

Line 95

BattleFx_CircleAnchor

void BattleFx_CircleAnchor(union FieldObject *fieldObject)

Per-frame update: circles the anchor at 8 pixels; after 121 frames it starts to wander (BattleFx_WanderAroundAnchor). FieldFx_RunWhirlwind gives it to each of the 16 particles it spawns round the orb.

Used by FieldFx_RunWhirlwind.

Line 127

BattleFx_ShrinkObjectScaleUntilHalf

void BattleFx_ShrinkObjectScaleUntilHalf(union FieldObject *fieldObject)

Shrinks a scene-selected Whirlwind target each frame; below half size, moves it to the origin, stops it and removes the update. The scale falls by 1/512 each frame. From unit scale the strict lower bound takes 257 updates.

Used by FieldFx_RunWhirlwind.

Line 159

FieldFx_RunWhirlwindOnTarget

void FieldFx_RunWhirlwindOnTarget(s32 unused)

Runs Whirlwind using the target already stored in the effect scene. Abilities: Whirlwind, Gale (field kind 14), cast on a target. BattleFx_DispatchRequestKind passes an argument this adapter ignores; the shared runner reads scene->child instead.

Used by BattleFx_DispatchRequestKind.

Line 176

FieldFx_RunWhirlwind

void FieldFx_RunWhirlwind(void)

An orb is carried from the caster to 4 pixels above the effect's position over 10 frames, growing from 0.25.

Abilities: Whirlwind, Gale (field kind 14).

Without scene->enabled the target shrinks, and 16 particles appear round the orb, one every 6 frames, and circle it.

Called by BattleFx_Run and FieldFx_RunWhirlwindOnTarget. Fades the palettes to an effect colour and back, and gives the target its shrinking update; the orb is released at the end, the particles finish on their own.

Used by BattleFx_Run, FieldFx_RunWhirlwindOnTarget.

Line 189

Structures

WhirlwindOrbit

struct WhirlwindOrbit

A FieldActor seen with the halfword at 0x64 unsigned and the one at 0x66 signed, as the bytes read them (FieldActor's own types change the code). Whirlwind particles (object 0xf9) use this view.

FieldDeclared as
unk00u8 unk00[6]
angleu16 angleheading or orbit angle, in 1/65536 turns
xs32 x16.16 pixels
ys32 y16.16 pixels
zs32 z16.16 pixels
unk14u8 unk14[20]
velocityYs32 velocityYapplied by the engine, in 16.16 pixels per frame
unk2cu8 unk2c[28]
gravitys32 gravityvertical deceleration, in 16.16 pixels per frame squared
unk4cu8 unk4c[24]
timeru16 timerframes so far
pauses16 pauseframes left of a sharp turn
anchorstruct WhirlwindOrbit *anchororb at the centre of the orbit
updatevoid (*update)(union FieldObject *object)engine's per-frame callback

Used by BattleFx_CircleAnchor, BattleFx_WanderAroundAnchor.

Line 23

Macros

EFFECT_SPAWN_RESIDENT

#define EFFECT_SPAWN_RESIDENT

The shared effect-spawning source, at its place in the ROM.

Line 41

On this page