Change swtruecolor cvar to take effect immediately

This commit is contained in:
Magnus Norddahl 2016-06-01 06:02:37 +02:00
parent e929eec80f
commit b9d7a98aec
4 changed files with 30 additions and 19 deletions

View file

@ -96,7 +96,16 @@ EXTERN_CVAR(Bool, ticker )
EXTERN_CVAR(Bool, vid_vsync)
EXTERN_CVAR(Bool, vid_hidpi)
CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE)
CUSTOM_CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
// Strictly speaking this doesn't require a mode switch, but it is the easiest
// way to force a CreateFramebuffer call without a lot of refactoring.
extern int NewWidth, NewHeight, NewBits, DisplayBits;
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewBits = DisplayBits;
setmodeneeded = true;
}
CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{

View file

@ -281,10 +281,18 @@ CUSTOM_CVAR (Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
}
}
CVAR (Bool, swtruecolor, false, CVAR_ARCHIVE)
extern int NewWidth, NewHeight, NewBits, DisplayBits;
CUSTOM_CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
// Strictly speaking this doesn't require a mode switch, but it is the easiest
// way to force a CreateFramebuffer call without a lot of refactoring.
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewBits = DisplayBits;
setmodeneeded = true;
}
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
NewWidth = screen->GetWidth();

View file

@ -311,10 +311,18 @@ void I_RestoreWindowedPos ()
MoveWindow (Window, winx, winy, winw, winh, TRUE);
}
CVAR (Bool, swtruecolor, false, CVAR_ARCHIVE)
extern int NewWidth, NewHeight, NewBits, DisplayBits;
CUSTOM_CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
// Strictly speaking this doesn't require a mode switch, but it is the easiest
// way to force a CreateFramebuffer call without a lot of refactoring.
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewBits = DisplayBits;
setmodeneeded = true;
}
CUSTOM_CVAR (Bool, fullscreen, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
NewWidth = screen->GetWidth();

View file

@ -221,22 +221,8 @@ bool Win32Video::InitD3D9 ()
// Enumerate available display modes.
FreeModes ();
#ifndef PALETTEOUTPUT // To do: remove this again (AddD3DModes fails when there are too many modes available for videomenu to display)
AddMode(320, 200, 8, 200, 0);
AddMode(320, 240, 8, 240, 0);
AddMode(640, 480, 8, 480, 0);
AddMode(800, 600, 8, 600, 0);
AddMode(1024, 768, 8, 768, 0);
AddMode(1920, 1080, 8, 1080, 0); // 1080p
AddMode(1920*2, 1080*2, 8, 1080*2, 0); // 4k
AddMode(2560, 1440, 8, 1440, 0); // 27" classic
AddMode(2560*2, 1440*2, 8, 1440*2, 0); // 5k
#else
AddD3DModes (m_Adapter, D3DFMT_X8R8G8B8);
AddD3DModes (m_Adapter, D3DFMT_R5G6B5);
#endif
if (Args->CheckParm ("-2"))
{ // Force all modes to be pixel-doubled.
ScaleModes (1);