From b120bade95914aca3754127fe984144dbdb5f977 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Jul 2020 18:35:47 +0200 Subject: [PATCH] - fixed scuba gear display. Fixes #37. --- source/common/2d/v_draw.cpp | 10 +++++++++- source/games/duke/src/hudweapon_d.cpp | 4 ++-- source/games/duke/src/hudweapon_r.cpp | 2 +- source/glbackend/glbackend.cpp | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/source/common/2d/v_draw.cpp b/source/common/2d/v_draw.cpp index b18f4e94a..3112fe6c4 100644 --- a/source/common/2d/v_draw.cpp +++ b/source/common/2d/v_draw.cpp @@ -340,6 +340,14 @@ static void CalcFullscreenScale(F2DDrawer* drawer, DrawParms *parms, double srcw auto GetWidth = [=]() { return parms->viewport.width; }; auto GetHeight = [=]() {return parms->viewport.height; }; + if (autoaspect == 4) + { + rect.left = rect.top = 0; + rect.width = GetWidth(); + rect.height = GetHeight(); + return; + } + double aspect; if (srcheight == 200) aspect = srcwidth / 240.; else if (srcheight == 400) aspect = srcwidth / 480; @@ -763,7 +771,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double case DTA_FullscreenScale: intval = ListGetInt(tags); - if (intval >= 0 && intval <= 3) + if (intval >= 0 && intval <= 4) { parms->fsscalemode = (uint8_t)intval; } diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index 77cd50c09..6ad9d6d98 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -198,12 +198,12 @@ void displaymasks_d(int snum) if (hud_size < 9) { hud_drawsprite(44, (200 - 8 - tilesiz[SCUBAMASK].y), 65536, 0, SCUBAMASK, 0, p, 2 + 16); - hud_drawsprite((320 - 43), (200 - 8 - tilesiz[SCUBAMASK].y), 65536, 1024, SCUBAMASK, 0, p, 2 + 4 + 16); + hud_drawsprite((320 - 43), (200 - 8 - tilesiz[SCUBAMASK].y), 65536, 0, SCUBAMASK, 0, p, 2 + 4 + 16); } else { hud_drawsprite(44, (200 - tilesiz[SCUBAMASK].y), 65536, 0, SCUBAMASK, 0, p, 2 + 16); - hud_drawsprite((320 - 43), (200 - tilesiz[SCUBAMASK].y), 65536, 1024, SCUBAMASK, 0, p, 2 + 4 + 16); + hud_drawsprite((320 - 43), (200 - tilesiz[SCUBAMASK].y), 65536, 0, SCUBAMASK, 0, p, 2 + 4 + 16); } } } diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index 6dea3b4c4..e9d1fe813 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -79,7 +79,7 @@ void displaymasks_r(int snum) if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_STRETCH; hud_drawsprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15), (200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[(int)totalclock & 2047] >> 10)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin); hud_drawsprite((320 - tilesiz[SCUBAMASK + 4].x), (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin); - hud_drawsprite(tilesiz[SCUBAMASK + 4].x, (200 - tilesiz[SCUBAMASK + 4].y), 65536, 1024, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin); + hud_drawsprite(tilesiz[SCUBAMASK + 4].x, (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin); hud_drawsprite(35, (-1), 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16 + pin); hud_drawsprite(285, 200, 65536, 1024, SCUBAMASK + 3, 0, p, 2 + 16 + pin); } diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index fbdb22b88..95575079d 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -544,14 +544,14 @@ void hud_drawsprite(double sx, double sy, int z, int a, int picnum, int dashade, DTA_TranslationIndex, TRANSLATION(Translation_Remap + curbasepal, dapalnum), DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, - DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, + DTA_FullscreenScale, (dastat & RS_STRETCH)? 4: 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, !(dastat & (RS_TOPLEFT | RS_CENTER)), DTA_TopLeft, !!(dastat & RS_TOPLEFT), DTA_CenterOffset, !!(dastat & RS_CENTER), DTA_FlipX, !!(dastat & RS_YFLIP), // the weapon drawer uses y-flip+180° rotation for x-flip but no other transformation. DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0, DTA_Rotate, a * (-360./2048), - DTA_FlipOffsets, !(dastat & (RS_TOPLEFT | RS_CENTER)), + DTA_FlipOffsets, !(dastat & (/*RS_TOPLEFT |*/ RS_CENTER)), TAG_DONE); }