MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / fvi_QuickRoomCheck

Function fvi_QuickRoomCheck

physics/findintersection.cpp:2309–2451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2307}
2308
2309bool fvi_QuickRoomCheck(vector *pos, room *cur_room, bool try_again) {
2310 vector hit_point; // where we hit
2311 vector colp;
2312 float cur_dist; // distance to hit point
2313 int i;
2314 bool f_in_room = true;
2315
2316internal_try_again:
2317
2318 int closest_hit_type = 0;
2319 float closest_hit_distance = 10000000.0f;
2320
2321 vector min_xyz;
2322 vector max_xyz;
2323 vector new_pos;
2324
2325 if (!(cur_room->used) || (cur_room->flags & RF_EXTERNAL))
2326 return false;
2327
2328 new_pos = min_xyz = max_xyz = *pos;
2329
2330 if (!try_again) {
2331 new_pos.x += 10000000.0f;
2332 max_xyz.x += 10000000.0f;
2333 } else {
2334 new_pos.z -= 10000000.0f;
2335 min_xyz.z -= 10000000.0f;
2336 new_pos.y -= 10000000.0f;
2337 min_xyz.y -= 10000000.0f;
2338 new_pos.x -= 10000000.0f;
2339 min_xyz.x -= 10000000.0f;
2340 }
2341 // mprintf(0, "Checking room %d ", ROOMNUM(cur_room));
2342
2343 // sort shit
2344 uint8_t msector = 0;
2345
2346 if (min_xyz.x <= cur_room->bbf_min_xyz.x) {
2347 msector |= 0x01;
2348 }
2349 if (min_xyz.y <= cur_room->bbf_min_xyz.y) {
2350 msector |= 0x02;
2351 }
2352 if (min_xyz.z <= cur_room->bbf_min_xyz.z) {
2353 msector |= 0x04;
2354 }
2355 if (max_xyz.x >= cur_room->bbf_max_xyz.x) {
2356 msector |= 0x08;
2357 }
2358 if (max_xyz.y >= cur_room->bbf_max_xyz.y) {
2359 msector |= 0x10;
2360 }
2361 if (max_xyz.z >= cur_room->bbf_max_xyz.z) {
2362 msector |= 0x20;
2363 }
2364
2365 const int16_t num_bbf_regions = cur_room->num_bbf_regions;
2366 int16_t *num_faces_ptr = cur_room->num_bbf;

Callers 4

fvi_FindIntersectionFunction · 0.85
FindPointRoomFunction · 0.85
DrawRoomVisPntsFunction · 0.85
MakeBOAVisTableFunction · 0.85

Calls 2

room_manual_AABBFunction · 0.85
check_line_to_faceFunction · 0.85

Tested by

no test coverage detected