From 464fe3007c4483fab6829671027ea7eca4db6081 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 14 Jul 2009 09:05:08 +0000 Subject: [PATCH] only show "shader already defined" messages if the two shaders actually mismatch for matching shaders, hide the message if developer is 0 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9057 d7cf8633-e32d-0410-b094-e92efae38249 --- model_shared.c | 9 ++++++++- model_shared.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/model_shared.c b/model_shared.c index 94c3b015..d76ac1d4 100644 --- a/model_shared.c +++ b/model_shared.c @@ -1337,7 +1337,14 @@ static void Q3Shader_AddToHash (q3shaderinfo_t* shader) { if (strcasecmp (entry->shader.name, shader->name) == 0) { - Con_Printf("Shader '%s' already defined\n", shader->name); + unsigned char *start, *end, *start2; + start = (unsigned char *) (&shader->Q3SHADERINFO_COMPARE_START); + end = ((unsigned char *) (&shader->Q3SHADERINFO_COMPARE_END)) + sizeof(shader->Q3SHADERINFO_COMPARE_END); + start2 = (unsigned char *) (&entry->shader.Q3SHADERINFO_COMPARE_START); + if(memcmp(start, start2, end - start)) + Con_Printf("Shader '%s' already defined, ignoring mismatching redeclaration\n", shader->name); + else + Con_DPrintf("Shader '%s' already defined\n", shader->name); return; } lastEntry = entry; diff --git a/model_shared.h b/model_shared.h index 21637f73..b182b7e4 100644 --- a/model_shared.h +++ b/model_shared.h @@ -356,6 +356,7 @@ q3shaderinfo_deform_t; typedef struct q3shaderinfo_s { char name[Q3PATHLENGTH]; +#define Q3SHADERINFO_COMPARE_START surfaceparms int surfaceparms; int textureflags; int numlayers; @@ -381,6 +382,7 @@ typedef struct q3shaderinfo_s float reflectfactor; // amount of reflection distort (1.0 = like the cvar specifies) vec4_t reflectcolor4f; // color tint of reflection (including alpha factor) float r_water_wateralpha; // additional wateralpha to apply when r_water is active +#define Q3SHADERINFO_COMPARE_END r_water_wateralpha } q3shaderinfo_t; -- 2.39.2