14#if VERSION_US || VERSION_JP
15#define BG_ARCHIVE 0x74E
18#define BG_ARCHIVE 0x75E
37 if (frame->
frame == 0xFF) {
70 switch (task->
state) {
85 task->
x = task->
body.
x >> 8;
87 task->
y = task->
body.
y >> 8;
96 if (task->
frame != 0) {
99 if (task->
y > 0x244) {
185 if (frame->
frame == 0xFF) {
200 switch (task->
state) {
203 if (task->
key1 == 0) {
204 task->
body.
x = 0x9600;
205 task->
body.
y = 0xE600;
211 task->
body.
x = 0x9600;
212 task->
body.
y = 0x1AE00;
215 task->
x = task->
body.
x >> 8;
216 task->
y = task->
body.
y >> 8;
219 if (object->
anim == 1) {
238 task->
x = task->
body.
x >> 8;
239 task->
y = task->
body.
y >> 8;
240 if (task->
y >= 0x1AE) {
241 task->
body.
y = 0x1AE00;
243 if (task->
body.
vy > 0x200) {
280 if ((++task->
step & 0x1F) == 0) {
305 task->
body.
x = 0x9600;
306 task->
body.
y = 0xE600;
363 pos[0] = task->
x >> 8;
364 pos[1] = (task->
y >> 8) + 0x100;
369 pos[0] = (task->
x >> 8) + 0x100;
378 switch (task->
state) {
389 if (task->
key1 != 0) {
401 if (task->
vx == 0x800) {
406 task->
vy = task->
vx / 2;
416 if (task->
x > 0x1FFFF) {
430 if (task !=
NULL &&
id == 0x336) {
445 switch (task->
state) {
467#define STAGE_CHILDREN_SIZE 0xC
476#if VERSION_US || VERSION_JP
477#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_06)
478#define EVENT_TEXT_FILE (TEXT_EVENTS_400 - 1)
479#define STAGE_FILE 0x74E
481#define STAGE_TEXT TEXT_FILE(TEXT_TALKS_06)
482#define EVENT_TEXT_FILE (TEXT_EVENTS_400 - 1)
483#define STAGE_FILE 0x75E
591 { 70, 8 }, { 71, 8 }, { 72, 8 }, { 73, 8 },
595 { 74, 8 }, { 75, 8 }, { 76, 8 }, { 77, 8 },
611 { 50, 5 }, { 52, 5 }, { 53, 5 }, { 54, 40 },
612 { 55, 8 }, { 56, 8 }, { 57, 10 }, { 58, 12 },
613 { 59, 180 }, { 255, 0 },
616 { 60, 4 }, { 61, 4 }, { 62, 0x3E7 }, { 255, 0 },
619 { 1, 4 }, { 2, 4 }, { 3, 4 }, { 4, 4 },
620 { 5, 4 }, { 6, 4 }, { 7, 4 }, { 8, 4 },
621 { 9, 4 }, { 10, 4 }, { 11, 4 }, { 12, 4 },
622 { 13, 4 }, { 14, 4 }, { 15, 4 }, { 16, 4 },
623 { 17, 4 }, { 18, 4 }, { 19, 4 }, { 20, 4 },
624 { 21, 4 }, { 22, 4 }, { 23, 4 }, { 24, 4 },
625 { 25, 4 }, { 26, 4 }, { 27, 4 }, { 28, 4 },
626 { 29, 4 }, { 30, 4 }, { 31, 4 }, { 32, 4 },
627 { 33, 4 }, { 34, 4 }, { 35, 4 }, { 36, 4 },
628 { 37, 4 }, { 38, 4 }, { 39, 4 }, { 40, 4 },
629 { 41, 4 }, { 42, 4 }, { 43, 4 }, { 44, 4 },
630 { 45, 4 }, { 46, 4 }, { 47, 4 }, { 255, 0x3E7 },
688 { 0x200, 0x100, 0x21C, 0x1A6, 0x70, 0xA6, 0x230, 0x1FE },
689 { 0x200, 0x100, 0x200, 0x100, 0, 0, 0x220, 0x1FE },
690 { 0x200, 0x100, 0x216, 0x138, 0x58, 0x38, 0x200, 0x1FD },
691 { 0x200, 0x100, 0x208, 0x1BC, 0x20, 0xBC, 0x210, 0x1FD },
692 { 0x200, 0x100, 0x210, 0x1BC, 0x40, 0xBC, 0x220, 0x1FD },
693 { 0x200, 0x100, 0x200, 0x1BC, 0, 0xBC, 0x230, 0x1FD },
694 { 0x1C0, 0x100, 0x1CC, 0x150, 0x230, 0x50, 0x160, 0x1FF },
702 { 1, 0, 0x6E, 6, 0, 0, 0, 0, 0, 0, 225, 318, 0, 0 },
703 { 1, 1, 0x94, 4, 0x32, 0, 0, 0, 0, 0, 0, -50, 0, 0 },
704 { 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.
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 SOUND_MTL_DOWN
The sounds the stages play, with SOUNDTST's names (engine/sound.h has the ones the overlays share)
#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_COMMAND_SHAKE_CAMERA
#define SCRIPT_WAIT_BOX
until box 0 closes
#define FIELD_COMMAND_PLAY_GONDRA_S
#define SCRIPT_POSE(id, set, dir)
Actor.setPose: its animation set, facing dir.
#define SCRIPT_WAIT(frames)
#define SCRIPT_WAIT_ANIM(id)
until its animation ends
#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 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_MAGASTA
BGM_0011: the Undersea Base (Magasta), and the Deeper Crevice's gondola.
#define MUSIC_BOSS
BOSS_000: the sectors' boss battles.
#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)
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,...
@ STORY_FAKE_BLUE_CARD
WSTAG410 (East Station), event 90: the Blue Card the player was given turns out to be a fake.
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(* 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 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)
s32(* getFrameTime)(void)
struct Layer *(* getLayer)(s32 id)
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
void(* addSortedCallback)()
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(* setAltClut)()
(x, y)
void(* setLayer)()
(layer, depth)
void(* setLayerId)()
(id, depth)
void(* setClutRow)()
(row)
void(* draw)()
(sheet, frame, x, y)
void(* setTexture)()
(x, y)
What moves a StageFaller or the StageMover of WSTAG415 at (x, y) in 8.8, and its animation: one layou...
s16 timer
the mover's frames of falling; a faller never sets it
s16 mode
the mover's; a faller's is 1 once it has bounced
Where a StageFaller starts and how it falls.
s16 bounce
divides vy when bouncing, 0 for no bounce
A sprite of WSTAG415 that falls from a point of a table, bounces once and dies at the bottom.
void(* setState)(struct StageFaller *task, s32 state)
void(* nextState)(struct StageFaller *task)
The object of WSTAG415 that events 0x331 to 0x334 drive.
void(* nextState)(struct StageMover *task)
StageTile * tile
the map object (FieldState.objects) with animation 1
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,...
u8 anim
which of a stage's animations sets frame (1-3); FIELDSTG finds objects by it (its lift,...
Any task, seen through its header.
void(* setSubstate)(struct Task *task, s32 substate)
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 * 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 handleCommand811(StageMover *task, s32 id)
Handles the events 0x331 to 0x334 sent to a StageMover.
void(* stageFuncs[])(void)
The stage's functions (common/start_stage.inc.c calls the first): a StageFuncs in the stages with a t...
Task * createCommand819(s32 id)
Command 819 of the event scripts: a thing that falls in event 150's earthquake (kind 3)
Task * createCommand816(s32 id)
The fallers of kinds 0 to 9.
AnimFrame updateFallerParams_0[]
AnimFrame updateMoverFrames1[]
AnimFrame updateMoverFrames2[]
Task * createCommand811(s32 id)
Creates the task of updateMover with the given id, kind 0.
Task * createCommand822(s32 id)
Command 822 of the event scripts: a thing that falls in event 150's earthquake (kind 6)
Task * createCommand817(s32 id)
Command 817 of the event scripts: a thing that falls in event 150's earthquake (kind 1)
Task * createCommand820(s32 id)
Command 820 of the event scripts: a thing that falls in event 150's earthquake (kind 4)
Task * createScroller(s32 kind)
Creates the task of updateScroller (id 0x32C) of the given kind.
void endEvent150(void)
After event 150, with the player: starts the stage's event battle 0 and sets flag 0x4018.
#define BG_ARCHIVE
The files of the background, which the versions number differently.
void drawScroller(StageScroller *task)
Draws a StageScroller: each image twice, the second 0x200 left and 0x100 down.
void handleCommand812(Task *task, s32 id)
Sets the substate of the task to 1 when the id is 0x336.
AnimFrame updateFallerParams_1[]
FieldActorEntry * stageActors[]
s32 stepFallBody(StageBody *body, AnimFrame *frames, s32 depth)
Steps the looping animation of a faller's StageBody, returning its frame.
static Task * createFaller(s32 id, s32 kind)
Creates the task of updateFaller with the given id, of kind KIND (its updateFallerParams)
Task * createCommand821(s32 id)
Command 821 of the event scripts: a thing that falls in event 150's earthquake (kind 5)
void setupStage(void)
Sets the stage up: its map, actors, battles and events, playing BGM_0011.
void updateScroller(StageScroller *task)
Loads the images of a StageScroller and scrolls it, slowing down to a stop in substate 1.
StageTile stageObjects[]
The tables and color setupStage gives FIELDSTG_state (FieldState)
AnimFrame updateMoverFrames0[]
StageFallParams updateFallerParams[]
Defined below, after the code that uses them.
Task * createCommand823(s32 id)
Command 823 of the event scripts: a thing that falls in event 150's earthquake (kind 7)
Task * createCommand825(s32 id)
Command 825 of the event scripts: the last of the ten things that fall in event 150's earthquake (kin...
Task * createCommand818(s32 id)
Command 818 of the event scripts: a thing that falls in event 150's earthquake (kind 2)
s32 stepMoverBody(StageBody *body, AnimFrame *frames, s32 depth)
Steps the animation of the mover's StageBody, holding its last frame, and returns the frame.
Task * createMover(s32 id)
Creates the mover of event 151, where the Digimon gets away (updateMover), already falling (mode 1)
void updateFaller(StageFaller *task)
Updates a StageFaller of kind key1: it falls from the start of its updateFallerParams with their spee...
Task * createCommand824(s32 id)
Command 824 of the event scripts: a thing that falls in event 150's earthquake (kind 8)
FieldBattles stageBattles[]
void updateMover(StageMover *task)
Updates a StageMover: falls in mode 1 and plays an animation in modes 2 to 4.
void drawFaller(StageFaller *task, Layer *layer)
Draws a StageFaller (a layer callback)