| 226 | } |
| 227 | |
| 228 | bool 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 | } |
no test coverage detected