manually sets the cockpit display.
| 656 | |
| 657 | // manually sets the cockpit display. |
| 658 | void SetHUDMode(tHUDMode mode) { |
| 659 | static int saved_window_w = 0, saved_window_h = 0; |
| 660 | |
| 661 | if (Dedicated_server) |
| 662 | return; |
| 663 | |
| 664 | if (GetScreenMode() != SM_GAME) { |
| 665 | #ifdef _DEBUG |
| 666 | Int3(); |
| 667 | #endif |
| 668 | return; |
| 669 | } |
| 670 | |
| 671 | // clear the screen. |
| 672 | Clear_screen = 4; |
| 673 | |
| 674 | // free poly model of cockpit if we're not switching to a cockpit mode. |
| 675 | if (Hud_mode == HUD_COCKPIT && IsValidCockpit()) { |
| 676 | if (mode == HUD_LETTERBOX || mode == HUD_OBSERVER) { |
| 677 | QuickCloseCockpit(); |
| 678 | } else if (mode != HUD_COCKPIT) { |
| 679 | CloseCockpit(); |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | // do cockpit specific thing. |
| 684 | redo_hud_switch: |
| 685 | switch (mode) { |
| 686 | uint16_t cp_hud_stat, cp_hud_graphical_stat; |
| 687 | |
| 688 | case HUD_LETTERBOX: |
| 689 | // our objective here is to display a letterbox screen for the cockpit. |
| 690 | // we save the old width and height of the windows. |
| 691 | saved_window_w = Game_window_w; |
| 692 | saved_window_h = Game_window_h; |
| 693 | |
| 694 | Game_window_w = Max_window_w; |
| 695 | Game_window_h = Max_window_h - (Max_window_h / 3); |
| 696 | |
| 697 | if (Game_window_h > Max_window_h) |
| 698 | Game_window_h = Max_window_h; |
| 699 | |
| 700 | if (Game_window_w > Max_window_w) |
| 701 | Game_window_w = Max_window_w; |
| 702 | |
| 703 | Game_window_x = (Max_window_w - Game_window_w) / 2; |
| 704 | Game_window_y = (Max_window_h - Game_window_h) / 2; |
| 705 | |
| 706 | SetHUDState(STAT_MESSAGES | (Hud_stat_mask & STAT_FPS), 0); |
| 707 | break; |
| 708 | |
| 709 | case HUD_FULLSCREEN: |
| 710 | // our objective here is to display a fullscreen box that is resizable. |
| 711 | LoadHUDConfig(HUD_resources.hud_inf_name); |
| 712 | |
| 713 | InitGameScreen(saved_window_w ? saved_window_w : Game_window_w, saved_window_h ? saved_window_h : Game_window_h); |
| 714 | saved_window_w = 0; |
| 715 | saved_window_h = 0; |
no test coverage detected