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.
TolbiSpring_AskAboutLuckyMedal
static void TolbiSpring_AskAboutLuckyMedal(s32 actorId)
Asks whether the party has a Lucky Medal.
Used by gTolbiSpringEvents2.
TolbiSpring_AskAboutFirstDiceGame
static void TolbiSpring_AskAboutFirstDiceGame(s32 actorId)
Asks whether this is the party's first Lucky Dice game.
Used by gTolbiSpringEventsOther.
TolbiSpring_TossCoinOrMedal
static void TolbiSpring_TossCoinOrMedal(void)
Reveals the spring once, then positions the leader to toss into it.
Used by gTolbiSpringEvents2.
TolbiSpring_ReadLuckyWheelsRules
static void TolbiSpring_ReadLuckyWheelsRules(void)
Reads the Lucky Wheels rules sign.
Used by gTolbiSpringEventsOther.
TolbiSpring_ReadLuckyWheelsPrizes
static void TolbiSpring_ReadLuckyWheelsPrizes(void)
Reads the Lucky Wheels prize sign.
Used by gTolbiSpringEventsOther.
TolbiSpring_GetEvents
const struct SceneEvent *TolbiSpring_GetEvents(void)
Selects interactions for the spring or the game attendants.
TolbiSpring_Initialize
s32 TolbiSpring_Initialize(void)
Prepares the spring or settles rewards from the nearby games.
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.
TolbiSpring_RevealPrize
static void TolbiSpring_RevealPrize(s32 item)
Animates the spring's prize reveal, gives the item, and closes it.
Used by TolbiSpring_RunSpringGame.
TolbiSpring_RiseAndFadeIn
static void TolbiSpring_RiseAndFadeIn(void)
Raises the spring's displayed layer and blends it into view.
Used by TolbiSpring_TossCoinOrMedal.
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.
TolbiSpring_OfferLuckyDice
static void TolbiSpring_OfferLuckyDice(void)
Offers Lucky Dice and saves the coin total for the return visit.
Used by gTolbiSpringEventsOther.
TolbiSpring_RunSpringGame
static s32 TolbiSpring_RunSpringGame(void)
Chooses a coin or medal, runs its toss, and awards the resulting prize.
Used by TolbiSpring_TossCoinOrMedal.
TolbiSpring_SelectLuckyWheelsPrize
static s32 TolbiSpring_SelectLuckyWheelsPrize(s32 category)
Chooses an item variant in the prize category, avoiding its last variant.
Used by TolbiSpring_Initialize.
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.
TolbiSpring_SetSpriteStorageKind
static void TolbiSpring_SetSpriteStorageKind(s32 actorId, s32 storageKind)
Sets whether the specified actor draws its sprite.
Used by TolbiSpring_RunToss, TolbiSpring_UpdateTossSimulation.
TolbiSpring_UpdateTossSimulation
static void TolbiSpring_UpdateTossSimulation(void)
Advances the toss, obstacles, collisions and displayed trail each frame.
Used by TolbiSpring_InitializeTossSimulation.
TolbiSpring_InitializeTossSimulation
static void TolbiSpring_InitializeTossSimulation(void)
Resets four obstacles and schedules the spring simulation.
Used by TolbiSpring_Initialize.
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.
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.
| Field | Declared as | |
|---|---|---|
unk00 | u8 unk00[2] | |
launchFrame | s16 launchFrame | |
trail | struct Vector3 trail[4] | 16.16 fixed-point pixels |
shadow | struct Vector3 shadow | |
velocity | struct Vector3 velocity | 16.16 fixed-point pixels per frame |
attractionFrames | s32 attractionFrames |
Used by TolbiSpring_InitializeTossSimulation, TolbiSpring_RunToss, TolbiSpring_UpdateTossSimulation, sToss.
SpringObstacle
struct SpringObstacle
One of the four obstacles moving in the spring during a toss.
| Field | Declared as | |
|---|---|---|
position | struct Vector3 position | 16.16 fixed-point pixels |
heading | s16 heading | |
pauseOrPhase | s16 pauseOrPhase | |
speedMode | s16 speedMode | |
reactionFrames | s16 reactionFrames | |
hitCooldownFrames | s16 hitCooldownFrames | |
unk16 | u8 unk16[2] |
Used by TolbiSpring_InitializeTossSimulation, TolbiSpring_UpdateTossSimulation, sObstacles.
Enumerations
TolbiSpringGameRoomActor
enum TolbiSpringGameRoomActor
The game room's actors, numbered in the order of its placement table from 8.
| Value | = | |
|---|---|---|
TOLBI_SPRING_WHEELS_ATTENDANT | 8 | |
TOLBI_SPRING_DICE_ATTENDANT | 9 | |
TOLBI_SPRING_WHEELS_PRIZE_SIGN | 14 | |
TOLBI_SPRING_WHEELS_RULES_SIGN | 15 | |
TOLBI_SPRING_SOLDIER | 17 | A soldier, gone after Colosso. "poor soldiers like us" |
TolbiSpringActor
enum TolbiSpringActor
The spring's own actors, numbered the same way.
| Value | = | |
|---|---|---|
TOLBI_SPRING_MEDAL_SEEKER | 27 | Asks for a medal. "Do you have a Lucky Medal?" |
TOLBI_SPRING_SPRING | 80 | searched to toss a coin or medal |
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.
gTolbiSpring_AlphaSteps
const u16 gTolbiSpring_AlphaSteps[]
BLDALPHA steps.
Used by TolbiSpring_RiseAndFadeIn.
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.