Fix video mode selection bug

This commit is contained in:
Magnus Norddahl 2016-09-14 23:38:11 +02:00 committed by Christoph Oelckers
parent cb17e109f1
commit 48f491cfd1
3 changed files with 20 additions and 12 deletions

View file

@ -95,7 +95,7 @@ CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE)
}
else
{
BuildModesList (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
BuildModesList (screen->VideoWidth, screen->VideoHeight, DisplayBits);
}
}
@ -139,7 +139,7 @@ public:
DVideoModeMenu()
{
SetModesMenu (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
SetModesMenu (screen->VideoWidth, screen->VideoHeight, DisplayBits);
}
bool MenuEvent(int mkey, bool fromcontroller)
@ -163,13 +163,13 @@ public:
{
if (!GetSelectedSize (&NewWidth, &NewHeight))
{
NewWidth = SCREENWIDTH;
NewHeight = SCREENHEIGHT;
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
}
else
{
OldWidth = SCREENWIDTH;
OldHeight = SCREENHEIGHT;
OldWidth = screen->VideoWidth;
OldHeight = screen->VideoHeight;
OldBits = DisplayBits;
NewBits = BitTranslate[DummyDepthCvar];
setmodeneeded = true;
@ -297,11 +297,11 @@ void M_RestoreMode ()
void M_SetDefaultMode ()
{
// Make current resolution the default
vid_defwidth = SCREENWIDTH;
vid_defheight = SCREENHEIGHT;
vid_defwidth = screen->VideoWidth;
vid_defheight = screen->VideoHeight;
vid_defbits = DisplayBits;
testingmode = 0;
SetModesMenu (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
SetModesMenu (screen->VideoWidth, screen->VideoHeight, DisplayBits);
}
@ -314,7 +314,7 @@ void M_SetDefaultMode ()
void M_RefreshModesList ()
{
BuildModesList (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
BuildModesList (screen->VideoWidth, screen->VideoHeight, DisplayBits);
}
void M_InitVideoModesMenu ()
@ -385,8 +385,8 @@ void M_SetVideoMode()
{
if (!GetSelectedSize (&NewWidth, &NewHeight))
{
NewWidth = SCREENWIDTH;
NewHeight = SCREENHEIGHT;
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
}
else
{

View file

@ -850,6 +850,9 @@ DFrameBuffer::DFrameBuffer (int width, int height)
{
LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
Accel2D = false;
VideoWidth = width;
VideoHeight = height;
}
//==========================================================================
@ -1352,6 +1355,7 @@ void V_OutputResized (int width, int height)
{
StatusBar->ScreenSizeChanged();
}
C_NewModeAdjust();
}
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2)

View file

@ -422,6 +422,10 @@ public:
virtual bool Is8BitMode() = 0;
#endif
// The original size of the framebuffer as selected in the video menu.
int VideoWidth = 0;
int VideoHeight = 0;
protected:
void DrawRateStuff ();
void CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest);