Alchemy

tolbi_spring.c

Tolbi's spring and the game rooms beside it: Lucky Medals or coins tossed into the spring win prizes, and the attendants run Lucky Dice and Lucky Wheels.

games/tbs/src/scene/tolbi_spring.c on GitHub

Tolbi's spring and the game rooms beside it: Lucky Medals or coins tossed into the spring win prizes, and the attendants run Lucky Dice and Lucky Wheels.

Functions

TolbiSpring_GetPlacements

const struct ScenePlacement *TolbiSpring_GetPlacements(void)

Selects the actors for the spring or its nearby games.

Line 114

TolbiSpring_AskAboutLuckyMedal

static void TolbiSpring_AskAboutLuckyMedal(s32 actorId)

Asks whether the party has a Lucky Medal.

Used by gTolbiSpringEvents2.

Line 122

TolbiSpring_AskAboutFirstDiceGame

static void TolbiSpring_AskAboutFirstDiceGame(s32 actorId)

Asks whether this is the party's first Lucky Dice game.

Used by gTolbiSpringEventsOther.

Line 136

TolbiSpring_TossCoinOrMedal

static void TolbiSpring_TossCoinOrMedal(void)

Reveals the spring once, then positions the leader to toss into it.

Used by gTolbiSpringEvents2.

Line 150

TolbiSpring_ReadLuckyWheelsRules

static void TolbiSpring_ReadLuckyWheelsRules(void)

Reads the Lucky Wheels rules sign.

Used by gTolbiSpringEventsOther.

Line 165

TolbiSpring_ReadLuckyWheelsPrizes

static void TolbiSpring_ReadLuckyWheelsPrizes(void)

Reads the Lucky Wheels prize sign.

Used by gTolbiSpringEventsOther.

Line 173

TolbiSpring_GetEvents

const struct SceneEvent *TolbiSpring_GetEvents(void)

Selects interactions for the spring or the game attendants.

Line 185

TolbiSpring_Initialize

s32 TolbiSpring_Initialize(void)

Prepares the spring or settles rewards from the nearby games.

Line 193

TolbiSpring_ShowPrizeFrame

static inline void TolbiSpring_ShowPrizeFrame(s32 sourceColumn, s32 sourceRow)

Displays one frame of the spring's opening or closing prize animation.

Used by TolbiSpring_RevealPrize.

Line 300

TolbiSpring_RevealPrize

static void TolbiSpring_RevealPrize(s32 item)

Animates the spring's prize reveal, gives the item, and closes it.

Used by TolbiSpring_RunSpringGame.

Line 307

TolbiSpring_RiseAndFadeIn

static void TolbiSpring_RiseAndFadeIn(void)

Raises the spring's displayed layer and blends it into view.

Used by TolbiSpring_TossCoinOrMedal.

Line 358

TolbiSpring_OfferLuckyWheels

static void TolbiSpring_OfferLuckyWheels(s32 spoken)

Checks tickets and inventory space before sending the party to Lucky Wheels.

Used by TolbiSpring_Initialize, TolbiSpring_TalkToWheelsAttendant.

Line 379

TolbiSpring_OfferLuckyDice

static void TolbiSpring_OfferLuckyDice(void)

Offers Lucky Dice and saves the coin total for the return visit.

Used by gTolbiSpringEventsOther.

Line 434

TolbiSpring_RunSpringGame

static s32 TolbiSpring_RunSpringGame(void)

Chooses a coin or medal, runs its toss, and awards the resulting prize.

Used by TolbiSpring_TossCoinOrMedal.

Line 486

TolbiSpring_SelectLuckyWheelsPrize

static s32 TolbiSpring_SelectLuckyWheelsPrize(s32 category)

Chooses an item variant in the prize category, avoiding its last variant.

Used by TolbiSpring_Initialize.

Line 734

TolbiSpring_SetActorAppearance

static void TolbiSpring_SetActorAppearance(s32 actorId, const s32 *coordinate, s32 facing, s32 colorVariant, s32 childValue)

Copies three coordinates and sets the actor's facing, child value and colors.

Used by TolbiSpring_UpdateTossSimulation.

Line 759

TolbiSpring_SetSpriteStorageKind

static void TolbiSpring_SetSpriteStorageKind(s32 actorId, s32 storageKind)

Sets whether the specified actor draws its sprite.

Used by TolbiSpring_RunToss, TolbiSpring_UpdateTossSimulation.

Line 802

TolbiSpring_UpdateTossSimulation

static void TolbiSpring_UpdateTossSimulation(void)

Advances the toss, obstacles, collisions and displayed trail each frame.

Used by TolbiSpring_InitializeTossSimulation.

Line 826

TolbiSpring_InitializeTossSimulation

static void TolbiSpring_InitializeTossSimulation(void)

Resets four obstacles and schedules the spring simulation.

Used by TolbiSpring_Initialize.

Line 1229

TolbiSpring_RunToss

static s32 TolbiSpring_RunToss(s32 tossKind)

Launches the chosen coin or medal and waits for its final prize ring.

Used by TolbiSpring_RunSpringGame.

Line 1279

Also, functions without a comment: Io_SetBlendControl, Io_SetBlendAlpha, TolbiSpring_GetEntrances, TolbiSpring_GetRegions, TolbiSpring_GetExits, TolbiSpring_TalkToWheelsAttendant.

Structures

SpringTossMotion

struct SpringTossMotion

The tossed coin or medal: its last four positions for the trail, its velocity and the frames the prize rings still pull it.

FieldDeclared as
unk00u8 unk00[2]
launchFrames16 launchFrame
trailstruct Vector3 trail[4]16.16 fixed-point pixels
shadowstruct Vector3 shadow
velocitystruct Vector3 velocity16.16 fixed-point pixels per frame
attractionFramess32 attractionFrames

Used by TolbiSpring_InitializeTossSimulation, TolbiSpring_RunToss, TolbiSpring_UpdateTossSimulation, sToss.

Line 81

SpringObstacle

struct SpringObstacle

One of the four obstacles moving in the spring during a toss.

FieldDeclared as
positionstruct Vector3 position16.16 fixed-point pixels
headings16 heading
pauseOrPhases16 pauseOrPhase
speedModes16 speedMode
reactionFramess16 reactionFrames
hitCooldownFramess16 hitCooldownFrames
unk16u8 unk16[2]

Used by TolbiSpring_InitializeTossSimulation, TolbiSpring_UpdateTossSimulation, sObstacles.

Line 91

Enumerations

TolbiSpringGameRoomActor

enum TolbiSpringGameRoomActor

The game room's actors, numbered in the order of its placement table from 8.

Value=
TOLBI_SPRING_WHEELS_ATTENDANT8
TOLBI_SPRING_DICE_ATTENDANT9
TOLBI_SPRING_WHEELS_PRIZE_SIGN14
TOLBI_SPRING_WHEELS_RULES_SIGN15
TOLBI_SPRING_SOLDIER17A soldier, gone after Colosso. "poor soldiers like us"

Line 58

TolbiSpringActor

enum TolbiSpringActor

The spring's own actors, numbered the same way.

Value=
TOLBI_SPRING_MEDAL_SEEKER27Asks for a medal. "Do you have a Lucky Medal?"
TOLBI_SPRING_SPRING80searched to toss a coin or medal

Line 68

Also, enumerations without a comment: SpringTossKind.

Macros, without a comment: SPRING_CENTER_X, SPRING_CENTER_Z, ASK_WIDTH, ASK_WIDTH, NUMBER_X, TOSS_X, TOSS_WIDTH, NUMBER_X, TOSS_X, TOSS_WIDTH, NUMBER_X, TOSS_X, TOSS_WIDTH.

Globals

sTossUnknown

static s32 sTossUnknown[3]

Unreferenced toss storage; removing it shifts the obstacle state.

Line 817

gTolbiSpring_AlphaSteps

const u16 gTolbiSpring_AlphaSteps[]

BLDALPHA steps.

Used by TolbiSpring_RiseAndFadeIn.

Line 1462

Also, globals without a comment: sToss, sTossKind, sObstacles, sTossFrame, sTossEnded, sTossResult, gTolbiSpring_Entrances, gTolbiSpring_Exits, gTolbiSpringPlacements2, gTolbiSpringPlacementsOther, gTolbiSpringEventsOther, gTolbiSpringEvents2, gTolbiSpring_PrizeItems, gTolbiSpring_CoinPrizes, gTolbiSpring_LuckyWheelsPrizeItems, gTolbiSpring_SliderFrames, gTolbiSpring_CircleFrames, gTolbiSpring_ActorPixelX, gTolbiSpring_ActorPixelZ, gTolbiSpring_ActorHeadings.

On this page