32 if (frame->
frame == 0xFF) {
35 }
else if (frame->
frame == 0xFF) {
56 switch (task->
state) {
62 if (object->
anim >= 1 && object->
anim <= 4) {
86 for (i = 0; i < 4; i++) {
139 switch (task->
state) {
160#define STAGE_CHILDREN_SIZE 0x8
191#if VERSION_US || VERSION_JP
192#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_02)
193#define EVENT_TEXT_FILE (TEXT_EVENTS_600 - 1)
194#define STAGE_FILE 0x479
196#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_02)
197#define EVENT_TEXT_FILE (TEXT_EVENTS_600 - 1)
198#define STAGE_FILE 0x489
832 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 1, 6 },
833 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 1, 6 },
837 { 0, 6 }, { 0, 6 }, { 0, 6 }, { 1, 6 },
838 { 2, 6 }, { 3, 6 }, { 4, 6 }, { 5, 6 },
839 { 6, 6 }, { 7, 6 }, { 6, 6 }, { 5, 6 },
840 { 4, 6 }, { 3, 6 }, { 2, 6 }, { 1, 6 },
841 { 0, 6 }, { 0, 6 }, { 255, 0x3E7 },
844 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 1, 6 },
845 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 1, 6 },
849 { 0, 12 }, { 1, 12 }, { 2, 12 }, { 1, 12 },
853 { 2, 12 }, { 3, 12 }, { 4, 12 }, { 5, 12 },
854 { 6, 12 }, { 7, 12 }, { 8, 12 }, { 9, 12 },
855 { 10, 12 }, { 255, 0x3E7 },
858 { 9, 12 }, { 10, 12 }, { 9, 12 }, { 8, 12 },
862 { 0x12C, 90 }, { 0, 6 }, { 1, 6 }, { 2, 6 },
863 { 3, 6 }, { 4, 6 }, { 3, 6 }, { 4, 6 },
864 { 3, 6 }, { 4, 6 }, { 3, 6 }, { 2, 6 },
865 { 1, 6 }, { 2, 6 }, { 1, 6 }, { 2, 6 },
866 { 1, 6 }, { 255, 0x3E7 },
869 { 0x12C, 108 }, { 50, 6 }, { 51, 6 }, { 52, 6 },
870 { 53, 6 }, { 54, 6 }, { 56, 6 }, { 57, 6 },
871 { 58, 6 }, { 59, 6 }, { 255, 0x3E7 },
874 { {
NULL, 0, 0 }, {
updateTileSeqs8Steps_0_0, 0, 0 }, {
updateTileSeqs8Steps_0_1, 1, 3 }, {
updateTileSeqs8Steps_0_2, 0, 0 } },
875 { {
NULL, 0, 0 }, {
updateTileSeqs8Steps_1_0, 0, 0 }, {
updateTileSeqs8Steps_1_1, 1, 3 }, {
updateTileSeqs8Steps_1_2, 0, 0 } },
876 { {
NULL, 0, 0 }, {
updateTileSeqs8Steps_2, 1, 0 }, {
NULL, 0, 0 }, {
NULL, 0, 0 } },
877 { {
NULL, 0, 0 }, {
updateTileSeqs8Steps_3, 1, 0 }, {
NULL, 0, 0 }, {
NULL, 0, 0 } },
935 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
936 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
937 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
938 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
939 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
940 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
941 { 0x140, 0x100, 0x176, 0x1A0, 0xD8, 0xA0, 0x160, 0x1F6 },
942 { 0x140, 0x100, 0x158, 0x1A8, 0x60, 0xA8, 0x160, 0x1F5 },
943 { 0x140, 0x100, 0x174, 0x150, 0xD0, 0x50, 0x170, 0x1F5 },
944 { 0x140, 0x100, 0x158, 0x180, 0x60, 0x80, 0x160, 0x1F4 },
945 { 0x140, 0x100, 0x160, 0x180, 0x80, 0x80, 0x170, 0x1F4 },
946 { 0x140, 0x100, 0x140, 0x198, 0, 0x98, 0x140, 0x1F3 },
947 { 0x140, 0x100, 0x178, 0x128, 0xE0, 0x28, 0x150, 0x1F3 },
948 { 0x140, 0x100, 0x148, 0x198, 0x20, 0x98, 0x160, 0x1F3 },
949 { 0x140, 0x100, 0x160, 0x1B8, 0x80, 0xB8, 0x170, 0x1F3 },
950 { 0x140, 0x100, 0x140, 0x1C0, 0, 0xC0, 0x140, 0x1F2 },
951 { 0x140, 0x100, 0x148, 0x1C0, 0x20, 0xC0, 0x150, 0x1F2 },
952 { 0x140, 0x100, 0x150, 0x1C0, 0x40, 0xC0, 0x160, 0x1F2 },
953 { 0x140, 0x100, 0x150, 0x198, 0x40, 0x98, 0x140, 0x1F1 },
954 { 0x140, 0x100, 0x170, 0x1C0, 0xC0, 0xC0, 0x150, 0x1F1 },
955 { 0x140, 0x100, 0x146, 0x1E0, 0x18, 0xE0, 0x160, 0x1F1 },
956 { 0x140, 0x100, 0x15C, 0x150, 0x70, 0x50, 0x170, 0x1F1 },
1061 { 0, 1, 0x40, 2, 0x3D, 0, 0, 0, 0, 0, 335, 351, 0, 0 },
1062 { 0, 2, 0x40, 2, 0x3E, 0, 0, 0, 0, 0, 345, 372, 0, 0 },
1063 { 0, 3, 0x40, 2, 0x3C, 0, 0, 0, 0, 0, 477, 356, 0, 0 },
1064 { 0, 4, 0x40, 2, 0x32, 0, 0, 0, 0, 0, 489, 350, 0, 0 },
1065 { 1, 0, 0x40, 2, 0x40, 2, 0, 3, 6, 0, 521, 212, 0, 0 },
1066 { 1, 0, 0x40, 2, 0x40, 2, 0, 3, 6, 0, 569, 236, 0, 0 },
1067 { 1, 0, 0x40, 2, 0x41, 2, 0, 3, 6, 0, 617, 260, 0, 0 },
1068 { 1, 0, 0x40, 2, 0x43, 2, 0, 5, 6, 0, 392, 163, 0, 0 },
1069 { 1, 0, 0x40, 2, 0x44, 2, 0, 5, 6, 0, 369, 205, 0, 0 },
1070 { 1, 0, 0x40, 6, 0x3F, 2, 0, 3, 6, 0, 360, 389, 0, 0 },
1071 { 1, 0, 0x40, 6, 0x42, 2, 0, 5, 6, 0, 361, 186, 0, 0 },
1072 { 1, 0, 0x40, 4, 0, 0, 0, 0, 0, 0, 377, 371, 399, 0 },
1073 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
1076 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_EXIT, 0x254, 0x2D4, 0xC4, 7, 0, 0, 0 },
1077 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_CLIMB_DOWN, 5, 0x1D0, 0xF8, 0, 0, 0, 0 },
1078 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_CLIMB_UP, 5, 0x1E0, 0x150, 0, 0, 0, 0 },
1079 { { {
CODES_END, 0 }, {
CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
GfxState GFX
GFX: the graphics state and its methods.
GameFlags FLAGS_00
The flag bitset FLAGS_00 and the event functions.
GameState GAME
The save data, the game mode and the methods.
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
EventTask * FIELDSTG_startEvent(s32 id)
Starts the event id of FieldState.events: its script, start and end, and its text; the player stands ...
The stage overlays (AAA/PRO/WSTAG###.PRO), loaded at 0x800A4CA4 on top of FIELDSTG.
#define EVENT_TEXT(n)
An entry of the stage's events' text file, for FieldEvent.text.
void updateStage()
The names every stage defines, each its own (config/<version>/stages/<stage>.txt).
#define FIELD_COMMAND_PLAY_DEMO_BGM
#define SCRIPT_WAIT_WALK(id)
until the character gets to its goal
#define SCRIPT_END
The commands of an event script (FieldEvent.script), as FIELDSTG_runEvent reads them: a halfword kind...
#define SCRIPT_LOOK_AT(snap, x, y)
FIELDSTG_pointCamera.
#define SCRIPT_LEAVE(mode, x, y, dir)
FIELDSTG_leaveField; ends the event.
#define SCRIPT_COMMAND(id, command, arg)
the same word for a script command's id: FIELDSTG_setEventPose creates its task if none runs and hand...
#define SCRIPT_FOLLOW(snap, id)
FIELDSTG_followWithCamera.
#define FIELD_MAP_FLOOR0
Some of FieldMap's maps (files): those of the floors the player walks on come first,...
#define FIELD_COMMAND_STOP_BEAM_HIT
#define FIELD_COMMAND_PLAY_BEAM_HIT
#define FIELD_COMMAND_PLAY_SWITCH02
#define SCRIPT_WALK(id, x, y, dir)
Actor.setGoal: walks to (x, y), then faces dir.
#define SCRIPT_WAIT_BOX
until box 0 closes
#define SLOT_EXIT
The kinds of StageSlot (type).
#define FIELD_COMMAND_PLAY_BEAM_SHT
#define SCRIPT_POSE(id, set, dir)
Actor.setPose: its animation set, facing dir.
#define FIELD_MAP_TRIGGERS
a cell's value: a direction (3 bits) and a StageSlot (5)
#define SCRIPT_WAIT(frames)
#define FIELD_TASK_COMMANDS
script command 813 (FIELDSTG_startCommandTask): the field commands
#define SCRIPT_PLACE(id, x, y)
puts a character at (x, y)
#define SCRIPT_TALK(box, entry, id, kind)
box of the event's boxes shows the event text's entry: a talk box at the corner kind next to the char...
FieldState FIELDSTG_state
#define EVENT_BATTLE(id)
action: FIELDSTG_battleFuncs.startEventBattle
#define PROGRESS(n)
GAME.progress is n.
#define FLAG(group, id)
The codes of the (code, value) pairs that FLAGS_00 checks as conditions and applies as actions (event...
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
#define MUSIC_BATTLE
BATL0000: the maps' random battles (AreaBattle, nearly all of them)
#define MUSIC_SECRET_ROOM
BGM_0019: the Secret Room, the rebels' hideout.
#define MUSIC(bank, n)
A field's or a battle's music (FieldState.music, Battle.music): track (SEP) n of the first sequence o...
#define MUSIC_BANK(music)
The sound bank of a music, which a stage loads for it (FieldState.soundBank)
FIELDSTG's start of the stage (StageEntry.init in FIELDSTG_stages): the stage's task,...
@ STORY_LUCKY_MOUSE
WSTAG615 (Sewers), event 531: Lucky Mouse appears (DM0531, "Lucky Mouse appears")
@ STORY_BYAKKO_LEADER_FOUGHT
WSTAG620 (the rebels' hideout), event 534: the Byakko Leader takes the player for the A....
@ STORY_STAFF_PASS
WSTAG620, event 551: Nick finds a Staff Pass for the player.
#define FLAG_SECURITY_HOLE_SEEN
wstag525 event 550: Suzaku Leader shows the security hole behind the earthquake; set at its end,...
#define FLAG_KEITH_NICK_SEARCH_STARTED
wstag620 Secret Room: set after event 540; then Lisa says "Find Keith and Nick" and people in 10 stag...
#define SPECIAL_STORY_BYAKKO_LEADER_FOUGHT_TO_GAME_MASTER_CAUGHT
GAME.progress is from STORY_BYAKKO_LEADER_FOUGHT to STORY_GAME_MASTER_CAUGHT (PROGRESS_RANGES[3])
#define FLAG_PASS_CODE_SEARCH_SEEN
wstag620 event 540: Lisa sets Nick and Keith to look for a pass code in the computer; set at its end,...
#define FLAG_DATAMON_STAFF_PASS_TALKED
wstag325 Control Room: Datamon will open the basement gate only for a DO Staff Pass holder; set by th...
Where an actor's frames go in VRAM: one of the records after the FieldImage (Actor....
One frame of a sprite animation; frame 0xFF ends it (or loops it)
A battle of an area's BattleList, which can start on the field (see FIELDSTG_startEncounter); FIGHTST...
The battles of an area of the map (its cells' value at FieldMap.files[4]), one picked at random.
A character of the field (FieldState.actors, a list of pointers up to NULL), which FIELDSTG_updateFie...
The battles of a place (FieldState.battles), by area of the map: the fourth area's are also the ones ...
An event of the table FieldState.events, up to the first id -1, which FIELDSTG_startEvent starts.
void(* setFile)(s32 index, s32 file)
FIELDSTG_setMapFile.
void(* setFirstMap)(s32 index)
FIELDSTG_setFirstMap: the map the player starts on (GAME.mapIndex), when the mode is new.
s32 sheetEntry
the stage's sprite sheet, loaded before the field starts, or 0
FieldEvent * events
up to the first id -1
s32 soundBank
SOUND.loadBank's, or 0.
StageTile * objects
the map objects, up to the first margin 0
s32 imageFile
or an image archive file, or 0
Vec2 start
where the player starts
StageSlot * slots
up to the first type 0
ActorImage * actors
then the actors', from actors[2]
s32 mapFile
the file of the map's tiles (FIELDSTG_createMapStreamer)
s32 startDir
and its direction
s32 textFile
the stage's text file, for the talks
union FieldState::@12 images
s32 music
SOUND.playSound's, or 0.
What a character says (FIELDSTG_runActorAction): the first whose conditions hold, or the last,...
void(* applyAction)(s32 code, s32 value)
s32(* checkCondition)(u16 code, u16 value)
s32(* getFrameTime)(void)
short(* playSound)(s32 id)
returns the voice of a key-on
A step of a StageTileSeq: its animation, and the step after it ends.
s16 next
0: hide the map object
s16 once
play once, then go to next
What the player can trigger on a map (FIELDSTG_updateTriggers): a record of the table at FieldState....
The task a stage starts (startStage), updated by its updateStage.
void(* nextState)(struct StageTask *task)
StageTileSeq with a byte setFrame and a sound to play at frame 0x34.
void(* nextState)(struct StageTileSeqs8 *task)
An object of a map, which FIELDSTG draws: a record of the table at FieldState.objects,...
u8 anim
which of a stage's animations sets frame (1-3); FIELDSTG finds objects by it (its lift,...
void * createTaskWithId(void(*update)(), s32 size, s32 childrenSize, s32 id)
Allocates a zeroed task of size bytes (header included) with room for childrenSize / 4 child tasks.
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
AnimFrame updateTileSeqs8Steps_1_0[]
u16 actor2Talk1Conditions[]
void * createCommand849(s32 arg)
Command 849 of the event scripts: the map objects of event 532, at Lucky Mouse's hideout (updateTileS...
s32 stepTileAnimation(StageTileSeq8 *obj, AnimFrame *frames, s32 once, s32 depth)
stepTileAnimation (common/step_tile_animation.inc.c) for a StageTileSeq8: steps OBJ's animation throu...
AnimFrame updateTileSeqs8Steps_3[]
AnimFrame updateTileSeqs8Steps_0_2[]
u16 actor5Talk0Conditions[]
void endEvent532(void)
After event 532, with Lucky Mouse, Lisa, Kail, General and Attacker: starts the stage's event battle ...
FieldActorEntry * stageActors[]
u16 actor19Talk0Conditions[]
AnimFrame updateTileSeqs8Steps_0_1[]
void updateTileSeqs8(StageTileSeqs8 *task)
Plays the steps of updateTileSeqs8Steps on the map objects with animations 1 to 4,...
AnimFrame updateTileSeqs8Steps_2[]
void endEvent540(void)
After event 540, with Kail, Kurt and Lisa: lets event 550 of WSTAG525 start and keeps it from playing...
StageSeqStep updateTileSeqs8Steps[4][4]
Defined below, after the code that uses them.
AnimFrame updateTileSeqs8Steps_1_1[]
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing BGM_0019.
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
AnimFrame updateTileSeqs8Steps_1_2[]
u16 actor2Talk0Conditions[]
AnimFrame updateTileSeqs8Steps_0_0[]
u16 actor5Talk1Conditions[]
void endEvent551(void)
After event 551, with Lisa, Keith, Nick and Kail: moves the story on to STORY_STAFF_PASS.
u16 actor19Talk1Conditions[]
FieldBattles stageBattles[]
void endEvent534(void)
After event 534, with Attacker, Lisa, Kail and Kurt: moves the story on to STORY_BYAKKO_LEADER_FOUGHT...