1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_model.h"
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "d/d_com_inf_game.h"
void dMdl_c::draw() {
j3dSys.setVtxPos(mpModelData->getVtxPosArray());
j3dSys.setVtxNrm(mpModelData->getVtxNrmArray());
j3dSys.setVtxCol(mpModelData->getVtxColorArray(0));
J3DShape::resetVcdVatCache();
J3DShape* shape = mpModelData->getMaterialNodePointer(mMaterialId)->getShape();
mpModelData->getMaterialNodePointer(mMaterialId)->loadSharedDL();
shape->loadPreDrawSetting();
GXColor amb_color = {(u8)mpTevstr->AmbCol.r, (u8)mpTevstr->AmbCol.g, (u8)mpTevstr->AmbCol.b,
(u8)mpTevstr->AmbCol.a};
GXSetChanAmbColor(GX_COLOR0A0, amb_color);
GXSetChanMatColor(GX_COLOR0A0, g_whiteColor);
dKy_setLight_nowroom_actor(mpTevstr);
dKy_setLight_again();
dKy_GxFog_tevstr_set(mpTevstr);
Mtx m;
for (dMdl_obj_c* obj = mpModelObj; obj != NULL; obj = obj->mpObj) {
MTXConcat(j3dSys.getViewMtx(), obj->getMtx(), m);
GXLoadPosMtxImm(m, GX_PNMTX0);
GXLoadNrmMtxImm(m, GX_PNMTX0);
shape->simpleDrawCache();
}
field_0x1a = false;
}
void dMdl_c::create(J3DModelData* i_modelData, u16 i_materialId, dKy_tevstr_c* i_tevstr) {
mpModelData = i_modelData;
mMaterialId = i_materialId;
mpTevstr = i_tevstr;
field_0x1a = false;
}
void dMdl_c::entryObj(dMdl_obj_c* i_obj) {
if (!field_0x1a) {
dComIfGd_getListPacket()->entryImm(this, 0);
field_0x1a = true;
mpModelObj = NULL;
}
i_obj->mpObj = mpModelObj;
mpModelObj = i_obj;
}
dMdl_c* dMdl_mng_c::search(J3DModelData* i_modelData, u16 i_materialId, dKy_tevstr_c* i_tevstr) {
dMdl_c* model = field_0x0;
for (int i = field_0x80; i > 0; i--) {
if (model->getModelData() == i_modelData && model->getMaterialId() == i_materialId &&
model->getTevstr() == i_tevstr) {
return model;
}
model++;
}
return NULL;
}
dMdl_c* dMdl_mng_c::entry(J3DModelData* i_modelData, u16 i_materialId, dKy_tevstr_c* i_tevstr) {
dMdl_c* model = search(i_modelData, i_materialId, i_tevstr);
if (model == NULL) {
if (field_0x80 >= 4) {
return NULL;
} else {
model = &field_0x0[field_0x80];
model->create(i_modelData, i_materialId, i_tevstr);
field_0x80++;
}
}
return model;
}
dMdl_mng_c* dMdl_mng_c::m_myObj;
void dMdl_mng_c::create() {
m_myObj = new dMdl_mng_c();
}
dMdl_c::~dMdl_c() {}
void dMdl_mng_c::remove() {
if (m_myObj != NULL) {
delete m_myObj;
m_myObj = NULL;
}
}
void dMdl_mng_c::reset() {
if (m_myObj == NULL) {
return;
}
m_myObj->field_0x80 = 0;
}
dMdl_c* dMdl_mng_c::entry(J3DModelData* i_modelData, u16 i_materialId, int i_roomNo) {
if (m_myObj == NULL) {
return NULL;
}
dKy_tevstr_c* tevstr = dComIfGp_roomControl_getTevStr(i_roomNo);
return m_myObj->entry(i_modelData, i_materialId, tevstr);
}
|