31#include "text/msg_ids.h"
107 if (*(
s16 *)(workspace + 376) != 0 || render->
mode != 0) {
302 actor->
facing = savedFacing;
320 actor->
facing = savedFacing;
404 actor->
facing = savedFacing;
421 actor->
facing = savedFacing;
674 for (frames = 60; frames != 0; --frames) {
732 s32 suspectsMindRead;
750 actor->
timer = lowBit;
768 if ((lowBit & suspectsMindRead) != 0) {
886 if (effect->
timer != 0) {
896 horizontalRate = effect->
speed;
937 sprite = effect->sprite;
965 directionBias = flags ^
x;
967 driftMultiplier += directionBias;
972 effect->
timer = zero;
992 spriteFlags = &sprite->
flags;
1128 {0,
CONDITION_ALWAYS, 223, 0, 135,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1129 {1,
CONDITION_ALWAYS, 400, 0, 472,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
1130 {2,
CONDITION_ALWAYS, 224, 0, 138,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1131 {5,
CONDITION_ALWAYS, 408, 0, 344,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1132 {6,
CONDITION_ALWAYS, 312, 0, 328,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1133 {7,
CONDITION_ALWAYS, 216, 0, 312,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1134 {8,
CONDITION_ALWAYS, 376, 0, 248,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1135 {9,
CONDITION_ALWAYS, 296, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1136 {10,
CONDITION_ALWAYS, 120, 0, 168,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1137 {11,
CONDITION_ALWAYS, 64, 0, 294,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1138 {12,
CONDITION_ALWAYS, 70, 0, 183,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
1139 {13,
CONDITION_ALWAYS, 152, 0, 272,
FACING_SOUTH, 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.
const struct ScenePlacement * Scene_GetPlacements(void)
const struct SceneEntrance * Scene_GetEntrances(void)
const struct SceneEvent * Scene_GetEvents(void)
const u32 * Scene_GetExits(void)
Both scenes share one exit table.
const struct SceneRegion * Scene_GetRegions(void)
s32 Scene_Initialize(void)
Sets up whichever scene is being entered and runs its arrival events.
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
B5Context, the object context a battle routine reads; most of its fields are still unnamed.
const s32 * gEffectScripts[]
Which units are in a battle, and the Djinn recovery list.
Calls through a function pointer, by argument count.
Character numbers, with each character's Japanese name.
The engine calls the debug menus import, and their palette swatch tiles.
static UNUSED void * OverlayObject_CreateConfiguredObject(s32 x, s32 y, s32 z, s32 type)
A still effect in palette 15, at sprite priority 1, drawn under the actors.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
static s32 Event_OpenMessage(s32 speaker, s32 flags)
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 Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
s32 Engine_EventChooseYesNo(s32 actor, s32 flags)
void Engine_MessageShowCentered(s32 message, s32 flags)
void Engine_EventShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
void Engine_ActorMoveToAndWait(s32 actor, s32 x, s32 z)
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
void Engine_ActorSetSpeed(s32 actor, s32 speed, s32 acceleration)
void Engine_EventCloseScreen(void)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
static s32 Math_Divide(s32 dividend, s32 divisor)
void Engine_EventOpenScreen(void)
s32 Engine_EventOpenMessage(s32 speaker, s32 flags)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
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)
static void Event_ShowMessage(s32 speaker, s32 flags)
static void Event_PlayCue(s32 cue)
#define MAP_CELL_STEPS_END
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_MapAnimateCells(const u16 *steps, s32 destX, s32 destY)
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)
static struct FieldActor * Actor_Get(s32 actor)
Field objects and actors, and the scene transition styles.
@ ACTOR_PRIORITY_AUTOMATIC
The sprite takes its priority from the map cell under it.
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
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 SCENE_EXIT(exit, scene, entrance)
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define USE_ITEM_ON_ACTOR(item)
#define TOUCH_WALKING_INTO(facing)
16.16 fixed-point constants, sine and cosine, and the library division.
FixedPointPosition, a position in 16.16 fixed point.
Game flags, named where their meaning is shown.
#define FLAG_VAULT_IVAN_JOINED_ROD_SEARCH
Set when the party agrees to help Ivan find the rod; while it is set and the thieves are free,...
#define FLAG_SHOW_LOCATION_NAME
#define FLAG_VAULT_BOX_NUT
#define FLAG_VAULT_SUSPECTS_MIND_READ
Set once Ivan has read the minds of the two cornered suspects.
#define FLAG_VAULT_DJINNI_CALLED_BY_BELL
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
#define FLAG_VAULT_THIEVES_JAILED
#define FLAG_VAULT_DOG_SHOWN_PASSAGE
#define FLAG_REACHED_KALAY
Set whenever Kalay is entered; Vale's villagers then talk of the party's journey.
#define FLAG_IN_PARTY(character)
Flags 0 to 7: the character with that id (character_ids.h) is in the party (Party_AddActiveOwner).
#define FLAG_SCENE_TEMP_00
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_VAULT_THIEVES_CONFRONTED
Set as the three thieves are confronted in the attic, before the battle.
GameState, the game's state: play time, coins, the scene and the leader's position,...
struct GameState gGameState
The screen blend's globals and the graphics routines.
s32 PartyInventory_Discard(s32 itemId)
Discards one itemId from whoever carries it first, as Inventory_Discard does; always returns 0.
s32 PartyInventory_FindOwner(s32 itemId)
Returns who carries itemId, asking the selected character first, or -1.
gOverflowItem, an item slot the spoils code uses when items are handed out.
Item numbers, named from the English release.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
The reel game's title lettering.
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_POS(x, y, z)
Set position.
#define SC_SYNC
Wait for arrival.
#define SC_WANDER_HOME(a, b, c)
#define SC_MOVE(x, y, z)
Move toward the target.
#define SC_WAIT(n)
Wait n frames.
#define SC_TOP
Script start.
#define SC_END
Return to the main script.
void Party_RemoveOwnerRestored(s32 unit)
Takes unit out of the party, fully restoring its HP and PP and curing its poison.
void Event_PrepareObjectAndApplyValue(s32 unit, s32 announce)
Adds unit to the party.
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_ActorShowEmote()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
Vault, before and after the thieves are caught: villagers who walk about stop when someone is close i...
s32 Vault_StopIfFacingNear(struct FieldActor *actor, struct FieldActor *target, s32 range, s32 force)
Stops the actor (paused, mode 1) when the target is nearer than range pixels and lies ahead of it,...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart image
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
u16 priority
2 when created
u8 djinnOwnedCounts[4]
the Djinn held in each element, at most 10
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
s16 touchedTrigger
the step event a touch or exit event answers
u16 unk172
FieldWork's menu request; scenes set it to 1.
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,...
s16 timer
The parameter its action script reads (a follow distance or an angle to face), the player's frames to...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
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 paused
nonzero skips its script and motion, not its update
s32 bounce
The share of its falling speed kept as it bounces on landing, 16.16 fixed point (0x4000 when created)...
union FieldCoordinate y
16.16 fixed-point pixels
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
s32 velocityY
16.16 fixed-point pixels per frame
s32 gravity
Taken off the vertical velocity each frame while it is above the ground, in 16.16 fixed-point pixels ...
union FieldCoordinate z
16.16 fixed-point pixels
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
s32 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
void(*) update(union FieldObject *object)
Called each frame while the effect is live: the spawner sets BattleFx_UpdateObjectMotionScaleAndLinke...
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 system's work: the windows' tilemap, the windows, the three text channels,...
u8 mode
Set while Mind Read shows thoughts: round frame corners, colour 8 text with no shadow,...
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
Values that differ by patch level or language, chosen once for their code.
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
struct FieldEffect effect
struct BattleUnit * UnitGet(u32 owner)
Returns the unit record of owner: 0 to 7 are the playable characters in the game state,...
static void Event_EnterCentralHouse(void)
Animates the central house door before entering.
static void Event_EnterSoutheastHouse(void)
Opens the southeastern door and enters its interior.
static void Event_GiveBoneToDog(void)
Given a Bone, the dog runs to the hidden passage and jumps there three times.
static void Event_ReadMindOnTheft(void)
Mind Read: stealing during an eruption is unforgivable, or how should the prisoners be punished?
static void Event_TalkOfEruptionThefts(void)
Some folks got robbed during the chaos of the eruption.
static void Event_ThankBeforeDeparture(void)
Thanks the party before it leaves.
static void Event_AskAboutFleeingTravelers(void)
Travelers left town in a big hurry: did the party see them?
s32 gVault_DriftScriptA[]
u16 gVault_Scene10Cells[]
static void Event_TalkToDogAfterCapture(void)
The dog barks; carrying a Bone before it has shown the passage lets the party give it one.
static void Event_ReadMindOnSuspects(void)
Mind Read on the watchman: everyone knows the three at the inn stole the rod, or he feels much better...
static void Event_EnterNorthwestHouse(void)
Opens and enters the northwestern house.
static void Event_TalkToDog(void)
The dog stops and barks.
static void Event_EnterPassage(void)
The party walks through the doorless entrance into the interiors (exit 13).
static void Event_ReadMindOnIvan(void)
Mind Read on the first walker: the three creeps at the inn stole the rod, or where did Ivan go (when ...
s32 gVault_DriftScriptB[]
static void Event_RingBell(void)
Isaac rings the bell; the first time, the Venus Djinni hiding nearby jumps out and comes to the bell.
static void Vault_JumpActorToAndWait(s32 actorId, s32 x, s32 z, s32 verticalSpeed)
Moves an actor through a jump and waits up to sixty frames for it to settle.
static void Event_ReadMindOnWealth(void)
Mind Read on the second walker: riches can't save you from a volcano, or the party must be stronger t...
static void Event_AskAboutEruption(void)
Asks about the eruption.
static void Event_PityIvan(void)
The first walker stops: poor Ivan was left at the mayor's to look for the stolen rod.
static void Vault_AskYesNoAndShowReply(s32 speaker)
Asks the current question and selects its ordinary or alternate reply.
static void Event_PraiseThievesCapture(void)
Praises the thieves' capture. "It's great that you caught those thieves!".
static void Event_TalkOfHammetsCaravan(void)
The second walker stops: Hammet's caravan left as soon as the eruption stopped.
static void Event_EnterNortheastHouse(void)
Enters the northeastern doorway behind its foreground tiles.
static void Event_PeerIntoWell(void)
Isaac peers into the well and hears water rumbling down there.
static void Event_EnterNorthHouse(void)
Enters the northern doorway behind its foreground tiles.
static UNUSED void Vault_SpawnDriftingEffect(s32 flags)
Spawns a drifting sprite near the dog, sharing its drawing priority.
static void Event_ThankForCapturingThieves(void)
The second walker: everyone is grateful the party captured the thieves.
static void Vault_FaceActorAndWait(s32 actor, s32 cue, s32 delay)
struct SceneEvent gVault_Events[]
u16 gVault_Scene12Cells[]
static void Event_ReadMindOnRoofer(void)
Mind Read: that sneak is wasting time instead of fixing the roof.
struct ScenePlacement gVault_PlacementsAfterThieves[]
static void Event_AskAboutAdventure(void)
Asks whether the party is off on an adventure.
static void Event_ReadDogMind(void)
Mind Read on the dog: humans value money over their lives; after the thieves are jailed,...
static void Event_AskWhetherIvanWentToLunpa(void)
The first walker hopes Ivan didn't go to Lunpa alone, or, with Ivan in the party, asks when he joined...
static void Vault_ShowStandingActorMessage(s32 actor)
Stops an actor, faces the leader and shows the current message.
static void Vault_ShowMessageAndWait(s32 actor, s32 delay)
static void Event_TalkAboutIvan(void)
Ivan went out to Lunpa, or, with Ivan in the party, rescuing Hammet must have been impossible.
static void Event_WatchmanSuspectsOutsiders(void)
The watchman: nobody steals on his watch, the thieves must be from out of town.
static void Event_LookForRoofer(void)
The roofer should be fixing the roof, but is probably in back slacking off.
static void Event_TalkOfDamagedRoads(void)
The eruption devastated the roads; once the southern bridge is repaired, you can head toward Kalay.
static void Event_AskWhoCapturedThieves(void)
Asks who captured the thieves; either answer is praised.
static void Vault_WalkThroughExit(s32 x, s32 y, s32 continuation)
Walks to the exit threshold and requests the room's transition.
static int Vault_GetIvanVenusDjinnCount(void)
Counts the Venus Djinn that must leave Ivan before he leaves the party.
static void Event_ReadMindOnTravelers(void)
Mind Read: the strange travelers headed for the northeast of the Goma Range, or the only way out is t...
struct SceneEntrance gVault_Entrances[]
static void Event_EnterCentralEastHouse(void)
Opens and enters the house east of the town's center.
static void Event_AskAboutPrisoners(void)
Asks about the prisoners.
static void Event_EnterJail(void)
The jail door opens and the party walks in, drawn behind the doorway.
static void Event_ThiefDeniesTheft(void)
One of the thieves asks whether the party accuses them; either answer gets a denial.
struct SceneEvent gVault_EventsAfterThieves[]
static void Event_IvanStaysBehind(void)
Exits 1 and 2 (triggers 20 and 21): while Ivan is helping search for the rod and the thieves are free...
struct ScenePlacement gVault_Placements[]
@ ACTOR_ERUPTION_WITNESS
Asks about the eruption. "Wasn't the eruption of Mt. Aleph incredible?".
@ ACTOR_STRANDED_TRAVELER
was leaving town when the volcano erupted
@ ACTOR_VAULT_VENUS_DJINNI
@ ACTOR_WATCHMAN
Keeps watch. "Nobody's stealing anything on my watch!".
@ ACTOR_ROOFER
a fiery rock burnt a hole through the roof
@ ACTOR_HAMMET_GOSSIP
Master Hammet had his precious rod stolen.
@ ACTOR_TRAVELER_WATCHER
Speaks of travelers. "Those travelers left in a big hurry.".
@ ACTOR_THEFT_GOSSIP
folks got robbed during the eruption
@ ACTOR_ROOF_COMPLAINER
Complains of the roofer. "He should be fixing the roof now".
@ ACTOR_LOITERING_THIEF
A thief. "Are you accusing us of stealing...?".
@ VAULT_VENUS_DJINNI_INDEX
@ ACTOR_FIRST_WALKER
The two who walk in circles.
@ ACTOR_IVAN_GOSSIP
Hammet's servant can't return to Kalay.
static void Vault_UpdateDriftingEffect(union FieldObject *fieldObject)
Applies drift and gradually damps both rates toward zero.
static void Event_AskAboutLeavingAgain(void)
After the thieves are jailed, asks whether the party is leaving again.
static s32 Vault_UpdateRoofComplainerProximity(union FieldObject *fieldObject)
Vault and its interiors: Ivan hands back Isaac's Djinni before he leaves the party.
static s32 Vault_ReturnIsaacsDjinni(void)
Brings every Djinni back from recovery (twenty rounds of it), then, if Ivan holds the first Venus Dji...
Vault, before and after the thieves are caught: the two villagers who walk about together (actors 14 ...
static s32 Vault_UpdateWalkingVillager(union FieldObject *fieldObject)
Vault, before and after the thieves are caught: the doorway of exit 11, which opens in two frames as ...
static void Vault_OpenDoorwayAndEnter(void)
Walking north into cell code 11 opens the doorway to the Sanctum.
Vault and its interiors: a villager's thought read with Mind Read.
static void Vault_ShowThought(s32 actorId)
Shows the message already set as the actor's thought: the actor stops and stands while the thought is...
Vault, before and after the thieves are caught: touch triggers 1 and 2 swap the collision of the 4x2 ...
static void Vault_RestorePassageCells(void)
Cell code 2 restores the passage's usual collision and clears FLAG_SCENE_TEMP_00.
static void Vault_EnableAlternatePassageCells(void)
Cell code 1 selects the passage's alternate collision and sets FLAG_SCENE_TEMP_00,...
The window renderer's work.