weather.c
Ground particles, motes, sparkles and lightning on the field.
games/tbs/src/object/psynergy_effects/weather.c on GitHub
Ground particles, motes, sparkles and lightning on the field. Part of psynergy_effects.c, compiled only through it.
Functions
FieldFx_UpdateGroundParticles
void FieldFx_UpdateGroundParticles(void)
Scheduler callback: animates the ground particles. Each plays a 16-frame animation (gFieldFx_GroundParticleFrames, 5 halfwords a frame: x and y offsets, tile, shape and size) on a random spot of ground within 128 pixels of the leader, then starts again elsewhere. The timer counts down, so the rows play from the last: each comes down slantwise onto its spot and stays there for its last seven frames. They freeze while flag 0x166 is set. Vale runs them with the lightning while FLAG_VALE_STORM is set (vale_home.c).
Used by FieldFx_StartGroundParticles.
FieldFx_UpdateLightning
void FieldFx_UpdateLightning(void)
Scheduler callback for the storm: lightning flashes the BG colours three times, 5 frames apart. The timer counts down to a burst's end: the lit colours show at 11, 6 and 1, each fading back over 12 frames from the next frame on. While enabled is set, the end of a burst plays a thunderclap (louder with loud set) and sets the timer to 51 to 549 frames for the next. Flag 0x166 holds the next burst back, and a timer below 0 stops the lightning.
Used by BattleFx_StartBufferBlend, FieldFx_StartLightning.
FieldFx_StartGroundParticles
void FieldFx_StartGroundParticles(void)
Starts the ground particles (FieldFx_UpdateGroundParticles) with sound 170: loads their tiles and puts 32 of them under the leader with staggered timers, drawn semi-transparent. Their work is heap block 29, which the motes and sparkles also take. SE_170 is queued (BattleFx_SetQueuedSoundAndPlay), so it plays again wherever the queued sound is replayed, as after a Psynergy effect.
Used by ValeHome_Initialize.
FieldMotes_Update
void FieldMotes_Update(void)
Scheduler callback: the floating motes. Each mote is given a spot of ground within 128 pixels of the leader (at most 8 new ones a frame), starts 120 pixels above it on screen and comes down a pixel a frame, slowing to 3/4 pixel a frame for its last 90 frames and 1/4 for its last 60, jittering sideways and changing tiles as it ages. It lasts 120 frames, ending about 52 pixels above its spot, or until it leaves the screen. They freeze while flag 0x166 is set. Nothing in ☀️ starts them (FieldMotes_Start has only its overlay veneer).
Used by FieldMotes_Start.
FieldMotes_Start
void FieldMotes_Start(void)
Starts the floating motes (FieldMotes_Update): loads their tiles and puts 32 of them under the leader with staggered timers, drawn semi-transparent.
FieldEffect_UpdateSparkles
void FieldEffect_UpdateSparkles(void)
Scheduler callback: the sparkles. Now and then (1 frame in 256) a sparkle appears on the ground within 128 pixels of the leader, and up to three more follow on the same spot, each 4 frames shorter. Each plays gFieldFx_SparkleFrames from the row its timer starts at down to row 0, coming down onto the spot, flipping every other frame. No new bursts start while the work's stopped is set; flag 0x166 freezes them. Sol Sanctum's eruption scene starts them (sol_sanctum_eruption.c).
Used by FieldEffect_InitSparkles.
FieldEffect_InitSparkles
void FieldEffect_InitSparkles(void)
Starts the sparkles (FieldEffect_UpdateSparkles): loads their tiles and clears the 32 sparkles.
Used by SolSanctumEruption_Initialize.
FieldFx_StartLightning
void FieldFx_StartLightning(void)
Starts the storm's lightning (FieldFx_UpdateLightning): builds the dark (0x10003, PALETTE_TRANSFORM_WARM) and lit (0x10005, PALETTE_TRANSFORM_PALE) BG colours and their 12-step fade, and arms the first burst to end in 600 frames, repeating. The work is heap block HEAP_SLOT_FIELD_BLEND, which the other lightning calls look up again. Vale's storm scenes call it.
Used by Event_DoraSendsIsaacToThePlaza, Event_DoraWakesIsaac, Event_HurryToThePlaza, ValeBabi_Initialize, ValeHome_Initialize, ValeInteriors_Initialize, ValeKraden_Initialize, ValeStorm_Initialize.
FieldFx_StopLightning
void FieldFx_StopLightning(void)
Stops the lightning: no flash for 0x7fff frames, and none after.
Used by Event_TravelersLeaveAfterBattle, ValeBabi_CloseScreenAndExit, ValeInteriors_RequestWindowExit, ValeStorm_ShowBoulderSweepingDownriver, Vale_RequestBackdropExit.
FieldFx_LastLightning
void FieldFx_LastLightning(void)
One last burst of lightning, its first flash two frames from now (timer 12; FieldFx_UpdateLightning flashes at 11), then no more. Vale's storm and eruption scenes call it.
Used by Event_DoraSendsIsaacToThePlaza, Event_DoraWakesIsaac, Event_HurryToThePlaza, Event_ReturnFromMtAleph, Event_TravelersLeaveAfterBattle, ValeBabi_Initialize, ValeInteriors_Initialize, ValeStorm_ShowBoulderSweepingDownriver.
FieldFx_ResumeLightning
void FieldFx_ResumeLightning(void)
Restarts the lightning: the next burst ends in 128 frames, its first flash 118 frames from now, and bursts repeat.
Used by Event_DoraSendsIsaacToThePlaza, Event_DoraWakesIsaac, Event_MeetSurvivingTravelers, Event_TravelersLeaveAfterBattle, ValeBabi_Initialize, ValeHome_Initialize, ValeInteriors_Initialize, ValeStorm_Initialize, ValeStorm_ShowBoulderSweepingDownriver.
BattleFx_StartBufferBlend
void BattleFx_StartBufferBlend(s32 from, s32 to)
Flashes the palette with the storm's callback: one burst of three flashes of palette to, each fading back to palette from (BattleFx_BuildBuffer modes) on the BG colours, ending 120 frames from now, and no more after. Vale's eruption calls it with the warm and red transforms (vale_eruption.c).
Used by Event_ReturnFromMtAleph.
Unions
DustWord
union DustWord
A particle's first word, seen as a value or a link.
| Field | Declared as | |
|---|---|---|
value | u32 value | |
link | void *link |
Used by FieldEffect_InitSparkles.