32#include "text/msg_ids.h"
77 for (i = 0; i < ownerCount; i++) {
148 roundedFacing = (leader->
facing + 0x2000) & 0xc000;
157 facingBits = roundedFacing << 16;
158 facingOrMessage = 0x4000;
159 if (facingBits == (0x4000 << 16)) {
174 facingOrMessage = MsgTolbiUseFourBeds;
212 question = MsgTolbiCameRestBefore;
238 s32 question = MsgTolbiPlanningEnterColosso;
258 const s32 *indigestionScript;
334 msg = MsgTolbiFoundCloakBall;
400 leader->
z.
fixed += -0x30000;
487 leader->
z.
part.pixel);
502 leader->
z.
part.pixel);
518 roundedFacing = (leader->
facing + 0x2000) & -0x4000;
654 leader->
z.
part.pixel);
662 leader->
z.
part.pixel);
670 leader->
z.
part.pixel);
957 event->transitionFrames = 12;
986 event->transitionFrames = 24;
1010 actor->
z.
fixed -= 0x30000;
1187 if (actor !=
NULL) {
1194 if (actor !=
NULL) {
1201 if (actor !=
NULL) {
2117 position->
z.
part.pixel);
2124 position->
z.
part.pixel);
2131 position->
z.
part.pixel);
2197 question = MsgTolbiArent;
2249 s32 question = MsgTolbiWarriorsWhoStayed;
2321 sprite = actor->sprite;
2322 actor->
y.
fixed = 0x40000;
2323 sprite->
count = set;
2365 MAP_CELL_STEP(25, 28, 1, 3, 5),
MAP_CELL_STEP(26, 28, 1, 3, 5),
MAP_CELL_STEP(27, 28, 1, 3, 5),
MAP_CELL_STEPS_END,
2387 { 0,
CONDITION_ALWAYS, 172, 0, 149,
FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
2388 { 1,
CONDITION_ALWAYS, 768, 0, 200,
FACING_NORTH, 0, 512, 0, 1024, 224, 0 },
2389 { 2,
CONDITION_ALWAYS, 728, 0, 88,
FACING_EAST, 0, 512, 0, 1024, 224, 0 },
2390 { 3,
CONDITION_ALWAYS, 808, 0, 88,
FACING_WEST, 0, 512, 0, 1024, 224, 0 },
2391 { 4,
CONDITION_ALWAYS, 600, 0, 152,
FACING_EAST, 0, 512, 0, 1024, 224, 0 },
2392 { 5,
CONDITION_ALWAYS, 936, 0, 152,
FACING_WEST, 0, 512, 0, 1024, 224, 0 },
2393 { 6,
CONDITION_ALWAYS, 584, 0, 56,
FACING_SOUTH, 0, 512, 0, 1024, 224, 0 },
2394 { 7,
CONDITION_ALWAYS, 952, 0, 56,
FACING_SOUTH, 0, 512, 0, 1024, 224, 0 },
2395 { 8,
CONDITION_ALWAYS, 72, 0, 216,
FACING_NORTH, 0, 0, 0, 512, 240, 0 },
2396 { 9,
CONDITION_ALWAYS, 440, 0, 216,
FACING_NORTH, 0, 0, 0, 512, 240, 0 },
2397 { 10,
CONDITION_ALWAYS, 72, 0, 968,
FACING_EAST, 0, 0, 864, 240, 1024, 0 },
2398 { 11,
CONDITION_ALWAYS, 168, 0, 936,
FACING_SOUTH, 0, 0, 864, 240, 1024, 0 },
2399 { 12,
CONDITION_ALWAYS, 424, 0, 680,
FACING_WEST, 0, 328, 600, 568, 760, 0 },
2400 { 13,
CONDITION_ALWAYS, 472, 0, 696,
FACING_SOUTH, 0, 328, 600, 568, 760, 0 },
2401 { 16,
CONDITION_ALWAYS, 408, 0, 824,
FACING_EAST, 0, 320, 728, 560, 888, 0 },
2402 { 17,
CONDITION_ALWAYS, 456, 0, 808,
FACING_SOUTH, 0, 320, 728, 560, 888, 0 },
2403 { 18,
CONDITION_ALWAYS, 824, 0, 648,
FACING_NORTH, 0, 768, 480, 1024, 672, 0 },
2404 { 20,
CONDITION_ALWAYS, 872, 0, 936,
FACING_WEST, 0, 784, 864, 1024, 1024, 0 },
2405 { 21,
CONDITION_ALWAYS, 888, 0, 968,
FACING_WEST, 0, 784, 864, 1024, 1024, 0 },
2406 { 22,
CONDITION_ALWAYS, 760, 0, 936,
FACING_EAST, 0, 608, 864, 848, 1024, 0 },
2407 { 23,
CONDITION_ALWAYS, 744, 0, 968,
FACING_EAST, 0, 608, 864, 848, 1024, 0 },
2408 { 24,
CONDITION_ALWAYS, 440, 0, 584,
FACING_WEST, 0, 272, 240, 784, 608, 0 },
2409 { 25,
CONDITION_ALWAYS, 616, 0, 584,
FACING_EAST, 0, 272, 240, 784, 608, 0 },
2410 { 26,
CONDITION_ALWAYS, 328, 0, 312,
FACING_WEST, 0, 272, 240, 784, 608, 0 },
2411 { 27,
CONDITION_ALWAYS, 728, 0, 312,
FACING_EAST, 0, 272, 240, 784, 608, 0 },
2412 { 28,
CONDITION_ALWAYS, 312, 0, 296,
FACING_WEST, 0, 272, 240, 784, 608, 0 },
2413 { 29,
CONDITION_ALWAYS, 744, 0, 296,
FACING_EAST, 0, 272, 240, 784, 608, 0 },
2414 { 30,
CONDITION_ALWAYS, 472, 0, 504,
FACING_SOUTH, 0, 272, 240, 784, 608, 0 },
2415 { 31,
CONDITION_ALWAYS, 584, 0, 504,
FACING_SOUTH, 0, 272, 240, 784, 608, 0 },
2416 { 32,
CONDITION_ALWAYS, 528, 0, 296,
FACING_SOUTH, 0, 272, 240, 784, 608, 0 },
2417 { 33,
CONDITION_ALWAYS, 208, 0, 840,
FACING_NORTH, 0, 0, 624, 336, 864, 0 },
2418 { 34,
CONDITION_ALWAYS, 40, 0, 760,
FACING_WEST, 0, 0, 624, 336, 864, 0 },
2419 { 35,
CONDITION_ALWAYS, 200, 0, 360,
FACING_NORTH, 0, 0, 240, 256, 480, 0 },
2420 { 36,
CONDITION_ALWAYS, 824, 0, 360,
FACING_NORTH, 0, 768, 240, 1024, 480, 0 },
2421 { 40,
CONDITION_ALWAYS, 376, 0, 936,
FACING_EAST, 0, 232, 864, 472, 1024, 0 },
2422 { 41,
CONDITION_ALWAYS, 520, 0, 936,
FACING_WEST, 0, 424, 864, 664, 1024, 0 },
2423 { 42,
CONDITION_ALWAYS, 904, 0, 776,
FACING_EAST, 0, 776, 704, 1016, 864, 0 },
2424 { 43,
CONDITION_ALWAYS, 216, 0, 552,
FACING_WEST, 0, 0, 472, 304, 632, 0 },
2425 { 44,
CONDITION_ALWAYS, 88, 0, 552,
FACING_SOUTH, 0, 0, 472, 304, 632, 0 },
2426 { 45,
CONDITION_ALWAYS, 728, 0, 824,
FACING_NORTH, 0, 552, 656, 792, 848, 0 },
2427 { 98,
CONDITION_ALWAYS, 152, 0, 104,
FACING_SOUTH, 0, 0, 0, 512, 240, 0 },
2428 { 99,
CONDITION_ALWAYS, 152, 0, 104,
FACING_SOUTH, 0, 0, 0, 512, 240, 0 },
2433 { 0,
CONDITION_ALWAYS, 264, 0, 440,
FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
2434 { 1,
CONDITION_ALWAYS, 264, 0, 424,
FACING_NORTH, 0, -1, -1, -1, -1, 0 },
2435 { 2,
CONDITION_ALWAYS, 200, 0, 248,
FACING_SOUTH, 0, -1, -1, -1, -1, 0 },
Ability numbers, named from the English release.
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
void Object_LinkObjectAndSetCallback(u32 objectId, u32 linkedObjectId)
Makes an actor follow another (the linked action script): writes its linkedObject.
const struct ScenePlacement * Scene_GetPlacements(void)
const struct SceneEntrance * Scene_GetEntrances(void)
const struct SceneEvent * Scene_GetEvents(void)
s32 BabiPalace_ApplyEntryState(void)
Sets up the scene being entered: the doors, the Cloak Ball on show, and the scenes that play on arriv...
struct SceneRegion gBabiPalace_Regions[]
static void BabiPalace_ShowQuestionAnswer(s32 actorId, s32 question)
Asks a yes or no question; the answers are the two messages after it.
static void BabiPalace_TalkToIndigestedWarrior(s32 actorId)
The warrior with indigestion tries to shrug it off, doubles up, and gives up on entering Colosso.
static void BabiPalace_WakeFromFinalsDream(void)
Waking after resting before the finals: the leader dreamt of fighting in them, the others tease,...
static void BabiPalace_AskAboutColosso(s32 actorId)
A warrior asks whether the party is entering Colosso, and either hurries it to the trials or asks whe...
static void BabiPalace_OfferCloakBall(void)
Taking the Cloak Ball on show after Colosso: Babi asks whether the party wants it,...
static void BabiPalace_HearSoldiersReport(void)
Walking past Iodem while Babi is missing: his two soldiers report back from Altmiller Cave without Ba...
u16 gBabiPalace_DoorCells[]
static void BabiPalace_AskAboutRemainingWarriors(s32 actorId)
Asks whether the party is leaving, like the other warriors.
static void BabiPalace_ThankForSavingBabi(void)
The other guard thanks the party for saving Babi once, then sends it to the colosseum.
struct SceneEvent gBabiPalace_EventsColosso[]
static void BabiPalace_AskAboutMeetingBabi(s32 actorId)
Asks about meeting Babi. "Did you meet with Babi?".
struct SceneEvent gBabiPalace_EventsOther[]
struct SceneEvent gBabiPalace_Events2[]
static void BabiPalace_AskAboutEasternShores(s32 actorId)
Asks whether the party wants to go back to the eastern shores.
struct ScenePlacement gBabiPalace_PlacementsAfterColosso[]
static void BabiPalace_RestInPalaceBeds(void)
Searching the beds: the party goes to bed, talking it over the first night.
struct SceneEntrance gBabiPalace_EntrancesOther[]
@ FLAG_ATTENDANT_SHOWED_BEDS
s32 gBabiPalace_IndigestionScript[]
static void BabiPalace_AskAboutSoldiers(s32 actorId)
Asks about Babi's soldiers.
struct SceneEntrance gBabiPalace_Entrances2[]
struct SceneEvent gBabiPalace_Events2Colosso[]
struct ScenePlacement gBabiPalace_PlacementsOther[]
const u32 * BabiPalace_GetExits(void)
Both scenes share one exit table.
static void BabiPalace_PassOnBabisWord(void)
A courtyard guard during the finals passes on Babi's word.
static void BabiPalace_WakeAfterFinals(void)
Waking in the palace after the finals: the leader slept long after fighting to the end; Babi wants to...
struct ScenePlacement gBabiPalace_Placements2[]
static void BabiPalace_ReadShebasMind(s32 unused0, s32 actorId)
Mind Read on Sheba: she cannot escape to Lalivero alone; the first time, she feels it,...
struct ScenePlacement gBabiPalace_PlacementsColosso[]
struct SceneEvent gBabiPalace_Events2AfterColosso[]
static void BabiPalace_OfferRest(s32 actorId)
Talking to the attendant during the finals: the first time, the attendant asks whether the party came...
static void BabiPalace_ExamineWell(void)
Searching the courtyard's well. "It's filled with fresh, clean water.".
static void BabiPalace_ShowBeds(s32 actorId)
Talking to the attendant before Babi's rescue: the attendant leads the party to the beds.
struct SceneEvent gBabiPalace_EventsAfterColosso[]
const struct SceneRegion * BabiPalace_GetRegions(void)
The palace has no regions; the table is empty.
static void BabiPalace_MeetBabiAfterColosso(void)
Arriving after Colosso: Iodem and Babi have been waiting for the party.
static void BabiPalace_LeaveThroughDoor(void)
Walking north into one of the palace's doors: it opens (SE_DOOR_OPEN) and the leader walks through.
static __inline__ void BabiPalace_RestorePartyAndInventory(void)
After a night in the palace's beds: the party's HP and PP are full, Garet, Ivan and Mia rejoin,...
static void BabiPalace_LeaveThroughAnimatedDoor(void)
Walking north into the courtyard's door: it opens and the leader goes in.
BattleUnit, a party member's or enemy's battle state, with the elements, abilities and actions it use...
The engine calls the debug menus import, and their palette swatch tiles.
The display transition's frames, windows and state.
static s32 FieldParty_ListActiveOwners(s16 *owners)
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)
static void Map_AnimateCells(const u16 *steps, s32 destX, s32 destY)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
s32 Engine_PartyGiveItem(s32 item, s32 flags)
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)
static void Actor_SetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
static void Actor_WalkByAndWait(s32 actor, s32 dx, s32 dz)
void Engine_EventOpenScreen(void)
s32 Engine_EventOpenMessage(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_CameraFollowActor(s32 actor, s32 keep_position)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
static void Event_ShowMessage(s32 speaker, s32 flags)
static void Event_PlayCue(s32 cue)
#define MAP_CELL_STEPS_END
s32 Engine_GameFlagIsSet(s32 flag)
static void Actor_WalkBy(s32 actor, s32 dx, s32 dz)
static void Actor_CenterAndWalk(s32 actor, s32 priority, s32 dz)
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_EventWait(s32 frames)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
static struct FieldActor * Actor_Get(s32 actor)
@ TRANSITION_BACKDROP_FADE
#define SCENE_TRANSITION(style, variant)
@ ACTOR_FACES_MOTION
turns toward its velocity, 1/16 turn a frame
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define SCENE_EXITS(scene)
#define IF_FLAG_SET(flag)
#define FIND_MESSAGE(message)
#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)
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void Event_End(void)
static void Psynergy_Cancel(void)
static void Actor_RunRepeatedMotion(s32 actor, s32 repeats)
static s32 Vram_Load(s32 block, s32 size, const void *data)
static void Camera_WaitForMove(void)
static void Task_Wait(s32 frames)
static void Event_RequestExit(s32 exit)
static void Actor_Stop(s32 actor)
static void Event_Begin(void)
static void Item_ShowFound(s32 item, s32 height)
static void Actor_StartRepeatedMotion(s32 actor, s32 repeats)
static void Actor_SetSpriteFlags(struct FieldActor *actor, s32 flags)
static void Actor_WaitForMove(s32 actor)
static s32 Party_GiveItem(s32 item, s32 flags)
static void FieldMotion_LaunchFromFocusedObject(s32 actor, s32 dx, s32 dz, s32 facing)
static void Actor_SetAnimation(s32 actor, s32 animation)
static void Actor_SetAnimationAndWait(s32 actor, s32 animation)
static void Event_Wait(s32 frames)
static void Item_LoadIcon(s32 item)
static void Heap_Release(s32 slot)
static void Actor_Jump(s32 actor, s32 height, s32 frames)
static s32 Event_ChooseYesNo(s32 actor, s32 flags)
static void Actor_FaceEachOther(s32 actor, s32 other, s32 frames)
static void Event_SetMessage(s32 message)
static void * Heap_Allocate(s32 slot, s32 size)
Game flags, named where their meaning is shown.
#define FLAG_BABI_PALACE_FIRST_NIGHT
the party has slept there once
#define FLAG_SHOW_LOCATION_NAME
#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_BABI_PALACE_FINALS_BEDS_OPEN
While set, the beds can be used during the finals.
#define FLAG_BABI_SPOKE_AFTER_COLOSSO
Babi and Iodem have spoken with the party after Colosso.
#define FLAG_BABI_PALACE_CLOAK_BALL
lent by Babi after Colosso
#define FLAG_SCENE_TEMP_00
#define FLAG_BABI_PALACE_FINALS_REST_OFFERED
The attendant has offered the beds for the night before the finals.
#define FLAG_BABI_PALACE_LUCKY_MEDAL
in a barrel
#define FLAG_SHEBA_NOTICED_MIND_READ
Sheba has felt the party read her mind.
#define FLAG_BABI_PALACE_GUARD_GAVE_WORD
A courtyard guard has passed on Babi's word to go to the colosseum.
#define FLAG_BABI_PALACE_GUARD_THANKED_PARTY
The other courtyard guard has thanked the party for saving Babi.
#define FLAG_BABI_PALACE_BEDS_OPEN
While set, the beds can be used before the finals.
#define FLAG_IODEM_HEARD_SOLDIERS
The soldiers have come back from Altmiller Cave to Iodem without Babi.
#define FLAG_WON_COLOSSO
the party won the finals
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
The work slots of gWorkSlot, read through their own names.
struct DisplayTransitionState * gDisplayTransition
Slot 31.
The screen blend's globals and the graphics routines.
The main-image routines scene overlays import.
void Engine_OwnerRecalculateRatios(s32 owner_id)
void Engine_UiTextDrawQuantity(u32 value, u32 kind)
void Engine_InventorySnapshotRestore(void)
void Inn_PlaySleep(s32 roomPrice)
Charges roomPrice, restores the HP and PP of each member still standing, and plays the night: a fade ...
The hardware's I/O registers and their bits, as pret names them.
Item numbers, named from the English release.
The keypad state the VBlank interrupt keeps.
volatile u32 gKeysHeld
Keys down now.
void Map_SetLayerEntryFlag(u32 channelIndex)
Pauses tile animation channel channelIndex by setting its paused byte.
void Map_ClearLayerEntryFlag(u32 channelIndex)
Resumes tile animation channel channelIndex by clearing its paused byte.
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_SET(w, v)
Write a work value.
#define SC_LOOP(n, to)
Repeat up to n times.
#define SC_WAIT(n)
Wait n frames.
#define SC_TOP
Script start.
void Battle_ResetEffectCounter(void)
Clears the field's busy flag and, while Reveal is active, ends it: Reveal used with ACT_PACKED runs i...
void DisplayTransition_InitializeBattleEffectState(s32 mode)
Starts window transition mode at value 0, with no duration: the caller moves it.
s32 Party_AddActiveOwner(s32 owner)
Adds character owner to the end of the party: sets its game flag and appends it to gGameState....
void Audio_PlayCueFromEventWork(void)
Starts the current scene's field music, chosen by Scene_ResolveInteractionResult.
Scene numbers, named after their places.
Song and sound effect ids, indices into gSound_SongTable.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_EventEnd(void)
void Engine_EventBegin(void)
void Engine_ActorShowEmote()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart image
u8 slot
VRAM cache entry holding its tiles.
u8 count
layers in use, up to the last one present
u16 fullColor
256 colours; set for both parts when created
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
s16 maxPp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
s16 hp
current HP, 0 when downed
s16 maxHp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
The display transition state (heap block 31): two pages of window edges for every line,...
u16 value
The progress, moved from start to end over duration frames: bit 5 says whether the transition opens o...
s16 active
WININ, or WINOUT by mode: 1 when a transition starts.
s16 mask
WINOUT, or WININ by mode: 0x3f3f or 63 when a transition starts.
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
s32 transitionFrames
frames
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,...
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
u8 retainSpriteCache
Nonzero keeps its sprite's VRAM cache entry while sprites are suspended or it is off screen (ObjectSy...
union FieldCoordinate y
16.16 fixed-point pixels
union FieldCoordinate z
16.16 fixed-point pixels
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 scaleY
16.16 fixed point, 0x10000 full size
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 system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
struct BattleUnit * UnitGet(u32 owner)
Returns the unit record of owner: 0 to 7 are the playable characters in the game state,...
The patch levels: our groups of the measured changes from the Japanese release.