]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
only show "shader already defined" messages if the two shaders actually mismatch
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 14 Jul 2009 09:05:08 +0000 (09:05 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 14 Jul 2009 09:05:08 +0000 (09:05 +0000)
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
model_shared.h

index 94c3b0150d5d0d679614c604bf8b0ff95d9a9ee9..d76ac1d47c4b55e492d49185bcdf3ec0d1d690d5 100644 (file)
@@ -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;
index 21637f73b1e17941e3529fc4437f611f5159dc74..b182b7e4ac9db07b306194af60199bdba9204fcc 100644 (file)
@@ -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;