Skip to content

Commit

Permalink
VideoModes: fixed bug with selection of screen resolution & windowed …
Browse files Browse the repository at this point in the history
…mode
  • Loading branch information
SNMetamorph authored and a1batross committed Feb 15, 2021
1 parent 5c687e8 commit dffb12e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ ipch/
__pycache__
temp.txt
nonfree_translations
/.vs
26 changes: 18 additions & 8 deletions menus/VideoModes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,29 @@ UI_VidModes_SetConfig
void CMenuVidModes::SetConfig( )
{
bool testMode = false;
if( prevMode != vidList.GetCurrentIndex() - VID_MODES_POS )
int currentModeIndex = vidList.GetCurrentIndex() - VID_MODES_POS;
bool isVidModeChanged = prevMode != currentModeIndex;
bool isWindowedModeChanged = prevFullscreen != !windowed.bChecked;

/*
checking windowed mode first because it'll be checked next in
screen resolution changing code, otherwise when user try to
change screen resolution and windowed flag at same time,
only resolution will be changed.
*/
if( isWindowedModeChanged )
{
SetMode( vidList.GetCurrentIndex( ) - VID_MODES_POS );

// have changed resolution, but enable test mode only in fullscreen
EngFuncs::CvarSetValue( "fullscreen", !windowed.bChecked );
// moved to fullscreen, enable test mode
testMode |= !windowed.bChecked;
}

if( prevFullscreen == windowed.bChecked )
if( isVidModeChanged )
{
EngFuncs::CvarSetValue( "fullscreen", !windowed.bChecked );

// moved to fullscreen, enable test mode
SetMode( currentModeIndex );
EngFuncs::CvarSetValue( "vid_mode", currentModeIndex );
vidList.SetCurrentIndex( currentModeIndex + VID_MODES_POS );
// have changed resolution, but enable test mode only in fullscreen
testMode |= !windowed.bChecked;
}

Expand Down

0 comments on commit dffb12e

Please sign in to comment.