Draw all the active small views
| 396 | |
| 397 | // Draw all the active small views |
| 398 | void DrawSmallViews() { |
| 399 | int v; |
| 400 | small_view *svp; |
| 401 | int left, top, right, bot; |
| 402 | ddgr_color outline_color; |
| 403 | vector *viewer_eye, gun_pos; |
| 404 | matrix *viewer_orient, gun_orient; |
| 405 | matrix save_orient; |
| 406 | vector save_eye; |
| 407 | int viewer_roomnum; |
| 408 | |
| 409 | // if letterbox, don't draw the small views |
| 410 | if (GetHUDMode() == HUD_LETTERBOX) |
| 411 | return; |
| 412 | |
| 413 | bool lsave = Detail_settings.Dynamic_lighting; |
| 414 | |
| 415 | g3_GetUnscaledMatrix(&save_orient); |
| 416 | g3_GetViewPosition(&save_eye); |
| 417 | |
| 418 | Detail_settings.Dynamic_lighting = false; |
| 419 | |
| 420 | for (v = 0, svp = Small_views; v < NUM_SMALL_VIEWS; v++, svp++) { |
| 421 | if (svp->objhandle == OBJECT_HANDLE_NONE) |
| 422 | continue; |
| 423 | |
| 424 | object *viewer = ObjGet(svp->objhandle); |
| 425 | bool kill_viewer = false; |
| 426 | |
| 427 | // Bail if object not around any more, or if its gone too high |
| 428 | if (!viewer || (viewer->type == OBJ_DUMMY)) |
| 429 | kill_viewer = true; |
| 430 | |
| 431 | if (viewer && OBJECT_OUTSIDE(viewer) && viewer->pos.y >= MAX_TERRAIN_HEIGHT) |
| 432 | kill_viewer = true; |
| 433 | |
| 434 | // If not view & not already static, switch to static |
| 435 | if (kill_viewer && !(svp->flags & SVF_STATIC)) { |
| 436 | // Viewer is dead, so switch to static |
| 437 | svp->flags |= SVF_STATIC | SVF_TIMED; |
| 438 | svp->timer = STATIC_TIME; |
| 439 | svp->gun_num = -1; |
| 440 | } |
| 441 | |
| 442 | if (v == SVW_CENTER) // no center window for now |
| 443 | Int3(); |
| 444 | |
| 445 | if (CockpitState() == COCKPIT_STATE_QUASI) { |
| 446 | continue; |
| 447 | } |
| 448 | |
| 449 | else if (CockpitState() == COCKPIT_STATE_FUNCTIONAL) { |
| 450 | // draw on the cockpit |
| 451 | if (!GetCockpitWindowCoords((v == SVW_LEFT) ? 0 : 1, &left, &top, &right, &bot)) { |
| 452 | continue; |
| 453 | } |
| 454 | |
| 455 | // Move relative to the current window |
no test coverage detected