MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / SetHUDMode

Function SetHUDMode

Descent3/hud.cpp:658–769  ·  view source on GitHub ↗

manually sets the cockpit display.

Source from the content-addressed store, hash-verified

656
657// manually sets the cockpit display.
658void 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.
684redo_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;

Callers 14

GameSequencerFunction · 0.85
StartLevelFunction · 0.85
ProcessTestKeysFunction · 0.85
MultiDoBashPlayerShipFunction · 0.85
ToggleHUDModeFunction · 0.85
ChangePlayerShipIndexFunction · 0.85
DemoReadHeaderFunction · 0.85
DoNewPlayerDeathFrameFunction · 0.85
EndPlayerDeathFunction · 0.85
StartPlayerExplosionFunction · 0.85
PlayerSwitchToObserverFunction · 0.85
PlayerStopObservingFunction · 0.85

Calls 13

GetScreenModeFunction · 0.85
IsValidCockpitFunction · 0.85
QuickCloseCockpitFunction · 0.85
CloseCockpitFunction · 0.85
SetHUDStateFunction · 0.85
LoadHUDConfigFunction · 0.85
InitGameScreenFunction · 0.85
AddHUDMessageFunction · 0.85
QuickOpenCockpitFunction · 0.85
OpenCockpitFunction · 0.85
PltWriteFileFunction · 0.85
get_hud_dataMethod · 0.80

Tested by

no test coverage detected