18#include "text/msg_ids.h"
28#define TOLBI_JAR_SEARCH_KIND \
29 (SEARCH(SEARCH_JAR) | EVENT_TOUCH_FACING | FACING_NORTH)
31#define TOLBI_JAR_SEARCH_KIND SEARCH(SEARCH_JAR)
56 if (FixedPoint_Distance(targetPos, kidPos) < range || force != 0) {
59 *(
const s32 *)targetPos - *(
const s32 *)kidPos);
64 u32 ahead = heading & 0xf000;
67 if (ahead == facing || right == facing || left == facing || force != 0) {
73 (farRight == facing || farLeft == facing)) {
99 u8 *work12 = workAreas[12];
153 if ((
s32)sprout != 0) {
200 if (
work->psynergyRequest == 0) {
202 msg = MsgTolbiYayEasyRun;
204 msg = MsgTolbiHoorayFinalsSeven;
206 msg = MsgTolbiWheeFestivalColosso;
210 msg = MsgTolbiMainStreetTolbi;
212 msg = MsgTolbiWinBigUsed;
214 msg = MsgTolbiOldestShouldntShare;
238 if (
work->psynergyRequest == 0) {
240 msg = MsgTolbiHaHaHa;
242 msg = MsgTolbiWaahBigBrother;
244 msg = MsgTolbiWaahSaidMoney;
248 msg = MsgTolbiBrotherMeanDuring;
250 msg = MsgTolbiMamaWhyListen;
252 msg = MsgTolbiMamaToldShare;
366 door =
work->touchedTrigger - 1;
388 if (
object !=
NULL) {
391 object->actor.sprite->image.priority = priority;
392 object->actor.sprite->shadow.priority = priority;
506 firstMsg = MsgTolbiSeenAnyoneWho;
675 {0,
CONDITION_ALWAYS, 296, 0, 232,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
676 {1,
CONDITION_ALWAYS, 304, 0, 448,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
677 {2,
CONDITION_ALWAYS, 168, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
678 {3,
CONDITION_ALWAYS, 408, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
679 {4,
CONDITION_ALWAYS, 536, 0, 232,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
680 {5,
CONDITION_ALWAYS, 536, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
681 {6,
CONDITION_ALWAYS, 456, 0, 376,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
682 {7,
CONDITION_ALWAYS, 368, 0, 416,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
683 {8,
CONDITION_ALWAYS, 200, 0, 456,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
684 {9,
CONDITION_ALWAYS, 200, 0, 424,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
685 {10,
CONDITION_ALWAYS, 88, 0, 392,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
686 {11,
CONDITION_ALWAYS, 64, 0, 112,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
687 {12,
CONDITION_ALWAYS, 304, 0, 64,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
688 {13,
CONDITION_ALWAYS, 424, 0, 224,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
689 {20,
CONDITION_ALWAYS, 304, 0, 304,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
690 {30,
CONDITION_ALWAYS, 568, 0, 296,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
Ability numbers, named from the English release.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
Calls through a function pointer, by argument count.
void Djinn_JoinParty(s32 slot, s32 element, s32 djinn)
A Djinni joins the party: djinn (0 to 19) of element goes to the member with the fewest Djinn,...
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
static s32 Event_OpenMessage(s32 speaker, s32 flags)
void Engine_ActorFaceActor(s32 actor, s32 target, s32 frames)
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Object_SetMode(struct FieldActor *object, s32 animation)
static void Map_AnimateCells(const u16 *steps, s32 destX, s32 destY)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
s32 Engine_PartyGiveItem(s32 item, s32 flags)
void Engine_EventShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
void Engine_ItemShowFound(s32 item, s32 height)
void Engine_ActorSetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ActorWalkToAndWait(s32 actor, s32 x, s32 z)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
s32 Engine_EventAskYesNo(s32 speaker, s32 flags)
void Engine_GameFlagSet(s32 flag)
static void Actor_SetActionScript(s32 actor, const s32 *script)
The engine encodes either a built-in action or an action-script address.
void Engine_ActorWaitForMove(s32 actor)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
void Engine_ActorWalkTo(s32 actor, s32 x, s32 z)
void Engine_ActorSetChildValue(s32 actor, s32 value)
#define MAP_CELL_STEPS_END
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
static void Actor_CenterAndWalk(s32 actor, s32 priority, s32 dz)
static void MapObject_SetPosition(s32 object, s32 fixed_x, s32 fixed_z)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
static void Camera_MoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
static void Actor_SetPosition(s32 actor, s32 fixed_x, s32 fixed_z)
void Engine_ActorFaceEachOther(s32 actor, s32 other, s32 frames)
void Engine_EventWait(s32 frames)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
@ TRANSITION_BACKDROP_FADE
@ ACTOR_PRIORITY_UNDERFOOT
The depth sort treats it as 320 pixels higher on the screen.
#define SCENE_TRANSITION(style, variant)
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EXITS(scene)
#define PSYNERGY_IN_AREA(ability, phase)
#define IF_FLAG_SET(flag)
#define EVENT_TOUCH_FACING
#define SCENE_EXIT(exit, scene, entrance)
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define TOUCH_WALKING_INTO(facing)
#define FIND_COINS(coins)
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void Field_SetMapCellCollision(s32 a0, s32 a1, s32 a2, s32 a3)
#define FLAG_TOLBI_SEARCHERS_MET
the soldiers asked about Babi
#define FLAG_COLOSSO_OVER
the Colosso finals have been fought
#define FLAG_BABI_SAVED
The party has saved Babi in Altmiller Cave with his Mystic Draught; Tolbi then holds the Colosso fina...
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
#define FLAG_TOLBI_CORN_GIVEN
the snack vendor gave away her corn
#define FLAG_TOLBI_SPRING_OPENED
the gambler let the party go first
#define FLAG_SCENE_TEMP_00
#define FLAG_SCENE_TEMP_01
struct UiWindow * UiText_OpenMessageWindow(s32 message, s32 x, s32 y, u32 packed)
Opens a window sized to a message near tile (x, y) and starts typing the message into it.
Item numbers, named from the English release.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
s32 ArcTan2(s32 x, s32 y)
Returns the angle of the vector (x, y), in 1/65536 turns, measured from the y axis: 0 along +y,...
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_LABEL(n)
Branch destination.
#define SC_SET(w, v)
Write a work value.
#define SC_LOOP(n, to)
Repeat up to n times.
#define SC_SYNC
Wait for arrival.
#define SC_MOVE(x, y, z)
Move toward the target.
#define SC_END
Return to the main script.
Song and sound effect ids, indices into gSound_SongTable.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_EventSetMessage()
void Engine_EventShowMessage()
@ TOLBI_MISSING_PERSON_POSTER
@ TOLBI_PLAYER_COPY
copies the leader's sprite priority every frame
@ TOLBI_SCALPER
Sleeps under the archway during the festival; on finals day he sells seats.
@ TOLBI_FATHER
A family at the festival: the father, the mother and their child, who cries for sweets.
@ KID_TALKING
set while the party talks to this child
@ KID_CHASES_YOUNGER
set on the older brother, who runs after actor 17
#define EVENT_WORK_1F4
A word of the event work, at offset 0x1f4, that is set to the poster before the yes/no choice under t...
#define offsetof(type, member)
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
s32 startTransition
SCENE_TRANSITION(style, variant).
s16 touchedTrigger
the step event a touch or exit event answers
u16 message
the next message, advanced as each window opens
A field actor: a person or thing on the field with a position, motion toward a target,...
s16 timer
The parameter its action script reads (a follow distance or an angle to face), the player's frames to...
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
u8 paused
nonzero skips its script and motion, not its update
union FieldCoordinate y
16.16 fixed-point pixels
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
union FieldCoordinate z
16.16 fixed-point pixels
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
Cell replacement: procedure and destination cells.
A scene entrance: where and facing which way the party arrives, and the camera's bounds there (-1 for...
A scene event: its kind and detail, the trigger it answers, its condition and its value (a message or...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
A scene's exit region: the box that, while its condition holds, takes the party leader out through it...
The window state the running children consult before they widen their stopping range.
struct SceneEvent gTolbiEventsAfterColosso[]
After Colosso has ended.
struct SceneEvent gTolbiEventsFinalsDay[]
On finals day.
struct SceneEntrance gTolbiEntrances[]
static void Tolbi_TalkToMother(void)
The mother turns to her crying child, then back to promise better sweets later on.
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; other...
static void Tolbi_TalkToSleepingScalper(void)
During the festival the scalper sleeps under the archway: the inns are full.
s32 gTolbiYoungerSiblingRun[]
The younger sibling runs the same loop half a lap ahead.
s32 gTolbiOlderBrotherRun[]
The older brother runs a loop of eight points around the plaza.
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 par...
static void Tolbi_JoinEmber(void)
Talking to Ember, the Mars Djinni hiding in town, makes it join the party.
static void Tolbi_AskAboutLivingPastHundred(void)
A townsperson asks whether someone can live to be more than 100 years old; either way the talk turns ...
static void Tolbi_TalkToYoungerSibling(void)
Talking to the younger sibling, or reading the child's mind, as above.
static void Tolbi_TalkToCryingChild(void)
The crying child turns, stamps twice and wails for sweets.
static void Tolbi_AskWhetherPartyWasInFinals(void)
After Colosso, actor 12 asks whether the party was in the finals.
static void Tolbi_MeetSearchingSoldiers(void)
During the festival, two soldiers searching for the missing Babi stop the party and show his picture.
s32 Tolbi_ApplyEntryState(s32 unused)
Sets up the scene on entry: the running children, actor 14's update, and everything the flags have al...
const struct SceneEntrance * Tolbi_GetEntrances(void)
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...
static void Tolbi_TalkToFather(void)
The father asks whether children really do love souvenirs, and owns up to loving them himself.
static void Tolbi_RevealHiddenChest(void)
Reveal uncovers the hidden chest: its map cell is drawn in and the chest moves into place.
struct MapCellAnim gTolbiDoors[]
The doors, in the order of their triggers 1 to 9, by map cell.
const struct SceneRegion * Tolbi_GetRegions(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_RequestTouchedExit(void)
Leaves by the exit numbered as the trigger the party walked into.
static void Tolbi_ReadLuckyMedalSign(void)
The second sign at Tolbi Spring: a Lucky Medal wins better prizes.
s32 gTolbiMirroredActor[]
The action script of a mirrored actor: flips its sprite and passes 7 on.
static void Tolbi_TalkToOlderBrother(void)
Talking to the older brother, or reading his mind.
u16 gTolbiDoorOpening[]
How a door opens: two frames of cells copied over the closed door.
static void Tolbi_HideRevealedChest(void)
When Reveal wears off, the chest's cell is covered again and the chest moves out of sight.
static s32 Tolbi_UpdateKid(union FieldObject *fieldObject)
static void Tolbi_FreezePuddle(void)
Frost on the puddle: the frozen pillar is drawn underfoot and stops following the terrain,...
static void Tolbi_TalkToGambler(void)
The gambler at the spring's gate asks whether the party wants to test its luck.
struct SceneEvent gTolbiEventsFestival[]
During the festival, before the finals.
#define TOLBI_JAR_SEARCH_KIND
const struct SceneEvent * Tolbi_SelectEvents(void)
Picks the event table for Tolbi's current mood.
const u32 * Tolbi_GetExits(void)
struct ScenePlacement gTolbiPlacements[]
static void Tolbi_ReadSpringSign(void)
The first sign at Tolbi Spring: face away and toss a coin in.
static void Tolbi_TalkToSnackVendor(void)
After Colosso, the snack vendor gives the party her leftover corn, once.
const struct ScenePlacement * Tolbi_GetPlacements(void)
static void Tolbi_EnterSpring(void)
The gate to Tolbi Spring, once the gambler has stepped aside.
The integer types, TRUE, UNUSED and the fixed-address macros.
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
struct UiWindow * UiWindow_CreateWithSideObject(s32 speaker, s32 portraitOption, s32 x, s32 y)
Opens a portrait window at tile (x, y) showing the speaker's portrait.