12#if VERSION_US || VERSION_JP
13#define BG_ARCHIVE 0x767
17#define BG_ARCHIVE 0x776
29 scroll.
x = (scroll.
x << 8) / 384;
30 scroll.
y = (scroll.
y << 8) / 384;
45 switch (task->
state) {
75 switch (task->
state) {
79 for (i = 0; i < 5; i++) {
148#if VERSION_US || VERSION_JP
149#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
150#define EVENT_TEXT_FILE (TEXT_EVENTS_800 - 1)
151#define STAGE_FILE 0x767
153#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
154#define EVENT_TEXT_FILE (TEXT_EVENTS_800 - 1)
155#define STAGE_FILE 0x776
269#elif VERSION_EU || VERSION_JP
325 { 60, 0, 0x318, 166 },
326 { 60, 0, 0x3F8, 0x116 },
327 { 60, 0, 168, 0x26E },
328 { 60, 0, 0x188, 0x2DE },
329 { 44, 0, 0x3F8, 0x2C6 },
332 { 0, 6 }, { 1, 6 }, { 2, 68 }, { 1, 4 },
333 { 0, 4 }, { 255, 0 },
336 { 0x12C, 18 }, { 1, 6 }, { 2, 6 }, { 3, 6 },
337 { 4, 6 }, { 5, 4 }, { 6, 4 }, { 7, 4 },
338 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 5, 4 },
339 { 6, 4 }, { 7, 4 }, { 5, 4 }, { 6, 4 },
340 { 7, 4 }, { 4, 4 }, { 3, 4 }, { 2, 4 },
341 { 1, 4 }, { 255, 0x3E7 },
399 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
400 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
401 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
402 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
403 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
404 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
405 { 0x1C0, 0x100, 0x1CD, 0x182, 0x234, 0x82, 0x160, 0x1FC },
406 { 0x1C0, 0x100, 0x1CD, 0x15A, 0x234, 0x5A, 0x170, 0x1FC },
426 { 1, 0, 0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
427 { 1, 0, 0xF9, 6, 3, 0, 0, 0, 0, 0, 853, 643, 643, 0 },
428 { 1, 0, 0xFF, 6, 4, 0, 0, 0, 0, 0, 124, 99, 0, 0 },
429 { 1, 0, 0xD6, 6, 1, 0, 0, 0, 0, 0, 341, 195, 0, 0 },
430 { 1, 0, 0xD6, 6, 1, 0, 0, 0, 0, 0, 469, 307, 0, 0 },
431 { 1, 0, 0xD6, 6, 1, 0, 0, 0, 0, 0, 597, 419, 0, 0 },
432 { 1, 0, 0xD6, 6, 1, 0, 0, 0, 0, 0, 725, 531, 0, 0 },
433 { 1, 0, 0xFF, 6, 2, 0, 0, 0, 0, 0, 156, 617, 617, 0 },
434 { 1, 0, 0xFF, 6, 2, 0, 0, 0, 0, 0, 780, 161, 161, 0 },
435 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
438 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_EXIT, 0x2DF, 0x310, 0x228, 3, 0, 0, 0 },
439 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_LAUNCH_OUT, 0x2DD, 0x504, 0x296, 5, 0, 0, 0 },
440 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_LAUNCH_OUT, 0x2DD, 0x344, 0xF6, 5, 0, 0, 0 },
441 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_LAUNCH_OUT, 0x2DD, 0x29C, 0x1AA, 1, 0, 0, 0 },
442 { { {
CODES_END, 0 }, {
CODES_END, 0 } },
SLOT_LAUNCH_OUT, 0x2DD, 0x3E4, 0x146, 5, 0, 0, 0 },
443 { { {
FLAG_GUNSLINGER_2F_SOLDIER_SEEN, 0 }, {
CODES_END, 0 } },
SLOT_EVENT, 0x3FC, 0, 0, 0, 0, 0, 0 },
444 { { {
FLAG_MEGADEATH_TAUNT_SEEN, 0 }, {
CODES_END, 0 } },
SLOT_EVENT, 0x406, 0, 0, 0, 0, 0, 0 },
445 { { {
FLAG(0x40, 0x72), 0 }, {
CODES_END, 0 } },
SLOT_EVENT, 0x410, 0, 0, 0, 0, 0, 0 },
446 { { {
FLAG_MEGADEATH_MEETING_SEEN, 0 }, {
CODES_END, 0 } },
SLOT_EVENT, 0x41A, 0, 0, 0, 0, 0, 0 },
447 { { {
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.
GfxState GFX
GFX: the graphics state and its methods.
GameFlags FLAGS_00
The flag bitset FLAGS_00 and the event functions.
#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 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 SCRIPT_LEAVE(mode, x, y, dir)
FIELDSTG_leaveField; ends the event.
#define FIELD_LAYER_MAP
the map, its objects and characters, and the menus
#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_COMMAND_STOP_CAMERA_SHAKE
#define FIELD_MAP_FLOOR0
Some of FieldMap's maps (files): those of the floors the player walks on come first,...
#define FIELD_COMMAND_SHAKE_CAMERA
#define FIELD_TASK_LAUNCHER
a stage's launchers (FIELDSTG_runLaunch)
#define SLOT_EVENT
starts the event arg
#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_LAUNCH_OUT
the same, then leaves for mode arg
#define SLOT_EXIT
The kinds of StageSlot (type).
#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
FileCache FILE_CACHE
The file cache.
#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...
#define MUSIC_BATTLE
BATL0000: the maps' random battles (AreaBattle, nearly all of them)
#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_GUNSLINGER
BGM_0026: the Gunslinger (the Spy Satellite)
#define MUSIC_BANK(music)
The sound bank of a music, which a stage loads for it (FieldState.soundBank)
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
#define FLAG_GUNSLINGER_2F_SOLDIER_SEEN
wstag815 event 1020: a Metal Soldier sounds the intruder alert in Gunslinger 2F; set at its end,...
@ STORY_OPERATION_SIGMA
WSTAG311 (A.o.A Headquarters, Amaterasu City), event 982, after event 981, where the A....
#define FLAG_MEGADEATH_MEETING_SEEN
wstag815 event 1050: Lord Megadeath, a life form born in the network, meets the player; set at its en...
#define FLAG_MEGADEATH_TAUNT_SEEN
wstag815 event 1030: Lord Megadeath taunts the player from beyond the Warp Gate; set at its end,...
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 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.
void *(* getEntry)(u32 fileAndIndex)
void(* applyAction)(s32 code, s32 value)
s32(* checkCondition)(u16 code, u16 value)
struct Layer *(* getLayer)(s32 id)
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
void(* setAltClut)()
(x, y)
void(* setLayerId)()
(id, depth)
void(* draw)()
(sheet, frame, x, y)
void(* setTexture)()
(x, y)
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)
An object of a map, which FIELDSTG draws: a record of the table at FieldState.objects,...
Uploads TIM images to VRAM (initTimLoader); acts on TIM_LOADER.
void(* setClutPos)()
(x, y)
void(* setImagePos)()
(x, y)
void(* loadArchive)()
(archive): each image 64 halfwords to the right
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 initTimLoader(TimLoader *obj)
Clears a TIM loader, gives it its methods and binds it.
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[]
void endEvent1020(void)
After event 1020, with Metal Soldier: starts the stage's event battle 0 and keeps it from playing aga...
#define BG_ARCHIVE
The files of the background, which the versions number differently.
void endEvent1040(void)
After event 1040, with the player: keeps it from playing again.
FieldActorEntry * stageActors[]
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing BGM_0026.
void drawBackground(StageTask *task)
Draws the two background images (file BG_ARCHIVE) scrolled at 2/3 of the layer's scroll.
StageTask * startStage(void *owner)
Creates the stage task (id 0x17) and calls the first function of its table.
StageEffectSpot updateStageSpots[]
Defined below, after the code that uses them.
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
void endEvent1030(void)
After event 1030, with Metal Soldier: starts the stage's event battle 0 and keeps it from playing aga...
void * createBackground(void)
Creates the spy satellite's background (updateBackground)
void updateBackground(StageTask *task)
Loads the background images (files BG_FILE and BG_FILE2) to VRAM, then draws them every frame.
void endEvent1050(void)
After event 1050, with the player: starts the stage's event battle 1 and keeps it from playing again.
void endEvent1041(void)
After event 1041, with the player: keeps it from playing again.
FieldBattles stageBattles[]