diff --git a/src/console.c b/src/console.c index 420740b37..e018e1a1c 100644 --- a/src/console.c +++ b/src/console.c @@ -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 { diff --git a/src/d_main.c b/src/d_main.c index eb1df0c35..eddada2a5 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -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) { diff --git a/src/f_finale.c b/src/f_finale.c index 6126b51b6..f8d2064c8 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -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)<width*16))<>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, 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< vid.height) + + if (FixedMul(y, vid.dup) > vid.height) break; } diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 767b7cbf3..9c43b1988 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -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) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 9cf187b0b..7ad1111a2 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -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; } } diff --git a/src/k_hud.c b/src/k_hud.c index d26d17cb5..7c1a59cea 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -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<height/2)<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)<= 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<width<kartstuff[k_cardanimation])< 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; diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index c6dbd97d2..251a1013c 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -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}, diff --git a/src/lua_hudlib_drawlist.c b/src/lua_hudlib_drawlist.c index cb6594264..f8e7fa33a 100644 --- a/src/lua_hudlib_drawlist.c +++ b/src/lua_hudlib_drawlist.c @@ -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; diff --git a/src/m_anigif.c b/src/m_anigif.c index 3d2ef2e5f..a8cc21bcf 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -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); } diff --git a/src/m_menu.c b/src/m_menu.c index 8c459b1c0..c07d0f270 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1358,8 +1358,8 @@ boolean M_DemoResponder(event_t *ev) default: break; } - } + return eatinput; } @@ -1376,7 +1376,10 @@ static boolean ShouldDrawMenuBG(void) return false; // camera options stuff, only do when in level - if (gamestate == GS_LEVEL && (currentMenu == &OP_CamOptionsDef || currentMenu == &OP_Player1CamOptionsDef || currentMenu == &OP_Player2CamOptionsDef || currentMenu == &OP_Player3CamOptionsDef || currentMenu == &OP_Player4CamOptionsDef)) + if (gamestate == GS_LEVEL && + (currentMenu == &OP_CamOptionsDef || currentMenu == &OP_Player1CamOptionsDef + || currentMenu == &OP_Player2CamOptionsDef || currentMenu == &OP_Player3CamOptionsDef + || currentMenu == &OP_Player4CamOptionsDef)) return false; return true; @@ -1414,17 +1417,17 @@ void M_Drawer(void) { if (customversionstring[0] != '\0') { - V_DrawThinString(vid.dupx, vid.height - 20*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT, "Mod version:"); - V_DrawThinString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring); + V_DrawThinString(vid.dup, vid.height - 20*vid.dup, V_NOSCALESTART|V_TRANSLUCENT, "Mod version:"); + V_DrawThinString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring); } else { #ifdef DEVELOP // Development -- show revision / branch info - V_DrawThinString(vid.dupx, vid.height - 20*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); - V_DrawThinString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); + V_DrawThinString(vid.dup, vid.height - 20*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); + V_DrawThinString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); #else // Regular build - V_DrawThinString(vid.dupx, vid.height - 20*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); // Removeur this for release! im just lazy to make a new flag or smth - V_DrawThinString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); + V_DrawThinString(vid.dup, vid.height - 20*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); // Removeur this for release! im just lazy to make a new flag or smth + V_DrawThinString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); #endif #ifdef HWRENDER @@ -1633,7 +1636,6 @@ void M_StartControlPanel(void) M_RefreshPauseMenu(); } #endif - currentMenu = &MPauseDef; itemOn = mpause_continue; } @@ -1964,19 +1966,19 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv) centerlump[1] = W_GetNumForName("M_THERMM"); cursorlump = W_GetNumForName("M_THERMO"); - V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump, PU_PATCH)); + V_DrawScaledPatch(xx, y, 0, p = (patch_t *)W_CachePatchNum(leftlump, PU_PATCH)); xx += p->width - p->leftoffset; for (i = 0; i < 16; i++) { - V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_PATCH)); + V_DrawScaledPatch(xx, y, V_WRAPX, (patch_t *)W_CachePatchNum(centerlump[i & 1], PU_PATCH)); xx += 8; } - V_DrawScaledPatch(xx, y, 0, W_CachePatchNum(rightlump, PU_PATCH)); + V_DrawScaledPatch(xx, y, 0, (patch_t *)W_CachePatchNum(rightlump, PU_PATCH)); xx = (cv->value - cv->PossibleValue[0].value) * (15*8) / (cv->PossibleValue[1].value - cv->PossibleValue[0].value); - V_DrawScaledPatch((x + 8) + xx, y, 0, W_CachePatchNum(cursorlump, PU_PATCH)); + V_DrawScaledPatch((x + 8) + xx, y, 0, (patch_t *)W_CachePatchNum(cursorlump, PU_PATCH)); } // A smaller 'Thermo', with range given as percents (0-100) @@ -1988,18 +1990,18 @@ static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv, boolean ontop) x = BASEVIDWIDTH - x - SLIDER_WIDTH; - p = W_CachePatchName("M_SLIDEL", PU_PATCH); + p = (patch_t *)W_CachePatchName("M_SLIDEL", PU_PATCH); V_DrawScaledPatch(x - 8, y, 0, p); - p = W_CachePatchName("M_SLIDEM", PU_PATCH); + p = (patch_t *)W_CachePatchName("M_SLIDEM", PU_PATCH); for (i = 0; i < SLIDER_RANGE; i++) V_DrawScaledPatch (x+i*8, y, 0,p); - p = W_CachePatchName("M_SLIDER", PU_PATCH); + p = (patch_t *)W_CachePatchName("M_SLIDER", PU_PATCH); V_DrawScaledPatch(x+i*8, y, 0, p); // draw the slider cursor - p = W_CachePatchName("M_SLIDEC", PU_PATCH); + p = (patch_t *)W_CachePatchName("M_SLIDEC", PU_PATCH); for (i = 0; cv->PossibleValue[i+1].strvalue; i++); @@ -2093,10 +2095,10 @@ static void M_DrawMapEmblems(INT32 mapnum, INT32 x, INT32 y) lasttype = curtype; if (emblem->collected) - V_DrawSmallMappedPatch(x, y, 0, W_CachePatchName(M_GetEmblemPatch(emblem), PU_PATCH), + V_DrawSmallMappedPatch(x, y, 0, (patch_t *)W_CachePatchName(M_GetEmblemPatch(emblem), PU_PATCH), R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_MENUCACHE)); else - V_DrawSmallScaledPatch(x, y, 0, W_CachePatchName("NEEDIT", PU_PATCH)); + V_DrawSmallScaledPatch(x, y, 0, (patch_t *)W_CachePatchName("NEEDIT", PU_PATCH)); emblem = M_GetLevelEmblems(-1); x -= 8; @@ -2107,7 +2109,7 @@ static void M_DrawMenuTitle(void) { if (currentMenu->menutitlepic) { - patch_t *p = W_CachePatchName(currentMenu->menutitlepic, PU_PATCH); + patch_t *p = (patch_t *)W_CachePatchName(currentMenu->menutitlepic, PU_PATCH); if (p->height > 24) // title is larger than normal { @@ -2237,13 +2239,13 @@ static void M_DrawGenericMenu(void) if (currentMenu->menuitems[i].status & IT_CENTER) { patch_t *p; - p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH); + p = (patch_t *)W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH); V_DrawScaledPatch((BASEVIDWIDTH - p->width)/2, y, 0, p); } else { V_DrawScaledPatch(x, y, 0, - W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH)); + (patch_t *)W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH)); } } /* FALLTHRU */ @@ -2315,7 +2317,7 @@ static void M_DrawGenericMenu(void) case IT_GRAYPATCH: if (currentMenu->menuitems[i].patch && currentMenu->menuitems[i].patch[0]) V_DrawMappedPatch(x, y, 0, - W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH), graymap); + (patch_t *)W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH), graymap); y += LINEHEIGHT; break; case IT_TRANSTEXT: @@ -2348,12 +2350,12 @@ static void M_DrawGenericMenu(void) || ((currentMenu->menuitems[itemOn].status & IT_DISPLAY) == IT_NOTHING)) { V_DrawScaledPatch(currentMenu->x + SKULLXOFF, cursory - 5, 0, - W_CachePatchName("M_CURSOR", PU_PATCH)); + (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); } else { V_DrawScaledPatch(currentMenu->x - 24, cursory, 0, - W_CachePatchName("M_CURSOR", PU_PATCH)); + (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); V_DrawString(currentMenu->x, cursory, MENUCAPS|highlightflags, currentMenu->menuitems[itemOn].text); } @@ -2364,7 +2366,7 @@ static void M_DrawGenericMenu(void) static void M_DrawGenericBackgroundMenu(void) { - V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH)); + V_DrawPatchFill((patch_t *)W_CachePatchName("SRB2BACK", PU_PATCH)); M_DrawGenericMenu(); } @@ -2486,7 +2488,7 @@ static void M_DrawGenericScrollMenu(void) // DRAW THE SKULL CURSOR V_DrawScaledPatch(currentMenu->x - 24, cursory, 0, - W_CachePatchName("M_CURSOR", PU_PATCH)); + (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); // dumb hack // tooltips @@ -2507,7 +2509,7 @@ static void M_DrawPauseMenu(void) (currentMenu->y + MPauseMenu[mpause_discordrequests].alphaKey - 1) * FRACUNIT, FRACUNIT, 0, - W_CachePatchName("K_REQUE2", PU_PATCH), + (patch_t *)W_CachePatchName("K_REQUE2", PU_PATCH), NULL ); } @@ -2537,7 +2539,7 @@ static void M_DrawCenteredMenu(void) case IT_PATCH: if (currentMenu->menuitems[i].patch && currentMenu->menuitems[i].patch[0]) { - patch_t *p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH); + patch_t *p = (patch_t *)W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH); if (currentMenu->menuitems[i].status & IT_CENTER) { @@ -2615,7 +2617,7 @@ static void M_DrawCenteredMenu(void) case IT_GRAYPATCH: if (currentMenu->menuitems[i].patch && currentMenu->menuitems[i].patch[0]) V_DrawMappedPatch(x, y, 0, - W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH), graymap); + (patch_t *)W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH), graymap); y += LINEHEIGHT; break; } @@ -2626,12 +2628,12 @@ static void M_DrawCenteredMenu(void) || ((currentMenu->menuitems[itemOn].status & IT_DISPLAY) == IT_NOTHING)) { V_DrawScaledPatch(x + SKULLXOFF, cursory - 5, 0, - W_CachePatchName("M_CURSOR", PU_PATCH)); + (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); } else { V_DrawScaledPatch(x - V_StringWidth(currentMenu->menuitems[itemOn].text, 0)/2 - 24, cursory, 0, - W_CachePatchName("M_CURSOR", PU_PATCH)); + (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); V_DrawCenteredString(x, cursory, highlightflags|MENUCAPS, currentMenu->menuitems[itemOn].text); } } @@ -2934,7 +2936,7 @@ static void M_DrawMessageMenu(void) // hack: draw RA background in RA menus if (gamestate == GS_TIMEATTACK) - V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH)); + V_DrawPatchFill((patch_t *)W_CachePatchName("SRB2BACK", PU_PATCH)); M_DrawTextBox(currentMenu->x, y - 8, (max+7)>>3, mlines); @@ -3000,7 +3002,7 @@ static void M_StopMessage(INT32 choice) // You can even put multiple images in one menu! static void M_DrawImageDef(void) { - patch_t *patch = W_CachePatchName(currentMenu->menuitems[itemOn].text, PU_PATCH); + patch_t *patch = (patch_t *)W_CachePatchName(currentMenu->menuitems[itemOn].text, PU_PATCH); if (patch->width <= BASEVIDWIDTH) V_DrawScaledPatch(0,0,0,patch); else @@ -3124,23 +3126,23 @@ static void M_AddonsInternal(void) W_UnlockCachedPatch(addonsp[i]); } - addonsp[EXT_FOLDER] = W_CachePatchName("M_FFLDR", PU_PATCH); - addonsp[EXT_UP] = W_CachePatchName("M_FBACK", PU_PATCH); - addonsp[EXT_NORESULTS] = W_CachePatchName("M_FNOPE", PU_PATCH); - addonsp[EXT_TXT] = W_CachePatchName("M_FTXT", PU_PATCH); - addonsp[EXT_CFG] = W_CachePatchName("M_FCFG", PU_PATCH); - addonsp[EXT_WAD] = W_CachePatchName("M_FWAD", PU_PATCH); + addonsp[EXT_FOLDER] = (patch_t *)W_CachePatchName("M_FFLDR", PU_PATCH); + addonsp[EXT_UP] = (patch_t *)W_CachePatchName("M_FBACK", PU_PATCH); + addonsp[EXT_NORESULTS] = (patch_t *)W_CachePatchName("M_FNOPE", PU_PATCH); + addonsp[EXT_TXT] = (patch_t *)W_CachePatchName("M_FTXT", PU_PATCH); + addonsp[EXT_CFG] = (patch_t *)W_CachePatchName("M_FCFG", PU_PATCH); + addonsp[EXT_WAD] = (patch_t *)W_CachePatchName("M_FWAD", PU_PATCH); #ifdef USE_KART - addonsp[EXT_KART] = W_CachePatchName("M_FKART", PU_PATCH); + addonsp[EXT_KART] = (patch_t *)W_CachePatchName("M_FKART", PU_PATCH); #endif - addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_PATCH); - addonsp[EXT_SOC] = W_CachePatchName("M_FSOC", PU_PATCH); - addonsp[EXT_LUA] = W_CachePatchName("M_FLUA", PU_PATCH); - addonsp[NUM_EXT] = W_CachePatchName("M_FUNKN", PU_PATCH); - addonsp[NUM_EXT+1] = W_CachePatchName("M_FSEL", PU_PATCH); - addonsp[NUM_EXT+2] = W_CachePatchName("M_FLOAD", PU_PATCH); - addonsp[NUM_EXT+3] = W_CachePatchName("M_FSRCH", PU_PATCH); - addonsp[NUM_EXT+4] = W_CachePatchName("M_FSAVE", PU_PATCH); + addonsp[EXT_PK3] = (patch_t *)W_CachePatchName("M_FPK3", PU_PATCH); + addonsp[EXT_SOC] = (patch_t *)W_CachePatchName("M_FSOC", PU_PATCH); + addonsp[EXT_LUA] = (patch_t *)W_CachePatchName("M_FLUA", PU_PATCH); + addonsp[NUM_EXT] = (patch_t *)W_CachePatchName("M_FUNKN", PU_PATCH); + addonsp[NUM_EXT+1] = (patch_t *)W_CachePatchName("M_FSEL", PU_PATCH); + addonsp[NUM_EXT+2] = (patch_t *)W_CachePatchName("M_FLOAD", PU_PATCH); + addonsp[NUM_EXT+3] = (patch_t *)W_CachePatchName("M_FSRCH", PU_PATCH); + addonsp[NUM_EXT+4] = (patch_t *)W_CachePatchName("M_FSAVE", PU_PATCH); MISC_AddonsDef.prevMenu = currentMenu; M_SetupNextMenu(&MISC_AddonsDef); @@ -4183,8 +4185,6 @@ static void M_HandleReplayHutList(INT32 choice) } } -#define SCALEDVIEWWIDTH (vid.width/vid.dupx) -#define SCALEDVIEWHEIGHT (vid.height/vid.dupy) static void DrawReplayHutReplayInfo(void) { lumpnum_t lumpnum; @@ -4216,9 +4216,9 @@ static void DrawReplayHutReplayInfo(void) //CONS_Printf("%d %s\n", demolist[dir_on[menudepthleft]].map, G_BuildMapName(demolist[dir_on[menudepthleft]].map)); lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(demolist[dir_on[menudepthleft]].map))); if (lumpnum != LUMPERROR) - patch = W_CachePatchNum(lumpnum, PU_PATCH); + patch = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH); else - patch = W_CachePatchName("M_NOLVL", PU_PATCH); + patch = (patch_t *)W_CachePatchName("M_NOLVL", PU_PATCH); if (!(demolist[dir_on[menudepthleft]].kartspeed & DF_ENCORE)) V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch); @@ -4231,7 +4231,7 @@ static void DrawReplayHutReplayInfo(void) { static angle_t rubyfloattime = 0; const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT); - V_DrawFixedPatch((x+(w>>2))<>2))<>2))<>2))<numitems-2; boolean processed_one_this_frame = false; + const INT32 scaledviewheight = (vid.height/vid.dup); static UINT16 replayhutmenuy = 0; - V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH)); + V_DrawPatchFill((patch_t *)W_CachePatchName("SRB2BACK", PU_PATCH)); if (cv_vhseffect.value) V_DrawVhsEffect(false); @@ -4365,8 +4366,8 @@ static void M_DrawReplayHut(void) if (cursory > maxy - 20) cursory = maxy - 20; - if (cursory - replayhutmenuy > SCALEDVIEWHEIGHT-50) - replayhutmenuy += (cursory-SCALEDVIEWHEIGHT-replayhutmenuy + 51)/2; + if (cursory - replayhutmenuy > scaledviewheight-50) + replayhutmenuy += (cursory-scaledviewheight-replayhutmenuy + 51)/2; else if (cursory - replayhutmenuy < 110) replayhutmenuy += (max(0, cursory-110)-replayhutmenuy - 1)/2; } @@ -4407,7 +4408,7 @@ static void M_DrawReplayHut(void) if (localy < 65) continue; - if (localy >= SCALEDVIEWHEIGHT - 24) + if (localy >= scaledviewheight - 24) break; if (demolist[i].type == MD_NOTLOADED && !processed_one_this_frame) @@ -4419,7 +4420,7 @@ static void M_DrawReplayHut(void) if (demolist[i].type == MD_SUBDIR) { localx += 8; - V_DrawScaledPatch(x - 4, localy, V_SNAPTOTOP|V_SNAPTOLEFT, W_CachePatchName(dirmenu[i][DIR_TYPE] == EXT_UP ? "M_RBACK" : "M_RFLDR", PU_PATCH)); + V_DrawScaledPatch(x - 4, localy, V_SNAPTOTOP|V_SNAPTOLEFT, (patch_t *)W_CachePatchName(dirmenu[i][DIR_TYPE] == EXT_UP ? "M_RBACK" : "M_RFLDR", PU_PATCH)); } if (itemOn == replaylistitem && i == (INT16)dir_on[menudepthleft]) @@ -4432,7 +4433,7 @@ static void M_DrawReplayHut(void) replayScrollDelay--; else if (replayScrollDir > 0) { - if (replayScrollTitle < (V_StringWidth(demolist[i].title, 0) - (SCALEDVIEWWIDTH - (x<<1)))<<1) + if (replayScrollTitle < (V_StringWidth(demolist[i].title, 0) - (vid.scaledwidth - (x<<1)))<<1) replayScrollTitle++; else { @@ -4459,15 +4460,15 @@ static void M_DrawReplayHut(void) // Draw scrollbar y = replayqueryfound*10 + currentMenu->menuitems[replaylistitem].alphaKey + 30; - if (y > SCALEDVIEWHEIGHT-80) + if (y > scaledviewheight-80) { - V_DrawFill(BASEVIDWIDTH-4, 75, 4, SCALEDVIEWHEIGHT-80, V_SNAPTOTOP|V_SNAPTORIGHT|239); - V_DrawFill(BASEVIDWIDTH-3, 76 + (SCALEDVIEWHEIGHT-80) * replayhutmenuy / y, 2, (((SCALEDVIEWHEIGHT-80) * (SCALEDVIEWHEIGHT-80))-1) / y - 1, V_SNAPTOTOP|V_SNAPTORIGHT|229); + V_DrawFill(BASEVIDWIDTH-4, 75, 4, scaledviewheight-80, V_SNAPTOTOP|V_SNAPTORIGHT|239); + V_DrawFill(BASEVIDWIDTH-3, 76 + (scaledviewheight-80) * replayhutmenuy / y, 2, (((scaledviewheight-80) * (scaledviewheight-80))-1) / y - 1, V_SNAPTOTOP|V_SNAPTORIGHT|229); } // Draw the cursor V_DrawScaledPatch(currentMenu->x - 24, cursory, V_SNAPTOTOP|V_SNAPTOLEFT, - W_CachePatchName("M_CURSOR", PU_PATCH)); + (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); V_DrawString(currentMenu->x, cursory, V_SNAPTOTOP|V_SNAPTOLEFT|highlightflags, currentMenu->menuitems[itemOn].text); // Now draw some replay info! @@ -4531,7 +4532,7 @@ static void M_DrawReplayStartMenu(void) } else { - patch = W_CachePatchName("M_NORANK", PU_PATCH); + patch = (patch_t *)W_CachePatchName("M_NORANK", PU_PATCH); colormap = R_GetTranslationColormap( TC_RAINBOW, demolist[dir_on[menudepthleft]].standings[i].color, @@ -4549,7 +4550,7 @@ static void M_DrawReplayStartMenu(void) replayScrollDelay--; else if (replayScrollDir > 0) { - if (replayScrollTitle < (i*20 - SCALEDVIEWHEIGHT + 100)<<1) + if (replayScrollTitle < (i*20 - (vid.height/vid.dup) + 100)<<1) replayScrollTitle++; else { @@ -4576,25 +4577,25 @@ static void M_DrawReplayStartMenu(void) // Draw a warning prompt if needed switch (demolist[dir_on[menudepthleft]].addonstatus) { - case DFILE_ERROR_CANNOTLOAD: - warning = "Some addons in this replay cannot be loaded.\nYou can watch anyway, but desyncs may occur."; - break; + case DFILE_ERROR_CANNOTLOAD: + warning = "Some addons in this replay cannot be loaded.\nYou can watch anyway, but desyncs may occur."; + break; - case DFILE_ERROR_NOTLOADED: - case DFILE_ERROR_INCOMPLETEOUTOFORDER: - warning = "Loading addons will mark your game as modified, and Record Attack may be unavailable.\nYou can watch without loading addons, but desyncs may occur."; - break; + case DFILE_ERROR_NOTLOADED: + case DFILE_ERROR_INCOMPLETEOUTOFORDER: + warning = "Loading addons will mark your game as modified, and Record Attack may be unavailable.\nYou can watch without loading addons, but desyncs may occur."; + break; - case DFILE_ERROR_EXTRAFILES: - warning = "You have addons loaded that were not present in this replay.\nYou can watch anyway, but desyncs may occur."; - break; + case DFILE_ERROR_EXTRAFILES: + warning = "You have addons loaded that were not present in this replay.\nYou can watch anyway, but desyncs may occur."; + break; - case DFILE_ERROR_OUTOFORDER: - warning = "You have this replay's addons loaded, but they are out of order.\nYou can watch anyway, but desyncs may occur."; - break; + case DFILE_ERROR_OUTOFORDER: + warning = "You have this replay's addons loaded, but they are out of order.\nYou can watch anyway, but desyncs may occur."; + break; - default: - return; + default: + return; } if (warning) @@ -4707,16 +4708,16 @@ static void M_DrawPlaybackMenu(void) inactivemap = R_GetTranslationColormap(players[ply].skin, players[ply].skincolor, GTC_MENUCACHE); } else if (currentMenu->menuitems[i].patch && W_CheckNumForName(currentMenu->menuitems[i].patch) != LUMPERROR) - icon = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH); + icon = (patch_t *)W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH); else - icon = W_CachePatchName("PLAYRANK", PU_PATCH); // temp + icon = (patch_t *)W_CachePatchName("PLAYRANK", PU_PATCH); // temp } else if (currentMenu->menuitems[i].status == IT_DISABLED) continue; else if (currentMenu->menuitems[i].patch && W_CheckNumForName(currentMenu->menuitems[i].patch) != LUMPERROR) - icon = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH); + icon = (patch_t *)W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH); else - icon = W_CachePatchName("PLAYRANK", PU_PATCH); // temp + icon = (patch_t *)W_CachePatchName("PLAYRANK", PU_PATCH); // temp if ((i == playback_fastforward && cv_playbackspeed.value > 1) || (i == playback_rewind && demo.rewinding)) V_DrawMappedPatch(currentMenu->x + currentMenu->menuitems[i].alphaKey, currentMenu->y, transmap|V_SNAPTOTOP, icon, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_JAWZ, GTC_MENUCACHE)); @@ -5410,9 +5411,9 @@ static void M_DrawMusicTest(void) x = 90<usage[0]) - V_DrawString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s", curplaying->name)); + V_DrawString(vid.dup, vid.height - 10*vid.dup, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s", curplaying->name)); else - V_DrawSmallString(vid.dupx, vid.height - 5*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s - %.255s\n", curplaying->name, curplaying->usage)); + V_DrawSmallString(vid.dup, vid.height - 5*vid.dup, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s - %.255s\n", curplaying->name, curplaying->usage)); if (cv_showmusicfilename.value) V_DrawSmallString(0, 0, V_SNAPTOTOP|V_SNAPTOLEFT|V_ALLOWLOWERCASE, curplaying->filename); @@ -5611,6 +5612,7 @@ static void M_HandleMusicTest(INT32 choice) default: break; } + if (exitmenu) { if (currentMenu->prevMenu) @@ -5731,7 +5733,7 @@ static void M_DrawStatsMaps(void) V_DrawRightAlignedString(BASEVIDWIDTH-16, 50, recommendedflags|MENUCAPS, "(complete)"); V_DrawString(32, 50, MENUCAPS, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems)); - V_DrawSmallScaledPatch(20, 50, 0, W_CachePatchName("GOTITA", PU_PATCH)); + V_DrawSmallScaledPatch(20, 50, 0, (patch_t *)W_CachePatchName("GOTITA", PU_PATCH)); if (location) V_DrawCharacter(10, y-(skullAnimCounter/5), @@ -5802,10 +5804,10 @@ static void M_DrawStatsMaps(void) exemblem = &extraemblems[i]; if (exemblem->collected) - V_DrawSmallMappedPatch(295, y, 0, W_CachePatchName(M_GetExtraEmblemPatch(exemblem), PU_PATCH), + V_DrawSmallMappedPatch(295, y, 0, (patch_t *)W_CachePatchName(M_GetExtraEmblemPatch(exemblem), PU_PATCH), R_GetTranslationColormap(TC_DEFAULT, M_GetExtraEmblemColor(exemblem), GTC_MENUCACHE)); else - V_DrawSmallScaledPatch(295, y, 0, W_CachePatchName("NEEDIT", PU_PATCH)); + V_DrawSmallScaledPatch(295, y, 0, (patch_t *)W_CachePatchName("NEEDIT", PU_PATCH)); V_DrawString(20, y, MENUCAPS, va("%s", exemblem->description)); } @@ -5972,7 +5974,7 @@ void M_DrawTimeAttackMenu(void) //S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback - V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_PATCH)); + V_DrawPatchFill((patch_t *)W_CachePatchName("SRB2BACK", PU_PATCH)); M_DrawMenuTitle(); if (currentMenu == &SP_TimeAttackDef) @@ -6056,21 +6058,21 @@ void M_DrawTimeAttackMenu(void) y = currentMenu->y; // DRAW THE SKULL CURSOR - V_DrawScaledPatch(x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_PATCH)); + V_DrawScaledPatch(x - 24, cursory, 0, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); V_DrawString(x, cursory, highlightflags|MENUCAPS, currentMenu->menuitems[itemOn].text); // Level record list if (cv_nextmap.value) { - INT32 dupadjust = (vid.width/vid.dupx); tic_t lap = 0, time = 0; + if (mainrecords[cv_nextmap.value-1]) { lap = mainrecords[cv_nextmap.value-1]->lap; time = mainrecords[cv_nextmap.value-1]->time; } - V_DrawFill((BASEVIDWIDTH - dupadjust)>>1, 78, dupadjust, 36, 239); + V_DrawFill((BASEVIDWIDTH - vid.scaledwidth)>>1, 78, vid.scaledwidth, 36, 239); V_DrawRightAlignedString(149, 80, highlightflags|MENUCAPS, "Best Lap:"); K_drawKartTimestamp(lap, 19, 86, 0, 2); @@ -6380,10 +6382,8 @@ static void M_ExitGameResponse(INT32 ch) static void M_EndGame(INT32 choice) { (void)choice; - if (demo.playback) - return; - if (!Playing()) + if (demo.playback || !Playing()) return; M_StartMessage(M_GetText("Are you sure you want to end the game?\n\n(Press 'Y' to confirm)\n"), M_ExitGameResponse, MM_YESNO); @@ -6393,8 +6393,7 @@ static void M_EndGame(INT32 choice) // Connect Menu //=========================================================================== -void -M_SetWaitingMode (int mode) +void M_SetWaitingMode(int mode) { #ifdef HAVE_THREADS I_lock_mutex(&m_menu_mutex); @@ -6407,8 +6406,7 @@ M_SetWaitingMode (int mode) #endif } -int -M_GetWaitingMode (void) +int M_GetWaitingMode(void) { int mode; @@ -6427,8 +6425,7 @@ M_GetWaitingMode (void) #ifdef MASTERSERVER #ifdef HAVE_THREADS -static void -Spawn_masterserver_thread (const char *name, void (*thread)(int*)) +static void Spawn_masterserver_thread(const char *name, void (*thread)(int*)) { int *id = malloc(sizeof *id); @@ -6441,8 +6438,7 @@ Spawn_masterserver_thread (const char *name, void (*thread)(int*)) I_spawn_thread(name, (I_thread_fn)thread, id); } -static int -Same_instance (int id) +static int Same_instance(int id) { int okay; @@ -6456,8 +6452,7 @@ Same_instance (int id) } #endif/*HAVE_THREADS*/ -static void -Fetch_servers_thread (int *id) +static void Fetch_servers_thread(int *id) { msg_server_t * server_list; @@ -6554,6 +6549,7 @@ static void M_HandleServerSearch(INT32 choice) } break; } + if (exitmenu) { if (currentMenu->prevMenu) @@ -6899,8 +6895,7 @@ static void M_CheckMODVersion(int id) #if defined (UPDATE_ALERT) && defined (HAVE_THREADS) #ifdef MASTERSERVER -static void -Check_new_version_thread (int *id) +static void Check_new_version_thread(int *id) { M_SetWaitingMode(M_WAITING_VERSION); @@ -7032,7 +7027,6 @@ void M_PopupMasterServerConnectError(void) static void M_PreStartServerMenu(INT32 choice) { - (void)choice; #ifdef MASTERSERVER connect_error_continue = STARTSERVER_MENU; @@ -7144,7 +7138,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) { lumpnum_t lumpnum; patch_t *PictureOfLevel; - INT32 x, y, w, i, oldval, trans, dupadjust = ((vid.width/vid.dupx) - BASEVIDWIDTH)>>1; + INT32 x, y, w, i, oldval, trans, dupadjust = (vid.scaledwidth - BASEVIDWIDTH)>>1; if (levellistmode != LLM_RECORDATTACK) // so it doesent show in record attack menu { @@ -7165,12 +7159,12 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) { lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value))); if (lumpnum != LUMPERROR) - PictureOfLevel = W_CachePatchNum(lumpnum, PU_PATCH); + PictureOfLevel = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH); else - PictureOfLevel = W_CachePatchName("BLANKLVL", PU_PATCH); + PictureOfLevel = (patch_t *)W_CachePatchName("BLANKLVL", PU_PATCH); } else - PictureOfLevel = W_CachePatchName("RANDOMLV", PU_PATCH); + PictureOfLevel = (patch_t *)W_CachePatchName("RANDOMLV", PU_PATCH); w = PictureOfLevel->width/2; i = PictureOfLevel->height/2; @@ -7216,14 +7210,14 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) { /*UINT8 *mappingforencore = NULL; if ((lumpnum = W_CheckNumForName(va("%sE", mapname))) != LUMPERROR) - mappingforencore = W_CachePatchNum(lumpnum, PU_PATCH);*/ + mappingforencore = (patch_t *)W_CachePatchNum(lumpnum, PU_PATCH);*/ V_DrawFixedPatch((x+w)<>ANGLETOFINESHIFT); - V_DrawFixedPatch((x+w/2)< 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {} - V_DrawFixedPatch(x<> FRACBITS) + 1), PU_PATCH), NULL); + V_DrawFixedPatch(x<> FRACBITS) + 1), PU_PATCH), NULL); } x += incrwidth; @@ -7706,10 +7700,10 @@ static void M_DrawSetupMultiPlayerMenu(void) INT32 tw = 0; spritedef_t *sprdef; spriteframe_t *sprframe; - patch_t *statbg = W_CachePatchName("K_STATBG", PU_PATCH); - patch_t *statlr = W_CachePatchName("K_STATLR", PU_PATCH); - patch_t *statud = W_CachePatchName("K_STATUD", PU_PATCH); - patch_t *statdot = W_CachePatchName("K_SDOT0", PU_PATCH); + patch_t *statbg = (patch_t *)W_CachePatchName("K_STATBG", PU_PATCH); + patch_t *statlr = (patch_t *)W_CachePatchName("K_STATLR", PU_PATCH); + patch_t *statud = (patch_t *)W_CachePatchName("K_STATUD", PU_PATCH); + patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0", PU_PATCH); patch_t *patch; UINT8 frame; UINT8 speed; @@ -7737,15 +7731,15 @@ static void M_DrawSetupMultiPlayerMenu(void) // Offsets switch (cv_skinselectmenu.value) { - case SKINMENUTYPE_EXTENDED: - nameboxaddy = 6; - break; - case SKINMENUTYPE_GRID: - nameboxaddy = 6; - break; - default: - nameboxaddy = 0; - break; + case SKINMENUTYPE_EXTENDED: + nameboxaddy = 6; + break; + case SKINMENUTYPE_GRID: + nameboxaddy = 6; + break; + default: + nameboxaddy = 0; + break; } M_DrawTextBox(mx + 32, my - 8 + nameboxaddy, MAXPLAYERNAME, 1); @@ -7889,17 +7883,17 @@ static void M_DrawSetupMultiPlayerMenu(void) if (statdp == true) { //Background - V_DrawScaledPatch(statx - 50, staty + 4, 0, W_CachePatchName("K_STATNB", PU_PATCH)); + V_DrawScaledPatch(statx - 50, staty + 4, 0, (patch_t *)W_CachePatchName("K_STATNB", PU_PATCH)); //Speed for (i = 0; i < GETSELECTEDSPEED; i++) // draw the stat bars { if (i == 0) - V_DrawScaledPatch(statx - 45, staty + 63, 0, W_CachePatchName("K_STATN1", PU_PATCH)); + V_DrawScaledPatch(statx - 45, staty + 63, 0, (patch_t *)W_CachePatchName("K_STATN1", PU_PATCH)); else if (i == GETSELECTEDSPEED -1 ) - V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN3", PU_PATCH)); + V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, (patch_t *)W_CachePatchName("K_STATN3", PU_PATCH)); else - V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN2", PU_PATCH)); + V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, (patch_t *)W_CachePatchName("K_STATN2", PU_PATCH)); } //Weight @@ -7907,11 +7901,11 @@ static void M_DrawSetupMultiPlayerMenu(void) { if (i == 0) - V_DrawScaledPatch(statx - 30, staty + 63, 0, W_CachePatchName("K_STATN4", PU_PATCH)); + V_DrawScaledPatch(statx - 30, staty + 63, 0, (patch_t *)W_CachePatchName("K_STATN4", PU_PATCH)); else if (i == GETSELECTEDWEIGHT -1) - V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN6", PU_PATCH)); + V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, (patch_t *)W_CachePatchName("K_STATN6", PU_PATCH)); else - V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN5", PU_PATCH)); + V_DrawScaledPatch(statx - 30, staty + 63 -(5 *i), 0, (patch_t *)W_CachePatchName("K_STATN5", PU_PATCH)); } } @@ -8041,7 +8035,7 @@ static void M_DrawSetupMultiPlayerMenu(void) UINT8 cursorframe = (I_GetTime() / 4) % 7; - cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); + cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL); } @@ -8089,7 +8083,7 @@ static void M_DrawSetupMultiPlayerMenu(void) { UINT8 cursorframe = (I_GetTime() / 4) % 7; - cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); + cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL); } } @@ -8098,13 +8092,13 @@ static void M_DrawSetupMultiPlayerMenu(void) INT32 selectedskin = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin); speed = skins[selectedskin].kartspeed; weight = skins[selectedskin].kartweight; - statdot = W_CachePatchName("K_SDOT1", PU_PATCH); + statdot = (patch_t *)W_CachePatchName("K_SDOT1", PU_PATCH); if (skullAnimCounter < 4) // SRB2Kart: we draw this dot later so that it's not covered if there's multiple skins with the same stats V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<>1), (((staty+71) + (weight*4))<>1, 0, statdot, flashcol); else V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<>1), (((staty+71) + (weight*4))<>1, 0, statdot, NULL); - statdot = W_CachePatchName("K_SDOT2", PU_PATCH); // coloured center + statdot = (patch_t *)W_CachePatchName("K_SDOT2", PU_PATCH); // coloured center if (setupm_fakecolor) V_DrawFixedPatch((((statx+46+GRIDSTATOFFSET) + (speed*4))<>1), (((staty+71) + (weight*4))<>1, 0, statdot, R_GetTranslationColormap(0, setupm_fakecolor, GTC_MENUCACHE)); } @@ -8153,7 +8147,7 @@ static void M_DrawSetupMultiPlayerMenu(void) { UINT8 cursorframe = (I_GetTime() / 4) % 7; - cursor = W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); + cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL); } } @@ -8164,13 +8158,13 @@ static void M_DrawSetupMultiPlayerMenu(void) speed = skins[setupm_fakeskin].kartspeed; weight = skins[setupm_fakeskin].kartweight; - statdot = W_CachePatchName("K_SDOT1", PU_PATCH); + statdot = (patch_t *)W_CachePatchName("K_SDOT1", PU_PATCH); if (skullAnimCounter < 4) // SRB2Kart: we draw this dot later so that it's not covered if there's multiple skins with the same stats V_DrawFixedPatch(((BASEVIDWIDTH - mx - 80) + ((speed-1)*8))< 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {} - cursor = W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_PATCH); + cursor = (patch_t *)W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_PATCH); if (col < 0) col += numskins; @@ -8309,7 +8303,6 @@ static void M_DrawSetupMultiPlayerMenu(void) sprframe = &sprdef->spriteframes[frame]; //minenice's speen css, it's a piece of shit but hey - //patch = W_CachePatchNum(sprframe->lumppat[1], PU_PATCH); speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8; //this is a very shitty solution for checking if a sprite needs flipping @@ -8317,7 +8310,7 @@ static void M_DrawSetupMultiPlayerMenu(void) if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4)) flags = V_FLIP; // This sprite is left/right flipped! - patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH); + patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH); // draw box around guy V_DrawFill(mx + 36 - (charw/2), my+65, charw, 84, 239); @@ -9276,8 +9269,7 @@ static void M_DrawControl(void) y += SMALLLINEHEIGHT; } - V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, - W_CachePatchName("M_CURSOR", PU_PATCH)); + V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); } #undef controlheight @@ -9666,7 +9658,7 @@ static void M_DrawLocalSkinMenu(void) sprframe = &sprdef->spriteframes[frame]; //minenice's speen css, it's a piece of shit but hey - //patch = W_CachePatchNum(sprframe->lumppat[1], PU_PATCH); + //patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[1], PU_PATCH); speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8; //this is a very shitty solution for checking if a sprite needs flipping @@ -9675,7 +9667,7 @@ static void M_DrawLocalSkinMenu(void) { flags = V_FLIP; // This sprite is left/right flipped! } - patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH); + patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH); // draw box around guy V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239); @@ -9683,9 +9675,11 @@ static void M_DrawLocalSkinMenu(void) // draw player sprite UINT8 *colormap = R_GetLocalTranslationColormap(&skins[displayskin.localnum], (displayskin.localskin ? &localskins[displayskin.localnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, displayskin.localskin); - V_DrawMappedPatch(mx, my+50, 0, W_CachePatchName(displayskin.facewant, PU_PATCH), colormap); - V_DrawMappedPatch(mx+8, my+85, 0, W_CachePatchName(displayskin.facerank, PU_PATCH), colormap); + V_DrawMappedPatch(mx, my+50, 0, (patch_t *)W_CachePatchName(displayskin.facewant, PU_PATCH), colormap); + V_DrawMappedPatch(mx+8, my+85, 0, (patch_t *)W_CachePatchName(displayskin.facerank, PU_PATCH), colormap); + V_DrawString(mx, my+108, V_ALLOWLOWERCASE, "Character"); + if (strlen(displayskin.realname) > 10) V_DrawThinString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, displayskin.realname); else @@ -9693,10 +9687,7 @@ static void M_DrawLocalSkinMenu(void) if (displayskin.flags & SF_HIRES) { - V_DrawFixedPatch((mx+220)<x - 24, cursory, 0, - W_CachePatchName("M_CURSOR", PU_PATCH)); + V_DrawScaledPatch(currentMenu->x - 24, cursory, 0, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH)); } @@ -10043,14 +10032,14 @@ static void M_DrawMonitorToggles(void) #ifdef ITEMTOGGLEBOTTOMRIGHT if (currentMenu->menuitems[thisitem].alphaKey == 255) { - V_DrawScaledPatch(x, y, V_TRANSLUCENT, W_CachePatchName("K_ISBG", PU_PATCH)); + V_DrawScaledPatch(x, y, V_TRANSLUCENT, (patch_t *)W_CachePatchName("K_ISBG", PU_PATCH)); continue; } #endif if (currentMenu->menuitems[thisitem].alphaKey == 0) { - V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBG", PU_PATCH)); - V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISTOGL", PU_PATCH)); + V_DrawScaledPatch(x, y, 0, (patch_t *)W_CachePatchName("K_ISBG", PU_PATCH)); + V_DrawScaledPatch(x, y, 0, (patch_t *)W_CachePatchName("K_ISTOGL", PU_PATCH)); continue; } @@ -10079,18 +10068,18 @@ static void M_DrawMonitorToggles(void) } if (cv->value) - V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBG", PU_PATCH)); + V_DrawScaledPatch(x, y, 0, (patch_t *)W_CachePatchName("K_ISBG", PU_PATCH)); else - V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISBGD", PU_PATCH)); + V_DrawScaledPatch(x, y, 0, (patch_t *)W_CachePatchName("K_ISBGD", PU_PATCH)); if (drawnum != 0) { - V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISMUL", PU_PATCH)); - V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].alphaKey, true), PU_PATCH)); + V_DrawScaledPatch(x, y, 0, (patch_t *)W_CachePatchName("K_ISMUL", PU_PATCH)); + V_DrawScaledPatch(x, y, translucent, (patch_t *)W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].alphaKey, true), PU_PATCH)); V_DrawString(x+24, y+31, V_ALLOWLOWERCASE|translucent, va("x%d", drawnum)); } else - V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].alphaKey, true), PU_PATCH)); + V_DrawScaledPatch(x, y, translucent, (patch_t *)W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].alphaKey, true), PU_PATCH)); y += spacing; } @@ -10103,7 +10092,7 @@ static void M_DrawMonitorToggles(void) #ifdef ITEMTOGGLEBOTTOMRIGHT if (currentMenu->menuitems[itemOn].alphaKey == 255) { - V_DrawScaledPatch(onx-1, ony-2, V_TRANSLUCENT, W_CachePatchName("K_ITBG", PU_PATCH)); + V_DrawScaledPatch(onx-1, ony-2, V_TRANSLUCENT, (patch_t *)W_CachePatchName("K_ITBG", PU_PATCH)); if (shitsfree) { INT32 trans = V_TRANSLUCENT; @@ -10111,15 +10100,15 @@ static void M_DrawMonitorToggles(void) trans = ((10-TICRATE)+shitsfree-1)<menuitems[itemOn].alphaKey == 0) { - V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBG", PU_PATCH)); - V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITTOGL", PU_PATCH)); + V_DrawScaledPatch(onx-1, ony-2, 0, (patch_t *)W_CachePatchName("K_ITBG", PU_PATCH)); + V_DrawScaledPatch(onx-1, ony-2, 0, (patch_t *)W_CachePatchName("K_ITTOGL", PU_PATCH)); } else { @@ -10144,19 +10133,19 @@ static void M_DrawMonitorToggles(void) } if (cv->value) - V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBG", PU_PATCH)); + V_DrawScaledPatch(onx-1, ony-2, 0, (patch_t *)W_CachePatchName("K_ITBG", PU_PATCH)); else - V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITBGD", PU_PATCH)); + V_DrawScaledPatch(onx-1, ony-2, 0, (patch_t *)W_CachePatchName("K_ITBGD", PU_PATCH)); if (drawnum != 0) { - V_DrawScaledPatch(onx-1, ony-2, 0, W_CachePatchName("K_ITMUL", PU_PATCH)); - V_DrawScaledPatch(onx-1, ony-2, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].alphaKey, false), PU_PATCH)); - V_DrawScaledPatch(onx+27, ony+39, translucent, W_CachePatchName("K_ITX", PU_PATCH)); + V_DrawScaledPatch(onx-1, ony-2, 0, (patch_t *)W_CachePatchName("K_ITMUL", PU_PATCH)); + V_DrawScaledPatch(onx-1, ony-2, translucent, (patch_t *)W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].alphaKey, false), PU_PATCH)); + V_DrawScaledPatch(onx+27, ony+39, translucent, (patch_t *)W_CachePatchName("K_ITX", PU_PATCH)); V_DrawKartString(onx+37, ony+34, translucent, va("%d", drawnum)); } else - V_DrawScaledPatch(onx-1, ony-2, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].alphaKey, false), PU_PATCH)); + V_DrawScaledPatch(onx-1, ony-2, translucent, (patch_t *)W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[itemOn].alphaKey, false), PU_PATCH)); } } @@ -10318,7 +10307,7 @@ void M_QuitResponse(INT32 ch) while (ptime > I_GetTime()) { V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - V_DrawSmallScaledPatch(0, 0, 0, W_CachePatchName("GAMEQUIT", PU_PATCH)); // Demo 3 Quit Screen Tails 06-16-2001 + V_DrawSmallScaledPatch(0, 0, 0, (patch_t *)W_CachePatchName("GAMEQUIT", PU_PATCH)); // Demo 3 Quit Screen Tails 06-16-2001 I_FinishUpdate(); // Update the screen with the image Tails 06-19-2001 I_Sleep(cv_sleep.value); I_UpdateTime(cv_timescale.value); @@ -10387,12 +10376,12 @@ static void M_DrawSticker(INT32 x, INT32 y, INT32 width, INT32 flags, boolean is if (isSmall == true) { - stickerEnd = W_CachePatchName("K_STIKE2", PU_PATCH); + stickerEnd = (patch_t *)W_CachePatchName("K_STIKE2", PU_PATCH); height = 6; } else { - stickerEnd = W_CachePatchName("K_STIKEN", PU_PATCH); + stickerEnd = (patch_t *)W_CachePatchName("K_STIKEN", PU_PATCH); height = 11; } @@ -10422,12 +10411,12 @@ static void M_DrawDiscordRequests(void) if (confirmAccept == true) { colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREEN, GTC_MENUCACHE); - hand = W_CachePatchName("K_LAPH02", PU_PATCH); + hand = (patch_t *)W_CachePatchName("K_LAPH02", PU_PATCH); } else { colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_RED, GTC_MENUCACHE); - hand = W_CachePatchName("K_LAPH03", PU_PATCH); + hand = (patch_t *)W_CachePatchName("K_LAPH03", PU_PATCH); } slide = confirmLength - confirmDelay; @@ -10442,7 +10431,7 @@ static void M_DrawDiscordRequests(void) colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GREY, GTC_MENUCACHE); } - V_DrawFixedPatch(56*FRACUNIT, 150*FRACUNIT, FRACUNIT, 0, W_CachePatchName("K_LAPE01", PU_PATCH), colormap); + V_DrawFixedPatch(56*FRACUNIT, 150*FRACUNIT, FRACUNIT, 0, (patch_t *)W_CachePatchName("K_LAPE01", PU_PATCH), colormap); if (hand != NULL) { diff --git a/src/r_sky.c b/src/r_sky.c index 8cbdd3a59..9b0a9262c 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -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<> 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. diff --git a/src/screen.h b/src/screen.h index ce72e168e..df5baee18 100644 --- a/src/screen.h +++ b/src/screen.h @@ -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 diff --git a/src/st_stuff.c b/src/st_stuff.c index ef32162c5..92a33665a 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -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]); } } } diff --git a/src/v_video.c b/src/v_video.c index bc444f764..59a578454 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -661,7 +661,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca UINT32 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; @@ -719,36 +719,38 @@ 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<topoffset<>= FRACBITS; y >>= FRACBITS; @@ -818,26 +820,27 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca } } - 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 ((scrn & (V_HORZSCREEN|V_SNAPTOLEFT)) == (V_HORZSCREEN|V_SNAPTOLEFT)) - x += (vid.width/2 - (BASEVIDWIDTH/2 * dupx)); + x += (vid.width/2 - (BASEVIDWIDTH/2 * dup)); else if (scrn & V_SNAPTORIGHT) - x += (vid.width - (BASEVIDWIDTH * dupx)); + x += (vid.width - (BASEVIDWIDTH * dup)); else if (!(scrn & 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 ((scrn & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP)) - y += (vid.height/2 - (BASEVIDHEIGHT/2 * dupy)); + y += (vid.height/2 - (BASEVIDHEIGHT/2 * dup)); else if (scrn & V_SNAPTOBOTTOM) - y += (vid.height - (BASEVIDHEIGHT * dupy)); + y += (vid.height - (BASEVIDHEIGHT * dup)); else if (!(scrn & V_SNAPTOTOP)) - y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; + y += (vid.height - (BASEVIDHEIGHT * dup)) / 2; } } @@ -848,11 +851,11 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca { pwidth = patch->width<>= FRACBITS; } else - pwidth = patch->width * dupx; + pwidth = patch->width * dup; deststart = desttop; destend = desttop + pwidth; @@ -982,7 +985,6 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_ UINT32 alphalevel = 0; fixed_t col, ofs, colfrac, rowfrac, fdup; - INT32 dupx, dupy; const column_t *column; UINT8 *desttop, *dest; const UINT8 *source, *deststop; @@ -1026,11 +1028,8 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_ } } - // only use one dup, to avoid stretching (har har) - dupx = dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); - fdup = FixedMul(dupx<topoffset<leftoffset<>= FRACBITS; y >>= FRACBITS; @@ -1061,22 +1060,23 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_ // if it's meant to cover the whole screen, black out the rest // no the patch is cropped do not do this ever - if (vid.width != BASEVIDWIDTH * dupx) + if (vid.width != BASEVIDWIDTH * vid.dup) { - // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, + // vid.dup adjustments pretend that screen width is BASEVIDWIDTH * vid.dup, // so center this imaginary screen if (scrn & V_SNAPTORIGHT) - x += (vid.width - (BASEVIDWIDTH * dupx)); + x += (vid.width - (BASEVIDWIDTH * vid.dup)); else if (!(scrn & V_SNAPTOLEFT)) - x += (vid.width - (BASEVIDWIDTH * dupx)) / 2; + x += (vid.width - (BASEVIDWIDTH * vid.dup)) / 2; } - if (vid.height != BASEVIDHEIGHT * dupy) + + if (vid.height != BASEVIDHEIGHT * vid.dup) { // same thing here if (scrn & V_SNAPTOBOTTOM) - y += (vid.height - (BASEVIDHEIGHT * dupy)); + y += (vid.height - (BASEVIDHEIGHT * vid.dup)); else if (!(scrn & V_SNAPTOTOP)) - y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; + y += (vid.height - (BASEVIDHEIGHT * vid.dup)) / 2; } } @@ -1226,42 +1226,41 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) if (!(c & V_NOSCALESTART)) { - INT32 dupx = vid.dupx, dupy = vid.dupy; - if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT) { // Clear the entire screen, from dest to deststop. Yes, this really works. memset(vid.screens[0], (c&255), vid.width * vid.height); return; } - x *= dupx; - y *= dupy; - w *= dupx; - h *= dupy; + x *= vid.dup; + y *= vid.dup; + w *= vid.dup; + h *= vid.dup; // Center it if necessary - if (vid.width != BASEVIDWIDTH * dupx) + if (vid.width != BASEVIDWIDTH * vid.dup) { - // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, + // vid.dup adjustments pretend that screen width is BASEVIDWIDTH * vid.dup, // so center this imaginary screen if (c & V_SNAPTORIGHT) - x += (vid.width - (BASEVIDWIDTH * dupx)); + x += (vid.width - (BASEVIDWIDTH * vid.dup)); else if (!(c & V_SNAPTOLEFT)) - x += (vid.width - (BASEVIDWIDTH * dupx)) / 2; + x += (vid.width - (BASEVIDWIDTH * vid.dup)) / 2; } - if (vid.height != BASEVIDHEIGHT * dupy) + + if (vid.height != BASEVIDHEIGHT * vid.dup) { // same thing here if (c & V_SNAPTOBOTTOM) - y += (vid.height - (BASEVIDHEIGHT * dupy)); + y += (vid.height - (BASEVIDHEIGHT * vid.dup)); else if (!(c & V_SNAPTOTOP)) - y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; + y += (vid.height - (BASEVIDHEIGHT * vid.dup)) / 2; } if (c & V_SPLITSCREEN) - y += (BASEVIDHEIGHT * dupy)/2; + y += (BASEVIDHEIGHT * vid.dup)/2; if (c & V_HORZSCREEN) - x += (BASEVIDWIDTH * dupx)/2; + x += (BASEVIDWIDTH * vid.dup)/2; } if (x >= vid.width || y >= vid.height) @@ -1386,36 +1385,35 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) if (!(c & V_NOSCALESTART)) { - INT32 dupx = vid.dupx, dupy = vid.dupy; - if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT) { // Clear the entire screen, from dest to deststop. Yes, this really works. memset(vid.screens[0], (UINT8)(c&255), vid.width * vid.height); return; } - x *= dupx; - y *= dupy; - w *= dupx; - h *= dupy; + x *= vid.dup; + y *= vid.dup; + w *= vid.dup; + h *= vid.dup; // Center it if necessary - if (vid.width != BASEVIDWIDTH * dupx) + if (vid.width != BASEVIDWIDTH * vid.dup) { - // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, + // vid.dup adjustments pretend that screen width is BASEVIDWIDTH * vid.dup, // so center this imaginary screen if (c & V_SNAPTORIGHT) - x += (vid.width - (BASEVIDWIDTH * dupx)); + x += (vid.width - (BASEVIDWIDTH * vid.dup)); else if (!(c & V_SNAPTOLEFT)) - x += (vid.width - (BASEVIDWIDTH * dupx)) / 2; + x += (vid.width - (BASEVIDWIDTH * vid.dup)) / 2; } - if (vid.height != BASEVIDHEIGHT * dupy) + + if (vid.height != BASEVIDHEIGHT * vid.dup) { // same thing here if (c & V_SNAPTOBOTTOM) - y += (vid.height - (BASEVIDHEIGHT * dupy)); + y += (vid.height - (BASEVIDHEIGHT * vid.dup)); else if (!(c & V_SNAPTOTOP)) - y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; + y += (vid.height - (BASEVIDHEIGHT * vid.dup)) / 2; } } @@ -1477,8 +1475,10 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) w = clip(w,vid.width); h = clip(h,vid.height); #undef clip - for (v = 0; v < h; v++, dest += vid.width) { - for (u = 0; u < w; u++) { + for (v = 0; v < h; v++, dest += vid.width) + { + for (u = 0; u < w; u++) + { dest[u] = fadetable[consolebgmap[dest[u]]]; } } @@ -1511,34 +1511,32 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c) if (!(c & V_NOSCALESTART)) { - INT32 dupx = vid.dupx, dupy = vid.dupy; - - x *= dupx; - y *= dupy; - wh *= dupx; + x *= vid.dup; + y *= vid.dup; + wh *= vid.dup; // Center it if necessary - if (vid.width != BASEVIDWIDTH * dupx) + if (vid.width != BASEVIDWIDTH * vid.dup) { - // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, + // vid.dup adjustments pretend that screen width is BASEVIDWIDTH * vid.dup, // so center this imaginary screen if (c & V_SNAPTORIGHT) - x += (vid.width - (BASEVIDWIDTH * dupx)); + x += (vid.width - (BASEVIDWIDTH * vid.dup)); else if (!(c & V_SNAPTOLEFT)) - x += (vid.width - (BASEVIDWIDTH * dupx)) / 2; + x += (vid.width - (BASEVIDWIDTH * vid.dup)) / 2; } - if (vid.height != BASEVIDHEIGHT * dupy) + if (vid.height != BASEVIDHEIGHT * vid.dup) { // same thing here if (c & V_SNAPTOBOTTOM) - y += (vid.height - (BASEVIDHEIGHT * dupy)); + y += (vid.height - (BASEVIDHEIGHT * vid.dup)); else if (!(c & V_SNAPTOTOP)) - y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; + y += (vid.height - (BASEVIDHEIGHT * vid.dup)) / 2; } if (c & V_SPLITSCREEN) - y += (BASEVIDHEIGHT * dupy)/2; + y += (BASEVIDHEIGHT * vid.dup)/2; if (c & V_HORZSCREEN) - x += (BASEVIDWIDTH * dupx)/2; + x += (BASEVIDWIDTH * vid.dup)/2; } if (x >= vid.width || y >= vid.height) @@ -1591,7 +1589,7 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c) // void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum) { - INT32 u, v, dupx, dupy; + INT32 u, v; fixed_t dx, dy, xfrac, yfrac; const UINT8 *src, *deststop; UINT8 *flat, *dest; @@ -1641,29 +1639,28 @@ 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); - - dest = vid.screens[0] + y*dupy*vid.width + x*dupx; + dest = vid.screens[0] + y*vid.dup*vid.width + x*vid.dup; deststop = vid.screens[0] + vid.width * vid.height; // from V_DrawScaledPatch - if (vid.width != BASEVIDWIDTH * dupx) + if (vid.width != BASEVIDWIDTH * vid.dup) { - // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, + // vid.dup adjustments pretend that screen width is BASEVIDWIDTH * vid.dup, // so center this imaginary screen - dest += (vid.width - (BASEVIDWIDTH * dupx)) / 2; + dest += (vid.width - (BASEVIDWIDTH * vid.dup)) / 2; } - if (vid.height != BASEVIDHEIGHT * dupy) + + if (vid.height != BASEVIDHEIGHT * vid.dup) { // same thing here - dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2; + dest += (vid.height - (BASEVIDHEIGHT * vid.dup)) * vid.width / 2; } - w *= dupx; - h *= dupy; + w *= vid.dup; + h *= vid.dup; - dx = FixedDiv(FRACUNIT, dupx<<(FRACBITS-2)); - dy = FixedDiv(FRACUNIT, dupy<<(FRACBITS-2)); + dx = FixedDiv(FRACUNIT, vid.dup<<(FRACBITS-2)); + dy = FixedDiv(FRACUNIT, vid.dup<<(FRACBITS-2)); yfrac = 0; for (v = 0; v < h; v++, dest += vid.width) @@ -1686,8 +1683,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) { @@ -1756,10 +1752,10 @@ void V_DrawVhsEffect(boolean rewind) UINT8 *thismapstart; SINT8 offs; - UINT8 barsize = vid.dupy<<5; + UINT8 barsize = vid.dup<<5; barsize *= (((vid.height > 1440) && (cv_highreshudscale.value > 1)) ? 3 : 1); - UINT8 updistort = vid.dupx<<(rewind ? 5 : 3); + UINT8 updistort = vid.dup<<(rewind ? 5 : 3); updistort *= (((vid.height > 1440) && (cv_highreshudscale.value > 1)) ? 3 : 1); UINT8 downdistort = updistort>>1; @@ -1767,8 +1763,8 @@ void V_DrawVhsEffect(boolean rewind) if (rewind) V_DrawVhsEffect(false); // experimentation - upbary -= renderdeltatics * (vid.dupy * (rewind ? 3 : 1.8f)); - downbary += renderdeltatics * (vid.dupy * (rewind ? 2 : 1)); + upbary -= renderdeltatics * (vid.dup * (rewind ? 3 : 1.8f)); + downbary += renderdeltatics * (vid.dup * (rewind ? 2 : 1)); if (upbary < -barsize*FRACUNIT) upbary = vid.height<= vid.height-2 && offs > 0)) @@ -2049,7 +2045,7 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) // void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) { - INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0; + INT32 w, c, cx = x, cy = y, dup, scrwidth, center = 0, left = 0; const char *ch = string; INT32 charflags = 0; const UINT8 *colormap = NULL; @@ -2060,14 +2056,14 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) if (option & V_NOSCALESTART) { - dupx = vid.dupx; - dupy = vid.dupy; + dup = vid.dup; scrwidth = vid.width; } else { - dupx = dupy = 1; - scrwidth = vid.width/vid.dupx; + dup = 1; + scrwidth = vid.scaledwidth; + if (!(option & V_SNAPTOLEFT)) { left = (scrwidth - BASEVIDWIDTH)/2; @@ -2111,9 +2107,9 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) cx = x; if (option & V_RETURN8) - cy += 8*dupy; + cy += 8*dup; else - cy += 12*dupy; + cy += 12*dup; continue; } @@ -2126,17 +2122,17 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) // character does not exist or is a space if (c < 0 || c >= HU_FONTSIZE || !hu_font[c]) { - cx += spacewidth * dupx; + cx += spacewidth * dup; continue; } if (charwidth) { - w = charwidth * dupx; - center = w/2 - hu_font[c]->width*dupx/2; + w = charwidth * dup; + center = w/2 - hu_font[c]->width*dup/2; } else - w = hu_font[c]->width * dupx; + w = hu_font[c]->width * dup; if (cx > scrwidth) break; @@ -2155,7 +2151,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) // SRB2kart void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string) { - INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0; + INT32 w, c, cx = x, cy = y, dup, scrwidth, center = 0, left = 0; const char *ch = string; INT32 charflags = 0; const UINT8 *colormap = NULL; @@ -2166,14 +2162,13 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string) if (option & V_NOSCALESTART) { - dupx = vid.dupx; - dupy = vid.dupy; + dup = vid.dup; scrwidth = vid.width; } else { - dupx = dupy = 1; - scrwidth = vid.width/vid.dupx; + dup = 1; + scrwidth = vid.scaledwidth; left = (scrwidth - BASEVIDWIDTH)/2; } @@ -2213,9 +2208,9 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string) cx = x; if (option & V_RETURN8) - cy += 8*dupy; + cy += 8*dup; else - cy += 12*dupy; + cy += 12*dup; continue; } @@ -2228,17 +2223,17 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string) // character does not exist or is a space if (c < 0 || c >= KART_FONTSIZE || !kart_font[c]) { - cx += spacewidth * dupx; + cx += spacewidth * dup; continue; } if (charwidth) { - w = charwidth * dupx; - center = w/2 - kart_font[c]->width*dupx/2; + w = charwidth * dup; + center = w/2 - kart_font[c]->width*dup/2; } else - w = kart_font[c]->width * dupx; + w = kart_font[c]->width * dup; if (cx > scrwidth) break; @@ -2273,7 +2268,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string // void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) { - INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0; + INT32 w, c, cx = x, cy = y, dup, scrwidth, center = 0, left = 0; const char *ch = string; INT32 charflags = 0; const UINT8 *colormap = NULL; @@ -2284,14 +2279,13 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) if (option & V_NOSCALESTART) { - dupx = vid.dupx; - dupy = vid.dupy; + dup = vid.dup; scrwidth = vid.width; } else { - dupx = dupy = 1; - scrwidth = vid.width/vid.dupx; + dup = 1; + scrwidth = vid.scaledwidth; left = (scrwidth - BASEVIDWIDTH)/2; scrwidth -= left; } @@ -2332,9 +2326,9 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) cx = x; if (option & V_RETURN8) - cy += 4*dupy; + cy += 4*dup; else - cy += 6*dupy; + cy += 6*dup; continue; } @@ -2346,19 +2340,21 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) if (c < 0 || c >= HU_FONTSIZE || !hu_font[c]) { - cx += spacewidth * dupx; + cx += spacewidth * dup; continue; } if (charwidth) { - w = charwidth * dupx; - center = w/2 - hu_font[c]->width*dupx/4; + w = charwidth * dup; + center = w/2 - hu_font[c]->width*dup/4; } else - w = hu_font[c]->width * dupx / 2; + w = hu_font[c]->width * dup / 2; + if (cx > scrwidth) break; + if (cx+left + w < 0) //left boundary check { cx += w; @@ -2389,7 +2385,7 @@ void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *s // void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string) { - INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, left = 0; + INT32 w, c, cx = x, cy = y, dup, scrwidth, left = 0; const char *ch = string; INT32 charflags = 0; const UINT8 *colormap = NULL; @@ -2400,14 +2396,13 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string) if (option & V_NOSCALESTART) { - dupx = vid.dupx; - dupy = vid.dupy; + dup = vid.dup; scrwidth = vid.width; } else { - dupx = dupy = 1; - scrwidth = vid.width/vid.dupx; + dup = 1; + scrwidth = vid.scaledwidth; left = (scrwidth - BASEVIDWIDTH)/2; scrwidth -= left; } @@ -2449,9 +2444,9 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string) cx = x; if (option & V_RETURN8) - cy += 8*dupy; + cy += 8*dup; else - cy += 12*dupy; + cy += 12*dup; continue; } @@ -2463,18 +2458,19 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string) if (c < 0 || c >= HU_FONTSIZE || !tny_font[c]) { - cx += spacewidth * dupx; + cx += spacewidth * dup; continue; } if (charwidth) - w = charwidth * dupx; + w = charwidth * dup; else w = ((option & V_6WIDTHSPACE ? max(1, tny_font[c]->width-1) // Reuse this flag for the alternate bunched-up spacing - : tny_font[c]->width) * dupx); + : tny_font[c]->width) * dup); if (cx > scrwidth) break; + if (cx+left + w < 0) //left boundary check { cx += w; @@ -2503,7 +2499,7 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) { fixed_t cx = x, cy = y; - INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0; + INT32 w, c, dup, scrwidth, center = 0, left = 0; const char *ch = string; INT32 spacewidth = 4, charwidth = 0; @@ -2512,14 +2508,13 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) if (option & V_NOSCALESTART) { - dupx = vid.dupx; - dupy = vid.dupy; + dup = vid.dup; scrwidth = vid.width; } else { - dupx = dupy = 1; - scrwidth = vid.width/vid.dupx; + dup = 1; + scrwidth = vid.scaledwidth; left = (scrwidth - BASEVIDWIDTH)/2; scrwidth -= left; } @@ -2542,16 +2537,18 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) { if (!*ch) break; + if (*ch & 0x80) //color ignoring continue; + if (*ch == '\n') { cx = x; if (option & V_RETURN8) - cy += (8*dupy)<= HU_FONTSIZE || !hu_font[c]) { - cx += (spacewidth * dupx)<width*(dupx/2); + w = charwidth * dup; + center = w/2 - hu_font[c]->width*(dup/2); } else - w = hu_font[c]->width * dupx; + w = hu_font[c]->width * dup; if ((cx>>FRACBITS) > scrwidth) break; + if ((cx>>FRACBITS)+left + w < 0) //left boundary check { cx += w<= HU_FONTSIZE || !hu_font[c]) { - cx += (spacewidth * dupx)<width*(dupx/4); + w = charwidth * dup; + center = w/2 - hu_font[c]->width*(dup/4); } else - w = hu_font[c]->width * dupx / 2; + w = hu_font[c]->width * dup / 2; + if ((cx>>FRACBITS) > scrwidth) break; + if ((cx>>FRACBITS)+left + w < 0) //left boundary check { cx += w<= HU_FONTSIZE || !tny_font[c]) { - cx += (spacewidth * dupx)<width*(dupx/2); + w = charwidth * dup; + center = w/2 - tny_font[c]->width*(dup/2); } else - w = tny_font[c]->width * dupx; + w = tny_font[c]->width * dup; if ((cx>>FRACBITS) > scrwidth) break; + if ((cx>>FRACBITS)+left + w < 0) //left boundary check { cx += w<width; if (flags & V_NOSCALESTART) - w *= vid.dupx; + w *= vid.dup; if (num < 0) num = -num; @@ -2842,7 +2855,7 @@ void V_DrawPaddedTallColorNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 di INT32 w = tallnum[0]->width; if (flags & V_NOSCALESTART) - w *= vid.dupx; + w *= vid.dup; if (num < 0) num = -num; @@ -2864,7 +2877,7 @@ INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *color INT32 w = pingnum[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; @@ -2887,7 +2900,7 @@ void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const INT32 w = ranknum[0]->width - 1; if (flags & V_NOSCALESTART) - w *= vid.dupx; + w *= vid.dup; if (num < 0) num = -num; @@ -2907,7 +2920,7 @@ void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const // void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string) { - INT32 w, c, dupx, dupy, scrwidth = BASEVIDWIDTH; + INT32 w, c, dup, scrwidth = BASEVIDWIDTH; fixed_t cx = x, cy = y; const char *ch = string; @@ -2917,33 +2930,36 @@ void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string) if (option & V_NOSCALESTART) { - dupx = vid.dupx; - dupy = vid.dupy; + dup = vid.dup; scrwidth = vid.width; } else - dupx = dupy = 1; + dup = 1; for (;;) { c = *ch++; + if (!c) break; + if (c == '\n') { cx = x; - cy += (12*dupy)<= CRED_FONTSIZE) { - cx += (16*dupx)<width * dupx; + w = cred_font[c]->width * dup; + if ((cx>>FRACBITS) > scrwidth) break; @@ -2980,19 +2996,18 @@ INT32 V_CreditStringWidth(const char *string) // void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string) { - INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, left = 0; + INT32 w, c, cx = x, cy = y, dup, scrwidth, left = 0; const char *ch = string; if (option & V_NOSCALESTART) { - dupx = vid.dupx; - dupy = vid.dupy; + dup = vid.dup; scrwidth = vid.width; } else { - dupx = dupy = 1; - scrwidth = vid.width/vid.dupx; + dup = 1; + scrwidth = vid.scaledwidth; left = (scrwidth - BASEVIDWIDTH)/2; scrwidth -= left; } @@ -3000,25 +3015,30 @@ void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string) for (;;) { c = *ch++; + if (!c) break; + if (c == '\n') { cx = x; - cy += 12*dupy; + cy += 12*dup; continue; } c = toupper(c) - LT_FONTSTART; + if (c < 0 || c >= LT_FONTSIZE || !lt_font[c]) { - cx += 12*dupx; + cx += 12*dup; continue; } - w = lt_font[c]->width * dupx; + w = lt_font[c]->width * dup; + if (cx > scrwidth) break; + if (cx+left + w < 0) //left boundary check { cx += w; @@ -3668,7 +3688,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]; - M_Memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset+vid.dupx], viewwidth-vid.dupx); + M_Memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset+vid.dup], viewwidth-vid.dup); } else M_Memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset], viewwidth); @@ -3830,3 +3850,33 @@ void V_Init(void) CONS_Debug(DBG_RENDER, " screens[%d] = %x\n", i, screens[i]); #endif } + +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 + + // 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.dup = FixedDiv(vid.dup, cv_highreshudscale.value); + vid.fdup = FixedDiv(vid.fdup, cv_highreshudscale.value); + } + + vid.scaledwidth = (vid.width/vid.dup); + + vid.meddup = (UINT8)(vid.dup >> 1) + 1; + vid.smalldup = (UINT8)(vid.dup / 3) + 1; +} diff --git a/src/v_video.h b/src/v_video.h index 1032082be..6213dc1bb 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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) diff --git a/src/y_inter.c b/src/y_inter.c index 76479aa42..c1bdafd32 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -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) / (8 * vid.dupx); + x -= ((((count<>FRACBITS) / (8 * vid.dup); else if (count < 16) - x += (((((16 - count)<>FRACBITS) / (8 * vid.dupx); + x += (((((16 - count)<>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) {