14 return script->
enemy != 0 ? 0x10 : 0;
35 switch (*script->
pc++) {
60 hit = script->
hits[0];
63 hit = script->
hits[1];
66 hit = script->
hits[2];
84 control->
motion = motion + 1;
91 control->
rot.
x = *script->
pc++;
92 control->
rot.
y = -*script->
pc++;
93 control->
rot.
z = -*script->
pc++;
110 models->
add(models,
id, fighter, 0);
116 s32 time = *script->
pc++;
131 models->
remove(models,
id);
146 s32 cmd = *script->
pc++;
162 if (cmd != 6 && cmd != 9) {
212 s32 time = script->
pc[3];
214 pos.
x = script->
pc[0];
215 pos.
y = -script->
pc[1];
216 pos.
z = -script->
pc[2];
221 control->
pos.
x = pos.
x;
222 control->
pos.
y = pos.
y;
223 control->
pos.
z = pos.
z;
241 s32 time = *script->
pc++;
253 control->
pos.
x = pos.
x;
254 control->
pos.
y = pos.
y;
255 control->
pos.
z = pos.
z;
272 s32 mode = *script->
pc++;
273 s32 effect = *script->
pc++;
276 if (effect == 9999) {
282 pos.vx = *script->
pc++;
283 pos.vy = *script->
pc++;
284 pos.vz = *script->
pc++;
285 for (i = 0; i < 8; i++) {
333 s32 mode = *script->
pc++;
334 s32 id = *script->
pc++;
341 pos.vx = *script->
pc++;
342 pos.vy = -*script->
pc++;
343 pos.vz = -*script->
pc++;
344 rot.vx = *script->
pc++;
345 rot.vy = -*script->
pc++;
346 rot.vz = -*script->
pc++;
347 for (i = 0; i < 3; i++) {
369 s32 time = *script->
pc++;
371 s16 *pc = script->
pc;
375 switch (*script->
pc++) {
407 view->
rot.vx = pc[10];
408 view->
rot.vy = -pc[11];
409 view->
rot.vz = -pc[12];
412 script->
pc = pc + 15;
416 camera->
fade(camera,
NULL, view, time);
418 camera->
set(camera, view);
428 script->
wait = *script->
pc;
435 if (script->
wait > 0) {
452 s32 mode = *script->
pc++;
453 s32 id = *script->
pc++;
468 fadeOut = *script->
pc++;
469 fadeIn = *script->
pc++;
473 stage->
setStage(stage,
id, fadeOut, fadeIn);
504 s32 sound = *script->
pc++;
505 s32 time = *script->
pc++;
510 }
else if (sound == 0x63) {
511 sound = script->
hits[3] == 3 ? 0x38 : script->
sound;
522 s32 op = *script->
pc++;
523 s32 frames = *script->
pc++;
545 switch (script->
state) {
551 script->
model = script->
enemy != 0 ? 0x10 : 0;
558 if (script->
index != 12) {
565 switch (script->
step) {
583 switch (*script->
pc++) {
625 for (i = 0; i < 8; i++) {
652#if VERSION_EU || VERSION_JP
FighterCache FIGHTSTG_fighterCache
the fighters' data, loaded one at a time
#define BATTLE_TASK_CAMERA
#define BATTLE_TASK_MODELS
the fighters'
#define BATTLE_TASK_STAGE
FIGHTSTG.PRO: the battle.
static void addModel(s32 id, s32 fighter)
Model command 6: adds fighter FIGHTER's model to the battle as model ID.
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).
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...
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 ...
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,...
BattleScript * FIGHTSTG_createBattleScript(void)
Creates a battle script, which plays a technique (FIGHTSTG_updateBattleScript)
void FIGHTSTG_runScriptFade(BattleScript *script, WhiteFlash **fade)
The battle script's fade command: 0 fades the screen out over the frames in the script,...
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 ...
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.
static void turnModel(BattleScript *script, ModelControl *control)
Model command 4: sets the model's rotation from the script.
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 (...
static void removeModel(s32 id)
Model command 9: removes model ID from the battle.
static void playMotion(ModelControl *control, s32 motion)
Model command 0 with any other MOTION: plays the model's motion MOTION from its start.
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 positi...
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.
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,...
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 ...
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,...
static void playIdleMotion(ModelControl *control)
Model command 0 with 1: puts the model back to its idle motion.
BattleSound * FIGHTSTG_playBattleSound(s32 index, s32 time)
Plays battle sound index (FIGHTSTG_battleSounds; 0x5A the battle's music, 0x5B stops sound 0x20040006...
The camera's turn around the fighters, a task that both versions have: the USA version in camera_task...
GfxState GFX
GFX: the graphics state and its methods.
EffectModel * FIGHTSTG_startEffectModel(s32 id, SVECTOR *pos, SVECTOR *rot)
Starts the effect model id at pos and rot, its model in FIGHTSTG_effectModels and its textures at (0x...
s32 FIGHTSTG_getEffectModelFile(s32 id)
The model file of effect model id (FIGHTSTG_effectModels), or 0 for none.
FileCache FILE_CACHE
The file cache.
CameraView FIGHTSTG_fighterView
the view FIGHTSTG_getFighterView makes
s32 FIGHTSTG_partnerIdleMotion
the partner's idle motion while stage 0x1D is up
Jump * FIGHTSTG_startJump(ModelControl *control, s32 kind, s32 distance)
Starts a jump of control's model of kind 1-6 (FIGHTSTG_jumps), forward by distance for kind 4.
MoveTask * FIGHTSTG_startMove(ModelControl *control, ShortVec3 *to, s32 time)
Moves control's model from where it is to to over time frames.
TaskRegistry TASK_REGISTRY
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
s32 FIGHTSTG_findEffectSheet(s32 effect, s32 *images, s32 *sheet, Vec2 *texPos)
Finds 2D effect effect's sheet (FIGHTSTG_spriteEffects, FIGHTSTG_effectSheets) and gives its values; ...
SpriteEffect * FIGHTSTG_startSpriteEffect(s32 effect, const SVECTOR *pos)
Starts 2D effect effect (FIGHTSTG_spriteEffects) at pos; killed at once when it has no entry.
s32 FIGHTSTG_getStageMotionsFile(s32 id)
The file of fight stage ID's motions.
The battle camera (FIGHTSTG_createBattleCamera), registered as BATTLE_TASK_CAMERA on a layer: set put...
CameraView *(* getFighterView)(struct BattleCamera *task, s32 id, s32 camera)
CameraView *(* getEnemyView)(struct BattleCamera *task)
void(* set)(struct BattleCamera *task, CameraView *view)
void(* fade)(struct BattleCamera *task, CameraView *from, CameraView *to, s32 time)
from: NULL for the current
The battle script's children.
SpriteEffect * spriteEffects[8]
BattleScript * script
one it plays
A fighter's battle script (FIGHTSTG_updateBattleScript): a list of s16 commands in an archive entry o...
s32 hitsPlayed
how many hits command 5 has played
s32 enemy
the script is the enemy's (nonzero) or the partner's
s32 soundsPlayed
and the sound commands
void(* nextSubstate)(struct BattleScript *task)
s32 sound
what the sound commands' 0x62 and 0x63 stand for on a hit
s32 effect
the sprite effect the effect command's 9999 stands for
void(* nextStep)(struct BattleScript *task)
void(* setState)(struct BattleScript *task, s32 state)
s32 effectImages
FIGHTSTG_findEffectSheet's.
s32 hits[4]
0 a hit, 3 a miss; [3] how it ended
void(* destroy)(struct BattleScript *task)
void(* nextState)(struct BattleScript *task)
s32 model
the Models task's id
s32 index
the script, in the fighter's archive
s32 loadStep
FIGHTSTG_runScriptEffect's, loading a 2D effect.
s32 stage
what the stage command's 0x38 stands for
s32 stage
the battle's fight stage
Where the battle camera looks from and to, as a GsRVIEW2 with the transform of its coordinate system.
s32 rz
the roll, in degrees
s32 proj
the projection distance
The fight stage (FIGHTSTG_createStage), registered as BATTLE_TASK_STAGE: its model,...
void(* setStage)(struct FightStage *task, s32 stage, s32 fadeOutTime, s32 fadeInTime)
FighterInfo * partnerInfo
both hold the info found, read by isEnemy
FighterInfo *(* getInfo)(s32 id)
s32 effects
its effect scripts' archive
void *(* getArchiveEntry)(s32 index, void *archive)
s32(* isLoading)(s32 file)
void *(* getEntry)(u32 fileAndIndex)
s32(* getFrameTime)(void)
void(* destroy)(struct Jump *task)
What drives a Model, owned by whoever created it.
s32 restart
play it again from the start
struct ModelControl::@3 layers[2]
the model is drawn once for each one enabled
s32 motion
the motion to play
s32 fighter
the Models task's
The fighters' models (FIGHTSTG_createModels), registered as BATTLE_TASK_MODELS: up to four,...
void(* remove)(struct Models *task, s32 id)
void(* add)(struct Models *task, s32 id, s32 fighter, s32 visible)
ModelControl *(* get)(struct Models *task, s32 id)
A position or rotation, without the SVECTOR pad.
void *(* find)(s32 id, s32 key1, s32 key2)
Any task, seen through its header.
Uploads TIM images to VRAM (initTimLoader); acts on TIM_LOADER.
void(* setImagePos)()
(x, y)
void(* loadArchive)()
(archive): each image 64 halfwords to the right
The white flash (FIGHTSTG_startWhiteFlash): fades the screen to white, and back once ended.
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
void initTimLoader(TimLoader *obj)
Clears a TIM loader, gives it its methods and binds it.
WhiteFlash * FIGHTSTG_startWhiteFlash(s32 frames)
Starts a white flash that whitens the screen over FRAMES.
void FIGHTSTG_endWhiteFlash(WhiteFlash *task, s32 frames)
Fades the white flash back out over FRAMES.