src/field/super_lucky_dice.c
Super Lucky Dice, Contigo's four-dice game with its hi-lo game to double the winnings.
#include "sounds.h"#include "field/super_lucky_dice.h"#include "field/field_engine.h"#include "game/game.h"#include "menu/menu.h"#include "battle/battle_camera.h"#include "macros.h"#include "edition.h"#include "window/stubs.h"#include "window/window.h"
Macros
| Name | Description | |
|---|---|---|
#define | OBJ_X_TURN (OBJ_X_MASK + 1) | A whole turn of an OAM entry's 9-bit x and 8-bit y. |
#define | OBJ_Y_TURN (OBJ_Y_MASK + 1) | |
#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). |
#define | FINAL_GAME_TILES 168 | "Final Game", in 16 by 16 metatiles |
#define | GAME_TILES (FINAL_GAME_TILES + 5 * SPRITE_TILES(16, 16)) | |
#define | ORANGE_DIGIT_TILES 200 | 0 to 9, 16 by 32, the hi-lo game's number |
#define | TIMES_SIGN_TILES 280 | the times sign, then "or" |
#define | OR_TILES (TIMES_SIGN_TILES + SPRITE_TILES(16, 16)) | |
#define | DOUBLE_UP_TILES 292 | the large "Double Up" choice |
#define | CASH_OUT_TILES 372 | "Cash Out" |
#define | HIGHER_TILES 512 | "Higher", in a hi-lo game |
#define | RESULT_BANNER_TILES 512 | "Win!" to "Perfect!!!", over Higher |
#define | LOWER_TILES 560 | "Lower" |
#define | GREEN_DIGIT_TILES 640 | 0 to 9, 32 by 32, the total |
#define | PINK_DIGIT_TILES 816 | 0 to 9, 16 by 16 |
#define | DOME_PALETTE_COLORS 224 | The dome's picture begins with its 224 colours, the dice faces' with 64, each before its tiles. |
#define | DICE_FACES_PALETTE_COLORS 64 | |
#define | GLOW_LEVELS 16 | A glowing picture's channels rise by up to twice this many levels. |
#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. |
#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. |
#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. |
#define | TOTAL_Y 48 | |
#define | RESULT_BANNER_X 60 | |
#define | RESULT_BANNER_Y 64 | |
#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. |
#define | TOTAL_ARC_RADIUS_Y 48 | |
#define | TOTAL_CIRCLE_RADIUS 48 | Unused: the circle a won total would ride. |
#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. |
#define | DIE_CORNER_Y 32 | |
#define | SHADOW_CORNER_X 48 | |
#define | SHADOW_CORNER_Y 24 | |
#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. |
#define | SUPER_LUCKY_DICE_ONE_PAIR_PAYOUT 1 | |
#define | SUPER_LUCKY_DICE_TRIPLE_PAYOUT 2 | |
#define | SUPER_LUCKY_DICE_TWO_PAIR_PAYOUT 3 | |
#define | SUPER_LUCKY_DICE_PERFECT_PAYOUT 8 | |
#define | DICE_FINAL_GAME 5 | the fifth hi-lo game, the "Final Game" |
#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. |
#define | DICE_HIGHEST_TOTAL (SUPER_LUCKY_DICE_COUNT * DICE_FACE_COUNT) | |
#define | DICE_MIDDLE_TOTAL ((DICE_LOWEST_TOTAL + DICE_HIGHEST_TOTAL) / 2) | |
#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. |
#define | COIN_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. |
#define | COIN_TEXT_X BY_LANGUAGE(48, 48, 48, 56, 56, 56) | |
#define | SUPER_LUCKY_DICE_HELP_WINDOW_X BY_LANGUAGE(22, 22, 20, 20, 20, 20) | |
#define | SUPER_LUCKY_DICE_HELP_WINDOW_WIDTH BY_LANGUAGE(8, 8, 10, 10, 10, 10) | |
#define | BET_TEXT_X BY_LANGUAGE(24, 24, 32, 32, 24, 24) | |
#define | WINNINGS_WINDOW_X BY_LANGUAGE(10, 9, 7, 9, 7, 9) | |
#define | WINNINGS_WINDOW_MARGIN BY_LANGUAGE(10, 12, 14, 12, 14, 12) | |
#define | WINNINGS_LABEL_X BY_LANGUAGE(40, 48, 48, 56, 56, 56) | |
#define | WINNINGS_TEXT_X JAPANESE_OR(40, 48) | |
#define | RESULT_WINDOW_X ITALIAN_OR(3, 4) | |
#define | RESULT_WINDOW_WIDTH BY_LANGUAGE(20, 21, 21, 21, 21, 23) | |
#define | GAME_BANNER_X | |
#define | MULTIPLIER_ZERO_X BY_LANGUAGE(80, 80, 92, 80, 86, 80) | |
#define | CANNOT_QUIT (game) ((game) > 0) | |
#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. |
#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. |
#define | BET_WINDOW_WIDTH FRENCH_OR(13, COIN_WINDOW_WIDTH) | |
#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. |
#define | SUPER_LUCKY_DICE_TOUCH_DISTANCE 70 | Two dice whose centres come closer than this push each other apart. |
#define | DICE_DOME_RADIUS 200 | The round dome's radius: a die beyond it is turned back inward. |
#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. |
#define | DICE_WINDOW_FLAGS (WINDOW_FLAG_INSTANT | WINDOW_FLAG_UNREAD) | A window of the game's: it opens at once, with no zoom. |
#define | DICE_BET () (gmPartyGetAverageLevelStub() * DICE_BET_PER_LEVEL) | What a throw costs: ten coins per level of the party's average. |
#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. |
#define | SHOW_COINS () | |
#define | OPEN_THROW_HELP () | |
#define | GLOW_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. |
#define | DIM_PALETTE (palette) |
Enumerations
| Name | Description | |
|---|---|---|
enum | SUPER_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. |
enum | SUPER_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). |
enum | SUPER_LUCKY_DICE_PICTURES { DICE_PICTURES_NONE, DICE_PICTURES_HIGHER_LOWER, DICE_PICTURE … } | The pictures a state asks fdSuperLuckyDiceRun to load before the next tick. |
enum | SUPER_LUCKY_DICE_STATE { SUPER_LUCKY_DICE_THROW, SUPER_LUCKY_DICE_GUESS, SUPER_LUCKY_ … } | What the Super Lucky Dice screen is doing. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | fdSuperLuckyDiceStart (void) | Runs Super Lucky Dice, every layer off until it sets up its own display, and returns 0. |
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. |
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. |
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. |
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. |
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. |
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. |
void | fdSuperLuckyDiceRun (void) | Runs Super Lucky Dice until the player quits or cannot afford a throw (DICE_BET). |
Variables
| Name | Description | |
|---|---|---|
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. |
extern Uint8 | MapGridMetatileBuffer [] | The map cell buffer at its own address, which the effects borrow: no map is loaded during a battle. |
extern char | MsgLuckyDiceCoins , 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.
| Enumerator | Value | Description |
|---|---|---|
DICE_PALETTE_FINAL_GAME | 6 | |
DICE_PALETTE_SMALL_DOUBLE_UP | 7 | |
DICE_PALETTE_ORANGE_DIGITS | 8 | |
DICE_PALETTE_TIMES_SIGN | 9 | |
DICE_PALETTE_PINK_DIGITS | 10 | |
DICE_PALETTE_PALE_DIGITS | 11 | the pink digits, paler |
DICE_PALETTE_RELOADED_A | 12 | Higher, or the total's green digits |
DICE_PALETTE_RELOADED_B | 13 | Lower, or the result's banner |
DICE_PALETTE_RELOADED_C | 14 | Double Up, or the glowing number above (Higher/Lower) |
DICE_PALETTE_RELOADED_D | 15 | Cash 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).
| Enumerator | Value | Description |
|---|---|---|
SUPER_LUCKY_DICE_RESULT_LOSE | 0 | "Lose". |
SUPER_LUCKY_DICE_RESULT_WIN | 1 | "Win!", a hi-lo game won. |
SUPER_LUCKY_DICE_RESULT_ONE_PAIR | 2 | |
SUPER_LUCKY_DICE_RESULT_TWO_PAIR | 3 | |
SUPER_LUCKY_DICE_RESULT_TRIPLE | 4 | |
SUPER_LUCKY_DICE_RESULT_PERFECT | 5 | All 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.
| Enumerator | Value | Description |
|---|---|---|
DICE_PICTURES_NONE | -1 | |
DICE_PICTURES_HIGHER_LOWER | 1 | Higher and Lower, and the glowing digits |
DICE_PICTURES_RESULT | 3 | the result's banner and the total's digits |
DICE_PICTURES_DOUBLE_UP | 5 | Double 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.
| Enumerator | Value | Description |
|---|---|---|
SUPER_LUCKY_DICE_THROW | the dice wait to be thrown; A throws, B leaves | |
SUPER_LUCKY_DICE_GUESS | a hi-lo game: higher or lower than this total | |
SUPER_LUCKY_DICE_ROLL | the dice fly, bounce and settle | |
SUPER_LUCKY_DICE_RESULT | the four dice are scored | |
SUPER_LUCKY_DICE_PAYOUT | the winnings are counted into the coins | |
SUPER_LUCKY_DICE_DOUBLE_UP | a 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.