diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 9cdc6a835..4033eb994 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -852,6 +852,13 @@ extern int32_t rendmode; EXTERN int32_t h_xsize[MAXTILES], h_ysize[MAXTILES]; EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES]; +enum { + GLOBAL_NO_GL_TILESHADES = 1<<0, + GLOBAL_NO_GL_FULLBRIGHT = 1<<1, +}; + +extern int32_t globalflags; + extern const char *engineerrstr; EXTERN int32_t editorzrange[2]; diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index e2ee4e39e..31eba71fb 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -77,6 +77,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 && + !(globalflags & GLOBAL_NO_GL_TILESHADES) && eligible_for_tileshades(globalpicnum, globalpal)) return 1.f; diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index eff7ff21a..01fbce4af 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -92,6 +92,7 @@ enum scripttoken_t T_NOFULLBRIGHTRANGE, T_MAPINFO, T_MAPFILE, T_MAPTITLE, T_MAPMD4, T_MHKFILE, T_ECHO, + T_GLOBALFLAGS, }; static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0; @@ -277,6 +278,7 @@ static int32_t defsparser(scriptfile *script) { "tilefromtexture", T_TILEFROMTEXTURE }, { "mapinfo", T_MAPINFO }, { "echo", T_ECHO }, + { "globalflags", T_GLOBALFLAGS }, }; while (1) @@ -2210,6 +2212,12 @@ static int32_t defsparser(scriptfile *script) } break; + case T_GLOBALFLAGS: + { + if (scriptfile_getnumber(script,&globalflags)) break; + } + break; + default: initprintf("Unknown token.\n"); break; } diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 9032fa6a1..d680195ee 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -180,6 +180,8 @@ static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1; int32_t r_usenewaspect = 1, newaspect_enable=0; uint32_t r_screenxy = 0; +int32_t globalflags; + int32_t curbrightness = 0, gammabrightness = 0; float vid_gamma = DEFAULT_GAMMA; diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 90adc48df..181e228f6 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -4541,7 +4541,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 && polymer_eligible_for_artmap(tilenum, pth)) { + if (pr_artmapping && !(globalflags & GLOBAL_NO_GL_TILESHADES) && polymer_eligible_for_artmap(tilenum, pth)) { if (!prartmaps[tilenum]) { char *tilebuffer = (char *)waloff[tilenum]; char *tempbuffer = (char *)Xmalloc(tilesiz[tilenum].x * tilesiz[tilenum].y); @@ -4722,6 +4722,7 @@ static int32_t polymer_bindmaterial(const _prmaterial *material, int16_t* l // PR_BIT_ART_MAP if (pr_artmapping && material->artmap && + !(globalflags & GLOBAL_NO_GL_TILESHADES) && (overridematerial & prprogrambits[PR_BIT_ART_MAP].bit)) { programbits |= prprogrambits[PR_BIT_ART_MAP].bit; } else diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index d62cff649..4384f06a5 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -442,6 +442,7 @@ static void fogcalc_old(int32_t shade, int32_t vis) static inline void fogcalc(int32_t tile, int32_t shade, int32_t vis, int32_t pal) { if (shade > 0 && getrendermode() == REND_POLYMOST && r_usetileshades == 1 && + !(globalflags & GLOBAL_NO_GL_TILESHADES) && (!usehightile || !hicfindsubst(tile, pal)) && (!usemodels || md_tilehasmodel(tile, pal) < 0)) shade >>= 1; @@ -848,7 +849,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t dashade, int32_t dameth } else { - const int dofullbright = !(picanm[dapic].sf & PICANM_NOFULLBRIGHT_BIT); + const int dofullbright = !(picanm[dapic].sf & PICANM_NOFULLBRIGHT_BIT) && !(globalflags & GLOBAL_NO_GL_FULLBRIGHT); for (int y = 0; y < siz.y; y++) { @@ -1302,7 +1303,7 @@ static float alpha = 0.f; static inline pthtyp *our_texcache_fetch(int32_t dameth) { // r_usetileshades 1 is TX's method. - return texcache_fetch(globalpicnum, globalpal, getpalookup((r_usetileshades == 1) ? globvis>>3 : 0, globalshade), dameth); + return texcache_fetch(globalpicnum, globalpal, getpalookup((r_usetileshades == 1 && !(globalflags & GLOBAL_NO_GL_TILESHADES)) ? globvis>>3 : 0, globalshade), dameth); } static void drawpoly(vec2f_t *dpxy, int32_t n, int32_t method) @@ -1512,7 +1513,7 @@ static void drawpoly(vec2f_t *dpxy, int32_t n, int32_t method) float pc[4]; #ifdef POLYMER - if (getrendermode() == REND_POLYMER && pr_artmapping && polymer_eligible_for_artmap(globalpicnum, pth)) + if (getrendermode() == REND_POLYMER && pr_artmapping && !(globalflags & GLOBAL_NO_GL_TILESHADES) && polymer_eligible_for_artmap(globalpicnum, pth)) pc[0] = pc[1] = pc[2] = 1.0f; else #endif diff --git a/polymer/eduke32/build/src/texcache.c b/polymer/eduke32/build/src/texcache.c index 959823602..9a671f60c 100644 --- a/polymer/eduke32/build/src/texcache.c +++ b/polymer/eduke32/build/src/texcache.c @@ -109,7 +109,7 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3 if ((si = hicfindskybox(dapicnum, dapalnum)) == NULL) return NULL; - if (!r_usetileshades || getrendermode() != REND_POLYMOST) + if (!r_usetileshades || (globalflags & GLOBAL_NO_GL_TILESHADES) || getrendermode() != REND_POLYMOST) dashade = 0; if (!si)