From 4a6bc850c0e399edc9fbe629d01b7999bf6c343c Mon Sep 17 00:00:00 2001 From: plagman Date: Sun, 7 Jun 2009 23:35:11 +0000 Subject: [PATCH] Fixes full-screen tinting effects to bypass the material cache and apply instantly. git-svn-id: https://svn.eduke32.com/eduke32@1421 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymer.c | 38 +++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 760b966e0..7339256c7 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -3303,13 +3303,6 @@ static void polymer_drawmdsprite(spritetype *tspr) color[0] *= (float)hictinting[tspr->pal].r / 255.0; color[1] *= (float)hictinting[tspr->pal].g / 255.0; color[2] *= (float)hictinting[tspr->pal].b / 255.0; - - if (hictinting[MAXPALOOKUPS-1].r != 255 || hictinting[MAXPALOOKUPS-1].g != 255 || hictinting[MAXPALOOKUPS-1].b != 255) - { - color[0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0; - color[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0; - color[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0; - } } else globalnoeffect=1; //mdloadskin reads this } @@ -3654,13 +3647,6 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile material->diffusemodulation[1] *= (float)hictinting[pal].g / 255.0; material->diffusemodulation[2] *= (float)hictinting[pal].b / 255.0; } - - if (hictinting[MAXPALOOKUPS-1].r != 255 || hictinting[MAXPALOOKUPS-1].g != 255 || hictinting[MAXPALOOKUPS-1].b != 255) - { - material->diffusemodulation[0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0; - material->diffusemodulation[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0; - material->diffusemodulation[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0; - } } @@ -3868,10 +3854,26 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights, // PR_BIT_DIFFUSE_MODULATION if (programbits & prprogrambits[PR_BIT_DIFFUSE_MODULATION].bit) { - bglColor4f(material.diffusemodulation[0], - material.diffusemodulation[1], - material.diffusemodulation[2], - material.diffusemodulation[3]); + // build-specific hack for fullscreen tint on global palette change + if (hictinting[MAXPALOOKUPS-1].r != 255 || + hictinting[MAXPALOOKUPS-1].g != 255 || + hictinting[MAXPALOOKUPS-1].b != 255) + { + GLfloat color[3]; + + color[0] = material.diffusemodulation[0] * (hictinting[MAXPALOOKUPS-1].r / 255.0); + color[1] = material.diffusemodulation[1] * (hictinting[MAXPALOOKUPS-1].g / 255.0); + color[2] = material.diffusemodulation[2] * (hictinting[MAXPALOOKUPS-1].b / 255.0); + + bglColor4f(color[0], + color[1], + color[2], + material.diffusemodulation[3]); + } else + bglColor4f(material.diffusemodulation[0], + material.diffusemodulation[1], + material.diffusemodulation[2], + material.diffusemodulation[3]); } // PR_BIT_SPECULAR_MAP