From: havoc Date: Sat, 20 Aug 2011 13:29:21 +0000 (+0000) Subject: added dpshaderkillifcvar and dpshaderkillifcvarzero keywords for X-Git-Tag: xonotic-v0.5.0~36 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d700e29fad085addf4fe0e2fb6c0cf29768b77e2;p=xonotic%2Fdarkplaces.git added dpshaderkillifcvar and dpshaderkillifcvarzero keywords for shaders, their parameter is a custom cvar name of your choice git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11286 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=6642d846d198f2616c17d2c742a44d2df35074c9 --- diff --git a/model_shared.c b/model_shared.c index 0fc77282..46768288 100644 --- a/model_shared.c +++ b/model_shared.c @@ -2079,6 +2079,16 @@ void Mod_LoadQ3Shaders(void) strlcpy(shader.dpreflectcube, parameter[1], sizeof(shader.dpreflectcube)); else if (!strcasecmp(parameter[0], "dpmeshcollisions")) shader.dpmeshcollisions = true; + else if (!strcasecmp(parameter[0], "dpshaderkillifcvarzero") && numparameters >= 2) + { + if (Cvar_VariableValue(parameter[1]) == 0.0f) + shader.dpshaderkill = true; + } + else if (!strcasecmp(parameter[0], "dpshaderkillifcvar") && numparameters >= 2) + { + if (Cvar_VariableValue(parameter[1]) != 0.0f) + shader.dpshaderkill = true; + } else if (!strcasecmp(parameter[0], "sky") && numparameters >= 2) { // some q3 skies don't have the sky parm set @@ -2211,6 +2221,9 @@ void Mod_LoadQ3Shaders(void) } } } + // hide this shader if a cvar said it should be killed + if (shader.dpshaderkill) + shader.numlayers = 0; // pick the primary layer to render with if (shader.numlayers) { @@ -2490,6 +2503,8 @@ nothing GL_ZERO GL_ONE if (shader->dpmeshcollisions) texture->basematerialflags |= MATERIALFLAG_MESHCOLLISIONS; + if (shader->dpshaderkill && developer_extra.integer) + Con_DPrintf("^1%s:^7 killing shader ^3\"%s\" because of cvar\n", loadmodel->name, name); } else if (!strcmp(texture->name, "noshader") || !texture->name[0]) { diff --git a/model_shared.h b/model_shared.h index 8b73377e..bd0bb265 100644 --- a/model_shared.h +++ b/model_shared.h @@ -452,6 +452,9 @@ typedef struct q3shaderinfo_s // add collisions to all triangles of the surface qboolean dpmeshcollisions; + // kill shader based on cvar checks + qboolean dpshaderkill; + // fake reflection char dpreflectcube[Q3PATHLENGTH];