MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Use

Method Use

ogsr_engine/xrGame/Car.cpp:1446–1482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1444}
1445
1446bool CCar::Use(const Fvector& pos, const Fvector& dir, const Fvector& foot_pos)
1447{
1448 xr_map<u16, SDoor>::iterator i;
1449
1450 if (!Owner())
1451 {
1452 if (Enter(pos, dir, foot_pos))
1453 return true;
1454 }
1455
1456 RQR.r_clear();
1457 collide::ray_defs Q(pos, dir, 3.f, CDB::OPT_CULL, collide::rqtObject); // CDB::OPT_ONLYFIRST CDB::OPT_ONLYNEAREST
1458 VERIFY(!fis_zero(Q.dir.square_magnitude()));
1459 if (collidable.model && collidable.model->RayQuery(RQR, Q))
1460 {
1461 collide::rq_results& R = RQR;
1462 int y = R.r_count();
1463 for (int k = 0; k < y; ++k)
1464 {
1465 collide::rq_result* I = R.r_begin() + k;
1466 if (is_Door((u16)I->element, i))
1467 {
1468 bool front = i->second.IsFront(pos, dir);
1469 if ((Owner() && !front) || (!Owner() && front))
1470 i->second.Use();
1471 if (i->second.state == SDoor::broken)
1472 break;
1473 return false;
1474 }
1475 }
1476 }
1477
1478 if (Owner())
1479 return Exit(pos, dir);
1480
1481 return false;
1482}
1483bool CCar::DoorUse(u16 id)
1484{
1485 xr_map<u16, SDoor>::iterator i;

Callers 3

DoorUseMethod · 0.45
use_VehicleMethod · 0.45
use_MountedWeaponMethod · 0.45

Calls 8

fis_zeroFunction · 0.85
r_clearMethod · 0.80
RayQueryMethod · 0.80
r_countMethod · 0.80
IsFrontMethod · 0.80
OwnerFunction · 0.70
square_magnitudeMethod · 0.45
r_beginMethod · 0.45

Tested by

no test coverage detected