| 56 | } |
| 57 | |
| 58 | void zEntTriggerUpdate(zEntTrigger* trig, xScene*, F32) |
| 59 | { |
| 60 | if (xBaseIsEnabled(trig)) |
| 61 | { |
| 62 | U32 i; |
| 63 | xLinkAsset* link = trig->link; |
| 64 | xTriggerAsset* tasset = (xTriggerAsset*)(trig->asset + 1); |
| 65 | |
| 66 | for (i = 0; i < trig->linkCount; i++) |
| 67 | { |
| 68 | if (link->chkAssetID && link->srcEvent >= eEventEnterEntity && |
| 69 | link->srcEvent <= eEventExitEntityFLAG) |
| 70 | { |
| 71 | xIsect isect; |
| 72 | S32 collide = 0; |
| 73 | |
| 74 | if (link->chkAssetID) |
| 75 | { |
| 76 | xEnt* chkEnt = (xEnt*)zSceneFindObject(link->chkAssetID); |
| 77 | |
| 78 | if (chkEnt) |
| 79 | { |
| 80 | xVec3* chkPos; |
| 81 | |
| 82 | if (chkEnt->bound.type == XBOUND_TYPE_SPHERE) |
| 83 | { |
| 84 | chkPos = &chkEnt->bound.sph.center; |
| 85 | } |
| 86 | else |
| 87 | { |
| 88 | chkPos = (xVec3*)&chkEnt->model->Mat->pos; |
| 89 | } |
| 90 | |
| 91 | switch (trig->subType) |
| 92 | { |
| 93 | case ZENTTRIGGER_TYPE_BOX: |
| 94 | { |
| 95 | xVec3 xformVec; |
| 96 | |
| 97 | xMat4x3Tolocal(&xformVec, &trig->triggerMatrix, chkPos); |
| 98 | iBoxIsectVec(&trig->triggerBox, &xformVec, &isect); |
| 99 | |
| 100 | collide = (isect.penned <= 0.0f); |
| 101 | |
| 102 | break; |
| 103 | } |
| 104 | case ZENTTRIGGER_TYPE_SPHERE: |
| 105 | { |
| 106 | xSphere sphere; |
| 107 | xIsect isect; |
| 108 | |
| 109 | sphere.center = tasset->p[0]; |
| 110 | sphere.r = tasset->p[1].x; |
| 111 | |
| 112 | iSphereIsectVec(&sphere, chkPos, &isect); |
| 113 | |
| 114 | collide = (isect.penned <= 0.0f); |
| 115 |
nothing calls this directly
no test coverage detected