Alchemy
Loading...
Searching...
No Matches

tolbi.c File Reference

Tolbi, the town of the Colosso festival. More...

Go to the source code of this file.

Macros

#define TOLBI_JAR_SEARCH_KIND   (SEARCH(SEARCH_JAR) | EVENT_TOUCH_FACING | FACING_NORTH)

Functions

static void Tolbi_FreezePuddle (void)
 Frost on the puddle: the frozen pillar is drawn underfoot and stops following the terrain, and its map cell becomes solid.
static void Tolbi_JoinEmber (void)
 Talking to Ember, the Mars Djinni hiding in town, makes it join the party.
static s32 Tolbi_KidStopForTarget (struct FieldActor *kid, struct FieldActor *target, s32 range, s32 force)
 Stops a running child when the target is close by and ahead of it, or always when force is set; otherwise starts the child running again.
static s32 Tolbi_UpdateKid (union FieldObject *fieldObject)
const struct SceneEntrance * Tolbi_GetEntrances (void)
const struct SceneRegion * Tolbi_GetRegions (void)
const u32 * Tolbi_GetExits (void)
const struct ScenePlacement * Tolbi_GetPlacements (void)
static void Tolbi_GrowSprout (void)
 Growth on the sprout: the grown plant no longer blocks the party, and its map cell becomes climbable.
static void Tolbi_RevealHiddenChest (void)
 Reveal uncovers the hidden chest: its map cell is drawn in and the chest moves into place.
static void Tolbi_HideRevealedChest (void)
 When Reveal wears off, the chest's cell is covered again and the chest moves out of sight.
static void Tolbi_ReadSpringSign (void)
 The first sign at Tolbi Spring: face away and toss a coin in.
static void Tolbi_ReadLuckyMedalSign (void)
 The second sign at Tolbi Spring: a Lucky Medal wins better prizes.
static void Tolbi_TalkToOlderBrother (void)
 Talking to the older brother, or reading his mind.
static void Tolbi_TalkToYoungerSibling (void)
 Talking to the younger sibling, or reading the child's mind, as above.
const struct SceneEvent * Tolbi_SelectEvents (void)
 Picks the event table for Tolbi's current mood.
static void Tolbi_AskAboutLivingPastHundred (void)
 A townsperson asks whether someone can live to be more than 100 years old; either way the talk turns to Babi, who is older still.
static void Tolbi_TalkToFather (void)
 The father asks whether children really do love souvenirs, and owns up to loving them himself.
static void Tolbi_TalkToMother (void)
 The mother turns to her crying child, then back to promise better sweets later on.
static void Tolbi_TalkToCryingChild (void)
 The crying child turns, stamps twice and wails for sweets.
static void Tolbi_TalkToSleepingScalper (void)
 During the festival the scalper sleeps under the archway: the inns are full.
static void Tolbi_AskWhetherPartyWasInFinals (void)
 After Colosso, actor 12 asks whether the party was in the finals.
static void Tolbi_TalkToSnackVendor (void)
 After Colosso, the snack vendor gives the party her leftover corn, once.
static void Tolbi_EnterDoor (void)
 Walking into one of the town's doors: the door opens, the leader steps in (except at the seventh door) and the scene changes to the door's exit.
static void Tolbi_CopyLeaderPriority (union FieldObject *object)
 The update of actor 14: gives it the leader's sprite priority every frame, for both of its sprite parts.
s32 Tolbi_ApplyEntryState (s32 unused)
 Sets up the scene on entry: the running children, actor 14's update, and everything the flags have already changed.
static void Tolbi_TalkToGambler (void)
 The gambler at the spring's gate asks whether the party wants to test its luck.
static void Tolbi_EnterSpring (void)
 The gate to Tolbi Spring, once the gambler has stepped aside.
static void Tolbi_RequestTouchedExit (void)
 Leaves by the exit numbered as the trigger the party walked into.
static void Tolbi_MeetSearchingSoldiers (void)
 During the festival, two soldiers searching for the missing Babi stop the party and show his picture.

Variables

s32 gTolbiMirroredActor []
 The action script of a mirrored actor: flips its sprite and passes 7 on.
s32 gTolbiOlderBrotherRun []
 The older brother runs a loop of eight points around the plaza.
s32 gTolbiYoungerSiblingRun []
 The younger sibling runs the same loop half a lap ahead.
struct SceneEntrance gTolbiEntrances []
u32 gTolbiExits []
struct ScenePlacement gTolbiPlacements []
struct SceneEvent gTolbiEventsFestival []
 During the festival, before the finals.
struct SceneEvent gTolbiEventsFinalsDay []
 On finals day.
struct SceneEvent gTolbiEventsAfterColosso []
 After Colosso has ended.
u16 gTolbiDoorOpening []
 How a door opens: two frames of cells copied over the closed door.
struct MapCellAnim gTolbiDoors []
 The doors, in the order of their triggers 1 to 9, by map cell.

Detailed Description

Tolbi, the town of the Colosso festival.

The town has three moods, chosen by story flags: the festival during the trials, finals day, and the quiet after Colosso has ended. Each mood has its own event table; the actors and their scripts are shared.

Definition in file tolbi.c.

Macro Definition Documentation

◆ TOLBI_JAR_SEARCH_KIND

#define TOLBI_JAR_SEARCH_KIND   (SEARCH(SEARCH_JAR) | EVENT_TOUCH_FACING | FACING_NORTH)

Definition at line 28 of file tolbi.c.

Function Documentation

◆ Tolbi_FreezePuddle()

void Tolbi_FreezePuddle ( void )
static

Frost on the puddle: the frozen pillar is drawn underfoot and stops following the terrain, and its map cell becomes solid.

Definition at line 603 of file tolbi.c.

Referenced by Tolbi_ApplyEntryState(), and Tolbi_FreezePuddle().

◆ Tolbi_JoinEmber()

void Tolbi_JoinEmber ( void )
static

Talking to Ember, the Mars Djinni hiding in town, makes it join the party.

Its index among the Mars Djinn is 4, the fifth Mars name in the game text.

Definition at line 38 of file tolbi.c.

Referenced by Tolbi_JoinEmber().

◆ Tolbi_KidStopForTarget()

s32 Tolbi_KidStopForTarget ( struct FieldActor * kid,
struct FieldActor * target,
s32 range,
s32 force )
static

Stops a running child when the target is close by and ahead of it, or always when force is set; otherwise starts the child running again.

The child stops when the target is within one facing step of where it looks; for the party leader, within two steps either side. Returns 1 when the child stopped.

Definition at line 49 of file tolbi.c.

Referenced by Tolbi_KidStopForTarget(), and Tolbi_UpdateKid().

◆ Tolbi_UpdateKid()

s32 Tolbi_UpdateKid ( union FieldObject * fieldObject)
static

Definition at line 94 of file tolbi.c.

Referenced by Tolbi_ApplyEntryState(), and Tolbi_UpdateKid().

◆ Tolbi_GetEntrances()

const struct SceneEntrance * Tolbi_GetEntrances ( void )

Definition at line 137 of file tolbi.c.

Referenced by Tolbi_GetEntrances().

◆ Tolbi_GetRegions()

const struct SceneRegion * Tolbi_GetRegions ( void )

Definition at line 139 of file tolbi.c.

Referenced by Tolbi_GetRegions().

◆ Tolbi_GetExits()

const u32 * Tolbi_GetExits ( void )

Definition at line 141 of file tolbi.c.

Referenced by Tolbi_GetExits().

◆ Tolbi_GetPlacements()

const struct ScenePlacement * Tolbi_GetPlacements ( void )

Definition at line 143 of file tolbi.c.

Referenced by Tolbi_GetPlacements().

◆ Tolbi_GrowSprout()

void Tolbi_GrowSprout ( void )
static

Growth on the sprout: the grown plant no longer blocks the party, and its map cell becomes climbable.

Definition at line 149 of file tolbi.c.

Referenced by Tolbi_ApplyEntryState(), and Tolbi_GrowSprout().

◆ Tolbi_RevealHiddenChest()

void Tolbi_RevealHiddenChest ( void )
static

Reveal uncovers the hidden chest: its map cell is drawn in and the chest moves into place.

Definition at line 164 of file tolbi.c.

Referenced by Tolbi_RevealHiddenChest().

◆ Tolbi_HideRevealedChest()

void Tolbi_HideRevealedChest ( void )
static

When Reveal wears off, the chest's cell is covered again and the chest moves out of sight.

Definition at line 171 of file tolbi.c.

Referenced by Tolbi_HideRevealedChest().

◆ Tolbi_ReadSpringSign()

void Tolbi_ReadSpringSign ( void )
static

The first sign at Tolbi Spring: face away and toss a coin in.

Definition at line 177 of file tolbi.c.

Referenced by Tolbi_ReadSpringSign().

◆ Tolbi_ReadLuckyMedalSign()

void Tolbi_ReadLuckyMedalSign ( void )
static

The second sign at Tolbi Spring: a Lucky Medal wins better prizes.

Definition at line 183 of file tolbi.c.

Referenced by Tolbi_ReadLuckyMedalSign().

◆ Tolbi_TalkToOlderBrother()

void Tolbi_TalkToOlderBrother ( void )
static

Talking to the older brother, or reading his mind.

He stops running while he speaks, then turns back the way he was going.

Definition at line 190 of file tolbi.c.

Referenced by Tolbi_TalkToOlderBrother().

◆ Tolbi_TalkToYoungerSibling()

void Tolbi_TalkToYoungerSibling ( void )
static

Talking to the younger sibling, or reading the child's mind, as above.

Definition at line 228 of file tolbi.c.

Referenced by Tolbi_TalkToYoungerSibling().

◆ Tolbi_SelectEvents()

const struct SceneEvent * Tolbi_SelectEvents ( void )

Picks the event table for Tolbi's current mood.

Definition at line 266 of file tolbi.c.

Referenced by Tolbi_SelectEvents().

◆ Tolbi_AskAboutLivingPastHundred()

void Tolbi_AskAboutLivingPastHundred ( void )
static

A townsperson asks whether someone can live to be more than 100 years old; either way the talk turns to Babi, who is older still.

Definition at line 278 of file tolbi.c.

Referenced by Tolbi_AskAboutLivingPastHundred().

◆ Tolbi_TalkToFather()

void Tolbi_TalkToFather ( void )
static

The father asks whether children really do love souvenirs, and owns up to loving them himself.

Definition at line 287 of file tolbi.c.

Referenced by Tolbi_TalkToFather().

◆ Tolbi_TalkToMother()

void Tolbi_TalkToMother ( void )
static

The mother turns to her crying child, then back to promise better sweets later on.

"Be patient, little guy."

Definition at line 296 of file tolbi.c.

Referenced by Tolbi_TalkToMother().

◆ Tolbi_TalkToCryingChild()

void Tolbi_TalkToCryingChild ( void )
static

The crying child turns, stamps twice and wails for sweets.

Definition at line 307 of file tolbi.c.

Referenced by Tolbi_TalkToCryingChild().

◆ Tolbi_TalkToSleepingScalper()

void Tolbi_TalkToSleepingScalper ( void )
static

During the festival the scalper sleeps under the archway: the inns are full.

Definition at line 318 of file tolbi.c.

Referenced by Tolbi_TalkToSleepingScalper().

◆ Tolbi_AskWhetherPartyWasInFinals()

void Tolbi_AskWhetherPartyWasInFinals ( void )
static

After Colosso, actor 12 asks whether the party was in the finals.

The question is anchored to the father, who has left town by then.

Definition at line 327 of file tolbi.c.

Referenced by Tolbi_AskWhetherPartyWasInFinals().

◆ Tolbi_TalkToSnackVendor()

void Tolbi_TalkToSnackVendor ( void )
static

After Colosso, the snack vendor gives the party her leftover corn, once.

Definition at line 335 of file tolbi.c.

Referenced by Tolbi_TalkToSnackVendor().

◆ Tolbi_EnterDoor()

void Tolbi_EnterDoor ( void )
static

Walking into one of the town's doors: the door opens, the leader steps in (except at the seventh door) and the scene changes to the door's exit.

Definition at line 354 of file tolbi.c.

Referenced by Tolbi_EnterDoor().

◆ Tolbi_CopyLeaderPriority()

void Tolbi_CopyLeaderPriority ( union FieldObject * object)
static

The update of actor 14: gives it the leader's sprite priority every frame, for both of its sprite parts.

Definition at line 385 of file tolbi.c.

Referenced by Tolbi_ApplyEntryState(), and Tolbi_CopyLeaderPriority().

◆ Tolbi_ApplyEntryState()

s32 Tolbi_ApplyEntryState ( s32 unused)

Sets up the scene on entry: the running children, actor 14's update, and everything the flags have already changed.

Definition at line 398 of file tolbi.c.

Referenced by Tolbi_ApplyEntryState().

◆ Tolbi_TalkToGambler()

void Tolbi_TalkToGambler ( void )
static

The gambler at the spring's gate asks whether the party wants to test its luck.

On yes he steps aside for good and the way to Tolbi Spring opens.

Definition at line 461 of file tolbi.c.

Referenced by Tolbi_TalkToGambler().

◆ Tolbi_EnterSpring()

void Tolbi_EnterSpring ( void )
static

The gate to Tolbi Spring, once the gambler has stepped aside.

Definition at line 485 of file tolbi.c.

Referenced by Tolbi_EnterSpring().

◆ Tolbi_RequestTouchedExit()

void Tolbi_RequestTouchedExit ( void )
static

Leaves by the exit numbered as the trigger the party walked into.

Definition at line 491 of file tolbi.c.

Referenced by Tolbi_RequestTouchedExit().

◆ Tolbi_MeetSearchingSoldiers()

void Tolbi_MeetSearchingSoldiers ( void )
static

During the festival, two soldiers searching for the missing Babi stop the party and show his picture.

They leave either way the party answers.

Definition at line 499 of file tolbi.c.

Referenced by Tolbi_MeetSearchingSoldiers().

Variable Documentation

◆ gTolbiMirroredActor

s32 gTolbiMirroredActor[]
Initial value:
= {
SC_SET(SW_SCALE_X, -0x10000),
SC_ARG(7),
}
#define SC_SET(w, v)
Write a work value.
Definition objcmd.h:37
#define SC_ARG(v)
Definition objcmd.h:44
#define SC_END
Return to the main script.
Definition objcmd.h:32
@ SW_SCALE_X
Definition objcmd.h:62

The action script of a mirrored actor: flips its sprite and passes 7 on.

Definition at line 618 of file tolbi.c.

◆ gTolbiOlderBrotherRun

s32 gTolbiOlderBrotherRun[]
Initial value:
= {
SC_ARG(2),
SC_SET(SW_SPEED, 0xcccc),
SC_SET(SW_ACCEL, 0x3333),
SC_MOVE(PIXELS(352), 0, PIXELS(352)),
SC_MOVE(PIXELS(368), 0, PIXELS(352)),
SC_MOVE(PIXELS(376), 0, PIXELS(344)),
SC_MOVE(PIXELS(376), 0, PIXELS(328)),
SC_MOVE(PIXELS(368), 0, PIXELS(320)),
SC_MOVE(PIXELS(352), 0, PIXELS(320)),
SC_MOVE(PIXELS(344), 0, PIXELS(328)),
SC_MOVE(PIXELS(344), 0, PIXELS(344)),
}
#define PIXELS(value)
#define SC_LABEL(n)
Branch destination.
Definition objcmd.h:11
#define SC_LOOP(n, to)
Repeat up to n times.
Definition objcmd.h:28
#define SC_SYNC
Wait for arrival.
Definition objcmd.h:17
#define SC_FOREVER
Definition objcmd.h:14
#define SC_TO(n)
Definition objcmd.h:12
#define SC_MOVE(x, y, z)
Move toward the target.
Definition objcmd.h:19
@ SW_ACCEL
Definition objcmd.h:68
@ SW_SPEED
Definition objcmd.h:67

The older brother runs a loop of eight points around the plaza.

Definition at line 625 of file tolbi.c.

Referenced by Tolbi_ApplyEntryState().

◆ gTolbiYoungerSiblingRun

s32 gTolbiYoungerSiblingRun[]
Initial value:
= {
SC_ARG(2),
SC_SET(SW_SPEED, 0xcccc),
SC_SET(SW_ACCEL, 0x3333),
SC_MOVE(PIXELS(368), 0, PIXELS(320)),
SC_MOVE(PIXELS(352), 0, PIXELS(320)),
SC_MOVE(PIXELS(344), 0, PIXELS(328)),
SC_MOVE(PIXELS(344), 0, PIXELS(344)),
SC_MOVE(PIXELS(352), 0, PIXELS(352)),
SC_MOVE(PIXELS(368), 0, PIXELS(352)),
SC_MOVE(PIXELS(376), 0, PIXELS(344)),
SC_MOVE(PIXELS(376), 0, PIXELS(328)),
}

The younger sibling runs the same loop half a lap ahead.

Definition at line 650 of file tolbi.c.

Referenced by Tolbi_ApplyEntryState().

◆ gTolbiEntrances

struct SceneEntrance gTolbiEntrances[]
Initial value:
= {
{0, CONDITION_ALWAYS, 296, 0, 232, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{1, CONDITION_ALWAYS, 304, 0, 448, FACING_NORTH, 0, -1, -1, -1, -1, 0},
{2, CONDITION_ALWAYS, 168, 0, 200, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{3, CONDITION_ALWAYS, 408, 0, 160, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{4, CONDITION_ALWAYS, 536, 0, 232, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{5, CONDITION_ALWAYS, 536, 0, 200, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{6, CONDITION_ALWAYS, 456, 0, 376, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{7, CONDITION_ALWAYS, 368, 0, 416, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{8, CONDITION_ALWAYS, 200, 0, 456, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{9, CONDITION_ALWAYS, 200, 0, 424, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{10, CONDITION_ALWAYS, 88, 0, 392, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{11, CONDITION_ALWAYS, 64, 0, 112, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{12, CONDITION_ALWAYS, 304, 0, 64, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{13, CONDITION_ALWAYS, 424, 0, 224, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{20, CONDITION_ALWAYS, 304, 0, 304, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{30, CONDITION_ALWAYS, 568, 0, 296, FACING_NORTH, 0, -1, -1, -1, -1, 0},
}
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ FACING_NORTH
Definition field_scene.h:32
@ FACING_SOUTH
Definition field_scene.h:28

Definition at line 674 of file tolbi.c.

Referenced by Tolbi_GetEntrances().

◆ gTolbiExits

u32 gTolbiExits[]
Initial value:
= {
SCENE_EXITS(135), SCENE_EXIT(1, 136, 4), SCENE_EXIT(2, 136, 2),
SCENE_EXIT(3, 136, 9), SCENE_EXIT(4, 137, 11), SCENE_EXIT(5, 136, 1),
SCENE_EXIT(6, 136, 3), SCENE_EXIT(7, 136, 6), SCENE_EXIT(8, 136, 5),
SCENE_EXIT(9, 136, 8), SCENE_EXIT(10, 139, 1), SCENE_EXIT(11, 142, 1),
SCENE_EXIT(12, 2, 23), SCENE_EXIT(13, 137, 10), SCENE_EXIT(30, 189, 1),
}
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#define SCENE_EXIT(exit, scene, entrance)
Definition field_scene.h:73
#define SCENE_EXITS_END
Definition field_scene.h:77

Definition at line 694 of file tolbi.c.

Referenced by Tolbi_GetExits().

◆ gTolbiPlacements

struct ScenePlacement gTolbiPlacements[]

Definition at line 704 of file tolbi.c.

Referenced by Tolbi_GetPlacements().

◆ gTolbiEventsFestival

struct SceneEvent gTolbiEventsFestival[]

During the festival, before the finals.

Definition at line 760 of file tolbi.c.

Referenced by Tolbi_SelectEvents().

◆ gTolbiEventsFinalsDay

struct SceneEvent gTolbiEventsFinalsDay[]

On finals day.

Definition at line 829 of file tolbi.c.

Referenced by Tolbi_SelectEvents().

◆ gTolbiEventsAfterColosso

struct SceneEvent gTolbiEventsAfterColosso[]

After Colosso has ended.

Definition at line 896 of file tolbi.c.

Referenced by Tolbi_SelectEvents().

◆ gTolbiDoorOpening

u16 gTolbiDoorOpening[]
Initial value:
= {
MAP_CELL_STEP(39, 32, 1, 2, 6),
MAP_CELL_STEP(40, 32, 1, 2, 6),
}
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
Definition field_event.h:59
#define MAP_CELL_STEPS_END
Definition field_event.h:61

How a door opens: two frames of cells copied over the closed door.

Definition at line 950 of file tolbi.c.

◆ gTolbiDoors

struct MapCellAnim gTolbiDoors[]
Initial value:
= {
{gTolbiDoorOpening, 66, 21}, {gTolbiDoorOpening, 61, 24},
{gTolbiDoorOpening, 50, 26}, {gTolbiDoorOpening, 50, 22},
{gTolbiDoorOpening, 43, 20},
}
u16 gTolbiDoorOpening[]
How a door opens: two frames of cells copied over the closed door.
Definition tolbi.c:950

The doors, in the order of their triggers 1 to 9, by map cell.

Definition at line 957 of file tolbi.c.

Referenced by Tolbi_EnterDoor().