diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index faf3a56e6..90a14e8aa 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -56,6 +56,12 @@ extern int32_t r_usetileshades; extern int16_t globalpicnum; extern int32_t globalpal; +static inline int32_t eligible_for_tileshades(int32_t picnum, int32_t pal) +{ + return (!usehightile || !hicfindsubst(picnum, pal, 0)) && + (!usemodels || md_tilehasmodel(picnum, pal) < 0); +} + static inline float getshadefactor(int32_t shade) { int32_t shadebound = (shadescale_unbounded || shade>=numshades) ? numshades : numshades-1; @@ -64,8 +70,7 @@ static inline float getshadefactor(int32_t shade) // 8-bit tiles, i.e. non-hightiles and non-models, don't get additional // glColor() shading with r_usetileshades! if (getrendermode() == REND_POLYMOST && r_usetileshades && - (!usehightile || !hicfindsubst(globalpicnum, globalpal, 0)) && - (!usemodels || md_tilehasmodel(globalpicnum, globalpal) < 0)) + eligible_for_tileshades(globalpicnum, globalpal)) return 1.f; return ((float)(numshades-clamped_shade))/(float)numshades; diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 3070a972a..aca57eb76 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -1303,10 +1303,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) double f, r, ox, oy, oz, ox2, oy2, oz2, dd[16], uu[16], vv[16], px[16], py[16], uoffs; int32_t i, j, k, nn, ix0, ix1, tsizx, tsizy; int32_t xx, yy, dorot; -#ifdef USE_OPENGL - pthtyp *pth, *detailpth, *glowpth; - int32_t texunits = GL_TEXTURE0_ARB; -#endif + // backup of the n for possible redrawing of fullbright const int32_t n_ = n, method_ = method; @@ -1390,6 +1387,8 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) if (getrendermode() >= REND_POLYMOST) { float hackscx, hackscy; + pthtyp *pth, *detailpth, *glowpth; + int32_t texunits = GL_TEXTURE0_ARB; if (skyclamphack) method |= 4; pth = our_texcache_fetch(method&(~3)); @@ -1765,21 +1764,6 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) return; } #endif - -/* - if (rendmode == 1) - { - if (method&3) //Only draw border around sprites/maskwalls - { - for (i=0,j=n-1; i: ignored if not in Polymost+r_usetileshades pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int32_t dameth) { int32_t i, j; @@ -35,7 +36,8 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3 j = (dapicnum&(GLTEXCACHEADSIZ-1)); - if (getrendermode() != REND_POLYMOST || !r_usetileshades) dashade = 0; + if (getrendermode() != REND_POLYMOST || !r_usetileshades) + dashade = 0; si = usehightile ? hicfindsubst(dapicnum,dapalnum,drawingskybox) : NULL;