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

The training's run and its result (STGTRAIN_runTraining), and an idle task that nothing creates: STGTRAIN.PRO's second object (see sprite.c), whose rodata starts at 0x8008251C (USA) More...

#include "menus/gym.h"
Include dependency graph for result.c:

Go to the source code of this file.

Functions

s32 STGTRAIN_raiseStat (TrainResult *result, s32 stat)
 Raises a battle stat (1-5) by the training's gain, up to 999.
 
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.
 
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 growth of it and how high it already is.
 
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 raises the current value, up to the maximum.
 
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, and the one it lowers or also raises.
 
s32 STGTRAIN_getAccessoryBonus (TrainResult *result)
 The bonus of the accessories 0x151 (3) and 0x152 (6)
 
void STGTRAIN_createResultWindows (TrainResult *result, TrainResultWindows *win)
 Creates the training result's text windows and cursor.
 
void STGTRAIN_drawResult (TrainResult *result)
 Draws the training result: the blinking arrow, a mark for each try (0x45 worked, 0x46 failed) and the four panels.
 
static s16 getStat (PartnerTotals *totals, s32 stat)
 A battle stat (1-5) or a resistance (8-14) of TOTALS: the match depends on reading them through these (indexed in place, the stat's address is summed with the index first)
 
static s16 getResistance (PartnerTotals *totals, s32 stat)
 
static void STGTRAIN_takeTry (TrainResult *result, TrainResultWindows *win)
 Takes the result of a try: plays its sound and applies it, then plays the next try, or, after the last, asks for the bonus try (three good tries) or ends the training (substate 3)
 
static void STGTRAIN_showGains (TrainResult *result, TrainResultWindows *win)
 Once cross is pressed, shows what the training gave: the stat's gain, and the other stat's loss or gain, in the message, and the stats before and after.
 
static void STGTRAIN_askBonusTry (TrainResult *result, TrainResultWindows *win)
 Moves the cursor between yes and no of the bonus try's question, and takes the answer (triangle: no)
 
static void STGTRAIN_startBonusTry (TrainResult *result, TrainResultWindows *win)
 Once the question's panels close: yes makes the bonus try with its sound (a sure fail when the training is the partner's last bonus one, else a 50% chance), no plays the other tries.
 
static void STGTRAIN_takeBonusTry (TrainResult *result, TrainResultWindows *win)
 Takes the result of the bonus try: a good one makes the training the partner's last bonus one and the gains take their better columns.
 
void STGTRAIN_runTraining (TrainResult *result, TrainResultWindows *win)
 Runs a training: the partner tries it three times (five at the gyms' second half), then shows what it gained.
 
void STGTRAIN_updateResult (TrainResult *result, TrainResultWindows *win)
 The training result's task.
 
TrainResult * STGTRAIN_createResult (TrainScreen *screen, s32 partner, s32 training)
 Creates the results of a training of a partner.
 
void STGTRAIN_initIdle (TrainIdle *task, void *children)
 Left empty, as are the idle task's other steps.
 
void STGTRAIN_showIdle (TrainIdle *task, void *children, s32 show)
 Left empty.
 
void STGTRAIN_drawIdle (TrainIdle *task)
 Only sets up a sprite drawer.
 
void STGTRAIN_runIdle (TrainIdle *task, void *children)
 Left empty.
 
void STGTRAIN_updateIdle (TrainIdle *task, void *children)
 A task that does nothing: its steps are empty, and nothing creates it.
 
TrainIdle * STGTRAIN_createIdle (TrainScreen *screen)
 Creates the idle task for the screen.
 

Variables

TrainGain STGTRAIN_statGains []
 The battle stats a training raises, by [training >= 13][bonusWorked][level].
 
TrainGain STGTRAIN_statLosses []
 What a training may lower another battle stat by, by level.
 
TrainGain STGTRAIN_resistGainsLow []
 The resistance gains, by [bonusWorked ? (training < 13 ? 1 : 2) : 0][level].
 
TrainGain STGTRAIN_resistGainsMid []
 
TrainGain STGTRAIN_resistGainsHigh []
 
TrainGain * STGTRAIN_resistGainTables []
 The resistance gain tables, by the Digimon's affinity and the resistance's value (under 100, under 300, more)
 
TrainGain STGTRAIN_maxHpMpGains []
 The max HP and MP gains, indexed like the resistances.
 

Detailed Description

The training's run and its result (STGTRAIN_runTraining), and an idle task that nothing creates: STGTRAIN.PRO's second object (see sprite.c), whose rodata starts at 0x8008251C (USA)

Definition in file result.c.

Function Documentation

◆ STGTRAIN_raiseStat()

s32 STGTRAIN_raiseStat ( TrainResult *  result,
s32  stat 
)

Raises a battle stat (1-5) by the training's gain, up to 999.

result.c

Definition at line 8 of file result.c.

Referenced by STGTRAIN_applyTry().

Here is the caller graph for this function:

◆ STGTRAIN_lowerStat()

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.

Definition at line 35 of file result.c.

Referenced by STGTRAIN_applyTry().

Here is the caller graph for this function:

◆ STGTRAIN_raiseResistance()

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 growth of it and how high it already is.

Definition at line 62 of file result.c.

Referenced by STGTRAIN_applyTry().

Here is the caller graph for this function:

◆ STGTRAIN_raiseMaxHpMp()

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 raises the current value, up to the maximum.

Definition at line 110 of file result.c.

Referenced by STGTRAIN_applyTry().

Here is the caller graph for this function:

◆ STGTRAIN_applyTry()

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, and the one it lowers or also raises.

< a light blue: what is highlighted or current

< a light blue: what is highlighted or current

< a light blue: what is highlighted or current

Definition at line 165 of file result.c.

Referenced by STGTRAIN_takeBonusTry(), and STGTRAIN_takeTry().

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

◆ STGTRAIN_getAccessoryBonus()

s32 STGTRAIN_getAccessoryBonus ( TrainResult *  result)

The bonus of the accessories 0x151 (3) and 0x152 (6)

Definition at line 230 of file result.c.

Referenced by STGTRAIN_runTraining().

Here is the caller graph for this function:

◆ STGTRAIN_createResultWindows()

void STGTRAIN_createResultWindows ( TrainResult *  result,
TrainResultWindows *  win 
)

Creates the training result's text windows and cursor.

Definition at line 243 of file result.c.

Referenced by STGTRAIN_updateResult().

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

◆ STGTRAIN_drawResult()

void STGTRAIN_drawResult ( TrainResult *  result)

Draws the training result: the blinking arrow, a mark for each try (0x45 worked, 0x46 failed) and the four panels.

< its sprite bank

< its sprite bank

< GTE regards 4096 as 1.0

< GTE regards 4096 as 1.0

< its sprite bank

< GTE regards 4096 as 1.0

< GTE regards 4096 as 1.0

< GTE regards 4096 as 1.0

< its sprite bank

< GTE regards 4096 as 1.0

< GTE regards 4096 as 1.0

< GTE regards 4096 as 1.0

< its sprite bank

< GTE regards 4096 as 1.0

< GTE regards 4096 as 1.0

< GTE regards 4096 as 1.0

< its sprite bank

Definition at line 258 of file result.c.

Referenced by STGTRAIN_updateResult().

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

◆ getStat()

static s16 getStat ( PartnerTotals *  totals,
s32  stat 
)
inlinestatic

A battle stat (1-5) or a resistance (8-14) of TOTALS: the match depends on reading them through these (indexed in place, the stat's address is summed with the index first)

Definition at line 332 of file result.c.

Referenced by STGTRAIN_showGains().

Here is the caller graph for this function:

◆ getResistance()

static s16 getResistance ( PartnerTotals *  totals,
s32  stat 
)
inlinestatic

Definition at line 336 of file result.c.

Referenced by STGTRAIN_showGains().

Here is the caller graph for this function:

◆ STGTRAIN_takeTry()

static void STGTRAIN_takeTry ( TrainResult *  result,
TrainResultWindows *  win 
)
inlinestatic

Takes the result of a try: plays its sound and applies it, then plays the next try, or, after the last, asks for the bonus try (three good tries) or ends the training (substate 3)

Definition at line 344 of file result.c.

Referenced by STGTRAIN_runTraining().

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

◆ STGTRAIN_showGains()

static void STGTRAIN_showGains ( TrainResult *  result,
TrainResultWindows *  win 
)
inlinestatic

Once cross is pressed, shows what the training gave: the stat's gain, and the other stat's loss or gain, in the message, and the stats before and after.

< SYSTEM07

Definition at line 376 of file result.c.

Referenced by STGTRAIN_runTraining().

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

◆ STGTRAIN_askBonusTry()

static void STGTRAIN_askBonusTry ( TrainResult *  result,
TrainResultWindows *  win 
)
inlinestatic

Moves the cursor between yes and no of the bonus try's question, and takes the answer (triangle: no)

< SYSTEM02: a cursor moves

< SYSTEM00: a choice is taken

< SYSTEM01

Definition at line 495 of file result.c.

Referenced by STGTRAIN_runTraining().

Here is the caller graph for this function:

◆ STGTRAIN_startBonusTry()

static void STGTRAIN_startBonusTry ( TrainResult *  result,
TrainResultWindows *  win 
)
inlinestatic

Once the question's panels close: yes makes the bonus try with its sound (a sure fail when the training is the partner's last bonus one, else a 50% chance), no plays the other tries.

Definition at line 526 of file result.c.

Referenced by STGTRAIN_runTraining().

Here is the caller graph for this function:

◆ STGTRAIN_takeBonusTry()

static void STGTRAIN_takeBonusTry ( TrainResult *  result,
TrainResultWindows *  win 
)
inlinestatic

Takes the result of the bonus try: a good one makes the training the partner's last bonus one and the gains take their better columns.

Definition at line 552 of file result.c.

Referenced by STGTRAIN_runTraining().

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

◆ STGTRAIN_runTraining()

void STGTRAIN_runTraining ( TrainResult *  result,
TrainResultWindows *  win 
)

Runs a training: the partner tries it three times (five at the gyms' second half), then shows what it gained.

Three good tries in a row give a bonus try, asked for (with the training as the partner's last) after the gyms' first half.

< SYSTEM07

< SYSTEM07

Definition at line 583 of file result.c.

Referenced by STGTRAIN_updateResult().

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

◆ STGTRAIN_updateResult()

void STGTRAIN_updateResult ( TrainResult *  result,
TrainResultWindows *  win 
)

The training result's task.

Definition at line 691 of file result.c.

Referenced by STGTRAIN_createResult().

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

◆ STGTRAIN_createResult()

TrainResult * STGTRAIN_createResult ( TrainScreen *  screen,
s32  partner,
s32  training 
)

Creates the results of a training of a partner.

Definition at line 724 of file result.c.

Referenced by STGTRAIN_runScreen().

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

◆ STGTRAIN_initIdle()

void STGTRAIN_initIdle ( TrainIdle *  task,
void *  children 
)

Left empty, as are the idle task's other steps.

Definition at line 737 of file result.c.

Referenced by STGTRAIN_updateIdle().

Here is the caller graph for this function:

◆ STGTRAIN_showIdle()

void STGTRAIN_showIdle ( TrainIdle *  task,
void *  children,
s32  show 
)

Left empty.

Definition at line 741 of file result.c.

Referenced by STGTRAIN_updateIdle().

Here is the caller graph for this function:

◆ STGTRAIN_drawIdle()

void STGTRAIN_drawIdle ( TrainIdle *  task)

Only sets up a sprite drawer.

Definition at line 745 of file result.c.

Referenced by STGTRAIN_updateIdle().

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

◆ STGTRAIN_runIdle()

void STGTRAIN_runIdle ( TrainIdle *  task,
void *  children 
)

Left empty.

Definition at line 752 of file result.c.

Referenced by STGTRAIN_updateIdle().

Here is the caller graph for this function:

◆ STGTRAIN_updateIdle()

void STGTRAIN_updateIdle ( TrainIdle *  task,
void *  children 
)

A task that does nothing: its steps are empty, and nothing creates it.

Definition at line 756 of file result.c.

Referenced by STGTRAIN_createIdle().

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

◆ STGTRAIN_createIdle()

TrainIdle * STGTRAIN_createIdle ( TrainScreen *  screen)

Creates the idle task for the screen.

Definition at line 775 of file result.c.

Here is the call graph for this function:

Variable Documentation

◆ STGTRAIN_statGains

TrainGain STGTRAIN_statGains[]
Initial value:
= {
{1, 2}, {7, 2}, {14, 3},
{2, 0}, {10, 0}, {20, 0},
{1, 2}, {6, 3}, {11, 5},
{4, 0}, {22, 0}, {48, 0},
}

The battle stats a training raises, by [training >= 13][bonusWorked][level].

Definition at line 786 of file result.c.

Referenced by STGTRAIN_raiseStat().

◆ STGTRAIN_statLosses

TrainGain STGTRAIN_statLosses[]
Initial value:
= {
{1, 0}, {2, 3}, {4, 3},
}

What a training may lower another battle stat by, by level.

Definition at line 793 of file result.c.

Referenced by STGTRAIN_lowerStat().

◆ STGTRAIN_resistGainsLow

TrainGain STGTRAIN_resistGainsLow[]
Initial value:
= {
{1, 0}, {1, 0}, {2, 0},
{4, 2}, {8, 0}, {12, 0},
{8, 2}, {20, 0}, {30, 0},
}

The resistance gains, by [bonusWorked ? (training < 13 ? 1 : 2) : 0][level].

Definition at line 797 of file result.c.

◆ STGTRAIN_resistGainsMid

TrainGain STGTRAIN_resistGainsMid[]
Initial value:
= {
{1, 2}, {2, 0}, {3, 0},
{6, 3}, {12, 0}, {18, 0},
{12, 4}, {30, 0}, {40, 0},
}

Definition at line 802 of file result.c.

◆ STGTRAIN_resistGainsHigh

TrainGain STGTRAIN_resistGainsHigh[]
Initial value:
= {
{2, 0}, {2, 0}, {4, 0},
{8, 4}, {12, 0}, {25, 0},
{16, 5}, {30, 0}, {50, 0},
}

Definition at line 807 of file result.c.

◆ STGTRAIN_resistGainTables

TrainGain* STGTRAIN_resistGainTables[]
Initial value:

The resistance gain tables, by the Digimon's affinity and the resistance's value (under 100, under 300, more)

Definition at line 814 of file result.c.

Referenced by STGTRAIN_raiseResistance().

◆ STGTRAIN_maxHpMpGains

TrainGain STGTRAIN_maxHpMpGains[]
Initial value:
= {
{1, 2}, {2, 0}, {4, 0},
{6, 4}, {10, 0}, {20, 0},
{13, 5}, {20, 0}, {40, 0},
}

The max HP and MP gains, indexed like the resistances.

Definition at line 821 of file result.c.

Referenced by STGTRAIN_raiseMaxHpMp().