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

Function xSweptSphereToNPC

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

Source from the content-addressed store, hash-verified

2294}
2295
2296S32 xSweptSphereToNPC(xSweptSphere* sws, xScene* sc, xEnt* mover, U8 collType)
2297{
2298 if (sws->dist == 0.0f)
2299 return 0;
2300
2301 sSweptSphereEntFound = 0;
2302 sSweptSphereMover = mover;
2303 sSweptSphereCollType = collType;
2304
2305 xRay3 ray;
2306 xVec3Copy(&ray.origin, &sws->start);
2307 xVec3Sub(&ray.dir, &sws->end, &sws->start);
2308 ray.max_t = xVec3Length(&ray.dir);
2309
2310 F32 one_len = 1.0f / MAX(ray.max_t, 0.00001f);
2311 xVec3SMul(&ray.dir, &ray.dir, one_len);
2312
2313 ray.flags = XRAY3_USE_MAX;
2314 if (!(ray.flags & XRAY3_USE_MIN))
2315 {
2316 ray.flags |= XRAY3_USE_MIN;
2317 ray.min_t = 0.0f;
2318 }
2319
2320 xRayHitsGrid(&npcs_grid, sc, &ray, SweptSphereHitsEntCB, &sws->qcd, sws);
2321
2322 return sSweptSphereEntFound;
2323}
2324
2325S32 xSweptSphereToNonMoving(xSweptSphere* sws, xScene* sc, xEnt* mover, U8 collType)
2326{

Callers

nothing calls this directly

Calls 5

xVec3CopyFunction · 0.85
xVec3SubFunction · 0.85
xVec3LengthFunction · 0.85
xVec3SMulFunction · 0.85
xRayHitsGridFunction · 0.70

Tested by

no test coverage detected