Alchemy
Loading...
Searching...
No Matches

colorfx.h File Reference

Go to the source code of this file.

Functions

s32 ReelGame_Start (void)
 Plays the slot machine: blanks the screen, seeds the random numbers with the play time and runs the game.
s32 Graphics_ScaleRgb555 (u16 *src, u16 *dst, s32 scale, s32 count)
 Writes count RGB555 colours from src to dst scaled by scale (16.16, 0x10000 keeps them).
void ReelGame_TransferCanvas (void)
 A scheduler callback: on a frame whose canvas is ready (transferPending), sends the canvas to its tiles in VRAM (REEL_CANVAS_TILES), then clears it or fades it into trails as transferMode says.
void Palette_DarkenSceneStep (void)
 Darkens the screen one step: lowers each channel of the 16 colours of BG palette 10 and of OBJ colours 1 to 239 by 1.
void Palette_StepTowardResource (s32 resource)
 Moves the first 64 BG colours one step toward the palette of resource; the backdrop colour is not written back.
void ReelGame_DrawCanvasLine (s32 x0, s32 y0, s32 x1, s32 y1, s32 color)
 Draws a line from (x0, y0) to (x1, y1) on the 256 x 128 8bpp canvas (32 tiles across), writing only over lower colour numbers.
void ReelGame_RunFrame (void)
 The slot machine's frame callback: reads the keys, runs the game's state (betting, spinning and stopping the reels, scoring the paylines, choosing reels to hold, showing a win) and builds all 128 sprites: the cursor, the title letters of a win, the frame, the hold lamps, the spin counter, the paylines, the reel symbols, the lever and the bottom bar.
void ReelGame_InitTitle (void)
 Sets up the bouncing title letters of a win, the brightness wave of the screen's lines and the betting window, and starts at betting.
void ReelGame_Run (void)
 The slot machine: loads its backgrounds, sprites and palettes, fills each of the five reels with 21 random symbols (with eight placed symbols of rank 0 to 5), then runs until the player leaves: fading in, drawing the paylines on the canvas while betting or winning, and the jackpot's sparks and colour cycle while showing a win.
void LzPack_ResetSlotBuckets (void)
 The LZ packer below: empties its 256 hash chains (one per byte value) and numbers its 1024 window nodes.
void LzPack_InsertSlotNode (s32 index)
 Adds window position index to the chain of the byte it holds.
void LzPack_RemoveSlotNode (s32 slot)
 Removes window position slot from its chain.
void LzPack_ConsumeSlotBytes (s32 start, s32 count, const u8 *input)
 Reads count more input bytes into the window from position start, dropping the bytes they replace from their chains; past the end of the input the positions are marked empty (-1).
void LzPack_CopyBufferedBytes (u8 *destination)
 Appends the finished group (a flag byte and up to eight items) to the output.
s32 LzPack_PackStream (const u8 *input, u8 *dst, s32 size)
 Packs size bytes of input into dst with a small LZ scheme and returns the packed size.

Variables

const u16 gReelGame_SparkCellOffsets []
 Where each spark cell (a square 2 to 20 pixels on a side) starts.
const u8 gReelGame_SymbolPrizes []
 The prize of each reel symbol.
const u8 gReelGame_FrameSpriteX []
 The positions of the frame's sprites.
const u8 gReelGame_FrameSpriteY []

Function Documentation

◆ ReelGame_Start()

s32 ReelGame_Start ( void )

Plays the slot machine: blanks the screen, seeds the random numbers with the play time and runs the game.

Returns 0.

Definition at line 58 of file colorfx.c.

Referenced by ReelGame_Start().

◆ Graphics_ScaleRgb555()

s32 Graphics_ScaleRgb555 ( u16 * src,
u16 * dst,
s32 scale,
s32 count )

Writes count RGB555 colours from src to dst scaled by scale (16.16, 0x10000 keeps them).

Returns 0.

Definition at line 68 of file colorfx.c.

Referenced by Graphics_ScaleRgb555(), and ReelGame_Run().

◆ ReelGame_TransferCanvas()

void ReelGame_TransferCanvas ( void )

A scheduler callback: on a frame whose canvas is ready (transferPending), sends the canvas to its tiles in VRAM (REEL_CANVAS_TILES), then clears it or fades it into trails as transferMode says.

Definition at line 106 of file colorfx.c.

Referenced by ReelGame_Run(), and ReelGame_TransferCanvas().

◆ Palette_DarkenSceneStep()

void Palette_DarkenSceneStep ( void )

Darkens the screen one step: lowers each channel of the 16 colours of BG palette 10 and of OBJ colours 1 to 239 by 1.

Definition at line 139 of file colorfx.c.

Referenced by Palette_DarkenSceneStep(), and ReelGame_Run().

◆ Palette_StepTowardResource()

void Palette_StepTowardResource ( s32 resource)

Moves the first 64 BG colours one step toward the palette of resource; the backdrop colour is not written back.

Definition at line 183 of file colorfx.c.

Referenced by Palette_StepTowardResource(), and ReelGame_Run().

◆ ReelGame_DrawCanvasLine()

void ReelGame_DrawCanvasLine ( s32 x0,
s32 y0,
s32 x1,
s32 y1,
s32 color )

Draws a line from (x0, y0) to (x1, y1) on the 256 x 128 8bpp canvas (32 tiles across), writing only over lower colour numbers.

Definition at line 217 of file colorfx.c.

Referenced by ReelGame_DrawCanvasLine(), and ReelGame_Run().

◆ ReelGame_RunFrame()

void ReelGame_RunFrame ( void )

The slot machine's frame callback: reads the keys, runs the game's state (betting, spinning and stopping the reels, scoring the paylines, choosing reels to hold, showing a win) and builds all 128 sprites: the cursor, the title letters of a win, the frame, the hold lamps, the spin counter, the paylines, the reel symbols, the lever and the bottom bar.

Definition at line 351 of file colorfx.c.

Referenced by ReelGame_Run(), and ReelGame_RunFrame().

◆ ReelGame_InitTitle()

void ReelGame_InitTitle ( void )

Sets up the bouncing title letters of a win, the brightness wave of the screen's lines and the betting window, and starts at betting.

Definition at line 897 of file colorfx.c.

Referenced by ReelGame_InitTitle(), and ReelGame_Run().

◆ ReelGame_Run()

void ReelGame_Run ( void )

The slot machine: loads its backgrounds, sprites and palettes, fills each of the five reels with 21 random symbols (with eight placed symbols of rank 0 to 5), then runs until the player leaves: fading in, drawing the paylines on the canvas while betting or winning, and the jackpot's sparks and colour cycle while showing a win.

Then fades out and frees its memory.

Definition at line 958 of file colorfx.c.

Referenced by ReelGame_Run(), and ReelGame_Start().

◆ LzPack_ResetSlotBuckets()

void LzPack_ResetSlotBuckets ( void )

The LZ packer below: empties its 256 hash chains (one per byte value) and numbers its 1024 window nodes.

Definition at line 1293 of file colorfx.c.

Referenced by LzPack_PackStream(), and LzPack_ResetSlotBuckets().

◆ LzPack_InsertSlotNode()

void LzPack_InsertSlotNode ( s32 index)

Adds window position index to the chain of the byte it holds.

Definition at line 1308 of file colorfx.c.

Referenced by LzPack_ConsumeSlotBytes(), and LzPack_InsertSlotNode().

◆ LzPack_RemoveSlotNode()

void LzPack_RemoveSlotNode ( s32 slot)

Removes window position slot from its chain.

Definition at line 1320 of file colorfx.c.

Referenced by LzPack_ConsumeSlotBytes(), and LzPack_RemoveSlotNode().

◆ LzPack_ConsumeSlotBytes()

void LzPack_ConsumeSlotBytes ( s32 start,
s32 count,
const u8 * input )

Reads count more input bytes into the window from position start, dropping the bytes they replace from their chains; past the end of the input the positions are marked empty (-1).

Definition at line 1332 of file colorfx.c.

Referenced by LzPack_ConsumeSlotBytes(), and LzPack_PackStream().

◆ LzPack_CopyBufferedBytes()

void LzPack_CopyBufferedBytes ( u8 * destination)

Appends the finished group (a flag byte and up to eight items) to the output.

Definition at line 1386 of file colorfx.c.

Referenced by LzPack_CopyBufferedBytes(), and LzPack_PackStream().

◆ LzPack_PackStream()

s32 LzPack_PackStream ( const u8 * input,
u8 * dst,
s32 size )

Packs size bytes of input into dst with a small LZ scheme and returns the packed size.

Each group starts with a flag byte, a set bit marking a match: two bytes of distance and length (lengths 2 to 16), or three for lengths up to 272; a match is put off by one byte when the next position matches further. A zero match ends the stream. Nothing in this game calls it.

Definition at line 1460 of file colorfx.c.

Referenced by LzPack_PackStream().

Variable Documentation

◆ gReelGame_SparkCellOffsets

const u16 gReelGame_SparkCellOffsets[]
extern

Where each spark cell (a square 2 to 20 pixels on a side) starts.

Definition at line 6 of file reel_tables.h.

Referenced by ReelGame_Run().

◆ gReelGame_SymbolPrizes

const u8 gReelGame_SymbolPrizes[]
extern

The prize of each reel symbol.

Definition at line 10 of file reel_tables.h.

Referenced by ReelGame_RunFrame().

◆ gReelGame_FrameSpriteX

const u8 gReelGame_FrameSpriteX[]
extern

The positions of the frame's sprites.

Definition at line 27 of file reel_tables.h.

Referenced by ReelGame_RunFrame().

◆ gReelGame_FrameSpriteY

const u8 gReelGame_FrameSpriteY[]
extern

Definition at line 29 of file reel_tables.h.

Referenced by ReelGame_RunFrame().