Alchemy
Loading...
Searching...
No Matches

lucky_dice.h File Reference

Go to the source code of this file.

Functions

s32 Runtime_BlankDisplayAndRun (void)
 Starts the Lucky Dice minigame: leaves only the backdrop on screen, starts song MUS_009 and plays until the player quits.
void Camera_ResetSceneDefaults (void)
 Puts the 3D camera back at its scene defaults: at the origin, unturned, pitched to 152 and 510 units away, following nothing.
s32 FixedPoint_Multiply8_8 (s32 leftValue, s32 rightValue)
 Multiplies two 8.8 fixed-point values, rounding toward zero.
s16 Math_ScaleByRatio (s16 numerator, s16 denominator)
 Divides two 8.8 fixed-point values.
s16 FixedPoint_Reciprocal (s16 value)
 The reciprocal of an 8.8 fixed-point value.
s32 Graphics_ScaleRgb555Buffer (u16 *source, u16 *destination, s32 scale, s32 count)
 Copies count RGB555 colours from source to destination with each channel multiplied by scale (16.16: 0 is black, 0x10000 unchanged), for fades.
void LuckyDice_Run (void)
 Runs the Lucky Dice minigame until the player quits or cannot afford a throw.

Variables

const s32 gLuckyDice_UnusedSigns []
const u8 gLuckyDice_LabelCounts []
 How many sprites each kind of result's lettering takes.
const u8 gLuckyDice_LabelTiles []
 The first tile of each kind of result's lettering.
const u8 gLuckyDice_FaceTiles []
 The die face tile at each step of its roll.
const s16 gLuckyDice_FaceHeights []
 The heights that decide the face (z > value << 16).

Function Documentation

◆ Runtime_BlankDisplayAndRun()

s32 Runtime_BlankDisplayAndRun ( void )

Starts the Lucky Dice minigame: leaves only the backdrop on screen, starts song MUS_009 and plays until the player quits.

Returns 0. Reached through Runtime_BlankDisplayAndRunFar from RunLuckyDice (object/object/scene.c), which saves background palettes 14 and 15 around it and passes an entrance this function does not take.

Definition at line 31 of file lucky_dice.c.

Referenced by Runtime_BlankDisplayAndRun().

◆ Camera_ResetSceneDefaults()

void Camera_ResetSceneDefaults ( void )

Puts the 3D camera back at its scene defaults: at the origin, unturned, pitched to 152 and 510 units away, following nothing.

Recomputes the eye and sets the projection's focal length (250), near plane and far plane. Called only by LuckyDice_Run, once the camera's heap block is allocated; writes gCameraWork's fields and gProjection.

Definition at line 43 of file lucky_dice.c.

Referenced by Camera_ResetSceneDefaults(), and LuckyDice_Run().

◆ FixedPoint_Multiply8_8()

s32 FixedPoint_Multiply8_8 ( s32 leftValue,
s32 rightValue )

Multiplies two 8.8 fixed-point values, rounding toward zero.

Definition at line 77 of file lucky_dice.c.

Referenced by FixedPoint_Multiply8_8().

◆ Math_ScaleByRatio()

s16 Math_ScaleByRatio ( s16 numerator,
s16 denominator )

Divides two 8.8 fixed-point values.

Definition at line 99 of file lucky_dice.c.

Referenced by Math_ScaleByRatio().

◆ FixedPoint_Reciprocal()

s16 FixedPoint_Reciprocal ( s16 value)

The reciprocal of an 8.8 fixed-point value.

Definition at line 109 of file lucky_dice.c.

Referenced by FixedPoint_Reciprocal().

◆ Graphics_ScaleRgb555Buffer()

s32 Graphics_ScaleRgb555Buffer ( u16 * source,
u16 * destination,
s32 scale,
s32 count )

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

Returns 0. Called only by LuckyDice_Run, to fade both palettes in and out.

Definition at line 208 of file lucky_dice.c.

Referenced by Graphics_ScaleRgb555Buffer(), and LuckyDice_Run().

◆ LuckyDice_Run()

void LuckyDice_Run ( void )

Runs the Lucky Dice minigame until the player quits or cannot afford a throw.

Each throw costs ten coins per level of the party's average. Two dice are thrown onto a board of six rows; each die's face and the row it stops in give four numbers. Four of a kind pays 5 times the bet (15 or 25 times when it matches one of the two lucky numbers shown at the top), three of a kind 3 times, two pairs twice and one pair the bet back. Called by Runtime_BlankDisplayAndRun. Takes the bet from and pays the winnings into gGameState.coins, resets the scheduler's task table, and frees the five heap slots it allocates before it returns.

Definition at line 252 of file lucky_dice.c.

Referenced by LuckyDice_Run(), and Runtime_BlankDisplayAndRun().

Variable Documentation

◆ gLuckyDice_UnusedSigns

const s32 gLuckyDice_UnusedSigns[]
extern

Definition at line 6 of file tables.h.

◆ gLuckyDice_LabelCounts

const u8 gLuckyDice_LabelCounts[]
extern

How many sprites each kind of result's lettering takes.

Definition at line 9 of file tables.h.

Referenced by LuckyDice_Run().

◆ gLuckyDice_LabelTiles

const u8 gLuckyDice_LabelTiles[]
extern

The first tile of each kind of result's lettering.

Definition at line 12 of file tables.h.

Referenced by LuckyDice_Run().

◆ gLuckyDice_FaceTiles

const u8 gLuckyDice_FaceTiles[]
extern

The die face tile at each step of its roll.

Definition at line 21 of file tables.h.

Referenced by LuckyDice_Run().

◆ gLuckyDice_FaceHeights

const s16 gLuckyDice_FaceHeights[]
extern

The heights that decide the face (z > value << 16).

Definition at line 25 of file tables.h.

Referenced by LuckyDice_Run().