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

View file

@ -850,6 +850,9 @@ DFrameBuffer::DFrameBuffer (int width, int height)
{ {
LastMS = LastSec = FrameCount = LastCount = LastTic = 0; LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
Accel2D = false; Accel2D = false;
VideoWidth = width;
VideoHeight = height;
} }
//========================================================================== //==========================================================================
@ -1352,6 +1355,7 @@ void V_OutputResized (int width, int height)
{ {
StatusBar->ScreenSizeChanged(); StatusBar->ScreenSizeChanged();
} }
C_NewModeAdjust();
} }
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2) 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; virtual bool Is8BitMode() = 0;
#endif #endif
// The original size of the framebuffer as selected in the video menu.
int VideoWidth = 0;
int VideoHeight = 0;
protected: protected:
void DrawRateStuff (); void DrawRateStuff ();
void CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest); void CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest);