8#if VERSION_US || VERSION_JP
9#define TIMER_SHEET 0x6EE
11#define TIMER_SHEET 0x6FE
33 switch (task->
state) {
37 if (object->
anim == 1) {
42 if (object->
anim == 2) {
49 if (task->
done == 0) {
58 for (i = 0; i < 2; i++) {
73 for (i = 0; i < 2; i++) {
143 if (frame->
frame == 0xFF) {
146 }
else if (frame->
frame == 0xFF) {
163 switch (task->
state) {
167 if (object->
anim == 3) {
171 if (object->
anim == 4) {
185 for (i = 0; i < 2; i++) {
230 switch (task->
state) {
238 if (countdown[0] != 0 || countdown[1] != 0 || countdown[2] != 0) {
240 if (countdown[3] > 60) {
266 switch (task->
state) {
270 for (i = 0; i < 4; i++) {
292#define STAGE_CHILDREN_SIZE 0x20
324#if VERSION_US || VERSION_JP
325#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
326#define EVENT_TEXT_FILE (TEXT_EVENTS_800 - 1)
327#define STAGE_FILE 0x6EE
328#define STAGE_FILE_8 0x715
330#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
331#define EVENT_TEXT_FILE (TEXT_EVENTS_800 - 1)
332#define STAGE_FILE 0x6FE
333#define STAGE_FILE_8 0x725
536 { 0, 8 }, { 1, 8 }, { 255, 0 },
539 { 71, 4 }, { 72, 4 }, { 73, 4 }, { 74, 4 },
540 { 75, 4 }, { 76, 4 }, { 77, 4 }, { 78, 4 },
541 { 79, 4 }, { 80, 4 }, { 255, 0 },
544 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
545 { 4, 6 }, { 5, 6 }, { 255, 0 },
548 { 52, 6 }, { 53, 6 }, { 54, 6 }, { 55, 6 },
549 { 56, 6 }, { 57, 6 }, { 58, 6 }, { 59, 6 },
550 { 60, 6 }, { 61, 6 }, { 62, 6 }, { 63, 6 },
551 { 64, 6 }, { 65, 6 }, { 66, 6 }, { 67, 6 },
552 { 68, 6 }, { 69, 6 }, { 255, 0 },
555 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
556 { 4, 6 }, { 5, 6 }, { 0, 6 }, { 1, 6 },
557 { 2, 6 }, { 3, 6 }, { 4, 6 }, { 5, 6 },
558 { 0, 6 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
559 { 4, 6 }, { 5, 6 }, { 255, 0 },
568 { 28, 0, 0x4BC, 0x273 },
569 { 28, 0, 0x39C, 0x373 },
570 { 20, 0, 0x2BC, 211 },
571 { 20, 0, 0x43C, 0x323 },
574 { 0, 6 }, { 1, 6 }, { 2, 68 }, { 1, 4 },
575 { 0, 4 }, { 255, 0 },
578 { 0x12C, 18 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
579 { 4, 6 }, { 5, 4 }, { 6, 4 }, { 7, 4 },
580 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 5, 4 },
581 { 6, 4 }, { 7, 4 }, { 5, 4 }, { 6, 4 },
582 { 7, 4 }, { 4, 4 }, { 3, 4 }, { 2, 4 },
583 { 1, 4 }, { 255, 0x3E7 },
641 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
642 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
643 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
644 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
645 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
646 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
647 { 0x180, 0x100, 0x19C, 0x158, 0x170, 0x58, 0x170, 0x1D9 },
648 { 0x180, 0x100, 0x1A2, 0x158, 0x188, 0x58, 0x170, 0x1D8 },
649 { 0x180, 0x100, 0x1A8, 0x158, 0x1A0, 0x58, 0x170, 0x1D7 },
650 { 0x180, 0x100, 0x18C, 0x170, 0x130, 0x70, 0x170, 0x1D6 },
651 { 0x180, 0x100, 0x192, 0x170, 0x148, 0x70, 0x170, 0x1D5 },
652 { 0x140, 0x100, 0x16E, 0x1A8, 0xB8, 0xA8, 0x170, 0x1D4 },
653 { 0x140, 0x100, 0x17A, 0x1B0, 0xE8, 0xB0, 0x170, 0x1D3 },
709 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 728, 212, 0, 0 },
710 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 760, 197, 0, 0 },
711 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 952, 884, 0, 0 },
712 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 984, 868, 0, 0 },
713 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 1112, 804, 0, 0 },
714 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 1144, 788, 0, 0 },
715 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 1240, 629, 0, 0 },
716 { 1, 0, 0x40, 2, 0x32, 2, 0, 5, 4, 0, 1272, 612, 0, 0 },
717 { 1, 2, 0x64, 6, 0x51, 0, 0, 0, 0, 0, 898, 764, 0, 0 },
718 { 1, 1, 0x64, 6, 0x46, 0, 0, 0, 0, 0, 898, 764, 0, 0 },
719 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 656, 176, 0, 0 },
720 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 688, 160, 0, 0 },
721 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 880, 848, 0, 0 },
722 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 912, 832, 0, 0 },
723 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 1040, 768, 0, 0 },
724 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 1072, 752, 0, 0 },
725 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 1168, 592, 0, 0 },
726 { 1, 0, 0x40, 6, 0x32, 2, 0, 5, 4, 0, 1200, 576, 0, 0 },
727 { 0, 4, 0x64, 6, 0x33, 0, 0, 0, 0, 0, 1550, 338, 0, 0 },
728 { 0, 3, 0x64, 6, 0x34, 0, 0, 0, 0, 0, 1550, 338, 0, 0 },
729 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
732 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_EXIT, 0x2DA, 0x4F2, 0x150, 3, 0, 0, 0 },
733 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_EXIT, 0x2DA, 0x522, 0x1F6, 3, 0, 0, 0 },
734 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_EXIT, 0x2DA, 0x552, 0x28E, 3, 0, 0, 0 },
735 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_EXIT, 0x2DA, 0x554, 0x400, 3, 0, 0, 0 },
736 { { {
PROGRESS(
STORY_REAL_WORLD), 1 }, {
FLAG_MECH_SOLDIER_WIN_SEEN, 0 } },
SLOT_EVENT, 0x366, 0, 0, 0, 0, 0, 0 },
737 { { {
FLAG(0x1C, 5), 1 }, {
FLAG_MECH_SOLDIER_ALERT_SEEN, 0 } },
SLOT_EVENT, 0x352, 0, 0, 0, 0, 0, 0 },
738 { { {
FLAG(0x1C, 5), 1 }, {
CODES_END, 0 } },
SLOT_LAUNCH, 0x2DB, 0x450, 0x330, 1, 0, 0, 0 },
739 { { {
FLAG(0x1C, 5), 1 }, {
CODES_END, 0 } },
SLOT_LAUNCH, 0x2DB, 0x2D0, 0xE0, 5, 0, 0, 0 },
740 { { {
CODES_END, 0 }, {
CODES_END, 0 } }, 0, 0, 0, 0, 0, 0, 0, 0 },
StageEffect * createStageEffect(s32 x, s32 y, s32 frame)
Creates a StageEffect at (x, y) with its sprites' frames from FRAME.
void * createTimer(void)
Creates the updateTimer task.
GfxState GFX
GFX: the graphics state and its methods.
void drawTimer(StageTask *task)
Draws the timer: its frame and the three digits of GAME.countdown, from the sprites of the stage's TI...
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 COUNTDOWN_BORROW(c)
Carries the borrow down the digits of GAME.countdown, the timer of the timed stages: a units digit th...
#define SCRIPT_WAIT_WALK(id)
until the character gets to its goal
#define FIELD_COMMAND_HALT_PARTNERS
The field commands, which an event script hands FIELD_TASK_COMMANDS as the first argument of a pose c...
#define SCRIPT_END
The commands of an event script (FieldEvent.script), as FIELDSTG_runEvent reads them: a halfword kind...
#define SLOT_LAUNCH
sends the player flying (FIELDSTG_launchActor)
#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 FIELD_MAP_FLOOR0
Some of FieldMap's maps (files): those of the floors the player walks on come first,...
#define SLOT_EVENT
starts the event arg
#define SCRIPT_WALK(id, x, y, dir)
Actor.setGoal: walks to (x, y), then faces dir.
#define FIELD_COMMAND_PLAY_SWITCH03
#define SCRIPT_WAIT_BOX
until box 0 closes
#define SLOT_EXIT
The kinds of StageSlot (type).
#define FIELD_MAP_AREAS
a cell's value: its battle area (FieldBattles), or 0
#define FIELD_COMMAND_PLAY_GONDRA_S
#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_COMMAND_PLAY_COMCD103
#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 ITEM(kind, id)
an item, in the bag or equipped; kind (bits 9-11) isn't read, and the scripts set it after the item's...
#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 SOUND_COUNT
SYSTEM10: a number counts up or down.
#define MUSIC_BATTLE
BATL0000: the maps' random battles (AreaBattle, nearly all of them)
#define MUSIC_MAGASTA
BGM_0011: the Undersea Base (Magasta), and the Deeper Crevice's gondola.
#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,...
s32 stepTileAnimation(StageTileAnim *obj, AnimFrame *frames, s32 once, s32 depth)
Steps OBJ's animation through FRAMES by the frame time (at most 4) and returns its frame: at the end ...
#define FLAG_MAGASTA_B2F_BERET_FOUND
wstag800: chest that gives the Beret, "I got" text; its conditions test it 0
@ STORY_REAL_WORLD
WSTAG750 (the emergency Matrix Chamber), event 820: back in the real world, for 180 seconds.
#define FLAG_MAGASTA_B2F_ROYAL_CROWN_FOUND
wstag800: chest that gives the Royal Crown, "I got" text; its conditions test it 0
#define FLAG_MECH_SOLDIER_ALERT_SEEN
wstag800 event 850: a Mech Soldier sounds the intruder alert at the Juggernaut launch; set at its end...
#define FLAG_MAGASTA_B2F_SUPER_CHARGE_FOUND
wstag800: chest that gives the Super Charge, "I got" text; its conditions test it 0
#define FLAG_ROYAL_GUARD_CHALLENGE_SEEN
wstag800 event 871: the player tells the Royal Guard to stop the launch; set at its end,...
#define FLAG_MAGASTA_BUTTON_PRESSED
wstag795 event 830: the player pushes a button on a control panel in Magasta B1F; set at its end,...
#define FLAG_MECH_SOLDIER_WIN_SEEN
wstag800 event 870: the player wins and finds the Dramon Guard in Magasta B2F; set at its end,...
#define FLAG_MAGASTA_B2F_MISTY_ARMOR_FOUND
wstag800: chest that gives the Misty Armor, "I got" text; its conditions test it 0
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 frozen
no control, triggers or encounters for the player: while the area name banner shows (FIELDSTG_createB...
s32 sheetEntry
the stage's sprite sheet, loaded before the field starts, or 0
s32 busy
an event, a warp, a launch or a battle has the player
s32 battleStarting
an encounter started (FIELDSTG_startEncounter)
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
s32 menuOpen
the field menu (START) or the inn (FIELDSTG_openInn) is open: the pad doesn't move the player
Vec2 start
where the player starts
StageSlot * slots
up to the first type 0
ActorImage * actors
then the actors', from actors[2]
s32 acting
the player talks, climbs, slides or searches
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 sprite effect a stage creates at (x, y) with the given frame, by kind.
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)
A map object animated while playing is set.
The map objects with animations 3 and 4, each animated once.
void(* nextState)(struct StageTileOnce *task)
StageTileAnimFlag tiles[2]
void(* setState)(struct StageTileOnce *task, s32 state)
StageTilePair with halfword flags.
void(* nextState)(struct StageTilePair16 *task)
void(* setState)(struct StageTilePair16 *task, s32 state)
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 * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
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 effectClutFrames[]
s32 stepTileAnimation2(StageTileAnimFlag *obj, AnimFrame *frames, s32 once, s32 depth)
stepTileAnimation for a StageTileAnimFlag
AnimFrame updateTilePair16Frames2[]
AnimFrame * updateTileOnceFrames[]
AnimFrame updateTilePair16Frames1[]
void * createTilePair16Done(void)
Creates the tile pair object, started in TASK_DONE.
void updateTileOnce(StageTileOnce *task)
Plays the map objects with animations 3 and 4 once, then ends.
FieldActorEntry * stageActors[]
AnimFrame updateTileOnceFrames_0[]
void endEvent871(void)
After event 871, with the player: gives the player the Dramon Guard and keeps it from playing again.
AnimFrame updateTilePair16Frames0[]
Defined below, after the code that uses them.
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing BGM_0011.
StageEffectSpot updateStageSpots[]
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
void updateTimer(StageTask *task, void **children)
The timer: counts GAME.countdown down while nothing stops it, then starts event 0x5E2.
void endEvent870(void)
After event 870, with Mech Soldier: starts the stage's event battle 0 and keeps it from playing again...
void endEvent850(void)
After event 850, with the player: sets flag 0x1C0A and keeps it from playing again.
AnimFrame updateTileOnceFrames_1[]
void updateTilePair16(StageTilePair16 *task)
Shows the first map object animated while running; when done, both.
void handleCommand837(StageTilePair16 *task, s32 id)
Plays the first map object's one-shot animation when the event of map object 0x35B happens.
void * createTilePair16(s32 arg)
Creates the button's map objects of event 850 (updateTilePair16) with an id.
void * createCommand839(s32 arg)
Command 839 of the event scripts: the button the player pushes in event 871 to stop the Juggernaut (u...
FieldBattles stageBattles[]