Add "globalflags" def token. Flag 1 is a kill switch for the tileshades and artmapping features. Flag 2 is kill switch for the GL fullbright rendering pass.

git-svn-id: https://svn.eduke32.com/eduke32@5056 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-03-09 20:32:36 +00:00
parent 74b264dcb1
commit 97025d9fc7
7 changed files with 25 additions and 5 deletions

View file

@ -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];

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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)