1#ifndef FIGHTSTG_MODEL_H
2#define FIGHTSTG_MODEL_H
186#if VERSION_US || VERSION_JP
187#define FILE_FIGHTERS 0x1BE
189#define FILE_FIGHTERS 0x1CC
195 void (*
lerp)(SVECTOR *from, SVECTOR *to,
s32 t, SVECTOR *out);
FIGHTSTG's shared declarations: the headers it builds on, the ids its tasks register with,...
#define TASK_HEADER(Type)
void FIGHTSTG_moveFacePart(Face *task, DR_MOVE *prim, s32 part, s32 frame)
Fills prim to copy part's frame of the face's texture over the part, in VRAM.
void FIGHTSTG_saveBlendPose(Model *model)
Saves each bone's pose as the one a blend starts from.
Vec2 FIGHTSTG_fighterTexPos[]
the fighters' models' texture places
s32 FIGHTSTG_isMotionDone(Model *model)
Model.isMotionDone.
JumpParams FIGHTSTG_jumps[]
the jumps of FIGHTSTG_startJump, by kind from 1
void FIGHTSTG_drawMeshWireframe(Mesh *mesh, Layer *layer)
Draws a Mesh as wireframe: each polygon of its command runs as a green LINE_F4 through its screen poi...
void FIGHTSTG_updateJump(Jump *task)
The jump's task: lifts its model and drops it along ease curves at its speed; kind 4 also moves it fo...
FighterCache FIGHTSTG_fighterCache
Shared between the overlay's objects.
EffectModelEntry FIGHTSTG_effectModels[]
the effect models, ended by an id of 0; the European version's differ
void FIGHTSTG_faceModel(Models *task, s32 id)
Models.face: puts the model registered as ID at its side's place, facing the other side,...
void FIGHTSTG_cacheFighter(s32 index)
Loads entry index of the fighters file into FIGHTSTG_fighterCache: its id and kind,...
void FIGHTSTG_addMeshPolyGT(MeshDrawState *state)
Adds the polygon in state as a gouraud-shaded textured triangle or quad; the colors,...
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...
void FIGHTSTG_interpNop(void)
FIGHTSTG_interp.nop: empty, and nothing calls it.
ModelControl * FIGHTSTG_getModelControl(Models *task, s32 id)
Models.get: the control of the model registered as ID, or NULL.
void FIGHTSTG_blendBone(Model *model, ModelBone *bone)
Blends a bone's position, rotation and scale from the saved pose (FIGHTSTG_saveBlendPose) towards the...
void FIGHTSTG_drawBlendedQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
A Gouraud-shaded quad on a layer, blended.
void FIGHTSTG_queueMeshWireframe(Mesh *mesh, s32 layerId, MATRIX *matrix)
Mesh.drawWireframe: has the layer draw the Mesh as wireframe (FIGHTSTG_drawMeshWireframe) with MATRIX...
s32 FIGHTSTG_ease(s32 curve, s32 t, s32 value)
Returns value scaled by the sine of t (4096 is 1.0) on the given curve: 0 a quarter of t,...
void FIGHTSTG_setModelColor(Model *model, s32 mode, CVECTOR *color)
Model.setColor: sets the color mode, and the color unless COLOR is NULL, of the meshes of each bone b...
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.
Model * FIGHTSTG_createModel(s32 file, s32 motionFile, Vec2 texPos, ModelControl *control, s32 hasIdle)
Creates a model (registered as BATTLE_TASK_MODEL) from the bone list in FILE: each bone's parent,...
s32 FIGHTSTG_isMeshOnScreen(Mesh *mesh, Layer *layer)
Whether a Mesh may be on screen: the screen positions of the 9 points of its bounds against the layer...
void FIGHTSTG_projectMesh(Mesh *mesh, Layer *layer)
The screen positions of a Mesh's vertices and their depths in the layer's ordering table.
s32 FIGHTSTG_getEyesFrame(Face *task)
The eyes' frame for the model's motion: 2 (closed) for motions 4 to 11, 1 for 2, else 0 (open)
s32 FIGHTSTG_getModelFighter(Models *task, s32 id)
Models.getFighter: the fighter of the model registered as ID, or 0.
Models * FIGHTSTG_createModels(void)
The tasks FIGHTSTG starts for WFIGHTMN and WFIGHTTS.
void FIGHTSTG_queueMeshDraw(Mesh *mesh, s32 layerId, MATRIX *matrix)
Mesh.draw: has the layer draw the Mesh (FIGHTSTG_drawMesh) with MATRIX.
void FIGHTSTG_updateMesh(Mesh *mesh)
The Mesh's task: frees its screen positions, depths and colors when killed.
void FIGHTSTG_addFighterModel(Models *task, s32 id, s32 fighter, s32 visible)
Models.add: replaces the model registered as ID with FIGHTER's, in a free slot with that slot's textu...
s32 FIGHTSTG_getEffectModelFile(s32 id)
The model file of effect model id (FIGHTSTG_effectModels), or 0 for none.
void FIGHTSTG_updateMove(MoveTask *task)
The move's task: takes the model from from to to along tStep, a step each frame, and dies there.
FaceRect * FIGHTSTG_getFighterFace(s32 id)
Fighter id's face parts (FaceRect), in the fighters file.
Model * FIGHTSTG_createIdlingModel(s32 file, s32 motionFile, Vec2 texPos, ModelControl *control)
A model whose motions go back to its idle motion (FIGHTSTG_createModel): the fighters'.
void FIGHTSTG_drawMesh(void *arg, Layer *layer)
A layer callback that draws a Mesh: walks its command bytes (see MeshDrawState), setting its texture ...
void FIGHTSTG_addMeshPolyFT(MeshDrawState *state)
The same as a flat-shaded textured triangle or quad.
void FIGHTSTG_updateFace(Face *task)
A fighter's face task: each frame, copies the eyes' frame (blinking at random while open) and the oth...
Face * FIGHTSTG_createFace(Model *model, s32 fighter)
Creates the face of fighter's model, with its parts (FIGHTSTG_fighterCache.getFace); none for fighter...
void FIGHTSTG_lightMesh(Mesh *mesh)
The colors of a Mesh's normals under the lights, through its matrix.
void FIGHTSTG_lerpVector(SVECTOR *from, SVECTOR *to, s32 t, SVECTOR *out)
FIGHTSTG_interp.lerp: out is from moved t (0-0x1000) of the way to to, on the GTE.
FighterInfo * FIGHTSTG_getFighterInfo(s32 id)
the match depends on reaching the cache through the symbol until a fighter is found,...
void FIGHTSTG_updateModel(Model *model, Mesh **children)
The model's task: loads its textures and makes its meshes and face, then each frame follows its contr...
InterpFuncs FIGHTSTG_interp
the functions that go between values
void FIGHTSTG_poseBones(Model *model, Mesh **children)
Moves the root bone by the model's move along its rotation, then poses (FIGHTSTG_poseBone) or blends ...
void FIGHTSTG_getFighterRange(u32 enemy, s32 *min, s32 *max)
The first and last entries of the fighters file that are enemies (enemy set) or partners.
s32 FIGHTSTG_findFreeModelSlot(Models *task)
A free fighter model slot, or -1.
Model * FIGHTSTG_createPlainModel(s32 file, s32 motionFile, Vec2 texPos, ModelControl *control)
A model whose motions just end (FIGHTSTG_createModel)
void FIGHTSTG_drawShadedQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors, s32 semi)
A Gouraud-shaded quad on a layer, blended when semi is set; the match depends on setSemiTrans inside ...
void FIGHTSTG_updateModels(Models *task)
The fighters' models' task: nothing to do but start.
void FIGHTSTG_updateEffectModel(EffectModel *task, Model **children)
An effect model's task: creates its model at its position and rotation on layer BATTLE_LAYER_MODELS a...
s32 FIGHTSTG_findModelSlot(Models *task, s32 id)
The slot of the fighter model registered as ID, or -1.
MATRIX IDENTITY_MATRIX
the root bone's parent (src/engine/data/matrices.c)
MoveTask * FIGHTSTG_startMove(ModelControl *control, ShortVec3 *to, s32 time)
Moves control's model from where it is to to over time frames.
void FIGHTSTG_setModelId(Models *task, s32 id, s32 newId)
Models.setId: registers the model ID as NEWID instead, removing the one that had it.
void FIGHTSTG_setBoneNoBoundsCheck(Model *model, s32 bone, s32 value)
Model.setBoneNoBoundsCheck: sets bone's Mesh noBoundsCheck when either of the control's layers is ena...
s32 FIGHTSTG_partnerIdleMotion
the partner's idle motion while stage 0x1D is up
void FIGHTSTG_removeFighterModel(Models *task, s32 id)
Models.remove: kills the model registered as ID and frees its slot.
void FIGHTSTG_poseBone(Model *model, ModelBone *bone, s32 frame)
Sets a bone's position, rotation and scale to their keys at FRAME, interpolated between the keys arou...
void FIGHTSTG_setMotion(Model *model, s32 motion, s32 restart)
Model.setMotion: lays out the motion's keyframes.
void FIGHTSTG_drawQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
the functions of FIGHTSTG_battle, FIGHTSTG_action and FIGHTSTG_battleFuncs
void FIGHTSTG_projectPoint(Layer *layer, SVECTOR *pos, ShortVec3 *out)
Projects pos to the screen: its x and y, and its depth in the layer's ordering table.
Mesh * FIGHTSTG_createMesh(void *archive, Vec2 texPos)
Creates a Mesh from an archive: its vertices (entry 0), normals (1), commands (2) and bounds (5)
void FIGHTSTG_setModelIdleMotion(Models *task, s32 id, s32 motion)
Models.setIdleMotion.
void FIGHTSTG_stepMotion(Model *model)
Steps a model's motion by the frames gone by, blending into a new pose where a keyframe has 0x8000,...
A battle effect that is a model (FIGHTSTG_startEffectModel): FIGHTSTG_effectModels lists them,...
s32 file
the model's file and index
Shows an effect's model at a place until its motion ends (FIGHTSTG_startEffectModel)
s32 effect
0 if it has no entry
A part of a fighter's face (its eyes, then up to 14 more) and where its three frames are in its textu...
A model's face (FIGHTSTG_createFace, the model's first child): the eyes blink (or close for some moti...
FIGHTSTG_fighterCache: the last fighter getInfo found, and the fighters' file's functions.
s32 isEnemy
the kind is 0x3A or more
s32 index
in the partners' or the enemies' table
FighterInfo * partnerInfo
both hold the info found, read by isEnemy
An entry of the fighters' file's list.
u8 kind
0x3A and up: an enemy
u8 index
in the partners' or the enemies' table
An enemy's FighterInfo: it has 3 cameras where a partner has 12.
The fighters' file (FIGHTSTG_fighterCache.funcs)
void(* cacheEntry)(s32 index)
FIGHTSTG_cacheFighter: the list's entry at index.
void(* getRange)(u32 enemy, s32 *min, s32 *max)
the indices of the partners or the enemies
A fighter's entry in its file, from FIGHTSTG_fighterCache.funcs.getInfo.
ShortVec3 camPos[12]
the cameras that look at it; an enemy has 3 of each and then their count
s16 unk12[3]
varied on the disc (as 0, 0x700, 0x100); nothing reads it
s32 effects
its effect scripts' archive
s16 distance
how far past 0x1400 from the middle it stands
s32 face
its FaceRects: an offset in the fighters' file
The fighters' file: offsets from its start.
s32 enemies
FighterInfoEnemy.
s32 base
the address FighterInfo.face assumes the file is at
s32 entries
FighterEntry, up to an id 0.
FIGHTSTG_interp: the functions that go between values.
s32(* ease)(s32 curve, s32 t, s32 value)
value scaled by a curve of t
void(* lerp)(SVECTOR *from, SVECTOR *to, s32 t, SVECTOR *out)
t: 0-0x1000
The jump heights and speeds (t per frame) of the Jump kinds 1-6.
A ModelControl's jump (FIGHTSTG_startJump): up and down from its y, or for kinds 4 and 5 also forward...
s32 zTravel
kinds 4 and 5: the z it moves from home, negated for the enemy
s32 distance
kind 4: past 0x2800
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
A Mesh's drawing state while its drawer (FIGHTSTG_drawMesh) walks its command bytes: a high nibble of...
s32 abr
the semi-transparency mode + 1, 0 for opaque
s32 unk8
the 0xA nibble: on the disc, 0 but in two effect meshes; nothing reads it
CVECTOR colors[4]
the polygon's vertex colors
s32 sxy[4]
the polygon's screen points
s32 unk4
the 0xB nibble: on the disc, 1 on the textured polygons that are not lit and 0 on those that are; not...
union MeshDrawState::@2 prim
u_long * tag
the primitive's first word
Draws one bone of a Model (FIGHTSTG_createMesh), from the parts of an archive.
ShortVec3 * normals
the count in [0].x, then the normals
CVECTOR * colors
its normals' colors under the lights
ShortVec3 * bounds
9 points (FIGHTSTG_isMeshOnScreen)
void(* drawWireframe)(struct Mesh *mesh, s32 layerId, MATRIX *matrix)
s32 colorMode
Model.setColor's.
ShortVec3 * vertices
the count in [0].x, then the vertices
u8 * commands
see MeshDrawState
s32 * depth
and their depths in the ordering table
void(* draw)(struct Mesh *mesh, s32 layerId, MATRIX *matrix)
s32 * screen
where its vertices land on screen
One part of a Model: a mesh (Mesh) placed by a matrix relative to its parent's.
SVECTOR prevPos
the pose the motion blends from
s32 visible
0 while its scale is tiny
s32 keyFile
its keys' file: positions, rotations and scales by frame
s32 file
the mesh's file and index
What drives a Model, owned by whoever created it.
s32 restart
play it again from the start
s32 active
in the Models task's list
s32 wireframe
they are drawn as wireframe (Mesh.drawWireframe)
s32 layerId
the layer its meshes are drawn in
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
A 3D model (FIGHTSTG_createModel), registered with id 0x11: a tree of bones, each drawn by a Mesh chi...
s32 xy
vx and vy as one word
Vec2 texPos
where its textures go in VRAM
u16 blendSources[0x640]
and the one it blends from, 0xFFFF for the saved pose
u16 blendTargets[0x640]
the frame a blending keyframe blends into
SVECTOR v
moves the root bone, along its rotation
s32(* isMotionDone)(struct Model *model)
s32 toIdle
the motion ends in the idle motion
s32 idleFrames[2]
where the two idle motions start
void(* setColor)()
(model, mode, color): its meshes'
void(* setMotion)(struct Model *model, s32 motion, s32 restart)
void(* setBoneNoBoundsCheck)()
s32 hasIdle
it goes back to its idle motion
s32 blend
how far, in 4096ths
s32 blendTarget
the frame it blends into, 0 for none
The Models task's children: a removed model stays until it is gone.
The fighters' models (FIGHTSTG_createModels), registered as BATTLE_TASK_MODELS: up to four,...
void(* remove)(struct Models *task, s32 id)
void(* setId)(struct Models *task, s32 id, s32 newId)
void(* setIdleMotion)(struct Models *task, s32 id, s32 motion)
void(* face)(struct Models *task, s32 id)
ids under 0x10 are one side
void(* add)(struct Models *task, s32 id, s32 fighter, s32 visible)
s32(* getFighter)(struct Models *task, s32 id)
A motion in the motions' archive: its keyframes, step by step.
s16 index
0x7FFF ends them
s16 count
frames, 0 for the last one
s16 endFrame
the frame it ends on; 0: it blends into the next one
FIGHTSTG_startMove's task: moves a ModelControl to a position.
A position or rotation, without the SVECTOR pad.