diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index b4ce895488..62043a6a82 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -1732,6 +1732,8 @@ class CommandAspectRatio : public SBarInfoCommandFlowControl ratio = ASPECTRATIO_16_9; else if(sc.Compare("16:10")) ratio = ASPECTRATIO_16_10; + else if(sc.Compare("17:10")) + ratio = ASPECTRATIO_17_10; else if(sc.Compare("5:4")) ratio = ASPECTRATIO_5_4; else @@ -1750,6 +1752,7 @@ class CommandAspectRatio : public SBarInfoCommandFlowControl ASPECTRATIO_4_3 = 0, ASPECTRATIO_16_9 = 1, ASPECTRATIO_16_10 = 2, + ASPECTRATIO_17_10 = 3, ASPECTRATIO_5_4 = 4 }; diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index 0d15904635..3e8f18ea83 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -83,15 +83,15 @@ int OldWidth, OldHeight, OldBits; static FIntCVar DummyDepthCvar (NULL, 0, 0); static BYTE BitTranslate[32]; -CUSTOM_CVAR (Int, menu_screenratios, 0, CVAR_ARCHIVE) +CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE) { - if (self < 0 || self > 4) + if (self < -1 || self > 4) { - self = 3; + self = -1; } else if (self == 4 && !vid_tft) { - self = 3; + self = 0; } else { @@ -213,7 +213,7 @@ static void BuildModesList (int hiwidth, int hiheight, int hi_bits) bool letterbox=false; int ratiomatch; - if (menu_screenratios >= 0 && menu_screenratios <= 4 && menu_screenratios != 3) + if (menu_screenratios >= 0 && menu_screenratios <= 4) { ratiomatch = menu_screenratios; } diff --git a/src/v_video.cpp b/src/v_video.cpp index f2436862bf..cef81aba54 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1635,16 +1635,25 @@ CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // 0: 4:3 // 1: 16:9 // 2: 16:10 +// 3: 17:10 // 4: 5:4 int CheckRatio (int width, int height, int *trueratio) { int fakeratio = -1; int ratio; - if ((vid_aspect >=1) && (vid_aspect <=4)) + if ((vid_aspect >= 1) && (vid_aspect <= 5)) { // [SP] User wants to force aspect ratio; let them. - fakeratio = vid_aspect == 3? 0: int(vid_aspect); + fakeratio = int(vid_aspect); + if (fakeratio == 3) + { + fakeratio = 0; + } + else if (fakeratio == 5) + { + fakeratio = 3; + } } if (vid_nowidescreen) { @@ -1662,6 +1671,11 @@ int CheckRatio (int width, int height, int *trueratio) { ratio = 1; } + // Consider 17:10 as well. + else if (abs (height * 17/10 - width) < 10) + { + ratio = 3; + } // 16:10 has more variance in the pixel dimensions. Grr. else if (abs (height * 16/10 - width) < 60) { @@ -1680,7 +1694,7 @@ int CheckRatio (int width, int height, int *trueratio) { ratio = 4; } - // Assume anything else is 4:3. + // Assume anything else is 4:3. (Which is probably wrong these days...) else { ratio = 0; @@ -1693,16 +1707,21 @@ int CheckRatio (int width, int height, int *trueratio) return (fakeratio >= 0) ? fakeratio : ratio; } -// First column: Base width (unused) +// First column: Base width // Second column: Base height (used for wall visibility multiplier) // Third column: Psprite offset (needed for "tallscreen" modes) // Fourth column: Width or height multiplier + +// For widescreen aspect ratio x:y ... +// base_width = 240 * x / y +// multiplier = 320 / base_width +// base_height = 200 * multiplier const int BaseRatioSizes[5][4] = { { 960, 600, 0, 48 }, // 4:3 320, 200, multiplied by three { 1280, 450, 0, 48*3/4 }, // 16:9 426.6667, 150, multiplied by three { 1152, 500, 0, 48*5/6 }, // 16:10 386, 166.6667, multiplied by three - { 960, 600, 0, 48 }, + { 1224, 471, 0, 48*40/51 }, // 17:10 408, 156.8627, multiplied by three { 960, 640, (int)(6.5*FRACUNIT), 48*15/16 } // 5:4 320, 213.3333, multiplied by three }; diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index 6408e9279b..6b3f40f1cd 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -338,7 +338,7 @@ CUSTOM_CVAR (Float, vid_winscale, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CCMD (vid_listmodes) { - static const char *ratios[5] = { "", " - 16:9", " - 16:10", "", " - 5:4" }; + static const char *ratios[5] = { "", " - 16:9", " - 16:10", " - 17:10", " - 5:4" }; int width, height, bits; bool letterbox; diff --git a/src/win32/win32video.cpp b/src/win32/win32video.cpp index d82744ef79..494df774d5 100644 --- a/src/win32/win32video.cpp +++ b/src/win32/win32video.cpp @@ -449,6 +449,8 @@ void Win32Video::AddLowResModes() { ModeInfo *mode, *nextmode; + AddMode(1024,600, 8, 600, 0); + for (mode = m_Modes; mode != NULL; mode = nextmode) { nextmode = mode->next; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 03f0baeac0..e27ba1036e 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1429,26 +1429,29 @@ OptionMenu ModReplayerOptions OptionValue ForceRatios { - 0.0, "Off" - 3.0, "4:3" - 1.0, "16:9" - 2.0, "16:10" + 0.0, "Off" + 3.0, "4:3" + 1.0, "16:9" + 5.0, "17:10" + 2.0, "16:10" 4.0, "5:4" } OptionValue Ratios { - 0.0, "4:3" - 1.0, "16:9" - 2.0, "16:10" - 3.0, "All" + 0.0, "4:3" + 1.0, "16:9" + 2.0, "16:10" + 3.0, "17:10" + -1, "All" } OptionValue RatiosTFT { - 0.0, "4:3" - 4.0, "5:4" - 1.0, "16:9" - 2.0, "16:10" - 3.0, "All" + 0.0, "4:3" + 4.0, "5:4" + 1.0, "16:9" + 2.0, "16:10" + 3.0, "17:10" + -1, "All" } OptionMenu VideoModeMenu