Skip to Content
The Alchemy Project

include/field/lucky_dice.h

Lucky Dice, the dice game (lucky_dice.c), and the dice types and constants shared with Super Lucky Dice.

Included by lucky_dice.c and super_lucky_dice.h.

Structures

NameDescription
structDICE_PARTICLEA die of the dice game: its place and velocity, 16.16, and its variant.
structDICE_STATEThe dice game's four dice.
structLUCKY_DICE_SPRLucky Dice's state as its drawing reads it: 128 OAM entries and its coins, winnings and help windows.

Macros

NameDescription
#defineDICE_FACE_COUNT 6The dice games' numbers, Lucky Dice's and Super Lucky Dice's alike: a die's faces.
#defineDICE_BET_PER_LEVEL 10A throw costs ten coins for each level of the party's average.
#defineDICE_COIN_DIGITS 6The coins, and Super Lucky Dice's bet, are drawn with six digits.
#defineDICE_FADE_TICKS 16The dice screen fades in and out over 16 ticks, a sixteenth of full brightness a tick.
#defineDICE_NEAREST_DEPTH 350The depths from the camera a die or its shadow is drawn between: nearer or further is drawn as at the limit, and the nearer, the larger.
#defineDICE_FARTHEST_DEPTH 650
#defineDICE_SHADOW_TILE 144Where the dice's shadow starts in OBJ VRAM, in 16-colour tiles (32 bytes, half a 256-colour tile): after the rolling die's eighteen 256-colour views.
#defineDICE_THROW_SPIN 300A thrown die starts spinning at this rate, its roll angle a tick; each bounce takes DICE_BOUNCE_SPIN_LOSS off it.
#defineDICE_BOUNCE_SPIN_LOSS 20
#defineDICE_TILES_PER_FACE 3A die's roll angle (its particle's variant) crosses a face in DICE_TILES_PER_FACE tiles: the tile is angle / DICE_ROLL_PER_TILE and the face angle / DICE_ROLL_PER_FACE.
#defineDICE_ROLL_PER_TILE 1024
#defineDICE_ROLL_PER_FACE (DICE_TILES_PER_FACE * DICE_ROLL_PER_TILE)
#defineDICE_ROLL_TURN (DICE_FACE_COUNT * DICE_ROLL_PER_FACE)six faces
#defineDICE_NEAREST_SCALE 128A die's or a shadow's affine scale at DICE_NEAREST_DEPTH, in 256ths: drawn at twice its size, and smaller the further past it.

Functions

NameDescription
Sint32fdLuckyDiceStart (void)The Lucky Dice module's functions in the order of its stub table (src/field/lucky_dice_stubs.s).

Description

Lucky Dice, the dice game (lucky_dice.c), and the dice types and constants shared with Super Lucky Dice.

Macros in detail

DICE_FACE_COUNT

#define DICE_FACE_COUNT 6

The dice games' numbers, Lucky Dice's and Super Lucky Dice's alike: a die's faces.

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 33 of file lucky_dice.h.

DICE_BET_PER_LEVEL

#define DICE_BET_PER_LEVEL 10

A throw costs ten coins for each level of the party's average.

Referenced by fdLuckyDiceRun().

Definition at line 35 of file lucky_dice.h.

DICE_COIN_DIGITS

#define DICE_COIN_DIGITS 6

The coins, and Super Lucky Dice's bet, are drawn with six digits.

Referenced by fdLuckyDiceRun().

Definition at line 37 of file lucky_dice.h.

DICE_FADE_TICKS

#define DICE_FADE_TICKS 16

The dice screen fades in and out over 16 ticks, a sixteenth of full brightness a tick.

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 40 of file lucky_dice.h.

DICE_NEAREST_DEPTH

#define DICE_NEAREST_DEPTH 350

The depths from the camera a die or its shadow is drawn between: nearer or further is drawn as at the limit, and the nearer, the larger.

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 43 of file lucky_dice.h.

DICE_FARTHEST_DEPTH

#define DICE_FARTHEST_DEPTH 650

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 44 of file lucky_dice.h.

DICE_SHADOW_TILE

#define DICE_SHADOW_TILE 144

Where the dice's shadow starts in OBJ VRAM, in 16-colour tiles (32 bytes, half a 256-colour tile): after the rolling die's eighteen 256-colour views.

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 47 of file lucky_dice.h.

DICE_THROW_SPIN

#define DICE_THROW_SPIN 300

A thrown die starts spinning at this rate, its roll angle a tick; each bounce takes DICE_BOUNCE_SPIN_LOSS off it.

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 50 of file lucky_dice.h.

DICE_BOUNCE_SPIN_LOSS

#define DICE_BOUNCE_SPIN_LOSS 20

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 51 of file lucky_dice.h.

DICE_TILES_PER_FACE

#define DICE_TILES_PER_FACE 3

A die's roll angle (its particle's variant) crosses a face in DICE_TILES_PER_FACE tiles: the tile is angle / DICE_ROLL_PER_TILE and the face angle / DICE_ROLL_PER_FACE. It is the die's own unit, a whole roll DICE_ROLL_TURN, not a TRIG_TURN angle.

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 56 of file lucky_dice.h.

DICE_ROLL_PER_TILE

#define DICE_ROLL_PER_TILE 1024

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 57 of file lucky_dice.h.

DICE_ROLL_PER_FACE

#define DICE_ROLL_PER_FACE (DICE_TILES_PER_FACE * DICE_ROLL_PER_TILE)

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 58 of file lucky_dice.h.

DICE_ROLL_TURN

#define DICE_ROLL_TURN (DICE_FACE_COUNT * DICE_ROLL_PER_FACE)

six faces

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 59 of file lucky_dice.h.

DICE_NEAREST_SCALE

#define DICE_NEAREST_SCALE 128

A die's or a shadow's affine scale at DICE_NEAREST_DEPTH, in 256ths: drawn at twice its size, and smaller the further past it.

Referenced by fdLuckyDiceRun() and fdSuperLuckyDiceRun().

Definition at line 62 of file lucky_dice.h.