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

Function zEntTriggerHitsSphere

src/SB/Game/zEntTrigger.cpp:228–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228bool zEntTriggerHitsSphere(const zEntTrigger& trig, const xSphere& o, const xVec3& dir)
229{
230 xTriggerAsset* tasset;
231
232 if (!xBaseIsEnabled(&trig))
233 {
234 return false;
235 }
236
237 tasset = zEntTriggerAsset(trig);
238
239 if (tasset->flags & 0x1 && dir.dot(tasset->direction) <= 0.0f)
240 {
241 return false;
242 }
243
244 switch (trig.subType)
245 {
246 case ZENTTRIGGER_TYPE_BOX:
247 {
248 return xSphereHitsOBB(o, trig.triggerBox, trig.triggerMatrix);
249 }
250 case ZENTTRIGGER_TYPE_SPHERE:
251 {
252 return xSphereHitsSphere(o.center, o.r, tasset->p[0], tasset->p[1].x);
253 }
254 case ZENTTRIGGER_TYPE_VCYLINDER:
255 {
256 return xSphereHitsVCylinder(o.center, o.r, tasset->p[0], tasset->p[1].x, tasset->p[1].y);
257 }
258 case ZENTTRIGGER_TYPE_VSPHERE:
259 {
260 return xSphereHitsVCircle(o, tasset->p[0], tasset->p[1].x);
261 }
262 }
263
264 return false;
265}

Callers 1

notify_triggersFunction · 0.85

Calls 6

xBaseIsEnabledFunction · 0.85
xSphereHitsOBBFunction · 0.85
xSphereHitsSphereFunction · 0.50
xSphereHitsVCylinderFunction · 0.50
xSphereHitsVCircleFunction · 0.50
dotMethod · 0.45

Tested by

no test coverage detected