Alchemy
Loading...
Searching...
No Matches

lucky_dice.c File Reference

Go to the source code of this file.

Data Structures

struct  LuckyDiceSprites
 The used prefix of Lucky Dice's 0x618-byte work block (heap slot 45): its sprites and windows. More...

Macros

#define DICE_COIN_X   18
#define DICE_COIN_W   12
#define DICE_WIN_W   12
#define DICE_LABEL_X   48
#define DICE_HELP_X   22
#define DICE_HELP_W   8
#define DICE_WIN_X   9
#define DICE_WIN_NUM_X   48
#define DICE_WIN_LABEL_X   DICE_LABEL_X
#define DICE_KIND_X   0x278
#define DICE_COUNT   2
#define DICE_FACE_COUNT   6
#define DICE_RESULT_COUNT   4
#define DICE_BET_PER_LEVEL   10

Enumerations

enum  LuckyDiceState { LUCKY_DICE_AIM , LUCKY_DICE_ROLL , LUCKY_DICE_RESULT , LUCKY_DICE_PAYOUT }
 What the Lucky Dice screen is doing. More...

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.
UNUSED s32 FixedPoint_Multiply8_8 (s32 leftValue, s32 rightValue)
 Multiplies two 8.8 fixed-point values, rounding toward zero.
UNUSED s16 Math_ScaleByRatio (s16 numerator, s16 denominator)
 Divides two 8.8 fixed-point values.
UNUSED 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.

Macro Definition Documentation

◆ DICE_COIN_X

#define DICE_COIN_X   18

Definition at line 135 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_COIN_W

#define DICE_COIN_W   12

Definition at line 136 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_WIN_W

#define DICE_WIN_W   12

Definition at line 137 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_LABEL_X

#define DICE_LABEL_X   48

Definition at line 149 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_HELP_X

#define DICE_HELP_X   22

Definition at line 159 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_HELP_W

#define DICE_HELP_W   8

Definition at line 160 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_WIN_X

#define DICE_WIN_X   9

Definition at line 167 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_WIN_NUM_X

#define DICE_WIN_NUM_X   48

Definition at line 168 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_WIN_LABEL_X

#define DICE_WIN_LABEL_X   DICE_LABEL_X

Definition at line 169 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_KIND_X

#define DICE_KIND_X   0x278

Definition at line 170 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_COUNT

#define DICE_COUNT   2

Definition at line 192 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_FACE_COUNT

#define DICE_FACE_COUNT   6

Definition at line 193 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_RESULT_COUNT

#define DICE_RESULT_COUNT   4

Definition at line 194 of file lucky_dice.c.

Referenced by LuckyDice_Run().

◆ DICE_BET_PER_LEVEL

#define DICE_BET_PER_LEVEL   10

Definition at line 195 of file lucky_dice.c.

Referenced by LuckyDice_Run().

Enumeration Type Documentation

◆ LuckyDiceState

What the Lucky Dice screen is doing.

Enumerator
LUCKY_DICE_AIM 

the dice wait to be thrown; Up and Down raise them

LUCKY_DICE_ROLL 

the dice fly, bounce and settle

LUCKY_DICE_RESULT 

the four numbers and the result are shown

LUCKY_DICE_PAYOUT 

the winnings move into the coins

Definition at line 198 of file lucky_dice.c.

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()

UNUSED 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()

UNUSED 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()

UNUSED 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().