Skip to Content
The Alchemy Project

src/field/lucky_wheels.c

Lucky Wheels, Contigo's game of chance: the player trades game tickets for lines, pulls the lever up to five times and locks wheels to line up matching icons. More…

Structures

NameDescription
structLUCKY_WHEELS_STATELucky Wheels' state: the five reels, the game's stage, cursor, spins and bet, the keys read, the winning lines, the reel sprites, the windows and the scanline offsets that bend the reels.

Macros

NameDescription
#defineLUCKY_WHEELS_CANVAS_SIZE (256 * 128)The paylines' canvas: 256 x 128 pixels of 8-bit colour, shown on BG2 from its tile 212 in the rows of its map from LUCKY_WHEELS_CANVAS_TOP_ROW to LUCKY_WHEELS_CANVAS_BOTTOM_ROW; the rows above and below show a clear tile, in the part of BG1's map below the screen that fdLuckyWheelsRun clears.
#defineLUCKY_WHEELS_CANVAS_FIRST_TILE 212
#defineLUCKY_WHEELS_CANVAS_TOP_ROW 2
#defineLUCKY_WHEELS_CANVAS_BOTTOM_ROW 16
#defineLUCKY_WHEELS_CANVAS_TILES
#defineLUCKY_WHEELS_CANVAS_CLEAR_TILE 191
#defineLUCKY_WHEELS_SPARK_COLORS 64The canvas's first 64 colours, its sparks', from a Djinn sprite sheet's palette and cycled through others while a win shows.
#defineLUCKY_WHEELS_LINE_COLOR 64The paylines' green on the canvas, colour 64, and its lighter centre.
#defineLUCKY_WHEELS_LINE_LIGHT (LUCKY_WHEELS_LINE_COLOR + 1)
#defineLUCKY_WHEELS_MACHINE_PALETTE 10The machine's picture: its 16 colours in BG palette 10, and its tiles from tile 424 of BG1's characters, all but those of the opening the wheels show through, which BG1's map fills with a clear tile.
#defineLUCKY_WHEELS_MACHINE_TILE 424
#defineLUCKY_WHEELS_CLEAR_TILE 422
#defineLUCKY_WHEELS_IN_OPENING (column, row)The machine's opening, in BG1's map tiles: columns 5 to 24 and rows 3 to 13.
#defineLUCKY_WHEELS_ICON_COLORS 240The icons' picture begins with its 240 colours, the sprites' first 240.
#defineLUCKY_WHEELS_JACKPOT_PALETTE 15The jackpot banner's and the title letters' sprite palette.
#defineLUCKY_WHEELS_REEL_COUNT 5The machine's five wheels; the cursor's next place, past the last wheel, is the lever.
#defineLUCKY_WHEELS_LEVER LUCKY_WHEELS_REEL_COUNT
#defineLUCKY_WHEELS_LEVER_PULL_TICKS 48Pulling the lever: 48 ticks down and back up, then 8 settling; only then can the wheels be stopped.
#defineLUCKY_WHEELS_LEVER_SETTLE_TICKS 8
#defineLUCKY_WHEELS_LEVER_TICKS
#defineLUCKY_WHEELS_LEVER_X 208The lever sprite's place at rest, in screen pixels, and how far it is pulled down.
#defineLUCKY_WHEELS_LEVER_Y 40
#defineLUCKY_WHEELS_LEVER_PULL 64
#defineLUCKY_WHEELS_AUTO_STOP_TICKS 32Left alone, the spinning wheels stop one every 32 ticks; R stops one at once.
#defineLUCKY_WHEELS_WIN_PAUSE 60The pause after a winning spin before the win is shown, and after the last spin loses before the game ends.
#defineLUCKY_WHEELS_LOSS_PAUSE 45
#defineLUCKY_WHEELS_STOP_WINDOW_TICK 4The stop prompt's window opens this many ticks into a spin, and its sound plays at LUCKY_WHEELS_STOP_PROMPT_TICK.
#defineLUCKY_WHEELS_STOP_PROMPT_TICK 16
#defineLUCKY_WHEELS_LAMP_TILES 96Where each picture of icons.png starts in sprite tiles, in OAM's 32-byte steps (a 256-colour tile is two): the sprite sheet is 32 pixels wide, so a picture starts at the tile numbered as its row.
#defineLUCKY_WHEELS_LOCKED_LAMP_TILES 128A locked wheel's lamp.
#defineLUCKY_WHEELS_CORNER_LIGHT_TILES 224
#defineLUCKY_WHEELS_FRAME_LIGHT_TILES 232
#defineLUCKY_WHEELS_LEVER_TILES 256
#defineLUCKY_WHEELS_LINE_TILES 272A payline's gem, not bet on.
#defineLUCKY_WHEELS_LIT_LINE_TILES 464A payline's gem, bet on.
#defineLUCKY_WHEELS_LEVER_SLOT_TILES 320The slot the lever runs in, drawn in eight pieces 16 pixels tall down beside the wheels from (LUCKY_WHEELS_LEVER_SLOT_X, LUCKY_WHEELS_LEVER_SLOT_Y).
#defineLUCKY_WHEELS_LEVER_SLOT_PIECES 8
#defineLUCKY_WHEELS_LEVER_SLOT_X 206
#defineLUCKY_WHEELS_LEVER_SLOT_Y 12
#defineLUCKY_WHEELS_HAND_TILES 496The cursor's hand.
#defineLUCKY_WHEELS_PULL_TILES 528A pull's number, the current one large.
#defineLUCKY_WHEELS_ARROW_TILES 688The cursor's blinking arrows.
#defineLUCKY_WHEELS_REEL_SYMBOLS 21The symbols round a wheel, each 16 pixels tall: a wheel turns once in 336 pixels, 8 a tick, and stops only with a symbol centred on a line.
#defineLUCKY_WHEELS_SYMBOL_HEIGHT 16
#defineLUCKY_WHEELS_REEL_TURN
#defineLUCKY_WHEELS_SPIN_SPEED 8
#defineLUCKY_WHEELS_PAYLINES 7The seven paylines: the two diagonals (0 and 6) and the five rows between.
#defineLUCKY_WHEELS_MIDDLE_LINE 3
#defineLUCKY_WHEELS_BET_MAX 4
#defineLUCKY_WHEELS_RESPINS 4The pulls of the lever after the first, before betting again.
#defineLUCKY_WHEELS_PLACED_SYMBOLS 8The places on each wheel given the symbols 0 to 4 and three wilds.
#defineLUCKY_WHEELS_WILD_SYMBOL LUCKY_WHEELS_MOONThe symbol that matches any other on a payline.
#defineLUCKY_WHEELS_FADE_TICKS 16The machine fades in and out over 16 ticks, a sixteenth of full brightness a tick; the win flashes the screen darker over as many.
#defineLUCKY_WHEELS_CYCLE_TICKS 16The win cycles the background through five palettes, 16 ticks each.
#defineLUCKY_WHEELS_CYCLE_PALETTES 5
#defineLUCKY_WHEELS_BURST_SPARKS 256The jackpot sparks: four bursts of 256 in turn, one every eight ticks.
#defineLUCKY_WHEELS_SPARK_COUNT (4 * LUCKY_WHEELS_BURST_SPARKS)
#defineLUCKY_WHEELS_SPARK_SHRINK_TICKS 12A spark's size steps down every 12 ticks of its life, from 2 or 3 to 1.
#defineLUCKY_WHEELS_REPEAT_DELAY 12A held direction moves the cursor once, waits 12 ticks, then moves it again with 4 ticks between each move.
#defineLUCKY_WHEELS_REPEAT_INTERVAL 4
#defineLUCKY_WHEELS_MACHINE_LIGHTS 14The machine's lights, its four corners first and then the lights along its frame.
#defineLUCKY_WHEELS_CORNER_LIGHTS 4
#defineLINE_STEP_ONE (1 << 8)A line's step along its shorter axis, in 256ths of a pixel.
#defineLUCKY_WHEELS_ALL_LOCKED_X BY_LANGUAGE(12, 11, 11, 6, 11, 10)The prompt windows (all locked, start, lock and spin a wheel, stop the slots, choose the slots to lock) and the ticket count's digits, placed and sized for each language's words.
#defineLUCKY_WHEELS_ALL_LOCKED_WIDTH BY_LANGUAGE(18, 19, 19, 24, 19, 20)
#defineLUCKY_WHEELS_START_X BY_LANGUAGE(18, 16, 16, 22, 16, 21)
#defineLUCKY_WHEELS_START_WIDTH BY_LANGUAGE(12, 14, 14, 8, 14, 9)
#defineLUCKY_WHEELS_LOCK_X 18
#defineLUCKY_WHEELS_LOCK_WIDTH 12
#defineLUCKY_WHEELS_SPIN_X 21
#defineLUCKY_WHEELS_SPIN_WIDTH 9
#defineLUCKY_WHEELS_TICKET_DIGITS
#defineLUCKY_WHEELS_TICKET_X
#defineLUCKY_WHEELS_STOP_X BY_LANGUAGE(23, 18, 18, 21, 18, 18)
#defineLUCKY_WHEELS_STOP_WIDTH BY_LANGUAGE(7, 12, 12, 9, 12, 12)
#defineLUCKY_WHEELS_CHOOSE_LOCKED_X JAPANESE_OR(7, 3)
#defineLUCKY_WHEELS_CHOOSE_LOCKED_WIDTH JAPANESE_OR(16, 24)
#defineLUCKY_WHEELS_TITLE_FIRST_TURNED (LANGUAGE == LANGUAGE_SPANISH)The Spanish title's first letter is its last letter's tile turned over both ways, drawn 16 pixels left and 8 down.
#defineLUCKY_WHEELS_TITLE_TILES JAPANESE_OR(896, 880)The first tile of the title's letters: the Japanese letters take fewer tiles, so they start later and end at the same place.
#defineLUCKY_WHEELS_BOUNCED_LETTERS 8The title letters fdLuckyWheelsFinishTick bounces in every edition: the Japanese title's eight.
#defineLUCKY_WHEELS_TITLE_X SPANISH_OR(8, 24)The left edge of the title's first letter: the Spanish title has nine letters and starts further left.
#defineLUCKY_WHEELS_SPARKS ((PARTICLE *)RamMapMetatileBuffer)The sparks of the jackpot, kept in the map metatile buffer.
#defineLUCKY_WHEELS_WHEELS_TOP 23The screen lines of the wheels' top and bottom edges, and the lines from each that fdLuckyWheelsSetUpBetting shades.
#defineLUCKY_WHEELS_WHEELS_BOTTOM 110
#defineLUCKY_WHEELS_SHADE_LINES 40
#defineLUCKY_WHEELS_SHADE_LEVEL 6The darkening at the wheels' very edges, in BLDY's sixteenths.
#defineLUCKY_WHEELS_HELP_WINDOW_X JAPANESE_OR(6, 2)The help window is narrower in Japanese, and one row shorter there when it shows only the controls.
#defineLUCKY_WHEELS_HELP_WINDOW_WIDTH JAPANESE_OR(18, 26)
#defineLUCKY_WHEELS_CONTROLS_WINDOW_HEIGHT JAPANESE_OR(3, 4)
#defineLUCKY_WHEELS_JACKPOT_COPY
#defineLUCKY_WHEELS_JACKPOT_TILES
#definePACK_WINDOW_SIZE 1024The LZ packer: a window of PACK_WINDOW_SIZE bytes with a hash chain for each byte value, PACK_LOOKAHEAD bytes read ahead of the one being packed and the PACK_HISTORY behind it kept in the chains, and matches of up to PACK_MATCH_MAX bytes at most PACK_DISTANCE_MAX back.
#definePACK_WINDOW_MASK (PACK_WINDOW_SIZE - 1)
#definePACK_BYTE_VALUES 256
#definePACK_LOOKAHEAD 672
#definePACK_HISTORY 60
#definePACK_DISTANCE_MAX 63
#definePACK_SHORT_MATCH_MAX 16A match of up to 16 bytes takes two bytes; a longer one three, its length less 17 in the third, up to PACK_MATCH_MAX.
#definePACK_MATCH_MAX 272
#definePACK_FIRST_FLAG (1 << 7)A group's flag byte is read from its top bit down, a bit an item.
#definePACK_CODE_DISTANCE_HIGH (~0xfff)A match's code, a halfword written high byte first: its distance's bits from 8 up in bits 12 to 15, its length less one in bits 8 to 11 for a short match, and its distance's low byte.
#definePACK_CODE_LENGTH 0xf00
#definePACK_CODE_DISTANCE_LOW 0xff

Enumerations

NameDescription
enumLUCKY_WHEELS_SYMBOL { LUCKY_WHEELS_SHIRT, LUCKY_WHEELS_HEART, LUCKY_WHEELS_BOOT, L … }The wheels' symbols, in icons.png's order.
enumLUCKY_WHEELS_PRIZE { LUCKY_WHEELS_PRIZE_UNDERSHIRT, LUCKY_WHEELS_PRIZE_BOOTS, LUC … }What a line of each symbol wins, as the prize sign reads it: "Shirts win undershirts, Rings win rings, Boots win boots, Stars and Hearts win you items..." and Moons "can win you anything." Contigo then gives one of three items of the kind.
enumLUCKY_WHEELS_STAGE { LUCKY_WHEELS_BETTING, LUCKY_WHEELS_SPINNING, LUCKY_WHEELS_WO … }Lucky Wheels' stages (LUCKY_WHEELS_STATE.stage).
enumLUCKY_WHEELS_PROMPT { LUCKY_WHEELS_PROMPT_NONE, LUCKY_WHEELS_PROMPT_ALL_LOCKED_FIR … }The prompt window LUCKY_WHEELS_STATE.prompt says is open, so that it is drawn once rather than every tick.

Functions

NameDescription
voidfdLuckyWheelsRun (void)Lucky Wheels: loads its backgrounds, sprites and palettes, fills each of the five wheels with 21 random symbols (eight places on each given symbols 0 to 4 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.
Sint32fdLuckyWheelsStart (void)Plays Lucky Wheels: blanks the screen, seeds the random numbers with the play time and runs the game.
Sint32fdLuckyWheelsScaleRGB555 (Uint16 *src, Uint16 *dest, FIXED scale, Sint32 count)Writes count RGB555 colours from src to dest scaled by scale (16.16, toFIXED(1) keeps them).
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 state (betting, spinning and stopping the wheels, scoring the paylines, choosing wheels to lock, showing a win) and builds all 128 sprites: the cursor, the title letters of a win, the frame, the lock lamps, the spin counter, the paylines, the wheel symbols, the lever and the bottom bar.
voidfdLuckyWheelsFinishTick (void)The end of Lucky Wheels' tick: while a win shows it bounces the title letters, then restarts the HBlank DMA of the scanline offsets into BLDY and copies the tick's sprites to OAM.
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.
voidfdLZPackResetSlotBuckets (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.
voidfdLZPackConsumeSlotBytes (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.
static __inline__ voidfdLZPackFindWindowMatch (Sint32 start)Finds the longest earlier match (up to PACK_MATCH_MAX bytes, at most PACK_DISTANCE_MAX back) for the bytes at window position start; matchLen stays 1 for none.
Sint32fdLZPackPackStream (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 charMsgSlotsBet []"Bet"
extern charMsgSlotsStop []"{button_icon:4}:Stop slots"
extern charMsgSlotsChooseHeld []"When you've chosen which slots"
extern charMsgSlotsPullLever []"to lock, pull the lever!"
extern charMsgSlotsHold []"{button_icon:1}:Stop"
extern charMsgSlotsRelease []"{button_icon:1}:Spin"
extern charMsgSlotsStart []"{button_icon:1}:Start machine"
extern charMsgSlotsAllHeld []"If you lock all the slots,"
extern charMsgSlotsCannotPull []"you can't pull the lever!"
extern charMsgSlotsChangeBet []"Press up or down to change value"
extern charMsgSlotsControls []"{button_icon:1}:Start machine {button_icon:2}:Quit"
const Uint16LuckyWheelsSparkPictureOffsets []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.
const Uint8LuckyWheelsSymbolPrizes []The prize of each wheel symbol (LUCKY_WHEELS_PRIZE), kept in REEL_SAVE.wonPrizes for each winning line.
const Uint8LuckyWheelsTitleLetterTiles [LUCKY_WHEELS_TITLE_LETTERS]The tile of each title letter.
const Uint8LuckyWheelsMachineSpriteX [LUCKY_WHEELS_MACHINE_LIGHTS]The positions of the machine's lights, in screen pixels: its four corners first, then the lights along its frame.
const Uint8LuckyWheelsMachineSpriteY [LUCKY_WHEELS_MACHINE_LIGHTS]
const Uint8LuckyWheelsTitleLetterWidths [LUCKY_WHEELS_TITLE_LETTERS]The advance of each title letter.

Description

Lucky Wheels, Contigo's game of chance: the player trades game tickets for lines, pulls the lever up to five times and locks wheels to line up matching icons. It draws its own wheels and lines, and keeps an unused LZ packer.

Macros in detail

LUCKY_WHEELS_CANVAS_SIZE

#define LUCKY_WHEELS_CANVAS_SIZE (256 * 128)

The paylines' canvas: 256 x 128 pixels of 8-bit colour, shown on BG2 from its tile 212 in the rows of its map from LUCKY_WHEELS_CANVAS_TOP_ROW to LUCKY_WHEELS_CANVAS_BOTTOM_ROW; the rows above and below show a clear tile, in the part of BG1's map below the screen that fdLuckyWheelsRun clears.

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsTransferCanvas().

Definition at line 34 of file lucky_wheels.c.

LUCKY_WHEELS_CANVAS_FIRST_TILE

#define LUCKY_WHEELS_CANVAS_FIRST_TILE 212

Referenced by fdLuckyWheelsRun().

Definition at line 35 of file lucky_wheels.c.

LUCKY_WHEELS_CANVAS_TOP_ROW

#define LUCKY_WHEELS_CANVAS_TOP_ROW 2

Referenced by fdLuckyWheelsRun().

Definition at line 36 of file lucky_wheels.c.

LUCKY_WHEELS_CANVAS_BOTTOM_ROW

#define LUCKY_WHEELS_CANVAS_BOTTOM_ROW 16

Referenced by fdLuckyWheelsRun().

Definition at line 37 of file lucky_wheels.c.

LUCKY_WHEELS_CANVAS_TILES

#define LUCKY_WHEELS_CANVAS_TILES

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsTransferCanvas().

Definition at line 38 of file lucky_wheels.c.

LUCKY_WHEELS_CANVAS_CLEAR_TILE

#define LUCKY_WHEELS_CANVAS_CLEAR_TILE 191

Referenced by fdLuckyWheelsRun().

Definition at line 40 of file lucky_wheels.c.

LUCKY_WHEELS_SPARK_COLORS

#define LUCKY_WHEELS_SPARK_COLORS 64

The canvas's first 64 colours, its sparks', from a Djinn sprite sheet's palette and cycled through others while a win shows.

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsStepSparkColors().

Definition at line 43 of file lucky_wheels.c.

LUCKY_WHEELS_LINE_COLOR

#define LUCKY_WHEELS_LINE_COLOR 64

The paylines' green on the canvas, colour 64, and its lighter centre.

Referenced by fdLuckyWheelsRun().

Definition at line 45 of file lucky_wheels.c.

LUCKY_WHEELS_LINE_LIGHT

#define LUCKY_WHEELS_LINE_LIGHT (LUCKY_WHEELS_LINE_COLOR + 1)

Referenced by fdLuckyWheelsRun().

Definition at line 46 of file lucky_wheels.c.

LUCKY_WHEELS_MACHINE_PALETTE

#define LUCKY_WHEELS_MACHINE_PALETTE 10

The machine's picture: its 16 colours in BG palette 10, and its tiles from tile 424 of BG1's characters, all but those of the opening the wheels show through, which BG1's map fills with a clear tile.

Referenced by fdLuckyWheelsDarkenStep() and fdLuckyWheelsRun().

Definition at line 50 of file lucky_wheels.c.

LUCKY_WHEELS_MACHINE_TILE

#define LUCKY_WHEELS_MACHINE_TILE 424

Referenced by fdLuckyWheelsRun().

Definition at line 51 of file lucky_wheels.c.

LUCKY_WHEELS_CLEAR_TILE

#define LUCKY_WHEELS_CLEAR_TILE 422

Referenced by fdLuckyWheelsRun().

Definition at line 52 of file lucky_wheels.c.

LUCKY_WHEELS_IN_OPENING

#define LUCKY_WHEELS_IN_OPENING(column, row)

The machine's opening, in BG1's map tiles: columns 5 to 24 and rows 3 to 13.

Referenced by fdLuckyWheelsRun().

Definition at line 54 of file lucky_wheels.c.

LUCKY_WHEELS_ICON_COLORS

#define LUCKY_WHEELS_ICON_COLORS 240

The icons' picture begins with its 240 colours, the sprites' first 240.

Referenced by fdLuckyWheelsDarkenStep() and fdLuckyWheelsRun().

Definition at line 57 of file lucky_wheels.c.

LUCKY_WHEELS_JACKPOT_PALETTE

#define LUCKY_WHEELS_JACKPOT_PALETTE 15

The jackpot banner's and the title letters' sprite palette.

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsUpdate().

Definition at line 59 of file lucky_wheels.c.

LUCKY_WHEELS_REEL_COUNT

#define LUCKY_WHEELS_REEL_COUNT 5

The machine's five wheels; the cursor's next place, past the last wheel, is the lever.

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsUpdate().

Definition at line 62 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER

#define LUCKY_WHEELS_LEVER LUCKY_WHEELS_REEL_COUNT

Referenced by fdLuckyWheelsUpdate().

Definition at line 63 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_PULL_TICKS

#define LUCKY_WHEELS_LEVER_PULL_TICKS 48

Pulling the lever: 48 ticks down and back up, then 8 settling; only then can the wheels be stopped.

Referenced by fdLuckyWheelsUpdate().

Definition at line 66 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_SETTLE_TICKS

#define LUCKY_WHEELS_LEVER_SETTLE_TICKS 8

Definition at line 67 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_TICKS

#define LUCKY_WHEELS_LEVER_TICKS

Referenced by fdLuckyWheelsUpdate().

Definition at line 68 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_X

#define LUCKY_WHEELS_LEVER_X 208

The lever sprite's place at rest, in screen pixels, and how far it is pulled down.

Referenced by fdLuckyWheelsUpdate().

Definition at line 72 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_Y

#define LUCKY_WHEELS_LEVER_Y 40

Referenced by fdLuckyWheelsUpdate().

Definition at line 73 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_PULL

#define LUCKY_WHEELS_LEVER_PULL 64

Referenced by fdLuckyWheelsUpdate().

Definition at line 74 of file lucky_wheels.c.

LUCKY_WHEELS_AUTO_STOP_TICKS

#define LUCKY_WHEELS_AUTO_STOP_TICKS 32

Left alone, the spinning wheels stop one every 32 ticks; R stops one at once.

Referenced by fdLuckyWheelsUpdate().

Definition at line 76 of file lucky_wheels.c.

LUCKY_WHEELS_WIN_PAUSE

#define LUCKY_WHEELS_WIN_PAUSE 60

The pause after a winning spin before the win is shown, and after the last spin loses before the game ends.

Referenced by fdLuckyWheelsUpdate().

Definition at line 79 of file lucky_wheels.c.

LUCKY_WHEELS_LOSS_PAUSE

#define LUCKY_WHEELS_LOSS_PAUSE 45

Referenced by fdLuckyWheelsUpdate().

Definition at line 80 of file lucky_wheels.c.

LUCKY_WHEELS_STOP_WINDOW_TICK

#define LUCKY_WHEELS_STOP_WINDOW_TICK 4

The stop prompt's window opens this many ticks into a spin, and its sound plays at LUCKY_WHEELS_STOP_PROMPT_TICK.

Referenced by fdLuckyWheelsUpdate().

Definition at line 83 of file lucky_wheels.c.

LUCKY_WHEELS_STOP_PROMPT_TICK

#define LUCKY_WHEELS_STOP_PROMPT_TICK 16

Referenced by fdLuckyWheelsUpdate().

Definition at line 84 of file lucky_wheels.c.

LUCKY_WHEELS_LAMP_TILES

#define LUCKY_WHEELS_LAMP_TILES 96

Where each picture of icons.png starts in sprite tiles, in OAM's 32-byte steps (a 256-colour tile is two): the sprite sheet is 32 pixels wide, so a picture starts at the tile numbered as its row. The six symbols are 16 apart from 0. A wheel's lamp, not locked.

Referenced by fdLuckyWheelsUpdate().

Definition at line 89 of file lucky_wheels.c.

LUCKY_WHEELS_LOCKED_LAMP_TILES

#define LUCKY_WHEELS_LOCKED_LAMP_TILES 128

A locked wheel's lamp.

Referenced by fdLuckyWheelsUpdate().

Definition at line 91 of file lucky_wheels.c.

LUCKY_WHEELS_CORNER_LIGHT_TILES

#define LUCKY_WHEELS_CORNER_LIGHT_TILES 224

Referenced by fdLuckyWheelsUpdate().

Definition at line 92 of file lucky_wheels.c.

LUCKY_WHEELS_FRAME_LIGHT_TILES

#define LUCKY_WHEELS_FRAME_LIGHT_TILES 232

Referenced by fdLuckyWheelsUpdate().

Definition at line 93 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_TILES

#define LUCKY_WHEELS_LEVER_TILES 256

Referenced by fdLuckyWheelsUpdate().

Definition at line 94 of file lucky_wheels.c.

LUCKY_WHEELS_LINE_TILES

#define LUCKY_WHEELS_LINE_TILES 272

A payline's gem, not bet on.

Referenced by fdLuckyWheelsUpdate().

Definition at line 96 of file lucky_wheels.c.

LUCKY_WHEELS_LIT_LINE_TILES

#define LUCKY_WHEELS_LIT_LINE_TILES 464

A payline's gem, bet on.

Referenced by fdLuckyWheelsUpdate().

Definition at line 98 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_SLOT_TILES

#define LUCKY_WHEELS_LEVER_SLOT_TILES 320

The slot the lever runs in, drawn in eight pieces 16 pixels tall down beside the wheels from (LUCKY_WHEELS_LEVER_SLOT_X, LUCKY_WHEELS_LEVER_SLOT_Y).

Referenced by fdLuckyWheelsUpdate().

Definition at line 101 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_SLOT_PIECES

#define LUCKY_WHEELS_LEVER_SLOT_PIECES 8

Referenced by fdLuckyWheelsUpdate().

Definition at line 102 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_SLOT_X

#define LUCKY_WHEELS_LEVER_SLOT_X 206

Referenced by fdLuckyWheelsUpdate().

Definition at line 103 of file lucky_wheels.c.

LUCKY_WHEELS_LEVER_SLOT_Y

#define LUCKY_WHEELS_LEVER_SLOT_Y 12

Referenced by fdLuckyWheelsUpdate().

Definition at line 104 of file lucky_wheels.c.

LUCKY_WHEELS_HAND_TILES

#define LUCKY_WHEELS_HAND_TILES 496

The cursor's hand.

Referenced by fdLuckyWheelsUpdate().

Definition at line 106 of file lucky_wheels.c.

LUCKY_WHEELS_PULL_TILES

#define LUCKY_WHEELS_PULL_TILES 528

A pull's number, the current one large.

Referenced by fdLuckyWheelsUpdate().

Definition at line 108 of file lucky_wheels.c.

LUCKY_WHEELS_ARROW_TILES

#define LUCKY_WHEELS_ARROW_TILES 688

The cursor's blinking arrows.

Referenced by fdLuckyWheelsUpdate().

Definition at line 110 of file lucky_wheels.c.

LUCKY_WHEELS_REEL_SYMBOLS

#define LUCKY_WHEELS_REEL_SYMBOLS 21

The symbols round a wheel, each 16 pixels tall: a wheel turns once in 336 pixels, 8 a tick, and stops only with a symbol centred on a line.

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsUpdate().

Definition at line 113 of file lucky_wheels.c.

LUCKY_WHEELS_SYMBOL_HEIGHT

#define LUCKY_WHEELS_SYMBOL_HEIGHT 16

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsUpdate().

Definition at line 114 of file lucky_wheels.c.

LUCKY_WHEELS_REEL_TURN

#define LUCKY_WHEELS_REEL_TURN

Referenced by fdLuckyWheelsUpdate().

Definition at line 115 of file lucky_wheels.c.

LUCKY_WHEELS_SPIN_SPEED

#define LUCKY_WHEELS_SPIN_SPEED 8

Referenced by fdLuckyWheelsUpdate().

Definition at line 117 of file lucky_wheels.c.

LUCKY_WHEELS_PAYLINES

#define LUCKY_WHEELS_PAYLINES 7

The seven paylines: the two diagonals (0 and 6) and the five rows between.

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsUpdate().

Definition at line 119 of file lucky_wheels.c.

LUCKY_WHEELS_MIDDLE_LINE

#define LUCKY_WHEELS_MIDDLE_LINE 3

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsUpdate().

Definition at line 120 of file lucky_wheels.c.

LUCKY_WHEELS_BET_MAX

#define LUCKY_WHEELS_BET_MAX 4

Referenced by fdLuckyWheelsUpdate().

Definition at line 121 of file lucky_wheels.c.

LUCKY_WHEELS_RESPINS

#define LUCKY_WHEELS_RESPINS 4

The pulls of the lever after the first, before betting again.

Referenced by fdLuckyWheelsUpdate().

Definition at line 123 of file lucky_wheels.c.

LUCKY_WHEELS_PLACED_SYMBOLS

#define LUCKY_WHEELS_PLACED_SYMBOLS 8

The places on each wheel given the symbols 0 to 4 and three wilds.

Referenced by fdLuckyWheelsRun().

Definition at line 125 of file lucky_wheels.c.

LUCKY_WHEELS_WILD_SYMBOL

#define LUCKY_WHEELS_WILD_SYMBOL LUCKY_WHEELS_MOON

The symbol that matches any other on a payline.

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsUpdate().

Definition at line 139 of file lucky_wheels.c.

LUCKY_WHEELS_FADE_TICKS

#define LUCKY_WHEELS_FADE_TICKS 16

The machine fades in and out over 16 ticks, a sixteenth of full brightness a tick; the win flashes the screen darker over as many.

Referenced by fdLuckyWheelsRun().

Definition at line 157 of file lucky_wheels.c.

LUCKY_WHEELS_CYCLE_TICKS

#define LUCKY_WHEELS_CYCLE_TICKS 16

The win cycles the background through five palettes, 16 ticks each.

Referenced by fdLuckyWheelsRun().

Definition at line 159 of file lucky_wheels.c.

LUCKY_WHEELS_CYCLE_PALETTES

#define LUCKY_WHEELS_CYCLE_PALETTES 5

Referenced by fdLuckyWheelsRun().

Definition at line 160 of file lucky_wheels.c.

LUCKY_WHEELS_BURST_SPARKS

#define LUCKY_WHEELS_BURST_SPARKS 256

The jackpot sparks: four bursts of 256 in turn, one every eight ticks.

Referenced by fdLuckyWheelsRun().

Definition at line 162 of file lucky_wheels.c.

LUCKY_WHEELS_SPARK_COUNT

#define LUCKY_WHEELS_SPARK_COUNT (4 * LUCKY_WHEELS_BURST_SPARKS)

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsSetUpBetting().

Definition at line 163 of file lucky_wheels.c.

LUCKY_WHEELS_SPARK_SHRINK_TICKS

#define LUCKY_WHEELS_SPARK_SHRINK_TICKS 12

A spark's size steps down every 12 ticks of its life, from 2 or 3 to 1.

Referenced by fdLuckyWheelsRun().

Definition at line 165 of file lucky_wheels.c.

LUCKY_WHEELS_REPEAT_DELAY

#define LUCKY_WHEELS_REPEAT_DELAY 12

A held direction moves the cursor once, waits 12 ticks, then moves it again with 4 ticks between each move.

Referenced by fdLuckyWheelsUpdate().

Definition at line 168 of file lucky_wheels.c.

LUCKY_WHEELS_REPEAT_INTERVAL

#define LUCKY_WHEELS_REPEAT_INTERVAL 4

Referenced by fdLuckyWheelsUpdate().

Definition at line 169 of file lucky_wheels.c.

LUCKY_WHEELS_MACHINE_LIGHTS

#define LUCKY_WHEELS_MACHINE_LIGHTS 14

The machine's lights, its four corners first and then the lights along its frame.

Referenced by fdLuckyWheelsUpdate(), LuckyWheelsMachineSpriteX and LuckyWheelsMachineSpriteY.

Definition at line 190 of file lucky_wheels.c.

LUCKY_WHEELS_CORNER_LIGHTS

#define LUCKY_WHEELS_CORNER_LIGHTS 4

Referenced by fdLuckyWheelsUpdate().

Definition at line 191 of file lucky_wheels.c.

LINE_STEP_ONE

#define LINE_STEP_ONE (1 << 8)

A line's step along its shorter axis, in 256ths of a pixel.

Referenced by fdLuckyWheelsDrawCanvasLine().

Definition at line 427 of file lucky_wheels.c.

LUCKY_WHEELS_ALL_LOCKED_X

#define LUCKY_WHEELS_ALL_LOCKED_X BY_LANGUAGE(12, 11, 11, 6, 11, 10)

The prompt windows (all locked, start, lock and spin a wheel, stop the slots, choose the slots to lock) and the ticket count's digits, placed and sized for each language's words. Lock reads "Stop", and Japanese shows it and Spin in one window.

Referenced by fdLuckyWheelsUpdate().

Definition at line 524 of file lucky_wheels.c.

LUCKY_WHEELS_ALL_LOCKED_WIDTH

#define LUCKY_WHEELS_ALL_LOCKED_WIDTH BY_LANGUAGE(18, 19, 19, 24, 19, 20)

Referenced by fdLuckyWheelsUpdate().

Definition at line 525 of file lucky_wheels.c.

LUCKY_WHEELS_START_X

#define LUCKY_WHEELS_START_X BY_LANGUAGE(18, 16, 16, 22, 16, 21)

Referenced by fdLuckyWheelsUpdate().

Definition at line 526 of file lucky_wheels.c.

LUCKY_WHEELS_START_WIDTH

#define LUCKY_WHEELS_START_WIDTH BY_LANGUAGE(12, 14, 14, 8, 14, 9)

Referenced by fdLuckyWheelsUpdate().

Definition at line 527 of file lucky_wheels.c.

LUCKY_WHEELS_LOCK_X

#define LUCKY_WHEELS_LOCK_X 18

#define LUCKY_WHEELS_LOCK_X 22

#define LUCKY_WHEELS_LOCK_X 21

#define LUCKY_WHEELS_LOCK_X 23

Referenced by fdLuckyWheelsUpdate().

Definition at lines 529, 532, 537, 542 and 547 of file lucky_wheels.c.

LUCKY_WHEELS_LOCK_WIDTH

#define LUCKY_WHEELS_LOCK_WIDTH 12

#define LUCKY_WHEELS_LOCK_WIDTH 8

#define LUCKY_WHEELS_LOCK_WIDTH 9

#define LUCKY_WHEELS_LOCK_WIDTH 7

Referenced by fdLuckyWheelsUpdate().

Definition at lines 530, 533, 538, 543 and 548 of file lucky_wheels.c.

LUCKY_WHEELS_SPIN_X

#define LUCKY_WHEELS_SPIN_X 21

#define LUCKY_WHEELS_SPIN_X 22

#define LUCKY_WHEELS_SPIN_X 23

Referenced by fdLuckyWheelsUpdate().

Definition at lines 534, 539, 544 and 549 of file lucky_wheels.c.

LUCKY_WHEELS_SPIN_WIDTH

#define LUCKY_WHEELS_SPIN_WIDTH 9

#define LUCKY_WHEELS_SPIN_WIDTH 8

#define LUCKY_WHEELS_SPIN_WIDTH 7

Referenced by fdLuckyWheelsUpdate().

Definition at lines 535, 540, 545 and 550 of file lucky_wheels.c.

LUCKY_WHEELS_TICKET_DIGITS

#define LUCKY_WHEELS_TICKET_DIGITS

Referenced by fdLuckyWheelsUpdate().

Definition at line 552 of file lucky_wheels.c.

LUCKY_WHEELS_TICKET_X

#define LUCKY_WHEELS_TICKET_X

Referenced by fdLuckyWheelsUpdate().

Definition at line 554 of file lucky_wheels.c.

LUCKY_WHEELS_STOP_X

#define LUCKY_WHEELS_STOP_X BY_LANGUAGE(23, 18, 18, 21, 18, 18)

Referenced by fdLuckyWheelsUpdate().

Definition at line 556 of file lucky_wheels.c.

LUCKY_WHEELS_STOP_WIDTH

#define LUCKY_WHEELS_STOP_WIDTH BY_LANGUAGE(7, 12, 12, 9, 12, 12)

Referenced by fdLuckyWheelsUpdate().

Definition at line 557 of file lucky_wheels.c.

LUCKY_WHEELS_CHOOSE_LOCKED_X

#define LUCKY_WHEELS_CHOOSE_LOCKED_X JAPANESE_OR(7, 3)

Referenced by fdLuckyWheelsUpdate().

Definition at line 558 of file lucky_wheels.c.

LUCKY_WHEELS_CHOOSE_LOCKED_WIDTH

#define LUCKY_WHEELS_CHOOSE_LOCKED_WIDTH JAPANESE_OR(16, 24)

Referenced by fdLuckyWheelsUpdate().

Definition at line 559 of file lucky_wheels.c.

LUCKY_WHEELS_TITLE_FIRST_TURNED

#define LUCKY_WHEELS_TITLE_FIRST_TURNED (LANGUAGE == LANGUAGE_SPANISH)

The Spanish title's first letter is its last letter's tile turned over both ways, drawn 16 pixels left and 8 down.

Referenced by fdLuckyWheelsUpdate().

Definition at line 562 of file lucky_wheels.c.

LUCKY_WHEELS_TITLE_TILES

#define LUCKY_WHEELS_TITLE_TILES JAPANESE_OR(896, 880)

The first tile of the title's letters: the Japanese letters take fewer tiles, so they start later and end at the same place.

Referenced by fdLuckyWheelsUpdate().

Definition at line 565 of file lucky_wheels.c.

LUCKY_WHEELS_BOUNCED_LETTERS

#define LUCKY_WHEELS_BOUNCED_LETTERS 8

The title letters fdLuckyWheelsFinishTick bounces in every edition: the Japanese title's eight. The other editions also bounce every letter as fdLuckyWheelsUpdate draws it, so there the first eight move twice a tick and the Spanish title's ninth once: its last letter falls in and bounces at half the others' pace, each fall taking twice as many ticks, and drops again last.

Referenced by fdLuckyWheelsFinishTick().

Definition at line 1414 of file lucky_wheels.c.

LUCKY_WHEELS_TITLE_X

#define LUCKY_WHEELS_TITLE_X SPANISH_OR(8, 24)

The left edge of the title's first letter: the Spanish title has nine letters and starts further left.

Referenced by fdLuckyWheelsSetUpBetting().

Definition at line 1468 of file lucky_wheels.c.

LUCKY_WHEELS_SPARKS

#define LUCKY_WHEELS_SPARKS ((PARTICLE *)RamMapMetatileBuffer)

The sparks of the jackpot, kept in the map metatile buffer.

Referenced by fdLuckyWheelsRun() and fdLuckyWheelsSetUpBetting().

Definition at line 1471 of file lucky_wheels.c.

LUCKY_WHEELS_WHEELS_TOP

#define LUCKY_WHEELS_WHEELS_TOP 23

The screen lines of the wheels' top and bottom edges, and the lines from each that fdLuckyWheelsSetUpBetting shades.

Referenced by fdLuckyWheelsSetUpBetting().

Definition at line 1475 of file lucky_wheels.c.

LUCKY_WHEELS_WHEELS_BOTTOM

#define LUCKY_WHEELS_WHEELS_BOTTOM 110

Referenced by fdLuckyWheelsSetUpBetting().

Definition at line 1476 of file lucky_wheels.c.

LUCKY_WHEELS_SHADE_LINES

#define LUCKY_WHEELS_SHADE_LINES 40

Referenced by fdLuckyWheelsSetUpBetting().

Definition at line 1477 of file lucky_wheels.c.

LUCKY_WHEELS_SHADE_LEVEL

#define LUCKY_WHEELS_SHADE_LEVEL 6

The darkening at the wheels' very edges, in BLDY's sixteenths.

Referenced by fdLuckyWheelsSetUpBetting().

Definition at line 1479 of file lucky_wheels.c.

LUCKY_WHEELS_HELP_WINDOW_X

#define LUCKY_WHEELS_HELP_WINDOW_X JAPANESE_OR(6, 2)

The help window is narrower in Japanese, and one row shorter there when it shows only the controls. The jackpot banner's tiles are the title's.

Referenced by fdLuckyWheelsRun().

Definition at line 1542 of file lucky_wheels.c.

LUCKY_WHEELS_HELP_WINDOW_WIDTH

#define LUCKY_WHEELS_HELP_WINDOW_WIDTH JAPANESE_OR(18, 26)

Referenced by fdLuckyWheelsRun().

Definition at line 1543 of file lucky_wheels.c.

LUCKY_WHEELS_CONTROLS_WINDOW_HEIGHT

#define LUCKY_WHEELS_CONTROLS_WINDOW_HEIGHT JAPANESE_OR(3, 4)

Referenced by fdLuckyWheelsRun().

Definition at line 1544 of file lucky_wheels.c.

LUCKY_WHEELS_JACKPOT_COPY

#define LUCKY_WHEELS_JACKPOT_COPY

Referenced by fdLuckyWheelsRun().

Definition at line 1545 of file lucky_wheels.c.

LUCKY_WHEELS_JACKPOT_TILES

#define LUCKY_WHEELS_JACKPOT_TILES

Referenced by fdLuckyWheelsRun().

Definition at line 1547 of file lucky_wheels.c.

PACK_WINDOW_SIZE

#define PACK_WINDOW_SIZE 1024

The LZ packer: a window of PACK_WINDOW_SIZE bytes with a hash chain for each byte value, PACK_LOOKAHEAD bytes read ahead of the one being packed and the PACK_HISTORY behind it kept in the chains, and matches of up to PACK_MATCH_MAX bytes at most PACK_DISTANCE_MAX back.

Referenced by fdLZPackConsumeSlotBytes() and fdLZPackResetSlotBuckets().

Definition at line 2027 of file lucky_wheels.c.

PACK_WINDOW_MASK

#define PACK_WINDOW_MASK (PACK_WINDOW_SIZE - 1)

Referenced by fdLZPackConsumeSlotBytes(), fdLZPackFindWindowMatch() and fdLZPackPackStream().

Definition at line 2028 of file lucky_wheels.c.

PACK_BYTE_VALUES

#define PACK_BYTE_VALUES 256

Referenced by fdLZPackResetSlotBuckets().

Definition at line 2029 of file lucky_wheels.c.

PACK_LOOKAHEAD

#define PACK_LOOKAHEAD 672

Referenced by fdLZPackConsumeSlotBytes() and fdLZPackPackStream().

Definition at line 2030 of file lucky_wheels.c.

PACK_HISTORY

#define PACK_HISTORY 60

Referenced by fdLZPackConsumeSlotBytes().

Definition at line 2031 of file lucky_wheels.c.

PACK_DISTANCE_MAX

#define PACK_DISTANCE_MAX 63

Referenced by fdLZPackFindWindowMatch().

Definition at line 2032 of file lucky_wheels.c.

PACK_SHORT_MATCH_MAX

#define PACK_SHORT_MATCH_MAX 16

A match of up to 16 bytes takes two bytes; a longer one three, its length less 17 in the third, up to PACK_MATCH_MAX.

Referenced by fdLZPackPackStream().

Definition at line 2035 of file lucky_wheels.c.

PACK_MATCH_MAX

#define PACK_MATCH_MAX 272

Referenced by fdLZPackFindWindowMatch().

Definition at line 2036 of file lucky_wheels.c.

PACK_FIRST_FLAG

#define PACK_FIRST_FLAG (1 << 7)

A group's flag byte is read from its top bit down, a bit an item.

Referenced by fdLZPackPackStream().

Definition at line 2038 of file lucky_wheels.c.

PACK_CODE_DISTANCE_HIGH

#define PACK_CODE_DISTANCE_HIGH (~0xfff)

A match's code, a halfword written high byte first: its distance's bits from 8 up in bits 12 to 15, its length less one in bits 8 to 11 for a short match, and its distance's low byte.

Referenced by fdLZPackPackStream().

Definition at line 2042 of file lucky_wheels.c.

PACK_CODE_LENGTH

#define PACK_CODE_LENGTH 0xf00

Referenced by fdLZPackPackStream().

Definition at line 2043 of file lucky_wheels.c.

PACK_CODE_DISTANCE_LOW

#define PACK_CODE_DISTANCE_LOW 0xff

Referenced by fdLZPackPackStream().

Definition at line 2044 of file lucky_wheels.c.

Enumerations in detail

LUCKY_WHEELS_SYMBOL

enum LUCKY_WHEELS_SYMBOL

The wheels' symbols, in icons.png's order.

EnumeratorValueDescription
LUCKY_WHEELS_SHIRT
LUCKY_WHEELS_HEART
LUCKY_WHEELS_BOOT
LUCKY_WHEELS_STAR
LUCKY_WHEELS_RING
LUCKY_WHEELS_MOON

Definition at line 128 of file lucky_wheels.c.

LUCKY_WHEELS_PRIZE

enum LUCKY_WHEELS_PRIZE

What a line of each symbol wins, as the prize sign reads it: "Shirts win undershirts, Rings win rings, Boots win boots, Stars and Hearts win you items..." and Moons "can win you anything." Contigo then 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

Definition at line 145 of file lucky_wheels.c.

LUCKY_WHEELS_STAGE

enum LUCKY_WHEELS_STAGE

Lucky Wheels' stages (LUCKY_WHEELS_STATE.stage).

EnumeratorValueDescription
LUCKY_WHEELS_BETTING0Up and Down change the bet, A spins, B leaves
LUCKY_WHEELS_SPINNING1the wheels spin until R or time stops each
LUCKY_WHEELS_WON2a payline won: a pause
LUCKY_WHEELS_SHOWING_WIN3the win is shown until A
LUCKY_WHEELS_CHOOSING_LOCKS5choose wheels to lock, or pull the lever
LUCKY_WHEELS_DONE10the game ends
LUCKY_WHEELS_NO_WIN11no payline won: A to choose locks
LUCKY_WHEELS_OUT_OF_SPINS20the last pull lost: a pause, then the end

Definition at line 172 of file lucky_wheels.c.

LUCKY_WHEELS_PROMPT

enum LUCKY_WHEELS_PROMPT

The prompt window LUCKY_WHEELS_STATE.prompt says is open, so that it is drawn once rather than every tick. The all-locked prompt draws its two lines on two ticks; after a losing spin the first value says the "pull the lever" line is drawn.

EnumeratorValueDescription
LUCKY_WHEELS_PROMPT_NONE
LUCKY_WHEELS_PROMPT_ALL_LOCKED_FIRST_LINE
LUCKY_WHEELS_PROMPT_PULL_LEVERLUCKY_WHEELS_PROMPT_ALL_LOCKED_FIRST_LINE
LUCKY_WHEELS_PROMPT_ALL_LOCKED
LUCKY_WHEELS_PROMPT_START
LUCKY_WHEELS_PROMPT_LOCK
LUCKY_WHEELS_PROMPT_SPIN

Definition at line 603 of file lucky_wheels.c.

Functions in detail

fdLuckyWheelsRun

void fdLuckyWheelsRun(void)

Lucky Wheels: loads its backgrounds, sprites and palettes, fills each of the five wheels with 21 random symbols (eight places on each given symbols 0 to 4 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. Then fades out and frees its memory.

References BgScrollWork, btEffectBuildBlitterStub(), fdLuckyWheelsDarkenStep(), fdLuckyWheelsDrawCanvasLine(), fdLuckyWheelsFinishTick(), fdLuckyWheelsScaleRGB555(), fdLuckyWheelsSetUpBetting(), fdLuckyWheelsStepSparkColors(), fdLuckyWheelsTransferCanvas(), fdLuckyWheelsUpdate(), gmPartyInventoryCountItemStub(), LuckyWheelsSparkPictureOffsets, mnTextDrawMessageAsTilesStub(), mnWindowCreateStub(), mnWindowSystemInitFieldStub(), MsgSlotsChangeBet, MsgSlotsControls, OamCopyEnabled, PartyDjinnRecovery, Sint32, syCloseEvent(), syCos(), syDecompressTaggedLZ(), syDMAXCopy(), syHeapSlotAllocate(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), syInitEvent(), syRandom(), syResourceGetTableEntry(), syResourceReservedNoOperation(), sySetEvent(), sySin(), sySynch() and syWordsClear().

Referenced by fdLuckyWheelsStart().

Definition at lines 240 and 1555 of file lucky_wheels.c.

fdLuckyWheelsStart

Sint32 fdLuckyWheelsStart(void)

Plays Lucky Wheels: blanks the screen, seeds the random numbers with the play time and runs the game. Returns 0.

References fdLuckyWheelsRun(), MainRoutineStateWork, RandWork, Sint32 and sySoundPlayStub().

Definition at line 244 of file lucky_wheels.c.

fdLuckyWheelsScaleRGB555

Sint32 fdLuckyWheelsScaleRGB555(Uint16 *src, Uint16 *dest, FIXED scale, Sint32 count)

Writes count RGB555 colours from src to dest scaled by scale (16.16, toFIXED(1) keeps them). Returns 0.

References Sint32.

Referenced by fdLuckyWheelsRun().

Definition at line 255 of file lucky_wheels.c.

fdLuckyWheelsTransferCanvas

void fdLuckyWheelsTransferCanvas(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.

References syColorBufferHalveNonzero(), syColorBufferScaleNonzeroThreeQuarters(), syDMAXCopy() and syWordsFill().

Referenced by fdLuckyWheelsRun().

Definition at line 296 of file lucky_wheels.c.

fdLuckyWheelsDarkenStep

void fdLuckyWheelsDarkenStep(void)

Darkens the screen one step: lowers each channel of the machine's 16 colours and of the icons' by 1.

References Sint32.

Referenced by fdLuckyWheelsRun().

Definition at line 340 of file lucky_wheels.c.

fdLuckyWheelsStepSparkColors

void fdLuckyWheelsStepSparkColors(Sint32 resource)

Moves the sparks' colours one step toward the palette of resource; the backdrop colour is not written back.

References Sint32, syDMAXCopy() and syResourceGetTableEntry().

Referenced by fdLuckyWheelsRun().

Definition at line 387 of file lucky_wheels.c.

fdLuckyWheelsDrawCanvasLine

void fdLuckyWheelsDrawCanvasLine( 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.

References Sint32.

Referenced by fdLuckyWheelsRun().

Definition at line 431 of file lucky_wheels.c.

fdLuckyWheelsUpdate

void fdLuckyWheelsUpdate(void)

Lucky Wheels' VBlank event: reads the keys, runs the game's state (betting, spinning and stopping the wheels, scoring the paylines, choosing wheels to lock, showing a win) and builds all 128 sprites: the cursor, the title letters of a win, the frame, the lock lamps, the spin counter, the paylines, the wheel symbols, the lever and the bottom bar.

References DebugPaused, gmPartyInventoryCountItemStub(), gmPartyInventoryRemoveStub(), LuckyWheelsMachineSpriteX, LuckyWheelsMachineSpriteY, LuckyWheelsSymbolPrizes, LuckyWheelsTitleLetterTiles, mnTextDrawMessageAsTilesStub(), mnTextDrawNumberInWindowStub(), mnWindowCloseStub(), mnWindowCreateStub(), MsgSlotsAllHeld, MsgSlotsBet, MsgSlotsCannotPull, MsgSlotsChooseHeld, MsgSlotsHold, MsgSlotsPullLever, MsgSlotsRelease, MsgSlotsStart, MsgSlotsStop, PartyDjinnRecovery, PerWork, Sint32, syRandom(), sySin() and sySoundPlayStub().

Referenced by fdLuckyWheelsRun().

Definition at line 619 of file lucky_wheels.c.

fdLuckyWheelsFinishTick

void fdLuckyWheelsFinishTick(void)

The end of Lucky Wheels' tick: while a win shows it bounces the title letters, then restarts the HBlank DMA of the scanline offsets into BLDY and copies the tick's sprites to OAM.

References Sint32 and syDMAXCopy().

Referenced by fdLuckyWheelsRun().

Definition at line 1419 of file lucky_wheels.c.

fdLuckyWheelsSetUpBetting

void fdLuckyWheelsSetUpBetting(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.

References LuckyWheelsTitleLetterWidths, mnTextDrawMessageAsTilesStub(), mnWindowCreateStub(), MsgSlotsBet, Sint32 and syCos().

Referenced by fdLuckyWheelsRun().

Definition at line 1483 of file lucky_wheels.c.

fdLZPackResetSlotBuckets

void fdLZPackResetSlotBuckets(void)

Empties the LZ packer's hash chains and numbers its window nodes.

References Sint32.

Referenced by fdLZPackPackStream().

Definition at line 2047 of file lucky_wheels.c.

fdLZPackInsertSlotNode

void fdLZPackInsertSlotNode(Sint32 index)

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

References Sint32.

Referenced by fdLZPackConsumeSlotBytes().

Definition at line 2065 of file lucky_wheels.c.

fdLZPackRemoveSlotNode

void fdLZPackRemoveSlotNode(Sint32 slot)

Removes window position slot from its chain.

References Sint32.

Referenced by fdLZPackConsumeSlotBytes().

Definition at line 2078 of file lucky_wheels.c.

fdLZPackConsumeSlotBytes

void fdLZPackConsumeSlotBytes(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).

References fdLZPackInsertSlotNode(), fdLZPackRemoveSlotNode() and Sint32.

Referenced by fdLZPackPackStream().

Definition at line 2093 of file lucky_wheels.c.

fdLZPackCopyBufferedBytes

void fdLZPackCopyBufferedBytes(Uint8 *dest)

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

References Sint32.

Referenced by fdLZPackPackStream().

Definition at line 2151 of file lucky_wheels.c.

fdLZPackFindWindowMatch

static __inline__ void fdLZPackFindWindowMatch(Sint32 start)

Finds the longest earlier match (up to PACK_MATCH_MAX bytes, at most PACK_DISTANCE_MAX back) for the bytes at window position start; matchLen stays 1 for none.

References Sint32.

Referenced by fdLZPackPackStream().

Definition at line 2166 of file lucky_wheels.c.

fdLZPackPackStream

Sint32 fdLZPackPackStream(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. 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.

References fdLZPackConsumeSlotBytes(), fdLZPackCopyBufferedBytes(), fdLZPackFindWindowMatch(), fdLZPackResetSlotBuckets() and Sint32.

Definition at line 2245 of file lucky_wheels.c.

Variables in detail

MsgSlotsBet

extern char MsgSlotsBet[]

"Bet"

Referenced by fdLuckyWheelsSetUpBetting() and fdLuckyWheelsUpdate().

Definition at line 17 of file lucky_wheels.c.

MsgSlotsStop

extern char MsgSlotsStop[]

"{button_icon:4}:Stop slots"

Referenced by fdLuckyWheelsUpdate().

Definition at line 18 of file lucky_wheels.c.

MsgSlotsChooseHeld

extern char MsgSlotsChooseHeld[]

"When you've chosen which slots"

Referenced by fdLuckyWheelsUpdate().

Definition at line 19 of file lucky_wheels.c.

MsgSlotsPullLever

extern char MsgSlotsPullLever[]

"to lock, pull the lever!"

Referenced by fdLuckyWheelsUpdate().

Definition at line 20 of file lucky_wheels.c.

MsgSlotsHold

extern char MsgSlotsHold[]

"{button_icon:1}:Stop"

Referenced by fdLuckyWheelsUpdate().

Definition at line 21 of file lucky_wheels.c.

MsgSlotsRelease

extern char MsgSlotsRelease[]

"{button_icon:1}:Spin"

Referenced by fdLuckyWheelsUpdate().

Definition at line 22 of file lucky_wheels.c.

MsgSlotsStart

extern char MsgSlotsStart[]

"{button_icon:1}:Start machine"

Referenced by fdLuckyWheelsUpdate().

Definition at line 23 of file lucky_wheels.c.

MsgSlotsAllHeld

extern char MsgSlotsAllHeld[]

"If you lock all the slots,"

Referenced by fdLuckyWheelsUpdate().

Definition at line 24 of file lucky_wheels.c.

MsgSlotsCannotPull

extern char MsgSlotsCannotPull[]

"you can't pull the lever!"

Referenced by fdLuckyWheelsUpdate().

Definition at line 25 of file lucky_wheels.c.

MsgSlotsChangeBet

extern char MsgSlotsChangeBet[]

"Press up or down to change value"

Referenced by fdLuckyWheelsRun().

Definition at line 26 of file lucky_wheels.c.

MsgSlotsControls

extern char MsgSlotsControls[]

"{button_icon:1}:Start machine {button_icon:2}:Quit"

Referenced by fdLuckyWheelsRun().

Definition at line 28 of file lucky_wheels.c.

LuckyWheelsSparkPictureOffsets

const Uint16 LuckyWheelsSparkPictureOffsets[]

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.

Referenced by fdLuckyWheelsRun().

Definition at line 197 of file lucky_wheels.c.

LuckyWheelsSymbolPrizes

const Uint8 LuckyWheelsSymbolPrizes[]

The prize of each wheel symbol (LUCKY_WHEELS_PRIZE), kept in REEL_SAVE.wonPrizes for each winning line.

Referenced by fdLuckyWheelsUpdate().

Definition at line 202 of file lucky_wheels.c.

LuckyWheelsTitleLetterTiles

const Uint8 LuckyWheelsTitleLetterTiles[LUCKY_WHEELS_TITLE_LETTERS]

The tile of each title letter.

Referenced by fdLuckyWheelsUpdate().

Definition at line 212 of file lucky_wheels.c.

LuckyWheelsMachineSpriteX

const Uint8 LuckyWheelsMachineSpriteX[LUCKY_WHEELS_MACHINE_LIGHTS]

The positions of the machine's lights, in screen pixels: its four corners first, then the lights along its frame.

Referenced by fdLuckyWheelsUpdate().

Definition at line 224 of file lucky_wheels.c.

LuckyWheelsMachineSpriteY

const Uint8 LuckyWheelsMachineSpriteY[LUCKY_WHEELS_MACHINE_LIGHTS]

Referenced by fdLuckyWheelsUpdate().

Definition at line 226 of file lucky_wheels.c.

LuckyWheelsTitleLetterWidths

const Uint8 LuckyWheelsTitleLetterWidths[LUCKY_WHEELS_TITLE_LETTERS]

The advance of each title letter.

Referenced by fdLuckyWheelsSetUpBetting().

Definition at line 230 of file lucky_wheels.c.

On this page

StructuresMacrosEnumerationsFunctionsVariablesDescriptionMacros in detailLUCKY_WHEELS_CANVAS_SIZELUCKY_WHEELS_CANVAS_FIRST_TILELUCKY_WHEELS_CANVAS_TOP_ROWLUCKY_WHEELS_CANVAS_BOTTOM_ROWLUCKY_WHEELS_CANVAS_TILESLUCKY_WHEELS_CANVAS_CLEAR_TILELUCKY_WHEELS_SPARK_COLORSLUCKY_WHEELS_LINE_COLORLUCKY_WHEELS_LINE_LIGHTLUCKY_WHEELS_MACHINE_PALETTELUCKY_WHEELS_MACHINE_TILELUCKY_WHEELS_CLEAR_TILELUCKY_WHEELS_IN_OPENINGLUCKY_WHEELS_ICON_COLORSLUCKY_WHEELS_JACKPOT_PALETTELUCKY_WHEELS_REEL_COUNTLUCKY_WHEELS_LEVERLUCKY_WHEELS_LEVER_PULL_TICKSLUCKY_WHEELS_LEVER_SETTLE_TICKSLUCKY_WHEELS_LEVER_TICKSLUCKY_WHEELS_LEVER_XLUCKY_WHEELS_LEVER_YLUCKY_WHEELS_LEVER_PULLLUCKY_WHEELS_AUTO_STOP_TICKSLUCKY_WHEELS_WIN_PAUSELUCKY_WHEELS_LOSS_PAUSELUCKY_WHEELS_STOP_WINDOW_TICKLUCKY_WHEELS_STOP_PROMPT_TICKLUCKY_WHEELS_LAMP_TILESLUCKY_WHEELS_LOCKED_LAMP_TILESLUCKY_WHEELS_CORNER_LIGHT_TILESLUCKY_WHEELS_FRAME_LIGHT_TILESLUCKY_WHEELS_LEVER_TILESLUCKY_WHEELS_LINE_TILESLUCKY_WHEELS_LIT_LINE_TILESLUCKY_WHEELS_LEVER_SLOT_TILESLUCKY_WHEELS_LEVER_SLOT_PIECESLUCKY_WHEELS_LEVER_SLOT_XLUCKY_WHEELS_LEVER_SLOT_YLUCKY_WHEELS_HAND_TILESLUCKY_WHEELS_PULL_TILESLUCKY_WHEELS_ARROW_TILESLUCKY_WHEELS_REEL_SYMBOLSLUCKY_WHEELS_SYMBOL_HEIGHTLUCKY_WHEELS_REEL_TURNLUCKY_WHEELS_SPIN_SPEEDLUCKY_WHEELS_PAYLINESLUCKY_WHEELS_MIDDLE_LINELUCKY_WHEELS_BET_MAXLUCKY_WHEELS_RESPINSLUCKY_WHEELS_PLACED_SYMBOLSLUCKY_WHEELS_WILD_SYMBOLLUCKY_WHEELS_FADE_TICKSLUCKY_WHEELS_CYCLE_TICKSLUCKY_WHEELS_CYCLE_PALETTESLUCKY_WHEELS_BURST_SPARKSLUCKY_WHEELS_SPARK_COUNTLUCKY_WHEELS_SPARK_SHRINK_TICKSLUCKY_WHEELS_REPEAT_DELAYLUCKY_WHEELS_REPEAT_INTERVALLUCKY_WHEELS_MACHINE_LIGHTSLUCKY_WHEELS_CORNER_LIGHTSLINE_STEP_ONELUCKY_WHEELS_ALL_LOCKED_XLUCKY_WHEELS_ALL_LOCKED_WIDTHLUCKY_WHEELS_START_XLUCKY_WHEELS_START_WIDTHLUCKY_WHEELS_LOCK_XLUCKY_WHEELS_LOCK_WIDTHLUCKY_WHEELS_SPIN_XLUCKY_WHEELS_SPIN_WIDTHLUCKY_WHEELS_TICKET_DIGITSLUCKY_WHEELS_TICKET_XLUCKY_WHEELS_STOP_XLUCKY_WHEELS_STOP_WIDTHLUCKY_WHEELS_CHOOSE_LOCKED_XLUCKY_WHEELS_CHOOSE_LOCKED_WIDTHLUCKY_WHEELS_TITLE_FIRST_TURNEDLUCKY_WHEELS_TITLE_TILESLUCKY_WHEELS_BOUNCED_LETTERSLUCKY_WHEELS_TITLE_XLUCKY_WHEELS_SPARKSLUCKY_WHEELS_WHEELS_TOPLUCKY_WHEELS_WHEELS_BOTTOMLUCKY_WHEELS_SHADE_LINESLUCKY_WHEELS_SHADE_LEVELLUCKY_WHEELS_HELP_WINDOW_XLUCKY_WHEELS_HELP_WINDOW_WIDTHLUCKY_WHEELS_CONTROLS_WINDOW_HEIGHTLUCKY_WHEELS_JACKPOT_COPYLUCKY_WHEELS_JACKPOT_TILESPACK_WINDOW_SIZEPACK_WINDOW_MASKPACK_BYTE_VALUESPACK_LOOKAHEADPACK_HISTORYPACK_DISTANCE_MAXPACK_SHORT_MATCH_MAXPACK_MATCH_MAXPACK_FIRST_FLAGPACK_CODE_DISTANCE_HIGHPACK_CODE_LENGTHPACK_CODE_DISTANCE_LOWEnumerations in detailLUCKY_WHEELS_SYMBOLLUCKY_WHEELS_PRIZELUCKY_WHEELS_STAGELUCKY_WHEELS_PROMPTFunctions in detailfdLuckyWheelsRunfdLuckyWheelsStartfdLuckyWheelsScaleRGB555fdLuckyWheelsTransferCanvasfdLuckyWheelsDarkenStepfdLuckyWheelsStepSparkColorsfdLuckyWheelsDrawCanvasLinefdLuckyWheelsUpdatefdLuckyWheelsFinishTickfdLuckyWheelsSetUpBettingfdLZPackResetSlotBucketsfdLZPackInsertSlotNodefdLZPackRemoveSlotNodefdLZPackConsumeSlotBytesfdLZPackCopyBufferedBytesfdLZPackFindWindowMatchfdLZPackPackStreamVariables in detailMsgSlotsBetMsgSlotsStopMsgSlotsChooseHeldMsgSlotsPullLeverMsgSlotsHoldMsgSlotsReleaseMsgSlotsStartMsgSlotsAllHeldMsgSlotsCannotPullMsgSlotsChangeBetMsgSlotsControlsLuckyWheelsSparkPictureOffsetsLuckyWheelsSymbolPrizesLuckyWheelsTitleLetterTilesLuckyWheelsMachineSpriteXLuckyWheelsMachineSpriteYLuckyWheelsTitleLetterWidths