douse.c
Douse.
games/tbs/src/object/psynergy_effects/douse.c on GitHub
Douse. Part of psynergy_effects.c, compiled only through it.
Functions
FieldFx_SpawnRandomAngleTriplet
void FieldFx_SpawnRandomAngleTriplet(union FieldObject *fieldObject)
Per-frame update of a falling drop: on reaching altitude it is freed 2 frames later and scatters three half-size splashes, which hop toward points 32 pixels away and are freed after 6 frames.
Used by FieldFx_RunDouse.
BattleFx_UpdateDriftingFallObject
void BattleFx_UpdateDriftingFallObject(union FieldObject *fieldObject)
Per-frame update: drifts from side to side, up to a pixel a frame, as it falls 0.3 pixels a frame, and is released on reaching its ground height. Douse's swaying particles in Mercury Lighthouse.
Used by FieldFx_RunDouse.
FieldFx_RunDouseOnTarget
void FieldFx_RunDouseOnTarget(s32 unused)
Runs Douse cast on a target, through FieldFx_RunDouse.
Abilities: Douse (field kind 5), cast on a target.
Used by BattleFx_DispatchRequestKind.
FieldFx_RunDouse
void FieldFx_RunDouse(void)
An orb rises from 16 pixels above the caster to 32 pixels above the destination (80 with variant) over 10 frames, growing as it goes, rains particles, and returns.
Abilities: Douse (field kind 5).
The destination is the target's position (BattleFx_SetupObjectPair); with no target it is 16 pixels in front of the caster, on the ground. Called by BattleFx_Run, and through FieldFx_RunDouseOnTarget.
Used by BattleFx_Run, FieldFx_RunDouseOnTarget.
Structures
Effect05Object
struct Effect05Object
A FieldActor as Douse's orb and drops use it; the notes give the FieldActor fields at the same offsets.
| Field | Declared as | |
|---|---|---|
reserved00 | u8 reserved00[8] | |
x, y, z | s32 x, y, z | 16.16 fixed-point pixels |
altitude | s32 altitude | terrainHeight: a drop's height to fall to |
scaleX, scaleY | s32 scaleX, scaleY | |
reserved20 | u8 reserved20[8] | |
velocityY | s32 velocityY | 16.16 fixed-point pixels per frame, up |
reserved2c | u8 reserved2c[4] | |
speed | s32 speed | speed limit, 16.16 fixed-point pixels per frame |
reserved34 | u8 reserved34[0x1c] | |
sprite | struct WaveFxSprite *sprite | |
reserved54 | u8 reserved54 | |
flag | u8 flag | motionFlags: 2 falls, 0 free flight |
reserved56 | u8 reserved56[8] | |
phase | s16 phase | wait: frames its script waits before it runs on; 2 or 6 here, before gBattleFx_CommonParticleScript frees it. |
reserved60 | u8 reserved60[0xc] | |
callback | void (*callback)(union FieldObject *object) | per-frame update |
Used by FieldFx_RunDouse, FieldFx_SpawnRandomAngleTriplet.
Effect05State
struct Effect05State
The effect scene (struct BattleFxScene, gEffectWork) as Douse reads it; the notes give the BattleFxScene fields at the same offsets.
| Field | Declared as | |
|---|---|---|
angle | s32 angle | 1/65536 turns: the way the caster faces |
x, y, z | s32 x, y, z | the ground under the orb's destination |
target | struct Object *target | mainObject: the caster, despite the name |
initialized | s32 initialized | child: the target's object, 0 for none |
reserved18 | u8 reserved18[8] | |
highArc | u8 highArc | enabled: set at the start, cleared when a scene event names the target (BattleFx_DispatchRequestKind). Set, 10 particles fall; cleared, 24 drops, or 30 swaying particles in Mercury Lighthouse. |
reserved21 | u8 reserved21[0x13] | |
variant | u8 variant | childOption: set by a scene, the orb stops 80 pixels up |
reserved35 | u8 reserved35[0x10] | |
alternate | u8 alternate | lit: set in two Mercury Lighthouse maps (setup.c), where swaying particles (object 0x11c) fall rather than splashing drops. |
Used by FieldFx_RunDouse.