Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
model_api.c File Reference

Go to the source code of this file.

Functions

void update_animated_models (void)
 
void render_animated_models (void)
 
void reset_model_animators (void)
 
void init_model_animators (void)
 

Variables

AnimatedModelList gBattleMeshAnimationList
 
AnimatedModelList gWorldMeshAnimationList
 
AnimatedModelListgCurrentMeshAnimationListPtr
 

Function Documentation

◆ update_animated_models()

void update_animated_models ( void )

Definition at line 7 of file model_api.c.

7 {
8 s32 i;
9
10 for (i = 0; i < MAX_ANIMATED_MODELS; i++) {
11 AnimatedModel* anim = (*gCurrentMeshAnimationListPtr)[i];
12
13 if (anim->animModelID >= 0) {
15 }
16 }
17}
void update_model_animator_with_transform(s32 animatorID, Mtx *mtx)
Definition animator.c:546
#define MAX_ANIMATED_MODELS
Definition macros.h:85

Referenced by reset_model_animators().

◆ render_animated_models()

void render_animated_models ( void )

Definition at line 19 of file model_api.c.

19 {
20 Matrix4f sp18;
21 Matrix4f sp58;
22 Matrix4f sp98;
23 Matrix4f spD8;
24 Matrix4f sp118;
25 Matrix4f sp158;
26 Matrix4f sp198;
27 Matrix4f sp1D8;
28 s32 i = 0;
29 Matrix4f* sp218 = &sp58;
30
31 for (; i < MAX_ANIMATED_MODELS; i++) {
32 AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[i];
33
34 if (model->animModelID >= 0) {
35 guTranslateF(sp18, model->pos.x, model->pos.y, model->pos.z);
36 guRotateF(*sp218, model->rot.x, 1.0f, 0.0f, 0.0f);
37 guRotateF(sp98, model->rot.y, 0.0f, 1.0f, 0.0f);
38 guRotateF(spD8, model->rot.z, 0.0f, 0.0f, 1.0f);
39 guScaleF(sp1D8, model->scale.x, model->scale.y, model->scale.z);
40 guMtxCatF(spD8, *sp218, sp158);
41 guMtxCatF(sp158, sp98, sp118);
42 guMtxCatF(sp1D8, sp118, sp158);
43 guMtxCatF(sp158, sp18, sp198);
44 guMtxF2L(sp198, &model->mtx);
45 render_animated_model(model->animModelID, &model->mtx);
46 }
47 }
48}
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
void render_animated_model(s32 animatorID, Mtx *rootTransform)
Definition animator.c:765

Referenced by reset_model_animators().

◆ reset_model_animators()

void reset_model_animators ( void )

Definition at line 258 of file model_api.c.

258 {
259 s32 i;
260
263 } else {
265 }
266
267 for (i = 0; i < MAX_ANIMATED_MODELS; i++) {
268 AnimatedModel* model = heap_malloc(sizeof(*model));
269
270 (*gCurrentMeshAnimationListPtr)[i] = model;
272 (*gCurrentMeshAnimationListPtr)[i]->animModelID = -1;
273 }
274
276}
#define ASSERT(condition)
@ CONTEXT_WORLD
Definition enums.h:3529
s32 create_worker_world(WorldArgs, WorldArgs)
void * heap_malloc(s32 size)
Definition heap.c:34
void update_animated_models(void)
Definition model_api.c:7
AnimatedModelList * gCurrentMeshAnimationListPtr
Definition script_list.c:29
AnimatedModelList gBattleMeshAnimationList
Definition script_list.c:27
AnimatedModelList gWorldMeshAnimationList
Definition script_list.c:28
void render_animated_models(void)
Definition model_api.c:19
GameStatus * gGameStatusPtr
Definition main_loop.c:32

Referenced by clear_script_list().

◆ init_model_animators()

void init_model_animators ( void )

Definition at line 278 of file model_api.c.

Referenced by init_script_list().

Variable Documentation

◆ gBattleMeshAnimationList

AnimatedModelList gBattleMeshAnimationList
extern

Definition at line 27 of file script_list.c.

Referenced by init_model_animators(), and reset_model_animators().

◆ gWorldMeshAnimationList

AnimatedModelList gWorldMeshAnimationList
extern

Definition at line 28 of file script_list.c.

Referenced by init_model_animators(), and reset_model_animators().

◆ gCurrentMeshAnimationListPtr

AnimatedModelList* gCurrentMeshAnimationListPtr
extern

Definition at line 29 of file script_list.c.

Referenced by init_model_animators(), and reset_model_animators().