mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
- removed scale resolutions and added vid_scalefactor to replace them.
This commit is contained in:
parent
0924cc3f0f
commit
4b82bb50df
3 changed files with 24 additions and 21 deletions
|
@ -25,7 +25,7 @@
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
|
||||||
#define NUMSCALEMODES 11
|
#define NUMSCALEMODES 5
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -41,19 +41,19 @@ namespace
|
||||||
{
|
{
|
||||||
// isValid, isLinear, GetScaledWidth(), GetScaledHeight(), isScaled43
|
// 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 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 Width; }, [](uint32_t Height)->uint32_t { return Height; }, false }, // 1 - Native (Linear)
|
||||||
{ true, true, [](uint32_t Width)->uint32_t { return 640; }, [](uint32_t Height)->uint32_t { return 400; }, true }, // 2 - 640x400
|
{ true, false, [](uint32_t Width)->uint32_t { return 320; }, [](uint32_t Height)->uint32_t { return 200; }, true }, // 2 - 320x200
|
||||||
{ true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true }, // 3 - 1280x800
|
{ true, false, [](uint32_t Width)->uint32_t { return 640; }, [](uint32_t Height)->uint32_t { return 400; }, true }, // 3 - 640x400
|
||||||
{ false, false, nullptr, nullptr, false }, // 4
|
{ true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true }, // 4 - 1280x800
|
||||||
{ 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
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
CUSTOM_CVAR(Int, vid_scalemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
{
|
{
|
||||||
if (self < 0 || self >= NUMSCALEMODES || vScaleTable[self].isValid == false)
|
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()
|
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)
|
int ViewportScaledWidth(int width)
|
||||||
{
|
{
|
||||||
return vScaleTable[vid_scalemode].GetScaledWidth(width);
|
return vScaleTable[vid_scalemode].GetScaledWidth((int)((float)width * vid_scalefactor));
|
||||||
}
|
}
|
||||||
|
|
||||||
int ViewportScaledHeight(int height)
|
int ViewportScaledHeight(int height)
|
||||||
{
|
{
|
||||||
return vScaleTable[vid_scalemode].GetScaledHeight(height);
|
return vScaleTable[vid_scalemode].GetScaledHeight((int)((float)height * vid_scalefactor));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewportIsScaled43()
|
bool ViewportIsScaled43()
|
||||||
|
|
|
@ -2193,6 +2193,7 @@ VIDMNU_ASPECTRATIO = "Aspect ratio";
|
||||||
VIDMNU_FORCEASPECT = "Force aspect ratio";
|
VIDMNU_FORCEASPECT = "Force aspect ratio";
|
||||||
VIDMNU_5X4ASPECTRATIO = "Enable 5:4 aspect ratio";
|
VIDMNU_5X4ASPECTRATIO = "Enable 5:4 aspect ratio";
|
||||||
VIDMNU_SCALEMODE = "Resolution scale";
|
VIDMNU_SCALEMODE = "Resolution scale";
|
||||||
|
VIDMNU_SCALEFACTOR = "Scale Factor";
|
||||||
VIDMNU_ENTERTEXT = "Press ENTER to set mode";
|
VIDMNU_ENTERTEXT = "Press ENTER to set mode";
|
||||||
VIDMNU_TESTTEXT1 = "T to test mode for 5 seconds";
|
VIDMNU_TESTTEXT1 = "T to test mode for 5 seconds";
|
||||||
VIDMNU_TESTTEXT2 = "Please wait 5 seconds...";
|
VIDMNU_TESTTEXT2 = "Please wait 5 seconds...";
|
||||||
|
@ -2378,6 +2379,8 @@ OPTVAL_VTFZDOOM = "ZDoom (Forced)";
|
||||||
OPTVAL_VTFVANILLA = "Vanilla (Forced)";
|
OPTVAL_VTFVANILLA = "Vanilla (Forced)";
|
||||||
OPTVAL_VTAZDOOM = "Auto (ZDoom Preferred)";
|
OPTVAL_VTAZDOOM = "Auto (ZDoom Preferred)";
|
||||||
OPTVAL_VTAVANILLA = "Auto (Vanilla Preferred)";
|
OPTVAL_VTAVANILLA = "Auto (Vanilla Preferred)";
|
||||||
|
OPTVAL_SCALENEAREST = "Scaled (Nearest)";
|
||||||
|
OPTVAL_SCALELINEAR = "Scaled (Linear)";
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
C_BRICK = "\cabrick";
|
C_BRICK = "\cabrick";
|
||||||
|
|
|
@ -1858,13 +1858,11 @@ OptionValue RatiosTFT
|
||||||
}
|
}
|
||||||
OptionValue ScaleModes
|
OptionValue ScaleModes
|
||||||
{
|
{
|
||||||
0, "$OPTVAL_OFF"
|
0, "$OPTVAL_SCALENEAREST"
|
||||||
1, "320x200"
|
1, "$OPTVAL_SCALELINEAR"
|
||||||
2, "640x400"
|
2, "320x200"
|
||||||
3, "1280x800"
|
3, "640x400"
|
||||||
8, "0.5x"
|
4, "1280x800"
|
||||||
9, "0.75x"
|
|
||||||
10, "2x SSAA"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionMenu VideoModeMenu protected
|
OptionMenu VideoModeMenu protected
|
||||||
|
@ -1880,6 +1878,7 @@ OptionMenu VideoModeMenu protected
|
||||||
Option "$VIDMNU_FORCEASPECT", "vid_aspect", "ForceRatios"
|
Option "$VIDMNU_FORCEASPECT", "vid_aspect", "ForceRatios"
|
||||||
Option "$VIDMNU_5X4ASPECTRATIO", "vid_tft", "YesNo"
|
Option "$VIDMNU_5X4ASPECTRATIO", "vid_tft", "YesNo"
|
||||||
Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes"
|
Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes"
|
||||||
|
Slider "$VIDMNU_SCALEFACTOR", "vid_scalefactor", 0.25, 2.0, 0.25, 2
|
||||||
StaticText " "
|
StaticText " "
|
||||||
ScreenResolution "res_0"
|
ScreenResolution "res_0"
|
||||||
ScreenResolution "res_1"
|
ScreenResolution "res_1"
|
||||||
|
|
Loading…
Reference in a new issue