Skip to Content
The Alchemy Project

src/field/script_commands_motes.c

Weather drawn in sprites on the field, and the storm's lightning: floating motes, rain, rising sparkles, and the flashes of the palettes. More…

Included by script_commands.c.

Macros

NameDescription
#defineFIRST_SPAWN_TICKS 16The ticks the first motes and sparkles are spread over as they start.
#definesyDecompressByteLZ ((void (*)(const void *, void *))syDecompressByteLZ)As syDecompressTaggedLZ, with the byte LZ decoder.

Functions

NameDescription
voidfdMotesStart (void)Unused: nothing calls it, nor its stub call in engine_stubs.s.
voidfdWeatherStartRain (Sint32 withSound)Starts fdWeatherUpdateRain's raindrops: allocates and clears HEAP_SLOT_WEATHER, decodes the streak tiles into VRAM, sets each of the 64 drops' sprite words and places it on the ground at the map's focus with its first fall staggered, turns on alpha blending of all layers at 16/16, schedules the update and, when asked, plays SE_KIRIN (fdQueueMusic).
voidfdWeatherStopRain (void)Stops fdWeatherStartRain's particles.
voidfdEffectUpdateSparkles (void)The sparkles each tick: now and then a burst of four rises from a random spot within 128 pixels of the map's focus, each a tick of FieldEffectSparklePictures every two ticks and started 4 ticks after the one before; FLAG_WEATHER_HELD holds them where they are.
voidfdEffectInitSparkles (void)Unused: nothing calls it or its stub; Aqua Rock and the Apojii Islands keep their own copy (shared/ground_particles_start.c).
voidfdWeatherStartLightning (void)Starts the storm's lightning (fdWeatherUpdateLightning): builds the dark (PALETTE_TINT_WARM) and lit (PALETTE_TINT_PALE) BG colours and their 12-step fade, and arms the first burst to end in 600 ticks, repeating.
voidfdWeatherStopLightning (void)Stops the lightning: no flash for 32767 ticks, and none after.
voidfdWeatherLastLightning (void)One last burst of lightning, its first flash two ticks from now (timer 12; fdWeatherUpdateLightning flashes at 11), then no more.
voidfdWeatherResumeLightning (void)Restarts the lightning: the next burst ends in 128 ticks, and bursts repeat.
voidfdWeatherStartLightningFlash (Sint32 from, Sint32 to)Flashes the palette with the storm's event: one burst of three flashes of palette to, each fading back to palette from (fdPaletteFadeBuild modes) on the BG colours, ending 120 ticks from now, and no more after.

Description

Weather drawn in sprites on the field, and the storm's lightning: floating motes, rain, rising sparkles, and the flashes of the palettes. Part of script_commands.c.

Macros in detail

FIRST_SPAWN_TICKS

#define FIRST_SPAWN_TICKS 16

The ticks the first motes and sparkles are spread over as they start.

Referenced by fdEffectInitSparkles() and fdMotesStart().

Definition at line 6 of file script_commands_motes.c.

syDecompressByteLZ

#define syDecompressByteLZ ((void (*)(const void *, void *))syDecompressByteLZ)

Referenced by fdEffectInitSparkles(), fdGroundParticlesStart(), fdHeadingShow(), fdMotesStart(), fdRisingParticlesStart(), fdWeatherStartRain(), fdWorldMapLoadAreaGraphics(), fdWorldMapLoadGraphics(), fdWorldMapPreloadCurrentTileBlock(), fdWorldMapWriteLayerMetatileTile(), mnBattleCommandRowLoadIconTiles(), mnCommandIconLoad(), mnCommandIconLoadIntoSlot(), mnCommandIconReloadSlot(), mnSelectionMenuLoadLargeIcon(), mnTitleIntroLoadPictureTiles(), mnTitleIntroShowLighthouse(), mnTitleLoad(), mnTitleShowTitleScreen() and mnVRAMBlockLoadResource().

Definition at lines 8 and 257 of file script_commands_motes.c.

Functions in detail

fdMotesStart

void fdMotesStart(void)

Unused: nothing calls it, nor its stub call in engine_stubs.s. Starts the 64 floating motes (fdMotesUpdate): loads their tiles and puts each under the leader with staggered timers, drawn semi-transparent.

References fdMapGridGetTerrainHeightStub(), fdMotesUpdate(), FieldEffectMoteTiles, Sint32, syDecompressByteLZ(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), sySetEvent(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Definition at line 13 of file script_commands_motes.c.

fdWeatherStartRain

void fdWeatherStartRain(Sint32 withSound)

Starts fdWeatherUpdateRain's raindrops: allocates and clears HEAP_SLOT_WEATHER, decodes the streak tiles into VRAM, sets each of the 64 drops' sprite words and places it on the ground at the map's focus with its first fall staggered, turns on alpha blending of all layers at 16/16, schedules the update and, when asked, plays SE_KIRIN (fdQueueMusic).

References fdMapGridGetTerrainHeightStub(), fdQueueMusic(), fdWeatherUpdateRain(), FieldEffectStreakTiles, Sint32, syDecompressByteLZ(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), sySetEvent(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by scInit() and scPrepareMap().

Definition at line 72 of file script_commands_motes.c.

fdWeatherStopRain

void fdWeatherStopRain(void)

Stops fdWeatherStartRain's particles. Unused: nothing calls it, nor its stub call in engine_stubs.s.

References fdWeatherUpdateRain() and syCloseEvent().

Definition at line 129 of file script_commands_motes.c.

fdEffectUpdateSparkles

void fdEffectUpdateSparkles(void)

The sparkles each tick: now and then a burst of four rises from a random spot within 128 pixels of the map's focus, each a tick of FieldEffectSparklePictures every two ticks and started 4 ticks after the one before; FLAG_WEATHER_HELD holds them where they are.

References fdMapGridGetTerrainHeightStub(), FieldEffectSparklePictures, Sint32, syGameFlagGet(), syOAMAddSpriteAtDepthClamped(), syRandom() and TickCount.

Referenced by fdEffectInitSparkles().

Definition at line 138 of file script_commands_motes.c.

fdEffectInitSparkles

void fdEffectInitSparkles(void)

Unused: nothing calls it or its stub; Aqua Rock and the Apojii Islands keep their own copy (shared/ground_particles_start.c). Starts the sparkles (fdEffectUpdateSparkles): loads their tiles and lays every sparkle at the map's top left corner with a staggered timer.

References fdEffectUpdateSparkles(), fdMapGridGetTerrainHeightStub(), FieldEffectSparkleTiles, Sint32, syDecompressByteLZ(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), sySetEvent(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Definition at line 263 of file script_commands_motes.c.

fdWeatherStartLightning

void fdWeatherStartLightning(void)

Starts the storm's lightning (fdWeatherUpdateLightning): builds the dark (PALETTE_TINT_WARM) and lit (PALETTE_TINT_PALE) BG colours and their 12-step fade, and arms the first burst to end in 600 ticks, repeating.

References fdPaletteFadeBuild(), fdPaletteFadeCalculateSteps(), fdWeatherUpdateLightning(), Sint32, syHeapSlotAllocateEWRAM() and sySetEvent().

Definition at line 317 of file script_commands_motes.c.

fdWeatherStopLightning

void fdWeatherStopLightning(void)

Stops the lightning: no flash for 32767 ticks, and none after.

References syHeapSlotAllocateEWRAM().

Definition at line 339 of file script_commands_motes.c.

fdWeatherLastLightning

void fdWeatherLastLightning(void)

One last burst of lightning, its first flash two ticks from now (timer 12; fdWeatherUpdateLightning flashes at 11), then no more.

References syHeapSlotAllocateEWRAM().

Definition at line 349 of file script_commands_motes.c.

fdWeatherResumeLightning

void fdWeatherResumeLightning(void)

Restarts the lightning: the next burst ends in 128 ticks, and bursts repeat.

References syHeapSlotAllocateEWRAM().

Definition at line 358 of file script_commands_motes.c.

fdWeatherStartLightningFlash

void fdWeatherStartLightningFlash(Sint32 from, Sint32 to)

Flashes the palette with the storm's event: one burst of three flashes of palette to, each fading back to palette from (fdPaletteFadeBuild modes) on the BG colours, ending 120 ticks from now, and no more after.

References fdPaletteFadeBuild(), fdPaletteFadeCalculateSteps(), fdWeatherUpdateLightning(), Sint32, syHeapSlotAllocateEWRAM() and sySetEvent().

Definition at line 369 of file script_commands_motes.c.