From b74c76a430990f4f9411a806401cc3d73984e92a Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Thu, 1 Dec 2022 00:21:11 -0600 Subject: [PATCH] modelRender.c documentation --- decompressed.us.v10.yaml | 8 +- include/core2/modelRender.h | 24 +++++ include/functions.h | 2 +- include/prop.h | 3 +- src/BGS/ch/mrvile.c | 6 +- src/BGS/ch/yumblie.c | 4 +- src/BGS/done/ch/pinkegg.c | 2 +- src/CC/code_13C0.c | 6 +- src/CC/code_1F70.c | 8 +- src/CCW/code_2270.c | 4 +- src/CCW/code_7570.c | 2 +- src/FP/code_A40.c | 2 +- src/GV/code_1570.c | 6 +- src/GV/code_2730.c | 2 +- src/GV/code_2B80.c | 4 +- src/GV/code_2EE0.c | 2 +- src/MM/ch/juju.c | 4 +- src/MM/ch/orange.c | 4 +- src/MMM/ch/motzhand.c | 4 +- src/MMM/code_47D0.c | 4 +- src/MMM/code_5000.c | 4 +- src/RBB/code_3CB0.c | 4 +- src/RBB/code_47D0.c | 2 +- src/RBB/code_4C70.c | 2 +- src/RBB/code_5F80.c | 2 +- src/RBB/code_640.c | 2 +- src/TTC/code_35D0.c | 4 +- src/core2/bs/croc.c | 4 +- src/core2/ch/badShad.c | 4 +- src/core2/code_41460.c | 4 +- src/core2/code_43800.c | 4 +- src/core2/code_440B0.c | 2 +- src/core2/code_47BD0.c | 8 +- src/core2/code_55390.c | 4 +- src/core2/code_556C0.c | 2 +- src/core2/code_55850.c | 4 +- src/core2/code_55A90.c | 2 +- src/core2/code_55BC0.c | 4 +- src/core2/code_55E70.c | 4 +- src/core2/code_560F0.c | 12 +-- src/core2/code_57C70.c | 6 +- src/core2/code_581D0.c | 4 +- src/core2/code_584D0.c | 4 +- src/core2/code_59780.c | 2 +- src/core2/code_59D40.c | 2 +- src/core2/code_679A0.c | 4 +- src/core2/code_70F20.c | 4 +- src/core2/code_71820.c | 4 +- src/core2/code_77E50.c | 4 +- src/core2/code_82000.c | 14 +-- src/core2/code_83340.c | 4 +- src/core2/code_9E370.c | 18 ++-- src/core2/code_AA60.c | 6 +- src/core2/code_B3A80.c | 66 ++++++------ src/core2/code_B9770.c | 124 ++++++--------------- src/core2/code_C89C0.c | 4 +- src/core2/code_C97F0.c | 2 +- src/core2/code_C9F00.c | 4 +- src/core2/code_D7D10.c | 2 +- src/core2/fxcommon3score.c | 4 +- src/core2/gc/pauseMenu.c | 8 +- src/core2/gc/sky.c | 2 +- src/core2/gc/transition.c | 10 +- src/core2/gc/zoombox.c | 6 +- src/core2/{code_B1400.c => modelRender.c} | 125 +++++++++++----------- src/fight/chbossshadow.c | 4 +- src/fight/chspellbarrier.c | 2 +- src/lair/code_0.c | 2 +- symbol_addrs.us.v10.txt | 2 +- 69 files changed, 296 insertions(+), 326 deletions(-) create mode 100644 include/core2/modelRender.h rename src/core2/{code_B1400.c => modelRender.c} (90%) diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index 6e8757e4..2b703e18 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -794,7 +794,7 @@ segments: - [0x1003BF0, c, code_AE290] #DONE - [0x1003F30, c, code_AE5D0] #DONE - [0x1004700, c, code_AEDA0] - - [0x1006D60, c, code_B1400] + - [0x1006D60, c, modelRender] - [0x1008EE0, c, code_B3580] #DONE - [0x10093E0, c, code_B3A80] #DONE - [0x100A9A0, c, code_B5040] #DONE @@ -1052,7 +1052,7 @@ segments: - [0x103E350, .data, code_AD110] - [0x103EC20, .data, code_AD5B0] - [0x103EC30, .data, code_AEDA0] - - [0x103ED10, .data, code_B1400] + - [0x103ED10, .data, modelRender] - [0x103F3B0, .data, code_B3A80] - [0x103F3F0, .data, code_B5040] - [0x103F490, .data, code_B62B0] @@ -1290,7 +1290,7 @@ segments: - [0x1047890, .rodata, code_AD110] - [0x10478B0, .rodata, code_AE5D0] - [0x10478C0, .rodata, code_AEDA0] - - [0x1047910, .rodata, code_B1400] + - [0x1047910, .rodata, modelRender] - [0x1047920, .rodata, code_B3A80] - [0x1047930, .rodata, string] - [0x1047950, .rodata, code_B6C60] @@ -1570,7 +1570,7 @@ segments: - [0x1048560, .bss, code_AD5B0] - [0x1048560, .bss, code_AE290] - [0x1048560, .bss, code_AEDA0] - - [0x1048560, .bss, code_B1400] + - [0x1048560, .bss, modelRender] - [0x1048560, .bss, code_B3A80] - [0x1048560, .bss, code_B5040] - [0x1048560, .bss, code_B5E00] diff --git a/include/core2/modelRender.h b/include/core2/modelRender.h new file mode 100644 index 00000000..6dc679e4 --- /dev/null +++ b/include/core2/modelRender.h @@ -0,0 +1,24 @@ +#ifndef _MODEL_RENDER_H_ +#define _MODEL_RENDER_H_ + +#include +#include "model.h" + +enum model_render_depth_mode_e{ + MODEL_RENDER_DEPTH_NONE = 0, + MODEL_RENDER_DEPTH_FULL = 1, + MODEL_RENDER_DEPTH_COMPARE = 2 +}; + +BKAnimationList *model_getAnimationList(BKModelBin *arg0); +BKTextureList *model_getTextureList(BKModelBin *arg0); + +void modelRender_reset(void); +BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f32 scale, f32*arg5, BKModelBin* model_bin); + +void modelRender_setDisplayList(BKGfxList *gfx_list); +void modelRender_setTextureList(BKTextureList *textureList); +void modelRender_setVertexList(BKVertexList *vertex_list); +void modelRender_setDepthMode(enum model_render_depth_mode_e renderMode); + +#endif diff --git a/include/functions.h b/include/functions.h index cdc49f59..f75bfd84 100644 --- a/include/functions.h +++ b/include/functions.h @@ -495,7 +495,7 @@ Struct80s *func_803358B4(void); void func_80335924(Struct80s *, enum asset_e anim_id, f32, f32); void func_80335A74(Struct80s *self, f32 arg1); void func_80335A94(Struct80s *, f32, s32); -BKModelBin *func_803391A4(Gfx**, Mtx**, f32 [3], f32[3], f32, f32*, BKModelBin*); +BKModelBin *modelRender_draw(Gfx**, Mtx**, f32 [3], f32[3], f32, f32*, BKModelBin*); void func_8033A280(f32); void func_80346C10(enum bs_e *retVal, enum bs_e fail_state, enum bs_e success_state, enum item_e item_id, int use_item); diff --git a/include/prop.h b/include/prop.h index ed130cdf..2e4d8a7a 100644 --- a/include/prop.h +++ b/include/prop.h @@ -5,6 +5,7 @@ #include "structs.h" #include "core2/animctrl.h" +#include "core2/modelRender.h" typedef struct sprite_prop_s{ u32 unk0_31:0xC; @@ -231,7 +232,7 @@ typedef struct actor_s{ u32 unk124_31:12; u32 alpha_124_19:8; u32 unk124_11:2; //blend_mode? - u32 unk124_9:2; //render_mode (passed to set_model_render_mode()) + u32 depth_mode:2; //render_mode (passed to modelRender_setDepthMode()) u32 unk124_7:1; u32 unk124_6:1; u32 unk124_5:2; diff --git a/src/BGS/ch/mrvile.c b/src/BGS/ch/mrvile.c index ad5c5bcd..cbefe8dc 100644 --- a/src/BGS/ch/mrvile.c +++ b/src/BGS/ch/mrvile.c @@ -3,9 +3,9 @@ #include "variables.h" #include "prop.h" +#include "core2/modelRender.h" void func_80335A24(void *, u32, f32, f32); -void set_model_render_mode(u32); Actor *chvile_draw(ActorMarker*, Gfx **, Mtx **, Vtx **); void chvile_update(Actor *); void func_8038BB40(ActorMarker *); @@ -240,8 +240,8 @@ Actor *chvile_draw(ActorMarker *marker, Gfx **gfx, Mtx** mtx, Vtx **vtx){ ) { func_8034A174(func_80329934(), 5, &sp34); sp34[1] -= 30.0f; - set_model_render_mode(1); - func_803391A4(gfx, mtx, &sp34, 0, local->unk14, 0, local->unk4); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, &sp34, 0, local->unk14, 0, local->unk4); } return this; } diff --git a/src/BGS/ch/yumblie.c b/src/BGS/ch/yumblie.c index 2184b3ef..8fe3d34f 100644 --- a/src/BGS/ch/yumblie.c +++ b/src/BGS/ch/yumblie.c @@ -118,10 +118,10 @@ Actor *chyumblie_draw(ActorMarker *this, Gfx **gfx, Mtx** mtx, Vtx **vtx){ sp38[1] = thisActor->yaw; sp38[2] = thisActor->roll; if(sp40->unk4 && sp40->game_marker){ - func_803391A4(gfx, mtx, sp44, sp38, 1.0f, NULL, chvilegame_get_grumblie_model(sp40->game_marker)); + modelRender_draw(gfx, mtx, sp44, sp38, 1.0f, NULL, chvilegame_get_grumblie_model(sp40->game_marker)); } else{ - func_803391A4(gfx, mtx, sp44, sp38, 1.0f, NULL, func_80330B1C(this)); + modelRender_draw(gfx, mtx, sp44, sp38, 1.0f, NULL, func_80330B1C(this)); } return thisActor; } diff --git a/src/BGS/done/ch/pinkegg.c b/src/BGS/done/ch/pinkegg.c index 551527f9..9155fdf2 100644 --- a/src/BGS/done/ch/pinkegg.c +++ b/src/BGS/done/ch/pinkegg.c @@ -118,7 +118,7 @@ void chpinkegg_update(Actor *this){ if(animctrl_isStopped(this->animctrl)){ func_80326310(this); if(this->alpha_124_19 < 0x60){ - this->unk124_9 = 0x2; + this->depth_mode = 0x2; } } break; diff --git a/src/CC/code_13C0.c b/src/CC/code_13C0.c index 82e398c2..3c09037c 100644 --- a/src/CC/code_13C0.c +++ b/src/CC/code_13C0.c @@ -3,6 +3,8 @@ #include "variables.h" #include "CC.h" +#include "core2/modelRender.h" + typedef struct{ void (*unk0)(s32 arg0); u8 pad4[0x14]; @@ -41,8 +43,8 @@ void func_803877B0(Struct_CC_13C0_1* arg0, void* arg1, f32 position[3], f32 rota arg4 = arg4*(1.0f - arg0->unkC); } func_8033A45C(2, 0); - set_model_render_mode(1); - func_803391A4(gfx, mtx, position, rotation, arg4, NULL, modeL_ptr); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, position, rotation, arg4, NULL, modeL_ptr); } void func_803878AC(Struct_CC_13C0_1 *arg0, Struct68s *arg1, s32 arg2) { diff --git a/src/CC/code_1F70.c b/src/CC/code_1F70.c index 08d2523a..510f3295 100644 --- a/src/CC/code_1F70.c +++ b/src/CC/code_1F70.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/modelRender.h" + extern BKCollisionTri *func_8028EF48(void); extern void func_8030E9FC(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, f32 arg4[3], f32 arg5, f32 arg6); extern void func_8030EA54(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, f32 arg4[3], f32 arg5, f32 arg6); @@ -202,9 +204,9 @@ void CC_func_80388760(Gfx **gfx, Mtx **mtx, Vtx **vtx){ } func_8033A238(s1); func_8033A450(D_80389FA0.unk34); - func_8033A4C0(D_80389FA0.unk40); - set_model_render_mode(1); - func_803391A4(gfx, mtx, D_80389FA0.unk28, NULL, 1.0f, NULL, D_80389FA0.unk24); + modelRender_setVertexList(D_80389FA0.unk40); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, D_80389FA0.unk28, NULL, 1.0f, NULL, D_80389FA0.unk24); if(func_80340020(D_80389FA0.unk18, D_80389FA0.unk28, 0, 1.0f, 0, D_80389FA0.unk40, spA4, spA4)){ func_8028FAB0(spA4); func_802921D4(spA4); diff --git a/src/CCW/code_2270.c b/src/CCW/code_2270.c index cce4ed07..751e1a10 100644 --- a/src/CCW/code_2270.c +++ b/src/CCW/code_2270.c @@ -113,8 +113,8 @@ Actor *func_803889AC(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp2C[2] = this->roll; func_8033A238(func_803356A0(local->unk4, local)); - set_model_render_mode(2); - func_803391A4(gfx, mtx, this->position, sp2C, 1.0f, NULL, local->unk8); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gfx, mtx, this->position, sp2C, 1.0f, NULL, local->unk8); } return func_80325888(marker, gfx, mtx, vtx); } diff --git a/src/CCW/code_7570.c b/src/CCW/code_7570.c index 804388a4..95c431aa 100644 --- a/src/CCW/code_7570.c +++ b/src/CCW/code_7570.c @@ -26,7 +26,7 @@ void func_8038D9E0(Actor *this) { if (!this->unk16C_4) { this->unk16C_4 = TRUE; - this->unk124_9 = 2; + this->depth_mode = 2; this->marker->unk40_22 = TRUE; func_8038D960(this, 1); } diff --git a/src/FP/code_A40.c b/src/FP/code_A40.c index 803260b3..a0f6a071 100644 --- a/src/FP/code_A40.c +++ b/src/FP/code_A40.c @@ -106,7 +106,7 @@ void chXmasTree_update(Actor *this){ } } - this->unk124_9 = 1; + this->depth_mode = 1; if(jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE) || levelSpecificFlags_get(0x29)){ FP_func_80386EF4(this, 1); return; diff --git a/src/GV/code_1570.c b/src/GV/code_1570.c index 3cae2150..50749f69 100644 --- a/src/GV/code_1570.c +++ b/src/GV/code_1570.c @@ -131,12 +131,12 @@ Actor *chgobi2_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp3C[2] = this->roll; func_8033A238(func_803356A0(this->unk148)); func_8033A2D4(func_803253A0, this); - func_803391A4(gfx, mtx, this->position, sp3C, 1.0f, NULL, func_80330B1C(this_marker)); + modelRender_draw(gfx, mtx, this->position, sp3C, 1.0f, NULL, func_80330B1C(this_marker)); if(this->state == 4){ func_8033A238(func_803356A0(local->unk4)); - set_model_render_mode(2); - func_803391A4(gfx, mtx, this->position, sp3C, 1.0f, NULL, local->unk8); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gfx, mtx, this->position, sp3C, 1.0f, NULL, local->unk8); } return this; } diff --git a/src/GV/code_2730.c b/src/GV/code_2730.c index 085b7d73..b9090446 100644 --- a/src/GV/code_2730.c +++ b/src/GV/code_2730.c @@ -73,7 +73,7 @@ Actor *func_80388C64(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp3C[2] = this->roll; func_8033A2D4(func_803253A0, this); func_8033A450(func_80329934()); - func_803391A4(gfx, mtx, this->position, sp3C, 1.0f, NULL,func_80330B1C(this_marker)); + modelRender_draw(gfx, mtx, this->position, sp3C, 1.0f, NULL,func_80330B1C(this_marker)); func_8034A174(func_80329934(), 5, local->unk0); return this; diff --git a/src/GV/code_2B80.c b/src/GV/code_2B80.c index e9368314..0079cb6c 100644 --- a/src/GV/code_2B80.c +++ b/src/GV/code_2B80.c @@ -47,8 +47,8 @@ Actor *func_80389050(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp2C[0] = this->pitch; sp2C[1] = this->yaw + 220.0f; sp2C[2] = this->roll; - set_model_render_mode(2); - func_803391A4(gfx, mtx, sp38, sp2C, 1.0f, NULL, func_8030A428(3)); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gfx, mtx, sp38, sp2C, 1.0f, NULL, func_8030A428(3)); return this; } diff --git a/src/GV/code_2EE0.c b/src/GV/code_2EE0.c index e69486b9..a6dfcd59 100644 --- a/src/GV/code_2EE0.c +++ b/src/GV/code_2EE0.c @@ -30,7 +30,7 @@ Actor *func_803892D0(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ position[2] = this->position_z; position[1] += 8.0f; func_8033A2D4(func_803253A0, this); - func_803391A4(gfx, mtx, position, rotation, this->unk1C[0], NULL, func_80330B1C(this_marker)); + modelRender_draw(gfx, mtx, position, rotation, this->unk1C[0], NULL, func_80330B1C(this_marker)); } return this; } diff --git a/src/MM/ch/juju.c b/src/MM/ch/juju.c index a2f5b13f..8d15963f 100644 --- a/src/MM/ch/juju.c +++ b/src/MM/ch/juju.c @@ -51,8 +51,8 @@ Actor* func_80389014(ActorMarker *this, Gfx **dl, Mtx **mPtr, Vtx **arg2){ actorPtr = func_80325300(this, sp34); jujuPtr = (ActorLocal_Juju_2 *)&actorPtr->local; if(jujuPtr->unk0 != 2){ - set_model_render_mode(1); - func_803391A4(dl, mPtr, actorPtr->position, sp34, jujuPtr->unk14, NULL, func_80330B1C(this)); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(dl, mPtr, actorPtr->position, sp34, jujuPtr->unk14, NULL, func_80330B1C(this)); } return actorPtr; } diff --git a/src/MM/ch/orange.c b/src/MM/ch/orange.c index 29209852..a10db8ad 100644 --- a/src/MM/ch/orange.c +++ b/src/MM/ch/orange.c @@ -86,8 +86,8 @@ Actor *func_80388188(ActorMarker *this, Gfx **dl, Mtx **mptr, Vtx **vtx){ sp48[1] = actorPtr->unk1C_y + 3.0f; sp48[2] = actorPtr->position_z; func_8033A410( (s32) MIN(255.0f, actorPtr->unk60) ); - set_model_render_mode(1); - func_803391A4(dl, mptr, sp48, sp54, actorPtr->unk28, sp60, func_8030A428(0x18)); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(dl, mptr, sp48, sp54, actorPtr->unk28, sp60, func_8030A428(0x18)); actorPtr->position_y -= 1.9; if(actorPtr->unk28 < 2.428){ actorPtr->unk28 += 0.1; diff --git a/src/MMM/ch/motzhand.c b/src/MMM/ch/motzhand.c index 49b02517..7ae4304f 100644 --- a/src/MMM/ch/motzhand.c +++ b/src/MMM/ch/motzhand.c @@ -77,8 +77,8 @@ Actor *chMotzhand_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp3C[0] = sp3C[1] = sp3C[2] = 0.0f; sp3C[1] = 180.0f; - set_model_render_mode(1); - func_803391A4(gfx, mtx, this->position, sp3C, 1.0f, NULL, func_80330B1C(marker)); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, this->position, sp3C, 1.0f, NULL, func_80330B1C(marker)); this->marker->unk14_21 = func_8033A170(); return this; } diff --git a/src/MMM/code_47D0.c b/src/MMM/code_47D0.c index e98d43eb..4c85ec83 100644 --- a/src/MMM/code_47D0.c +++ b/src/MMM/code_47D0.c @@ -36,8 +36,8 @@ void func_8038AC40(Struct_MMM_47D0_0 *arg0, struct struct_68_s *arg1, f32 positi } else if (arg0->unk4 == 2) { func_8033A410((s32)((1 - ((f64)arg0->unk8 * 1)) * 255.0), arg0); } - set_model_render_mode(1); - func_803391A4(gfx, mtx, position, rotation, scale, NULL, model_bin); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, position, rotation, scale, NULL, model_bin); } } diff --git a/src/MMM/code_5000.c b/src/MMM/code_5000.c index 3ab478ca..338355b5 100644 --- a/src/MMM/code_5000.c +++ b/src/MMM/code_5000.c @@ -41,8 +41,8 @@ void func_8038B3F0(Struct5Fs *arg0, struct struct_68_s *arg1, f32 position[3], f sp30[3] = 0xFF; func_8033A334(sp30, __mmm_5000_blue); } - set_model_render_mode(1); - func_803391A4(gfx, mtx, position, rotation, scale, NULL, model_bin); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, position, rotation, scale, NULL, model_bin); } void func_8038B590(Struct5Fs *arg0, Struct68s *arg1){ diff --git a/src/RBB/code_3CB0.c b/src/RBB/code_3CB0.c index ba7716eb..c1c0b209 100644 --- a/src/RBB/code_3CB0.c +++ b/src/RBB/code_3CB0.c @@ -79,10 +79,10 @@ Actor *func_8038A224(ActorMarker *marker, Gfx **gdl, Mtx **mptr, s32 arg3){ func_8033A2D4(func_803253A0, actor); if(local->unk4){ - func_803391A4(gdl, mptr, &actor->position, NULL, 1.0f, NULL, local->unk4); + modelRender_draw(gdl, mptr, &actor->position, NULL, 1.0f, NULL, local->unk4); } else{ - func_803391A4(gdl, mptr, &actor->position, NULL, 1.0f, NULL, func_80330B1C(marker)); + modelRender_draw(gdl, mptr, &actor->position, NULL, 1.0f, NULL, func_80330B1C(marker)); } return actor; } diff --git a/src/RBB/code_47D0.c b/src/RBB/code_47D0.c index 7261ca34..3102d5fe 100644 --- a/src/RBB/code_47D0.c +++ b/src/RBB/code_47D0.c @@ -119,7 +119,7 @@ Actor *func_8038AD9C(ActorMarker *marker, Gfx **gdl, Mtx **mptr, s32 arg3){ (local->unk4->unk4[1] - actor->position_y)/30.0, func_8033A148(temp_v0) ); - func_8033A4C0(local->unkC); + modelRender_setVertexList(local->unkC); } return func_80325888(marker, gdl, mptr, arg3); } diff --git a/src/RBB/code_4C70.c b/src/RBB/code_4C70.c index 046752ba..e8a465ce 100644 --- a/src/RBB/code_4C70.c +++ b/src/RBB/code_4C70.c @@ -113,7 +113,7 @@ Actor *func_8038B230(ActorMarker *marker, Gfx** gdl, Mtx** mptr, s32 arg3){ sp3C[2] = actor->roll; func_8033A2D4(&func_803253A0, actor); func_8033A450(func_80329934()); - func_803391A4(gdl, mptr, &actor->position, &sp3C, actor->scale, NULL, func_80330B1C(marker)); + modelRender_draw(gdl, mptr, &actor->position, &sp3C, actor->scale, NULL, func_80330B1C(marker)); func_8034A174(func_80329934(), 5, &local->unk4); local->unk4[0] -= 60.0f; return actor; diff --git a/src/RBB/code_5F80.c b/src/RBB/code_5F80.c index 8447cf52..9d19914d 100644 --- a/src/RBB/code_5F80.c +++ b/src/RBB/code_5F80.c @@ -467,7 +467,7 @@ Actor *func_8038D638(ActorMarker *marker, Gfx **gdl, Mtx ** mptr, s32 arg3){ } func_8033A2D4(func_803253A0, actor); func_8033A2E8(func_80325794, marker); - func_803391A4(gdl, mptr, &actor->position, &sp3C, actor->scale, NULL, func_80330B1C(marker)); + modelRender_draw(gdl, mptr, &actor->position, &sp3C, actor->scale, NULL, func_80330B1C(marker)); return actor; } diff --git a/src/RBB/code_640.c b/src/RBB/code_640.c index b367cf01..a98902c0 100644 --- a/src/RBB/code_640.c +++ b/src/RBB/code_640.c @@ -138,7 +138,7 @@ void func_80386A7C(Actor *this){ s32 temp_v0; func_802D3D74(this); - this->unk124_9 = 1; + this->depth_mode = 1; func_8024C5CC(&sp2C); sp28 = func_80386A30(&this->position); temp_v0 = func_80386A30(&sp2C); diff --git a/src/TTC/code_35D0.c b/src/TTC/code_35D0.c index d4b2f1fb..e6972a23 100644 --- a/src/TTC/code_35D0.c +++ b/src/TTC/code_35D0.c @@ -209,7 +209,7 @@ void TTC_func_80389E90(Actor *this){ break; }//L8038A094 actor_setOpacity(this, (s32)this->unk60); - this->unk124_9 = 2; + this->depth_mode = 2; } Actor *func_8038A0D0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ @@ -240,6 +240,6 @@ Actor *func_8038A0D0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ func_8032AA58(actor, sp3C); func_8033A2D4(func_803253A0, actor); - func_803391A4(gfx, mtx, sp40, sp4C, sp3C, NULL, func_80330B1C(marker)); + modelRender_draw(gfx, mtx, sp40, sp4C, sp3C, NULL, func_80330B1C(marker)); return actor; } diff --git a/src/core2/bs/croc.c b/src/core2/bs/croc.c index 01402e9b..8e3a33ba 100644 --- a/src/core2/bs/croc.c +++ b/src/core2/bs/croc.c @@ -600,8 +600,8 @@ void func_802AD2A8(Gfx **gdl, Mtx **mPtr, void *arg2){ player_getRotation(&sp34); func_8028E9C4(2, &sp28); - set_model_render_mode(1); - func_803391A4(gdl, mPtr, &sp28, &sp34, D_8037D3F0, NULL, D_8037D3E8); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gdl, mPtr, &sp28, &sp34, D_8037D3F0, NULL, D_8037D3E8); } diff --git a/src/core2/ch/badShad.c b/src/core2/ch/badShad.c index 1b9c6542..e1dfd8d0 100644 --- a/src/core2/ch/badShad.c +++ b/src/core2/ch/badShad.c @@ -50,8 +50,8 @@ Actor *func_802D6F48(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ if(other) func_8033A410(other->alpha_124_19); sp40 = ml_map_f(this->unk28, 0.0f , 800.0f, 0.53f, 0.18f)*this->unk1C[1]; - set_model_render_mode(2); - func_803391A4(gfx, mtx, this->position, sp44, sp40, NULL, func_80330B1C(marker)); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gfx, mtx, this->position, sp44, sp40, NULL, func_80330B1C(marker)); return this; } diff --git a/src/core2/code_41460.c b/src/core2/code_41460.c index 2ac6e740..19963621 100644 --- a/src/core2/code_41460.c +++ b/src/core2/code_41460.c @@ -79,8 +79,8 @@ Actor *func_802C8484(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { phi_s4 = FALSE; for(phi_s0 = temp_s1->begin; phi_s0 < temp_s1->current; phi_s0++){ if ((phi_s0->unk0 != 0) && (phi_s0->model_bin != NULL)) { - set_model_render_mode(1); - func_803391A4(gfx, mtx, phi_s0->unk8, phi_s0->unk14, phi_s0->unk2C / 10.0f, NULL, phi_s0->model_bin); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, phi_s0->unk8, phi_s0->unk14, phi_s0->unk2C / 10.0f, NULL, phi_s0->model_bin); phi_s4 = TRUE; } } diff --git a/src/core2/code_43800.c b/src/core2/code_43800.c index 5f0cd8f0..d34fda66 100644 --- a/src/core2/code_43800.c +++ b/src/core2/code_43800.c @@ -18,7 +18,7 @@ ActorInfo D_80366EF0 = { /* .code */ void func_802CA790(Actor *this){ func_8033A410(0xff); - set_model_render_mode(2); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); } Actor *func_802CA7BC(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ @@ -53,7 +53,7 @@ Actor *func_802CA7BC(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp48[2] = this->roll; sp44 = ml_map_f(sp54[1] - sp40, 0.0f, 300.0f, 0.43f, 0.28f); func_8033A2D4(func_802CA790, this); - func_803391A4(gfx, mtx, this->position, sp48, sp44, NULL, func_80330B1C(marker)); + modelRender_draw(gfx, mtx, this->position, sp48, sp44, NULL, func_80330B1C(marker)); return this; } diff --git a/src/core2/code_440B0.c b/src/core2/code_440B0.c index 70d2cab1..5dc3d1e3 100644 --- a/src/core2/code_440B0.c +++ b/src/core2/code_440B0.c @@ -189,7 +189,7 @@ void func_802CB7C0(ActorMarker *marker, ActorMarker *other){ if( map_get() == MAP_B_CC_CLANKERS_CAVERN && func_80259254(this->position, 13778.0f, 0.0f, 3000.0f) ) { - this->unk124_9 = 2; + this->depth_mode = MODEL_RENDER_DEPTH_COMPARE; if( !jiggyscore_isCollected(JIGGY_16_CC_SNIPPETS) && ((func_80326D68(this->position, 0xF5, -1, &sp44) == NULL) || (3000.0f < sp44))) { sp48[0] = 13814.0f; diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index 773f7f35..b607b329 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -97,15 +97,15 @@ Actor *chBeeSwarm_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp8C[1] = this->position[1] + phi_s0->unk0[1]; sp8C[2] = this->position[2] + phi_s0->unk0[2]; - set_model_render_mode(2); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); func_8033A410(0xFF); - func_803391A4(gfx, mtx, sp8C, sp80, 0.25f, NULL, phi_fp); + modelRender_draw(gfx, mtx, sp8C, sp80, 0.25f, NULL, phi_fp); local->unk5 |= func_8033A170(); if(phi_s2 < 10){ sp8C[1] = local->unk18 + 6.0f; func_8033A410(0xC0); - set_model_render_mode(2); - func_803391A4(gfx, mtx, sp8C, sp80, 0.1f, NULL, local->unk20); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gfx, mtx, sp8C, sp80, 0.1f, NULL, local->unk20); local->unk5 |= func_8033A170(); } phi_s0++; diff --git a/src/core2/code_55390.c b/src/core2/code_55390.c index a920742f..b70b7824 100644 --- a/src/core2/code_55390.c +++ b/src/core2/code_55390.c @@ -48,7 +48,7 @@ Actor *func_802DC320(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp34[0] = 0.0f; sp34[1] = 137.5f; sp34[2] = 0.0f; - func_803391A4(gfx, mtx, sp40, NULL, 1.0f, sp34, func_80330B1C(marker)); + modelRender_draw(gfx, mtx, sp40, NULL, 1.0f, sp34, func_80330B1C(marker)); func_8024E2FC(); func_8024C904(gfx, mtx); return this; @@ -64,7 +64,7 @@ void func_802DC45C(Actor *this){ if(!this->initialized){ this->initialized = TRUE; - this->unk124_9 = 0; + this->depth_mode = MODEL_RENDER_DEPTH_NONE; func_803262E4(this); actor_collisionOff(this); func_803300D8(this->marker, func_802DC430); diff --git a/src/core2/code_556C0.c b/src/core2/code_556C0.c index 7c3dfce7..c9cb150b 100644 --- a/src/core2/code_556C0.c +++ b/src/core2/code_556C0.c @@ -27,7 +27,7 @@ void func_802DC67C(Actor *this){ if(!this->initialized){ this->initialized = TRUE; - this->unk124_9 = 0; + this->depth_mode = MODEL_RENDER_DEPTH_NONE; func_803262E4(this); actor_collisionOff(this); func_803300D8(this->marker, func_802DC650); diff --git a/src/core2/code_55850.c b/src/core2/code_55850.c index 0a6fe717..29cf87f0 100644 --- a/src/core2/code_55850.c +++ b/src/core2/code_55850.c @@ -47,7 +47,7 @@ Actor *func_802DC7E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp34[0] = 0.0f; sp34[1] = -87.0f; sp34[2] = 0.0f; - func_803391A4(gfx, mtx, sp40, NULL, 1.0f, sp34, func_80330B1C(marker)); + modelRender_draw(gfx, mtx, sp40, NULL, 1.0f, sp34, func_80330B1C(marker)); func_8024E2FC(); func_8024C904(gfx, mtx); return this; @@ -60,7 +60,7 @@ void func_802DC8F0(Actor *this){ void func_802DC900(Actor *this){ if(!this->initialized){ this->initialized = TRUE; - this->unk124_9 = 0; + this->depth_mode = MODEL_RENDER_DEPTH_NONE; actor_collisionOff(this); func_803300D8(this->marker, func_802DC8F0); } diff --git a/src/core2/code_55A90.c b/src/core2/code_55A90.c index 8dcb0a6e..a30bb2c4 100644 --- a/src/core2/code_55A90.c +++ b/src/core2/code_55A90.c @@ -24,7 +24,7 @@ void func_802DCA20(Actor *this){ void func_802DCA30(Actor *this){ if(!this->initialized){ this->initialized = TRUE; - this->unk124_9 = 0; + this->depth_mode = MODEL_RENDER_DEPTH_NONE; actor_collisionOff(this); func_803300D8(this->marker, func_802DCA20); } diff --git a/src/core2/code_55BC0.c b/src/core2/code_55BC0.c index 4584a1fa..7fe82771 100644 --- a/src/core2/code_55BC0.c +++ b/src/core2/code_55BC0.c @@ -56,7 +56,7 @@ Actor *func_802DCB50(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **vptr){ func_8024C904(gdl, mptr); {sp40[0] = 0.0f; sp40[1] = 0.0f; sp40[2] = 0.0f;}; {sp34[0] = 0.0f; sp34[1] = 400.0f; sp34[2] = 0.0f;}; - func_803391A4(gdl, mptr, sp40, 0, 1.0f, sp34, func_80330B1C(marker)); + modelRender_draw(gdl, mptr, sp40, 0, 1.0f, sp34, func_80330B1C(marker)); func_8024E2FC(); func_8024C904(gdl, mptr); return actor; @@ -70,7 +70,7 @@ void func_802DCC78(ActorMarker *this){ void func_802DCC90(Actor *this){ if(!this->initialized){ this->initialized = 1; - this->unk124_9 = 0; + this->depth_mode = MODEL_RENDER_DEPTH_NONE; actor_collisionOff(this); func_80328B8C(this, 1, 0.0f, 1); actor_playAnimationOnce(this); diff --git a/src/core2/code_55E70.c b/src/core2/code_55E70.c index abb25711..c421f515 100644 --- a/src/core2/code_55E70.c +++ b/src/core2/code_55E70.c @@ -46,7 +46,7 @@ Actor *func_802DCE00(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **vptr){ func_8024C904(gdl, mptr); {sp40[0] = 0.0f; sp40[1] = 0.0f; sp40[2] = 0.0f;}; {sp34[0] = 0.0f; sp34[1] = 165.0f; sp34[2] = 0.0f;}; - func_803391A4(gdl, mptr, sp40, 0, 1.0f, sp34, func_80330B1C(marker)); + modelRender_draw(gdl, mptr, sp40, 0, 1.0f, sp34, func_80330B1C(marker)); func_8024E2FC(); func_8024C904(gdl, mptr); return actor; @@ -59,7 +59,7 @@ void func_802DCF10(Actor *this){ void func_802DCF20(Actor *this) { if (!this->initialized) { this->initialized = TRUE; - this->unk124_9 = 0; + this->depth_mode = MODEL_RENDER_DEPTH_NONE; actor_collisionOff(this); func_80328B8C(this, 1, 0.0f, 1); actor_playAnimationOnce(this); diff --git a/src/core2/code_560F0.c b/src/core2/code_560F0.c index deed1901..8b96168e 100644 --- a/src/core2/code_560F0.c +++ b/src/core2/code_560F0.c @@ -9,7 +9,7 @@ extern f32 *func_802E05AC(s32); extern f32 func_802E4B38(void); extern void func_8033A8F0(s32, s32, f32[4]); extern f32 func_8033DDB8(void); -BKAnimationList *func_8033A0D4(BKModelBin *arg0); +BKAnimationList *model_getAnimationList(BKModelBin *arg0); extern void func_8034BB08(s32); extern void func_803458E4(f32[4], f32[4], f32[4], f32); @@ -160,9 +160,9 @@ Actor *func_802DD188(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { func_802DD080(gfx, mtx); {sp60[0] = 0.0f; sp60[1] = 0.0f; sp60[2] = 0.0f;}; {sp54[0] = 0.0f; sp54[1] = 0.0f; sp54[2] = 0.0f;}; - set_model_render_mode(1); - func_803391A4(gfx, mtx, sp60, NULL, 1.0f, sp54, D_8037DEA4); - func_803391A4(gfx, mtx, sp60, NULL, 1.0f, sp54, D_8037DEA8); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, sp60, NULL, 1.0f, sp54, D_8037DEA4); + modelRender_draw(gfx, mtx, sp60, NULL, 1.0f, sp54, D_8037DEA8); gDPSetTextureFilter((*gfx)++, G_TF_POINT); gDPSetColorDither((*gfx)++, G_CD_DISABLE); @@ -174,7 +174,7 @@ Actor *func_802DD188(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { func_8033A2D4(func_803253A0, sp6C); func_8033A2E8(func_80325794, marker); - func_803391A4(gfx, mtx, sp60, NULL, D_80368250, sp54, func_80330B1C(marker)); + modelRender_draw(gfx, mtx, sp60, NULL, D_80368250, sp54, func_80330B1C(marker)); gDPSetTextureFilter((*gfx)++, G_TF_BILERP); gDPSetColorDither((*gfx)++, G_CD_MAGICSQ); func_802DF71C(gfx, mtx, vtx); @@ -222,7 +222,7 @@ f32 *func_802DD584(s32 arg0){ // temp_f0 = D_80376F48; sizeof(BKAnimationList); - temp_v1 = (BKAnimation*)(func_8033A0D4(func_80330B1C(D_8037DEA0)) + 1); + temp_v1 = (BKAnimation*)(model_getAnimationList(func_80330B1C(D_8037DEA0)) + 1); D_8037DF70[0] = temp_v1[5 + arg0].unk0[0] * 0.01; D_8037DF70[1] = temp_v1[5 + arg0].unk0[1] * 0.01; D_8037DF70[2] = temp_v1[5 + arg0].unk0[2] * 0.01; diff --git a/src/core2/code_57C70.c b/src/core2/code_57C70.c index d4ef840b..d40aae33 100644 --- a/src/core2/code_57C70.c +++ b/src/core2/code_57C70.c @@ -60,14 +60,14 @@ Actor *func_802DEC00(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ D_8037DFF0[0] = 0.0f; D_8037DFF0[1] = 270.0f; D_8037DFF0[2] = 0.0f; - set_model_render_mode(1); - func_803391A4(gfx, mtx, sp58, NULL, 1.0f, sp4C, D_8037DFE8); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, sp58, NULL, 1.0f, sp4C, D_8037DFE8); gDPSetColorDither((*gfx)++, G_CD_DISABLE); func_80253190(gfx); gSPSegment((*gfx)++, 0x04, osVirtualToPhysical(sp48)); func_8033A2D4(func_803253A0, this); func_8033A2E8(func_80325794, marker); - func_803391A4(gfx, mtx, this->position, NULL, 4.5f, &sp4C, func_80330B1C(marker)); + modelRender_draw(gfx, mtx, this->position, NULL, 4.5f, &sp4C, func_80330B1C(marker)); gDPSetTextureFilter((*gfx)++, G_TF_BILERP); gDPSetColorDither((*gfx)++, G_CD_MAGICSQ); func_802DD158(gfx, mtx); diff --git a/src/core2/code_581D0.c b/src/core2/code_581D0.c index fabe2e62..06a99cf3 100644 --- a/src/core2/code_581D0.c +++ b/src/core2/code_581D0.c @@ -28,12 +28,12 @@ Actor *func_802DF160(Gfx **gfx, Mtx **mtx, Vtx **vtx) { this = marker_getActor(D_8037E000); sp38 = func_8030C704(); - set_model_render_mode(1); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); gDPSetTextureFilter((*gfx)++, G_TF_POINT); gSPSegment((*gfx)++, 0x04, osVirtualToPhysical(sp38)); func_8033A2D4(func_803253A0, this); func_8033A2E8(func_80325794, D_8037E000); - func_803391A4(gfx, mtx, &D_80368360, NULL, 1.0f, NULL, func_80330B1C(D_8037E000)); + modelRender_draw(gfx, mtx, &D_80368360, NULL, 1.0f, NULL, func_80330B1C(D_8037E000)); gDPSetTextureFilter((*gfx)++, G_TF_BILERP); return this; } diff --git a/src/core2/code_584D0.c b/src/core2/code_584D0.c index 337de573..78682516 100644 --- a/src/core2/code_584D0.c +++ b/src/core2/code_584D0.c @@ -148,7 +148,7 @@ void func_802DF71C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { this = func_80325300(D_8037E060, &sp44); func_8033A2D4(func_803253A0, this); func_8033A2E8(func_80325794, D_8037E060); - set_model_render_mode(1); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); actor_setOpacity(this, 0xB9); func_8024E030(this->position, D_8037E5C0.unk18); sp3C = (this->scale * 650.0f); @@ -157,7 +157,7 @@ void func_802DF71C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { (s32)sp3C, (s32)sp3C, D_803A5D00[func_8024BDA0()] ); - func_803391A4(gfx, mtx, this->position, sp44, this->scale, NULL, func_80330B1C(D_8037E060)); + modelRender_draw(gfx, mtx, this->position, sp44, this->scale, NULL, func_80330B1C(D_8037E060)); func_8024E030(this->position, D_8037E5C0.unk10); if (this->state == 1) { D_8037E5C0.unk10[0] -= 24.0f; diff --git a/src/core2/code_59780.c b/src/core2/code_59780.c index 1be91b7f..6e5ef811 100644 --- a/src/core2/code_59780.c +++ b/src/core2/code_59780.c @@ -91,7 +91,7 @@ Actor *func_802E0738(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ this = func_80325300(marker, &sp34); func_8033A2D4(func_802E0710, this); func_8033A2E8(func_80325794, marker); - func_803391A4(gfx, mtx, this->position, &sp34, this->scale, NULL, func_80330B1C(marker)); + modelRender_draw(gfx, mtx, this->position, &sp34, this->scale, NULL, func_80330B1C(marker)); return this; } diff --git a/src/core2/code_59D40.c b/src/core2/code_59D40.c index a7e496ee..e1d43b39 100644 --- a/src/core2/code_59D40.c +++ b/src/core2/code_59D40.c @@ -289,7 +289,7 @@ void func_802E1168(Actor *this) { } actor_setOpacity(this, local->unk4); - this->unk124_9 = (255.0 == local->unk4) ? 1 : 2; + this->depth_mode = (255.0 == local->unk4) ? MODEL_RENDER_DEPTH_FULL : MODEL_RENDER_DEPTH_COMPARE; } extern f32 D_8037E624; diff --git a/src/core2/code_679A0.c b/src/core2/code_679A0.c index cc264be9..a40b12a4 100644 --- a/src/core2/code_679A0.c +++ b/src/core2/code_679A0.c @@ -165,8 +165,8 @@ void func_802EEE3C(ParticleEmitter *this, Gfx **gfx, Mtx **mtx, Vtx **vtx, u32 a func_8033A410((s32) (iPtr->unkC*this->unk49)); }//L802EEF5C // tmp_a3 = (this->unk18 & 0x10)?0:1; - set_model_render_mode((this->unk18 & 0x10)?0:1); - func_803391A4(gfx, mtx, sp8C, iPtr->unk24, iPtr->size_30, NULL, this->model_20); + modelRender_setDepthMode((this->unk18 & 0x10)?0:1); + modelRender_draw(gfx, mtx, sp8C, iPtr->unk24, iPtr->size_30, NULL, this->model_20); } return; } diff --git a/src/core2/code_70F20.c b/src/core2/code_70F20.c index 21afef4a..bd46cad8 100644 --- a/src/core2/code_70F20.c +++ b/src/core2/code_70F20.c @@ -66,8 +66,8 @@ void func_802F8110(struct3s *this, Gfx **gdl, Mtx **mptr, u32 arg3){ startPtr = vector_getBegin(this->unk20); endPtr = vector_getEnd(this->unk20); for(iPtr = startPtr; iPtr < endPtr; iPtr++){ - set_model_render_mode(2); - func_803391A4(gdl, mptr, iPtr, 0, 1.0f, 0, this->unk2C); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gdl, mptr, iPtr, 0, 1.0f, 0, this->unk2C); iPtr->unk18 = func_8033A170(); } } diff --git a/src/core2/code_71820.c b/src/core2/code_71820.c index d0eb570a..1e217a91 100644 --- a/src/core2/code_71820.c +++ b/src/core2/code_71820.c @@ -77,8 +77,8 @@ void func_802F8A90(struct6s *this, Gfx **gdl, Mtx **mptr, Vtx **vptr){ struct5s * iPtr; struct5s * endPtr = vector_getEnd(this->unk1C); for(iPtr = startPtr; iPtr < endPtr; iPtr++){ - set_model_render_mode(2); - func_803391A4(gdl, mptr, iPtr->unk4, iPtr->unk1C, 1.0f, NULL, iPtr->unk0); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gdl, mptr, iPtr->unk4, iPtr->unk1C, 1.0f, NULL, iPtr->unk0); iPtr->unk34 = func_8033A170(); } } diff --git a/src/core2/code_77E50.c b/src/core2/code_77E50.c index 2ad8e633..f1fc3e63 100644 --- a/src/core2/code_77E50.c +++ b/src/core2/code_77E50.c @@ -19,12 +19,12 @@ void func_802FEDE0(BKTextureList *texture_list, s32 indx, s32 x_offset, s32 y_of }; } -//framebuffer_to_texture_list +//framebuffer_to_model_texture void func_802FEF48(BKModelBin *model_bin){ BKTextureList *texture_list; s32 x, y; - texture_list = func_8033A104(model_bin); + texture_list = model_getTextureList(model_bin); osInvalDCache((void *)D_803A5D00[func_8024BDA0()], framebuffer_width * framebuffer_height*2); for(y = 0; y < 8; y++){//L802FEFEC diff --git a/src/core2/code_82000.c b/src/core2/code_82000.c index 1524e88b..f9f9c031 100644 --- a/src/core2/code_82000.c +++ b/src/core2/code_82000.c @@ -2,12 +2,13 @@ #include "functions.h" #include "variables.h" +#include "core2/modelRender.h" + extern UNK_TYPE(s32) func_802E8E88(BKCollisionList *, BKVertexList *, f32[3], f32[3], f32, f32[3], s32, s32); extern UNK_TYPE(s32) func_802E92AC(BKCollisionList *, BKVertexList *, f32[3], f32, f32[3], s32); extern UNK_TYPE(s32) func_802EC394(BKMeshList *, UNK_TYPE(s32), UNK_TYPE(s32), f32, UNK_TYPE(s32), UNK_TYPE(s32), UNK_TYPE(s32)); extern void func_802EC458(BKVertexList *, s32[3], s32[3]); extern void func_8033A494(s32); -extern void set_model_render_mode(s32); extern void func_8033A388(s32, s32, s32, s32); extern void func_802F7BC0(Gfx **, Mtx **, Vtx **); extern void func_8033A450(s32); @@ -209,7 +210,7 @@ f32 func_80308FDC(f32 arg0[3], u32 arg1) { sp58[1] = arg0[1]; sp58[2] = arg0[2]; sp58[1] -= 2000.0f; - if (func_80309B48(&sp64, &sp58, &sp70, arg1)) { + if (func_80309B48(sp64, sp58, sp70, arg1)) { return sp58[1]; } phi_s2 = 150; @@ -339,19 +340,20 @@ void func_803091D4(Gfx **gfx, Mtx **mtx, Vtx **vtx) { break; } func_8033A450(D_80382350.unk24); - set_model_render_mode(1); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); temp_a0 = D_80382350.unk0; if (temp_a0 != 0) { func_8033A494(temp_a0); } func_8033A388(D_80382350.unk2C, D_80382350.unk2D, D_80382350.unk2E, 0xFF); - func_803391A4(gfx, mtx, NULL, NULL, D_80382350.unk28->unk14, NULL, D_80382350.unk18); + modelRender_draw(gfx, mtx, NULL, NULL, D_80382350.unk28->unk14, NULL, D_80382350.unk18); if (!func_80309F78()) { func_802F7BC0(gfx, mtx, vtx); } } } +//levelRender_model2_draw void func_80309628(Gfx **gfx, Mtx **mtx, Vtx **vtx) { s32 temp_a0; @@ -359,13 +361,13 @@ void func_80309628(Gfx **gfx, Mtx **mtx, Vtx **vtx) { if (map_get() == MAP_1D_MMM_CELLAR) { func_8033A45C(1, (func_80326EEC(0x191) != NULL) ? 0 : 1); } - set_model_render_mode(2); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); temp_a0 = D_80382350.unk4; if (temp_a0 != 0) { func_8033A494(temp_a0); } func_8033A388(D_80382350.unk2C, D_80382350.unk2D, D_80382350.unk2E, 0xFF); - func_803391A4(gfx, mtx, NULL, NULL, D_80382350.unk28->unk14, NULL, D_80382350.unk1C); + modelRender_draw(gfx, mtx, NULL, NULL, D_80382350.unk28->unk14, NULL, D_80382350.unk1C); func_802F7BC0(gfx, mtx, vtx); } } diff --git a/src/core2/code_83340.c b/src/core2/code_83340.c index 26a6b2f1..aed07f7c 100644 --- a/src/core2/code_83340.c +++ b/src/core2/code_83340.c @@ -38,9 +38,9 @@ void func_8030A2D0(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3 sp2C = func_8030A428(arg6); func_8033A244(3700.0f); func_8033A28C(1); - set_model_render_mode(1); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); func_8033A1FC(); - func_803391A4(gfx, mtx, arg3, arg4, arg5, NULL, sp2C); + modelRender_draw(gfx, mtx, arg3, arg4, arg5, NULL, sp2C); } void func_8030A350(Gfx **gfx, Mtx **mtx, Vtx **Vtx, f32 arg3[3], f32 arg4, s32 arg5, Cube *arg6, s32 arg7, s32 arg8, s32 arg9, s32 argA, s32 argB) { diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index e4e9af50..ffc7f7fe 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -102,11 +102,11 @@ void func_803253A0(Actor *this){ if(this->marker->unk20 != NULL){ sp44 = FALSE; if(this->unk148 != NULL){ - func_802EA1A8(&this->marker->unk20, func_8033A0D4(sp48), func_803356A0(this->unk148)); + func_802EA1A8(&this->marker->unk20, model_getAnimationList(sp48), func_803356A0(this->unk148)); sp44 = TRUE; }//L8032542C - else if(this->animctrl != NULL && func_8033A0D4(sp48)){ - anim_802897D4(&this->marker->unk20, func_8033A0D4(sp48), animctrl_getAnimPtr(this->animctrl)); + else if(this->animctrl != NULL && model_getAnimationList(sp48)){ + anim_802897D4(&this->marker->unk20, model_getAnimationList(sp48), animctrl_getAnimPtr(this->animctrl)); sp44 = TRUE; }//L80325474 @@ -119,7 +119,7 @@ void func_803253A0(Actor *this){ func_8033A410(this->alpha_124_19); } - set_model_render_mode(this->unk124_9); + modelRender_setDepthMode(this->depth_mode); if(this->marker->unk44 != 0){ if((s32)this->marker->unk44 == 1){ func_8033A450(D_8036E568); @@ -137,7 +137,7 @@ void func_803253A0(Actor *this){ sp34[2] = this->roll; func_80333D48(sp40, this->position, sp34, this->scale, 0, func_8033A148(sp48)); }//L80325560 - func_8033A4C0(sp40); + modelRender_setVertexList(sp40); this->unkF4_29 = NOT(this->unkF4_29); }//L80325594 @@ -221,7 +221,7 @@ Actor *func_80325888(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { this = func_80325300(marker, sp3C); func_8033A2D4(func_803253A0, this); func_8033A2E8(func_80325794, marker); - func_803391A4(gfx, mtx, this->position, sp3C, this->scale, (this->unk104 != NULL) ? D_8036E580 : NULL, func_803257B4(marker)); + modelRender_draw(gfx, mtx, this->position, sp3C, this->scale, (this->unk104 != NULL) ? D_8036E580 : NULL, func_803257B4(marker)); return this; } @@ -340,10 +340,10 @@ Actor *func_80325E78(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { Actor *this; this = func_80325300(marker, rotation); - set_model_render_mode(1); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); func_8033A2D4(func_803253A0, this); func_8033A2E8(func_80325794, marker); - func_803391A4(gfx, mtx, this->position, rotation, this->scale, (this->unk104 != NULL) ? D_8036E580 : NULL, func_803257B4(marker)); + modelRender_draw(gfx, mtx, this->position, rotation, this->scale, (this->unk104 != NULL) ? D_8036E580 : NULL, func_803257B4(marker)); return this; } @@ -902,7 +902,7 @@ Actor *actor_new(s32 (* position)[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ }//L80327BA8 D_80383390->unk124_11 = 0; D_80383390->alpha_124_19 = 0xff; - D_80383390->unk124_9 = 1; + D_80383390->depth_mode = MODEL_RENDER_DEPTH_FULL; D_80383390->unk124_0 = D_80383390->unk138_31 = 1; for(i = 0; i < 0x10; i++){ ((s32 *)D_80383390->unk7C)[i] = 0; diff --git a/src/core2/code_AA60.c b/src/core2/code_AA60.c index c8ef1ace..9eae2972 100644 --- a/src/core2/code_AA60.c +++ b/src/core2/code_AA60.c @@ -106,13 +106,13 @@ void func_80291AF0(Gfx **gfx, Mtx **mtx, Vtx **vtx){ func_8033A280(2.0f); func_8033A2D4(func_80291AC4, 0); func_8033A450(D_80363780); - set_model_render_mode(1); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); if(D_8037C150.unk0){ D_8037C150.unk0 = 0; - func_803391A4(gfx, mtx, D_8037C150.unk4, sp5C, D_8037C0EC, sp38, D_8037C0E0); + modelRender_draw(gfx, mtx, D_8037C150.unk4, sp5C, D_8037C0EC, sp38, D_8037C0E0); } else{ - func_803391A4(gfx, mtx, plyr_pos, sp5C, D_8037C0EC, sp38, D_8037C0E0); + modelRender_draw(gfx, mtx, plyr_pos, sp5C, D_8037C0EC, sp38, D_8037C0E0); } }//L80291CD4 diff --git a/src/core2/code_B3A80.c b/src/core2/code_B3A80.c index c7d43d78..fb03b57f 100644 --- a/src/core2/code_B3A80.c +++ b/src/core2/code_B3A80.c @@ -98,55 +98,55 @@ s32 func_8033AC30(AnimationFile *this){ return this->elem_cnt; } -f32 func_8033AC38(AnimationFile *this, AnimationFileElement *elem, f32 arg2){ - AnimationFileData *var_a0; - AnimationFileData *var_a2; +f32 func_8033AC38(AnimationFile *this, AnimationFileElement *elem, f32 time){ + AnimationFileData *end_anim; + AnimationFileData *start_anim; AnimationFileData *var_v0; f32 temp_f12; - f32 sp38[4]; + f32 knot_list[4]; u32 temp_t2; - var_a2 = &elem->data[0]; - if ((s32)arg2 < var_a2->unk0_13) { - sp38[0] = sp38[1] = D_803709E0[elem->unk0_3]; - sp38[2] = (f32) var_a2->unk2 / 64; - sp38[3] = (var_a2->unk0_15 == 1 && elem->data_cnt >= 2) ? (f32)(var_a2 + 1)->unk2/64 : sp38[2]; - return glspline_catmull_rom_interpolate((arg2 - this->unk0)/(var_a2->unk0_13 - this->unk0), 4, sp38); + start_anim = &elem->data[0]; + if ((s32)time < start_anim->unk0_13) { + knot_list[0] = knot_list[1] = D_803709E0[elem->unk0_3]; + knot_list[2] = (f32) start_anim->unk2 / 64; + knot_list[3] = (start_anim->unk0_15 == 1 && elem->data_cnt >= 2) ? (f32)(start_anim + 1)->unk2/64 : knot_list[2]; + return glspline_catmull_rom_interpolate((time - this->unk0)/(start_anim->unk0_13 - this->unk0), 4, knot_list); } - var_a0 = var_a2 + elem->data_cnt; - var_a0--; - if ((s32) arg2 >= (var_a0->unk0_13)) { - sp38[1] = (f32) var_a0->unk2 / 64; - sp38[0] = ((var_a0->unk0_14 == 1) && (elem->data_cnt >= 2)) ? (f32) (var_a0 - 1)->unk2 / 64 : sp38[1]; - sp38[2] = sp38[3] = sp38[1]; + end_anim = start_anim + elem->data_cnt; + end_anim--; + if ((s32) time >= (end_anim->unk0_13)) { + knot_list[1] = (f32) end_anim->unk2 / 64; + knot_list[0] = ((end_anim->unk0_14 == 1) && (elem->data_cnt >= 2)) ? (f32) (end_anim - 1)->unk2 / 64 : knot_list[1]; + knot_list[2] = knot_list[3] = knot_list[1]; - return glspline_catmull_rom_interpolate(arg2 - var_a0->unk0_13, 4, sp38); + return glspline_catmull_rom_interpolate(time - end_anim->unk0_13, 4, knot_list); } - var_v0 = var_a2 + 1; - while (var_v0 < var_a0){ - var_v0 = &var_a2[(var_a0 - var_a2)/2]; - if (var_v0->unk0_13 <= (s32)arg2) { - var_a2 = var_v0; - if (!var_a2); + var_v0 = start_anim + 1; + while (var_v0 < end_anim){ + var_v0 = &start_anim[(end_anim - start_anim)/2]; + if (var_v0->unk0_13 <= (s32)time) { + start_anim = var_v0; + if (!start_anim); } else { - var_a0 = var_v0; + end_anim = var_v0; } - var_v0 = var_a2 + 1; + var_v0 = start_anim + 1; } - sp38[1] = (f32) var_a2->unk2 / 64; - sp38[2] = (f32) var_a0->unk2 / 64; - temp_f12 = (arg2 - var_a2->unk0_13) / (var_a0->unk0_13 - var_a2->unk0_13); - if ((var_a2->unk0_14 == 0) && (var_a0->unk0_15 == 0)) { - return sp38[1] + ((sp38[2] - sp38[1]) * temp_f12); + knot_list[1] = (f32) start_anim->unk2 / 64; + knot_list[2] = (f32) end_anim->unk2 / 64; + temp_f12 = (time - start_anim->unk0_13) / (end_anim->unk0_13 - start_anim->unk0_13); + if ((start_anim->unk0_14 == 0) && (end_anim->unk0_15 == 0)) { + return knot_list[1] + ((knot_list[2] - knot_list[1]) * temp_f12); } - sp38[0] = (var_a2->unk0_14 == 1 && (var_a2 - 1) >= &elem->data[0]) ? (f32)(var_a2 - 1)->unk2/64 : sp38[1]; - sp38[3] = (var_a0->unk0_15 == 1 && (var_a0 + 1) < &elem->data[elem->data_cnt]) ? (f32)(var_a0 + 1)->unk2/64 : sp38[2]; - return glspline_catmull_rom_interpolate(temp_f12, 4, sp38); + knot_list[0] = (start_anim->unk0_14 == 1 && (start_anim - 1) >= &elem->data[0]) ? (f32)(start_anim - 1)->unk2/64 : knot_list[1]; + knot_list[3] = (end_anim->unk0_15 == 1 && (end_anim + 1) < &elem->data[elem->data_cnt]) ? (f32)(end_anim + 1)->unk2/64 : knot_list[2]; + return glspline_catmull_rom_interpolate(temp_f12, 4, knot_list); } void func_8033AFB8(Struct_B1400 *arg0, s32 arg1, f32 arg2[3][3]){ diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index f5556551..5f46c35b 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -28,67 +28,6 @@ typedef struct { }unkC; } Struct_glspline_0; -// typedef struct { -// u8 pad_0[0x4]; -// union { -// struct{ -// u16 bit63; -// u16 bit47:12; -// u16 unk0_3:3; -// u16 pad0_0:1; -// u32 bit31:24; -// u32 pad4_7:8; -// }t0; -// struct{ -// u32 pad_bit63: 12; -// u32 bit51: 2; -// u32 pad_bit49: 18; -// u32 bit31: 10; -// u32 bit21: 11; -// u32 bit10: 1; -// u32 pad_bit9: 1; -// u32 bit8: 1; -// u32 pad_bit7: 1; -// u32 bit6: 3; -// u32 bit3: 3; -// u32 pad_bit0: 1; -// }t1; -// struct{ -// u32 bit63: 1; -// u32 bit62: 15; -// u32 bit47: 8; -// u32 bit39: 4; -// u32 pad_bit35: 4; -// u32 pad_bit31: 32; -// }t2; -// }unk4; -// u32 padC_31:8; -// u32 unkC_23:2; -// u32 unkC_21:1; -// u32 unkC_20:8; -// u32 unkC_12:12; -// u32 unkC_0 : 1; -// union { -// struct { -// u32 pad_bit31: 24; -// u32 bit7:7; -// u32 bit0:1; -// }t0; -// struct { -// u32 pad_bit31: 25; -// u32 bit6: 1; -// u32 bit5: 1; -// u32 bit4: 1; -// u32 pad_bit3:5; -// }t1; -// struct { -// u32 pad_bit31: 24; -// u32 bit7:5; -// u32 pad_bit1:2; -// }t2; -// }unk10; -// }Struct_glspline_0; - typedef struct { u32 bit31: 16; u32 bit15: 12; @@ -203,7 +142,7 @@ typedef union{ typedef struct{ s32 unk0; Union_glspline spline[]; -}glspline_list; +}SplineList; typedef struct { s16 unk0; @@ -214,11 +153,11 @@ typedef struct { u16 pad8_12:13; }Struct_glspline_803411B0; -s32 func_80341BC8(struct56s *arg0, glspline_list * arg1); +s32 func_80341BC8(struct56s *arg0, SplineList * arg1); /* .data */ struct56s **D_80371E70 = NULL; -glspline_list **D_80371E74 = NULL; +SplineList **D_80371E74 = NULL; s32 D_80371E78 = 0; s32 D_80371E7C = 0; s32 D_80371E80 = 0; @@ -236,7 +175,6 @@ s16 *D_803858A0; struct56s *func_80342038(s32 indx); /* .code */ -//glspline_clamp f32 func_80340700(f32 value, f32 min, f32 max) { return (value < min) ? min : (max < value) ? max @@ -248,8 +186,8 @@ bool func_80340748(s32 arg0, s32 arg1, s32 arg2, f32 arg3[3], s32 arg4, s32 arg5 } s32 func_80340760(s32 arg0, s32 *arg1, f32 *arg2, s32 arg3, s32 arg4, f32 *arg5, f32 *arg6) { - glspline_list **temp_t0 = D_80371E74; - glspline_list *temp_a0; + SplineList **temp_t0 = D_80371E74; + SplineList *temp_a0; Union_glspline *temp_v0; Union_glspline *var_v1; s32 var_a2; @@ -303,23 +241,23 @@ s32 func_80340760(s32 arg0, s32 *arg1, f32 *arg2, s32 arg3, s32 arg4, f32 *arg5, return 0; } -f32 glspline_catmull_rom_interpolate(f32 arg0, s32 arg1, f32 *arg2) { - s32 tmp_v1; +f32 glspline_catmull_rom_interpolate(f32 x, s32 knotCount, f32 *knotList) { + s32 start_knot; s32 tmp_t7; f32 sp24[3]; f32 *var_a0; - tmp_t7 = arg1 - 3; - tmp_v1 = arg0 = tmp_t7 * func_80340700(arg0, 0.0f, 1.0f); - tmp_v1 = (tmp_v1 >= (arg1 - 4)) ? (arg1 - 4) : (tmp_v1); - arg2 += tmp_v1; - arg0 -= tmp_v1; + tmp_t7 = knotCount - 3; + start_knot = x = tmp_t7 * func_80340700(x, 0.0f, 1.0f); + start_knot = (start_knot >= (knotCount - 4)) ? (knotCount - 4) : (start_knot); + knotList += start_knot; + x -= start_knot; - sp24[2] = -0.5*arg2[0] + 1.5*arg2[1] + -1.5*arg2[2] + 0.5*arg2[3]; - sp24[1] = 1.0*arg2[0] + -2.5*arg2[1] + 2.0*arg2[2] + -0.5*arg2[3]; - sp24[0] = -0.5*arg2[0] + 0.0*arg2[1] + 0.5*arg2[2] + 0.0*arg2[3]; + sp24[2] = -0.5*knotList[0] + 1.5*knotList[1] + -1.5*knotList[2] + 0.5*knotList[3]; + sp24[1] = 1.0*knotList[0] + -2.5*knotList[1] + 2.0*knotList[2] + -0.5*knotList[3]; + sp24[0] = -0.5*knotList[0] + 0.0*knotList[1] + 0.5*knotList[2] + 0.0*knotList[3]; - return (((((sp24[2] * arg0) + sp24[1]) * arg0) + sp24[0]) * arg0) + (1.0*arg2[1]); + return (((((sp24[2] * x) + sp24[1]) * x) + sp24[0]) * x) + (1.0*knotList[1]); } void func_80340BE4(f32 arg0, s32 arg1, s32 arg2, s32 arg3, f32 * arg4, f32 arg5[3]); @@ -340,7 +278,7 @@ void func_803411B0(void) { s32 spC8; s32 spC4; struct56s *spB4; - glspline_list *spA8; + SplineList *spA8; struct56s *spA4; Union_glspline *sp80; Struct_glspline_803411B0 *sp50; @@ -440,7 +378,7 @@ void func_803411B0(void) { spB4 = (struct56s *) malloc(sizeof(struct56s) + (var_s7 * 3* sizeof(f32))); spB4->unk0 = var_s7; spB4->unk4 = 0; - spA8 = (glspline_list *)malloc(sizeof(glspline_list) + var_s0*sizeof(Union_glspline)); + spA8 = (SplineList *)malloc(sizeof(SplineList) + var_s0*sizeof(Union_glspline)); spA8->unk0 = var_s0; var_s1_2 = &spA8->spline[0]; var_s2 = var_s0; @@ -519,7 +457,7 @@ void func_80341BA0(void){ func_803411B0(); } -s32 func_80341BC8(struct56s *arg0, glspline_list * arg1) { +s32 func_80341BC8(struct56s *arg0, SplineList * arg1) { s32 temp_t7; void *temp_v0; void *temp_v0_2; @@ -528,7 +466,7 @@ s32 func_80341BC8(struct56s *arg0, glspline_list * arg1) { D_80371E70 = (struct56s **)realloc(D_80371E70, D_80371E78 * sizeof(struct56s *)); D_80371E70[D_80371E78 - 1] = arg0; - D_80371E74 = (glspline_list **)realloc(D_80371E74, D_80371E78 * sizeof(glspline_list *)); + D_80371E74 = (SplineList **)realloc(D_80371E74, D_80371E78 * sizeof(SplineList *)); D_80371E74[D_80371E78 - 1] = arg1; return D_80371E78 - 1; } @@ -645,8 +583,8 @@ int func_80342064(s32 arg0){ } s32 func_80342070(s32 arg0){ - glspline_list **temp_v0 = D_80371E74; - glspline_list *temp_v1; + SplineList **temp_v0 = D_80371E74; + SplineList *temp_v1; if(arg0 == -1) return 0; @@ -659,8 +597,8 @@ s32 func_80342070(s32 arg0){ } s32 func_803420BC(s32 arg0, s32 arg1, s32 arg2){ - glspline_list **temp_v0 = D_80371E74; - glspline_list *temp_v1; + SplineList **temp_v0 = D_80371E74; + SplineList *temp_v1; s32 temp_a1; s32 var_a0; @@ -686,8 +624,8 @@ s32 func_803420BC(s32 arg0, s32 arg1, s32 arg2){ } s32 func_803421A4(s32 arg0, f32 arg1) { - glspline_list **temp_v0 = D_80371E74; - glspline_list *temp_v1; + SplineList **temp_v0 = D_80371E74; + SplineList *temp_v1; s32 var_a3; Union_glspline *i_ptr; Union_glspline *temp_a2; @@ -722,7 +660,7 @@ void func_803422AC(ActorMarker *caller, enum asset_e text_id, s32 arg2){ #ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_803422D4.s") #else -s32 func_803422D4(Actor *arg0, Union_glspline *arg1, glspline_list *arg2) { +s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2) { s32 sp84 = 0; u8 sp83; f32 sp7C; @@ -1114,8 +1052,8 @@ s32 func_80343654(Actor *this){ } s32 func_80343694(Actor *actor, s32 indx, s32 begin, s32 end, s32 count, s32 stride) { - glspline_list **temp_v0; - glspline_list *temp_s5; + SplineList **temp_v0; + SplineList *temp_s5; Union_glspline *start_ptr; Union_glspline *end_ptr; bool var_v1; @@ -1275,14 +1213,14 @@ void glspline_defrag(void) { D_80371E70 = (struct56s **) defrag(D_80371E70); } if (D_80371E74 != 0) { - D_80371E74 = (glspline_list **) defrag(D_80371E74); + D_80371E74 = (SplineList **) defrag(D_80371E74); } if (D_803858A0 != 0) { D_803858A0 = (s16 *) defrag(D_803858A0); } for(i = 0; i < D_80371E78; i++){ - D_80371E74[i] = (glspline_list *) defrag(D_80371E74[i]); + D_80371E74[i] = (SplineList *) defrag(D_80371E74[i]); D_80371E70[i] = (struct56s *) defrag(D_80371E70[i]); } } diff --git a/src/core2/code_C89C0.c b/src/core2/code_C89C0.c index a6511cd3..e794870e 100644 --- a/src/core2/code_C89C0.c +++ b/src/core2/code_C89C0.c @@ -109,8 +109,8 @@ Actor* func_8034FCDC(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp2C[0] = 0.0f; sp2C[1] = sp28->unk14; sp2C[2] = 0.0f; - set_model_render_mode(2); - func_803391A4(gfx, mtx, sp28->unk8, sp2C, sp28->unk18 * 0.1, NULL, D_80386150.unk0); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gfx, mtx, sp28->unk8, sp2C, sp28->unk18 * 0.1, NULL, D_80386150.unk0); return NULL; } diff --git a/src/core2/code_C97F0.c b/src/core2/code_C97F0.c index 4e263fdd..8f77b675 100644 --- a/src/core2/code_C97F0.c +++ b/src/core2/code_C97F0.c @@ -163,7 +163,7 @@ void func_80350818(Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp80[3] = temp_s2->unk4[i].unk4[3]; sp80[3] *= var_f22; func_8033A334(sp80, D_803725A8); - func_803391A4(gfx, mtx, spB8, spD0, temp_s2->unk4[i].unk14*0.25, NULL, D_80386170.unk8); + modelRender_draw(gfx, mtx, spB8, spD0, temp_s2->unk4[i].unk14*0.25, NULL, D_80386170.unk8); } } } diff --git a/src/core2/code_C9F00.c b/src/core2/code_C9F00.c index a66c92fb..32d70a41 100644 --- a/src/core2/code_C9F00.c +++ b/src/core2/code_C9F00.c @@ -106,8 +106,8 @@ Actor *func_80350E90(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { if (temp_s0->unk8 != NULL) { temp_s0->unk8(&temp_s0->local, temp_s0, temp_s0->unk14, temp_s0->unk20, temp_s0->unk2C, temp_v0, gfx, mtx, vtx); } else { - set_model_render_mode(1); - func_803391A4(gfx, mtx, temp_s0->unk14, temp_s0->unk20, temp_s0->unk2C, NULL, temp_s0->unkC); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, temp_s0->unk14, temp_s0->unk20, temp_s0->unk2C, NULL, temp_s0->unkC); } } return 0; diff --git a/src/core2/code_D7D10.c b/src/core2/code_D7D10.c index c7b1b141..cd59a568 100644 --- a/src/core2/code_D7D10.c +++ b/src/core2/code_D7D10.c @@ -50,7 +50,7 @@ Actor *func_8035ECA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { func_8033A45C(4, local->unk0); func_8033A2D4(func_803253A0, this); func_8033A2E8(func_80325794, marker); - func_803391A4(gfx, mtx, this->position, rotation, this->scale, D_80373008, func_803257B4(marker)); + modelRender_draw(gfx, mtx, this->position, rotation, this->scale, D_80373008, func_803257B4(marker)); return this; } diff --git a/src/core2/fxcommon3score.c b/src/core2/fxcommon3score.c index 0016661d..deddc119 100644 --- a/src/core2/fxcommon3score.c +++ b/src/core2/fxcommon3score.c @@ -203,7 +203,7 @@ void fxcommon3score_draw(enum item_e item_id, void *arg1, Gfx **gfx, Mtx **mtx, sp50[2] = 0.0f; func_8033A308(sp50); if(getGameMode() != GAME_MODE_4_PAUSED){ - set_model_render_mode(1); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); } sp68[0] += a1->unk4C; if(a1->unk6C == 0.0f){ @@ -213,7 +213,7 @@ void fxcommon3score_draw(enum item_e item_id, void *arg1, Gfx **gfx, Mtx **mtx, if(a1->anim_ctrl != NULL){ func_8028781C(a1->anim_ctrl, sp5C, 1); } - func_803391A4(gfx, mtx, sp5C, sp68, a1->unk3C*sp3C, sp44, a1->model); + modelRender_draw(gfx, mtx, sp5C, sp68, a1->unk3C*sp3C, sp44, a1->model); }//L80300BA4 } diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 7092e606..436c5ba1 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -1357,9 +1357,9 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { func_8033A45C(var_s0_2 + 1, 0); } func_8033A45C(i, 1); - set_model_render_mode(0); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_NONE); func_8033A410(D_80383010.sns_alpha); - func_803391A4(gfx, mtx, &sp98, &sp8C, 0.8f, &sp80, D_80383010.sns_egg_model); + modelRender_draw(gfx, mtx, &sp98, &sp8C, 0.8f, &sp80, D_80383010.sns_egg_model); func_8024E2FC(); func_8024C904(gfx, mtx); } @@ -1398,9 +1398,9 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp80[0] = 0.0f; sp80[1] = 120.0f; sp80[2] = 0.0f; - set_model_render_mode(0); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_NONE); func_8033A410(D_80383010.sns_alpha); - func_803391A4(gfx, mtx, sp98, sp8C, 0.8f, sp80, D_80383010.ice_key_model); + modelRender_draw(gfx, mtx, sp98, sp8C, 0.8f, sp80, D_80383010.ice_key_model); func_8024E2FC(); func_8024C904(gfx, mtx); } diff --git a/src/core2/gc/sky.c b/src/core2/gc/sky.c index f113d6d1..1647c8cd 100644 --- a/src/core2/gc/sky.c +++ b/src/core2/gc/sky.c @@ -85,7 +85,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ rotation[0] = 0.0f; rotation[1] = gcSky.sky_info->sky_list[i].rotation_speed * gcSky.timer; rotation[2] = 0.0f; - func_803391A4(gfx, mtx, position, rotation, gcSky.sky_info->sky_list[i].scale, NULL, iAsset); + modelRender_draw(gfx, mtx, position, rotation, gcSky.sky_info->sky_list[i].scale, NULL, iAsset); } } } diff --git a/src/core2/gc/transition.c b/src/core2/gc/transition.c index e3b602a5..a8aa5b53 100644 --- a/src/core2/gc/transition.c +++ b/src/core2/gc/transition.c @@ -223,10 +223,10 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){ gDPSetTextureFilter((*gdl)++, G_TF_POINT); gDPSetColorDither((*gdl)++, G_CD_DISABLE); func_8028781C(D_80382430.animctrl, sp58, 1); - set_model_render_mode(1); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); } if(D_80382430.unk8 == 1 || D_80382430.unk8 == 6){ - func_803391A4(gdl, mptr, sp58, sp68, 1.0f, 0, D_80382430.unkC); + modelRender_draw(gdl, mptr, sp58, sp68, 1.0f, 0, D_80382430.unkC); if(D_80382430.animctrl != NULL){ gDPSetTextureFilter((*gdl)++, G_TF_BILERP); gDPSetColorDither((*gdl)++, G_CD_MAGICSQ); @@ -244,7 +244,7 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){ sp68[2] = D_80382430.rotation - 90.0f*sp64; tmp = sp64*D_80382430.unk4->unk10 + 0.1; } - func_803391A4(gdl, mptr, sp58, sp68, tmp, 0, D_80382430.unkC); + modelRender_draw(gdl, mptr, sp58, sp68, tmp, 0, D_80382430.unkC); } else if(D_80382430.unk8 == 5){//L8030B9EC switch (D_80382430.unk4->uid) @@ -262,10 +262,10 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){ break; } if(!(D_80382430.unk1C < 3) || D_80382430.unk4->uid != 0x11){ - func_803391A4(gdl, mptr, sp58, sp68, tmp, 0, D_80382430.unkC); + modelRender_draw(gdl, mptr, sp58, sp68, tmp, 0, D_80382430.unkC); } else{ - func_80338390(); + modelRender_reset(); } } diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index e6e8cf50..47bed1b8 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -841,11 +841,11 @@ void func_803163A8(gczoombox_t *this, Gfx **gfx, Mtx **mtx) { sp38[0] = 0.0f; sp38[1] = 0.0f; sp38[2] = 0.0f; sp44[0] = 0.0f; sp44[1] = 0.0f; sp44[2] = 0.0f; func_8033A308(sp44); - set_model_render_mode(0); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_NONE); if (this->anim_ctrl != NULL) { func_8028781C(this->anim_ctrl, sp50, 1); } - func_803391A4(gfx, mtx, sp50, sp5C, this->unk198 * sp34, &sp38, this->unkF0); + modelRender_draw(gfx, mtx, sp50, sp5C, this->unk198 * sp34, &sp38, this->unkF0); } void func_803164B0(gczoombox_t *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s32 arg5, f32 arg6) { @@ -874,7 +874,7 @@ void func_803164B0(gczoombox_t *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, mlMtxScale_xyz(temp_f12, temp_f12, 1.0f); mlMtxApply(*mtx); gSPMatrix((*gfx)++, (*mtx)++, G_MTX_LOAD | G_MTX_MODELVIEW); - set_model_render_mode(0); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_NONE); func_80344090(arg5, this->unk186, gfx); func_8033687C(gfx); func_8024C904(gfx, mtx); diff --git a/src/core2/code_B1400.c b/src/core2/modelRender.c similarity index 90% rename from src/core2/code_B1400.c rename to src/core2/modelRender.c index 19eefa2b..358ce439 100644 --- a/src/core2/code_B1400.c +++ b/src/core2/modelRender.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/modelRender.h" #define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0])) @@ -149,7 +150,7 @@ typedef struct { s32 unk8; }GeoCmd10; -void func_80338390(void); +void modelRender_reset(void); void func_803384A8(Gfx **, Mtx **, void *); void func_803385BC(Gfx **, Mtx **, void *); void func_803387F8(Gfx **, Mtx **, void *); @@ -613,11 +614,11 @@ f32 D_80383708; f32 D_8038370C; s32 D_80383710; s32 D_80383714; -BKGfxList *D_80383718; +BKGfxList *modelRenderDisplayList; struct58s *D_8038371C; -BKTextureList *D_80383720; +static BKTextureList *modelRenderTextureList; s32 D_80383724; -BKVertexList *D_80383728; +static BKVertexList *modelRenderVextureList; BKModelUnk20List *D_8038372C; struct58s *D_80383730; f32 D_80383734; @@ -636,12 +637,12 @@ struct { }D_803837B0; u8 D_803837C0; struct { - s32 unk0; //model_asset_index + s32 model_id; //model_asset_index f32 unk4; f32 unk8; u8 padC[0x4]; } D_803837C8; -s32 D_803837D8; +static s32 modelRenderDepthMode; struct { LookAt lookat_buffer[32]; LookAt *cur_lookat; @@ -651,7 +652,7 @@ struct { Mtx D_80383BF8; f32 D_80383C38[3]; f32 D_80383C48[3]; -BKModelBin *D_80383C54; +BKModelBin *modelRenderModelBin; f32 D_80383C58[3]; f32 D_80383C64; f32 D_80383C68[3]; @@ -660,7 +661,7 @@ f32 D_80383C88[3]; f32 D_80383C98[3]; /* .code */ -void func_80338390(void){ +void modelRender_reset(void){ D_80383700 = 0; D_80383708 = 30000.0f; D_80383704 = TRUE; @@ -668,17 +669,17 @@ void func_80338390(void){ D_80383710 = FALSE; D_80383714 = 2; D_80383650 = 0; - D_80383718 = NULL; + modelRenderDisplayList = NULL; D_8038371C = NULL; - D_80383720 = 0; + modelRenderTextureList = NULL; D_80383724 = 0; - D_80383728 = 0; + modelRenderVextureList = NULL; D_8038372C = 0; D_80383790.unk0 = NULL; D_80383790.unk8 = NULL; D_803837B0.unk0 = 0; - D_803837C8.unk0 = 0; - D_803837D8 = 0; + D_803837C8.model_id = 0; + modelRenderDepthMode = 0; func_8033A45C(1,1); func_8033A45C(2,0); if(D_80383758.unk18){ @@ -804,7 +805,7 @@ void func_80338904(Gfx **gfx, Mtx **mtx, void *arg2){ Gfx *vptr; if(D_80370990){ - vptr = &D_80383718->list[cmd->unk8]; + vptr = &modelRenderDisplayList->list[cmd->unk8]; gSPDisplayList((*gfx)++, osVirtualToPhysical(vptr)); } } @@ -815,14 +816,14 @@ void func_80338970(Gfx **gfx, Mtx **mtx, void *arg2){ int i; if(D_80370990){ - gSPDisplayList((*gfx)++, osVirtualToPhysical(D_80383718->list + cmd->unk8[0])); + gSPDisplayList((*gfx)++, osVirtualToPhysical(modelRenderDisplayList->list + cmd->unk8[0])); } if(D_80370990){ for(i = 1; cmd->unk8[i]; i++){ mlMtxApply(*mtx); gSPMatrix((*gfx)++, (*mtx)++, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList((*gfx)++, osVirtualToPhysical(D_80383718->list + cmd->unk8[i])); + gSPDisplayList((*gfx)++, osVirtualToPhysical(modelRenderDisplayList->list + cmd->unk8[i])); } } } @@ -836,7 +837,7 @@ void func_80338AC4(Gfx **gfx, Mtx **mtx, void *arg2){ //Cmd7_LOAD_DL??? void func_80338AE8(Gfx **gfx, Mtx **mtx, void *arg2){ if(D_80370990){ - gSPDisplayList((*gfx)++, osVirtualToPhysical(D_80383718->list + ((GeoCmd7*)arg2)->unkA)); + gSPDisplayList((*gfx)++, osVirtualToPhysical(modelRenderDisplayList->list + ((GeoCmd7*)arg2)->unkA)); } } @@ -996,7 +997,7 @@ void func_80339124(Gfx ** gfx, Mtx ** mtx, BKGeoList *geo_list){ }while(1); } -BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f32 scale, f32*arg5, BKModelBin* model_bin){ +BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f32 scale, f32*arg5, BKModelBin* model_bin){ f32 camera_focus[3]; f32 spF0; f32 padEC; @@ -1010,10 +1011,10 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 f32 tmp_f0; f32 padB8; - if( (!model_bin && !D_803837C8.unk0) - || (model_bin && D_803837C8.unk0) + if( (!model_bin && !D_803837C8.model_id) + || (model_bin && D_803837C8.model_id) ){ - func_80338390(); + modelRender_reset(); return 0; } @@ -1047,7 +1048,7 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 || ((camera_focus[1] < -17000.0f) || (17000.0f < camera_focus[1])) || ((camera_focus[2] < -17000.0f) || (17000.0f < camera_focus[2])) ){ - func_80338390(); + modelRender_reset(); return 0; } @@ -1068,7 +1069,7 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 } if(model_bin){ - verts = D_80383728 ? D_80383728 : (BKVertexList *)((s32)model_bin + model_bin->vtx_list_offset_10); + verts = modelRenderVextureList ? modelRenderVextureList : (BKVertexList *)((s32)model_bin + model_bin->vtx_list_offset_10); spD0 = verts->unk16; spD4 = verts->unk12; } @@ -1082,13 +1083,13 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 } if(D_80383708 <= spF0){ - func_80338390(); + modelRender_reset(); return 0; } D_80370990 = (D_80383704) ? func_8024DB50(camera_position, spD0*scale) : 1; if(D_80370990 == 0){ - func_80338390(); + modelRender_reset(); return 0; } @@ -1097,13 +1098,13 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 } func_80349AD0(); if(model_bin == NULL){ - model_bin = assetcache_get(D_803837C8.unk0); + model_bin = assetcache_get(D_803837C8.model_id); } - D_80383C54 = model_bin; - D_80383718 = D_80383718 ? D_80383718 : (BKGfxList *)((s32)D_80383C54 + D_80383C54->gfx_list_offset_C), - D_80383720 = D_80383720 ? D_80383720 : (BKTextureList *)((s32)D_80383C54 + D_80383C54->texture_list_offset_8), - D_80383728 = D_80383728 ? D_80383728 : (BKVertexList *)((s32)D_80383C54 + D_80383C54->vtx_list_offset_10), - D_8038372C = (D_80383C54->unk20 == NULL) ? NULL : (BKModelUnk20List *)((u8*)model_bin + model_bin->unk20); + modelRenderModelBin = model_bin; + modelRenderDisplayList = modelRenderDisplayList ? modelRenderDisplayList : (BKGfxList *)((s32)modelRenderModelBin + modelRenderModelBin->gfx_list_offset_C), + modelRenderTextureList = modelRenderTextureList ? modelRenderTextureList : (BKTextureList *)((s32)modelRenderModelBin + modelRenderModelBin->texture_list_offset_8), + modelRenderVextureList = modelRenderVextureList ? modelRenderVextureList : (BKVertexList *)((s32)modelRenderModelBin + modelRenderModelBin->vtx_list_offset_10), + D_8038372C = (modelRenderModelBin->unk20 == NULL) ? NULL : (BKModelUnk20List *)((u8*)model_bin + model_bin->unk20); if(D_80383710){ tmp_f0 = D_80383708 - 500.0f; @@ -1125,20 +1126,20 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 } // Set up segments 1 and 2 to point to vertices and textures respectively - gSPSegment((*gfx)++, 0x01, osVirtualToPhysical(&D_80383728->vtx_18)); - gSPSegment((*gfx)++, 0x02, osVirtualToPhysical(&D_80383720->tex_8[D_80383720->cnt_4])); + gSPSegment((*gfx)++, 0x01, osVirtualToPhysical(&modelRenderVextureList->vtx_18)); + gSPSegment((*gfx)++, 0x02, osVirtualToPhysical(&modelRenderTextureList->tex_8[modelRenderTextureList->cnt_4])); if(D_80383724){ - int i; + int i_segment; s32 texture_offset; - for(i = 0; i < 4; i++){ - if(func_80349BB0(D_80383724, i, &texture_offset)) - gSPSegment((*gfx)++, 15-i, osVirtualToPhysical((u8*)&D_80383720->tex_8[D_80383720->cnt_4] + texture_offset)); + for(i_segment = 0; i_segment < 4; i_segment++){ + if(func_80349BB0(D_80383724, i_segment, &texture_offset)) + gSPSegment((*gfx)++, 15 - i_segment, osVirtualToPhysical((u8*)&modelRenderTextureList->tex_8[modelRenderTextureList->cnt_4] + texture_offset)); } } - if(D_803837D8){ + if(modelRenderDepthMode != MODEL_RENDER_DEPTH_NONE){ gSPSetGeometryMode((*gfx)++, G_ZBUFFER); } else{ @@ -1146,15 +1147,15 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 } // Pick a table of render modes for opaque and translucent rendering - if(D_803837D8 == 0){ // No depth buffering + if(modelRenderDepthMode == MODEL_RENDER_DEPTH_NONE){ // No depth buffering rendermode_table_opa = renderModesNoDepthOpa; rendermode_table_xlu = renderModesNoDepthXlu; } - else if(D_803837D8 == 1){ // Full depth buffering + else if(modelRenderDepthMode == MODEL_RENDER_DEPTH_FULL){ // Full depth buffering rendermode_table_opa = renderModesFullDepthOpa; rendermode_table_xlu = renderModesFullDepthXlu; } - else if(D_803837D8 == 2){ // Depth compare but no depth write + else if(modelRenderDepthMode == MODEL_RENDER_DEPTH_COMPARE){ // Depth compare but no depth write rendermode_table_opa = renderModesDepthCompareOpa; rendermode_table_xlu = renderModesDepthCompareXlu; } @@ -1198,11 +1199,11 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 gSPSegment((*gfx)++, 0x03, osVirtualToPhysical(rendermode_table_xlu)); } - if(D_80383C54->geo_typ_A & 2){ //trilinear mipmapping + if(modelRenderModelBin->geo_typ_A & 2){ //trilinear mipmapping gSPDisplayList((*gfx)++, mipMapWrapDL); } - if(D_80383C54->geo_typ_A & 4){ //env mapping + if(modelRenderModelBin->geo_typ_A & 4){ //env mapping if(0.0f == camera_focus[2]){ camera_focus[2] = -0.1f; } @@ -1217,10 +1218,10 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 D_803837E0.cur_lookat = D_803837E0.lookat_buffer; } - if(D_8038371C && !D_80383C54->animation_list_offset_18){ + if(D_8038371C && !modelRenderModelBin->animation_list_offset_18){ D_8038371C = 0; } - else if(D_8038371C == 0 && D_80383C54->animation_list_offset_18){ + else if(D_8038371C == 0 && modelRenderModelBin->animation_list_offset_18){ if(D_80383700 == 0){ func_802EA060(&D_80383730, (u8*)model_bin + model_bin->animation_list_offset_18); } @@ -1235,7 +1236,7 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 } if(model_bin->unk28 != NULL && D_8038371C != NULL){ - func_802E6BD0((s32)D_80383C54 + D_80383C54->unk28, D_80383728, D_8038371C); + func_802E6BD0((s32)modelRenderModelBin + modelRenderModelBin->unk28, modelRenderVextureList, D_8038371C); } mlMtxIdent(); @@ -1271,11 +1272,11 @@ BKModelBin *func_803391A4(Gfx **gfx, Mtx **mtx, f32 position[3], f32 arg3[3], f3 D_80383790.unk8(D_80383790.unkC); } - if(D_803837C8.unk0){ - func_8033BD4C(model_bin); + if(D_803837C8.model_id){ + func_8033BD4C(model_bin); //assetCache_free } - func_80338390(); + modelRender_reset(); return model_bin; } @@ -1318,7 +1319,7 @@ f32 func_8033A0CC(UNK_TYPE(void *) arg0){ return *(f32 *)((s32)arg0 + 0x34); } -BKAnimationList *func_8033A0D4(BKModelBin *arg0){ +BKAnimationList *model_getAnimationList(BKModelBin *arg0){ if(arg0->animation_list_offset_18 == 0) return NULL; @@ -1329,7 +1330,7 @@ s32 func_8033A0F0(s32 arg0){ return D_80383658[arg0]; } -BKTextureList *func_8033A104(BKModelBin *arg0){ +BKTextureList *model_getTextureList(BKModelBin *arg0){ return (BKTextureList *)((s32)arg0 + arg0->texture_list_offset_8); } @@ -1363,7 +1364,7 @@ void func_8033A17C(void){ } void func_8033A1A4(void){ - func_80338390(); + modelRender_reset(); D_80383758.unk18 = 0; D_803837E0.cur_lookat = D_803837E0.lookat_buffer; D_803837E0.lookat_buffer_end = D_803837E0.cur_lookat + ARRAYLEN(D_803837E0.lookat_buffer); @@ -1418,8 +1419,8 @@ void func_8033A2E8(void(*func)(ActorMarker *), ActorMarker* marker){ D_80383790.unkC = marker; } -void func_8033A2FC(BKGfxList *gfx_list){ - D_80383718 = gfx_list; +void modelRender_setDisplayList(BKGfxList *gfx_list){ + modelRenderDisplayList = gfx_list; } void func_8033A308(f32 arg0[3]){ @@ -1478,26 +1479,26 @@ void func_8033A470(s32 arg0, s32 arg1){ D_80383658[arg0] = -arg1; } -void func_8033A488(BKTextureList *arg0){ - D_80383720 = arg0; +void modelRender_setTextureList(BKTextureList *textureList){ + modelRenderTextureList = textureList; } void func_8033A494(s32 arg0){ D_80383724 = arg0; } -void func_8033A4A0(enum asset_e model_id, f32 arg1, f32 arg2){ - D_803837C8.unk0 = model_id; +void func_8033A4A0(enum asset_e modelId, f32 arg1, f32 arg2){ + D_803837C8.model_id = modelId; D_803837C8.unk4 = arg1; D_803837C8.unk8 = arg2; } -void func_8033A4C0(BKVertexList *vertex_list){ - D_80383728 = vertex_list; +void modelRender_setVertexList(BKVertexList *vertexList){ + modelRenderVextureList = vertexList; } -void set_model_render_mode(s32 renderMode){ - D_803837D8 = renderMode; +void modelRender_setDepthMode(enum model_render_depth_mode_e renderMode){ + modelRenderDepthMode = renderMode; } void func_8033A4D8(void){ diff --git a/src/fight/chbossshadow.c b/src/fight/chbossshadow.c index 4f8924cc..10e57cc2 100644 --- a/src/fight/chbossshadow.c +++ b/src/fight/chbossshadow.c @@ -19,8 +19,8 @@ Actor *chbossshadow_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **arg3) Actor *this; this = func_80325300(marker, sp34); sp30 = this->scale * ml_map_f(this->unk1C[0], 0.0f, 1000.0f, 1.75f, 0.9f); - set_model_render_mode(2); - func_803391A4(gdl, mptr, this->position, sp34, sp30, NULL, func_80330B1C(marker)); + modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE); + modelRender_draw(gdl, mptr, this->position, sp34, sp30, NULL, func_80330B1C(marker)); return this; } diff --git a/src/fight/chspellbarrier.c b/src/fight/chspellbarrier.c index 2cc9dd3b..8da8f28d 100644 --- a/src/fight/chspellbarrier.c +++ b/src/fight/chspellbarrier.c @@ -76,7 +76,7 @@ void chspellbarrier_update(Actor *this){ actor_collisionOn(this); local->unk0 = 0; local->unk4 = 1; - this->unk124_9 = 0; + this->depth_mode = 0; this->scale = 0.0f; this->unk44_31 = func_8030ED2C(SFX_142_GRUNTY_LAUGH_3, 3); func_8030DB04(this->unk44_31, 32000, this->position, 4000.0f, 12000.0f); diff --git a/src/lair/code_0.c b/src/lair/code_0.c index a662a169..a2913b7d 100644 --- a/src/lair/code_0.c +++ b/src/lair/code_0.c @@ -1823,7 +1823,7 @@ void func_8038A014(Actor *this) void func_8038A034(Actor *this) { - this->unk124_9 = 2; + this->depth_mode = 2; func_80389FA8(this, BKPROG_C4_STATUE_EYE_BROKEN); } diff --git a/symbol_addrs.us.v10.txt b/symbol_addrs.us.v10.txt index e15dadd6..5dd835d4 100644 --- a/symbol_addrs.us.v10.txt +++ b/symbol_addrs.us.v10.txt @@ -904,7 +904,7 @@ marker_setCollisionScripts = 0x803300A8; map_get = 0x803348C0; exit_get = 0x803348CC; jiggySpawn = 0x803330C0; -set_model_render_mode = 0x8033A4CC; +modelRender_setDepthMode = 0x8033A4CC; assetcache_release = 0x8033B3D8; assetcache_update_ptr = 0x8033B574; assetcache_get = 0x8033B798;