Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
field.c File Reference

The field's main task: it sets the field up, runs it, and closes it for a battle or another mode, and what the executable, the stages and the actors ask of it: an encounter, an event, the inn or a warp. More...

#include "field/field_mode.h"
Include dependency graph for field.c:

Go to the source code of this file.

Macros

#define PICK_PRIZE(common, rare)
 The prize of a battle, an item: the common one, or the rare one when the roll is 0.
 

Functions

static void requestBattleFiles (void)
 Has the battle's files read while the transition plays.
 
static void placeTransitionTiles (void)
 Puts the transition's tiles where they cover the screen.
 
static void waitToRequestBattleFiles (void)
 Asks for the battle's files once the CD has been free on two frames.
 
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 the screen; after the last one, waits TRANSITION_WAIT frames and asks for the battle's mode.
 
void FIELDSTG_playBattleTransition (FieldTask *task, FieldChildren *fieldChildren)
 The field's battle transition: the screen breaks into TRANSITION_COLUMNS by TRANSITION_ROWS tiles that slide off in a spiral (FIELDSTG_tileMoves, one move per counter step), then it requests the battle's mode.
 
void FIELDSTG_closeField (FieldTask *task, FieldChildren *children)
 Closes the field for the next mode: the view shrinks to nothing, the cover fades in, and the mode is requested with where the player stands.
 
s32 FIELDSTG_keepsFileCache (void)
 Whether the mode is FIELD_MODE_WSTAG415 or FIELD_MODE_WSTAG815, whose field keeps the file cache and doesn't take the high buffer.
 
static void setUpFieldScreen (void)
 Sets the screen up for the field: the display and its layers.
 
static void createCharacters (FieldChildren *children)
 Creates the map's characters (FieldState.actors but the player's) whose conditions hold, where their entries put them.
 
static void killCharacters (FieldChildren *children)
 Ends the player, the partners and the map's characters.
 
static void createParty (FieldChildren *children)
 Creates the player: the first of the characters 1, 0x6A, 0x146 and 0x147 in FieldState.actors whose conditions hold, or the player and the party's partners.
 
static void warpAway (FieldTask *task, FieldChildren *children)
 The warp's steps: its effect and sound, a fade out after 0x3C, the field's characters, map and objects killed while the warp's cutscene plays, then the field left for the warp's mode and place.
 
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 player's place is kept to come back to.
 
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, the mode's visited flag set, the player's start taken from where the field was left, and the banner created.
 
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 created (unless the file cache is kept), then the banner told to go once the map runs, and the field runs.
 
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 opens its menu.
 
Task * FIELDSTG_createField (void)
 Creates the field's main task.
 
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, which closes the field (FIELDSTG_closeField) and requests the mode with its argument.
 
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 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 pickEvenFighterPrize (s32 mode)
 The prize of an even prize fighter in the stage of the mode: the rare item 1 time in 16.
 
void FIELDSTG_startEncounter (s32 encounter)
 Starts encounter FIELDSTG_encounters[encounter]: the field task (FIELD_TASK_FIELD) leaves for the battle (MODE_BATTLE, after a movie in the chapter STORY_MOVIE_BATTLES), and BATTLE_SETUP takes the encounter's enemies and bytes.
 
void * FIELDSTG_startEventBattle5 (void)
 Starts battle 5 of the fourth area: the end of the stages' events 9000.
 
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)
 
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 warp's mode.
 

Detailed Description

The field's main task: it sets the field up, runs it, and closes it for a battle or another mode, and what the executable, the stages and the actors ask of it: an encounter, an event, the inn or a warp.

It's one object because startEncounter's jump tables follow FIELDSTG_updateField's with a gap that only the same object's 8-byte alignment makes

Definition in file field.c.

Macro Definition Documentation

◆ PICK_PRIZE

#define PICK_PRIZE (   common,
  rare 
)
Value:
if (roll != 0) { \
BATTLE_SETUP.prize = common; \
} else { \
BATTLE_SETUP.prize = rare; \
}
BattleSetup BATTLE_SETUP
Definition items.c:886
s32 prize
an item (BattleResult.item)
Definition game_state.h:391

The prize of a battle, an item: the common one, or the rare one when the roll is 0.

Definition at line 708 of file field.c.

Function Documentation

◆ requestBattleFiles()

static void requestBattleFiles ( void  )
inlinestatic

Has the battle's files read while the transition plays.

Definition at line 10 of file field.c.

Referenced by waitToRequestBattleFiles().

Here is the caller graph for this function:

◆ placeTransitionTiles()

static void placeTransitionTiles ( void  )
inlinestatic

Puts the transition's tiles where they cover the screen.

Definition at line 27 of file field.c.

Referenced by FIELDSTG_playBattleTransition().

Here is the caller graph for this function:

◆ waitToRequestBattleFiles()

static void waitToRequestBattleFiles ( void  )
inlinestatic

Asks for the battle's files once the CD has been free on two frames.

Definition at line 40 of file field.c.

Referenced by FIELDSTG_playBattleTransition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveTransitionTile()

static void moveTransitionTile ( FieldTask *  task,
s32  speed 
)
inlinestatic

On a frame the GPU draws the first buffer, moves the next tile (FIELDSTG_tileMoves[counter]) out of the screen; after the last one, waits TRANSITION_WAIT frames and asks for the battle's mode.

< a tile's coordinate once it has slid off

< a tile's coordinate once it has slid off

< the steps after the last tile, before the mode

< the step once the mode is requested

< the step once the mode is requested

Definition at line 61 of file field.c.

Referenced by FIELDSTG_playBattleTransition().

Here is the caller graph for this function:

◆ FIELDSTG_playBattleTransition()

void FIELDSTG_playBattleTransition ( FieldTask *  task,
FieldChildren *  fieldChildren 
)

The field's battle transition: the screen breaks into TRANSITION_COLUMNS by TRANSITION_ROWS tiles that slide off in a spiral (FIELDSTG_tileMoves, one move per counter step), then it requests the battle's mode.

field.c

The match depends on the move being an early exit, a do-while (0) that breaks while the buffer is busy, with move declared in it: the block's note stops stmt.c from rolling the exit test to the loop's end, and the loop notes make the GFX.buffer load wait for the counter's in the second scheduler.

< the background's color

< the map, its objects and characters, and the menus

< the transition to a battle

< the map, its objects and characters, and the menus

< pixels a frame

< the step once the mode is requested

< a tile's coordinate once it has slid off

< a tile's coordinate once it has slid off

Definition at line 102 of file field.c.

Referenced by FIELDSTG_updateField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIELDSTG_closeField()

void FIELDSTG_closeField ( FieldTask *  task,
FieldChildren *  children 
)

Closes the field for the next mode: the view shrinks to nothing, the cover fades in, and the mode is requested with where the player stands.

< every character (FIELDSTG_createActor)

< the map, its objects and characters, and the menus

< every character (FIELDSTG_createActor)

< the cover that fades the screen (FIELDSTG_drawCover)

< the cover that fades the screen (FIELDSTG_drawCover)

< the cover that fades the screen (FIELDSTG_drawCover)

Definition at line 200 of file field.c.

Referenced by FIELDSTG_updateField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIELDSTG_keepsFileCache()

s32 FIELDSTG_keepsFileCache ( void  )

Whether the mode is FIELD_MODE_WSTAG415 or FIELD_MODE_WSTAG815, whose field keeps the file cache and doesn't take the high buffer.

< where the player's run doesn't check the probes ahead (FIELDSTG_checkFlightProbes)

Definition at line 296 of file field.c.

Referenced by showField(), and startField().

Here is the caller graph for this function:

◆ setUpFieldScreen()

static void setUpFieldScreen ( void  )
inlinestatic

Sets the screen up for the field: the display and its layers.

< the background's color

< the cover that fades the screen (FIELDSTG_drawCover)

< the map, its objects and characters, and the menus

< the message and talk boxes

< the area name banner

Definition at line 304 of file field.c.

Referenced by startField().

Here is the caller graph for this function:

◆ createCharacters()

static void createCharacters ( FieldChildren *  children)
inlinestatic

Creates the map's characters (FieldState.actors but the player's) whose conditions hold, where their entries put them.

Definition at line 327 of file field.c.

Referenced by FIELDSTG_updateField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ killCharacters()

static void killCharacters ( FieldChildren *  children)
inlinestatic

Ends the player, the partners and the map's characters.

Definition at line 359 of file field.c.

Referenced by warpAway().

Here is the caller graph for this function:

◆ createParty()

static void createParty ( FieldChildren *  children)
inlinestatic

Creates the player: the first of the characters 1, 0x6A, 0x146 and 0x147 in FieldState.actors whose conditions hold, or the player and the party's partners.

< + the partner (GAME.funcs.getPartyPartner)

< + the partner (GAME.funcs.getPartyPartner)

< + the partner (GAME.funcs.getPartyPartner)

Definition at line 377 of file field.c.

Referenced by FIELDSTG_updateField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ warpAway()

static void warpAway ( FieldTask *  task,
FieldChildren *  children 
)
inlinestatic

The warp's steps: its effect and sound, a fade out after 0x3C, the field's characters, map and objects killed while the warp's cutscene plays, then the field left for the warp's mode and place.

< a warp's effect

< the map, its objects and characters, and the menus

Definition at line 428 of file field.c.

Referenced by FIELDSTG_updateField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ openFieldMenu()

static void openFieldMenu ( FieldTask *  task,
FieldChildren *  children 
)
inlinestatic

From the STORY_GENJI_BEATEN on, START opens the field menu (STSTATUS) while the field is idle; the player's place is kept to come back to.

< the map, its objects and characters, and the menus

Definition at line 469 of file field.c.

Referenced by FIELDSTG_updateField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startField()

static void startField ( FieldTask *  task,
FieldChildren *  children 
)
inlinestatic

The field's first step: the file cache and the screen set up, the stage's overlay loaded and started, the mode's visited flag set, the player's start taken from where the field was left, and the banner created.

< a cell's value: its battle area (FieldBattles), or 0

< STDWTITL's title screen; its movies follow

< STAGSLCT, the debug stage select

< STPLNMET: the player's name entry

Definition at line 493 of file field.c.

Referenced by FIELDSTG_updateField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showField()

static void showField ( FieldTask *  task,
FieldChildren *  children 
)
inlinestatic

The field's last loading step: once the CD is free, the high buffer freed and the map streamer created (unless the file cache is kept), then the banner told to go once the map runs, and the field runs.

Definition at line 535 of file field.c.

Referenced by FIELDSTG_updateField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIELDSTG_updateField()

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 opens its menu.

The match depends on two early exits written as do-while (0)s with breaks: one around the leader's search and the actors it creates (createParty), one around the menu's opening. flow weighs the references inside a loop's notes one level more, which is what ranks the list pointer above the entry it loads, the search's hoisted 1 above task, and the menu's GAME base above the other saved registers; written as plain ifs, task takes s3 for s4.

Definition at line 573 of file field.c.

Referenced by FIELDSTG_createField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIELDSTG_createField()

Task * FIELDSTG_createField ( void  )

Creates the field's main task.

< the field's main task (FIELDSTG_createField)

Definition at line 677 of file field.c.

Referenced by FIELDSTG_updateRoot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIELDSTG_leaveFieldAfter()

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, which closes the field (FIELDSTG_closeField) and requests the mode with its argument.

The player comes back to the field at (x, y), facing dir.

< the field's main task (FIELDSTG_createField)

Definition at line 687 of file field.c.

Referenced by FIELDSTG_leaveField(), and FIELDSTG_setOffTrigger().

Here is the caller graph for this function:

◆ FIELDSTG_leaveField()

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)

FIELDSTG's functions and data that the executable calls (game/events.c, system/overlay.c), by these names in its link (config/eu/undefined_syms.txt)

Definition at line 702 of file field.c.

Referenced by applyAction(), FIELDSTG_runEvent(), FIELDSTG_setOffTrigger(), startCardBattle(), and warpAway().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pickOddFighterPrize()

static void pickOddFighterPrize ( s32  mode)
inlinestatic

The prize of an odd prize fighter in the stage of the mode: the rare item 1 time in 32.

Definition at line 717 of file field.c.

Referenced by FIELDSTG_startEncounter().

Here is the caller graph for this function:

◆ pickEvenFighterPrize()

static void pickEvenFighterPrize ( s32  mode)
inlinestatic

The prize of an even prize fighter in the stage of the mode: the rare item 1 time in 16.

Definition at line 844 of file field.c.

Referenced by FIELDSTG_startEncounter().

Here is the caller graph for this function:

◆ FIELDSTG_startEncounter()

void FIELDSTG_startEncounter ( s32  encounter)

Starts encounter FIELDSTG_encounters[encounter]: the field task (FIELD_TASK_FIELD) leaves for the battle (MODE_BATTLE, after a movie in the chapter STORY_MOVIE_BATTLES), and BATTLE_SETUP takes the encounter's enemies and bytes.

A battle led by one of the prize fighters always gives an item, which the field's stage (named in each case by the stage its mode loads, FIELDSTG_stages) and a roll pick: the rare item comes 1 in 32 times for the odd fighters and 1 in 16 for the even ones. In the European version's extra chapter some stages give other items.

< the field's main task (FIELDSTG_createField)

< FIGHTSTG

Definition at line 968 of file field.c.

Referenced by FIELDSTG_startBattle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIELDSTG_startEventBattle5()

void * FIELDSTG_startEventBattle5 ( void  )

Starts battle 5 of the fourth area: the end of the stages' events 9000.

starts a battle: the handler of the stages' events 9000

Definition at line 1010 of file field.c.

Here is the call graph for this function:

◆ FIELDSTG_startListedEvent()

void FIELDSTG_startListedEvent ( s32  index)

Starts the event FIELDSTG_eventIds[index] (the executable calls it)

starts the event FIELDSTG_eventIds[index]

< the field's main task (FIELDSTG_createField)

Definition at line 1019 of file field.c.

Referenced by applyAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIELDSTG_openInn()

void FIELDSTG_openInn ( void  )

Opens the inn: the field task waits for it (the executable calls it)

opens the inn

< the field's main task (FIELDSTG_createField)

< the map, its objects and characters, and the menus

Definition at line 1027 of file field.c.

Referenced by applyAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIELDSTG_startWarp()

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 warp's mode.

< the field's main task (FIELDSTG_createField)

Definition at line 1039 of file field.c.

Referenced by FIELDSTG_warpActor().

Here is the caller graph for this function: