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

Function SwapModel

src/SB/Game/zEntDestructObj.cpp:14–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12namespace
13{
14 static void SwapModel(zEntDestructObj* ent, xModelInstance* modelInst)
15 {
16 xSFXAsset* sfxDestroy;
17 xModelInstance* collModel;
18 xModelInstance* camcollModel;
19 xModelInstance* entModel;
20
21 entModel = ent->model;
22 if (entModel != modelInst)
23 {
24 collModel = ent->collModel;
25 if ((collModel != NULL) && (collModel != entModel))
26 {
27 xModelInstanceFree(collModel);
28 ent->collModel = NULL;
29 }
30
31 camcollModel = ent->camcollModel;
32 if ((camcollModel != NULL) && (camcollModel != (xModelInstance*)ent->model))
33 {
34 xModelInstanceFree(camcollModel);
35 ent->camcollModel = NULL;
36 }
37
38 RwMatrixCopyMacro(modelInst->Mat, ent->model->Mat);
39
40 modelInst->Flags &= 0xBBFC;
41 modelInst->Flags |= (u16)(ent->model->Flags & 0x4403);
42 ent->model = modelInst;
43 iBoxForModelLocal(&ent->bound.box.box, modelInst);
44 zCollGeom_EntSetup((xEnt*)ent);
45
46 sfxDestroy = ent->sfx_destroy;
47 if (sfxDestroy != NULL)
48 {
49 xSndPlay3D(sfxDestroy->soundAssetID, (f32)sfxDestroy->volume, 0.0f, 0x80U, 0U,
50 &sfxDestroy->pos, 0.0f, (sound_category)SND_CAT_GAME, 0.0f);
51 }
52 }
53 }
54} // namespace
55
56void zEntDestructObj_FindFX()

Callers 2

zEntDestructObj_ResetFunction · 0.85
zEntDestructObjEventCBFunction · 0.85

Calls 4

zCollGeom_EntSetupFunction · 0.70
xSndPlay3DFunction · 0.70
xModelInstanceFreeFunction · 0.50
iBoxForModelLocalFunction · 0.50

Tested by

no test coverage detected