| 277 | #include "visual_memory_manager.h" |
| 278 | |
| 279 | bool CCar::isObjectVisible(CScriptGameObject* O_) |
| 280 | { |
| 281 | if (m_memory) |
| 282 | { |
| 283 | return m_memory->visual().visible_now(&O_->object()); |
| 284 | } |
| 285 | else |
| 286 | { |
| 287 | if (!O_) |
| 288 | { |
| 289 | Msg("Attempt to call CCar::isObjectVisible method wihth passed NULL parameter"); |
| 290 | return false; |
| 291 | } |
| 292 | CObject* O = &O_->object(); |
| 293 | Fvector dir_to_object; |
| 294 | Fvector to_point; |
| 295 | O->Center(to_point); |
| 296 | |
| 297 | Fvector from_point; |
| 298 | Center(from_point); |
| 299 | |
| 300 | if (HasWeapon()) |
| 301 | { |
| 302 | from_point.y = XFORM().c.y + m_car_weapon->_height(); |
| 303 | } |
| 304 | |
| 305 | dir_to_object.sub(to_point, from_point).normalize_safe(); |
| 306 | float ray_length = from_point.distance_to(to_point); |
| 307 | |
| 308 | BOOL res = Level().ObjectSpace.RayTest(from_point, dir_to_object, ray_length, collide::rqtStatic, NULL, NULL); |
| 309 | return (0 == res); |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | bool CCar::HasWeapon() { return (m_car_weapon != NULL); } |
| 314 |
nothing calls this directly
no test coverage detected