From 7da6380dcba9477d60b6ece891ebfe212eeafc02 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 30 Mar 2014 13:53:09 +0000 Subject: [PATCH] Amend r4394: don't use full brightness (glColor() factor 1) with hightiles. This is done by factoring out some polymer.c:polymer_getbuildmaterial() code into polymer_eligible_for_artmapping() and using that. The one in polymer.c can still determine to not use ART mapping on some ("rare"?) occasions, so it's not 100% in sync. git-svn-id: https://svn.eduke32.com/eduke32@4407 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymer.h | 6 ++++++ polymer/eduke32/build/include/polymost.h | 1 + polymer/eduke32/build/src/polymer.c | 2 +- polymer/eduke32/build/src/polymost.c | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index b6f51534c..c2ab4759b 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -351,6 +351,12 @@ static inline void polymer_invalidateartmap(int32_t tilenum) } } +// Compare with eligible_for_tileshades() +static inline int32_t polymer_eligible_for_artmap(int32_t tilenum, const pthtyp *pth) +{ + return ((!pth || !pth->hicr) && tilenum < (MAXTILES - 4)); +} + # ifdef POLYMER_C // CORE diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index 90a14e8aa..3b35198a0 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -56,6 +56,7 @@ extern int32_t r_usetileshades; extern int16_t globalpicnum; extern int32_t globalpal; +// Compare with polymer_eligible_for_artmap() static inline int32_t eligible_for_tileshades(int32_t picnum, int32_t pal) { return (!usehightile || !hicfindsubst(picnum, pal, 0)) && diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 128446d85..763a6be3c 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -4621,7 +4621,7 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile } // Lazily fill in all the textures we need, move this to precaching later - if (pr_artmapping && (!pth || !pth->hicr) && tilenum < (MAXTILES - 4)) { + if (pr_artmapping && polymer_eligible_for_artmap(tilenum, pth)) { if (!prartmaps[tilenum]) { char *tilebuffer = (char *)waloff[tilenum]; char *tempbuffer = (char *)Bmalloc(tilesizx[tilenum] * tilesizy[tilenum]); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index aca57eb76..712849616 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -1526,7 +1526,8 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) float pc[4]; #ifdef POLYMER - if (getrendermode() == REND_POLYMER && pr_artmapping) + if (getrendermode() == REND_POLYMER && pr_artmapping && + polymer_eligible_for_artmap(globalpicnum, pth)) pc[0] = pc[1] = pc[2] = 1.0f; else #endif