Skip to Content
The Alchemy Project

include/graphics/palette_cycles.h

Palette cycles: runs of background palette colours that rotate one place every few ticks, up to four at once.

Included by field_tile_animation.c and islets.c.

Structures

NameDescription
structPALETTE_CYCLEA palette cycle: a run of up to 16 background palette colours, saved and rotated by one colour every delay + 1 ticks.
structPALETTE_CYCLE_STATEThe palette cycling queue (HEAP_SLOT_PALETTE_CYCLES): four cycles and how many are in use.

Macros

NameDescription
#definePaletteState ((PALETTE_CYCLE_STATE *)RamHeapSlots->paletteCycles)The palette cycling queue, in its heap slot (HEAP_SLOT_PALETTE_CYCLES).

Functions

NameDescription
voidfdPaletteCycleInit (void)Allocates the palette cycling queue (HEAP_SLOT_PALETTE_CYCLES) with its four entries cleared.
Sint32fdPaletteCycleAdd (Sint16 paletteNumber, Sint16 firstColor, Sint16 delay, Sint16 colorCount)Unused: starts rotating colorCount colours of background palette paletteNumber, from colour firstColor, by one place every delay + 1 ticks (fdPaletteCycleStep).
voidfdPaletteQueueStop (void)Unused: stops the palette cycles and frees their queue (HEAP_SLOT_PALETTE_CYCLES).
voidfdPaletteCycleStep (void)Each tick: advances each palette cycle whose timer has run out by one colour, writing the rotated colours back to the palette.

Description

Palette cycles: runs of background palette colours that rotate one place every few ticks, up to four at once.

Macros in detail

PaletteState

#define PaletteState ((PALETTE_CYCLE_STATE *)RamHeapSlots->paletteCycles)

The palette cycling queue, in its heap slot (HEAP_SLOT_PALETTE_CYCLES).

Referenced by fdPaletteCycleStep().

Definition at line 41 of file palette_cycles.h.