Combine vid.dupx and vid.dupy

This commit is contained in:
NepDisk 2026-02-08 11:25:09 -05:00
parent 60a19aaf61
commit 14bf52af43
20 changed files with 375 additions and 416 deletions

View file

@ -518,18 +518,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;
@ -652,7 +652,7 @@ void CON_MoveConsole(void)
}
// Not instant - Increment fracmovement fractionally
fracmovement += FixedMul(cons_speed.value*vid.fdupy, renderdeltatics);
fracmovement += FixedMul(cons_speed.value*vid.fdup, renderdeltatics);
if (con_curlines < con_destlines) // Move the console downwards
{
@ -1503,9 +1503,9 @@ static void CON_DrawBackpic(void)
con_backpic = W_CachePatchNum(piclump, PU_PATCH);
// Center the backpic, and draw a vertically cropped patch.
w = (BASEVIDWIDTH * vid.dupx);
w = (BASEVIDWIDTH * vid.dup);
x = (vid.width / 2) - (w / 2);
h = con_curlines/vid.dupy;
h = con_curlines/vid.dup;
// If the patch doesn't fill the entire screen,
// then fill the sides with a solid color.

View file

@ -321,8 +321,7 @@ boolean D_RenderLevel(void)
{
// V_DrawPatchFill, but for the fourth screen only
patch_t *pat = static_cast<patch_t*>(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)
{

View file

@ -651,8 +651,8 @@ void F_SecretCreditsTicker(void)
dscreditsticks++;
INT32 w = (vid.width / vid.dupx);
INT32 h = (vid.height / vid.dupy);
INT32 w = vid.scaledwidth;
INT32 h = (vid.height / vid.dup);
const INT32 vidxdiff = (w - BASEVIDWIDTH) / 2;
const INT32 vidydiff = (h - BASEVIDHEIGHT) / 2;
@ -1132,7 +1132,7 @@ void F_SecretCreditsTicker(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;
}
}
@ -1159,7 +1159,7 @@ void F_SecretCreditsTicker(void)
// Repeats horizontally until it reaches across the screen.
static void F_DrawBannerPatch(fixed_t x, fixed_t y, fixed_t scale, INT32 scrn, patch_t *patch, const UINT8 *colormap)
{
fixed_t w = (vid.width / vid.dupx);
fixed_t w = vid.scaledwidth;
fixed_t vidxdiff = ((w - BASEVIDWIDTH) << FRACBITS) / 2;
fixed_t pw = (static_cast<fixed_t>(SHORT(patch->width)) * scale);
@ -1320,8 +1320,8 @@ static void F_FakeTitleScreen(tic_t count)
{
INT32 w, h;
w = (vid.width / vid.dupx);
h = (vid.height / vid.dupy);
w = vid.scaledwidth;
h = (vid.height / vid.dup);
const INT32 vidxdiff = (w - BASEVIDWIDTH) / 2;
const INT32 vidydiff = (h - BASEVIDHEIGHT) / 2;
@ -1369,8 +1369,8 @@ void F_SecretCreditsDrawer(void)
INT32 w, h;
UINT8 bgcolor = 31;
w = (vid.width / vid.dupx);
h = (vid.height / vid.dupy);
w = vid.scaledwidth;
h = (vid.height / vid.dup);
const INT32 vidxdiff = (w - BASEVIDWIDTH) / 2;
const INT32 vidydiff = (h - BASEVIDHEIGHT) / 2;
@ -1473,7 +1473,7 @@ void F_SecretCreditsDrawer(void)
y += 20<<FRACBITS;
break;
}
if (((y>>FRACBITS) * vid.dupy) > vid.height)
if (((y>>FRACBITS) * vid.dup) > vid.height)
break;
}
}
@ -1501,7 +1501,7 @@ void F_SecretCreditsDrawer(void)
y += 20<<FRACBITS;
break;
}
if (((y>>FRACBITS) * vid.dupy) > vid.height)
if (((y>>FRACBITS) * vid.dup) > vid.height)
break;
}
}

View file

@ -235,7 +235,7 @@ static void F_TitleBGScroll(INT32 scrollspeed)
pat = W_CachePatchName("TITLEBG1", PU_CACHE);
pat2 = W_CachePatchName("TITLEBG2", PU_CACHE);
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) % (SHORT(pat->width)*16))<<FRACBITS) + (R_GetTimeFrac(RTF_MENU) * scrollspeed))/16;
@ -777,7 +777,7 @@ void F_CreditDrawer(void)
y += 12<<FRACBITS;
break;
}
if (((y>>FRACBITS) * vid.dupy) > vid.height)
if (((y>>FRACBITS) * vid.dup) > vid.height)
break;
}
}
@ -797,7 +797,7 @@ 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;
}
@ -1164,7 +1164,7 @@ void F_BlanCreditDrawer(void)
}
F_DrawDiagCubes();
if (((y>>FRACBITS) * vid.dupy) > vid.height)
if (((y>>FRACBITS) * vid.dup) > vid.height)
break;
}
}
@ -1184,7 +1184,7 @@ void F_BlanCreditTicker(void)
case 1: y += 20<<FRACBITS; break;
default: y += 12<<FRACBITS; break;
}
if (FixedMul(y,vid.dupy) > vid.height)
if (FixedMul(y,vid.dup) > vid.height)
break;
}
@ -1306,9 +1306,8 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
INT32 xscrolled, x, xneg = (scrollxspeed > 0) - (scrollxspeed < 0), tilex;
INT32 yscrolled, y, yneg = (scrollyspeed > 0) - (scrollyspeed < 0), tiley;
boolean xispos = (scrollxspeed >= 0), yispos = (scrollyspeed >= 0);
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
INT16 patwidth, patheight;
INT32 pw, ph; // scaled by dupz
INT32 pw, ph; // scaled by vid.dup
patch_t *pat;
INT32 i, j;
fixed_t fracmenuanimtimer, xscrolltimer, yscrolltimer;
@ -1333,8 +1332,8 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
patwidth = pat->width;
patheight = pat->height;
pw = patwidth * dupz;
ph = patheight * dupz;
pw = patwidth * vid.dup;
ph = patheight * vid.dup;
tilex = max(FixedCeil(FixedDiv(vid.width, pw)) >> FRACBITS, 1)+2; // one tile on both sides of center
tiley = max(FixedCeil(FixedDiv(vid.height, ph)) >> FRACBITS, 1)+2;
@ -1344,8 +1343,8 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
yscrolltimer = ((fracmenuanimtimer*scrollyspeed)/16 + patheight*yneg*FRACUNIT) % (patheight * FRACUNIT);
// coordinate offsets
xscrolled = FixedInt(xscrolltimer * dupz);
yscrolled = FixedInt(yscrolltimer * dupz);
xscrolled = FixedInt(xscrolltimer * vid.dup);
yscrolled = FixedInt(yscrolltimer * vid.dup);
for (x = (xispos) ? -pw*(tilex-1)+pw : 0, i = 0;
i < tilex;
@ -2113,7 +2112,7 @@ static fixed_t F_GetPromptHideHudBound(void)
F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr);
// calc boxheight (see V_DrawPromptBack)
boxh *= vid.dupy;
boxh *= vid.dup;
boxh = (boxh * 4) + (boxh/2)*5; // 4 lines of space plus gaps between and some leeway
// return a coordinate to check

View file

@ -65,7 +65,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;
const cliprect_t *clip = V_GetClipRect();
@ -80,25 +80,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;
break;
case V_SMALLSCALEPATCH:
dupx = (float)vid.smalldupx;
dupy = (float)vid.smalldupy;
break;
case V_MEDSCALEPATCH:
dupx = (float)vid.meddupx;
dupy = (float)vid.meddupy;
break;
case V_NOSCALEPATCH:
dup = 1.0f;
break;
case V_SMALLSCALEPATCH:
dup = (float)vid.smalldup;
break;
case V_MEDSCALEPATCH:
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);
@ -126,15 +122,15 @@ 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))
{
INT32 intx, inty;
intx = (INT32)cx;
inty = (INT32)cy;
V_AdjustXYWithSnap(&intx, &inty, option, dupx, dupy);
V_AdjustXYWithSnap(&intx, &inty, option, dup);
cx = (float)intx;
cy = (float)inty;
}
@ -142,13 +138,13 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
if (pscale != FRACUNIT || (r_splitscreen && option & V_SPLITSCREEN))
{
fwidth = (float)(gpatch->width) * fscalew * dupx;
fheight = (float)(gpatch->height) * fscaleh * dupy;
fwidth = (float)(gpatch->width) * fscalew * dup;
fheight = (float)(gpatch->height) * fscaleh * dup;
}
else
{
fwidth = (float)(gpatch->width) * dupx;
fheight = (float)(gpatch->height) * dupy;
fwidth = (float)(gpatch->width) * dup;
fheight = (float)(gpatch->height) * dup;
}
s_min = t_min = 0.0f;
@ -276,15 +272,15 @@ void HWR_DrawAffinePatch(patch_t *gpatch, fixed_t x, fixed_t y, const affine_t *
HWR_GetMappedPatch(gpatch, colormap);
// positions of the x, y, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
float fwidth = vid.width;// / vid.dupx;
float fheight = vid.height;// / vid.dupy;
float fwidth = vid.width;// / vid.dup;
float fheight = vid.height;// / vid.dup;
float cx = -1.0f + (x / (fwidth/2));
float cy = 1.0f - (y / (fheight/2));
float fa = FIXED_TO_FLOAT(transform->a) / vid.dupx;
float fd = FIXED_TO_FLOAT(transform->d) / vid.dupx;
float fc = FIXED_TO_FLOAT(transform->c) / vid.dupy;
float fb = FIXED_TO_FLOAT(transform->b) / vid.dupy;
float fa = FIXED_TO_FLOAT(transform->a) / vid.dup;
float fd = FIXED_TO_FLOAT(transform->d) / vid.dup;
float fc = FIXED_TO_FLOAT(transform->c) / vid.dup;
float fb = FIXED_TO_FLOAT(transform->b) / vid.dup;
float fx = FIXED_TO_FLOAT(transform->ox);
float fy = FIXED_TO_FLOAT(transform->oy);
@ -403,31 +399,27 @@ 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;
// make patch ready in hardware cache
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;
break;
case V_SMALLSCALEPATCH:
dupx = (float)vid.smalldupx;
dupy = (float)vid.smalldupy;
break;
case V_MEDSCALEPATCH:
dupx = (float)vid.meddupx;
dupy = (float)vid.meddupy;
break;
case V_NOSCALEPATCH:
dup = 1.0f;
break;
case V_SMALLSCALEPATCH:
dup = (float)vid.smalldup;
break;
case V_MEDSCALEPATCH:
dup = (float)vid.meddup;
break;
}
dupx = dupy = (dupx < dupy ? dupx : dupy);
fscale = FIXED_TO_FLOAT(pscale);
// fuck it, no GL support for croppedpatch V_SPLITSCREEN right now. it's not like it's accessible to Lua or anything, and we only use it for menus...
@ -437,8 +429,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))
{
@ -446,19 +438,19 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
// no the patch is cropped do not do this ever
// centre screen
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dup) > 1.0E-36f)
{
if (option & V_SNAPTORIGHT)
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dup));
else if (!(option & V_SNAPTOLEFT))
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dup))/2;
}
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dup) > 1.0E-36f)
{
if (option & V_SNAPTOBOTTOM)
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dup));
else if (!(option & V_SNAPTOTOP))
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2;
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dup))/2;
}
}
}
@ -474,13 +466,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
@ -560,9 +552,9 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
// 0--1
v[0].x = v[3].x = 2.0f * (float)x/vid.width - 1;
v[2].x = v[1].x = 2.0f * (float)(x + patch->width*FIXED_TO_FLOAT(vid.fdupx))/vid.width - 1;
v[2].x = v[1].x = 2.0f * (float)(x + patch->width*FIXED_TO_FLOAT(vid.fdup))/vid.width - 1;
v[0].y = v[1].y = 1.0f - 2.0f * (float)y/vid.height;
v[2].y = v[3].y = 1.0f - 2.0f * (float)(y + patch->height*FIXED_TO_FLOAT(vid.fdupy))/vid.height;
v[2].y = v[3].y = 1.0f - 2.0f * (float)(y + patch->height*FIXED_TO_FLOAT(vid.fdup))/vid.height;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
@ -705,12 +697,12 @@ void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 ac
if (!(color & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
float dup = (float)vid.dup;
fx *= dupx;
fy *= dupy;
fw *= dupx;
fh *= dupy;
fx *= dup;
fy *= dup;
fw *= dup;
fh *= dup;
// adjustxy
}
@ -892,27 +884,27 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
if (!(color & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
float dup = (float)vid.dup;
fx *= dupx;
fy *= dupy;
fw *= dupx;
fh *= dupy;
fx *= dup;
fy *= dup;
fw *= dup;
fh *= dup;
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dup)) > 1.0E-36f)
{
if (color & V_SNAPTORIGHT)
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dup));
else if (!(color & V_SNAPTOLEFT))
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dup)) / 2;
}
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dup)) > 1.0E-36f)
{
// same thing here
if (color & V_SNAPTOBOTTOM)
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dup));
else if (!(color & V_SNAPTOTOP))
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dup)) / 2;
}
}
@ -984,17 +976,17 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32
if (!(color & V_NOSCALESTART))
{
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
float dup = (float)vid.dup;
INT32 intx, inty;
fx *= dupx;
fy *= dupy;
fw *= dupx;
fh *= dupy;
fx *= dup;
fy *= dup;
fw *= dup;
fh *= dup;
intx = (INT32)fx;
inty = (INT32)fy;
V_AdjustXYWithSnap(&intx, &inty, color, dupx, dupy);
V_AdjustXYWithSnap(&intx, &inty, color, dup);
fx = (float)intx;
fy = (float)inty;
}

View file

@ -6112,8 +6112,7 @@ void HWR_RenderPlayerView(void)
{
// V_DrawPatchFill, but for the fourth screen only
patch_t *gpatch = (patch_t *)W_CachePatchName("SRB2BACK", PU_CACHE);
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
INT32 x, y, pw = SHORT(gpatch->width) * dupz, ph = SHORT(gpatch->height) * dupz;
INT32 x, y, pw = SHORT(gpatch->width) * vid.dup, ph = SHORT(gpatch->height) * vid.dup;
for (x = vid.width>>1; x < vid.width; x += pw)
{

View file

@ -2443,7 +2443,7 @@ 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 dupadjust = vid.scaledwidth, duptweak = (dupadjust - BASEVIDWIDTH)/2;
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].spectator)

View file

@ -789,8 +789,8 @@ void K_ObjectTracking(trackingResult_t *result, const vector3_t *point, boolean
}
// Calculate screen size adjustments.
screenWidth = vid.width/vid.dupx;
screenHeight = vid.height/vid.dupy;
screenWidth = vid.scaledwidth;
screenHeight = vid.scaledheight;
if (r_splitscreen >= 2)
{
@ -878,8 +878,8 @@ void K_ObjectTracking(trackingResult_t *result, const vector3_t *point, boolean
}
// adjust to non-green-resolution screen coordinates
result->x -= ((vid.width/vid.dupx) - BASEVIDWIDTH)<<(FRACBITS-((r_splitscreen >= 2) ? 2 : 1));
result->y -= ((vid.height/vid.dupy) - BASEVIDHEIGHT)<<(FRACBITS-((r_splitscreen >= 1) ? 2 : 1));
result->x -= ((vid.scaledwidth) - BASEVIDWIDTH)<<(FRACBITS-((r_splitscreen >= 2) ? 2 : 1));
result->y -= ((vid.scaledheight) - BASEVIDHEIGHT)<<(FRACBITS-((r_splitscreen >= 1) ? 2 : 1));
return;
@ -2367,7 +2367,7 @@ INT32 K_DrawNeoTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines
INT32 i, rightoffset = split ? 160 - 6: BASEVIDWIDTH - 6;
const UINT8 *colormap = NULL;
UINT16 hightlightcolor = 0;
INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2;
INT32 dupadjust = (vid.scaledwidth), duptweak = (dupadjust - BASEVIDWIDTH)/2;
INT32 y2, x2;
// INT32 basey = y, basex = x;
@ -2633,7 +2633,7 @@ void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, IN
INT32 i, rightoffset = 240;
UINT8 *colormap = NULL;
UINT16 hightlightcolor = 0;
INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2;
INT32 dupadjust = (vid.scaledwidth), duptweak = (dupadjust - BASEVIDWIDTH)/2;
int basey = y, basex = x, y2;
(void)hilicol;
@ -4989,7 +4989,7 @@ static void K_drawKartFinish(void)
{
INT32 x, xval, ox, interpx, pwidth;
x = ((vid.width<<FRACBITS)/vid.dupx);
x = ((vid.width<<FRACBITS)/vid.dup);
xval = (SHORT(kptodraw[pnum]->width)<<FRACBITS);
pwidth = max(xval, x);
@ -5266,7 +5266,7 @@ static void K_drawKartFirstPerson(void)
if (r_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 (r_splitscreen)
scale = FRACUNIT/2;

View file

@ -626,7 +626,7 @@ static int libd_draw(lua_State *L)
flags &= ~V_PARAMMASK; // Don't let crashes happen.
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))
@ -660,7 +660,7 @@ static int libd_drawScaled(lua_State *L)
flags &= ~V_PARAMMASK; // Don't let crashes happen.
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))
@ -695,7 +695,7 @@ static int libd_drawStretched(lua_State *L)
flags &= ~V_PARAMMASK; // Don't let crashes happen.
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))
@ -879,7 +879,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 (cv_minihead.value)
@ -905,7 +905,7 @@ static int libd_drawNum(lua_State *L)
flags &= ~V_PARAMMASK; // Don't let crashes happen.
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))
@ -929,7 +929,7 @@ static int libd_drawPaddedNum(lua_State *L)
flags &= ~V_PARAMMASK; // Don't let crashes happen.
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))
@ -954,7 +954,7 @@ static int libd_drawPingNum(lua_State *L)
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
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))
@ -979,7 +979,7 @@ static int libd_drawFill(lua_State *L)
c = (c & ~0xff) | R_GetPaletteRemap(c & 0xff);
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))
@ -1008,7 +1008,7 @@ static int libd_fadeScreen(lua_State *L)
color = R_GetPaletteRemap(color);
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 (strength == maxstrength) // Allow as a shortcut for drawfill...
@ -1041,7 +1041,7 @@ static int libd_drawString(lua_State *L)
HUDONLY
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);
// okay, sorry, this is kind of ugly
@ -1100,7 +1100,7 @@ static int libd_drawTitleCardString(lua_State *L)
HUDONLY
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))
@ -1122,7 +1122,7 @@ static int libd_drawKartString(lua_State *L)
HUDONLY
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))
@ -1145,7 +1145,7 @@ static int libd_setClipRect(lua_State *L)
HUDONLY
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);
cliprectenabled = true;
@ -1162,7 +1162,7 @@ static int libd_clearClipRect(lua_State *L)
HUDONLY
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);
cliprectenabled = false;
@ -1383,19 +1383,11 @@ static int libd_height(lua_State *L)
return 1;
}
static int libd_dupx(lua_State *L)
static 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)
return 2;
}
static 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)
lua_pushinteger(L, vid.dup); // push integral scale (patch scale)
lua_pushfixed(L, vid.fdup); // push fixed point scale (position scale)
return 2;
}
@ -1662,8 +1654,9 @@ static luaL_Reg lib_draw[] = {
// properties
{"width", libd_width},
{"height", libd_height},
{"dupx", libd_dupx},
{"dupy", libd_dupy},
{"dup", libd_dup},
{"dupx", libd_dup},
{"dupy", libd_dup},
{"renderer", libd_renderer},
{"localTransFlag", libd_getlocaltransflag},
{"drawOnMinimap", libd_drawOnMinimap},

View file

@ -199,60 +199,54 @@ static void CalcStringCoords(drawitem_t *item, const char *string)
{
if (!(item->flags & V_NOSCALESTART))
{
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_SPLITSCREEN) && r_splitscreen > 1)
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_SPLITSCREEN|V_SNAPTOLEFT)) == (V_SPLITSCREEN|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;
}
item->x = x;
@ -264,38 +258,37 @@ static void CalcFillCoords(drawitem_t *item)
{
if (!(item->flags & V_NOSCALESTART))
{
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_SPLITSCREEN) && r_splitscreen > 1)
x += (BASEVIDWIDTH * dupx)/2;
x += (BASEVIDWIDTH * dup)/2;
item->x = x;
item->y = y;

View file

@ -457,7 +457,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);
}

View file

@ -2909,10 +2909,10 @@ void MD_DrawGenericMenu(void)
if (menustack[0] == MN_MAIN)
{
INT32 texty = vid.height - 10*vid.dupy;
INT32 texty = vid.height - 10*vid.dup;
#define addtext(f, str) {\
V_DrawThinString(vid.dupx, texty, MENUCAPS|V_NOSCALESTART|f, str);\
texty -= 10*vid.dupy;\
V_DrawThinString(vid.dup, texty, MENUCAPS|V_NOSCALESTART|f, str);\
texty -= 10*vid.dup;\
}
if (customversionstring[0] != '\0')
{
@ -3750,7 +3750,7 @@ void MD_DrawLevelPlatterMenu(void)
UINT8 row = levelselect.row;
INT32 y = lsbasey + FixedInt(levelselect.offsety) - getheadingoffset(row);
INT32 hiliy = INT32_MIN;
INT32 minrows = (vid.height/vid.dupy + lsbasevseperation/2)/lsbasevseperation;
INT32 minrows = (vid.scaledheight + lsbasevseperation/2)/lsbasevseperation;
INT32 cursorx = levelselect.rows[row].wide ? 0 : levelselect.column * lshseperation;
// finds row at top of the screen
@ -3767,7 +3767,7 @@ void MD_DrawLevelPlatterMenu(void)
}
// draw from top to bottom
while (y <= (vid.height/vid.dupy) + lsbasevseperation/2)
while (y <= (vid.scaledheight) + lsbasevseperation/2)
{
M_DrawLevelPlatterRow(row, y);
if (row == levelselect.row)
@ -4740,8 +4740,8 @@ INT32 MR_HandleReplayHutList(INT32 choice)
return true;
}
#define SCALEDVIEWWIDTH (vid.width/vid.dupx)
#define SCALEDVIEWHEIGHT (vid.height/vid.dupy)
#define SCALEDVIEWWIDTH (vid.scaledwidth)
#define SCALEDVIEWHEIGHT (vid.scaledheight)
static void DrawReplayHutReplayInfo(void)
{
patch_t *patch;
@ -5740,9 +5740,9 @@ void MD_DrawMusicTest(void)
x = 90<<FRACBITS;
y = (BASEVIDHEIGHT-32)<<FRACBITS;
y = (BASEVIDWIDTH-(vid.width/vid.dupx))/2;
y = (BASEVIDWIDTH-(vid.scaledwidth))/2;
V_DrawFill(y-1, 20, vid.width/vid.dupx+1, 24, 159);
V_DrawFill(y-1, 20, vid.scaledwidth+1, 24, 159);
{
static fixed_t st_scroll = -FRACUNIT;
const char* titl;
@ -5786,9 +5786,9 @@ void MD_DrawMusicTest(void)
if (curplaying)
{
if (!curplaying->usage || !curplaying->usage[0])
V_DrawString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s", &curplaying->name[0][0]));
V_DrawString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s", &curplaying->name[0][0]));
else {
V_DrawSmallString(vid.dupx, vid.height - 5*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s - %.255s\n", &curplaying->name[0][0], curplaying->usage));
V_DrawSmallString(vid.dup, vid.height - 5*vid.dup, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s - %.255s\n", &curplaying->name[0][0], curplaying->usage));
}
}
}
@ -6527,7 +6527,7 @@ void MD_DrawTimeAttackMenu(void)
// Level record list
if (cv_nextmap.value)
{
INT32 dupadjust = (vid.width/vid.dupx);
INT32 dupadjust = (vid.scaledwidth);
V_DrawFill((BASEVIDWIDTH - dupadjust)>>1, 78, dupadjust, 36, 159);
if (levellistmode != LLM_ITEMBREAKER)

View file

@ -1010,7 +1010,7 @@ static inline boolean M_PNGLib(void)
static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep png_buf)
{
png_uint_16 downscale = apng_downscale ? vid.dupx : 1;
png_uint_16 downscale = apng_downscale ? vid.dup : 1;
png_uint_32 pitch = png_get_rowbytes(png_ptr, png_info_ptr);
PNG_CONST png_uint_32 width = vid.width / downscale;
@ -1076,7 +1076,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal)
apng_downscale = (!!cv_apng_downscale.value);
downscale = apng_downscale ? vid.dupx : 1;
downscale = apng_downscale ? vid.dup : 1;
apng_FILE = fopen(filename,"wb+"); // + mode for reading
if (!apng_FILE)

View file

@ -90,10 +90,10 @@ void R_SetupSkyDraw(void)
*/
void R_SetSkyScale(void)
{
fixed_t difference = vid.fdupx-(vid.dupx<<FRACBITS);
fixed_t difference = vid.fdup-(vid.dup<<FRACBITS);
int i;
for (i = 0; i <= r_splitscreen; ++i)
{
skyscale[i] = FixedDiv(fovtan[i], vid.fdupx+difference);
skyscale[i] = FixedDiv(fovtan[i], vid.fdup+difference);
}
}

View file

@ -803,9 +803,9 @@ void SCR_DisplayMarathonInfo(void)
#define PRIMEV1 13
#define PRIMEV2 17 // I can't believe it! I'm on TV!
antisplice[0] += (entertic - oldentertics)*PRIMEV2;
antisplice[0] %= PRIMEV1*((vid.width/vid.dupx)+1);
antisplice[0] %= PRIMEV1*((vid.scaledwidth)+1);
antisplice[1] += (entertic - oldentertics)*PRIMEV1;
antisplice[1] %= PRIMEV1*((vid.width/vid.dupx)+1);
antisplice[1] %= PRIMEV1*((vid.scaledwidth)+1);
str = va("%i:%02i:%02i.%02i",
G_TicsToHours(marathontime),
G_TicsToMinutes(marathontime, false),

View file

@ -51,8 +51,6 @@ extern "C" {
// global video state
struct viddef_t
{
INT32 modenum; // vidmode num indexes videomodes list
// Each screen is [vid.width*vid.height];
UINT8 *screens[5];
// screens[0] = main display window
@ -64,12 +62,16 @@ struct viddef_t
size_t rowbytes; // bytes per scanline of the VIDEO mode
INT32 width; // PIXELS per scanline
INT32 height;
INT32 modenum; // vidmode num indexes videomodes list
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 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
INT32 scaledheight; // height / dup
#ifdef HWRENDER
INT32 glstate;
#endif

View file

@ -331,7 +331,7 @@ boolean st_overlay;
/*
static INT32 SCZ(INT32 z)
{
return FixedInt(FixedMul(z<<FRACBITS, vid.fdupy));
return FixedInt(FixedMul(z<<FRACBITS, vid.fdup));
}
*/
@ -386,7 +386,7 @@ static INT32 SPLITFLAGS(INT32 f)
/*
static INT32 SCX(INT32 x)
{
return FixedInt(FixedMul(x<<FRACBITS, vid.fdupx));
return FixedInt(FixedMul(x<<FRACBITS, vid.fdup));
}
*/
@ -397,14 +397,14 @@ static INT32 SCR(INT32 r)
//31/10/99: fixed by Hurdler so it _works_ also in hardware mode
// do not scale to resolution for hardware accelerated
// because these modes always scale by default
y = FixedMul(r*FRACUNIT, vid.fdupy); // scale to resolution
y = FixedMul(r*FRACUNIT, vid.fdup); // scale to resolution
if (splitscreen)
{
y >>= 1;
if (stplyrnum != 0)
y += vid.height / 2;
}
return FixedInt(FixedDiv(y, vid.fdupy));
return FixedInt(FixedDiv(y, vid.fdup));
}
#endif
@ -670,7 +670,7 @@ void ST_drawTitleCard(void)
INT32 lvlttlxpos;
INT32 ttlnumxpos;
INT32 zonexpos;
INT32 dupcalc = (vid.width/vid.dupx);
INT32 dupcalc = (vid.scaledwidth);
UINT8 gtc = G_GetGametypeColor(gametype);
INT32 sub = 0;
INT32 bary = (r_splitscreen)
@ -855,7 +855,7 @@ static void ST_overlayDrawer(void)
}
else if (r_splitscreen)
{
V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_SPLITSCREEN, player_names[stplyr-players]);
V_DrawCenteredThinString((vid.scaledwidth)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_SPLITSCREEN, player_names[stplyr-players]);
}
}
}

View file

@ -538,13 +538,13 @@ void VID_BlitLinearScreen(const UINT8 *restrict srcptr, UINT8 *restrict destptr,
}
}
void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 dupy)
void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dup)
{
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx
// dup adjustments pretend that screen width is BASEVIDWIDTH * dup
INT32 screenwidth = vid.width;
INT32 screenheight = vid.height;
INT32 basewidth = BASEVIDWIDTH * dupx;
INT32 baseheight = BASEVIDHEIGHT * dupy;
INT32 basewidth = BASEVIDWIDTH * dup;
INT32 baseheight = BASEVIDHEIGHT * dup;
SINT8 player = -1;
UINT8 i;
@ -572,7 +572,7 @@ void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 du
}
}
if (vid.width != (BASEVIDWIDTH * dupx))
if (vid.width != (BASEVIDWIDTH * dup))
{
if (options & V_SNAPTORIGHT)
*x += (screenwidth - basewidth);
@ -580,7 +580,7 @@ void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 du
*x += (screenwidth - basewidth) / 2;
}
if (vid.height != (BASEVIDHEIGHT * dupy))
if (vid.height != (BASEVIDHEIGHT * dup))
{
if (options & V_SNAPTOBOTTOM)
*y += (screenheight - baseheight);
@ -683,43 +683,38 @@ void V_SetClipRect(fixed_t x, fixed_t y, fixed_t w, fixed_t h, INT32 flags)
// Adjust position.
if (!(flags & V_NOSCALESTART))
{
fixed_t dupx = vid.dupx;
fixed_t dupy = vid.dupy;
fixed_t dup = vid.dup;
if (flags & V_SCALEPATCHMASK)
{
switch ((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;
}
}
dupx = dupy = (dupx < dupy ? dupx : dupy);
// fudge w/h to avoid precision loss (for carefully clipped drawfills)
w += x % (FRACUNIT/dupx);
h += y % (FRACUNIT/dupy);
w += x % (FRACUNIT/dup);
h += y % (FRACUNIT/dup);
x = FixedMul(x, dupx);
y = FixedMul(y, dupy);
w = FixedMul(w, dupx);
h = FixedMul(h, dupy);
x = FixedMul(x, dup);
y = FixedMul(y, dup);
w = FixedMul(w, dup);
h = FixedMul(h, dup);
if (!(flags & V_SCALEPATCHMASK))
{
V_AdjustXYWithSnap(&x, &y, flags, dupx, dupy);
V_AdjustXYWithSnap(&x, &y, flags, dup);
}
}
@ -813,24 +808,21 @@ void V_DrawAffinePatch(fixed_t x, fixed_t y, const affine_t *transform, INT32 sc
if (rendermode == render_none)
return;
INT32 dupx, dupy;
INT32 dup;
switch (scrn & V_SCALEPATCHMASK)
{
case V_NOSCALEPATCH:
dupx = dupy = 1;
break;
case V_SMALLSCALEPATCH:
dupx = vid.smalldupx;
dupy = vid.smalldupy;
break;
case V_MEDSCALEPATCH:
dupx = vid.meddupx;
dupy = vid.meddupy;
break;
default:
dupx = vid.dupx;
dupy = vid.dupy;
break;
case V_NOSCALEPATCH:
dup = 1;
break;
case V_SMALLSCALEPATCH:
dup = vid.smalldup;
break;
case V_MEDSCALEPATCH:
dup = vid.meddup;
break;
default:
dup = vid.dup;
break;
}
if (scrn & V_NOSCALESTART)
@ -840,15 +832,15 @@ void V_DrawAffinePatch(fixed_t x, fixed_t y, const affine_t *transform, INT32 sc
}
else
{
x = FixedMul(x,dupx<<FRACBITS);
y = FixedMul(y,dupy<<FRACBITS);
x += transform->ox * (dupx-1);
y += transform->oy * (dupy-1);
x = FixedMul(x,dup<<FRACBITS);
y = FixedMul(y,dup<<FRACBITS);
x += transform->ox * (dup-1);
y += transform->oy * (dup-1);
x >>= FRACBITS;
y >>= FRACBITS;
if (!(scrn & V_SCALEPATCHMASK)) // Center it if necessary
V_AdjustXYWithSnap(&x, &y, scrn, dupx, dupy);
V_AdjustXYWithSnap(&x, &y, scrn, dup);
}
#ifdef HWRENDER
@ -864,10 +856,10 @@ void V_DrawAffinePatch(fixed_t x, fixed_t y, const affine_t *transform, INT32 sc
if (src == NULL)
return;
const fixed_t a = transform->a / dupx;
const fixed_t b = transform->b / dupx;
const fixed_t c = transform->c / dupy;
const fixed_t d = transform->d / dupy;
const fixed_t a = transform->a / dup;
const fixed_t b = transform->b / dup;
const fixed_t c = transform->c / dup;
const fixed_t d = transform->d / dup;
const fixed_t cx = transform->ox;
const fixed_t cy = transform->oy;
@ -975,7 +967,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
UINT32 alphalevel, blendmode;
fixed_t col, ofs, colfrac, rowfrac, fdup, vdup;
INT32 dupx, dupy;
INT32 dup;
const column_t *column;
UINT8 *desttop, *dest, *deststart, *destend;
const UINT8 *source, *deststop;
@ -1023,30 +1015,26 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
patchdrawtype = (v_translevel) ? TRANSMAPPEDDRAW : MAPPEDDRAW;
}
dupx = vid.dupx;
dupy = vid.dupy;
dup = vid.dup;
if (scrn & V_SCALEPATCHMASK) switch ((scrn & 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);
fdup = vdup = FixedMul(dupx<<FRACBITS, pscale);
fdup = vdup = FixedMul(dup<<FRACBITS, pscale);
if (vscale != pscale)
vdup = FixedMul(dupx<<FRACBITS, vscale);
vdup = FixedMul(dup<<FRACBITS, vscale);
colfrac = FixedDiv(FRACUNIT, fdup);
rowfrac = FixedDiv(FRACUNIT, vdup);
@ -1085,15 +1073,15 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
else
{
x = FixedMul(x,dupx<<FRACBITS);
y = FixedMul(y,dupy<<FRACBITS);
x = FixedMul(x,dup<<FRACBITS);
y = FixedMul(y,dup<<FRACBITS);
x >>= FRACBITS;
y >>= FRACBITS;
// Center it if necessary
if (!(scrn & V_SCALEPATCHMASK))
{
V_AdjustXYWithSnap(&x, &y, scrn, dupx, dupy);
V_AdjustXYWithSnap(&x, &y, scrn, dup);
}
desttop += (y*vidwidth) + x;
@ -1103,11 +1091,11 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
{
pwidth = patch->width<<FRACBITS;
pwidth = FixedMul(pwidth, pscale);
pwidth = FixedMul(pwidth, dupx<<FRACBITS);
pwidth = FixedMul(pwidth, dup<<FRACBITS);
pwidth >>= FRACBITS;
}
else
pwidth = patch->width * dupx;
pwidth = patch->width * dup;
deststart = desttop;
destend = desttop + pwidth;
@ -1529,7 +1517,7 @@ void V_DrawFixedFill(fixed_t x, fixed_t y, INT32 w, INT32 h, INT32 c)
if (!(c & V_NOSCALESTART))
{
INT32 dupx = vid.dupx, dupy = vid.dupy;
INT32 dup = vid.dup;
if (x == 0 && y == 0 && w == BASEVIDWIDTH*FRACUNIT && h == BASEVIDHEIGHT*FRACUNIT)
{ // Clear the entire screen, from dest to deststop. Yes, this really works.
@ -1541,13 +1529,13 @@ void V_DrawFixedFill(fixed_t x, fixed_t y, INT32 w, INT32 h, INT32 c)
return;
}
x = FixedMul(x, dupx);
y = FixedMul(y, dupy);
w = FixedMul(w, dupx);
h = FixedMul(h, dupy);
x = FixedMul(x, dup);
y = FixedMul(y, dup);
w = FixedMul(w, dup);
h = FixedMul(h, dup);
// Center it if necessary
V_AdjustXYWithSnap(&x, &y, c, dupx, dupy);
V_AdjustXYWithSnap(&x, &y, c, dup);
}
else
{
@ -1686,15 +1674,15 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
if (!(c & V_NOSCALESTART))
{
INT32 dupx = vid.dupx, dupy = vid.dupy;
INT32 dup = vid.dup;
x *= dupx;
y *= dupy;
w *= dupx;
h *= dupy;
x *= dup;
y *= dup;
w *= dup;
h *= dup;
// Center it if necessary
V_AdjustXYWithSnap(&x, &y, c, dupx, dupy);
V_AdjustXYWithSnap(&x, &y, c, dup);
}
if (x >= vid.width || y >= vid.height)
@ -1774,14 +1762,14 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
if (!(c & V_NOSCALESTART))
{
INT32 dupx = vid.dupx, dupy = vid.dupy;
INT32 dup = vid.dup;
x *= dupx;
y *= dupy;
wh *= dupx;
x *= dup;
y *= dup;
wh *= dup;
// Center it if necessary
V_AdjustXYWithSnap(&x, &y, c, dupx, dupy);
V_AdjustXYWithSnap(&x, &y, c, dup);
}
if (x >= vid.width || y >= vid.height)
@ -1858,12 +1846,12 @@ void V_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c, UINT16 color, U
if (!(c & V_NOSCALESTART))
{
INT32 dupx = vid.dupx, dupy = vid.dupy;
INT32 dup = vid.dup;
x *= dupx;
y *= dupy;
w *= dupx;
h *= dupy;
x *= dup;
y *= dup;
w *= dup;
h *= dup;
// Center it if necessary
// adjustxy
@ -1911,7 +1899,7 @@ void V_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c, UINT16 color, U
//
void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
{
INT32 u, v, dupx, dupy;
INT32 u, v, dup;
fixed_t dx, dy, xfrac, yfrac;
const UINT8 *src, *deststop;
UINT8 *flat, *dest;
@ -1969,29 +1957,29 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
flat = W_CacheLumpNum(flatnum, PU_CACHE);
dupx = dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
dup = vid.dup;
dest = vid.screens[0] + y*dupy*vid.width + x*dupx;
dest = vid.screens[0] + y*dup*vid.width + x*dup;
deststop = vid.screens[0] + vid.rowbytes * vid.height;
// from V_DrawScaledPatch
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
dest += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
dest += (vid.width - (BASEVIDWIDTH * dup)) / 2;
}
if (vid.height != BASEVIDHEIGHT * dupy)
if (vid.height != BASEVIDHEIGHT * dup)
{
// same thing here
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2;
dest += (vid.height - (BASEVIDHEIGHT * dup)) * vid.width / 2;
}
w *= dupx;
h *= dupy;
w *= dup;
h *= dup;
dx = FixedDiv(FRACUNIT, dupx<<(FRACBITS-2));
dy = FixedDiv(FRACUNIT, dupy<<(FRACBITS-2));
dx = FixedDiv(FRACUNIT, dup<<(FRACBITS-2));
dy = FixedDiv(FRACUNIT, dup<<(FRACBITS-2));
yfrac = 0;
for (v = 0; v < h; v++, dest += vid.width)
@ -2014,8 +2002,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
//
void V_DrawPatchFill(patch_t *pat)
{
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
INT32 x, y, pw = pat->width * dupz, ph = pat->height * dupz;
INT32 x, y, pw = pat->width * vid.dup, ph = pat->height * vid.dup;
for (x = 0; x < vid.width; x += pw)
{
@ -2146,7 +2133,7 @@ void V_DrawVhsEffect(boolean rewind)
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
}
offs += M_RandomKey(vid.dupx<<1);
offs += M_RandomKey(vid.dup<<1);
// lazy way to avoid crashes
if ((y == 0 && offs < 0) || (y >= vid.height-2 && offs > 0))
@ -2308,11 +2295,11 @@ void V_DrawPromptBack(INT32 boxheight, INT32 color)
boxheight = -boxheight;
else // 4 lines of space plus gaps between and some leeway
boxheight = ((boxheight * 4) + (boxheight/2)*5);
V_DrawFill((BASEVIDWIDTH-(vid.width/vid.dupx))/2, BASEVIDHEIGHT-boxheight, (vid.width/vid.dupx),boxheight, (color-256)|V_SNAPTOBOTTOM);
V_DrawFill((BASEVIDWIDTH-(vid.scaledwidth))/2, BASEVIDHEIGHT-boxheight, (vid.scaledwidth),boxheight, (color-256)|V_SNAPTOBOTTOM);
return;
}
boxheight *= vid.dupy;
boxheight *= vid.dup;
if (color == INT32_MAX)
color = cons_backcolor.value;
@ -2708,12 +2695,12 @@ static inline fixed_t FixedCharacterDim(
fixed_t scale,
fixed_t chw,
INT32 hchw,
INT32 dupx,
INT32 dup,
fixed_t * cwp)
{
(void)scale;
(void)hchw;
(void)dupx;
(void)dup;
(*cwp) = chw;
return 0;
}
@ -2722,12 +2709,12 @@ static inline fixed_t VariableCharacterDim(
fixed_t scale,
fixed_t chw,
INT32 hchw,
INT32 dupx,
INT32 dup,
fixed_t * cwp)
{
(void)chw;
(void)hchw;
(void)dupx;
(void)dup;
(*cwp) = FixedMul ((*cwp) << FRACBITS, scale);
return 0;
}
@ -2736,7 +2723,7 @@ static inline fixed_t CenteredCharacterDim(
fixed_t scale,
fixed_t chw,
INT32 hchw,
INT32 dupx,
INT32 dup,
fixed_t * cwp)
{
INT32 cxoff;
@ -2749,19 +2736,19 @@ static inline fixed_t CenteredCharacterDim(
*/
cxoff = hchw -((*cwp) >> 1 );
(*cwp) = chw;
return FixedMul (( cxoff * dupx )<< FRACBITS, scale);
return FixedMul (( cxoff * dup )<< FRACBITS, scale);
}
static inline fixed_t BunchedCharacterDim(
fixed_t scale,
fixed_t chw,
INT32 hchw,
INT32 dupx,
INT32 dup,
fixed_t * cwp)
{
(void)chw;
(void)hchw;
(void)dupx;
(void)dup;
(*cwp) = FixedMul (max (1, (*cwp) - 1) << FRACBITS, scale);
return 0;
}
@ -2894,8 +2881,7 @@ void V_DrawStringScaledEx(
{
INT32 hchw;/* half-width for centering */
INT32 dupx;
INT32 dupy;
INT32 dup;
fixed_t right;
fixed_t bot;
@ -2963,23 +2949,21 @@ void V_DrawStringScaledEx(
if (( flags & V_NOSCALESTART ))
{
dupx = vid.dupx;
dupy = vid.dupy;
dup = vid.dup;
hchw *= dupx;
hchw *= dup;
fontspec.chw *= dupx;
fontspec.spacew *= dupx;
fontspec.lfh *= dupy;
fontspec.chw *= dup;
fontspec.spacew *= dup;
fontspec.lfh *= dup;
right = vid.width;
}
else
{
dupx = 1;
dupy = 1;
dup = 1;
right = ( vid.width / vid.dupx );
right = ( vid.scaledwidth );
if (!( flags & V_SNAPTOLEFT ))
{
left = ( right - BASEVIDWIDTH )/ 2;/* left edge of drawable area */
@ -3052,9 +3036,9 @@ void V_DrawStringScaledEx(
if (V_CharacterValid(font, c) == true)
{
// Remove offsets from patch
fixed_t patchxofs = SHORT (font->font[c]->leftoffset) * dupx * scale;
cw = SHORT (font->font[c]->width) * dupx;
cxoff = (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw);
fixed_t patchxofs = SHORT (font->font[c]->leftoffset) * dup * scale;
cw = SHORT (font->font[c]->width) * dup;
cxoff = (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dup, &cw);
V_DrawStretchyFixedPatch(cx + cxoff + patchxofs, cy + cyoff, scale, vscale,
flags, font->font[c], colormap);
cx += cw;
@ -3078,7 +3062,7 @@ fixed_t V_StringScaledWidth(
{
INT32 hchw;/* half-width for centering */
INT32 dupx;
INT32 dup;
font_t *font;
@ -3118,17 +3102,17 @@ fixed_t V_StringScaledWidth(
if (( flags & V_NOSCALESTART ))
{
dupx = vid.dupx;
dup = vid.dup;
hchw *= dupx;
hchw *= dup;
fontspec.chw *= dupx;
fontspec.spacew *= dupx;
fontspec.lfh *= vid.dupy;
fontspec.chw *= dup;
fontspec.spacew *= dup;
fontspec.lfh *= dup;
}
else
{
dupx = 1;
dup = 1;
}
cx = 0;
@ -3165,14 +3149,14 @@ fixed_t V_StringScaledWidth(
c -= font->start;
if (V_CharacterValid(font, c) == true)
{
cw = SHORT (font->font[c]->width) * dupx;
cw = SHORT (font->font[c]->width) * dup;
// How bunched dims work is by incrementing cx slightly less than a full character width.
// This causes the next character to be drawn overlapping the previous.
// We need to count the full width to get the rightmost edge of the string though.
right = cx + (cw * scale);
(*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw);
(*fontspec.dim_fn)(scale, fontspec.chw, hchw, dup, &cw);
cx += cw;
}
else
@ -3197,7 +3181,7 @@ char * V_ScaledWordWrap(
{
INT32 hchw;/* half-width for centering */
INT32 dupx;
INT32 dup;
font_t *font;
@ -3235,17 +3219,17 @@ char * V_ScaledWordWrap(
if (( flags & V_NOSCALESTART ))
{
dupx = vid.dupx;
dup = vid.dup;
hchw *= dupx;
hchw *= dup;
fontspec.chw *= dupx;
fontspec.spacew *= dupx;
fontspec.lfh *= vid.dupy;
fontspec.chw *= dup;
fontspec.spacew *= dup;
fontspec.lfh *= dup;
}
else
{
dupx = 1;
dup = 1;
}
cx = 0;
@ -3298,14 +3282,14 @@ char * V_ScaledWordWrap(
c -= font->start;
if (V_CharacterValid(font, c) == true)
{
cw = SHORT (font->font[c]->width) * dupx;
cw = SHORT (font->font[c]->width) * dup;
// How bunched dims work is by incrementing cx slightly less than a full character width.
// This causes the next character to be drawn overlapping the previous.
// We need to count the full width to get the rightmost edge of the string though.
right = cx + (cw * scale);
(*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw);
(*fontspec.dim_fn)(scale, fontspec.chw, hchw, dup, &cw);
cx += cw;
}
else
@ -3419,7 +3403,7 @@ INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *color
INT32 w = SHORT(fontv[PINGNUM_FONT].font[0]->width); // this SHOULD always be 5 but I guess custom graphics exist.
if (flags & V_NOSCALESTART)
w *= vid.dupx;
w *= vid.dup;
if (num < 0)
num = -num;
@ -3440,7 +3424,7 @@ INT32 V_DrawPingNumAtFixed(fixed_t x, fixed_t y, INT32 flags, INT32 num, const U
INT32 w = SHORT(fontv[PINGNUM_FONT].font[0]->width); // this SHOULD always be 5 but I guess custom graphics exist.
if (flags & V_NOSCALESTART)
w *= vid.dupx;
w *= vid.dup;
if (num < 0)
num = -num;
@ -3463,7 +3447,7 @@ void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const
INT32 w = SHORT(fontv[PINGNUM_FONT].font[0]->width) - 1;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
w *= vid.dup;
if (num < 0)
num = -num;
@ -3508,7 +3492,7 @@ void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num)
boolean neg;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
w *= vid.dup;
if ((neg = num < 0))
num = -num;
@ -3533,7 +3517,7 @@ void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits)
INT32 w = fontv[TALLNUM_FONT].font[0]->width;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
w *= vid.dup;
if (num < 0)
num = -num;
@ -3552,7 +3536,7 @@ void V_DrawPaddedTallColorNumAtFixed(fixed_t x, fixed_t y, INT32 flags, INT32 nu
INT32 w = fontv[TALLNUM_FONT].font[0]->width;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
w *= vid.dup;
if (num < 0)
num = -num;
@ -3658,7 +3642,7 @@ INT32 V_SubStringWidth(const char *string, INT32 length, INT32 option)
w = max(w, lw);
if (option & (V_NOSCALESTART|V_NOSCALEPATCH))
w *= vid.dupx;
w *= vid.dup;
return w;
}
@ -3965,7 +3949,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
{
// Shift this row of pixels to the right by 2
tmpscr[(y*vid.width)+xoffset] = srcscr[(y*vid.width)+xoffset];
memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset+vid.dupx], viewwidth-vid.dupx);
memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset+vid.dup], viewwidth-vid.dup);
}
else
memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset], viewwidth);
@ -4135,32 +4119,30 @@ void V_Init(void)
void V_Recalc(void)
{
// 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 and v_draw.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);
#ifdef HWRENDER
//if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions in opengl
// 13/11/18:
// The above is no longer necessary, since we want OpenGL to be just like software now
// -- Monster Iestyn
#endif
vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
// calculated once and for all, used by routines in v_video.c and v_draw.c
// Set dup based on width or height, whichever is less
if (((vid.width*FRACUNIT) / BASEVIDWIDTH) < ((vid.height*FRACUNIT) / BASEVIDHEIGHT))
{
vid.dup = vid.width / BASEVIDWIDTH;
vid.fdup = (vid.width*FRACUNIT) / BASEVIDWIDTH;
}
else
{
vid.dup = vid.height / BASEVIDHEIGHT;
vid.fdup = (vid.height*FRACUNIT) / BASEVIDHEIGHT;
}
if (loaded_config // this could use a better name, since it is more and indicator that early startup is done and its safe to do sketchy shit now :chaosleep:
&& (vid.width > 720) && (vid.height > 1280)) // ehhhh well this thing has so many issues, so ill lock it to higher resolutions instead
{
vid.dupx = vid.dupy = FixedDiv(vid.dupy, cv_highreshudscale.value);
vid.fdupx = vid.fdupy = FixedDiv(vid.fdupy, cv_highreshudscale.value);
vid.dup = FixedDiv(vid.dup, cv_highreshudscale.value);
vid.fdup = FixedDiv(vid.fdup, cv_highreshudscale.value);
}
vid.meddupx = (UINT8)(vid.dupx >> 1) + 1;
vid.meddupy = (UINT8)(vid.dupy >> 1) + 1;
vid.scaledwidth = (vid.width/vid.dup);
vid.scaledheight = (vid.height/vid.dup);
vid.smalldupx = (UINT8)(vid.dupx / 3) + 1;
vid.smalldupy = (UINT8)(vid.dupy / 3) + 1;
vid.meddup = (UINT8)(vid.dup >> 1) + 1;
vid.smalldup = (UINT8)(vid.dup / 3) + 1;
}

View file

@ -52,7 +52,7 @@ cv_palette, cv_palettenum;
// Allocates buffer screens, call before R_Init.
void V_Init(void);
// Recalculates the viddef (dupx, dupy, etc.) according to the current screen resolution.
// Recalculates the viddef (dup, etc.) according to the current screen resolution.
void V_Recalc(void);
// Color look-up table
@ -182,7 +182,7 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue);
#define V_NOSCALESTART 0x40000000 // don't scale x, y, start coords
#define V_SPLITSCREEN 0x80000000 // Add half of screen width or height automatically depending on player number
void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 dupy);
void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dup);
struct cliprect_t
{
@ -270,7 +270,7 @@ void V_DrawPromptBack(INT32 boxheight, INT32 color);
V_DrawStringScaledEx(x,y,scale,scale,space_scale,linefeed_scale,option,NULL,font,string)
#define V__DrawOneScaleString( x,y,scale,option,font,string ) \
V_DrawStringScaled(x,y,scale,FRACUNIT,FRACUNIT,option,font,string)
#define V__DrawDupxString( x,y,scale,option,font,string )\
#define V__DrawDupString( x,y,scale,option,font,string )\
V__DrawOneScaleString ((x)<<FRACBITS,(y)<<FRACBITS,scale,option,font,string)
INT32 V_DanceYOffset(INT32 counter);
@ -283,7 +283,7 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UI
UINT8 *V_GetStringColormap(INT32 colorflags);
#define V_DrawLevelTitle( x,y,option,string ) \
V__DrawDupxString (x,y,FRACUNIT,option,LT_FONT,string)
V__DrawDupString (x,y,FRACUNIT,option,LT_FONT,string)
// wordwrap a string using the hu_font
char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string);
@ -320,11 +320,11 @@ char * V_ScaledWordWrap(
// draw a string using the hu_font
#define V_DrawString( x,y,option,string ) \
V__DrawDupxString (x,y,FRACUNIT,option,HU_FONT,string)
V__DrawDupString (x,y,FRACUNIT,option,HU_FONT,string)
#define V_DrawKartString( x,y,option,string ) \
V__DrawDupxString (x,y,FRACUNIT,option,KART_FONT,string)
V__DrawDupString (x,y,FRACUNIT,option,KART_FONT,string)
#define V_DrawScalingKartString( x,y,sc,option,string ) \
V__DrawDupxString (x,y,sc,option,KART_FONT,string)
V__DrawDupString (x,y,sc,option,KART_FONT,string)
#define V_DrawKartStringAtFixed( x,y,option,string ) \
V__DrawOneScaleString (x,y,FRACUNIT,option,KART_FONT,string)
#define V_DrawScalingKartStringAtFixed( x,y,sc,option,string ) \
@ -334,7 +334,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string
// draw a string using the hu_font, 0.5x scale
#define V_DrawSmallString( x,y,option,string ) \
V__DrawDupxString (x,y,FRACUNIT>>1,option,HU_FONT,string)
V__DrawDupString (x,y,FRACUNIT>>1,option,HU_FONT,string)
#define V_DrawSmallStringAtFixed( x,y,option,string ) \
V__DrawOneScaleString (x,y,FRACUNIT>>1,option,HU_FONT,string)
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string);
@ -346,7 +346,7 @@ void V_DrawCenteredStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char
// draw a string using the tny_font
#define V_DrawThinString( x,y,option,string ) \
V__DrawDupxString (x,y,FRACUNIT,option,TINY_FONT,string)
V__DrawDupString (x,y,FRACUNIT,option,TINY_FONT,string)
void V_DrawCenteredThinString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string);

View file

@ -415,8 +415,8 @@ void Y_IntermissionDrawer(void)
if (intertype == int_none || rendermode == render_none)
return;
//INT32 w = (vid.width / vid.dupx);
//INT32 h = (vid.height / vid.dupy);
//INT32 w = vid.scaledwidth;
//INT32 h = (vid.height / vid.dup);
//const INT32 vidxdiff = (w - BASEVIDWIDTH) / 2;
//const INT32 vidydiff = (h - BASEVIDHEIGHT) / 2;
@ -475,29 +475,29 @@ void Y_IntermissionDrawer(void)
INT32 count = (intertic - (rolltic - 8));
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 == 8)
goto skiptallydrawer;
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);
}
else if (sorttic != -1 && intertic > sorttic)
{
INT32 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 == 8)
goto skiptallydrawer;
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_battle || intertype == int_battletime)
{
#define NUMFORNEWCOLUMN 8
INT32 y = 41, gutter = ((data.numplayers > NUMFORNEWCOLUMN) ? 0 : (BASEVIDWIDTH/2));
INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2;
INT32 dupadjust = (vid.scaledwidth), duptweak = (dupadjust - BASEVIDWIDTH)/2;
fixed_t newlist_xpush = (BASEVIDWIDTH/2) * FRACUNIT;
const char *timeheader;
@ -1329,8 +1329,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;
}
@ -1382,7 +1382,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)
{
@ -1460,8 +1460,8 @@ void Y_VoteDrawer(void)
fixed_t picwidth = 160;
// CEP: scale by screen hypotenuse for extra voting rows
INT32 vidx = ((vid.width) / vid.dupx);
INT32 vidy = ((vid.height) / vid.dupy);
INT32 vidx = vid.scaledwidth;
INT32 vidy = ((vid.height) / vid.dup);
fixed_t hypotf = 0;
INT32 hypoti = 0;