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

Function SweptSphereHitsEntCB

src/SB/Core/x/xCollide.cpp:2108–2231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2106 if (sSweptSphereIgnoreMovers)
2107 {
2108 xModelInstance* collmod = ent->collModel ? ent->collModel : ent->model;
2109 if (collmod->Flags & 0x800)
2110 return;
2111
2112 if (ent->frame)
2113 {
2114 xMat4x3* m1 = &ent->frame->oldmat;
2115 xMat4x3* m2 = (xMat4x3*)ent->model->Mat;
2116 if (m1->pos.x != m2->pos.x || m1->pos.y != m2->pos.y || m1->pos.z != m2->pos.z ||
2117 m1->right.x != m2->right.x || m1->right.y != m2->right.y ||
2118 m1->right.z != m2->right.z || m1->up.y != m2->up.y || m1->up.z != m2->up.z ||
2119 m1->at.z != m2->at.z)
2120 return;
2121 }
2122 }
2123
2124 if (ent->collLev == 5)
2125 {
2126 U32 result = 0;
2127 switch (ent->bound.type)
2128 {
2129 case XBOUND_TYPE_SPHERE:
2130 {
2131 F32 oldrad = ent->bound.sph.r;
2132 ent->bound.sph.r += sws->radius;
2133 result = xRayHitsSphereFast(ray, &ent->bound.sph);
2134 ent->bound.sph.r = oldrad;
2135 break;
2136 }
2137 case XBOUND_TYPE_BOX:
2138 {
2139 xBox tmpbox;
2140 tmpbox.upper.x = ent->bound.box.box.upper.x + sws->radius;
2141 tmpbox.upper.y = ent->bound.box.box.upper.y + sws->radius;
2142 tmpbox.upper.z = ent->bound.box.box.upper.z + sws->radius;
2143 tmpbox.lower.x = ent->bound.box.box.lower.x - sws->radius;
2144 tmpbox.lower.y = ent->bound.box.box.lower.y - sws->radius;
2145 tmpbox.lower.z = ent->bound.box.box.lower.z - sws->radius;
2146 result = xRayHitsBoxFast(ray, &tmpbox);
2147 break;
2148 }
2149 case XBOUND_TYPE_OBB:
2150 {
2151 xBox tmpbox;
2152 xRay3 lr;
2153 xMat3x3 mn;
2154 F32 ms = xVec3Length(&ent->bound.mat->right);
2155 xMat3x3Normalize(&mn, ent->bound.mat);
2156 xMat4x3Tolocal(&lr.origin, ent->bound.mat, &ray->origin);
2157 xMat3x3Tolocal(&lr.dir, &mn, &ray->dir);
2158 lr.max_t = ray->max_t / ms;
2159 lr.min_t = ray->min_t / ms;
2160 lr.flags = ray->flags;
2161 tmpbox.upper.x = ent->bound.box.box.upper.x + sws->radius / ms;
2162 tmpbox.upper.y = ent->bound.box.box.upper.y + sws->radius / ms;
2163 tmpbox.upper.z = ent->bound.box.box.upper.z + sws->radius / ms;
2164 tmpbox.lower.x = ent->bound.box.box.lower.x - sws->radius / ms;
2165 tmpbox.lower.y = ent->bound.box.box.lower.y - sws->radius / ms;

Callers

nothing calls this directly

Calls 12

xVec3LengthFunction · 0.85
xMat3x3NormalizeFunction · 0.85
xMat4x3TolocalFunction · 0.85
xMat3x3TolocalFunction · 0.85
xModelAnimCollApplyFunction · 0.85
xModelAnimCollRestoreFunction · 0.85
xQuickCullIsectsFunction · 0.70
xRayHitsSphereFastFunction · 0.70
xRayHitsBoxFastFunction · 0.70
xSweptSphereToModelFunction · 0.70
xSweptSphereToSphereFunction · 0.70
xSweptSphereToBoxFunction · 0.70

Tested by

no test coverage detected