- make the clean scaling system more consistent.
Now, all menus will use the same scale, i.e. it only depends on the screen width and a base size of 640. This nearly universally yields better results than trying to make a 320x200 screen fit. The only exceptions to this are the intermission screens and the level summary. These, unlike the menu need to try to make a 320x200 screen fit, but without all the hackery that was present to adjust the menu display. Note that since this affects globally visible script variables, both the intermission and summary drawers will not use their own set but instead temporarily override the global setting as long as they run their own code. Changing the use of variables here might cause much worse problems with menu code so it wasn't attempted
This commit is contained in:
parent
0ff703c361
commit
4f7ad5b130
4 changed files with 49 additions and 56 deletions
|
|
@ -539,13 +539,10 @@ CCMD(clean)
|
|||
|
||||
|
||||
void V_UpdateModeSize (int width, int height)
|
||||
{
|
||||
int cx1, cx2;
|
||||
V_CalcCleanFacs(320, 200, width, height, &CleanXfac, &CleanYfac, &cx1, &cx2);
|
||||
|
||||
CleanWidth = width / CleanXfac;
|
||||
CleanHeight = height / CleanYfac;
|
||||
assert(CleanWidth >= 320 && CleanHeight >= 200);
|
||||
{
|
||||
// This calculates the menu scale.
|
||||
// The optimal scale will always be to fit a virtual 640 pixel wide display onto the screen.
|
||||
// Exceptions are made for a few ranges where the available virtual width is > 480.
|
||||
|
||||
int w = screen->GetWidth();
|
||||
int factor;
|
||||
|
|
@ -554,9 +551,9 @@ void V_UpdateModeSize (int width, int height)
|
|||
else if (w >= 1600 && w < 1920) factor = 3;
|
||||
else factor = w / 640;
|
||||
|
||||
CleanXfac_1 = CleanYfac_1 = factor;
|
||||
CleanWidth_1 = width / CleanXfac_1;
|
||||
CleanHeight_1 = height / CleanYfac_1;
|
||||
CleanXfac = CleanYfac = CleanXfac_1 = CleanYfac_1 = factor;
|
||||
CleanWidth = CleanWidth_1 = width / CleanXfac_1;
|
||||
CleanHeight = CleanHeight_1 = height / CleanYfac_1;
|
||||
|
||||
DisplayWidth = width;
|
||||
DisplayHeight = height;
|
||||
|
|
@ -581,52 +578,8 @@ void V_OutputResized (int width, int height)
|
|||
|
||||
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2)
|
||||
{
|
||||
float ratio;
|
||||
int cwidth;
|
||||
int cheight;
|
||||
int cx1, cy1, cx2, cy2;
|
||||
|
||||
// For larger screems always use at least a 16:9 ratio for clean factor calculation, even if the actual ratio is narrower.
|
||||
if (realwidth > 1280 && (double)realwidth / realheight < 16./9)
|
||||
{
|
||||
realheight = realwidth * 9 / 16;
|
||||
}
|
||||
|
||||
ratio = ActiveRatio(realwidth, realheight);
|
||||
if (AspectTallerThanWide(ratio))
|
||||
{
|
||||
cwidth = realwidth;
|
||||
cheight = realheight * AspectMultiplier(ratio) / 48;
|
||||
}
|
||||
else
|
||||
{
|
||||
cwidth = realwidth * AspectMultiplier(ratio) / 48;
|
||||
cheight = realheight;
|
||||
}
|
||||
// Use whichever pair of cwidth/cheight or width/height that produces less difference
|
||||
// between CleanXfac and CleanYfac.
|
||||
cx1 = MAX(cwidth / designwidth, 1);
|
||||
cy1 = MAX(cheight / designheight, 1);
|
||||
cx2 = MAX(realwidth / designwidth, 1);
|
||||
cy2 = MAX(realheight / designheight, 1);
|
||||
if (abs(cx1 - cy1) <= abs(cx2 - cy2) || MAX(cx1, cx2) >= 4)
|
||||
{ // e.g. 640x360 looks better with this.
|
||||
*cleanx = cx1;
|
||||
*cleany = cy1;
|
||||
}
|
||||
else
|
||||
{ // e.g. 720x480 looks better with this.
|
||||
*cleanx = cx2;
|
||||
*cleany = cy2;
|
||||
}
|
||||
|
||||
if (*cleanx < *cleany)
|
||||
*cleany = *cleanx;
|
||||
else
|
||||
*cleanx = *cleany;
|
||||
|
||||
if (_cx1 != NULL) *_cx1 = cx1;
|
||||
if (_cx2 != NULL) *_cx2 = cx2;
|
||||
if (designheight < 240 && realheight >= 480) designheight = 240;
|
||||
*cleanx = *cleany = std::min(realwidth / designwidth, realheight / designheight);
|
||||
}
|
||||
|
||||
bool IVideo::SetResolution ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue