MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / zCollGeom_EntSetup

Function zCollGeom_EntSetup

src/SB/Game/zCollGeom.cpp:12–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10static zCollGeomTable* sTableList[3];
11
12U32 zCollGeom_EntSetup(xEnt* ent)
13{
14 U32 i, j;
15 S32 auto_cam_coll;
16
17 auto_cam_coll = (ent->baseType == eBaseTypeStatic);
18
19 ent->collModel = NULL;
20 ent->camcollModel = NULL;
21
22 if (ent->model)
23 {
24 for (j = 0; j < sNumTables; j++)
25 {
26 for (i = 0; i < sTableCount[j]; i++)
27 {
28 if (sTableList[j][i].baseModel == ent->model->Data)
29 {
30 RpAtomic* imodel;
31
32 if (imodel = sTableList[j][i].colModel[0])
33 {
34 xModelInstance* model = xModelInstanceAlloc(imodel, ent, 0x2000, 0, NULL);
35
36 ent->collModel = model;
37 ent->collModel->Mat = ent->model->Mat;
38
39 while (imodel = iModelFile_RWMultiAtomic(imodel))
40 {
41 xModelInstanceAttach(xModelInstanceAlloc(imodel, ent, 0x2000, 0, NULL),
42 model);
43 }
44 }
45 else if (imodel = sTableList[j][i].camcolModel)
46 {
47 xModelInstance* model = xModelInstanceAlloc(imodel, ent, 0x2000, 0, NULL);
48
49 ent->camcollModel = model;
50 ent->camcollModel->Mat = ent->model->Mat;
51
52 while (imodel = iModelFile_RWMultiAtomic(imodel))
53 {
54 xModelInstanceAttach(xModelInstanceAlloc(imodel, ent, 0x2000, 0, NULL),
55 model);
56 }
57 }
58 else
59 {
60 auto_cam_coll = 0;
61 }
62 }
63 }
64 }
65 }
66
67 if (auto_cam_coll && !ent->camcollModel)
68 {
69 ent->camcollModel = ent->model;

Callers 2

SwapModelFunction · 0.70
xEntSetupFunction · 0.50

Calls 3

xModelInstanceAllocFunction · 0.50
iModelFile_RWMultiAtomicFunction · 0.50
xModelInstanceAttachFunction · 0.50

Tested by

no test coverage detected