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

Function zEntRecurseModelInfo

src/SB/Game/zEnt.cpp:317–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317xModelInstance* zEntRecurseModelInfo(void* info, xEnt* ent)
318{
319 xModelAssetInfo* zinfo = (xModelAssetInfo*)info;
320 xModelAssetInst* zinst = (xModelAssetInst*)(zinfo + 1);
321 U32 bufsize;
322 xModelInstance* tempInst[64];
323
324 for (U32 i = 0; i < zinfo->NumModelInst; i++)
325 {
326 RpAtomic* imodel = (RpAtomic*)xSTFindAsset(zinst[i].ModelID, &bufsize);
327 if (*(U32*)&imodel->object.object == 0x464e494d)
328 {
329 tempInst[i] = zEntRecurseModelInfo(imodel, ent);
330 if (i != 0)
331 {
332 tempInst[i]->Flags |= zinst[i].Flags;
333 tempInst[i]->BoneIndex = zinst[i].Bone;
334 xModelInstanceAttach(tempInst[i], tempInst[zinst[i].Parent]);
335 }
336 }
337 else
338 {
339 if (i == 0)
340 {
341 tempInst[i] = xModelInstanceAlloc(imodel, ent, 0, 0, 0);
342 tempInst[i]->modelID = zinst[i].ModelID;
343 while (imodel = iModelFile_RWMultiAtomic(imodel), imodel != NULL)
344 {
345 xModelInstanceAttach(xModelInstanceAlloc(imodel, ent, 0x2000, 0, NULL),
346 tempInst[i]);
347 }
348 }
349 else
350 {
351 tempInst[i] = xModelInstanceAlloc(imodel, ent, zinst[i].Flags, zinst[i].Bone, NULL);
352 xModelInstanceAttach(tempInst[i], tempInst[zinst[i].Parent]);
353
354 while (imodel = iModelFile_RWMultiAtomic(imodel), imodel != NULL)
355 {
356 xModelInstanceAttach(xModelInstanceAlloc(imodel, ent, 0x2000, 0, NULL),
357 tempInst[i]);
358 }
359 }
360 }
361 }
362 if (zinfo->AnimTableID != 0)
363 {
364 xAnimTable* table = (xAnimTable*)xSTFindAsset(zinfo->AnimTableID, &bufsize);
365 tempInst[0]->Anim = xAnimPoolAlloc(&globals.sceneCur->mempool, ent, table, tempInst[0]);
366 }
367 return tempInst[0];
368}
369
370void zEntParseModelInfo(xEnt* ent, U32 assetID)
371{

Callers 6

zEntPlayer_InitFunction · 0.70
init_missle_modelFunction · 0.70
load_modelFunction · 0.70
load_modelFunction · 0.70
zEntParseModelInfoFunction · 0.70
load_modelFunction · 0.50

Calls 5

xSTFindAssetFunction · 0.50
xModelInstanceAttachFunction · 0.50
xModelInstanceAllocFunction · 0.50
iModelFile_RWMultiAtomicFunction · 0.50
xAnimPoolAllocFunction · 0.50

Tested by

no test coverage detected