mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-04 01:41:40 +00:00
Improve R_GetModeListForDisplay()
* Fixed small bug when only one display mode was found by SDL2 * removed some redundant and dead code * improved warnings
This commit is contained in:
parent
4863f11607
commit
b1dabf3efd
1 changed files with 6 additions and 11 deletions
|
@ -459,7 +459,7 @@ bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>&
|
||||||
}
|
}
|
||||||
|
|
||||||
int numModes = SDL_GetNumDisplayModes( requestedDisplayNum );
|
int numModes = SDL_GetNumDisplayModes( requestedDisplayNum );
|
||||||
if( numModes > 1 )
|
if( numModes > 0 )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < numModes; i++ )
|
for( int i = 0; i < numModes; i++ )
|
||||||
{
|
{
|
||||||
|
@ -480,24 +480,21 @@ bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>&
|
||||||
|
|
||||||
if( modeList.Num() < 1 )
|
if( modeList.Num() < 1 )
|
||||||
{
|
{
|
||||||
common->Warning( "Couldn't get information for a single video mode, using default ones..!\n" );
|
common->Warning( "Couldn't get a single video mode for display %i, using default ones..!\n", requestedDisplayNum );
|
||||||
FillStaticVidModes( modeList );
|
FillStaticVidModes( modeList );
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort with lowest resolution first
|
// sort with lowest resolution first
|
||||||
modeList.SortWithTemplate( idSort_VidMode() );
|
modeList.SortWithTemplate( idSort_VidMode() );
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
common->Warning( "Can't get Video Info!\n" );
|
common->Warning( "Can't get Video Info, using default modes...\n" );
|
||||||
if( numModes < 0 )
|
if( numModes < 0 )
|
||||||
{
|
{
|
||||||
common->Warning( "Reason was: %s\n", SDL_GetError() );
|
common->Warning( "Reason was: %s\n", SDL_GetError() );
|
||||||
}
|
}
|
||||||
FillStaticVidModes( modeList );
|
FillStaticVidModes( modeList );
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -513,13 +510,11 @@ bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>&
|
||||||
}
|
}
|
||||||
// DG end
|
// DG end
|
||||||
|
|
||||||
bool verbose = false;
|
|
||||||
|
|
||||||
const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo();
|
const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo();
|
||||||
if( videoInfo == NULL )
|
if( videoInfo == NULL )
|
||||||
{
|
{
|
||||||
// DG: yes, this can actually fail, e.g. if SDL_Init( SDL_INIT_VIDEO ) wasn't called
|
// DG: yes, this can actually fail, e.g. if SDL_Init( SDL_INIT_VIDEO ) wasn't called
|
||||||
common->Warning( "Can't get Video Info!\n" );
|
common->Warning( "Can't get Video Info, using default modes...\n" );
|
||||||
FillStaticVidModes( modeList );
|
FillStaticVidModes( modeList );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +523,7 @@ bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>&
|
||||||
|
|
||||||
if( !modes )
|
if( !modes )
|
||||||
{
|
{
|
||||||
common->Warning( "Can't get list of available modes\n" );
|
common->Warning( "Can't get list of available modes, using default ones...\n" );
|
||||||
FillStaticVidModes( modeList );
|
FillStaticVidModes( modeList );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue