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

FIGHTSTG's battle scripts: the commands of a fighter's script (models, effects, camera, waits, stage, sounds and fades) and its task. More...

#include "battle/battle_mode.h"
#include "camera_turn.h"
Include dependency graph for battle_script.c:

Go to the source code of this file.

Functions

s32 FIGHTSTG_getScriptModel (BattleScript *script, s32 type)
 The model a script command names by TYPE: 0 the script's own side's, 1-3 the partner's slots and 4-6 the enemy's.
 
void FIGHTSTG_runScriptHits (BattleScript *script, BattleScriptChildren *children)
 The battle script's hit command: 0 starts the other side's script for the last hit's result, 5 the one for the next hit's.
 
static void playIdleMotion (ModelControl *control)
 Model command 0 with 1: puts the model back to its idle motion.
 
static void playMotion (ModelControl *control, s32 motion)
 Model command 0 with any other MOTION: plays the model's motion MOTION from its start.
 
static void turnModel (BattleScript *script, ModelControl *control)
 Model command 4: sets the model's rotation from the script.
 
static void startModelJump (BattleScriptChildren *children, ModelControl *control, s32 kind, s32 distance)
 Model command 5: replaces the model's jump with a new one of kind KIND (DISTANCE only for kind 4).
 
static void addModel (s32 id, s32 fighter)
 Model command 6: adds fighter FIGHTER's model to the battle as model ID.
 
static void moveModelHome (BattleScript *script, BattleScriptChildren *children, ModelControl *control)
 Model command 7: moves the model back home over the script's time, or at once when it is 0.
 
static void removeModel (s32 id)
 Model command 9: removes model ID from the battle.
 
s32 FIGHTSTG_runScriptModel (BattleScript *script, BattleScriptChildren *children)
 The battle script's model command, on the model given by FIGHTSTG_getScriptModel: 0 plays a motion (0 waits for the one playing, 1 goes back to idle), 1 and 2 turn layers[0] on and off, 3 moves it to a position in the script (over a time, or at once when it is 0), 4 turns it, 5 makes it jump (0 waits for the jump), 6 adds a model (waiting while its file loads in script 12), 7 moves it home, 8 0x2800 from home and 9 removes it.
 
s32 FIGHTSTG_runScriptEffect (BattleScript *script, BattleScriptChildren *children)
 The battle script's effect command: 0 starts sprite effect EFFECT (9999 the script's own) at a position in the script, 1 loads its images and sheet, running again until they are in.
 
s32 FIGHTSTG_runScriptEffectModel (BattleScript *script, BattleScriptChildren *children)
 The battle script's effect model command: 0 starts effect model ID at a position and rotation in the script (their y and z negated), 1 waits while its file loads.
 
void FIGHTSTG_runScriptCamera (BattleScript *script, BattleScriptChildren *children)
 The battle script's camera command: the time of the fade (0 to cut), then the enemy's view, a fighter's or one given in the script.
 
s32 FIGHTSTG_runScriptWait (BattleScript *script, BattleScriptChildren *children)
 The battle script's wait command: waits the time in the script, returning 0 until it is over.
 
s32 FIGHTSTG_runScriptStage (BattleScript *script, BattleScriptChildren *children)
 The battle script's stage command (0x38 the script's own stage, -1 none): 0 changes the fight stage (0 the battle's) with the fade times in the script, keeping the partner's idle motion aside on stage 0x1D and bringing it back on 0x1E; 1 waits while the stage's motions load.
 
void FIGHTSTG_runScriptSound (BattleScript *script, BattleScriptChildren *children)
 The battle script's sound command: plays a battle sound for a time (0x62 and 0x63 the hit's sound, or 0x38 for a hit of result 3)
 
void FIGHTSTG_runScriptFade (BattleScript *script, WhiteFlash **fade)
 The battle script's fade command: 0 fades the screen out over the frames in the script, 1 back in.
 
void FIGHTSTG_updateBattleScript (BattleScript *script, BattleScriptChildren *children)
 The battle script's task: finds the fighter's effect archive and its script (loading sound bank 0x46 for script 12), then runs its commands until one waits, and ends once its children are done.
 
BattleScript * FIGHTSTG_createBattleScript (void)
 Creates a battle script, which plays a technique (FIGHTSTG_updateBattleScript)
 

Detailed Description

FIGHTSTG's battle scripts: the commands of a fighter's script (models, effects, camera, waits, stage, sounds and fades) and its task.

The European version has the camera turn here too (camera_turn.h), which the USA one has in camera_task.c.

Definition in file battle_script.c.

Function Documentation

◆ FIGHTSTG_getScriptModel()

s32 FIGHTSTG_getScriptModel ( BattleScript *  script,
s32  type 
)

The model a script command names by TYPE: 0 the script's own side's, 1-3 the partner's slots and 4-6 the enemy's.

Shared between the overlay's objects.

Definition at line 10 of file battle_script.c.

Referenced by FIGHTSTG_runScriptModel().

Here is the caller graph for this function:

◆ FIGHTSTG_runScriptHits()

void FIGHTSTG_runScriptHits ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's hit command: 0 starts the other side's script for the last hit's result, 5 the one for the next hit's.

Definition at line 32 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

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

◆ playIdleMotion()

static void playIdleMotion ( ModelControl *  control)
inlinestatic

Model command 0 with 1: puts the model back to its idle motion.

Definition at line 76 of file battle_script.c.

Referenced by FIGHTSTG_runScriptModel().

Here is the caller graph for this function:

◆ playMotion()

static void playMotion ( ModelControl *  control,
s32  motion 
)
inlinestatic

Model command 0 with any other MOTION: plays the model's motion MOTION from its start.

Definition at line 83 of file battle_script.c.

Referenced by FIGHTSTG_runScriptModel().

Here is the caller graph for this function:

◆ turnModel()

static void turnModel ( BattleScript *  script,
ModelControl *  control 
)
inlinestatic

Model command 4: sets the model's rotation from the script.

Definition at line 90 of file battle_script.c.

Referenced by FIGHTSTG_runScriptModel().

Here is the caller graph for this function:

◆ startModelJump()

static void startModelJump ( BattleScriptChildren *  children,
ModelControl *  control,
s32  kind,
s32  distance 
)
inlinestatic

Model command 5: replaces the model's jump with a new one of kind KIND (DISTANCE only for kind 4).

Definition at line 99 of file battle_script.c.

Referenced by FIGHTSTG_runScriptModel().

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

◆ addModel()

static void addModel ( s32  id,
s32  fighter 
)
inlinestatic

Model command 6: adds fighter FIGHTER's model to the battle as model ID.

< the fighters'

Definition at line 107 of file battle_script.c.

Referenced by FIGHTSTG_runScriptModel().

Here is the caller graph for this function:

◆ moveModelHome()

static void moveModelHome ( BattleScript *  script,
BattleScriptChildren *  children,
ModelControl *  control 
)
inlinestatic

Model command 7: moves the model back home over the script's time, or at once when it is 0.

Definition at line 115 of file battle_script.c.

Referenced by FIGHTSTG_runScriptModel().

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

◆ removeModel()

static void removeModel ( s32  id)
inlinestatic

Model command 9: removes model ID from the battle.

< the fighters'

Definition at line 128 of file battle_script.c.

Referenced by FIGHTSTG_runScriptModel().

Here is the caller graph for this function:

◆ FIGHTSTG_runScriptModel()

s32 FIGHTSTG_runScriptModel ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's model command, on the model given by FIGHTSTG_getScriptModel: 0 plays a motion (0 waits for the one playing, 1 goes back to idle), 1 and 2 turn layers[0] on and off, 3 moves it to a position in the script (over a time, or at once when it is 0), 4 turns it, 5 makes it jump (0 waits for the jump), 6 adds a model (waiting while its file loads in script 12), 7 moves it home, 8 0x2800 from home and 9 removes it.

Returning 0 runs the command again. The match depends on each case's time being its own and on case 3's being read before the position.

Definition at line 142 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

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

◆ FIGHTSTG_runScriptEffect()

s32 FIGHTSTG_runScriptEffect ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's effect command: 0 starts sprite effect EFFECT (9999 the script's own) at a position in the script, 1 loads its images and sheet, running again until they are in.

Returning 0 runs the command again

Definition at line 269 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

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

◆ FIGHTSTG_runScriptEffectModel()

s32 FIGHTSTG_runScriptEffectModel ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's effect model command: 0 starts effect model ID at a position and rotation in the script (their y and z negated), 1 waits while its file loads.

Returning 0 runs the command again

Definition at line 330 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

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

◆ FIGHTSTG_runScriptCamera()

void FIGHTSTG_runScriptCamera ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's camera command: the time of the fade (0 to cut), then the enemy's view, a fighter's or one given in the script.

Definition at line 367 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

Here is the caller graph for this function:

◆ FIGHTSTG_runScriptWait()

s32 FIGHTSTG_runScriptWait ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's wait command: waits the time in the script, returning 0 until it is over.

Definition at line 424 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

Here is the caller graph for this function:

◆ FIGHTSTG_runScriptStage()

s32 FIGHTSTG_runScriptStage ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's stage command (0x38 the script's own stage, -1 none): 0 changes the fight stage (0 the battle's) with the fade times in the script, keeping the partner's idle motion aside on stage 0x1D and bringing it back on 0x1E; 1 waits while the stage's motions load.

Returning 0 runs the command again

Definition at line 450 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

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

◆ FIGHTSTG_runScriptSound()

void FIGHTSTG_runScriptSound ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's sound command: plays a battle sound for a time (0x62 and 0x63 the hit's sound, or 0x38 for a hit of result 3)

Definition at line 503 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

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

◆ FIGHTSTG_runScriptFade()

void FIGHTSTG_runScriptFade ( BattleScript *  script,
WhiteFlash **  fade 
)

The battle script's fade command: 0 fades the screen out over the frames in the script, 1 back in.

Definition at line 521 of file battle_script.c.

Referenced by FIGHTSTG_updateBattleScript().

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

◆ FIGHTSTG_updateBattleScript()

void FIGHTSTG_updateBattleScript ( BattleScript *  script,
BattleScriptChildren *  children 
)

The battle script's task: finds the fighter's effect archive and its script (loading sound bank 0x46 for script 12), then runs its commands until one waits, and ends once its children are done.

< the fighters'

Definition at line 540 of file battle_script.c.

Referenced by FIGHTSTG_createBattleScript().

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

◆ FIGHTSTG_createBattleScript()

BattleScript * FIGHTSTG_createBattleScript ( void  )

Creates a battle script, which plays a technique (FIGHTSTG_updateBattleScript)

Definition at line 648 of file battle_script.c.

Referenced by FIGHTSTG_runItemScript(), FIGHTSTG_runScriptHits(), FIGHTSTG_updateCameraTurn(), FIGHTSTG_updateHitEffect(), pickEffect(), playCounterTech(), WFIGHTMN_startTech(), and WFIGHTMN_takeDamage().

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