25 switch (task->
state) {
29 for (i = 0; i < 27; i++) {
52 if (task !=
NULL &&
id == 0x335) {
80 if (frame->
frame == 0xFF) {
82 frame = &frames[loop];
98 switch (task->
state) {
102 switch (object->
anim) {
128 for (i = 0; i < 4; i++) {
151 for (i = 0; i < 4; i++) {
168 if (frame == 0x12C) {
187 if (task !=
NULL &&
id == 0x35B) {
220 if (frame->
frame == 0xFF) {
225 }
else if (frame->
frame == 0xFF) {
255 switch (task->
state) {
285 task->
y8 = task->
y << 8;
291 if (task->
y >= -100 && task->
y <= 1000) {
294 task->
y8 = task->
up ? y8 - value : y8 + value;
295 task->
y = task->
y8 >> 8;
318 switch (task->
state) {
348#define STAGE_CHILDREN_SIZE 0xC
371#if VERSION_US || VERSION_JP
372#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
373#define EVENT_TEXT_FILE (TEXT_EVENTS_800 - 1)
374#define STAGE_FILE 0x662
376#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_07)
377#define EVENT_TEXT_FILE (TEXT_EVENTS_800 - 1)
378#define STAGE_FILE 0x672
509#elif VERSION_EU || VERSION_JP
546#elif VERSION_EU || VERSION_JP
581 0, 4, 12, 16, 24, 28, 36, 40,
582 48, 52, 60, 64, 72, 84, 96, 100,
583 108, 112, 120, 124, 132, 136, 148, 160,
584 172, 184, 196, 0x1000,
736 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
737 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
738 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
739 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
740 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
741 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
742 { 0x140, 0x100, 0x159, 0x120, 0x64, 0x20, 0x140, 0x1F5 },
743 { 0x140, 0x100, 0x147, 0x100, 0x1C, 0, 0x150, 0x1F5 },
744 { 0x140, 0x100, 0x144, 0x1D8, 0x10, 0xD8, 0x160, 0x1F5 },
763 { 1, 1, 0xFF, 6, 0x13, 0, 0, 0, 0, 0, 235, 78, 0, 0 },
764 { 1, 2, 0xFF, 6, 0x15, 0, 0, 0, 0, 0, 235, 78, 0, 0 },
765 { 1, 3, 0xFF, 6, 0x16, 0, 0, 0, 0, 0, 235, 78, 0, 0 },
766 { 1, 4, 0xFF, 6, 0x17, 0, 0, 0, 0, 0, 235, 78, 0, 0 },
767 { 0, 0, 0, 0, 0, 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.
#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 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 SCRIPT_FOLLOW(snap, id)
FIELDSTG_followWithCamera.
#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 SCRIPT_WALK(id, x, y, dir)
Actor.setGoal: walks to (x, y), then faces dir.
#define SCRIPT_WAIT_BOX
until box 0 closes
#define SCRIPT_POSE(id, set, dir)
Actor.setPose: its animation set, facing dir.
#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 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...
s32 isOnScreen(s32 x, s32 y, s32 w, s32 h)
Whether the rectangle (x, y, w, h) is in the view of the map's layer.
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
#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)
#define MUSIC_BOSS_1
BOSS_001: the Digimon Arena's, the cities', the dungeons' and the A.o.A's boss battles.
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
FIELDSTG's start of the stage (StageEntry.init in FIELDSTG_stages): the stage's task,...
#define FLAG_FORCED_DIGITIZATION_SEEN
wstag750 event 860: the realize transfer limit is reached and the player is forced back to digital; s...
@ STORY_REAL_WORLD
WSTAG750 (the emergency Matrix Chamber), event 820: back in the real world, for 180 seconds.
#define FLAG_JUGGERNAUT_LAUNCH_SEEN
wstag805 event 880: the player wins but the field is gone and the Juggernaut launches; set at its end...
Where an actor's frames go in VRAM: one of the records after the FieldImage (Actor....
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
ActorImage * actors
then the actors', from actors[2]
s32 mapFile
the file of the map's tiles (FIELDSTG_createMapStreamer)
s32 startDir
and its direction
CVECTOR spriteColor
the field's sprites' color, unless cd is 0
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)
s32(* getFrameTime)(void)
struct Layer *(* getLayer)(s32 id)
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
short(* playSound)(s32 id)
returns the voice of a key-on
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
void(* setLayer)()
(layer, depth)
void(* setClutRow)()
(row)
void(* draw)()
(sheet, frame, x, y)
void(* setTexture)()
(x, y)
Sets its children to TASK_DONE one after the other, at the times of a table.
void(* nextState)(struct StageFloaterChain *task)
void(* setState)(struct StageFloaterChain *task, s32 state)
A frame of a StageFloaterPart's animation, with what it adds to value.
A sprite of a StageFloater, its animation and what the animation adds up.
Where a StageFloater is created.
A sprite from the stage's sheet at (x, y) that moves up or down in TASK_DONE.
void(* setState)(struct StageFloater *task, s32 state)
void(* nextState)(struct StageFloater *task)
void(* setSubstate)(struct StageFloater *task, s32 substate)
StageFloaterPart parts[3]
s32 y8
y << 8 while moving
The children of a StageFloaterChain.
StageFloater * floaters[27]
The task a stage starts (startStage), updated by its updateStage.
void(* nextState)(struct StageTask *task)
A map object with the animation that sets its frame.
A frame of a looping animation: after the last (frame 0xFF) it goes back to loop.
The map objects with animations 1 to 4.
void(* setState)(struct StageTileQuad *task, s32 state)
void(* nextState)(struct StageTileQuad *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 * 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...
void * createTileQuad(s32 arg)
Creates the map objects of event 881, where the Juggernaut launches (updateTileQuad),...
StageFloater * createFloater(s32 x, s32 y, s32 up)
Defined below, after the code that uses them.
StageTileLoopFrame updateTileQuadFrames_2[]
StageFloaterFrame updateFloaterFrames1[]
void endEvent881(void)
After event 881, with the player: gives the player the Wing Helmet.
StageFloaterFrame updateFloaterFrames0[]
void endEvent882(void)
After event 882, with Royal Guard: keeps it from playing again.
const CVECTOR stageColor
the color the setup copies to FIELDSTG_state.spriteColor
void * createFloaterChain(s32 arg)
Creates the chain of floaters.
void drawFloaterPart(StageFloater *task, Layer *layer, s32 idx)
Draws a part of a floater.
FieldActorEntry * stageActors[]
StageFloaterFrame updateFloaterFrames3[]
StageTileLoopFrame updateTileQuadFrames_0[]
StageFloaterSpot updateFloaterChainSpots[]
s32 stepTileLoop(StageTileAnim *obj, StageTileLoopFrame *frames, s32 depth)
Advances a looping animation, returns its frame.
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing BGM_0011.
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
void updateTileQuad(StageTileQuad *task)
Animates the map objects with animations 1 to 4: 2 and 3 hidden while running.
void updateFloater(StageFloater *task)
A floater: animated in place while running, moving up or down with a sound in TASK_DONE.
StageTileLoopFrame updateTileQuadFrames_3[]
void handleCommand841(StageFloaterChain *task, s32 id)
Starts the chain when the event of map object 0x335 happens.
void updateFloaterChain(StageFloaterChain *task, StageFloaters *children)
Creates the 27 floaters; in TASK_DONE sets them moving one after the other.
StageTileLoopFrame updateTileQuadFrames_1[]
s32 stepFloaterPart(StageFloaterPart *obj, StageFloaterFrame *frames, s32 once, s32 depth)
Advances a part's animation (adding up its deltas when once), returns its frame.
StageFloaterFrame updateFloaterFrames2[]
StageTileLoopFrame * updateTileQuadFrames[]
void endEvent880(void)
After event 880, with Royal Guard: starts the stage's event battle 0 and keeps it from playing again.
FieldBattles stageBattles[]
void handleCommand840(StageTileQuad *task, s32 id)
Plays a sound and starts the map objects' TASK_DONE animations when the event of map object 0x35B hap...