- Add 17:10 aspect ratio, for 1024x600 screens.

SVN r3482 (trunk)
This commit is contained in:
Randy Heit 2012-03-25 02:57:28 +00:00
parent cc34f973e2
commit 23e88c88c9
6 changed files with 51 additions and 24 deletions

View File

@ -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
};

View File

@ -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;
}

View File

@ -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
};

View File

@ -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;

View File

@ -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;

View File

@ -1432,6 +1432,7 @@ OptionValue ForceRatios
0.0, "Off"
3.0, "4:3"
1.0, "16:9"
5.0, "17:10"
2.0, "16:10"
4.0, "5:4"
}
@ -1440,7 +1441,8 @@ OptionValue Ratios
0.0, "4:3"
1.0, "16:9"
2.0, "16:10"
3.0, "All"
3.0, "17:10"
-1, "All"
}
OptionValue RatiosTFT
{
@ -1448,7 +1450,8 @@ OptionValue RatiosTFT
4.0, "5:4"
1.0, "16:9"
2.0, "16:10"
3.0, "All"
3.0, "17:10"
-1, "All"
}
OptionMenu VideoModeMenu