11#define OVL_NAME(name) STGTRAIN_##name
14#if VERSION_US || VERSION_JP
15#define STGTRAIN_TEXT TEXT_FILE(TEXT_TRAINING)
16#define STGTRAIN_FILE_SPRITES 0x27D
17#define STGTRAIN_FILE_IMAGES 0x27E
19#define STGTRAIN_TEXT TEXT_FILE(TEXT_TRAINING)
20#define STGTRAIN_FILE_SPRITES 0x28C
21#define STGTRAIN_FILE_IMAGES 0x28D
23#define STGTRAIN_SPRITES (STGTRAIN_FILE_SPRITES << 16 | 3)
352 u8 *(*getFile)(void);
#define TASK_HEADER(Type)
void STGTRAIN_finishSession(TrainSession *session)
Makes the session close (its substate 0x1E)
s32 STGTRAIN_requestFile(s32 index)
Starts loading a file of STGTRAIN_files, unless it is the one loaded.
void STGTRAIN_applyTry(TrainResult *result, s32 i)
Applies the i-th try of a training (if it worked) and shows what it changed: the stat it raises,...
void STGTRAIN_drawScreen(TrainScreen *screen)
Draws the screen: the panels, the party's sprites and the sign.
s32 STGTRAIN_waitAnims[PARTNER_COUNT][7]
The overlay's data, in its order: the first object's, the second's and the third's.
void STGTRAIN_showTp(TrainScreen *screen, TrainScreenWindows *win, s32 show)
Shows or hides the selected partner's TP.
TrainGain STGTRAIN_statLosses[]
What a training may lower another battle stat by, by level.
void STGTRAIN_startFade(PanelAnim *fade, s32 fadeIn)
void STGTRAIN_setActorClutPos(TrainActor *actor, s32 x, s32 y)
Sets where the Digimon's CLUTs go in VRAM.
void STGTRAIN_setSpriteScale(TrainSprite *sprite, s32 x, s32 y, s32 z)
Scales the sprite (0x1000 is its size), drawing it as quads.
void STGTRAIN_freeFile(void)
Frees the loaded file of STGTRAIN_files.
TrainEntry STGTRAIN_gymTrainings[14][16]
The trainings of each gym level, by STGTRAIN_findGymTraining: {id, stat, other}, 0 ends.
void STGTRAIN_shrinkActor(TrainActor *actor)
Makes the Digimon shrink to nothing (mode 2)
void STGTRAIN_runIdle(TrainIdle *task, void *children)
Left empty.
void STGTRAIN_setSpritePaused(TrainSprite *sprite, s32 paused)
Pauses the animation (paused) or plays it on.
s32 STGTRAIN_raiseMaxHpMp(TrainResult *result, s32 stat)
Raises the maximum HP (stat 15) or MP (16) by the training's gain, up to 9999; the US version also ra...
TrainFile STGTRAIN_files[]
the discs number their files differently
void STGTRAIN_runScreen(TrainScreen *screen, TrainScreenWindows *win)
The training screen: opens the panels, picks the partner, runs the menu and the trainings,...
void STGTRAIN_drawSession(TrainSession *session)
Draws a training session: the training's icon, its panels and the cursor over the three columns.
void STGTRAIN_runTraining(TrainResult *result, TrainResultWindows *win)
Runs a training: the partner tries it three times (five at the gyms' second half),...
s32 STGTRAIN_updateLerp(MenuLerp *lerp)
void STGTRAIN_pauseActor(TrainActor *actor)
Pauses the Digimon's sprite and effect.
s32 STGTRAIN_readSetAnims(TrainSetHeader *header, s32 set)
The set's animations.
s32 STGTRAIN_readSet(s32 set)
Reads an image set of the loaded file.
void STGTRAIN_setSpriteBank(TrainSprite *sprite, TrainSpriteBank *bank, s32 offset)
sprite.c
void STGTRAIN_showVitals(TrainScreen *screen, TrainScreenWindows *win, s32 show)
Shows or hides the selected partner's name, level, HP and MP.
void STGTRAIN_createSessionWindows(TrainSession *session, TrainSessionWindows *win)
session.c
TrainEntry * STGTRAIN_findGymTraining(s32 index, s32 id)
A training of a gym level, by its id.
TrainSpriteBank * STGTRAIN_getBank(s32 set)
The sprite bank of an image set.
TrainEntry * STGTRAIN_getGymTrainings(s32 index)
The trainings of a gym level, counting them.
void STGTRAIN_showMenuInfo(TrainMenu *menu)
Shows the selected training's name and description.
void STGTRAIN_setSpriteClutPos(TrainSprite *sprite, s32 x, s32 y)
Sets where the sprite's CLUT is in VRAM.
TrainSession * STGTRAIN_createSession(TrainScreen *screen)
Creates a training session.
s32 STGTRAIN_getFileId(s32 index)
The file of an entry of STGTRAIN_files.
TrainActor * STGTRAIN_createActor(s32 set, s32 file, s32 layerId, s32 depth)
Creates an animated sprite of an image set.
void STGTRAIN_setSpritePivot(TrainSprite *sprite, s32 x, s32 y)
Sets the point the sprite scales and turns about.
s32 STGTRAIN_readSetImages(TrainSetHeader *header, s32 set)
The images of a set: the rest of its offsets.
void STGTRAIN_playActor(TrainActor *actor)
Plays the training on (mode 4), unpausing the sprite and effect.
s32 STGTRAIN_getSpriteFlags(TrainSprite *sprite)
Whether the animation has ended (the flags but for the pause)
void STGTRAIN_showStatChanges(TrainScreen *screen, PartnerTotals *before)
Shows the selected partner's stats, in colour where they differ from before (NULL: just shows them).
void STGTRAIN_endActor(TrainActor *actor)
Plays the training's end (mode 8)
void STGTRAIN_drawResult(TrainResult *result)
Draws the training result: the blinking arrow, a mark for each try (0x45 worked, 0x46 failed) and the...
TrainCursor STGTRAIN_animCursor
void STGTRAIN_showTrainingInfo(TrainMenu *menu, TextWindow **win, s32 show)
Shows the name and description of the selected training (show) or hides them.
void STGTRAIN_updateFader(ScreenFade *task)
void STGTRAIN_initIdle(TrainIdle *task, void *children)
Left empty, as are the idle task's other steps.
TrainScreen * STGTRAIN_createScreen(void)
Creates the training screen.
s32 STGTRAIN_lowerStat(TrainResult *result, s32 stat)
Lowers a battle stat (1-5) by the training's loss, half of the time, down to 0.
void STGTRAIN_growActor(TrainActor *actor)
Makes the Digimon grow from nothing (mode 2)
s32 STGTRAIN_readSetBank(TrainSetHeader *header, s32 set)
The set's sprite bank, where its sprites start and its size: the two words after the set's offsets.
TrainMenu * STGTRAIN_createMenu(TrainScreen *screen)
Creates the training menu.
u8 * STGTRAIN_getFile(void)
The requested file, or NULL while it loads.
void STGTRAIN_startLerp(MenuLerp *lerp, s32 from, s32 to, s32 frames)
void STGTRAIN_showIdle(TrainIdle *task, void *children, s32 show)
Left empty.
TrainCursor STGTRAIN_bankCursor
TrainSprite * STGTRAIN_createSprite(void)
Creates an animated sprite.
void STGTRAIN_runSession(TrainSession *session, TrainSessionWindows *win)
Runs a training session: opens its panels, picks one of three intensities (it costs STGTRAIN_intensit...
s32 STGTRAIN_getAccessoryBonus(TrainResult *result)
The bonus of the accessories 0x151 (3) and 0x152 (6)
TrainGain STGTRAIN_maxHpMpGains[]
The max HP and MP gains, indexed like the resistances.
void STGTRAIN_updateSession(TrainSession *session, TrainSessionWindows *win)
A training session.
void STGTRAIN_showBattleStats(TrainScreen *screen, TrainScreenWindows *win, s32 show)
Shows or hides the selected partner's stats and resistances.
void STGTRAIN_updateMenu(TrainMenu *menu, TextWindow **win)
The training menu's task: a grid of trainings on two pages, filled from the gym's table (the training...
void STGTRAIN_setActorChance(TrainActor *actor, s32 chance)
Sets the chance that the training works.
s32 STGTRAIN_intensityCosts[]
the points each intensity of a training costs
void STGTRAIN_drawIdle(TrainIdle *task)
Only sets up a sprite drawer.
ScreenFade * STGTRAIN_createFader(void)
s32 STGTRAIN_getFileEffectSameDepth(s32 index)
Whether an entry of STGTRAIN_files draws its effect at the Digimon's depth.
s32 STGTRAIN_getActorResult(TrainActor *actor)
Whether the training worked, once it is done (mode bit 0), else -1.
void STGTRAIN_setSpriteImagePos(TrainSprite *sprite, s32 x, s32 y)
Sets where the sprite's image is in VRAM.
void STGTRAIN_setSpriteAnim(TrainSprite *sprite, TrainAnim *anim)
Starts an animation from its first frame.
void STGTRAIN_updateScreen(TrainScreen *screen, TrainScreenWindows *win)
The training screen's update: loads its files, then runs the menu.
void STGTRAIN_drawMenu(TrainMenu *menu)
Draws the training menu: its panels, the trainings of the page and the cursor.
void STGTRAIN_openMenu(TrainMenu *menu)
Opens the training menu (its substate 0)
TrainAnim * STGTRAIN_getAnim(s32 set, s32 i)
An animation of an image set.
void STGTRAIN_updateIdle(TrainIdle *task, void *children)
A task that does nothing: its steps are empty, and nothing creates it.
void STGTRAIN_createResultWindows(TrainResult *result, TrainResultWindows *win)
Creates the training result's text windows and cursor.
void STGTRAIN_closeMenu(TrainMenu *menu)
Closes the training menu (its substate 0x32)
void STGTRAIN_setSpriteLayer(TrainSprite *sprite, s32 layerId, s32 depth)
Sets the layer and depth the sprite is drawn at.
TrainResult * STGTRAIN_createResult(TrainScreen *screen, s32 partner, s32 training)
Creates the results of a training of a partner.
TrainCursor STGTRAIN_imageCursor
s32 STGTRAIN_raiseStat(TrainResult *result, s32 stat)
result.c
void STGTRAIN_loadImages(void)
files.c
s32 STGTRAIN_loadSet(s32 set, s32 *pos)
Loads the images of a set into VRAM side by side, unpacking the run-length encoded ones ("RLEN") firs...
TrainGain STGTRAIN_statGains[]
The battle stats a training raises, by [training >= 13][bonusWorked][level].
void STGTRAIN_createScreenWindows(TrainScreen *screen, TrainScreenWindows *win)
screen.c
void STGTRAIN_setActorScale(TrainActor *actor, s32 scale)
Scales the Digimon (0x1000 is its size)
s32 STGTRAIN_getBankSize(s32 set)
The size of an image set's sprite bank (nothing calls it)
void STGTRAIN_drawFader(ScreenFade *task)
void STGTRAIN_updateResult(TrainResult *result, TrainResultWindows *win)
The training result's task.
void STGTRAIN_setActorPos(TrainActor *actor, s32 x, s32 y)
Sets where the Digimon's images go in VRAM.
void STGTRAIN_updateActor(TrainActor *actor, TrainActorSprites *sprites)
actor.c
TrainIdle * STGTRAIN_createIdle(TrainScreen *screen)
Creates the idle task for the screen.
TrainState STGTRAIN_state
s32 STGTRAIN_updateFade(PanelAnim *fade)
s32 STGTRAIN_getFilePos(s32 index)
Where the image of an entry of STGTRAIN_files goes (y << 16 | x)
void STGTRAIN_startFader(ScreenFade *task, s32 fadeIn, s32 duration)
s32 STGTRAIN_getBankOffset(s32 set)
Where an image set's sprites start in its bank.
void STGTRAIN_runMenu(TrainMenu *menu, TextWindow **win)
Runs the training menu: opens its panels, moves the cursor over the trainings of a page (L1 and R1 tu...
void STGTRAIN_setSpriteRotation(TrainSprite *sprite, s16 x, s16 y, s16 z)
Turns the sprite, drawing it as quads.
void STGTRAIN_setSpritePos(TrainSprite *sprite, s32 x, s32 y)
Sets where the sprite is drawn.
void STGTRAIN_updateSprite(TrainSprite *sprite)
The animated sprite's update: state 1 advances the animation, unless it is paused,...
s32 STGTRAIN_raiseResistance(TrainResult *result, s32 stat)
Raises a resistance (stat 8-14) by the training's gain, up to 999: the table goes by the Digimon's gr...
TrainGain * STGTRAIN_resistGainTables[]
The resistance gain tables, by the Digimon's affinity and the resistance's value (under 100,...
void STGTRAIN_createMenuWindows(TrainMenu *menu, TextWindow **win)
menu.c
void STGTRAIN_updateRoot(Task *task, TrainScreen **children)
scene.c
TrainCursor STGTRAIN_setCursor
A menu cursor: a text window showing one of the CURSOR_FRAMES glyphs.
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Opens or closes a menu panel: level goes 0 -> ONE in duration frames (or back at twice the speed),...
Fades the whole screen to black and back with a subtractive rectangle.
Any task, seen through its header.
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
The children of a TrainActor.
TrainSprite * effect
of set 8
void * pad
never read or written: createTask allocates 0xC bytes of children
An animated sprite of an image set, as a training shows it (STGTRAIN_createActor): mode 1 idle,...
s32 padA0
never read or written
void(* play)(struct TrainActor *actor)
void(* setClutPos)(struct TrainActor *actor, s32 x, s32 y)
s32 pad7C
never read or written
void(* setScale)(struct TrainActor *actor, s32 scale)
void(* grow)(struct TrainActor *actor)
s32 result
the training worked
void(* pause)(struct TrainActor *actor)
void(* end)(struct TrainActor *actor)
s32 pos[4]
x, y, clutX, clutY: for loadSet
s32 chance
of the training working, in %
void(* setChance)(struct TrainActor *actor, s32 chance)
s32(* getResult)(struct TrainActor *actor)
s32 pad6C
never read or written
u8 padCC[8]
never read or written: createTask allocates 0xD4 bytes
void(* setPos)(struct TrainActor *actor, s32 x, s32 y)
void(* shrink)(struct TrainActor *actor)
s32 file
of STGTRAIN_files
A frame of a sprite animation.
s16 sprite
into the sprite bank
u8 duration
in ticks of GFX.funcs.getTime
A sprite animation: its frames follow the header.
s16 unk0
0x124 in every animation; nothing reads it
An entry of a gym level's trainings (STGTRAIN_gymTrainings)
s16 stat
1-5 battle stats, 8-14 resistances
s16 other
1-5: lowered, 15 or 16: max HP or MP raised
An entry of STGTRAIN_files: a file and where its image goes.
s32 effectSameDepth
0 draws the effect one depth in front of the Digimon (STGTRAIN_updateActor)
A stat change of a training: base plus a random 0..range-1.
A task the overlay creates (STGTRAIN_createIdle) that does nothing.
u8 pad[0x10]
never read or written: createTask allocates 0x6C bytes
An image set of the loaded file (STGTRAIN_readSet)
A training (STGTRAIN_trainings)
s32 icons[4]
frames of STGTRAIN_FILE_SPRITES
s32 name
strings of the text file
The children of TrainResult.
TextWindow * question[3]
whether to make the bonus try, yes, no
The results of a training (STGTRAIN_createResult)
s16 bonusSound
the slot of the bonus try's sound
s32 prompting
the blinking arrow: cross goes on
s32 bonusWorked
the gains take their better columns
s32 bonusTrying
the bonus try (the fourth) is on: its mark blinks
The children of the training screen.
struct TrainSession * session
TextWindow * resistances[7]
TextWindow * help
triangle stops training (string 5)
struct TrainResult * result
TextWindow * prompt
"Train which Digimon?" (string 6)
The training screen's main task (STGTRAIN_createScreen)
s32 training
the one picked in the menu, 0 for none
struct TrainScreen::@15 anims[3]
the party's sprites
s32 partner
the one selected
void(* showStats)(struct TrainScreen *screen, PartnerTotals *before)
s32 frame
the selected partner's sprite
s32 bgSprite
the gym's sign, by the mode it came from
s32 intensity
the last one picked
The children of a training session.
TextWindow * answers[2]
yes, no
TextWindow * notice
not enough points
TextWindow * text[3]
the message, the training and the intensity
TextWindow * intensities[3]
A training session (STGTRAIN_createSession)
void(* finish)(struct TrainSession *session)
s32 intensity
the cursor's column, the training's intensity; from the screen's
A sprite bank's header, as the animated sprite reads it: its sprites start bankOffset bytes from it (...
s16 unk0
801 in every bank; nothing reads it
A part of a sprite: a rectangle of a texture page.
u16 tpage
bits 0-4: the page's column, 64 pixels each; 5-8: getTPage's abr and tp
u8 unkC[8]
nothing reads it: in the files, four s16: 0, flags (bits 0, 14 and 15), 0x1000 and 0x1000
u16 clut
bits 6-14: the CLUT's row; bit 15: semi-transparent
Draws an animated sprite, maybe rotated and scaled (STGTRAIN_createSprite)
void(* setBank)(struct TrainSprite *sprite, TrainSpriteBank *bank, s32 offset)
s32 flags
bit 31: paused; the rest, ended
void(* setScale)(struct TrainSprite *sprite, s32 x, s32 y, s32 z)
void(* setRotation)(struct TrainSprite *sprite, s16 x, s16 y, s16 z)
s32 pad
never read or written
u16 unk84
the bank's unk2 and spriteCount: nothing reads them
void(* setAnim)(struct TrainSprite *sprite, TrainAnim *anim)
void(* setClutPos)(struct TrainSprite *sprite, s32 x, s32 y)
s32(* getFlags)(struct TrainSprite *sprite)
void(* setImagePos)(struct TrainSprite *sprite, s32 x, s32 y)
void(* setPivot)(struct TrainSprite *sprite, s32 x, s32 y)
void(* setPos)(struct TrainSprite *sprite, s32 x, s32 y)
void(* setLayer)(struct TrainSprite *sprite, s32 layerId, s32 depth)
void(* setPaused)(struct TrainSprite *sprite, s32 paused)
The overlay's helpers and the file they load (STGTRAIN_state)
s32(* requestFile)(s32 index)
s32 tableCount
the entries of the last getTable
u8 * data
the loaded file of STGTRAIN_files
s32(* getBankOffset)(s32 set)
s32(* updateFade)(PanelAnim *fade)
s32(* getFilePos)(s32 index)
y << 16 | x
s32(* loadSet)(s32 set, s32 *pos)
s32(* updateLerp)(MenuLerp *lerp)
void(* startLerp)(MenuLerp *lerp, s32 from, s32 to, s32 frames)
void(* startFade)(PanelAnim *fade, s32 fadeIn)
s32(* getBankSize)(s32 set)
TrainInfo * trainings
STGTRAIN_trainings.
s32(* getFileEffectSameDepth)(s32 index)
s32(* getFileId)(s32 index)
computeStats' result: the stats with the equipment added, by STAT_* or by name.
Where readSet and its helpers read the loaded file.
u8 * bytes
the file's offsets count bytes from its start