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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
//
// Generated By: dol2asm
// Translation Unit: J3DMaterialAttach
//
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "dolphin/types.h"
//
// Forward References:
//
extern "C" void clear__16J3DMaterialTableFv();
extern "C" void __ct__16J3DMaterialTableFv();
extern "C" void __dt__16J3DMaterialTableFv();
extern "C" void removeMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor();
extern "C" void removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern();
extern "C" void removeTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey();
extern "C" void removeTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey();
extern "C" void createTexMtxForAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey();
extern "C" void entryMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor();
extern "C" void entryTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern();
extern "C" void entryTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey();
extern "C" void entryTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey();
//
// External References:
//
extern "C" void* __nw__FUl();
extern "C" void __dl__FPv();
extern "C" void __as__13J3DTexMtxInfoFRC13J3DTexMtxInfo();
extern "C" void setMatColorAnm__14J3DMaterialAnmFiP14J3DMatColorAnm();
extern "C" void setTexMtxAnm__14J3DMaterialAnmFiP12J3DTexMtxAnm();
extern "C" void setTexNoAnm__14J3DMaterialAnmFiP11J3DTexNoAnm();
extern "C" void setTevColorAnm__14J3DMaterialAnmFiP14J3DTevColorAnm();
extern "C" void setTevKColorAnm__14J3DMaterialAnmFiP15J3DTevKColorAnm();
extern "C" void _savegpr_22();
extern "C" void _savegpr_24();
extern "C" void _savegpr_26();
extern "C" void _savegpr_27();
extern "C" void _restgpr_22();
extern "C" void _restgpr_24();
extern "C" void _restgpr_26();
extern "C" void _restgpr_27();
extern "C" extern void* __vt__11J3DTexNoAnm[3];
/* 8032F5A8-8032F5D0 329EE8 0028+00 0/0 1/1 0/0 .text clear__16J3DMaterialTableFv */
void J3DMaterialTable::clear() {
mMaterialNum = 0;
mUniqueMatNum = 0;
mMaterialNodePointer = NULL;
mMaterialName = NULL;
field_0x10 = 0;
mTexture = NULL;
mTextureName = NULL;
field_0x1c = 0;
}
/* 8032F5D0-8032F604 329F10 0034+00 0/0 2/2 0/0 .text __ct__16J3DMaterialTableFv */
J3DMaterialTable::J3DMaterialTable() {
mMaterialNum = 0;
mUniqueMatNum = 0;
mMaterialNodePointer = NULL;
mMaterialName = NULL;
field_0x10 = 0;
mTexture = NULL;
mTextureName = NULL;
field_0x1c = 0;
}
/* 8032F604-8032F64C 329F44 0048+00 1/0 1/1 0/0 .text __dt__16J3DMaterialTableFv */
J3DMaterialTable::~J3DMaterialTable() {}
/* 8032F64C-8032F6F8 329F8C 00AC+00 0/0 1/1 5/5 .text
* removeMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor */
int J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) {
int ret = false;
u16 updateMatNum = pAnmColor->getUpdateMaterialNum();
for (u16 i = 0; i < updateMatNum; i++) {
if (pAnmColor->isValidUpdateMaterialID(i)) {
J3DMaterial* materialNode = getMaterialNodePointer(pAnmColor->getUpdateMaterialID(i));
J3DMaterialAnm* materialAnm = materialNode->getMaterialAnm();
if (materialAnm == NULL) {
ret = true;
} else {
materialAnm->setMatColorAnm(0, NULL);
}
}
}
return ret;
}
/* 8032F6F8-8032F7B4 32A038 00BC+00 0/0 5/5 10/10 .text
* removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern */
int J3DMaterialTable::removeTexNoAnimator(J3DAnmTexPattern* anm) {
int ret = 0;
u16 materialNum = anm->getUpdateMaterialNum();
J3DAnmTexPatternFullTable* anm_table = anm->mAnmTable;
for (u16 i = 0; i < materialNum; i++) {
if (anm->isValidUpdateMaterialID(i)) {
u16 materialID = anm->getUpdateMaterialID(i);
J3DMaterialAnm* pMatAnm = getMaterialNodePointer(materialID)->getMaterialAnm();
u8 texNo = anm_table[i].mTexNo;
if (pMatAnm == NULL)
ret = 1;
else
pMatAnm->setTexNoAnm(texNo, NULL);
}
}
return ret;
}
/* 8032F7B4-8032F880 32A0F4 00CC+00 0/0 4/4 26/26 .text
* removeTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
int J3DMaterialTable::removeTexMtxAnimator(J3DAnmTextureSRTKey* pAnm) {
s32 ret = 0;
u16 materialNum = pAnm->getUpdateMaterialNum();
for (u16 i = 0; i < materialNum; i++) {
u16 materialID = pAnm->getUpdateMaterialID(i);
if (materialID != 0xFFFF) {
J3DMaterial* pMaterial = getMaterialNodePointer(materialID);
J3DMaterialAnm* pMatAnm = pMaterial->getMaterialAnm();
u8 texMtxID = pAnm->getUpdateTexMtxID(i);
if (pMatAnm == NULL) {
ret = 1;
} else if (texMtxID != 0xFF) {
pMatAnm->setTexMtxAnm(texMtxID, NULL);
}
}
}
return ret;
}
/* 8032F880-8032F9C0 32A1C0 0140+00 0/0 7/7 24/24 .text
* removeTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey */
int J3DMaterialTable::removeTevRegAnimator(J3DAnmTevRegKey* pAnm) {
s32 ret = 0;
u16 cRegMaterialNum = pAnm->getCRegUpdateMaterialNum();
u16 kRegMaterialNum = pAnm->getKRegUpdateMaterialNum();
for (u16 i = 0; i < cRegMaterialNum; i++) {
if (pAnm->getCRegUpdateMaterialID(i) != 0xFFFF) {
J3DMaterialAnm * pMatAnm = getMaterialNodePointer(pAnm->getCRegUpdateMaterialID(i))->getMaterialAnm();
u32 colorId = pAnm->getAnmCRegKeyTable()[i].mColorId;
if (pMatAnm == NULL)
ret = 1;
else
pMatAnm->setTevColorAnm(colorId, NULL);
}
}
for (u16 i = 0; i < kRegMaterialNum; i++) {
if (pAnm->getKRegUpdateMaterialID(i) != 0xFFFF) {
J3DMaterialAnm * pMatAnm = getMaterialNodePointer(pAnm->getKRegUpdateMaterialID(i))->getMaterialAnm();
u32 colorId = pAnm->getAnmKRegKeyTable()[i].mColorId;
if (pMatAnm == NULL) {
ret = 1;
} else {
pMatAnm->setTevKColorAnm(colorId, NULL);
}
}
}
return ret;
}
/* 8032F9C0-8032FAF4 32A300 0134+00 1/1 0/0 0/0 .text
* createTexMtxForAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
int J3DMaterialTable::createTexMtxForAnimator(J3DAnmTextureSRTKey* param_1) {
int rv = 0;
u16 materialNum = param_1->getUpdateMaterialNum();
if (isLocked()) {
return 2;
}
for (u16 i = 0; i < materialNum; i++) {
if (param_1->isValidUpdateMaterialID(i)) {
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
u8 mtxId = param_1->getUpdateTexMtxID(i);
if (material->getMaterialAnm() == 0) {
rv = 1;
} else {
u32 mtxId2 = mtxId;
if (mtxId2 != 0xff && material->getTexMtx(mtxId2) == 0) {
J3DTexMtx* mtx = new J3DTexMtx();
rv = 4;
material->setTexMtx(mtxId2, mtx);
JUT_WARN(420, "matNo<%d> : texMtx%d nothing !\n", i, mtxId);
}
}
}
}
return rv;
}
/* 8032FAF4-8032FBC8 32A434 00D4+00 0/0 1/1 0/0 .text
* entryMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor */
int J3DMaterialTable::entryMatColorAnimator(J3DAnmColor* param_1) {
int rv = 0;
u16 materialNum = param_1->getUpdateMaterialNum();
if (isLocked()) {
return 2;
}
for (u16 i = 0; i < materialNum; i++) {
if (param_1->isValidUpdateMaterialID(i)) {
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
if (materialAnm == 0) {
rv = 1;
} else {
J3DMatColorAnm matColorAnm(i, param_1);
materialAnm->setMatColorAnm(0, &matColorAnm);
}
}
}
return rv;
}
/* 8032FBC8-8032FCC4 32A508 00FC+00 0/0 7/7 1/1 .text
* entryTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern */
int J3DMaterialTable::entryTexNoAnimator(J3DAnmTexPattern* param_1) {
int rv = 0;
u16 materialNum = param_1->getUpdateMaterialNum();
if (isLocked()) {
return 2;
}
for (u16 i = 0; i < materialNum; i++) {
if (param_1->isValidUpdateMaterialID(i)) {
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
u8 texNo = param_1->getAnmTable()[i].mTexNo;
if (materialAnm == 0) {
rv = 1;
} else {
J3DTexNoAnm texNoAnm(i, param_1);
materialAnm->setTexNoAnm(texNo, &texNoAnm);
}
}
}
return rv;
}
/* 8032FCC4-8032FE70 32A604 01AC+00 0/0 14/14 6/6 .text
* entryTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */
// getUpdateTexMtxID u8 issue / getSRTCenter
#ifdef NONMATCHING
int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* param_1) {
int rv = 0;
u16 materialNum = param_1->getUpdateMaterialNum();
rv = createTexMtxForAnimator(param_1);
if (rv != 0) {
return rv;
}
if (isLocked()) {
return 2;
}
for (u16 i = 0; i < materialNum; i++) {
if (param_1->isValidUpdateMaterialID(i)) {
J3DMaterial* material = getMaterialNodePointer(param_1->getUpdateMaterialID(i));
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
u8 texMtxID = param_1->getUpdateTexMtxID(i);
if (materialAnm == 0) {
rv = 1;
} else {
if (texMtxID != 0xff) {
if (material->getTexCoord(texMtxID) != NULL) {
material->getTexCoord(texMtxID)->setTexGenMtx(texMtxID * 3 + 30);
}
J3DTexMtxInfo& iVar3 = material->getTexMtx(texMtxID)->getTexMtxInfo();
iVar3.mInfo = (iVar3.mInfo & 0x3f)| (param_1->getTexMtxCalcType() << 7);
iVar3.mCenter.x = param_1->getSRTCenter(i)->x;
iVar3.mCenter.y = param_1->getSRTCenter(i)->y;
iVar3.mCenter.z = param_1->getSRTCenter(i)->z;
J3DTexMtxAnm texMtxAnm(i, param_1);
materialAnm->setTexMtxAnm(texMtxID, &texMtxAnm);
}
}
}
}
return rv;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* param_0) {
nofralloc
#include "asm/JSystem/J3DGraphAnimator/J3DMaterialAttach/entryTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey.s"
}
#pragma pop
#endif
/* 8032FE70-8032FFEC 32A7B0 017C+00 0/0 10/10 4/4 .text
* entryTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey */
int J3DMaterialTable::entryTevRegAnimator(J3DAnmTevRegKey* param_1) {
int rv = 0;
u16 cRegNum = param_1->getCRegUpdateMaterialNum();
u16 kRegNum = param_1->getKRegUpdateMaterialNum();
if (isLocked()) {
return 2;
}
for (u16 i = 0; i < cRegNum; i++) {
if (param_1->isValidCRegUpdateMaterialID(i)) {
J3DMaterial* material = getMaterialNodePointer(param_1->getCRegUpdateMaterialID(i));
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
u8 colorId = param_1->getAnmCRegKeyTable()[i].mColorId;
if (materialAnm == NULL) {
rv = 1;
} else {
J3DTevColorAnm tevColorAnm(i, param_1);
materialAnm->setTevColorAnm(colorId, &tevColorAnm);
}
}
}
for (u16 i = 0; i < kRegNum; i++) {
if (param_1->isValidKRegUpdateMaterialID(i)) {
J3DMaterial* material = getMaterialNodePointer(param_1->getKRegUpdateMaterialID(i));
J3DMaterialAnm* materialAnm = material->getMaterialAnm();
u32 colorId = param_1->getAnmKRegKeyTable()[i].mColorId;
if (materialAnm == NULL) {
rv = 1;
} else {
J3DTevKColorAnm tevKColorAnm(i, param_1);
materialAnm->setTevKColorAnm(colorId, &tevKColorAnm);
}
}
}
return rv;
}
|