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

Method Init

src/SB/Core/x/xNPCBasic.cpp:32–90  ·  view source on GitHub ↗

The order of the function pointer assignment instructions at the end of the

Source from the content-addressed store, hash-verified

30
31// The order of the function pointer assignment instructions at the end of the
32void xNPCBasic::Init(xEntAsset* asset)
33{
34 if (0.0f == asset->scale.x)
35 {
36 asset->scale.x = 1.0f;
37 }
38 if (0.0f == asset->scale.y)
39 {
40 asset->scale.y = 1.0f;
41 }
42 if (0.0f == asset->scale.z)
43 {
44 asset->scale.z = 1.0f;
45 }
46
47 xEnt* thisEnt = this;
48 xEntInit(thisEnt, asset);
49 collType = 8;
50 collLev = 4;
51 bound.type = XBOUND_TYPE_SPHERE; // [S8] 0x84
52 moreFlags |= 0x10;
53 zEntParseModelInfo(thisEnt, asset->modelInfoID);
54 xEntInitForType(thisEnt);
55 xEntInitShadow(*thisEnt, entShadow_embedded);
56 simpShadow = &simpShadow_embedded;
57 xShadowSimple_CacheInit(simpShadow, thisEnt, 0x50);
58 if (bound.type == XBOUND_TYPE_BOX)
59 {
60 iBoxForModel(&bound.box.box, collModel ? collModel : model);
61 }
62 else if (bound.type == XBOUND_TYPE_OBB)
63 {
64 iBoxForModelLocal(&bound.box.box, collModel ? collModel : model);
65 }
66
67 if (flags1.flg_basenpc & 0x1)
68 {
69 collis = (xEntCollis*)xMemAllocSize(sizeof(xEntCollis));
70 memset(collis, 0, sizeof(xEntCollis));
71 }
72
73 if ((flags1.flg_basenpc & 0x2) == 0)
74 {
75 frame = (xEntFrame*)xMemAllocSize(sizeof(xEntFrame));
76 memset(frame, 0, sizeof(xEntFrame));
77 }
78
79 RestoreColFlags();
80
81 f_setup = &NPC_entwrap_setup;
82 f_reset = &NPC_entwrap_reset;
83 eventFunc = &NPC_entwrap_event;
84 update = &NPC_entwrap_update;
85 bupdate = &NPC_entwrap_bupdate;
86 move = &NPC_entwrap_move;
87 render = &NPC_entwrap_render;
88
89 baseFlags &= 0xffef;

Callers

nothing calls this directly

Calls 8

xEntInitFunction · 0.85
xEntInitForTypeFunction · 0.85
xEntInitShadowFunction · 0.85
iBoxForModelFunction · 0.85
memsetFunction · 0.85
xShadowSimple_CacheInitFunction · 0.70
zEntParseModelInfoFunction · 0.50
iBoxForModelLocalFunction · 0.50

Tested by

no test coverage detected