| 454 | } |
| 455 | |
| 456 | static RpCollisionTriangle* sphereHitsEnv4CB(RpIntersection* isx, RpWorldSector* sector, |
| 457 | RpCollisionTriangle* tri, F32 dist, void* data) |
| 458 | { |
| 459 | xCollis* colls = (xCollis*)data; |
| 460 | F32 radius = isx->t.line.end.x; |
| 461 | xVec3 tohit; |
| 462 | xCollis temp; |
| 463 | U8 idx; |
| 464 | xCollis* c; |
| 465 | F32 ddist; |
| 466 | |
| 467 | dist = FLOAT_MAX; |
| 468 | properSphereIsectTri((xVec3*)&isx->t.line.start, radius, &tohit, &dist, tri); |
| 469 | if (0.0f == dist) |
| 470 | { |
| 471 | return tri; |
| 472 | } |
| 473 | if (dist > radius) |
| 474 | { |
| 475 | return tri; |
| 476 | } |
| 477 | |
| 478 | if (sCollidingJSP != NULL) |
| 479 | { |
| 480 | if (*(U8*)(tri->index + 4) & 0x10) |
| 481 | { |
| 482 | temp.flags = 0x20000; |
| 483 | } |
| 484 | else |
| 485 | { |
| 486 | temp.flags = 0; |
| 487 | } |
| 488 | } |
| 489 | else |
| 490 | { |
| 491 | temp.flags = 0; |
| 492 | } |
| 493 | |
| 494 | temp.optr = NULL; |
| 495 | idx = xCollideGetCollsIdx(&temp, &tohit, cbmat); |
| 496 | |
| 497 | c = &colls[idx & 0xff]; |
| 498 | ddist = dist - c->dist; |
| 499 | |
| 500 | if (!(dist < 0.0f || (ddist < 0.001f && c->norm.y > tri->normal.y))) |
| 501 | { |
| 502 | return tri; |
| 503 | } |
| 504 | |
| 505 | c->dist = dist; |
| 506 | c->tohit = tohit; |
| 507 | c->norm.x = tri->normal.x; |
| 508 | c->norm.y = tri->normal.y; |
| 509 | c->norm.z = tri->normal.z; |
| 510 | c->tri.index = tri->index; |
| 511 | c->flags |= 1; |
| 512 | |
| 513 | if (sCollidingJSP != NULL && *(U8*)(tri->index + 4) & 0x10) |
nothing calls this directly
no test coverage detected