Skip to Content
The Alchemy Project

include/field/lucky_wheels.h

Lucky Wheels, Tolbi's game of chance (lucky_wheels.c), and the unused LZ packer kept beside it.

Included by lucky_wheels.c and tolbi_games.c.

Enumerations

NameDescription
enumLUCKY_WHEELS_PRIZE { LUCKY_WHEELS_PRIZE_UNDERSHIRT, LUCKY_WHEELS_PRIZE_BOOTS, LUC … }What a line of each Lucky Wheels symbol wins, as the prize sign reads it: "Shirts win undershirts, Rings win rings, Boots win boots, Stars and Hearts win items, and Moons can win you anything." Tolbi's attendant gives one of three items of the kind.

Functions

NameDescription
Sint32fdLuckyWheelsStart (void)The Lucky Wheels module's function in its stub table (src/field/lucky_wheels_stubs.s).
voidfdLuckyWheelsTransferCanvas (void)A VBlank-pass event: on a VBlank after the canvas is ready (transferPending), sends the canvas to its tiles in VRAM (LUCKY_WHEELS_CANVAS_TILES), then clears it or fades it into trails as transferMode says.
voidfdLuckyWheelsDarkenStep (void)Darkens the screen one step: lowers each channel of the machine's 16 colours and of the icons' by 1.
voidfdLuckyWheelsStepSparkColors (Sint32 resource)Moves the sparks' colours one step toward the palette of resource; the backdrop colour is not written back.
voidfdLuckyWheelsDrawCanvasLine ( Sint32 x0, Sint32 y0, Sint32 x1, Sint32 y1, Sint32 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.
voidfdLuckyWheelsUpdate (void)Lucky Wheels' VBlank event: reads the keys, runs the game's phase (betting, spinning and stopping the wheels, scoring the paylines, choosing wheels 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 wheel symbols, the lever and the bottom bar.
voidfdLuckyWheelsSetUpBetting (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.
voidfdLuckyWheelsRun (void)Lucky Wheels: loads its backgrounds, sprites and palettes, fills each of the five wheels with 21 random symbols, among them each plain symbol and three moons, 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.
voidfdLZPackResetChains (void)Empties the LZ packer's hash chains and numbers its window nodes.
voidfdLZPackInsertSlotNode (Sint32 index)Adds window position index to the chain of the byte it holds.
voidfdLZPackRemoveSlotNode (Sint32 slot)Removes window position slot from its chain.
voidfdLZPackReadInput (Sint32 start, Sint32 count, const Uint8 *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).
voidfdLZPackCopyBufferedBytes (Uint8 *dest)Appends the finished group (a flag byte and up to eight items) to the output.
Sint32fdLZPackPackData (const Uint8 *input, Uint8 *dest, Sint32 size)Unused: packs size bytes of input into dest with a small LZ scheme and returns the packed size.

Variables

NameDescription
extern const Uint16LuckyWheelsSparkPictures []Where each spark picture (a square 2 to 20 pixels on a side) starts: size s (1 to 10) is a square 2s pixels a side, after the smaller squares' pixels.
extern const Uint8LuckyWheelsSymbolPrizes []The prize of each wheel symbol (LUCKY_WHEELS_PRIZE), kept in MainRoutineStateWork.holdings.wonPrizes for each winning line.
extern const Uint8LuckyWheelsMachineSpriteX []The positions of the machine's lights, in screen pixels: its four corners first, then the lights along its frame.
extern const Uint8LuckyWheelsMachineSpriteY []

Description

Lucky Wheels, Tolbi's game of chance (lucky_wheels.c), and the unused LZ packer kept beside it.

Enumerations in detail

LUCKY_WHEELS_PRIZE

enum LUCKY_WHEELS_PRIZE

What a line of each Lucky Wheels symbol wins, as the prize sign reads it: "Shirts win undershirts, Rings win rings, Boots win boots, Stars and Hearts win items, and Moons can win you anything." Tolbi's attendant gives one of three items of the kind.

EnumeratorValueDescription
LUCKY_WHEELS_PRIZE_UNDERSHIRTa Mythril, Silk or Running Shirt
LUCKY_WHEELS_PRIZE_BOOTSHyper, Quick or Fur Boots
LUCKY_WHEELS_PRIZE_RINGan Adept, War or Sleep Ring
LUCKY_WHEELS_PRIZE_HEART_ITEMa Potion, Vial or Nut
LUCKY_WHEELS_PRIZE_STAR_ITEMa Water of Life, Psy Crystal or Elixir
LUCKY_WHEELS_PRIZE_ANYTHINGone of the five kinds above
LUCKY_WHEELS_PRIZE_LIST_END-1ends prize list; if first, last pull won nothing
LUCKY_WHEELS_PRIZE_LIST_DONE-2if first: left at bet, or attendant has given prizes

Definition at line 14 of file lucky_wheels.h.