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

Method CreateNPC

src/SB/Game/zNPCMgr.cpp:592–614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590}
591
592xEnt* zNPCMgr::CreateNPC(xEntAsset* asset)
593{
594 zNPCCommon* npc;
595 en_NPCTYPES nt;
596 U32 size;
597 xModelAssetInfo* modelAsset = (xModelAssetInfo*)xSTFindAsset(asset->modelInfoID, &size);
598
599 // FIXME: Replace with actually getting the right model hash from the packed data
600 nt = this->NPCTypeForModel(modelAsset->BrainID, *(&asset->modelInfoID + 3));
601 npc = (zNPCCommon*)npcFactory->CreateItem(nt, NULL, NULL);
602
603 npc->Init(asset);
604 XOrdAppend(&npclist, npc);
605
606 if (npclist.cnt == npclist.max)
607 {
608 XOrdSort(&npclist, zNPCMgr_OrdComp_npcid);
609 }
610
611 this->DBG_Reset();
612
613 return npc;
614}
615
616void zNPCMgr::BackdoorUpdateAllNPCsOnce(xScene* xscn, F32 dt)
617{

Callers 1

zNPCMgr_createNPCInstFunction · 0.80

Calls 7

NPCTypeForModelMethod · 0.95
DBG_ResetMethod · 0.95
XOrdAppendFunction · 0.85
CreateItemMethod · 0.80
xSTFindAssetFunction · 0.50
XOrdSortFunction · 0.50
InitMethod · 0.45

Tested by

no test coverage detected