From fe96cab2545f5add8e6eebc21d736177df9f999c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 Aug 2009 22:10:53 +0000 Subject: [PATCH] - Fixed: paletted texture composition with part translucent patches did not work. SVN r1771 (trunk) --- docs/rh-log.txt | 2 ++ src/textures/multipatchtexture.cpp | 35 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 93ec71a8cf..c03282fdd4 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ August 12, 2009 (Changes by Graf Zahl) +- Fixed: paletted texture composition with part translucent patches + did not work. - Fixed: A_SorcOffense2 depended on args being bytes and overflowing. - Fixed: Even though P_DamageMobj checked an attack's originator for MF2_NODMGTHRUST the same check was missing from P_RadiusAttack. diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 059baca993..2079f2448b 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -494,31 +494,30 @@ void FMultiPatchTexture::MakeTexture () Pixels = new BYTE[numpix]; memset (Pixels, 0, numpix); - // This is not going to be easy for paletted output. Using the - // real time mixing tables gives results that just look bad and - // downconverting a true color image also has its problems so the only - // real choice is to do normal compositing with any translucent patch - // just masking the affected pixels, then do a full true color composition - // and merge these pixels in. for (int i = 0; i < NumParts; ++i) { - BYTE *trans = Parts[i].Translation ? Parts[i].Translation->Remap : NULL; if (Parts[i].op != OP_COPY) { hasTranslucent = true; } - else - { - if (Parts[i].Blend != 0) - { - trans = GetBlendMap(Parts[i].Blend, blendwork); - } - Parts[i].Texture->CopyToBlock (Pixels, Width, Height, - Parts[i].OriginX, Parts[i].OriginY, Parts[i].Rotate, trans); - } } - if (hasTranslucent) + if (!hasTranslucent) + { + for (int i = 0; i < NumParts; ++i) + { + BYTE *trans = Parts[i].Translation ? Parts[i].Translation->Remap : NULL; + { + if (Parts[i].Blend != 0) + { + trans = GetBlendMap(Parts[i].Blend, blendwork); + } + Parts[i].Texture->CopyToBlock (Pixels, Width, Height, + Parts[i].OriginX, Parts[i].OriginY, Parts[i].Rotate, trans); + } + } + } + else { // In case there are translucent patches let's do the composition in // True color to keep as much precision as possible before downconverting to the palette. @@ -1120,7 +1119,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part) static const char *styles[] = {"copy", "translucent", "add", "subtract", "reversesubtract", "modulate", "copyalpha", NULL }; sc.MustGetString(); part.op = sc.MustMatchString(styles); - bComplex = (part.op != OP_COPY); + bComplex |= (part.op != OP_COPY); bTranslucentPatches = bComplex; } }