Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1#ifndef FIGHTSTG_MODEL_H
2#define FIGHTSTG_MODEL_H
3
4/* FIGHTSTG's models: meshes and their drawing, bones, motions, the models
5 task and its controls, faces, effect models, the fighters' data, and the
6 jumps and moves of a model (model_mesh.c, models.c, face.c, effect_model.c,
7 fighter_info.c, move.c, draw.c and interp.c). */
8
10
11extern MATRIX IDENTITY_MATRIX; /* the root bone's parent (src/engine/data/matrices.c) */
12
13/* A position or rotation, without the SVECTOR pad */
14typedef struct ShortVec3 {
15 /* 0x0 */ s16 x;
16 /* 0x2 */ s16 y;
17 /* 0x4 */ s16 z;
18} ShortVec3;
19
20/* Draws one bone of a Model (FIGHTSTG_createMesh), from the parts of an archive */
21typedef struct Mesh {
23 /* 0x50 */ s32 noBoundsCheck;
24 /* 0x54 */ s32 colorMode; /* Model.setColor's */
25 /* 0x58 */ CVECTOR color;
26 /* 0x5C */ void *archive;
27 /* 0x60 */ ShortVec3 *vertices; /* the count in [0].x, then the vertices */
28 /* 0x64 */ ShortVec3 *normals; /* the count in [0].x, then the normals */
29 /* 0x68 */ u8 *commands; /* see MeshDrawState */
30 /* 0x6C */ ShortVec3 *bounds; /* 9 points (FIGHTSTG_isMeshOnScreen) */
31 /* 0x70 */ Vec2 texPos;
32 /* 0x78 */ s32 *screen; /* where its vertices land on screen */
33 /* 0x7C */ s32 *depth; /* and their depths in the ordering table */
34 /* 0x80 */ CVECTOR *colors; /* its normals' colors under the lights */
35 /* 0x84 */ MATRIX matrix;
36 /* 0xA4 */ void (*draw)(struct Mesh *mesh, s32 layerId, MATRIX *matrix);
37 /* 0xA8 */ void (*drawWireframe)(struct Mesh *mesh, s32 layerId, MATRIX *matrix);
38} Mesh;
39
40/* A Mesh's drawing state while its drawer (FIGHTSTG_drawMesh) walks its command
41 bytes: a high nibble of 8 to 14 sets one of the flags, a low nibble of 1
42 the texture page and CLUT, 2 to 5 one of the flat colors, and 0 starts a
43 run of polygons, each a 0 byte then its vertices' indices, its normals'
44 indices when lit and its UVs when textured. 0xFF ends the commands. */
45typedef struct MeshDrawState {
46 /* 0x00 */ s32 textured;
47 /* 0x04 */ s32 unk4; /* the 0xB nibble: on the disc, 1 on the textured polygons that are not lit and 0 on those that are; nothing reads it */
48 /* 0x08 */ s32 unk8; /* the 0xA nibble: on the disc, 0 but in two effect meshes; nothing reads it */
49 /* 0x0C */ s32 quad;
50 /* 0x10 */ s32 lit;
51 /* 0x14 */ s32 gouraud;
52 /* 0x18 */ s32 abr; /* the semi-transparency mode + 1, 0 for opaque */
53 /* 0x1C */ u8 *cmd;
54 /* 0x20 */ s32 *screen;
55 /* 0x24 */ s32 *depth;
56 /* 0x28 */ u_long *otBase;
57 /* 0x2C */ CVECTOR *normalColors;
58 /* 0x30 */ Vec2 texPos;
59 /* 0x38 */ s32 u;
60 /* 0x3C */ s32 v;
61 /* 0x40 */ u16 tpage;
62 /* 0x42 */ u16 clut;
63 /* 0x44 */ CVECTOR color[4];
64 /* 0x54 */ union {
65 void *ptr;
66 u_long *tag; /* the primitive's first word */
67 POLY_FT3 *ft3;
68 POLY_FT4 *ft4;
69 POLY_GT3 *gt3;
70 POLY_GT4 *gt4;
71 LINE_F2 *lineF2;
72 LINE_F4 *lineF4;
74 /* 0x58 */ s32 sxy[4]; /* the polygon's screen points */
75 /* 0x68 */ u_long *ot;
76 /* 0x6C */ u8 uv[4][2];
77 /* 0x74 */ CVECTOR colors[4]; /* the polygon's vertex colors */
79
80/* One part of a Model: a mesh (Mesh) placed by a matrix relative to its
81 parent's */
82typedef struct ModelBone {
83 /* 0x00 */ s32 parent;
84 /* 0x04 */ s32 file; /* the mesh's file and index */
85 /* 0x08 */ s32 keyFile; /* its keys' file: positions, rotations and scales by frame */
86 /* 0x0C */ s32 visible; /* 0 while its scale is tiny */
87 /* 0x10 */ SVECTOR pos;
88 /* 0x18 */ SVECTOR rot;
89 /* 0x20 */ SVECTOR scale;
90 /* 0x28 */ MATRIX local;
91 /* 0x48 */ MATRIX *parentMatrix;
92 /* 0x4C */ MATRIX world;
93 /* 0x6C */ SVECTOR prevPos; /* the pose the motion blends from */
94 /* 0x74 */ SVECTOR prevRot;
95 /* 0x7C */ SVECTOR prevScale;
96} ModelBone;
97
98/* What drives a Model, owned by whoever created it */
99typedef struct ModelControl {
100 /* 0x00 */ s32 active; /* in the Models task's list */
101 /* 0x04 */ s32 id; /* the Models task's */
102 /* 0x08 */ s32 motion; /* the motion to play */
103 /* 0x0C */ s32 restart; /* play it again from the start */
104 /* 0x10 */ s32 motionDone;
105 /* 0x14 */ s32 fighter; /* the Models task's */
106 /* 0x18 */ s32 idleMotion;
107 /* 0x1C */ ShortVec3 pos;
108 /* 0x22 */ ShortVec3 rot;
109 /* 0x28 */ ShortVec3 homePos;
110 /* 0x2E */ ShortVec3 homeRot;
111 /* 0x34 */ struct {
113 s32 layerId; /* the layer its meshes are drawn in */
114 s32 wireframe; /* they are drawn as wireframe (Mesh.drawWireframe) */
115 } layers[2]; /* the model is drawn once for each one enabled */
117
118/* A motion in the motions' archive: its keyframes, step by step */
119typedef struct MotionStep {
120 /* 0x0 */ s16 index; /* 0x7FFF ends them */
121 /* 0x2 */ s16 count; /* frames, 0 for the last one */
122 /* 0x4 */ s16 frame;
123 /* 0x6 */ s16 endFrame; /* the frame it ends on; 0: it blends into the next one */
124} MotionStep;
125
126/*
127 * A 3D model (FIGHTSTG_createModel), registered with id 0x11: a tree of bones,
128 * each drawn by a Mesh child (children[i] for bone i, children[0] the
129 * model's face, FIGHTSTG_createFace), and the motion it plays, from the
130 * archive of motions in motionFile.
131 */
132typedef struct Model {
134 /* 0x0050 */ s32 boneCount;
135 /* 0x0054 */ ModelBone *bones;
136 /* 0x0058 */ union {
137 SVECTOR v; /* moves the root bone, along its rotation */
138 s32 xy; /* vx and vy as one word */
140 /* 0x0060 */ s32 hasIdle; /* it goes back to its idle motion */
141 /* 0x0064 */ ModelControl *control;
142 /* 0x0068 */ Vec2 texPos; /* where its textures go in VRAM */
143 /* 0x0070 */ s32 texFile;
144 /* 0x0074 */ s32 motionFile;
145 /* 0x0078 */ s32 motion;
146 /* 0x007C */ s32 motionDone;
147 /* 0x0080 */ s32 keyframe;
148 /* 0x0084 */ s32 frame; /* the pose's */
149 /* 0x0088 */ s32 idleFrames[2]; /* where the two idle motions start */
150 /* 0x0090 */ s32 blendTarget; /* the frame it blends into, 0 for none */
151 /* 0x0094 */ s32 blending;
152 /* 0x0098 */ s32 blend; /* how far, in 4096ths */
153 /* 0x009C */ s32 toIdle; /* the motion ends in the idle motion */
154 /* 0x00A0 */ s32 keyframeCount;
155 /* 0x00A4 */ u16 keyframes[0x640];
156 /* 0x0D24 */ u16 blendTargets[0x640]; /* the frame a blending keyframe blends into */
157 /* 0x19A4 */ u16 blendSources[0x640]; /* and the one it blends from, 0xFFFF for the saved pose */
158 /* 0x2624 */ void (*setMotion)(struct Model *model, s32 motion, s32 restart);
159 /* 0x2628 */ s32 (*isMotionDone)(struct Model *model);
160 /* 0x262C */ void (*setColor)(); /* (model, mode, color): its meshes' */
161 /* 0x2630 */ void (*setBoneNoBoundsCheck)();
162} Model;
163
164/* A battle effect that is a model (FIGHTSTG_startEffectModel): FIGHTSTG_effectModels lists
165 them, ending with id 0 */
166typedef struct EffectModelEntry {
167 /* 0x0 */ s32 id;
168 /* 0x4 */ s32 file; /* the model's file and index */
169 /* 0x8 */ s32 motionFile;
171
172/* Shows an effect's model at a place until its motion ends
173 (FIGHTSTG_startEffectModel) */
174typedef struct EffectModel {
176 /* 0x50 */ s32 effect; /* 0 if it has no entry */
177 /* 0x54 */ s32 file;
178 /* 0x58 */ s32 motionFile;
179 /* 0x5C */ SVECTOR pos;
180 /* 0x64 */ SVECTOR rot;
181 /* 0x6C */ Vec2 texPos;
184
185/* The fighters' file, which FIGHTSTG_fighterCache.funcs reads */
186#if VERSION_US || VERSION_JP
187#define FILE_FIGHTERS 0x1BE
188#elif VERSION_EU
189#define FILE_FIGHTERS 0x1CC
190#endif
191
192/* FIGHTSTG_interp: the functions that go between values */
193typedef struct InterpFuncs {
194 /* 0x0 */ void (*nop)(void);
195 /* 0x4 */ void (*lerp)(SVECTOR *from, SVECTOR *to, s32 t, SVECTOR *out); /* t: 0-0x1000 */
196 /* 0x8 */ s32 (*ease)(s32 curve, s32 t, s32 value); /* value scaled by a curve of t */
198
199/* FIGHTSTG_startMove's task: moves a ModelControl to a position */
200typedef struct MoveTask {
203 /* 0x54 */ ShortVec3 from;
204 /* 0x5A */ ShortVec3 to;
205 /* 0x60 */ s32 t; /* 0-0x1000 */
206 /* 0x64 */ s32 tStep;
207} MoveTask;
208
209/* An entry of the fighters' file's list */
210typedef struct FighterEntry {
211 /* 0x0 */ s16 id;
212 /* 0x2 */ u8 index; /* in the partners' or the enemies' table */
213 /* 0x3 */ u8 kind; /* 0x3A and up: an enemy */
215
216/* The fighters' file: offsets from its start */
217typedef struct FightersFile {
218 /* 0x0 */ s32 base; /* the address FighterInfo.face assumes the file is at */
219 /* 0x4 */ s32 entries; /* FighterEntry, up to an id 0 */
220 /* 0x8 */ s32 partners; /* FighterInfo */
221 /* 0xC */ s32 enemies; /* FighterInfoEnemy */
223
224/* A fighter's entry in its file, from FIGHTSTG_fighterCache.funcs.getInfo */
225typedef struct FighterInfo {
226 /* 0x00 */ s32 model;
227 /* 0x04 */ s32 motions;
228 /* 0x08 */ s32 effects; /* its effect scripts' archive */
229 /* 0x0C */ s32 face; /* its FaceRects: an offset in the fighters' file */
230 /* 0x10 */ s16 distance; /* how far past 0x1400 from the middle it stands */
231 /* 0x12 */ s16 unk12[3]; /* varied on the disc (as 0, 0x700, 0x100); nothing reads it */
232 /* 0x18 */ s16 height;
233 /* 0x1A */ ShortVec3 camPos[12]; /* the cameras that look at it; an enemy
234 has 3 of each and then their count */
235 /* 0x62 */ ShortVec3 camRef[12];
236 /* 0xAA */ s16 camProj[12];
238
239/* An enemy's FighterInfo: it has 3 cameras where a partner has 12.
240 FIGHTSTG_fighterCache keeps and returns it as a FighterInfo, so its
241 readers cast it back. */
242typedef struct FighterInfoEnemy {
243 /* 0x00 */ s32 model;
244 /* 0x04 */ s32 motions;
245 /* 0x08 */ s32 effects;
246 /* 0x0C */ s32 face;
247 /* 0x10 */ s16 distance;
248 /* 0x12 */ s16 unk12[3];
249 /* 0x18 */ s16 height;
250 /* 0x1A */ ShortVec3 camPos[3];
251 /* 0x2C */ ShortVec3 camRef[3];
252 /* 0x3E */ s16 camProj[3];
253 /* 0x44 */ s16 cameraCount;
255
256/* The fighters' file (FIGHTSTG_fighterCache.funcs) */
257typedef struct FighterInfoFuncs {
258 /* 0x0 */ FighterInfo *(*getInfo)(s32 id);
259 /* 0x4 */ void (*cacheEntry)(s32 index); /* FIGHTSTG_cacheFighter: the list's entry at index */
260 /* 0x8 */ void (*getRange)(u32 enemy, s32 *min, s32 *max); /* the indices of the partners or the enemies */
262
263/* FIGHTSTG_fighterCache: the last fighter getInfo found, and the fighters'
264 file's functions */
265typedef struct FighterCache {
266 /* 0x00 */ s32 id;
267 /* 0x04 */ s32 isEnemy; /* the kind is 0x3A or more */
268 /* 0x08 */ s32 index; /* in the partners' or the enemies' table */
269 /* 0x0C */ s32 kind;
270 /* 0x10 */ FighterInfo *partnerInfo; /* both hold the info found, read by isEnemy */
273 /* 0x24 */ struct FaceRect *(*getFace)(s32 fighter); /* up to an x of 0xFF */
275
276/* The Models task's children: a removed model stays until it is gone */
277typedef struct ModelsChildren {
278 /* 0x00 */ Model *models[4];
279 /* 0x10 */ Model *dying[4];
281
282/* The fighters' models (FIGHTSTG_createModels), registered as BATTLE_TASK_MODELS: up to four,
283 each one with its ModelControl, found by an id */
284typedef struct Models {
286 /* 0x050 */ ModelControl controls[4];
287 /* 0x180 */ void (*remove)(struct Models *task, s32 id);
288 /* 0x184 */ void (*add)(struct Models *task, s32 id, s32 fighter, s32 visible);
289 /* 0x188 */ ModelControl *(*get)(struct Models *task, s32 id);
290 /* 0x18C */ void (*setId)(struct Models *task, s32 id, s32 newId);
291 /* 0x190 */ s32 (*getFighter)(struct Models *task, s32 id);
292 /* 0x194 */ void (*face)(struct Models *task, s32 id); /* ids under 0x10 are one side */
293 /* 0x198 */ void (*setIdleMotion)(struct Models *task, s32 id, s32 motion);
294} Models;
295
296/* A part of a fighter's face (its eyes, then up to 14 more) and where its
297 three frames are in its texture: copied into place by a DR_MOVE */
298typedef struct FaceRect {
299 /* 0x0 */ u8 x;
300 /* 0x1 */ u8 y;
301 /* 0x2 */ u8 w; /* 0: unused */
302 /* 0x3 */ u8 h;
303 /* 0x4 */ u8 frames[3][2];
304} FaceRect;
305
306typedef struct FacePart {
307 /* 0x00 */ s32 used;
308 /* 0x04 */ s32 frame; /* the one drawn */
309 /* 0x08 */ FaceRect rect;
310} FacePart;
311
312/* A model's face (FIGHTSTG_createFace, the model's first child): the eyes
313 blink (or close for some motions) and the other parts loop their frames */
314typedef struct Face {
316 /* 0x050 */ Model *model;
317 /* 0x054 */ Vec2 texPos; /* the model's */
318 /* 0x05C */ s32 partCount;
319 /* 0x060 */ FacePart parts[16];
320 /* 0x1A0 */ s32 blinkTimer;
321 /* 0x1A4 */ s32 time;
322} Face;
323
324/* The jump heights and speeds (t per frame) of the Jump kinds 1-6 */
325typedef struct JumpParams {
326 /* 0x0 */ s32 height;
327 /* 0x4 */ s32 speed;
328} JumpParams;
329
330/* A ModelControl's jump (FIGHTSTG_startJump): up and down from its y, or
331 for kinds 4 and 5 also forwards from or back to its home */
332typedef struct Jump {
334 /* 0x50 */ s32 kind;
335 /* 0x54 */ s32 distance; /* kind 4: past 0x2800 */
336 /* 0x58 */ s32 zTravel; /* kinds 4 and 5: the z it moves from home, negated for the enemy */
338 /* 0x60 */ s32 height;
339 /* 0x64 */ s32 y;
340 /* 0x68 */ s32 speed;
341 /* 0x6C */ s32 t; /* 0-0x1000 */
342} Jump;
343
344/* The tasks FIGHTSTG starts for WFIGHTMN and WFIGHTTS */
346
347/* Shared between the overlay's objects */
350void FIGHTSTG_blendBone(Model *model, ModelBone *bone);
351void FIGHTSTG_poseBone(Model *model, ModelBone *bone, s32 frame);
352void FIGHTSTG_poseBones(Model *model, Mesh **children);
353void FIGHTSTG_saveBlendPose(Model *model);
354void FIGHTSTG_setMotion(Model *model, s32 motion, s32 restart);
355void FIGHTSTG_updateModel(Model *model, Mesh **children);
356Mesh *FIGHTSTG_createMesh(void *archive, Vec2 texPos);
357void FIGHTSTG_setModelColor(Model *model, s32 mode, CVECTOR *color);
358void FIGHTSTG_setBoneNoBoundsCheck(Model *model, s32 bone, s32 value);
360Model *FIGHTSTG_createModel(s32 file, s32 motionFile, Vec2 texPos, ModelControl *control, s32 hasIdle);
361Model *FIGHTSTG_createPlainModel(s32 file, s32 motionFile, Vec2 texPos, ModelControl *control);
362void FIGHTSTG_lightMesh(Mesh *mesh);
363void FIGHTSTG_projectMesh(Mesh *mesh, Layer *layer);
367void FIGHTSTG_drawMesh(void *arg, Layer *layer);
368void FIGHTSTG_drawMeshWireframe(Mesh *mesh, Layer *layer);
369void FIGHTSTG_queueMeshDraw(Mesh *mesh, s32 layerId, MATRIX *matrix);
370void FIGHTSTG_queueMeshWireframe(Mesh *mesh, s32 layerId, MATRIX *matrix);
371void FIGHTSTG_updateMesh(Mesh *mesh);
372void FIGHTSTG_updateMove(MoveTask *task);
374void FIGHTSTG_cacheFighter(s32 index);
375void FIGHTSTG_getFighterRange(u32 enemy, s32 *min, s32 *max);
377void FIGHTSTG_updateModels(Models *task);
381void FIGHTSTG_addFighterModel(Models *task, s32 id, s32 fighter, s32 visible);
383void FIGHTSTG_setModelId(Models *task, s32 id, s32 newId);
385void FIGHTSTG_faceModel(Models *task, s32 id);
386void FIGHTSTG_setModelIdleMotion(Models *task, s32 id, s32 motion);
387Model *FIGHTSTG_createIdlingModel(s32 file, s32 motionFile, Vec2 texPos, ModelControl *control);
388void FIGHTSTG_updateJump(Jump *task);
389Jump *FIGHTSTG_startJump(ModelControl *control, s32 kind, s32 distance);
391void FIGHTSTG_drawShadedQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors, s32 semi);
392void FIGHTSTG_stepMotion(Model *model);
395void FIGHTSTG_moveFacePart(Face *task, DR_MOVE *prim, s32 part, s32 frame);
396void FIGHTSTG_updateFace(Face *task);
397Face *FIGHTSTG_createFace(Model *model, s32 fighter);
398void FIGHTSTG_projectPoint(Layer *layer, SVECTOR *pos, ShortVec3 *out);
401void FIGHTSTG_updateEffectModel(EffectModel *task, Model **children);
403EffectModel *FIGHTSTG_startEffectModel(s32 id, SVECTOR *pos, SVECTOR *rot);
404void FIGHTSTG_interpNop(void);
405void FIGHTSTG_lerpVector(SVECTOR *from, SVECTOR *to, s32 t, SVECTOR *out);
406s32 FIGHTSTG_ease(s32 curve, s32 t, s32 value);
407
408/* the functions of FIGHTSTG_battle, FIGHTSTG_action and FIGHTSTG_battleFuncs */
409void FIGHTSTG_drawQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors);
410void FIGHTSTG_drawBlendedQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors);
412
413#endif /* FIGHTSTG_MODEL_H */
FIGHTSTG's shared declarations: the headers it builds on, the ids its tasks register with,...
signed int s32
Definition common.h:11
unsigned int u32
Definition common.h:12
signed short s16
Definition common.h:9
unsigned short u16
Definition common.h:10
unsigned char u8
Definition common.h:8
#define TASK_HEADER(Type)
Definition task.h:39
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.
Definition face.c:27
void FIGHTSTG_saveBlendPose(Model *model)
Saves each bone's pose as the one a blend starts from.
Definition model_mesh.c:173
Vec2 FIGHTSTG_fighterTexPos[]
the fighters' models' texture places
Definition models.c:58
s32 FIGHTSTG_isMotionDone(Model *model)
Model.isMotionDone.
Definition model_mesh.c:445
JumpParams FIGHTSTG_jumps[]
the jumps of FIGHTSTG_startJump, by kind from 1
Definition move.c:83
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...
Definition model_mesh.c:909
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...
Definition move.c:8
FighterCache FIGHTSTG_fighterCache
Shared between the overlay's objects.
Definition battle.c:21
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,...
Definition models.c:116
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,...
Definition model_mesh.c:580
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.
Definition interp.c:7
ModelControl * FIGHTSTG_getModelControl(Models *task, s32 id)
Models.get: the control of the model registered as ID, or NULL.
Definition models.c:88
void FIGHTSTG_blendBone(Model *model, ModelBone *bone)
Blends a bone's position, rotation and scale from the saved pose (FIGHTSTG_saveBlendPose) towards the...
Definition model_mesh.c:23
void FIGHTSTG_drawBlendedQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
A Gouraud-shaded quad on a layer, blended.
Definition draw.c:69
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,...
Definition interp.c:31
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...
Definition model_mesh.c:410
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.
Definition move.c:89
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,...
Definition model_mesh.c:452
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...
Definition model_mesh.c:648
void FIGHTSTG_projectMesh(Mesh *mesh, Layer *layer)
The screen positions of a Mesh's vertices and their depths in the layer's ordering table.
Definition model_mesh.c:541
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)
Definition face.c:7
s32 FIGHTSTG_getModelFighter(Models *task, s32 id)
Models.getFighter: the fighter of the model registered as ID, or 0.
Definition models.c:105
Models * FIGHTSTG_createModels(void)
The tasks FIGHTSTG starts for WFIGHTMN and WFIGHTTS.
Definition models.c:154
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...
Definition models.c:64
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.
Definition move.c:103
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'.
Definition model_mesh.c:497
void FIGHTSTG_drawMesh(void *arg, Layer *layer)
A layer callback that draws a Mesh: walks its command bytes (see MeshDrawState), setting its texture ...
Definition model_mesh.c:815
void FIGHTSTG_addMeshPolyFT(MeshDrawState *state)
The same as a flat-shaded textured triangle or quad.
Definition model_mesh.c:615
void FIGHTSTG_updateFace(Face *task)
A fighter's face task: each frame, copies the eyes' frame (blinking at random while open) and the oth...
Definition face.c:43
Face * FIGHTSTG_createFace(Model *model, s32 fighter)
Creates the face of fighter's model, with its parts (FIGHTSTG_fighterCache.getFace); none for fighter...
Definition face.c:119
void FIGHTSTG_lightMesh(Mesh *mesh)
The colors of a Mesh's normals under the lights, through its matrix.
Definition model_mesh.c:507
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.
Definition interp.c:12
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...
Definition model_mesh.c:296
InterpFuncs FIGHTSTG_interp
the functions that go between values
Definition interp.c:44
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 ...
Definition model_mesh.c:143
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.
Definition models.c:33
Model * FIGHTSTG_createPlainModel(s32 file, s32 motionFile, Vec2 texPos, ModelControl *control)
A model whose motions just end (FIGHTSTG_createModel)
Definition model_mesh.c:502
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 ...
Definition draw.c:28
void FIGHTSTG_updateModels(Models *task)
The fighters' models' task: nothing to do but start.
Definition models.c:7
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...
Definition effect_model.c:7
s32 FIGHTSTG_findModelSlot(Models *task, s32 id)
The slot of the fighter model registered as ID, or -1.
Definition models.c:21
MATRIX IDENTITY_MATRIX
the root bone's parent (src/engine/data/matrices.c)
Definition matrices.c:12
MoveTask * FIGHTSTG_startMove(ModelControl *control, ShortVec3 *to, s32 time)
Moves control's model from where it is to to over time frames.
Definition move.c:142
void FIGHTSTG_setModelId(Models *task, s32 id, s32 newId)
Models.setId: registers the model ID as NEWID instead, removing the one that had it.
Definition models.c:99
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...
Definition model_mesh.c:433
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.
Definition models.c:45
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...
Definition model_mesh.c:83
void FIGHTSTG_setMotion(Model *model, s32 motion, s32 restart)
Model.setMotion: lays out the motion's keyframes.
Definition model_mesh.c:185
void FIGHTSTG_drawQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
the functions of FIGHTSTG_battle, FIGHTSTG_action and FIGHTSTG_battleFuncs
Definition draw.c:64
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.
Definition draw.c:8
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.
Definition models.c:145
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,...
Definition model_mesh.c:242
A battle effect that is a model (FIGHTSTG_startEffectModel): FIGHTSTG_effectModels lists them,...
Definition model.h:166
s32 file
the model's file and index
Definition model.h:168
Shows an effect's model at a place until its motion ends (FIGHTSTG_startEffectModel)
Definition model.h:174
SVECTOR rot
Definition model.h:180
SVECTOR pos
Definition model.h:179
s32 motionFile
Definition model.h:178
Vec2 texPos
Definition model.h:181
s32 effect
0 if it has no entry
Definition model.h:176
s32 file
Definition model.h:177
ModelControl control
Definition model.h:182
s32 used
Definition model.h:307
s32 frame
the one drawn
Definition model.h:308
FaceRect rect
Definition model.h:309
A part of a fighter's face (its eyes, then up to 14 more) and where its three frames are in its textu...
Definition model.h:298
u8 frames[3][2]
Definition model.h:303
u8 w
0: unused
Definition model.h:301
u8 x
Definition model.h:299
u8 y
Definition model.h:300
u8 h
Definition model.h:302
A model's face (FIGHTSTG_createFace, the model's first child): the eyes blink (or close for some moti...
Definition model.h:314
FacePart parts[16]
Definition model.h:319
Model * model
Definition model.h:316
s32 time
Definition model.h:321
s32 partCount
Definition model.h:318
Vec2 texPos
the model's
Definition model.h:317
s32 blinkTimer
Definition model.h:320
FIGHTSTG_fighterCache: the last fighter getInfo found, and the fighters' file's functions.
Definition model.h:265
s32 isEnemy
the kind is 0x3A or more
Definition model.h:267
FighterInfo * enemyInfo
Definition model.h:271
s32 index
in the partners' or the enemies' table
Definition model.h:268
FighterInfo * partnerInfo
both hold the info found, read by isEnemy
Definition model.h:270
FighterInfoFuncs funcs
Definition model.h:272
An entry of the fighters' file's list.
Definition model.h:210
u8 kind
0x3A and up: an enemy
Definition model.h:213
u8 index
in the partners' or the enemies' table
Definition model.h:212
An enemy's FighterInfo: it has 3 cameras where a partner has 12.
Definition model.h:242
ShortVec3 camPos[3]
Definition model.h:250
s16 unk12[3]
Definition model.h:248
s16 camProj[3]
Definition model.h:252
ShortVec3 camRef[3]
Definition model.h:251
The fighters' file (FIGHTSTG_fighterCache.funcs)
Definition model.h:257
void(* cacheEntry)(s32 index)
FIGHTSTG_cacheFighter: the list's entry at index.
Definition model.h:259
void(* getRange)(u32 enemy, s32 *min, s32 *max)
the indices of the partners or the enemies
Definition model.h:260
A fighter's entry in its file, from FIGHTSTG_fighterCache.funcs.getInfo.
Definition model.h:225
s16 camProj[12]
Definition model.h:236
ShortVec3 camPos[12]
the cameras that look at it; an enemy has 3 of each and then their count
Definition model.h:233
s32 model
Definition model.h:226
ShortVec3 camRef[12]
Definition model.h:235
s16 height
Definition model.h:232
s32 motions
Definition model.h:227
s16 unk12[3]
varied on the disc (as 0, 0x700, 0x100); nothing reads it
Definition model.h:231
s32 effects
its effect scripts' archive
Definition model.h:228
s16 distance
how far past 0x1400 from the middle it stands
Definition model.h:230
s32 face
its FaceRects: an offset in the fighters' file
Definition model.h:229
The fighters' file: offsets from its start.
Definition model.h:217
s32 enemies
FighterInfoEnemy.
Definition model.h:221
s32 base
the address FighterInfo.face assumes the file is at
Definition model.h:218
s32 partners
FighterInfo.
Definition model.h:220
s32 entries
FighterEntry, up to an id 0.
Definition model.h:219
FIGHTSTG_interp: the functions that go between values.
Definition model.h:193
void(* nop)(void)
Definition model.h:194
s32(* ease)(s32 curve, s32 t, s32 value)
value scaled by a curve of t
Definition model.h:196
void(* lerp)(SVECTOR *from, SVECTOR *to, s32 t, SVECTOR *out)
t: 0-0x1000
Definition model.h:195
The jump heights and speeds (t per frame) of the Jump kinds 1-6.
Definition model.h:325
s32 speed
Definition model.h:327
s32 height
Definition model.h:326
A ModelControl's jump (FIGHTSTG_startJump): up and down from its y, or for kinds 4 and 5 also forward...
Definition model.h:332
s32 speed
Definition model.h:340
s32 kind
Definition model.h:334
ModelControl * control
Definition model.h:337
s32 y
Definition model.h:339
s32 t
0-0x1000
Definition model.h:341
s32 height
Definition model.h:338
s32 zTravel
kinds 4 and 5: the z it moves from home, negated for the enemy
Definition model.h:336
s32 distance
kind 4: past 0x2800
Definition model.h:335
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Definition gfx.h:128
A Mesh's drawing state while its drawer (FIGHTSTG_drawMesh) walks its command bytes: a high nibble of...
Definition model.h:45
u_long * ot
Definition model.h:75
s32 gouraud
Definition model.h:51
u8 uv[4][2]
Definition model.h:76
s32 * depth
Definition model.h:55
s32 abr
the semi-transparency mode + 1, 0 for opaque
Definition model.h:52
s32 textured
Definition model.h:46
LINE_F4 * lineF4
Definition model.h:72
LINE_F2 * lineF2
Definition model.h:71
POLY_GT3 * gt3
Definition model.h:69
u16 tpage
Definition model.h:61
void * ptr
Definition model.h:65
s32 unk8
the 0xA nibble: on the disc, 0 but in two effect meshes; nothing reads it
Definition model.h:48
u8 * cmd
Definition model.h:53
CVECTOR colors[4]
the polygon's vertex colors
Definition model.h:77
s32 sxy[4]
the polygon's screen points
Definition model.h:74
POLY_GT4 * gt4
Definition model.h:70
s32 unk4
the 0xB nibble: on the disc, 1 on the textured polygons that are not lit and 0 on those that are; not...
Definition model.h:47
POLY_FT4 * ft4
Definition model.h:68
union MeshDrawState::@2 prim
CVECTOR color[4]
Definition model.h:63
u_long * otBase
Definition model.h:56
POLY_FT3 * ft3
Definition model.h:67
CVECTOR * normalColors
Definition model.h:57
s32 * screen
Definition model.h:54
u_long * tag
the primitive's first word
Definition model.h:66
Vec2 texPos
Definition model.h:58
Draws one bone of a Model (FIGHTSTG_createMesh), from the parts of an archive.
Definition model.h:21
ShortVec3 * normals
the count in [0].x, then the normals
Definition model.h:28
CVECTOR * colors
its normals' colors under the lights
Definition model.h:34
void * archive
Definition model.h:26
ShortVec3 * bounds
9 points (FIGHTSTG_isMeshOnScreen)
Definition model.h:30
void(* drawWireframe)(struct Mesh *mesh, s32 layerId, MATRIX *matrix)
Definition model.h:37
s32 colorMode
Model.setColor's.
Definition model.h:24
CVECTOR color
Definition model.h:25
ShortVec3 * vertices
the count in [0].x, then the vertices
Definition model.h:27
Vec2 texPos
Definition model.h:31
u8 * commands
see MeshDrawState
Definition model.h:29
MATRIX matrix
Definition model.h:35
s32 * depth
and their depths in the ordering table
Definition model.h:33
void(* draw)(struct Mesh *mesh, s32 layerId, MATRIX *matrix)
Definition model.h:36
s32 noBoundsCheck
Definition model.h:23
s32 * screen
where its vertices land on screen
Definition model.h:32
One part of a Model: a mesh (Mesh) placed by a matrix relative to its parent's.
Definition model.h:82
SVECTOR prevPos
the pose the motion blends from
Definition model.h:93
s32 parent
Definition model.h:83
MATRIX world
Definition model.h:92
MATRIX local
Definition model.h:90
SVECTOR pos
Definition model.h:87
s32 visible
0 while its scale is tiny
Definition model.h:86
MATRIX * parentMatrix
Definition model.h:91
SVECTOR prevRot
Definition model.h:94
s32 keyFile
its keys' file: positions, rotations and scales by frame
Definition model.h:85
SVECTOR prevScale
Definition model.h:95
s32 file
the mesh's file and index
Definition model.h:84
SVECTOR scale
Definition model.h:89
SVECTOR rot
Definition model.h:88
What drives a Model, owned by whoever created it.
Definition model.h:99
ShortVec3 rot
Definition model.h:108
s32 restart
play it again from the start
Definition model.h:103
s32 active
in the Models task's list
Definition model.h:100
s32 wireframe
they are drawn as wireframe (Mesh.drawWireframe)
Definition model.h:114
s32 enabled
Definition model.h:112
ShortVec3 pos
Definition model.h:107
s32 layerId
the layer its meshes are drawn in
Definition model.h:113
s32 id
the Models task's
Definition model.h:101
ShortVec3 homeRot
Definition model.h:110
struct ModelControl::@3 layers[2]
the model is drawn once for each one enabled
ShortVec3 homePos
Definition model.h:109
s32 motion
the motion to play
Definition model.h:102
s32 fighter
the Models task's
Definition model.h:105
s32 idleMotion
Definition model.h:106
s32 motionDone
Definition model.h:104
A 3D model (FIGHTSTG_createModel), registered with id 0x11: a tree of bones, each drawn by a Mesh chi...
Definition model.h:132
s32 keyframeCount
Definition model.h:154
s32 xy
vx and vy as one word
Definition model.h:138
Vec2 texPos
where its textures go in VRAM
Definition model.h:142
u16 keyframes[0x640]
Definition model.h:155
s32 motionFile
Definition model.h:144
u16 blendSources[0x640]
and the one it blends from, 0xFFFF for the saved pose
Definition model.h:157
u16 blendTargets[0x640]
the frame a blending keyframe blends into
Definition model.h:156
ModelBone * bones
Definition model.h:135
s32 frame
the pose's
Definition model.h:148
SVECTOR v
moves the root bone, along its rotation
Definition model.h:137
s32(* isMotionDone)(struct Model *model)
Definition model.h:159
s32 motionDone
Definition model.h:146
s32 blending
Definition model.h:151
s32 toIdle
the motion ends in the idle motion
Definition model.h:153
s32 texFile
Definition model.h:143
s32 idleFrames[2]
where the two idle motions start
Definition model.h:149
void(* setColor)()
(model, mode, color): its meshes'
Definition model.h:160
s32 motion
Definition model.h:145
s32 keyframe
Definition model.h:147
ModelControl * control
Definition model.h:141
s32 boneCount
Definition model.h:134
void(* setMotion)(struct Model *model, s32 motion, s32 restart)
Definition model.h:158
void(* setBoneNoBoundsCheck)()
Definition model.h:161
s32 hasIdle
it goes back to its idle motion
Definition model.h:140
s32 blend
how far, in 4096ths
Definition model.h:152
s32 blendTarget
the frame it blends into, 0 for none
Definition model.h:150
union Model::@4 move
The Models task's children: a removed model stays until it is gone.
Definition model.h:277
Model * dying[4]
Definition model.h:279
Model * models[4]
Definition model.h:278
The fighters' models (FIGHTSTG_createModels), registered as BATTLE_TASK_MODELS: up to four,...
Definition model.h:284
s32 id
Definition model.h:285
void(* remove)(struct Models *task, s32 id)
Definition model.h:287
void(* setId)(struct Models *task, s32 id, s32 newId)
Definition model.h:290
void(* setIdleMotion)(struct Models *task, s32 id, s32 motion)
Definition model.h:293
void(* face)(struct Models *task, s32 id)
ids under 0x10 are one side
Definition model.h:292
ModelControl controls[4]
Definition model.h:286
void(* add)(struct Models *task, s32 id, s32 fighter, s32 visible)
Definition model.h:288
s32(* getFighter)(struct Models *task, s32 id)
Definition model.h:291
A motion in the motions' archive: its keyframes, step by step.
Definition model.h:119
s16 frame
Definition model.h:122
s16 index
0x7FFF ends them
Definition model.h:120
s16 count
frames, 0 for the last one
Definition model.h:121
s16 endFrame
the frame it ends on; 0: it blends into the next one
Definition model.h:123
FIGHTSTG_startMove's task: moves a ModelControl to a position.
Definition model.h:200
s32 tStep
Definition model.h:206
ShortVec3 from
Definition model.h:203
ModelControl * control
Definition model.h:202
s32 t
0-0x1000
Definition model.h:205
ShortVec3 to
Definition model.h:204
A position or rotation, without the SVECTOR pad.
Definition model.h:14
s16 x
Definition model.h:15
s16 z
Definition model.h:17
s16 y
Definition model.h:16
Definition gfx.h:352