MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ShatterObject

Function ShatterObject

TombEngine/Game/effects/debris.cpp:61–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void ShatterObject(SHATTER_ITEM* item, StaticMesh* mesh, int num, short roomNumber, int noZXVel)
62{
63 int meshIndex = 0;
64 short yRot = 0;
65 Vector3 scale;
66 Vector3 pos;
67 bool isStatic;
68
69 if (mesh)
70 {
71 if (!(mesh->Flags & StaticMeshFlags::SM_VISIBLE))
72 return;
73
74 isStatic = true;
75 meshIndex = Statics[mesh->Slot].meshNumber;
76 yRot = mesh->Pose.Orientation.y;
77 pos = Vector3(mesh->Pose.Position.x, mesh->Pose.Position.y, mesh->Pose.Position.z);
78 scale = mesh->Pose.Scale;
79
80 if (mesh->HitPoints <= 0)
81 mesh->Flags &= ~StaticMeshFlags::SM_VISIBLE;
82
83 SmashedMeshRoom[SmashedMeshCount] = roomNumber;
84 SmashedMesh[SmashedMeshCount] = mesh;
85 SmashedMeshCount++;
86 }
87 else
88 {
89 isStatic = false;
90 meshIndex = item->meshIndex;
91 yRot = item->yRot;
92 pos = item->sphere.Center;
93 scale = Vector3::One;
94 }
95
96 auto fragmentsMesh = &g_Level.Meshes[meshIndex];
97
98 for (auto& renderBucket : fragmentsMesh->buckets)
99 {
100 for (int i = 0; i < renderBucket.polygons.size(); i++)
101 {
102 POLYGON* poly = &renderBucket.polygons[i];
103 int indices[6];
104
105 if (poly->shape == SHAPE_RECTANGLE)
106 {
107 indices[0] = 0;
108 indices[1] = 1;
109 indices[2] = 3;
110 indices[3] = 2;
111 indices[4] = 3;
112 indices[5] = 1;
113 }
114 else
115 {
116 indices[0] = 0;
117 indices[1] = 1;
118 indices[2] = 2;

Callers 15

FallingBlockControlFunction · 0.85
ControlExplosionFunction · 0.85
ControlGladiatorFunction · 0.85
ControlGunShipFunction · 0.85
RomanStatueControlFunction · 0.85
ExplodeFXFunction · 0.85
BubblesShatterFunctionFunction · 0.85
ControlSpikyWallFunction · 0.85
KnightTemplarControlFunction · 0.85
SphinxControlFunction · 0.85
SkeletonControlFunction · 0.85
GetTargetOnLOSFunction · 0.85

Calls 10

GetFreeDebrisFragmentFunction · 0.85
TO_RADFunction · 0.85
GenerateFloatFunction · 0.85
GetSettingsMethod · 0.80
UpdateTransformMethod · 0.80
Vector3Function · 0.50
Vector4Function · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected