diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index 7add7450d5e..f8ec6ab8575 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -25,7 +25,7 @@ #include "c_dispatch.h" #include "c_cvars.h" -#define NUMSCALEMODES 11 +#define NUMSCALEMODES 5 namespace { @@ -41,19 +41,19 @@ namespace { // isValid, isLinear, GetScaledWidth(), GetScaledHeight(), isScaled43 { true, false, [](uint32_t Width)->uint32_t { return Width; }, [](uint32_t Height)->uint32_t { return Height; }, false }, // 0 - Native - { true, false, [](uint32_t Width)->uint32_t { return 320; }, [](uint32_t Height)->uint32_t { return 200; }, true }, // 1 - 320x200 - { true, true, [](uint32_t Width)->uint32_t { return 640; }, [](uint32_t Height)->uint32_t { return 400; }, true }, // 2 - 640x400 - { true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true }, // 3 - 1280x800 - { false, false, nullptr, nullptr, false }, // 4 - { false, false, nullptr, nullptr, false }, // 5 - { false, false, nullptr, nullptr, false }, // 6 - { false, false, nullptr, nullptr, false }, // 7 - { true, false, [](uint32_t Width)->uint32_t { return Width / 2; }, [](uint32_t Height)->uint32_t { return Height / 2; }, false }, // 8 - Half-Res - { true, true, [](uint32_t Width)->uint32_t { return Width * 0.75; }, [](uint32_t Height)->uint32_t { return Height * 0.75; }, false }, // 9 - Res * 0.75 - { true, true, [](uint32_t Width)->uint32_t { return Width * 2; }, [](uint32_t Height)->uint32_t { return Height * 2; }, false }, // 10 - SSAAx2 + { true, true, [](uint32_t Width)->uint32_t { return Width; }, [](uint32_t Height)->uint32_t { return Height; }, false }, // 1 - Native (Linear) + { true, false, [](uint32_t Width)->uint32_t { return 320; }, [](uint32_t Height)->uint32_t { return 200; }, true }, // 2 - 320x200 + { true, false, [](uint32_t Width)->uint32_t { return 640; }, [](uint32_t Height)->uint32_t { return 400; }, true }, // 3 - 640x400 + { true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true }, // 4 - 1280x800 }; } +CUSTOM_CVAR(Float, vid_scalefactor, 1.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +{ + if (self <= 0.0 || self > 2.0) + self = 1.0; +} + CUSTOM_CVAR(Int, vid_scalemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (self < 0 || self >= NUMSCALEMODES || vScaleTable[self].isValid == false) @@ -64,17 +64,18 @@ CUSTOM_CVAR(Int, vid_scalemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) bool ViewportLinearScale() { - return vScaleTable[vid_scalemode].isLinear; + // vid_scalefactor > 1 == forced linear scale + return (vid_scalefactor > 1.0) ? true : vScaleTable[vid_scalemode].isLinear; } int ViewportScaledWidth(int width) { - return vScaleTable[vid_scalemode].GetScaledWidth(width); + return vScaleTable[vid_scalemode].GetScaledWidth((int)((float)width * vid_scalefactor)); } int ViewportScaledHeight(int height) { - return vScaleTable[vid_scalemode].GetScaledHeight(height); + return vScaleTable[vid_scalemode].GetScaledHeight((int)((float)height * vid_scalefactor)); } bool ViewportIsScaled43() diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 3c20a7bfd84..95a13e513a6 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -2193,6 +2193,7 @@ VIDMNU_ASPECTRATIO = "Aspect ratio"; VIDMNU_FORCEASPECT = "Force aspect ratio"; VIDMNU_5X4ASPECTRATIO = "Enable 5:4 aspect ratio"; VIDMNU_SCALEMODE = "Resolution scale"; +VIDMNU_SCALEFACTOR = "Scale Factor"; VIDMNU_ENTERTEXT = "Press ENTER to set mode"; VIDMNU_TESTTEXT1 = "T to test mode for 5 seconds"; VIDMNU_TESTTEXT2 = "Please wait 5 seconds..."; @@ -2378,6 +2379,8 @@ OPTVAL_VTFZDOOM = "ZDoom (Forced)"; OPTVAL_VTFVANILLA = "Vanilla (Forced)"; OPTVAL_VTAZDOOM = "Auto (ZDoom Preferred)"; OPTVAL_VTAVANILLA = "Auto (Vanilla Preferred)"; +OPTVAL_SCALENEAREST = "Scaled (Nearest)"; +OPTVAL_SCALELINEAR = "Scaled (Linear)"; // Colors C_BRICK = "\cabrick"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 59c7946cb3a..38b447d4450 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1858,13 +1858,11 @@ OptionValue RatiosTFT } OptionValue ScaleModes { - 0, "$OPTVAL_OFF" - 1, "320x200" - 2, "640x400" - 3, "1280x800" - 8, "0.5x" - 9, "0.75x" - 10, "2x SSAA" + 0, "$OPTVAL_SCALENEAREST" + 1, "$OPTVAL_SCALELINEAR" + 2, "320x200" + 3, "640x400" + 4, "1280x800" } OptionMenu VideoModeMenu protected @@ -1880,6 +1878,7 @@ OptionMenu VideoModeMenu protected Option "$VIDMNU_FORCEASPECT", "vid_aspect", "ForceRatios" Option "$VIDMNU_5X4ASPECTRATIO", "vid_tft", "YesNo" Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes" + Slider "$VIDMNU_SCALEFACTOR", "vid_scalefactor", 0.25, 2.0, 0.25, 2 StaticText " " ScreenResolution "res_0" ScreenResolution "res_1"