Browse Source

engine: platform: sdl: fix qboolean to window_mode_t conversions

pull/2/head
Alibek Omarov 1 year ago
parent
commit
59bfc8c32f
  1. 9
      engine/platform/sdl/vid_sdl.c

9
engine/platform/sdl/vid_sdl.c

@ -1111,6 +1111,7 @@ qboolean VID_SetMode( void )
{ {
int iScreenWidth, iScreenHeight; int iScreenWidth, iScreenHeight;
rserr_t err; rserr_t err;
window_mode_t window_mode;
iScreenWidth = Cvar_VariableInteger( "width" ); iScreenWidth = Cvar_VariableInteger( "width" );
iScreenHeight = Cvar_VariableInteger( "height" ); iScreenHeight = Cvar_VariableInteger( "height" );
@ -1143,7 +1144,9 @@ qboolean VID_SetMode( void )
SetBits( gl_vsync.flags, FCVAR_CHANGED ); SetBits( gl_vsync.flags, FCVAR_CHANGED );
if(( err = R_ChangeDisplaySettings( iScreenWidth, iScreenHeight, vid_fullscreen.value )) == rserr_ok ) window_mode = bound( 0, vid_fullscreen.value, WINDOW_MODE_COUNT - 1 );
if(( err = R_ChangeDisplaySettings( iScreenWidth, iScreenHeight, window_mode )) == rserr_ok )
{ {
sdlState.prev_width = iScreenWidth; sdlState.prev_width = iScreenWidth;
sdlState.prev_height = iScreenHeight; sdlState.prev_height = iScreenHeight;
@ -1155,7 +1158,7 @@ qboolean VID_SetMode( void )
Cvar_DirectSet( &vid_fullscreen, "0" ); Cvar_DirectSet( &vid_fullscreen, "0" );
Con_Reportf( S_ERROR "VID_SetMode: fullscreen unavailable in this mode\n" ); Con_Reportf( S_ERROR "VID_SetMode: fullscreen unavailable in this mode\n" );
Sys_Warn("fullscreen unavailable in this mode!"); Sys_Warn("fullscreen unavailable in this mode!");
if(( err = R_ChangeDisplaySettings( iScreenWidth, iScreenHeight, false )) == rserr_ok ) if(( err = R_ChangeDisplaySettings( iScreenWidth, iScreenHeight, window_mode )) == rserr_ok )
return true; return true;
} }
else if( err == rserr_invalid_mode ) else if( err == rserr_invalid_mode )
@ -1165,7 +1168,7 @@ qboolean VID_SetMode( void )
} }
// try setting it back to something safe // try setting it back to something safe
if(( err = R_ChangeDisplaySettings( sdlState.prev_width, sdlState.prev_height, false )) != rserr_ok ) if(( err = R_ChangeDisplaySettings( sdlState.prev_width, sdlState.prev_height, window_mode )) != rserr_ok )
{ {
Con_Reportf( S_ERROR "VID_SetMode: could not revert to safe mode\n" ); Con_Reportf( S_ERROR "VID_SetMode: could not revert to safe mode\n" );
Sys_Warn("could not revert to safe mode!"); Sys_Warn("could not revert to safe mode!");

Loading…
Cancel
Save