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

Function xGridEntIsTooBig

src/SB/Core/x/xGrid.cpp:301–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301S32 xGridEntIsTooBig(xGrid* grid, const xEnt* ent)
302{
303 const xBound* bound = &ent->bound;
304 F32 maxr = grid->maxr;
305
306 if (bound->type == XBOUND_TYPE_SPHERE)
307 {
308 const xSphere* sph = &bound->sph;
309 if (sph->r >= maxr)
310 {
311 return 1;
312 }
313 }
314 else if (bound->type == XBOUND_TYPE_OBB)
315 {
316 const xBBox* bbox = &bound->box;
317 F32 rx = bbox->box.upper.x - bbox->box.lower.x;
318 F32 ry = bbox->box.upper.y - bbox->box.lower.y;
319 F32 rz = bbox->box.upper.z - bbox->box.lower.z;
320 F32 len2 =
321 SQR(rx) *
322 (SQR(bound->mat->right.x) + SQR(bound->mat->right.y) + SQR(bound->mat->right.z)) +
323 SQR(ry) * (SQR(bound->mat->up.x) + SQR(bound->mat->up.y) + SQR(bound->mat->up.z)) +
324 SQR(rz) * (SQR(bound->mat->at.x) + SQR(bound->mat->at.y) + SQR(bound->mat->at.z));
325 if (len2 >= 4.0f * maxr * maxr)
326 {
327 return 1;
328 }
329 }
330 else if (bound->type == XBOUND_TYPE_BOX)
331 {
332 const xBBox* bbox = &bound->box;
333 F32 rx = bbox->box.upper.x - bbox->box.lower.x;
334 F32 rz = bbox->box.upper.z - bbox->box.lower.z;
335 F32 len2 = SQR(rx) + SQR(rz);
336 if (len2 >= 4.0f * maxr * maxr)
337 {
338 return 1;
339 }
340 }
341
342 return 0;
343}
344
345void xGridCheckPosition(xGrid* grid, xVec3* pos, xQCData* qcd, xGridCheckPositionCallback hitCB,
346 void* cbdata)

Callers 3

zGridUpdateEntFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected