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

Function SetScreenMode

Descent3/game.cpp:921–1112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

919int Low_vidmem = 0;
920
921void SetScreenMode(int sm, bool force_res_change) {
922 static int old_sm = SM_NULL;
923 static int rend_width = 0, rend_height = 0;
924 rendering_state rs;
925
926 if (sm == SM_CINEMATIC) {
927 // force cinematic to menu
928 sm = SM_MENU;
929 }
930
931 if (Dedicated_server)
932 return;
933
934 if (old_sm == sm && !force_res_change)
935 return;
936
937 // close down any systems previously opened and that must be closed (like software->hardware, etc.)
938 // make sure renderer is initialized
939 // also set any preferred renderer states.
940 if (sm == SM_NULL) { // || (sm == SM_CINEMATIC && Renderer_type == RENDERER_OPENGL)) {
941 if (rend_initted) {
942 rend_Close();
943 rend_initted = 0;
944 }
945 } else if (sm == SM_CINEMATIC) { // && (Renderer_type == RENDERER_OPENGL || Renderer_type == RENDERER_DIRECT3D)) {
946 if (rend_initted) {
947 rend_Close();
948 rend_initted = 0;
949 }
950 }
951 else {
952 int scr_width, scr_height, scr_bitdepth;
953
954 if (sm == SM_GAME) {
955 scr_width = Video_res_list[Game_video_resolution].width;
956 scr_height = Video_res_list[Game_video_resolution].height;
957 scr_bitdepth = Render_preferred_bitdepth;
958 } else {
959 scr_width = FIXED_SCREEN_WIDTH;
960 scr_height = FIXED_SCREEN_HEIGHT;
961 scr_bitdepth = 32;
962 }
963
964 if (!rend_initted) {
965
966 Render_preferred_state.width = scr_width;
967 Render_preferred_state.height = scr_height;
968 Render_preferred_state.bit_depth = scr_bitdepth;
969
970 rend_initted = rend_Init(PreferredRenderer, Descent, &Render_preferred_state);
971 rend_width = rend_height = 0;
972 } else {
973
974 // If bitdepth changed but not initting, switch bitdepth
975 if (Render_preferred_state.bit_depth != scr_bitdepth) {
976 Render_preferred_state.bit_depth = scr_bitdepth;
977 rend_SetPreferredState(&Render_preferred_state);
978 }

Callers 15

GameSequencerFunction · 0.85
StartLevelFunction · 0.85
MainMultiplayerMenuFunction · 0.85
DisplayNetDLLHelpFunction · 0.85
PostLevelResultsFunction · 0.85
CtlConfigFunction · 0.85
TelComShowFunction · 0.85
ShutdownD3Function · 0.85
RestartD3Function · 0.85
DoMessageBoxFunction · 0.85
DoMessageBoxAdvancedFunction · 0.85
DoEditDialogFunction · 0.85

Calls 15

ErrorFunction · 0.85
ddvid_SetVideoModeFunction · 0.85
SelectHUDFontFunction · 0.85
InitGameScreenFunction · 0.85
ui_SetScreenModeFunction · 0.85
ui_HideCursorFunction · 0.85
SetUICallbackFunction · 0.85
ui_ShowCursorFunction · 0.85
SetMoviePropertiesFunction · 0.85
get_hud_dataMethod · 0.80
set_hud_dataMethod · 0.80
FindArgFunction · 0.70

Tested by

no test coverage detected