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.
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.
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.
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.
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.
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.
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.
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.
| Field | Declared as | |
|---|---|---|
unk00 | u8 unk00[6] | |
angle | u16 angle | heading or orbit angle, in 1/65536 turns |
x | s32 x | 16.16 pixels |
y | s32 y | 16.16 pixels |
z | s32 z | 16.16 pixels |
unk14 | u8 unk14[20] | |
velocityY | s32 velocityY | applied by the engine, in 16.16 pixels per frame |
unk2c | u8 unk2c[28] | |
gravity | s32 gravity | vertical deceleration, in 16.16 pixels per frame squared |
unk4c | u8 unk4c[24] | |
timer | u16 timer | frames so far |
pause | s16 pause | frames left of a sharp turn |
anchor | struct WhirlwindOrbit *anchor | orb at the centre of the orbit |
update | void (*update)(union FieldObject *object) | engine's per-frame callback |
Used by BattleFx_CircleAnchor, BattleFx_WanderAroundAnchor.
Macros
EFFECT_SPAWN_RESIDENT
#define EFFECT_SPAWN_RESIDENT
The shared effect-spawning source, at its place in the ROM.