From 77cd7bffc5c5bb6bd0a2f543a22d42e3960e735b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 31 Dec 2019 15:50:08 +0100 Subject: [PATCH] - fixed alpha calculations for textured automap. --- source/build/src/polymost.cpp | 4 +--- source/common/2d/v_2ddrawer.cpp | 8 ++++++-- source/common/2d/v_2ddrawer.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 8c0c953f9..0a97657f0 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -4903,9 +4903,7 @@ void polymost_fillpolygon(int32_t npoints) tessectrap((float*)rx1, (float*)ry1, xb1, npoints, &poly); uint8_t const maskprops = (globalorientation>>7)&DAMETH_MASKPROPS; - handle_blend(maskprops > DAMETH_MASK, 0, maskprops == DAMETH_TRANS2); - float alpha = (maskprops > DAMETH_MASK) ? float_trans(maskprops, 0) : 1.f; - twod->AddPoly(TileFiles.tiles[globalpicnum], poly, globalpal, globalshade, alpha); + twod->AddPoly(TileFiles.tiles[globalpicnum], poly, globalpal, globalshade, maskprops); } diff --git a/source/common/2d/v_2ddrawer.cpp b/source/common/2d/v_2ddrawer.cpp index e91ff24ec..89f8616ca 100644 --- a/source/common/2d/v_2ddrawer.cpp +++ b/source/common/2d/v_2ddrawer.cpp @@ -706,7 +706,7 @@ void F2DDrawer::rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16 // //========================================================================== -void F2DDrawer::AddPoly(FTexture* img, F2DPolygons& poly, int palette, int shade, float alpha) +void F2DDrawer::AddPoly(FTexture* img, F2DPolygons& poly, int palette, int shade, int maskprops) { RenderCommand dg = {}; int method = 0; @@ -724,7 +724,11 @@ void F2DDrawer::AddPoly(FTexture* img, F2DPolygons& poly, int palette, int shade #endif PalEntry p = 0xffffffff; - p.a = (uint8_t)(alpha * 255); + if (maskprops > DAMETH_MASK) + { + dg.mRenderStyle = GetBlend(0, maskprops == DAMETH_TRANS2); + p.a = (uint8_t)(float_trans(maskprops, 0) * 255); + } dg.mTexture = img; dg.mRemapIndex = palette | (shade << 16); dg.mVertCount = poly.vertices.Size(); diff --git a/source/common/2d/v_2ddrawer.h b/source/common/2d/v_2ddrawer.h index a50448757..adad2f58b 100644 --- a/source/common/2d/v_2ddrawer.h +++ b/source/common/2d/v_2ddrawer.h @@ -127,7 +127,7 @@ public: public: void AddTexture(FTexture *img, DrawParms &parms); - void AddPoly(FTexture* img, F2DPolygons& poly, int palette, int shade, float alpha); + void AddPoly(FTexture* img, F2DPolygons& poly, int palette, int shade, int maskprops); void AddFlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin); void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr);