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

Function xUpdateCull_Init

src/SB/Core/x/xUpdateCull.cpp:102–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102xUpdateCullMgr* xUpdateCull_Init(void** ent, U32 entCount, xGroup** group, U32 groupCount)
103{
104 void** tempEnt = NULL;
105 U32 tempCount = 0;
106
107 if (entCount > 0)
108 {
109 tempEnt = (void**)(((((RwGlobals*)RwEngineInstance)->memoryFuncs).rwmalloc)(
110 (sizeof(void*) * entCount)));
111
112 for (U32 idx = 0; idx < entCount; idx++)
113 {
114 if (!(((xEnt*)ent[idx])->baseFlags & 0x80))
115 {
116 tempEnt[tempCount++] = ent[idx];
117 }
118 }
119 }
120 ent = tempEnt;
121 entCount = tempCount;
122
123 U32 i, j, k, gcnt, entsInThisGroup, entsInGroups, nonEmptyGroups;
124 S32 x;
125
126 entsInGroups = 0;
127 nonEmptyGroups = 0;
128
129 bool* inGroupArray = (bool*)(((((RwGlobals*)RwEngineInstance)->memoryFuncs).rwmalloc)(
130 (sizeof(bool) * entCount)));
131 memset(inGroupArray, 0, sizeof(bool) * entCount);
132
133 for (i = 0; i < groupCount; i++)
134 {
135 entsInThisGroup = 0;
136 gcnt = xGroupGetCount(group[i]);
137 for (j = 0; j < gcnt; j++)
138 {
139 xBase* base = xGroupGetItemPtr(group[i], j);
140 for (k = 0; k < entCount; k++)
141 {
142 if (base == ent[k])
143 {
144 inGroupArray[k] = true;
145 entsInGroups++;
146 entsInThisGroup++;
147 }
148 }
149 }
150 if (entsInThisGroup > 0)
151 {
152 nonEmptyGroups++;
153 }
154 }
155
156 U32 mgrCount = entsInGroups;
157 for (i = 0; i < entCount; i++)
158 {
159 if (!inGroupArray[i])

Callers 1

zSceneSetupFunction · 0.50

Calls 5

memsetFunction · 0.85
xGroupGetCountFunction · 0.85
xGroupGetItemPtrFunction · 0.85
memcpyFunction · 0.85
xMemAllocFunction · 0.70

Tested by

no test coverage detected