| 1444 | } |
| 1445 | |
| 1446 | bool 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 | } |
| 1483 | bool CCar::DoorUse(u16 id) |
| 1484 | { |
| 1485 | xr_map<u16, SDoor>::iterator i; |