11#if VERSION_US || VERSION_JP
103 Task **children = (
Task **)fieldChildren;
130 if (*children !=
NULL) {
131 (*children)->setState(*children,
TASK_KILL);
146 setRGB0(prim.
f4, 0x10, 0x10, 0x10);
148 setSemiTrans(prim.
f4, 1);
157 addPrim(ot, prim.
f4);
159 setDrawTPage(prim.
tpage, 0, 1, getTPage(0, 2, 320, 0));
160 addPrim(ot, prim.
tpage);
165 setPolyFT4(prim.
ft4);
166 setSemiTrans(prim.
ft4, 1);
167 setRGB0(prim.
ft4, 0x80, 0x80, 0x80);
169 prim.
ft4->x0 = prim.
ft4->x2 = x;
180 prim.
ft4->y0 = prim.
ft4->y1 = y;
183 addPrim(ot, prim.
ft4);
213 if (player !=
NULL && player->
tile.
x != 0) {
228 if (task->
width <= 0) {
237 clip.
x = actor->
tile.
x - clip.
x;
238 clip.
y = actor->
tile.
y - clip.
y;
243 clip.
x -= task->
width / 2;
262 if (task->
fade != 0x8000) {
268 switch (task->
step) {
333 if (npcList !=
NULL) {
335 while (*npcList !=
NULL) {
362 for (i = 0; i < 4; i++) {
367 for (i = 0; i < 15; i++) {
386 while (*list !=
NULL) {
429 switch (task->
step) {
537 switch (task->
step) {
574 switch (task->
state) {
583 switch (task->
step) {
604 switch (task->
step) {
708#define PICK_PRIZE(common, rare) \
710 BATTLE_SETUP.prize = common; \
712 BATTLE_SETUP.prize = rare; \
738#if VERSION_EU || VERSION_JP
866#if VERSION_EU || VERSION_JP
987 for (i = 0; i < 12; i++) {
990 for (i = 0; i < 3; i++) {
Task * FIELDSTG_createBanner(s32 show)
Creates the area name banner, which closes at once unless show; the player is frozen until it ends.
Camera * FIELDSTG_createCamera(void)
Creates the camera.
CdReader CD_READER
The CD reader.
CutsceneAnim * FIELDSTG_createCutsceneAnim(s32 kind)
Creates a cutscene animation of a kind.
GfxState GFX
GFX: the graphics state and its methods.
FieldEffect * FIELDSTG_createEffect(s32 x, s32 y, s32 set)
Creates the effect of a set at (x, y)
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 ...
Actor * FIELDSTG_createActor(s32 key1, s32 kind, s32 image, FieldActorEntry *entry)
Creates a character (FIELD_TASK_ACTOR): key1 is the character, key2 its kind (0 the player,...
void FIELDSTG_startListedEvent(s32 index)
Starts the event FIELDSTG_eventIds[index] (the executable calls it)
void FIELDSTG_openInn(void)
Opens the inn: the field task waits for it (the executable calls it)
static void moveTransitionTile(FieldTask *task, s32 speed)
On a frame the GPU draws the first buffer, moves the next tile (FIELDSTG_tileMoves[counter]) out of t...
void * FIELDSTG_startEventBattle5(void)
Starts battle 5 of the fourth area: the end of the stages' events 9000.
static void setUpFieldScreen(void)
Sets the screen up for the field: the display and its layers.
static void killCharacters(FieldChildren *children)
Ends the player, the partners and the map's characters.
static void createCharacters(FieldChildren *children)
Creates the map's characters (FieldState.actors but the player's) whose conditions hold,...
void FIELDSTG_updateField(FieldTask *task, FieldChildren *children)
The field's update: sets up the stage, creates the characters and the NPCs, then runs the field and o...
void FIELDSTG_closeField(FieldTask *task, FieldChildren *children)
Closes the field for the next mode: the view shrinks to nothing, the cover fades in,...
void FIELDSTG_startWarp(s32 kind, Vec2 *pos, SlotDest *dest)
Starts a warp from pos: the field task plays the effect and the cutscene of kind, then leaves for the...
static void pickEvenFighterPrize(s32 mode)
The prize of an even prize fighter in the stage of the mode: the rare item 1 time in 16.
static void startField(FieldTask *task, FieldChildren *children)
The field's first step: the file cache and the screen set up, the stage's overlay loaded and started,...
static void requestBattleFiles(void)
Has the battle's files read while the transition plays.
void FIELDSTG_leaveField(s32 mode, s32 arg, s32 x, s32 y, s32 dir)
Leaves the field for a mode now (the executable calls it by this name)
static void placeTransitionTiles(void)
Puts the transition's tiles where they cover the screen.
void FIELDSTG_leaveFieldAfter(s32 mode, s32 arg, s32 x, s32 y, s32 dir, s32 delay)
Leaves the field for a mode after a delay: the field task (FIELD_TASK_FIELD) goes to TASK_DONE,...
static void pickOddFighterPrize(s32 mode)
The prize of an odd prize fighter in the stage of the mode: the rare item 1 time in 32.
static void showField(FieldTask *task, FieldChildren *children)
The field's last loading step: once the CD is free, the high buffer freed and the map streamer create...
static void waitToRequestBattleFiles(void)
Asks for the battle's files once the CD has been free on two frames.
s32 FIELDSTG_keepsFileCache(void)
Whether the mode is FIELD_MODE_WSTAG415 or FIELD_MODE_WSTAG815, whose field keeps the file cache and ...
static void createParty(FieldChildren *children)
Creates the player: the first of the characters 1, 0x6A, 0x146 and 0x147 in FieldState....
static void openFieldMenu(FieldTask *task, FieldChildren *children)
From the STORY_GENJI_BEATEN on, START opens the field menu (STSTATUS) while the field is idle; the pl...
void FIELDSTG_playBattleTransition(FieldTask *task, FieldChildren *fieldChildren)
The field's battle transition: the screen breaks into TRANSITION_COLUMNS by TRANSITION_ROWS tiles tha...
void FIELDSTG_startEncounter(s32 encounter)
Starts encounter FIELDSTG_encounters[encounter]: the field task (FIELD_TASK_FIELD) leaves for the bat...
Task * FIELDSTG_createField(void)
Creates the field's main task.
#define PICK_PRIZE(common, rare)
The prize of a battle, an item: the common one, or the rare one when the roll is 0.
static void warpAway(FieldTask *task, FieldChildren *children)
The warp's steps: its effect and sound, a fade out after 0x3C, the field's characters,...
#define FIELD_LAYER_MAP
the map, its objects and characters, and the menus
#define FIELD_LAYER_COVER
the cover that fades the screen (FIELDSTG_drawCover)
#define FIELD_CHARACTER_PARTNERS
#define FIELD_LAYER_TEXT
the message and talk boxes
#define FIELD_TASK_ACTOR
every character (FIELDSTG_createActor)
#define FIELD_FLAG_ENCOUNTERED
The FLAGS_00 flag that every encounter sets (FIELDSTG_startEncounter); until it is set,...
#define FIELD_LAYER_BACK
The field's drawing layers, by their ids (GFX.funcs.createLayer), as FIELDSTG_updateField creates the...
#define FIELD_MAP_AREAS
a cell's value: its battle area (FieldBattles), or 0
#define FIELD_TASK_FIELD
the field's main task (FIELDSTG_createField)
#define FIELD_CHARACTER_PLAYER
The characters (Actor.key1, FieldActorEntry.id) that FIELDSTG_updateField creates for the party.
#define FIELD_LAYER_BANNER
the area name banner
FIELDSTG.PRO: the field mode, where the player walks around the map.
#define TRANSITION_WAIT
the steps after the last tile, before the mode
#define FIELD_VISITED_FLAG(mode)
The flag set when the field of a mode is entered: FLAGS_00's group 0x20, flag mode - 0x200.
#define FIELD_MODE_WSTAG815
#define TRANSITION_SPEED
pixels a frame
#define TRANSITION_GONE
a tile's coordinate once it has slid off
#define TRANSITION_TILE_HEIGHT
#define SOUND_ENCOUNTS
the transition to a battle
#define TRANSITION_DONE
the step once the mode is requested
#define SOUND_DIGIMENT
a warp's effect
#define FIELD_PRIZE_FIGHTER_COUNT
#define TRANSITION_IMAGE_X
#define FIELD_MODE_WSTAG415
The modes of two fields that keep the file cache (FIELDSTG_keepsFileCache)
#define TRANSITION_TILE_WIDTH
#define TRANSITION_COLUMNS
FIELDSTG_playBattleTransition's tiles: a copy of the screen at TRANSITION_IMAGE_X in VRAM,...
#define FIELD_PRIZE_FIGHTERS
The fighters whose battles always give an item (FIELDSTG_startEncounter)
static void FIELDSTG_startBattle(AreaBattle *battle)
Starts a battle: its fight stage, its music and its encounter.
s16 FIELDSTG_eventIds[]
the events FIELDSTG_startListedEvent starts
Encounter FIELDSTG_encounters[]
The battles that can start on the field (FIELDSTG_startEncounter)
TileMove FIELDSTG_tileMoves[]
Vec2 FIELDSTG_tiles[5][6]
FIELDSTG_playBattleTransition's.
s32 FIELDSTG_battleFileStep
FIELDSTG_playBattleTransition's: 0 and 1 wait for the CD, 2 the battle's files are asked for.
FieldState FIELDSTG_state
FileCache FILE_CACHE
The file cache.
Task * FIELDSTG_createFileLoader(s32 step)
Creates the file loader, which starts at a step.
#define MODE_STAGE_SELECT
STAGSLCT, the debug stage select.
#define MODE_BATTLE
FIGHTSTG.
#define MODE_PLAYER_NAME
STPLNMET: the player's name entry.
#define MODE_TITLE
STDWTITL's title screen; its movies follow.
#define MODE_OVERLAY(mode)
The first mode of a mode's overlay: MODE_OVERLAY(mode) == MODE_TITLE for all of STDWTITL's.
#define MODE_BATTLE_MOVIE
#define SCREEN_WIDTH
The screen the modes draw on (setDisplayMode, their layers' rects)
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
Inn * createInn(s32 layerId)
Starts the inn of the current game mode on a layer.
MapObjects * FIELDSTG_createMapObjects(s32 sprites, StageTile *objects)
Creates the map's objects, with their sprites.
MapStreamer * FIELDSTG_createMapStreamer(s32 file)
Creates the map streamer of a file.
void FIELDSTG_drawCover(s32 id, s32 level)
Covers the screen on the layer id at a shade of level (8.8)
OverlayLoader OVERLAY_LOADER
PadState PAD
Controller input: cleared by initPad, then the methods.
TaskRegistry TASK_REGISTRY
ScreenFade * createScreenFade(s32 layerId)
A screen fade task on a layer, idle until started.
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
@ STORY_GENJI_BEATEN
WSTAG200, event 52: after the first battle, won against Tamer Genji (event 50), the Digimon Navi give...
@ STORY_EXTRA
WSTAG780, event 1500, in the European and Japanese versions: the extra chapter, whose stages are FIEL...
@ STORY_MOVIE_BATTLES
WSTAG820, event 1080, with Snatchmon: each encounter plays MODE_BATTLE_MOVIE first.
@ STORY_PARTNERS_RECEIVED
WSTAG212, events 10 to 12: the Tamer Service downloads the starter pack's Digimon (DM0010-DM0012,...
A character on the field (FIELDSTG_createActor): the player (kind 0) and the other characters.
void(* setSubstate)(struct Actor *task, s32 substate)
void(* setState)(struct Actor *task, s32 state)
A battle of an area's BattleList, which can start on the field (see FIELDSTG_startEncounter); FIGHTST...
u8 ambushChance
a chance that WFIGHTMN scales by level
s32 battle
the battle (BattleResult.battle)
u8 encounterKind
Encounter.kind; only the enemies' condition 13 reads it.
u8 blocks[12]
by BATTLE_BLOCK_*: what the player can't do in the battle
s32 hasPrize
1: the battle always gives prize
u8 kind
copied to BATTLE_SETUP.encounterKind: 1 for nearly all the maps' random battles (some enemies' battle...
u8 blocks[12]
copied to BATTLE_SETUP.blocks
A character of the field (FieldState.actors, a list of pointers up to NULL), which FIELDSTG_updateFie...
s16 image
its ActorImage, of FieldState.images.actors from 2 (FIELDSTG_createActor)
u16 * conditions
FLAGS_00.checkConditions's, or NULL.
The children of the field's main task (FieldTask, FIELDSTG_updateField)
struct Actor * actors[4]
the player and the partners
struct MapStreamer * mapStreamer
FIELDSTG_createMapStreamer's.
Task * fileLoader
FIELDSTG_createFileLoader's, as the field starts.
FieldMenu * menu
createFieldMenu's
struct Inn * inn
createInn's (FIELDSTG_openInn)
union FieldChildren::@14 awaited
the task the field waits for, until it ends
struct Triggers * triggers
FIELDSTG_createTriggers's.
Task * banner
FIELDSTG_createBanner's.
Task * stage
FieldState.stageInit's.
struct FieldEffect * effect
FIELDSTG_createEffect's.
struct CutsceneAnim * cutscene
FIELDSTG_createCutsceneAnim's.
struct Actor * npcs[15]
FieldState.actors's other characters.
struct MapObjects * mapObjects
FIELDSTG_createMapObjects's.
void(* setFile)(s32 index, s32 file)
FIELDSTG_setMapFile.
s32 frozen
no control, triggers or encounters for the player: while the area name banner shows (FIELDSTG_createB...
struct Task *(* stageInit)(void *owner)
starts the stage's task
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 defaultStartDir
and its direction
s32 battleStarting
an encounter started (FIELDSTG_startEncounter)
s32 soundBank
SOUND.loadBank's, or 0.
StageTile * objects
the map objects, up to the first margin 0
void(* init)(void)
FIELDSTG_pickStage.
s32 menuOpen
the field menu (START) or the inn (FIELDSTG_openInn) is open: the pad doesn't move the player
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)
Vec2 defaultStart
where the player starts without a mode argument
s32 music
SOUND.playSound's, or 0.
s32 stageFile
the stage overlay's file
The field's main task (FIELDSTG_updateField, FIELD_TASK_FIELD); its children follow.
s32 centerOnPlayer
the closing clip shrinks onto the player
s32 leaveDelay
the frames left before it closes the field
void * highBuffer
a buffer at the end of the heap
s32 nextMode
the mode it leaves for (FIELDSTG_leaveFieldAfter)
void(* tickCounter)(struct FieldTask *task)
void(* nextSubstate)(struct FieldTask *task)
s32 width
of the clip rectangle
void(* nextStep)(struct FieldTask *task)
Vec2 warpPos
where the warp's effect plays
void(* setSubstate)(struct FieldTask *task, s32 substate)
void(* setState)(struct FieldTask *task, s32 state)
void(* nextState)(struct FieldTask *task)
s32 fade
FIELDSTG_drawCover's level.
SlotDest * warp
where it leads
s32 warpKind
the effect and cutscene of a warp (FIELDSTG_startWarp)
void(* touchMarked)(void)
void(* freeFrom)(u32 addr)
void(* request)(s32 file)
void(* applyAction)(s32 code, s32 value)
s32(* checkConditions)(u16 *list)
void(* updateModeFlags)(void)
void(* requestMode)(s32 mode, s32 arg)
u16 place
where the last warp or trigger put the player (FieldBattles.id)
u16 placeArg
the place's argument, which the stage reads with it
s32 fieldMode
where the menu returns to
Vec2 fieldPos
the player's, there
s32(* getFrameTime)(void)
void(* allocPrimBuffers)(s32 size)
struct Layer *(* createLayer)(RECT *rect, s32 otShift, s32 id)
struct Layer *(* getLayer)(s32 id)
void(* setPrim)(void *next)
void(* setDisplayMode)(s32 w, s32 h, s32 hires, s32 interlace)
s32 buffer
the one being drawn
void *(* allocHigh)(s32 size, s32 tag)
from the end of the heap
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
u_long *(* getOtEntry)(struct Layer *, s32 depth)
void(* setBgColor)()
no prototype: callers would truncate u8 args
void(* setClipSize)()
no prototype: callers would truncate s16 args
void(* setClipPos)()
no prototype: callers would truncate s16 args
void(* setState)(struct MapObjects *task, s32 state)
void(* setState)(struct MapStreamer *task, s32 state)
void(* loadSubOverlay)(s32 file)
s32(* getPressed)(s32 pad)
s32(* next)(void)
0 to RANDOM_COUNT - 1
void(* start)(struct ScreenFade *fade, s32 fadeIn, s32 frames)
TASK_DONE when done.
Where a slot leads: a StageSlot from its arg on, as the warps (FieldTask.warp) and the launches (Laun...
u16 place
copied to GAME.place, the place (FieldBattles.id)
u16 placeArg
copied to GAME.placeArg
s32 music
the exclusive sound playing
void(* stopSound)(s32 id)
short(* playSound)(s32 id)
returns the voice of a key-on
void *(* find)(s32 id, s32 key1, s32 key2)
Any task, seen through its header.
void(* setSubstate)(struct Task *task, s32 substate)
A step of FIELDSTG_playBattleTransition's spiral: one coordinate of a tile moves by dir until it pass...
s32 dir
1, -1, or 0 at the end
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.
Triggers * FIELDSTG_createTriggers(s32 sheetEntry, StageSlot *slots)
Creates the triggers.
The next free primitive of the packet buffer (getPrim), written as the kind that is drawn next.