merge vid dupx and dupy

they always contained the same value, so just remove it
This commit is contained in:
Alug committed 2025-09-27 16:30:20 +02:00
1 parent 16ee0d6df5
commit c4c30eab44
17 files changed
+687 -705

No files matched your search

+13 -13
View File
@@ -479,18 +479,18 @@ static void CON_RecalcSize(void)
switch (cv_constextsize.value)
{
case V_NOSCALEPATCH:
con_scalefactor = 1;
break;
case V_SMALLSCALEPATCH:
con_scalefactor = vid.smalldupx;
break;
case V_MEDSCALEPATCH:
con_scalefactor = vid.meddupx;
break;
default: // Full scaling
con_scalefactor = vid.dupx;
break;
case V_NOSCALEPATCH:
con_scalefactor = 1;
break;
case V_SMALLSCALEPATCH:
con_scalefactor = vid.smalldup;
break;
case V_MEDSCALEPATCH:
con_scalefactor = vid.meddup;
break;
default: // Full scaling
con_scalefactor = vid.dup;
break;
}
con_recalc = false;
@@ -607,7 +607,7 @@ static void CON_MoveConsole(void)
}
// Not instant - Increment fracmovement fractionally
fracmovement += FixedMul(cons_speed.value*vid.fdupy, (cv_uncappedhud.value ? renderdeltatics : FRACUNIT));
fracmovement += FixedMul(cons_speed.value*vid.fdup, (cv_uncappedhud.value ? renderdeltatics : FRACUNIT));
if (con_curlines < con_destlines) // Move the console downwards
{
+1 -2
View File
@@ -352,8 +352,7 @@ static void D_Renderview(void)
{
// V_DrawPatchFill, but for the fourth screen only
patch_t *pat = W_CachePatchName("SRB2BACK", PU_CACHE);
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
INT32 x, y, pw = SHORT(pat->width) * dupz, ph = SHORT(pat->height) * dupz;
INT32 x, y, pw = SHORT(pat->width) * vid.dup, ph = SHORT(pat->height) * vid.dup;
for (x = vid.width>>1; x < vid.width; x += pw)
{
+6 -5
View File
@@ -169,7 +169,7 @@ static void F_SkyScroll(INT32 scrollspeed)
pat = W_CachePatchName("TITLEBG1", PU_PATCH_LOWPRIORITY);
pat2 = W_CachePatchName("TITLEBG2", PU_PATCH_LOWPRIORITY);
w = (vid.width / vid.dupx)<<FRACBITS;
w = (vid.scaledwidth << FRACBITS);
// The scroll offset MUST be clamped before shifting by FRACBITS, or else it'll overflow in about 3 minutes
animtimer = ((((finalecount * scrollspeed) % (pat->width*16))<<FRACBITS) + (R_GetTimeFrac(RTF_MENU) * scrollspeed))/16;
@@ -677,7 +677,7 @@ void F_CreditDrawer(void)
y += 12<<FRACBITS;
break;
}
if (((y>>FRACBITS) * vid.dupy) > vid.height)
if (((y>>FRACBITS) * vid.dup) > vid.height)
break;
}
@@ -685,8 +685,8 @@ void F_CreditDrawer(void)
if (finalecount)
{
const char *goodbyefornow = "See you in ""\x82""Dr. Robotnik's Ring Racers""\x80""!";
fixed_t lpad = ((vid.width/vid.dupx) - BASEVIDWIDTH)<<FRACBITS;
fixed_t w = V_StringWidth(goodbyefornow, V_ALLOWLOWERCASE)<<FRACBITS;
fixed_t lpad = (vid.scaledwidth - BASEVIDWIDTH) << FRACBITS;
fixed_t w = V_StringWidth(goodbyefornow, V_ALLOWLOWERCASE) << FRACBITS;
fixed_t x = FixedMul(((BASEVIDWIDTH<<FRACBITS)+w+lpad), ((finalecount-1)<<FRACBITS)/(5*TICRATE)) - w - (lpad/2);
V_DrawString(x>>FRACBITS, y>>FRACBITS, V_ALLOWLOWERCASE, goodbyefornow); // for some reason DrawStringAtFixed can't tolerate colour codes
}
@@ -707,7 +707,8 @@ void F_CreditTicker(void)
case 1: y += 30<<FRACBITS; break;
default: y += 12<<FRACBITS; break;
}
if (FixedMul(y,vid.dupy) > vid.height)
if (FixedMul(y, vid.dup) > vid.height)
break;
}
+99 -108
View File
@@ -74,10 +74,8 @@ void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option)
// | /|
// |/ |
// 0--1
float sdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f;
float sdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f;
float pdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f;
float pdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f;
float sdup = FIXED_TO_FLOAT(vid.fdup)*2.0f;
float pdup = FIXED_TO_FLOAT(vid.fdup)*2.0f;
// make patch ready in hardware cache
HWR_GetPatch(gpatch);
@@ -86,25 +84,23 @@ void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option)
switch (option & V_SCALEPATCHMASK)
{
case V_NOSCALEPATCH:
pdupx = pdupy = 2.0f;
pdup = 2.0f;
break;
case V_SMALLSCALEPATCH:
pdupx = 2.0f * FIXED_TO_FLOAT(vid.smalldupx*FRACUNIT);
pdupy = 2.0f * FIXED_TO_FLOAT(vid.smalldupy*FRACUNIT);
pdup = 2.0f * FIXED_TO_FLOAT(vid.smalldup*FRACUNIT);
break;
case V_MEDSCALEPATCH:
pdupx = 2.0f * FIXED_TO_FLOAT(vid.meddupx*FRACUNIT);
pdupy = 2.0f * FIXED_TO_FLOAT(vid.meddupx*FRACUNIT);
pdup = 2.0f * FIXED_TO_FLOAT(vid.meddup*FRACUNIT);
break;
}
if (option & V_NOSCALESTART)
sdupx = sdupy = 2.0f;
sdup = 2.0f;
v[0].x = v[3].x = (x*sdupx-gpatch->leftoffset*pdupx)/vid.width - 1;
v[2].x = v[1].x = (x*sdupx+(gpatch->width - gpatch->leftoffset)*pdupx)/vid.width - 1;
v[0].y = v[1].y = 1-(y*sdupy-gpatch->topoffset*pdupy)/vid.height;
v[2].y = v[3].y = 1-(y*sdupy+(gpatch->height - gpatch->topoffset)*pdupy)/vid.height;
v[0].x = v[3].x = (x*sdup-gpatch->leftoffset*pdup)/vid.width - 1;
v[2].x = v[1].x = (x*sdup+(gpatch->width - gpatch->leftoffset)*pdup)/vid.width - 1;
v[0].y = v[1].y = 1-(y*sdup-gpatch->topoffset*pdup)/vid.height;
v[2].y = v[3].y = 1-(y*sdup+(gpatch->height - gpatch->topoffset)*pdup)/vid.height;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
@@ -138,7 +134,7 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
// | /|
// |/ |
// 0--1
float dupx, dupy, fscalew, fscaleh, fwidth, fheight;
float dup, fscalew, fscaleh, fwidth, fheight;
if (alphalevel >= 10 && alphalevel < 13)
return;
@@ -154,25 +150,21 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
hwrPatch = ((GLPatch_t *)gpatch->hardware);
dupx = (float)vid.dupx;
dupy = (float)vid.dupy;
dup = (float)vid.dup;
switch (option & V_SCALEPATCHMASK)
{
case V_NOSCALEPATCH:
dupx = dupy = 1.0f;
dup = 1.0f;
break;
case V_SMALLSCALEPATCH:
dupx = (float)vid.smalldupx;
dupy = (float)vid.smalldupy;
dup = (float)vid.smalldup;
break;
case V_MEDSCALEPATCH:
dupx = (float)vid.meddupx;
dupy = (float)vid.meddupy;
dup = (float)vid.meddup;
break;
}
dupx = dupy = (dupx < dupy ? dupx : dupy);
fscalew = fscaleh = FIXED_TO_FLOAT(pscale);
if (vscale != pscale)
fscaleh = FIXED_TO_FLOAT(vscale);
@@ -192,10 +184,10 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
offsety = (float)(gpatch->topoffset) * fscaleh;
if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dup for crosshairs
{
offsetx *= dupx;
offsety *= dupy;
offsetx *= dup;
offsety *= dup;
}
cx -= offsetx;
@@ -210,8 +202,8 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
if (!(option & V_NOSCALESTART))
{
cx = cx * dupx;
cy = cy * dupy;
cx = cx * dup;
cy = cy * dup;
if (!(option & V_SCALEPATCHMASK))
{
@@ -228,28 +220,30 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
}
}
// centre screen
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
if (fabsf(fvw - FLOATBASEVIDWIDTH * dup) > 1.0E-36f)
{
if (option & V_SNAPTORIGHT)
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
cx += (fvw - (FLOATBASEVIDWIDTH * dup));
else if (!(option & V_SNAPTOLEFT))
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f;
cx += (fvw - (FLOATBASEVIDWIDTH * dup))/2.0f;
}
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dup) > 1.0E-36f)
{
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy));
cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dup));
else if (option & V_SNAPTOBOTTOM)
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
cy += (fvh - (FLOATBASEVIDHEIGHT * dup));
else if (!(option & V_SNAPTOTOP))
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f;
cy += (fvh - (FLOATBASEVIDHEIGHT * dup))/2.0f;
}
}
}
fwidth = (float)(gpatch->width) * fscalew * dupx;
fheight = (float)(gpatch->height) * fscaleh * dupy;
fwidth = (float)(gpatch->width) * fscalew * dup;
fheight = (float)(gpatch->height) * fscaleh * dup;
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
cx = -1.0f + (cx / (fvw / 2.0f));
@@ -326,7 +320,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
// | /|
// |/ |
// 0--1
float dupx, dupy, fscale, fwidth, fheight;
float dup, fscale, fwidth, fheight;
if (alphalevel >= 10 && alphalevel < 13)
return;
@@ -338,25 +332,21 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
HWR_GetPatch(gpatch);
hwrPatch = ((GLPatch_t *)gpatch->hardware);
dupx = (float)vid.dupx;
dupy = (float)vid.dupy;
dup = (float)vid.dup;
switch (option & V_SCALEPATCHMASK)
{
case V_NOSCALEPATCH:
dupx = dupy = 1.0f;
dup = 1.0f;
break;
case V_SMALLSCALEPATCH:
dupx = (float)vid.smalldupx;
dupy = (float)vid.smalldupy;
dup = (float)vid.smalldup;
break;
case V_MEDSCALEPATCH:
dupx = (float)vid.meddupx;
dupy = (float)vid.meddupy;
dup = (float)vid.meddup;
break;
}
dupx = dupy = (dupx < dupy ? dupx : dupy);
fscale = FIXED_TO_FLOAT(pscale);
cy -= (float)(gpatch->topoffset) * fscale;
@@ -364,8 +354,8 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
if (!(option & V_NOSCALESTART))
{
cx = cx * dupx;
cy = cy * dupy;
cx = cx * dup;
cy = cy * dup;
if (!(option & V_SCALEPATCHMASK))
{
@@ -382,22 +372,24 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
}
}
// centre screen
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
if (fabsf(fvw - FLOATBASEVIDWIDTH * dup) > 1.0E-36f)
{
if (option & V_SNAPTORIGHT)
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
cx += (fvw - (FLOATBASEVIDWIDTH * dup));
else if (!(option & V_SNAPTOLEFT))
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f;
cx += (fvw - (FLOATBASEVIDWIDTH * dup))/2.0f;
}
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dup) > 1.0E-36f)
{
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy));
cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dup));
else if (option & V_SNAPTOBOTTOM)
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
cy += (fvh - (FLOATBASEVIDHEIGHT * dup));
else if (!(option & V_SNAPTOTOP))
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f;
cy += (fvh - (FLOATBASEVIDHEIGHT * dup))/2.0f;
}
}
}
@@ -419,13 +411,13 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
if (pscale != FRACUNIT)
{
fwidth *= fscale * dupx;
fheight *= fscale * dupy;
fwidth *= fscale * dup;
fheight *= fscale * dup;
}
else
{
fwidth *= dupx;
fheight *= dupy;
fwidth *= dup;
fheight *= dup;
}
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
@@ -488,7 +480,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
// --------------------------------------------------------------------------
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum)
{
FOutVector v[4];
FOutVector v[4];
float dflatsize;
INT32 flatflag;
const size_t len = W_LumpLength(flatlumpnum);
@@ -591,7 +583,6 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
GL_UnSetShader();
return;
}
else
@@ -668,17 +659,14 @@ void HWR_DrawViewBorder(INT32 clearlines)
INT32 basewindowx, basewindowy;
patch_t *patch;
// if (gl_viewwidth == vid.width)
// return;
if (!clearlines)
clearlines = BASEVIDHEIGHT; // refresh all
// calc view size based on original game resolution
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdupx));
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdup)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdup));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdup));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdup));
// top
HWR_DrawFlatFill(0, 0,
@@ -831,27 +819,28 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
if (!(color & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
const float dup = (float)vid.dup;
fx *= dupx;
fy *= dupy;
fw *= dupx;
fh *= dupy;
fx *= dup;
fy *= dup;
fw *= dup;
fh *= dup;
if (fabsf(fvw - (FLOATBASEVIDWIDTH * dupx)) > 1.0E-36f)
if (fabsf(fvw - (FLOATBASEVIDWIDTH * dup)) > 1.0E-36f)
{
if (color & V_SNAPTORIGHT)
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
fx += (fvw - (FLOATBASEVIDWIDTH * dup));
else if (!(color & V_SNAPTOLEFT))
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2.0f;
fx += (fvw - (FLOATBASEVIDWIDTH * dup)) / 2.0f;
}
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dup)) > 1.0E-36f)
{
// same thing here
if (color & V_SNAPTOBOTTOM)
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
fy += (fvh - (FLOATBASEVIDHEIGHT * dup));
else if (!(color & V_SNAPTOTOP))
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2.0f;
fy += (fvh - (FLOATBASEVIDHEIGHT * dup)) / 2.0f;
}
}
@@ -904,8 +893,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
Surf.PolyColor = palette[color&0xFF];
GL_DrawPolygon(&Surf, v, 4,
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_NoTexture|PF_NoDepthTest);
}
// -------------------+
@@ -935,7 +923,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
if (!(options & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
const float dup = (float)vid.dup;
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
{
@@ -950,32 +938,32 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
return;
}
fx *= dupx;
fy *= dupy;
fw *= dupx;
fh *= dupy;
fx *= dup;
fy *= dup;
fw *= dup;
fh *= dup;
if (fabsf(fvw - (FLOATBASEVIDWIDTH * dupx)) > 1.0E-36f)
if (fabsf(fvw - (FLOATBASEVIDWIDTH * dup)) > 1.0E-36f)
{
if (options & V_SNAPTORIGHT)
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
fx += (fvw - (FLOATBASEVIDWIDTH * dup));
else if (!(options & V_SNAPTOLEFT))
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
fx += (fvw - (FLOATBASEVIDWIDTH * dup)) / 2;
}
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dup)) > 1.0E-36f)
{
// same thing here
if (options & V_SNAPTOBOTTOM)
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
fy += (fvh - (FLOATBASEVIDHEIGHT * dup));
else if (!(options & V_SNAPTOTOP))
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
fy += (fvh - (FLOATBASEVIDHEIGHT * dup)) / 2;
}
if (options & V_SPLITSCREEN)
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
fy += (FLOATBASEVIDHEIGHT * dup)/2;
if (options & V_HORZSCREEN)
fx += (FLOATBASEVIDWIDTH * dupx)/2;
fx += (FLOATBASEVIDWIDTH * dup)/2;
}
if (fx >= vid.width || fy >= vid.height)
@@ -1056,7 +1044,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
if (!(color & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
const float dup = (float)vid.dup;
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
{
@@ -1070,30 +1058,32 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
return;
}
fx *= dupx;
fy *= dupy;
fw *= dupx;
fh *= dupy;
fx *= dup;
fy *= dup;
fw *= dup;
fh *= dup;
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
if (fabsf(fvw - FLOATBASEVIDWIDTH * dup) > 1.0E-36f)
{
if (color & V_SNAPTORIGHT)
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
fx += (fvw - (FLOATBASEVIDWIDTH * dup));
else if (!(color & V_SNAPTOLEFT))
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
fx += (fvw - (FLOATBASEVIDWIDTH * dup)) / 2;
}
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dup) > 1.0E-36f)
{
// same thing here
if (color & V_SNAPTOBOTTOM)
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
fy += (fvh - (FLOATBASEVIDHEIGHT * dup));
else if (!(color & V_SNAPTOTOP))
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
fy += (fvh - (FLOATBASEVIDHEIGHT * dup)) / 2;
}
if (color & V_SPLITSCREEN)
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
fy += (FLOATBASEVIDHEIGHT * dup)/2;
if (color & V_HORZSCREEN)
fx += (FLOATBASEVIDWIDTH * dupx)/2;
fx += (FLOATBASEVIDWIDTH * dup)/2;
}
if (fx >= vid.width || fy >= vid.height)
@@ -1111,6 +1101,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
if (fw <= 0 || fh <= 0)
return;
if (fx + fw > vid.width)
fw = fvw - fx;
if (fy + fh > vid.height)
+6 -6
View File
@@ -2277,10 +2277,10 @@ static void HU_DrawSongCreditsBox(void)
INT32 strwidth = V_SmallStringWidth(str, V_ALLOWLOWERCASE) + 4;
// dup dup dup dup
INT32 dup = min(vid.dupx, vid.dupy);
INT32 dup = vid.dup;
// Center it
INT32 x = (BASEVIDWIDTH/2 - strwidth/2)*dup + ((vid.width - (BASEVIDWIDTH * vid.dupx)) / 2);
INT32 x = (BASEVIDWIDTH/2 - strwidth/2)*dup + ((vid.width - (BASEVIDWIDTH * dup)) / 2);
INT32 y = 0;
INT32 flags = V_SNAPTOTOP|V_NOSCALESTART;
@@ -2668,14 +2668,14 @@ static inline void HU_DrawSpectatorTicker(void)
INT32 i;
INT32 length = 0, height = 174;
INT32 totallength = 0, templength = -8;
INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2;
INT32 duptweak = (vid.scaledwidth - BASEVIDWIDTH)/2;
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].spectator)
totallength += (signed)strlen(player_names[i]) * 8 + 16;
length -= (leveltime % (totallength + dupadjust+8));
length += dupadjust;
length -= (leveltime % (totallength + vid.scaledwidth+8));
length += vid.scaledwidth;
for (i = 0; i < MAXPLAYERS; i++)
{
@@ -2743,7 +2743,7 @@ static inline void HU_DrawSpectatorTicker(void)
}
}
if ((length += len) >= dupadjust+8)
if ((length += len) >= vid.scaledwidth+8)
break;
}
}
+56 -58
View File
@@ -2283,7 +2283,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
{
INT32 i, rightoffset = 240;
const UINT8 *colormap;
const INT32 dupadjust = cv_betainterscreen.value ? 314 : (vid.width/vid.dupx), duptweak = cv_betainterscreen.value ? -3 : (dupadjust - BASEVIDWIDTH)/2;
const INT32 dupadjust = cv_betainterscreen.value ? 314 : vid.scaledwidth, duptweak = cv_betainterscreen.value ? -3 : (dupadjust - BASEVIDWIDTH)/2;
boolean (*_isHighlightedPlayer)(const player_t *) = (demo.playback ? P_IsDisplayPlayer : P_IsLocalPlayer);
@@ -2466,7 +2466,7 @@ static void K_DrawDialNum(INT32 x, INT32 y, boolean colorized, INT32 flags, INT3
w = skp_dialnum[0]->width;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
w *= vid.dup;
if (num < 0)
num = -num;
@@ -2992,7 +2992,6 @@ static void K_drawNameTags(void)
char *tag;
patch_t *icon = NULL;
INT32 dup;
UINT8 *cm = NULL;
UINT8 tagcolor = 0;
INT32 vflags = 0;
@@ -3077,13 +3076,12 @@ static void K_drawNameTags(void)
tag = va("%s%s ", HU_SkinColorToConsoleColor(players[i].mo->color), player_names[i]);
icon = R_GetSkinFaceMini(players[i].mo->player);
dup = vid.dupx;
cm = R_GetTranslationColormap(players[i].skin, players[i].mo->color, GTC_CACHE);
tagcolor = colortranslations[players[i].mo->color][7];
vflags = trans | V_NOSCALESTART;
usenametagrestat = ((cv_nametagrestat.value == 1 && (players[i].kartspeed != skins[players[i].skin].kartspeed || players[i].kartweight != skins[players[i].skin].kartweight)) || cv_nametagrestat.value == 2);
tagwidthsmall = cv_smallnametags.value ? V_SmallStringWidth(player_names[i], V_ALLOWLOWERCASE) : V_ThinStringWidth(player_names[i], V_ALLOWLOWERCASE);
tagwidth = dup*tagwidthsmall;
tagwidth = vid.dup*tagwidthsmall;
// If flipcam is on, other player is flipped relative to us when we have different
// verticalflip flag value. Otherwise, they are simply flipped when verticalflip flag says so
@@ -3095,36 +3093,36 @@ static void K_drawNameTags(void)
#ifdef HWRENDER
// Needs extra offset. Not perfect but this will do for now
if (rendermode == render_opengl && !cv_glshearing.value && cv_smallnametags.value)
namey -= dup*6;
namey -= vid.dup*6;
#endif
if (cv_smallnametags.value || !nametaggfx)
{
if (flipped)
namey += dup*5;
namey += vid.dup*5;
else // small offset
namey -= dup*3;
namey -= vid.dup*3;
if (nametaggfx && cv_smallnametags.value == 1)
{
if (cv_nametagfacerank.value)
tagwidthsmall += icon->width - dup;
tagwidthsmall += icon->width - vid.dup;
// Have to draw the nametag using patches here since drawfill can't draw at this scale...
if (!flipped)
V_DrawFixedPatch(namex<<FRACBITS, namey<<FRACBITS, FRACUNIT/2, vflags, nametagline, cm);
V_DrawStretchyFixedPatch(((namex+dup*3)<<FRACBITS), namey<<FRACBITS,
V_DrawStretchyFixedPatch(((namex+vid.dup*3)<<FRACBITS), namey<<FRACBITS,
tagwidthsmall<<FRACBITS, FRACUNIT/2, vflags, nametagpic, cm, 0);
namex += dup*2;
namey -= dup*4;
namex += vid.dup*2;
namey -= vid.dup*4;
}
if (cv_nametagfacerank.value)
{
V_DrawFixedPatch(namex<<FRACBITS, (namey - icon->height/2)<<FRACBITS, FRACUNIT/2, vflags, icon, cm);
namex += dup*(1+icon->width/2); // add offset to other stuff
namex += vid.dup*(1+icon->width/2); // add offset to other stuff
}
//Name
@@ -3132,71 +3130,72 @@ static void K_drawNameTags(void)
if (usenametagrestat)
{
V_DrawSmallString(namex, namey - dup*5, vflags, va("\x84S%d ", players[i].kartspeed));
V_DrawSmallString(namex + dup*10, namey - dup*5, vflags, va("\x87W%d ", players[i].kartweight));
V_DrawSmallString(namex, namey - vid.dup*5, vflags, va("\x84S%d ", players[i].kartspeed));
V_DrawSmallString(namex + vid.dup*10, namey - vid.dup*5, vflags, va("\x87W%d ", players[i].kartweight));
}
if (cv_nametagscore.value)
{
INT32 yofs = usenametagrestat ? 10 : 5;
V_DrawSmallString(namex, namey - dup*yofs, V_ALLOWLOWERCASE | vflags, va("\x8A%d ", players[i].score));
V_DrawSmallString(namex, namey - vid.dup*yofs, V_ALLOWLOWERCASE | vflags, va("\x8A%d ", players[i].score));
}
}
else
{
if (cv_nametagfacerank.value)
tagwidth += dup*(icon->width+1);
tagwidth += vid.dup*(icon->width+1);
if (flipped)
{
for (j = 0; j < 4; j++)
for (j = 0; j < 4; j++)
{
V_DrawFill(namex, namey, dup*3, dup*4, 31 | vflags);
V_DrawFill(namex+dup, namey, dup, dup*4, tagcolor | vflags);
namey += dup*4;
namex += dup;
V_DrawFill(namex, namey, vid.dup*3, vid.dup*4, 31 | vflags);
V_DrawFill(namex+vid.dup, namey, vid.dup, vid.dup*4, tagcolor | vflags);
namey += vid.dup*4;
namex += vid.dup;
}
namey -= dup*3;
V_DrawFill(namex, namey+dup*2, dup, dup, 31 | vflags); // a single black pixel
V_DrawFill(namex+dup, namey, tagwidth, dup*3, 31 | vflags);
V_DrawFill(namex+dup, namey+dup, tagwidth - dup, dup, tagcolor | vflags);
namex += dup*2;
namey -= vid.dup*3;
V_DrawFill(namex, namey+vid.dup*2, vid.dup, vid.dup, 31 | vflags); // a single black pixel
V_DrawFill(namex+vid.dup, namey, tagwidth, vid.dup*3, 31 | vflags);
V_DrawFill(namex+vid.dup, namey+vid.dup, tagwidth - vid.dup, vid.dup, tagcolor | vflags);
namex += vid.dup*2;
}
else
{
for (j = 0; j < 4; j++)
{
namey -= dup*4;
V_DrawFill(namex, namey, dup*3, dup*4, 31 | vflags);
V_DrawFill(namex+dup, namey, dup, dup*4, tagcolor | vflags);
namex += dup;
namey -= vid.dup*4;
V_DrawFill(namex, namey, vid.dup*3, vid.dup*4, 31 | vflags);
V_DrawFill(namex+vid.dup, namey, vid.dup, vid.dup*4, tagcolor | vflags);
namex += vid.dup;
}
V_DrawFill(namex, namey, dup, dup, 31 | vflags);
V_DrawFill(namex+dup, namey, tagwidth - dup*2, dup*3, 31 | vflags);
V_DrawFill(namex+dup, namey+dup, tagwidth - dup*3, dup, tagcolor | vflags);
V_DrawFill(namex, namey, vid.dup, vid.dup, 31 | vflags);
V_DrawFill(namex+vid.dup, namey, tagwidth - vid.dup*2, vid.dup*3, 31 | vflags);
V_DrawFill(namex+vid.dup, namey+vid.dup, tagwidth - vid.dup*3, vid.dup, tagcolor | vflags);
}
if (cv_nametagfacerank.value)
{
V_DrawMappedPatch(namex, namey - dup*(icon->height+1), vflags, icon, cm);
namex += dup*(icon->height+1); // add offset to other stuff
V_DrawMappedPatch(namex, namey - vid.dup*(icon->height+1), vflags, icon, cm);
namex += vid.dup*(icon->height+1); // add offset to other stuff
}
V_DrawThinString(namex, namey - dup*10, V_ALLOWLOWERCASE | vflags, tag);
V_DrawThinString(namex, namey - vid.dup*10, V_ALLOWLOWERCASE | vflags, tag);
if (usenametagrestat)
{
V_DrawScaledPatch(namex, namey - dup*20, vflags, nametagspeed);
V_DrawScaledPatch(namex + dup*18, namey - dup*20, vflags, nametagweight);
V_DrawString(namex + dup*9, namey - dup*19, V_ALLOWLOWERCASE | vflags, va("\x84%d ", players[i].kartspeed));
V_DrawString(namex + dup*27, namey - dup*19, V_ALLOWLOWERCASE | vflags, va("\x87%d ", players[i].kartweight));
V_DrawScaledPatch(namex, namey - vid.dup*20, vflags, nametagspeed);
V_DrawScaledPatch(namex + vid.dup*18, namey - vid.dup*20, vflags, nametagweight);
V_DrawString(namex + vid.dup*9, namey - vid.dup*19, V_ALLOWLOWERCASE | vflags, va("\x84%d ", players[i].kartspeed));
V_DrawString(namex + vid.dup*27, namey - vid.dup*19, V_ALLOWLOWERCASE | vflags, va("\x87%d ", players[i].kartweight));
}
if (cv_nametagscore.value)
{
INT32 yofs = usenametagrestat ? 25 : 15;
V_DrawSmallString(namex, namey - dup*yofs, V_ALLOWLOWERCASE | vflags, va("\x8A%d ", players[i].score));
V_DrawSmallString(namex, namey - vid.dup*yofs, V_ALLOWLOWERCASE | vflags, va("\x8A%d ", players[i].score));
}
}
}
@@ -3207,7 +3206,6 @@ static void K_drawDriftGauge(void)
{
vector2_t pos = {0};
fixed_t basex, basey;
const int dup = vid.dupx;
int i;
UINT8 *colormap = NULL;
@@ -3271,16 +3269,16 @@ skipcrap:
if (gaugestyle == GAUGE_DEFAULT || gaugestyle == GAUGE_BIGNUM || gaugestyle == GAUGE_EXTRA)
{
barx = basex - dup*23;
BAR_WIDTH = dup*47;
barx = basex - vid.dup*23;
BAR_WIDTH = vid.dup*47;
}
else
{
barx = basex - dup*12;
BAR_WIDTH = dup*23;
barx = basex - vid.dup*12;
BAR_WIDTH = vid.dup*23;
}
bary = basey - dup*2;
bary = basey - vid.dup*2;
if (gaugestyle == GAUGE_EXTRA) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code.....
{
@@ -3292,7 +3290,7 @@ skipcrap:
else
driftpatch = skp_smallsticker3;
V_DrawStretchyFixedPatch((basex - dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap, 0);
V_DrawStretchyFixedPatch((basex - vid.dup*30)<<FRACBITS, ((basey<<FRACBITS) - FixedMul(vid.dup<<FRACBITS, 21*FRACUNIT/10)), XTRA3PSCALE, XTRA3VSCALE, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap, 0);
}
else
{
@@ -3304,7 +3302,7 @@ skipcrap:
else
driftpatch = (gaugestyle == GAUGE_SMALL ? driftgaugesmall : driftgauge);
V_DrawMappedPatch(gaugestyle == GAUGE_SMALL ? basex + dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap);
V_DrawMappedPatch(gaugestyle == GAUGE_SMALL ? basex + vid.dup*11 : basex, basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftpatch, colormap);
}
if (driftcharge >= driftval*4) // rainbow sparks
@@ -3312,7 +3310,7 @@ skipcrap:
colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE);
for (i = 0; i < 4; i++)
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 17)] + i*2) | V_NOSCALESTART|drifttrans);
V_DrawFill(barx, bary+vid.dup*1+vid.dup*i, BAR_WIDTH, vid.dup, (driftrainbow[min((leveltime % 18) + 1, 17)] + i*2) | V_NOSCALESTART|drifttrans);
}
else // none/blue/red
{
@@ -3324,17 +3322,17 @@ skipcrap:
for (i = 0; i < 4; i++)
{
if (driftcharge >= driftval)
V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, driftcolors[driftlevel-1][i] | V_NOSCALESTART|drifttrans);
V_DrawFill(barx, bary+vid.dup*1+vid.dup*i, BAR_WIDTH, vid.dup, driftcolors[driftlevel-1][i] | V_NOSCALESTART|drifttrans);
V_DrawFill(barx, bary+dup*1+dup*i, width, dup, driftcolors[driftlevel][i] | V_NOSCALESTART|drifttrans);
V_DrawFill(barx, bary+vid.dup*1+vid.dup*i, width, vid.dup, driftcolors[driftlevel][i] | V_NOSCALESTART|drifttrans);
}
}
// right, also draw a cool number
if (gaugestyle == GAUGE_BIGNUM)
V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
V_DrawPaddedTallColorNum(basex + (vid.dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
else
V_DrawPingNum((gaugestyle == GAUGE_SMALL ? basex + (dup*22) : basex + (dup*32)), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, colormap);
V_DrawPingNum((gaugestyle == GAUGE_SMALL ? basex + (vid.dup*22) : basex + (vid.dup*32)), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, colormap);
}
break;
case GAUGE_NUMONLY:
@@ -3344,7 +3342,7 @@ skipcrap:
else
colormap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel], GTC_CACHE);
V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
V_DrawPaddedTallColorNum(basex + (vid.dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap);
}
break;
default:
@@ -3893,7 +3891,7 @@ static void K_drawKartFinish(void)
if (splitscreen) // wide splitscreen
pnum += 4;
x = ((vid.width<<FRACBITS)/vid.dupx);
x = ((vid.width<<FRACBITS)/vid.dup);
xval = (kp_racefinish[pnum]->width<<FRACBITS);
x = (FixedMul(((TICRATE - stplyr->kartstuff[k_cardanimation])<<FRACBITS) - R_GetTimeFrac(RTF_LEVEL), xval > x ? xval : x))/TICRATE;
@@ -4113,7 +4111,7 @@ static void K_drawKartFirstPerson(void)
if (splitscreen == 1)
{
scale = (2*FRACUNIT)/3;
y += FRACUNIT/(vid.dupx < vid.dupy ? vid.dupx : vid.dupy); // correct a one-pixel gap on the screen view (not the basevid view)
y += FRACUNIT/vid.dup; // correct a one-pixel gap on the screen view (not the basevid view)
}
else if (splitscreen)
scale = FRACUNIT/2;
+6 -15
View File
@@ -715,7 +715,7 @@ static int libd_drawOnMinimap(lua_State *L)
// and NOW we can FINALLY DRAW OUR GOD DAMN PATCH :V
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
list = (huddrawlist_h) lua_touserdata(L, -1);
list = (huddrawlist_h)lua_touserdata(L, -1);
lua_pop(L, 1);
if (LUA_HUD_IsDrawListValid(list))
@@ -1095,22 +1095,13 @@ FUNCINLINE static ATTRINLINE int libd_height(lua_State *L)
return 1;
}
FUNCINLINE static ATTRINLINE int libd_dupx(lua_State *L)
FUNCINLINE static ATTRINLINE int libd_dup(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.dupx); // push integral scale (patch scale)
lua_pushfixed(L, vid.fdupx); // push fixed point scale (position scale)
lua_pushinteger(L, vid.dup); // push integral scale (patch scale)
lua_pushfixed(L, vid.fdup); // push fixed point scale (position scale)
return 2;
}
FUNCINLINE static ATTRINLINE int libd_dupy(lua_State *L)
{
HUDONLY
lua_pushinteger(L, vid.dupy); // push integral scale (patch scale)
lua_pushfixed(L, vid.fdupy); // push fixed point scale (position scale)
return 2;
}
FUNCINLINE static ATTRINLINE int libd_renderer(lua_State *L)
{
HUDONLY
@@ -1208,8 +1199,8 @@ static luaL_Reg lib_draw[] = {
{"getColormap", libd_getColormap},
{"width", libd_width},
{"height", libd_height},
{"dupx", libd_dupx},
{"dupy", libd_dupy},
{"dupx", libd_dup},
{"dupy", libd_dup},
{"renderer", libd_renderer},
{"localTransFlag", libd_getlocaltransflag},
{"drawOnMinimap", libd_drawOnMinimap},
+36 -42
View File
@@ -205,73 +205,68 @@ static void CalcStringCoords(drawitem_t *item, const char *string)
{
if (!(item->flags & V_NOSCALESTART) && cv_uncappedhud.value)
{
INT32 dupx = vid.dupx;
INT32 dupy = vid.dupy;
INT32 dup = vid.dup;
item->flags |= V_NOSCALESTART;
if (item->flags & V_SCALEPATCHMASK) switch ((item->flags & V_SCALEPATCHMASK) >> V_SCALEPATCHSHIFT)
{
case 1: // V_NOSCALEPATCH
dupx = dupy = 1;
dup = 1;
break;
case 2: // V_SMALLSCALEPATCH
dupx = vid.smalldupx;
dupy = vid.smalldupy;
dup = vid.smalldup;
break;
case 3: // V_MEDSCALEPATCH
dupx = vid.meddupx;
dupy = vid.meddupy;
dup = vid.meddup;
break;
default:
break;
}
// only use one dup, to avoid stretching (har har)
dupx = dupy = (dupx < dupy ? dupx : dupy);
INT32 x = item->x * dupx;
INT32 y = item->y * dupy;
INT32 x = item->x * dup;
INT32 y = item->y * dup;
if (item->flags & V_SPLITSCREEN)
y += (BASEVIDHEIGHT * (dupy - 1))/2;
y += (BASEVIDHEIGHT * (dup - 1))/2;
if (item->flags & V_HORZSCREEN)
x += (BASEVIDWIDTH * (dupx - 1))/2;
x += (BASEVIDWIDTH * (dup - 1))/2;
if (vid.width != BASEVIDWIDTH * dupx)
if (vid.width != BASEVIDWIDTH * dup)
{
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
// dup adjustments pretend that screen width is BASEVIDWIDTH * dup,
// so center this imaginary screen
if ((item->flags & (V_HORZSCREEN|V_SNAPTOLEFT)) == (V_HORZSCREEN|V_SNAPTOLEFT))
x += (vid.width/2 - (BASEVIDWIDTH/2 * dupx));
x += (vid.width/2 - (BASEVIDWIDTH/2 * dup));
else if (item->flags & V_SNAPTORIGHT)
x += (vid.width - (BASEVIDWIDTH * dupx));
x += (vid.width - (BASEVIDWIDTH * dup));
else if (!(item->flags & V_SNAPTOLEFT))
x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
x += (vid.width - (BASEVIDWIDTH * dup)) / 2;
}
if (vid.height != BASEVIDHEIGHT * dupy)
if (vid.height != BASEVIDHEIGHT * dup)
{
// same thing here
if ((item->flags & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
y += (vid.height/2 - (BASEVIDHEIGHT/2 * dupy));
y += (vid.height/2 - (BASEVIDHEIGHT/2 * dup));
else if (item->flags & V_SNAPTOBOTTOM)
y += (vid.height - (BASEVIDHEIGHT * dupy));
y += (vid.height - (BASEVIDHEIGHT * dup));
else if (!(item->flags & V_SNAPTOTOP))
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
y += (vid.height - (BASEVIDHEIGHT * dup)) / 2;
}
// need to compensate for dup here
if (item->type == DI_DrawString)
{
if (item->align == align_center)
x -= (V_StringWidth(string, item->flags) * (dupx - 1))/2;
x -= (V_StringWidth(string, item->flags) * (dup - 1))/2;
if (item->align == align_right)
x -= V_StringWidth(string, item->flags) * (dupx - 1);
x -= V_StringWidth(string, item->flags) * (dup - 1);
if (item->align == align_smallright)
x -= V_SmallStringWidth(string, item->flags) * (dupx - 1);
x -= V_SmallStringWidth(string, item->flags) * (dup - 1);
if (item->align == align_thinright)
x -= V_ThinStringWidth(string, item->flags) * (dupx - 1);
x -= V_ThinStringWidth(string, item->flags) * (dup - 1);
}
item->x = x;
@@ -283,40 +278,39 @@ static void CalcFillCoords(drawitem_t *item)
{
if (!(item->flags & V_NOSCALESTART) && cv_uncappedhud.value)
{
INT32 dupx = vid.dupx;
INT32 dupy = vid.dupy;
INT32 x = item->x * dupx;
INT32 y = item->y * dupy;
INT32 dup = vid.dup;
INT32 x = item->x * dup;
INT32 y = item->y * dup;
INT32 c = item->c;
item->flags |= V_NOSCALESTART;
item->w *= dupx;
item->h *= dupy;
item->w *= dup;
item->h *= dup;
// Center it if necessary
if (vid.width != BASEVIDWIDTH * dupx)
if (vid.width != BASEVIDWIDTH * dup)
{
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
// dup adjustments pretend that screen width is BASEVIDWIDTH * dup,
// so center this imaginary screen
if (c & V_SNAPTORIGHT)
x += (vid.width - (BASEVIDWIDTH * dupx));
x += (vid.width - (BASEVIDWIDTH * dup));
else if (!(c & V_SNAPTOLEFT))
x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
x += (vid.width - (BASEVIDWIDTH * dup)) / 2;
}
if (vid.height != BASEVIDHEIGHT * dupy)
if (vid.height != BASEVIDHEIGHT * dup)
{
// same thing here
if (c & V_SNAPTOBOTTOM)
y += (vid.height - (BASEVIDHEIGHT * dupy));
y += (vid.height - (BASEVIDHEIGHT * dup));
else if (!(c & V_SNAPTOTOP))
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
y += (vid.height - (BASEVIDHEIGHT * dup)) / 2;
}
if (c & V_SPLITSCREEN)
y += (BASEVIDHEIGHT * dupy)/2;
y += (BASEVIDHEIGHT * dup)/2;
if (c & V_HORZSCREEN)
x += (BASEVIDWIDTH * dupx)/2;
x += (BASEVIDWIDTH * dup)/2;
item->x = x;
item->y = y;
+1 -1
View File
@@ -421,7 +421,7 @@ static void GIF_headwrite(void)
// Image width/height
if (gif_downscale)
{
scrbuf_downscaleamt = vid.dupx;
scrbuf_downscaleamt = vid.dup;
scrbuf_width = (vid.width / scrbuf_downscaleamt);
scrbuf_height = (vid.height / scrbuf_downscaleamt);
}
+183 -194
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -92,6 +92,6 @@ void R_SetupSkyDraw(void)
void R_SetSkyScale(void)
{
//skyscale = FixedDiv(fovtan, FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT));
fixed_t difference = vid.fdupx-(vid.dupx<<FRACBITS);
skyscale = FixedDiv(fovtan, vid.fdupx+difference);
fixed_t difference = vid.fdup-(vid.dup<<FRACBITS);
skyscale = FixedDiv(fovtan, vid.fdup+difference);
}
+2 -36
View File
@@ -182,19 +182,7 @@ void SCR_Startup(void)
vid.modenum = 0;
vid.dupx = vid.width / BASEVIDWIDTH;
vid.dupy = vid.height / BASEVIDHEIGHT;
vid.dupx = vid.dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
vid.fdupx = FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT);
vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT);
vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
vid.meddupx = (UINT8)(vid.dupx >> 1) + 1;
vid.meddupy = (UINT8)(vid.dupy >> 1) + 1;
vid.smalldupx = (UINT8)(vid.dupx / 3) + 1;
vid.smalldupy = (UINT8)(vid.dupy / 3) + 1;
V_Recalc();
V_Init();
CV_RegisterVar(&cv_highreshudscale);
@@ -239,29 +227,7 @@ void SCR_Recalc(void)
if (dedicated)
return;
// scale 1,2,3 times in x and y the patches for the menus and overlays...
// calculated once and for all, used by routines in v_video.c
vid.dupx = vid.width / BASEVIDWIDTH;
vid.dupy = vid.height / BASEVIDHEIGHT;
vid.dupx = vid.dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
vid.fdupx = FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT);
vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT);
if ((vid.width > 720) && (vid.height > 1280)) // ehhhh well this thing has so many issues, so ill lock it to higher resolutions instead
{
vid.dupx = FixedDiv(vid.dupx, cv_highreshudscale.value);
vid.dupy = FixedDiv(vid.dupy, cv_highreshudscale.value);
vid.fdupx = FixedDiv(vid.fdupx, cv_highreshudscale.value);
vid.fdupy = FixedDiv(vid.fdupy, cv_highreshudscale.value);
}
vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
vid.meddupx = (UINT8)(vid.dupx >> 1) + 1;
vid.meddupy = (UINT8)(vid.dupy >> 1) + 1;
vid.smalldupx = (UINT8)(vid.dupx / 3) + 1;
vid.smalldupy = (UINT8)(vid.dupy / 3) + 1;
V_Recalc();
// toggle off (then back on) the automap because some screensize-dependent values will
// be calculated next time the automap is activated.
+10 -8
View File
@@ -47,8 +47,6 @@
// global video state
typedef struct viddef_s
{
INT32 modenum; // vidmode num indexes videomodes list
// Each screen is [vid.width*vid.height];
UINT8 *screens[5];
// screens[0] = main display window
@@ -57,14 +55,18 @@ typedef struct viddef_s
// screens[3] = fade screen start
// screens[4] = fade screen end, postimage tempoarary buffer
INT32 width; // PIXELS per scanline
INT32 width; // PIXELS per scanline
INT32 height;
boolean recalc; // if true, recalc vid-based stuff
INT32 dupx, dupy; // scale 1, 2, 3 value for menus & overlays
INT32/*fixed_t*/ fdupx, fdupy; // same as dupx, dupy, but exact value when aspect ratio isn't 320/200
UINT8 smalldupx, smalldupy; // factor for a little bit of scaling
UINT8 meddupx, meddupy; // factor for moderate, but not full, scaling
INT32 modenum; // vidmode num indexes videomodes list
boolean recalc; // if true, recalc vid-based stuff
INT32 dup; // scale 1, 2, 3 value for menus & overlays
INT32 fdup; // same as dup, but exact value when aspect ratio isn't 320/200
UINT8 smalldup; // factor for a little bit of scaling
UINT8 meddup; // factor for moderate, but not full, scaling
INT32 scaledwidth; // width / dup
#ifdef HWRENDER
INT32 glstate;
#endif
+2 -2
View File
@@ -437,7 +437,7 @@ static void ST_drawLevelTitle(void)
subttl = mapheaderinfo[gamemap-1]->subttl;
zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
actnum = mapheaderinfo[gamemap-1]->actnum;
dupcalc = (vid.width/vid.dupx);
dupcalc = vid.scaledwidth;
gtc = G_GetGametypeColor(gametype);
bary = (splitscreen) ? BASEVIDHEIGHT/2 : 163;
@@ -589,7 +589,7 @@ static void ST_overlayDrawer(void)
}
else if (splitscreen)
{
V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT), player_names[stplyr-players]);
V_DrawCenteredThinString(vid.scaledwidth/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT), player_names[stplyr-players]);
}
}
}
+257 -207
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -48,6 +48,7 @@ cv_palette, cv_palettenum;
// Allocates buffer screens, call before R_Init.
void V_Init(void);
void V_Recalc(void);
// Color look-up table
#define CLUTINDEX(r, g, b) (((r) >> 3) << 11) | (((g) >> 2) << 5) | ((b) >> 3)
+6 -6
View File
@@ -283,7 +283,7 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol)
#define NUMFORNEWCOLUMN 8
INT32 y = 41, gutter = ((standings->numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2));
INT32 dupadjust = cv_betainterscreen.value ? 314 : (vid.width/vid.dupx), duptweak = cv_betainterscreen.value ? -3 : (dupadjust - BASEVIDWIDTH)/2;
INT32 dupadjust = cv_betainterscreen.value ? 314 : vid.scaledwidth, duptweak = cv_betainterscreen.value ? -3 : (dupadjust - BASEVIDWIDTH)/2;
const char *timeheader;
if (standings->rankingsmode)
@@ -473,9 +473,9 @@ void Y_IntermissionDrawer(void)
INT64 count = (intertic - sorttic);
if (count < 8)
x -= ((((count<<FRACBITS) + R_GetTimeFrac(RTF_INTER)) * vid.width)>>FRACBITS) / (8 * vid.dupx);
x -= ((((count<<FRACBITS) + R_GetTimeFrac(RTF_INTER)) * vid.width)>>FRACBITS) / (8 * vid.dup);
else if (count < 16)
x += (((((16 - count)<<FRACBITS) - R_GetTimeFrac(RTF_INTER)) * vid.width)>>FRACBITS) / (8 * vid.dupx);
x += (((((16 - count)<<FRACBITS) - R_GetTimeFrac(RTF_INTER)) * vid.width)>>FRACBITS) / (8 * vid.dup);
}
if (intertype == int_race || intertype == int_match)
@@ -883,8 +883,8 @@ static void Y_VoteBackgroundDrawer(patch_t *patch)
break;
case 0: // vanilla
default:
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (patch->width/2),
(vid.height / vid.dupy) - patch->height,
V_DrawScaledPatch(((vid.width/2) / vid.dup) - (patch->width/2),
(vid.height / vid.dup) - patch->height,
V_SNAPTOTOP|V_SNAPTOLEFT, patch);
break;
}
@@ -935,7 +935,7 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
static void Y_DrawVoteScreenPatch(void)
{
patch_t *votebg = NULL;
const boolean widescreen = (vid.width / vid.dupx > 320);
const boolean widescreen = (vid.scaledwidth > 320);
if (VoteScreen.foundLuaVoteWideFrames || VoteScreen.foundLuaVoteFrames)
{