From 8336e80f480ab066b9e433ad01b533fdfd4c5f78 Mon Sep 17 00:00:00 2001 From: drfrag Date: Wed, 1 Apr 2020 14:18:50 +0200 Subject: [PATCH] - Fixed sprites sunk into water on Carmack with HQ resize modes. --- src/rendering/swrenderer/things/r_sprite.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rendering/swrenderer/things/r_sprite.cpp b/src/rendering/swrenderer/things/r_sprite.cpp index cedb0fa22f..dca8dcff39 100644 --- a/src/rendering/swrenderer/things/r_sprite.cpp +++ b/src/rendering/swrenderer/things/r_sprite.cpp @@ -133,11 +133,13 @@ namespace swrenderer if (thing->renderflags & RF_SPRITEFLIP) renderflags ^= RF_XFLIP; - double yscale; + double yscale, origyscale; + int resizeMult = gl_texture_hqresizemult; + + origyscale = spriteScale.Y / tex->GetScale().Y; if (gl_texture_hqresizemode == 0 || gl_texture_hqresizemult < 1 || !(gl_texture_hqresize_targets & 2)) - yscale = spriteScale.Y / tex->GetScale().Y; - else - yscale = spriteScale.Y / tex->GetScale().Y / gl_texture_hqresizemult; + resizeMult = 1; + yscale = origyscale / resizeMult; // store information in a vissprite RenderSprite *vis = thread->FrameMemory->NewObject(); @@ -147,8 +149,8 @@ namespace swrenderer vis->CurrentPortalUniq = renderportal->CurrentPortalUniq; vis->yscale = float(viewport->InvZtoScale * yscale / wallc.sz1); vis->idepth = float(1 / wallc.sz1); - vis->floorclip = thing->Floorclip / yscale; - vis->texturemid = tex->GetTopOffsetSW() - (viewport->viewpoint.Pos.Z - pos.Z + thing->Floorclip) / yscale; + vis->floorclip = thing->Floorclip / origyscale; + vis->texturemid = tex->GetTopOffsetSW() - (viewport->viewpoint.Pos.Z - pos.Z + thing->Floorclip / resizeMult) / yscale; vis->x1 = wallc.sx1 < renderportal->WindowLeft ? renderportal->WindowLeft : wallc.sx1; vis->x2 = wallc.sx2 > renderportal->WindowRight ? renderportal->WindowRight : wallc.sx2; vis->heightsec = heightsec;