Skip to Content
The Alchemy Project

src/field/super_lucky_dice.c

Super Lucky Dice, Contigo's four-dice game with its hi-lo game to double the winnings.

Macros

NameDescription
#defineOBJ_X_TURN (OBJ_X_MASK + 1)A whole turn of an OAM entry's 9-bit x and 8-bit y.
#defineOBJ_Y_TURN (OBJ_Y_MASK + 1)
#defineSMALL_DOUBLE_UP_TILES 152Where fdSuperLuckyDiceRun puts each picture in OBJ VRAM, as 16-colour tiles (the dice, 256-colour, then their shadow at DICE_SHADOW_TILE, fill the first DICE_SHADOW_TILE + 8; GAME_TILES is FINAL_GAME_TILES's "Game" alone, the sixth metatile on).
#defineFINAL_GAME_TILES 168"Final Game", in 16 by 16 metatiles
#defineGAME_TILES (FINAL_GAME_TILES + 5 * SPRITE_TILES(16, 16))
#defineORANGE_DIGIT_TILES 2000 to 9, 16 by 32, the hi-lo game's number
#defineTIMES_SIGN_TILES 280the times sign, then "or"
#defineOR_TILES (TIMES_SIGN_TILES + SPRITE_TILES(16, 16))
#defineDOUBLE_UP_TILES 292the large "Double Up" choice
#defineCASH_OUT_TILES 372"Cash Out"
#defineHIGHER_TILES 512"Higher", in a hi-lo game
#defineRESULT_BANNER_TILES 512"Win!" to "Perfect!!!", over Higher
#defineLOWER_TILES 560"Lower"
#defineGREEN_DIGIT_TILES 6400 to 9, 32 by 32, the total
#definePINK_DIGIT_TILES 8160 to 9, 16 by 16
#defineDOME_PALETTE_COLORS 224The dome's picture begins with its 224 colours, the dice faces' with 64, each before its tiles.
#defineDICE_FACES_PALETTE_COLORS 64
#defineGLOW_LEVELS 16A glowing picture's channels rise by up to twice this many levels.
#defineCHOICE_COLUMN_X 64The x the choices, Higher and Lower or Double Up and Cash Out, rest at; once A is pressed the one not chosen slides away 12 pixels a tick.
#defineCHOICE_BOB_SHIFT 14The chosen choice's number bobs by a sine shifted down this far: up to 4 pixels and back every 32 ticks.
#defineTOTAL_X 100Where the total and the result's banner come to rest after sliding in from the left; after a loss each sways about its own x and falls from there.
#defineTOTAL_Y 48
#defineRESULT_BANNER_X 60
#defineRESULT_BANNER_Y 64
#defineTOTAL_ARC_RADIUS_X 40Offered the hi-lo game, the total arcs up and over to the left on an ellipse this wide and high, a sixteenth of a turn a tick.
#defineTOTAL_ARC_RADIUS_Y 48
#defineTOTAL_CIRCLE_RADIUS 48Unused: the circle a won total would ride.
#defineDIE_CORNER_X 48How far left of and above its point a die's sprite, and a shadow's, has its corner at DICE_NEAREST_DEPTH, in pixels; the further the die, the less.
#defineDIE_CORNER_Y 32
#defineSHADOW_CORNER_X 48
#defineSHADOW_CORNER_Y 24
#defineSUPER_LUCKY_DICE_COUNT 4Super Lucky Dice's rules, as Contigo's sign gives them: four dice thrown at once; two alike pay the bet back, three alike twice it, two pairs three times and all four alike eight times; then up to five hi-lo games, each won doubling the winnings.
#defineSUPER_LUCKY_DICE_ONE_PAIR_PAYOUT 1
#defineSUPER_LUCKY_DICE_TRIPLE_PAYOUT 2
#defineSUPER_LUCKY_DICE_TWO_PAIR_PAYOUT 3
#defineSUPER_LUCKY_DICE_PERFECT_PAYOUT 8
#defineDICE_FINAL_GAME 5the fifth hi-lo game, the "Final Game"
#defineDICE_LOWEST_TOTAL SUPER_LUCKY_DICE_COUNTThe totals four dice can throw, four ones to four sixes, and the one between them that the hi-lo game's target is reset to.
#defineDICE_HIGHEST_TOTAL (SUPER_LUCKY_DICE_COUNT * DICE_FACE_COUNT)
#defineDICE_MIDDLE_TOTAL ((DICE_LOWEST_TOTAL + DICE_HIGHEST_TOTAL) / 2)
#defineCOIN_WINDOW_X BY_LANGUAGE(19, 18, 17, 18, 16, 18)What differs between the editions: the windows' sizes and text columns by language; the hi-lo games B cannot leave (CANNOT_QUIT), only the first in the Japanese edition and every one in the others; and the first bet shown, clamped to the player's coins in the Japanese and English editions.
#defineCOIN_WINDOW_WIDTH BY_LANGUAGE(11, 12, 13, 12, 14, 12)French draws the coin window two tiles wider, its numbers 16 pixels further right; Japanese draws them 16 pixels further left, each followed by its counter word.
#defineCOIN_TEXT_X BY_LANGUAGE(48, 48, 48, 56, 56, 56)
#defineSUPER_LUCKY_DICE_HELP_WINDOW_X BY_LANGUAGE(22, 22, 20, 20, 20, 20)
#defineSUPER_LUCKY_DICE_HELP_WINDOW_WIDTH BY_LANGUAGE(8, 8, 10, 10, 10, 10)
#defineBET_TEXT_X BY_LANGUAGE(24, 24, 32, 32, 24, 24)
#defineWINNINGS_WINDOW_X BY_LANGUAGE(10, 9, 7, 9, 7, 9)
#defineWINNINGS_WINDOW_MARGIN BY_LANGUAGE(10, 12, 14, 12, 14, 12)
#defineWINNINGS_LABEL_X BY_LANGUAGE(40, 48, 48, 56, 56, 56)
#defineWINNINGS_TEXT_X JAPANESE_OR(40, 48)
#defineRESULT_WINDOW_X ITALIAN_OR(3, 4)
#defineRESULT_WINDOW_WIDTH BY_LANGUAGE(20, 21, 21, 21, 21, 23)
#defineGAME_BANNER_X
#defineMULTIPLIER_ZERO_X BY_LANGUAGE(80, 80, 92, 80, 86, 80)
#defineCANNOT_QUIT (game) ((game) > 0)
#defineGAME_NUMBER_WORDThe OAM word of the game's number after the final game's banner: its x, fitted to each language's banner, and its 16x32 shape.
#defineBET_WINDOW_X FRENCH_OR(17, COIN_WINDOW_X)The bet window: where the coin window is, but in French a tile further right and narrower.
#defineBET_WINDOW_WIDTH FRENCH_OR(13, COIN_WINDOW_WIDTH)
#defineDICE_START_RADIUS 100The dice wait on a circle this far about the dome's centre, a quarter turn apart, before the first throw.
#defineSUPER_LUCKY_DICE_TOUCH_DISTANCE 70Two dice whose centres come closer than this push each other apart.
#defineDICE_DOME_RADIUS 200The round dome's radius: a die beyond it is turned back inward.
#defineDICE_GAME_THROW (dice, spinRate)Throws the four dice from a row left of the centre, 24 pixels apart and 96 up, each with a random push up and into the dome and a random roll; it counts with fdSuperLuckyDiceRun's index.
#defineDICE_WINDOW_FLAGS (WINDOW_FLAG_INSTANT | WINDOW_FLAG_UNREAD)A window of the game's: it opens at once, with no zoom.
#defineDICE_BET () (gmPartyGetAverageLevelStub() * DICE_BET_PER_LEVEL)What a throw costs: ten coins per level of the party's average.
#defineSHOW_BET ()fdSuperLuckyDiceRun's redraws of the bet and the coins, its help window's Throw and Quit buttons, and the glowing and dimmed choice in a pair.
#defineSHOW_COINS ()
#defineOPEN_THROW_HELP ()
#defineGLOW_PALETTE (palette)The glow palette: every sixth tick its rotating colours move along by one, and every four ticks its glow colour takes the next of GLOW_STEPS steps.
#defineDIM_PALETTE (palette)

Enumerations

NameDescription
enumSUPER_LUCKY_DICE_PALETTE { DICE_PALETTE_FINAL_GAME, DICE_PALETTE_SMALL_DOUBLE_UP, DICE_ … }The sprite palettes fdSuperLuckyDiceRun gives its pictures, after the six the dice faces' copy fills; the last four are loaded again for each part of a game.
enumSUPER_DICE_RESULT { SUPER_LUCKY_DICE_RESULT_LOSE, SUPER_LUCKY_DICE_RESULT_WIN, S … }How a throw ended, the banner it shows: in a hi-lo game a loss or a win, or for the first throw what the four dice show (fdSuperLuckyDiceScoreDice).
enumSUPER_LUCKY_DICE_PICTURES { DICE_PICTURES_NONE, DICE_PICTURES_HIGHER_LOWER, DICE_PICTURE … }The pictures a state asks fdSuperLuckyDiceRun to load before the next tick.
enumSUPER_LUCKY_DICE_STATE { SUPER_LUCKY_DICE_THROW, SUPER_LUCKY_DICE_GUESS, SUPER_LUCKY_ … }What the Super Lucky Dice screen is doing.

Functions

NameDescription
Sint32fdSuperLuckyDiceStart (void)Runs Super Lucky Dice, every layer off until it sets up its own display, and returns 0.
voidfdSuperLuckyDiceResetViewDefaults (void)Puts the 3D camera at its view of the dome: at the origin, unturned, pitched to 147/256 of a turn and 510 pixels away, following nothing.
Sint32fdSuperLuckyDiceScaleRGB555Buffer (Uint16 *src, Uint16 *dest, FIXED scale, Sint32 count)Copies count RGB555 colours from source to destination with each channel multiplied by scale (16.16: 0 is black, toFIXED(1) unchanged), for fades.
voidfdSuperLuckyDiceBrightenColors (Uint16 *src, Uint16 *dest, Uint32 count, Sint32 angle)Copies count RGB555 colours from source to destination with each channel raised by GLOW_LEVELS * (1 - cos(angle)) and clamped at the brightest: unchanged at angle 0 and brightest at a half turn, so a picture glows and fades as angle turns.
Sint32fdSuperLuckyDiceDrawNumber (Sint32 sprite, Sint32 x, Sint32 y, Sint32 value, Sint32 palette, Sint32 digits)Draws value as digits small digit sprites, from PINK_DIGIT_TILES in palette, ending at x, 10 pixels apart, leading zeros skipped but for the last.
Sint32fdSuperLuckyDiceDrawLargeNumber (Sint32 sprite, Sint32 x, Sint32 y, Sint32 value, Sint32 palette, Sint32 digits)Draws value as digits large digit sprites, from GREEN_DIGIT_TILES in palette, starting at x, 22 pixels apart, leading zeros skipped.
Sint32fdSuperLuckyDiceScoreDice (Sint32 *dice)Scores the four dice's faces: SUPER_LUCKY_DICE_RESULT_PERFECT when all four match, otherwise by the matching pairs among them, one pair, two pair or three (three alike), or SUPER_LUCKY_DICE_RESULT_LOSE for none.
voidfdSuperLuckyDiceRun (void)Runs Super Lucky Dice until the player quits or cannot afford a throw (DICE_BET).

Variables

NameDescription
const Uint8SuperLuckyDiceFaceTiles []The die face tile at each step of its roll, as Lucky Dice's LuckyDiceFaceTiles: one for each DICE_ROLL_PER_TILE of the roll angle, three to a face.
extern Uint8MapGridMetatileBuffer []The map cell buffer at its own address, which the effects borrow: no map is loaded during a battle.
extern charMsgLuckyDiceCoins , MsgLuckyDiceWinnings, MsgDiceGameThrow, MsgDiceGameHigher, MsgDiceGameLower, MsgDiceGameHigherAgain, MsgDiceGameLowerAgain, MsgDiceGameChoose, MsgDiceGameDoubleUp

Description

Super Lucky Dice, Contigo's four-dice game with its hi-lo game to double the winnings.

Macros in detail

OBJ_X_TURN

#define OBJ_X_TURN (OBJ_X_MASK + 1)

A whole turn of an OAM entry's 9-bit x and 8-bit y. OBJ_POSITION keeps only those bits, so a place plus a turn is the same place; the dice game writes its sprites' places so, which keeps the sums positive where a sprite sits left of or above the screen.

Referenced by fdSuperLuckyDiceDrawLargeNumber(), fdSuperLuckyDiceDrawNumber() and fdSuperLuckyDiceRun().

Definition at line 19 of file super_lucky_dice.c.

OBJ_Y_TURN

#define OBJ_Y_TURN (OBJ_Y_MASK + 1)

Referenced by fdSuperLuckyDiceDrawLargeNumber(), fdSuperLuckyDiceDrawNumber() and fdSuperLuckyDiceRun().

Definition at line 20 of file super_lucky_dice.c.

SMALL_DOUBLE_UP_TILES

#define SMALL_DOUBLE_UP_TILES 152

Where fdSuperLuckyDiceRun puts each picture in OBJ VRAM, as 16-colour tiles (the dice, 256-colour, then their shadow at DICE_SHADOW_TILE, fill the first DICE_SHADOW_TILE + 8; GAME_TILES is FINAL_GAME_TILES's "Game" alone, the sixth metatile on).

"Double Up", for the rounds won

Referenced by fdSuperLuckyDiceRun().

Definition at line 26 of file super_lucky_dice.c.

FINAL_GAME_TILES

#define FINAL_GAME_TILES 168

"Final Game", in 16 by 16 metatiles

Referenced by fdSuperLuckyDiceRun().

Definition at line 27 of file super_lucky_dice.c.

GAME_TILES

#define GAME_TILES (FINAL_GAME_TILES + 5 * SPRITE_TILES(16, 16))

Referenced by fdSuperLuckyDiceRun().

Definition at line 28 of file super_lucky_dice.c.

ORANGE_DIGIT_TILES

#define ORANGE_DIGIT_TILES 200

0 to 9, 16 by 32, the hi-lo game's number

Referenced by fdSuperLuckyDiceRun().

Definition at line 29 of file super_lucky_dice.c.

TIMES_SIGN_TILES

#define TIMES_SIGN_TILES 280

the times sign, then "or"

Referenced by fdSuperLuckyDiceRun().

Definition at line 30 of file super_lucky_dice.c.

OR_TILES

#define OR_TILES (TIMES_SIGN_TILES + SPRITE_TILES(16, 16))

Referenced by fdSuperLuckyDiceRun().

Definition at line 31 of file super_lucky_dice.c.

DOUBLE_UP_TILES

#define DOUBLE_UP_TILES 292

the large "Double Up" choice

Referenced by fdSuperLuckyDiceRun().

Definition at line 32 of file super_lucky_dice.c.

CASH_OUT_TILES

#define CASH_OUT_TILES 372

"Cash Out"

Referenced by fdSuperLuckyDiceRun().

Definition at line 33 of file super_lucky_dice.c.

HIGHER_TILES

#define HIGHER_TILES 512

"Higher", in a hi-lo game

Referenced by fdSuperLuckyDiceRun().

Definition at line 34 of file super_lucky_dice.c.

RESULT_BANNER_TILES

#define RESULT_BANNER_TILES 512

"Win!" to "Perfect!!!", over Higher

Referenced by fdSuperLuckyDiceRun().

Definition at line 35 of file super_lucky_dice.c.

LOWER_TILES

#define LOWER_TILES 560

"Lower"

Referenced by fdSuperLuckyDiceRun().

Definition at line 36 of file super_lucky_dice.c.

GREEN_DIGIT_TILES

#define GREEN_DIGIT_TILES 640

0 to 9, 32 by 32, the total

Referenced by fdSuperLuckyDiceDrawLargeNumber() and fdSuperLuckyDiceRun().

Definition at line 37 of file super_lucky_dice.c.

PINK_DIGIT_TILES

#define PINK_DIGIT_TILES 816

0 to 9, 16 by 16

Referenced by fdSuperLuckyDiceDrawNumber() and fdSuperLuckyDiceRun().

Definition at line 38 of file super_lucky_dice.c.

DOME_PALETTE_COLORS

#define DOME_PALETTE_COLORS 224

The dome's picture begins with its 224 colours, the dice faces' with 64, each before its tiles.

Referenced by fdSuperLuckyDiceRun().

Definition at line 42 of file super_lucky_dice.c.

DICE_FACES_PALETTE_COLORS

#define DICE_FACES_PALETTE_COLORS 64

Referenced by fdSuperLuckyDiceRun().

Definition at line 43 of file super_lucky_dice.c.

GLOW_LEVELS

#define GLOW_LEVELS 16

A glowing picture's channels rise by up to twice this many levels.

Referenced by fdSuperLuckyDiceBrightenColors().

Definition at line 46 of file super_lucky_dice.c.

CHOICE_COLUMN_X

#define CHOICE_COLUMN_X 64

The x the choices, Higher and Lower or Double Up and Cash Out, rest at; once A is pressed the one not chosen slides away 12 pixels a tick.

Referenced by fdSuperLuckyDiceRun().

Definition at line 50 of file super_lucky_dice.c.

CHOICE_BOB_SHIFT

#define CHOICE_BOB_SHIFT 14

The chosen choice's number bobs by a sine shifted down this far: up to 4 pixels and back every 32 ticks.

Referenced by fdSuperLuckyDiceRun().

Definition at line 53 of file super_lucky_dice.c.

TOTAL_X

#define TOTAL_X 100

Where the total and the result's banner come to rest after sliding in from the left; after a loss each sways about its own x and falls from there.

Referenced by fdSuperLuckyDiceRun().

Definition at line 57 of file super_lucky_dice.c.

TOTAL_Y

#define TOTAL_Y 48

Referenced by fdSuperLuckyDiceRun().

Definition at line 58 of file super_lucky_dice.c.

RESULT_BANNER_X

#define RESULT_BANNER_X 60

Referenced by fdSuperLuckyDiceRun().

Definition at line 59 of file super_lucky_dice.c.

RESULT_BANNER_Y

#define RESULT_BANNER_Y 64

Referenced by fdSuperLuckyDiceRun().

Definition at line 60 of file super_lucky_dice.c.

TOTAL_ARC_RADIUS_X

#define TOTAL_ARC_RADIUS_X 40

Offered the hi-lo game, the total arcs up and over to the left on an ellipse this wide and high, a sixteenth of a turn a tick.

Referenced by fdSuperLuckyDiceRun().

Definition at line 63 of file super_lucky_dice.c.

TOTAL_ARC_RADIUS_Y

#define TOTAL_ARC_RADIUS_Y 48

Referenced by fdSuperLuckyDiceRun().

Definition at line 64 of file super_lucky_dice.c.

TOTAL_CIRCLE_RADIUS

#define TOTAL_CIRCLE_RADIUS 48

Unused: the circle a won total would ride.

Referenced by fdSuperLuckyDiceRun().

Definition at line 66 of file super_lucky_dice.c.

DIE_CORNER_X

#define DIE_CORNER_X 48

How far left of and above its point a die's sprite, and a shadow's, has its corner at DICE_NEAREST_DEPTH, in pixels; the further the die, the less.

Referenced by fdSuperLuckyDiceRun().

Definition at line 70 of file super_lucky_dice.c.

DIE_CORNER_Y

#define DIE_CORNER_Y 32

Referenced by fdSuperLuckyDiceRun().

Definition at line 71 of file super_lucky_dice.c.

SHADOW_CORNER_X

#define SHADOW_CORNER_X 48

Referenced by fdSuperLuckyDiceRun().

Definition at line 72 of file super_lucky_dice.c.

SHADOW_CORNER_Y

#define SHADOW_CORNER_Y 24

Referenced by fdSuperLuckyDiceRun().

Definition at line 73 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_COUNT

#define SUPER_LUCKY_DICE_COUNT 4

Super Lucky Dice's rules, as Contigo's sign gives them: four dice thrown at once; two alike pay the bet back, three alike twice it, two pairs three times and all four alike eight times; then up to five hi-lo games, each won doubling the winnings.

Referenced by fdSuperLuckyDiceRun() and fdSuperLuckyDiceScoreDice().

Definition at line 111 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_ONE_PAIR_PAYOUT

#define SUPER_LUCKY_DICE_ONE_PAIR_PAYOUT 1

Referenced by fdSuperLuckyDiceRun().

Definition at line 112 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_TRIPLE_PAYOUT

#define SUPER_LUCKY_DICE_TRIPLE_PAYOUT 2

Referenced by fdSuperLuckyDiceRun().

Definition at line 113 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_TWO_PAIR_PAYOUT

#define SUPER_LUCKY_DICE_TWO_PAIR_PAYOUT 3

Referenced by fdSuperLuckyDiceRun().

Definition at line 114 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_PERFECT_PAYOUT

#define SUPER_LUCKY_DICE_PERFECT_PAYOUT 8

Referenced by fdSuperLuckyDiceRun().

Definition at line 115 of file super_lucky_dice.c.

DICE_FINAL_GAME

#define DICE_FINAL_GAME 5

the fifth hi-lo game, the "Final Game"

Referenced by fdSuperLuckyDiceRun().

Definition at line 116 of file super_lucky_dice.c.

DICE_LOWEST_TOTAL

#define DICE_LOWEST_TOTAL SUPER_LUCKY_DICE_COUNT

The totals four dice can throw, four ones to four sixes, and the one between them that the hi-lo game's target is reset to.

Referenced by fdSuperLuckyDiceRun().

Definition at line 120 of file super_lucky_dice.c.

DICE_HIGHEST_TOTAL

#define DICE_HIGHEST_TOTAL (SUPER_LUCKY_DICE_COUNT * DICE_FACE_COUNT)

Referenced by fdSuperLuckyDiceRun().

Definition at line 121 of file super_lucky_dice.c.

DICE_MIDDLE_TOTAL

#define DICE_MIDDLE_TOTAL ((DICE_LOWEST_TOTAL + DICE_HIGHEST_TOTAL) / 2)

Referenced by fdSuperLuckyDiceRun().

Definition at line 122 of file super_lucky_dice.c.

COIN_WINDOW_X

#define COIN_WINDOW_X BY_LANGUAGE(19, 18, 17, 18, 16, 18)

What differs between the editions: the windows' sizes and text columns by language; the hi-lo games B cannot leave (CANNOT_QUIT), only the first in the Japanese edition and every one in the others; and the first bet shown, clamped to the player's coins in the Japanese and English editions.

Referenced by fdSuperLuckyDiceRun().

Definition at line 383 of file super_lucky_dice.c.

COIN_WINDOW_WIDTH

#define COIN_WINDOW_WIDTH BY_LANGUAGE(11, 12, 13, 12, 14, 12)

Referenced by fdSuperLuckyDiceRun() and scLemuriaSpringRunSpringGame().

Definition at line 384 of file super_lucky_dice.c.

COIN_TEXT_X

#define COIN_TEXT_X BY_LANGUAGE(48, 48, 48, 56, 56, 56)

Referenced by fdSuperLuckyDiceRun().

Definition at line 385 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_HELP_WINDOW_X

#define SUPER_LUCKY_DICE_HELP_WINDOW_X BY_LANGUAGE(22, 22, 20, 20, 20, 20)

Definition at line 386 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_HELP_WINDOW_WIDTH

#define SUPER_LUCKY_DICE_HELP_WINDOW_WIDTH BY_LANGUAGE(8, 8, 10, 10, 10, 10)

Definition at line 387 of file super_lucky_dice.c.

BET_TEXT_X

#define BET_TEXT_X BY_LANGUAGE(24, 24, 32, 32, 24, 24)

Definition at line 388 of file super_lucky_dice.c.

WINNINGS_WINDOW_X

#define WINNINGS_WINDOW_X BY_LANGUAGE(10, 9, 7, 9, 7, 9)

Referenced by fdSuperLuckyDiceRun().

Definition at line 389 of file super_lucky_dice.c.

WINNINGS_WINDOW_MARGIN

#define WINNINGS_WINDOW_MARGIN BY_LANGUAGE(10, 12, 14, 12, 14, 12)

Referenced by fdSuperLuckyDiceRun().

Definition at line 390 of file super_lucky_dice.c.

WINNINGS_LABEL_X

#define WINNINGS_LABEL_X BY_LANGUAGE(40, 48, 48, 56, 56, 56)

Referenced by fdSuperLuckyDiceRun().

Definition at line 391 of file super_lucky_dice.c.

WINNINGS_TEXT_X

#define WINNINGS_TEXT_X JAPANESE_OR(40, 48)

Referenced by fdSuperLuckyDiceRun().

Definition at line 392 of file super_lucky_dice.c.

RESULT_WINDOW_X

#define RESULT_WINDOW_X ITALIAN_OR(3, 4)

Referenced by fdSuperLuckyDiceRun().

Definition at line 393 of file super_lucky_dice.c.

RESULT_WINDOW_WIDTH

#define RESULT_WINDOW_WIDTH BY_LANGUAGE(20, 21, 21, 21, 21, 23)

Referenced by fdSuperLuckyDiceRun().

Definition at line 394 of file super_lucky_dice.c.

GAME_BANNER_X

#define GAME_BANNER_X

Referenced by fdSuperLuckyDiceRun().

Definition at line 395 of file super_lucky_dice.c.

MULTIPLIER_ZERO_X

#define MULTIPLIER_ZERO_X BY_LANGUAGE(80, 80, 92, 80, 86, 80)

Referenced by fdSuperLuckyDiceRun().

Definition at line 402 of file super_lucky_dice.c.

CANNOT_QUIT

#define CANNOT_QUIT(game) ((game) > 0)

#define CANNOT_QUIT(game) ((game) == 1)

Referenced by fdSuperLuckyDiceRun().

Definition at lines 406 and 408 of file super_lucky_dice.c.

GAME_NUMBER_WORD

#define GAME_NUMBER_WORD

The OAM word of the game's number after the final game's banner: its x, fitted to each language's banner, and its 16x32 shape.

Referenced by fdSuperLuckyDiceRun().

Definition at line 413 of file super_lucky_dice.c.

BET_WINDOW_X

#define BET_WINDOW_X FRENCH_OR(17, COIN_WINDOW_X)

The bet window: where the coin window is, but in French a tile further right and narrower.

Referenced by fdSuperLuckyDiceRun().

Definition at line 423 of file super_lucky_dice.c.

BET_WINDOW_WIDTH

#define BET_WINDOW_WIDTH FRENCH_OR(13, COIN_WINDOW_WIDTH)

Referenced by fdSuperLuckyDiceRun().

Definition at line 424 of file super_lucky_dice.c.

DICE_START_RADIUS

#define DICE_START_RADIUS 100

The dice wait on a circle this far about the dome's centre, a quarter turn apart, before the first throw.

Referenced by fdSuperLuckyDiceRun().

Definition at line 444 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_TOUCH_DISTANCE

#define SUPER_LUCKY_DICE_TOUCH_DISTANCE 70

Two dice whose centres come closer than this push each other apart.

Referenced by fdSuperLuckyDiceRun().

Definition at line 446 of file super_lucky_dice.c.

DICE_DOME_RADIUS

#define DICE_DOME_RADIUS 200

The round dome's radius: a die beyond it is turned back inward.

Referenced by fdSuperLuckyDiceRun().

Definition at line 448 of file super_lucky_dice.c.

DICE_GAME_THROW

#define DICE_GAME_THROW(dice, spinRate)

Throws the four dice from a row left of the centre, 24 pixels apart and 96 up, each with a random push up and into the dome and a random roll; it counts with fdSuperLuckyDiceRun's index.

Referenced by fdSuperLuckyDiceRun().

Definition at line 453 of file super_lucky_dice.c.

DICE_WINDOW_FLAGS

#define DICE_WINDOW_FLAGS (WINDOW_FLAG_INSTANT | WINDOW_FLAG_UNREAD)

A window of the game's: it opens at once, with no zoom.

Referenced by fdSuperLuckyDiceRun().

Definition at line 471 of file super_lucky_dice.c.

DICE_BET

#define DICE_BET() (gmPartyGetAverageLevelStub() * DICE_BET_PER_LEVEL)

What a throw costs: ten coins per level of the party's average.

Referenced by fdSuperLuckyDiceRun().

Definition at line 474 of file super_lucky_dice.c.

SHOW_BET

#define SHOW_BET()

fdSuperLuckyDiceRun's redraws of the bet and the coins, its help window's Throw and Quit buttons, and the glowing and dimmed choice in a pair.

Referenced by fdSuperLuckyDiceRun().

Definition at line 478 of file super_lucky_dice.c.

SHOW_COINS

#define SHOW_COINS()

Referenced by fdSuperLuckyDiceRun().

Definition at line 481 of file super_lucky_dice.c.

OPEN_THROW_HELP

#define OPEN_THROW_HELP()

Referenced by fdSuperLuckyDiceRun().

Definition at line 488 of file super_lucky_dice.c.

GLOW_PALETTE

#define GLOW_PALETTE(palette)

Referenced by fdSuperLuckyDiceRun() and scLemuriaPalaceCycleGlowColors().

Definition at line 495 of file super_lucky_dice.c.

DIM_PALETTE

#define DIM_PALETTE(palette)

Referenced by fdSuperLuckyDiceRun().

Definition at line 500 of file super_lucky_dice.c.

Enumerations in detail

SUPER_LUCKY_DICE_PALETTE

enum SUPER_LUCKY_DICE_PALETTE

The sprite palettes fdSuperLuckyDiceRun gives its pictures, after the six the dice faces' copy fills; the last four are loaded again for each part of a game.

EnumeratorValueDescription
DICE_PALETTE_FINAL_GAME6
DICE_PALETTE_SMALL_DOUBLE_UP7
DICE_PALETTE_ORANGE_DIGITS8
DICE_PALETTE_TIMES_SIGN9
DICE_PALETTE_PINK_DIGITS10
DICE_PALETTE_PALE_DIGITS11the pink digits, paler
DICE_PALETTE_RELOADED_A12Higher, or the total's green digits
DICE_PALETTE_RELOADED_B13Lower, or the result's banner
DICE_PALETTE_RELOADED_C14Double Up, or the glowing number above (Higher/Lower)
DICE_PALETTE_RELOADED_D15Cash Out, or the glowing number below

Definition at line 78 of file super_lucky_dice.c.

SUPER_DICE_RESULT

enum SUPER_DICE_RESULT

How a throw ended, the banner it shows: in a hi-lo game a loss or a win, or for the first throw what the four dice show (fdSuperLuckyDiceScoreDice).

EnumeratorValueDescription
SUPER_LUCKY_DICE_RESULT_LOSE0"Lose".
SUPER_LUCKY_DICE_RESULT_WIN1"Win!", a hi-lo game won.
SUPER_LUCKY_DICE_RESULT_ONE_PAIR2
SUPER_LUCKY_DICE_RESULT_TWO_PAIR3
SUPER_LUCKY_DICE_RESULT_TRIPLE4
SUPER_LUCKY_DICE_RESULT_PERFECT5All four alike.

Definition at line 95 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_PICTURES

enum SUPER_LUCKY_DICE_PICTURES

The pictures a state asks fdSuperLuckyDiceRun to load before the next tick.

EnumeratorValueDescription
DICE_PICTURES_NONE-1
DICE_PICTURES_HIGHER_LOWER1Higher and Lower, and the glowing digits
DICE_PICTURES_RESULT3the result's banner and the total's digits
DICE_PICTURES_DOUBLE_UP5Double Up and Cash Out

Definition at line 125 of file super_lucky_dice.c.

SUPER_LUCKY_DICE_STATE

enum SUPER_LUCKY_DICE_STATE

What the Super Lucky Dice screen is doing.

EnumeratorValueDescription
SUPER_LUCKY_DICE_THROWthe dice wait to be thrown; A throws, B leaves
SUPER_LUCKY_DICE_GUESSa hi-lo game: higher or lower than this total
SUPER_LUCKY_DICE_ROLLthe dice fly, bounce and settle
SUPER_LUCKY_DICE_RESULTthe four dice are scored
SUPER_LUCKY_DICE_PAYOUTthe winnings are counted into the coins
SUPER_LUCKY_DICE_DOUBLE_UPa win: double up or cash out

Definition at line 432 of file super_lucky_dice.c.

Functions in detail

fdSuperLuckyDiceStart

Sint32 fdSuperLuckyDiceStart(void)

Runs Super Lucky Dice, every layer off until it sets up its own display, and returns 0.

References fdSuperLuckyDiceRun() and Sint32.

Definition at line 136 of file super_lucky_dice.c.

fdSuperLuckyDiceResetViewDefaults

void fdSuperLuckyDiceResetViewDefaults(void)

Puts the 3D camera at its view of the dome: at the origin, unturned, pitched to 147/256 of a turn and 510 pixels away, following nothing.

References ProjectionWork, Sint32, syCalcPoint(), syDivFX(), syInitMatrix(), syMatrixTranslateVector(), syRotX(), syRotY() and sySetScreenDist().

Referenced by fdSuperLuckyDiceRun().

Definition at line 145 of file super_lucky_dice.c.

fdSuperLuckyDiceScaleRGB555Buffer

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

Copies count RGB555 colours from source to destination with each channel multiplied by scale (16.16: 0 is black, toFIXED(1) unchanged), for fades. Returns 0.

References Sint32.

Referenced by fdSuperLuckyDiceRun().

Definition at line 176 of file super_lucky_dice.c.

fdSuperLuckyDiceBrightenColors

void fdSuperLuckyDiceBrightenColors(Uint16 *src, Uint16 *dest, Uint32 count, Sint32 angle)

Copies count RGB555 colours from source to destination with each channel raised by GLOW_LEVELS * (1 - cos(angle)) and clamped at the brightest: unchanged at angle 0 and brightest at a half turn, so a picture glows and fades as angle turns.

References Sint32 and syCos().

Definition at line 221 of file super_lucky_dice.c.

fdSuperLuckyDiceDrawNumber

Sint32 fdSuperLuckyDiceDrawNumber(Sint32 sprite, Sint32 x, Sint32 y, Sint32 value, Sint32 palette, Sint32 digits)

Draws value as digits small digit sprites, from PINK_DIGIT_TILES in palette, ending at x, 10 pixels apart, leading zeros skipped but for the last. Returns the next free sprite.

References Sint32.

Referenced by fdSuperLuckyDiceRun().

Definition at line 251 of file super_lucky_dice.c.

fdSuperLuckyDiceDrawLargeNumber

Sint32 fdSuperLuckyDiceDrawLargeNumber(Sint32 sprite, Sint32 x, Sint32 y, Sint32 value, Sint32 palette, Sint32 digits)

Draws value as digits large digit sprites, from GREEN_DIGIT_TILES in palette, starting at x, 22 pixels apart, leading zeros skipped. Returns the next free sprite.

References Sint32.

Referenced by fdSuperLuckyDiceRun().

Definition at line 291 of file super_lucky_dice.c.

fdSuperLuckyDiceScoreDice

Sint32 fdSuperLuckyDiceScoreDice(Sint32 *dice)

Scores the four dice's faces: SUPER_LUCKY_DICE_RESULT_PERFECT when all four match, otherwise by the matching pairs among them, one pair, two pair or three (three alike), or SUPER_LUCKY_DICE_RESULT_LOSE for none.

References Sint32.

Referenced by fdSuperLuckyDiceRun().

Definition at line 330 of file super_lucky_dice.c.

fdSuperLuckyDiceRun

void fdSuperLuckyDiceRun(void)

Runs Super Lucky Dice until the player quits or cannot afford a throw (DICE_BET).

References BgScrollWork, fdSuperLuckyDiceDrawLargeNumber(), fdSuperLuckyDiceDrawNumber(), fdSuperLuckyDiceResetViewDefaults(), fdSuperLuckyDiceScaleRGB555Buffer(), fdSuperLuckyDiceScoreDice(), gmPartyAdjustCoinsStub(), MainRoutineStateWork, MapGridMetatileBuffer, mnTextDrawMessageAsTilesStub(), mnTextDrawNumberInWindowStub(), mnWindowCloseStub(), mnWindowCreateStub(), mnWindowSpritePrepareForRedrawStub(), mnWindowSystemInitFieldStub(), MsgLuckyDiceCoins, OamCopyEnabled, PerWork, Sint32, SuperLuckyDiceFaceTiles, syConvert3Dto2D(), syCos(), syDecompressTaggedLZ(), syDMAXCopy(), syHeapSlotAllocate(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), syInitEvent(), syInitMatrix(), syLookAtLoad(), syRandom(), syResourceGetTableEntry(), syResourceReservedNoOperation(), sySin(), sySoundPlayStub(), sySquartIWRAM() and sySynch().

Referenced by fdSuperLuckyDiceStart().

Definition at line 509 of file super_lucky_dice.c.

Variables in detail

SuperLuckyDiceFaceTiles

const Uint8 SuperLuckyDiceFaceTiles[]

The die face tile at each step of its roll, as Lucky Dice's LuckyDiceFaceTiles: one for each DICE_ROLL_PER_TILE of the roll angle, three to a face.

Referenced by fdSuperLuckyDiceRun().

Definition at line 376 of file super_lucky_dice.c.

MsgLuckyDiceCoins

extern char MsgLuckyDiceCoins, MsgLuckyDiceWinnings, MsgDiceGameThrow, MsgDiceGameHigher, MsgDiceGameLower, MsgDiceGameHigherAgain, MsgDiceGameLowerAgain, MsgDiceGameChoose, MsgDiceGameDoubleUp

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 427 of file super_lucky_dice.c.

On this page

MacrosEnumerationsFunctionsVariablesDescriptionMacros in detailOBJ_X_TURNOBJ_Y_TURNSMALL_DOUBLE_UP_TILESFINAL_GAME_TILESGAME_TILESORANGE_DIGIT_TILESTIMES_SIGN_TILESOR_TILESDOUBLE_UP_TILESCASH_OUT_TILESHIGHER_TILESRESULT_BANNER_TILESLOWER_TILESGREEN_DIGIT_TILESPINK_DIGIT_TILESDOME_PALETTE_COLORSDICE_FACES_PALETTE_COLORSGLOW_LEVELSCHOICE_COLUMN_XCHOICE_BOB_SHIFTTOTAL_XTOTAL_YRESULT_BANNER_XRESULT_BANNER_YTOTAL_ARC_RADIUS_XTOTAL_ARC_RADIUS_YTOTAL_CIRCLE_RADIUSDIE_CORNER_XDIE_CORNER_YSHADOW_CORNER_XSHADOW_CORNER_YSUPER_LUCKY_DICE_COUNTSUPER_LUCKY_DICE_ONE_PAIR_PAYOUTSUPER_LUCKY_DICE_TRIPLE_PAYOUTSUPER_LUCKY_DICE_TWO_PAIR_PAYOUTSUPER_LUCKY_DICE_PERFECT_PAYOUTDICE_FINAL_GAMEDICE_LOWEST_TOTALDICE_HIGHEST_TOTALDICE_MIDDLE_TOTALCOIN_WINDOW_XCOIN_WINDOW_WIDTHCOIN_TEXT_XSUPER_LUCKY_DICE_HELP_WINDOW_XSUPER_LUCKY_DICE_HELP_WINDOW_WIDTHBET_TEXT_XWINNINGS_WINDOW_XWINNINGS_WINDOW_MARGINWINNINGS_LABEL_XWINNINGS_TEXT_XRESULT_WINDOW_XRESULT_WINDOW_WIDTHGAME_BANNER_XMULTIPLIER_ZERO_XCANNOT_QUITGAME_NUMBER_WORDBET_WINDOW_XBET_WINDOW_WIDTHDICE_START_RADIUSSUPER_LUCKY_DICE_TOUCH_DISTANCEDICE_DOME_RADIUSDICE_GAME_THROWDICE_WINDOW_FLAGSDICE_BETSHOW_BETSHOW_COINSOPEN_THROW_HELPGLOW_PALETTEDIM_PALETTEEnumerations in detailSUPER_LUCKY_DICE_PALETTESUPER_DICE_RESULTSUPER_LUCKY_DICE_PICTURESSUPER_LUCKY_DICE_STATEFunctions in detailfdSuperLuckyDiceStartfdSuperLuckyDiceResetViewDefaultsfdSuperLuckyDiceScaleRGB555BufferfdSuperLuckyDiceBrightenColorsfdSuperLuckyDiceDrawNumberfdSuperLuckyDiceDrawLargeNumberfdSuperLuckyDiceScoreDicefdSuperLuckyDiceRunVariables in detailSuperLuckyDiceFaceTilesMsgLuckyDiceCoins