]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.c
Added r_shadow_bouncegrid_lightpathsize which is an alternative to blur
[xonotic/darkplaces.git] / model_brush.c
index 6f2651f6def8dbdc7802d6e6f42e9da578eb4f4f..2761d7d670d38b7d2f6e7e559789b5e80f9ea65b 100644 (file)
@@ -1880,6 +1880,10 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb)
                        if (tx->skinframes[0] && tx->skinframes[0]->hasalpha)
                                tx->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
                }
+               else if (tx->name[0] == '{') // fence textures
+               {
+                       tx->basematerialflags |= MATERIALFLAG_ALPHATEST | MATERIALFLAG_NOSHADOW;
+               }
                else if (!strncmp(tx->name, "mirror", 6)) // Tenebrae
                {
                        // replace the texture with black
@@ -1904,6 +1908,12 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb)
                tx = loadmodel->data_textures + i;
                if (!tx || tx->name[0] != '+' || tx->name[1] == 0 || tx->name[2] == 0)
                        continue;
+               num = tx->name[1];
+               if ((num < '0' || num > '9') && (num < 'a' || num > 'j'))
+               {
+                       Con_Printf("Bad animating texture %s\n", tx->name);
+                       continue;
+               }
                if (tx->anim_total[0] || tx->anim_total[1])
                        continue;       // already sequenced
 
@@ -1922,8 +1932,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb)
                                anims[num - '0'] = tx2;
                        else if (num >= 'a' && num <= 'j')
                                altanims[num - 'a'] = tx2;
-                       else
-                               Con_Printf("Bad animating texture %s\n", tx->name);
+                       // No need to warn otherwise - we already did above.
                }
 
                max = altmax = 0;
@@ -1956,6 +1965,12 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb)
                if (incomplete)
                        continue;
 
+               // If we have exactly one frame, something's wrong.
+               if (max + altmax <= 1)
+               {
+                       Con_Printf("Texture %s is animated (leading +) but has only one frame\n", tx->name);
+               }
+
                if (altmax < 1)
                {
                        // if there is no alternate animation, duplicate the primary
@@ -1965,6 +1980,18 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb)
                                altanims[k] = anims[k];
                }
 
+               if (max < 1)
+               {
+                       // Warn.
+                       Con_Printf("Missing frame 0 of %s\n", tx->name);
+
+                       // however, we can handle this by duplicating the alternate animation into the primary
+                       max = altmax;
+                       for (k = 0;k < 10;k++)
+                               anims[k] = altanims[k];
+               }
+
+
                // link together the primary animation
                for (j = 0;j < max;j++)
                {
@@ -2129,7 +2156,7 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data)
                                for (i = 0;i < (int)sizeof(value);i++)
                                        if (value[i] != ';' && value[i] != '\\' && value[i] != '/' && value[i] != ':')
                                                break;
-                               if (value[i])
+                               if (i < (int)sizeof(value) && value[i])
                                {
                                        for (;i < (int)sizeof(value);i++)
                                        {
@@ -4236,7 +4263,7 @@ static void Mod_Q2BSP_LoadNodes(sizebuf_t *sb)
                out->numsurfaces = (unsigned short)MSG_ReadLittleShort(sb);
                if (out->firstsurface + out->numsurfaces > (unsigned int)loadmodel->num_surfaces)
                {
-                       Con_Printf("Mod_Q2BSP_LoadNodes: invalid surface index range %i+%i (file has only %i surfaces)\n", p, out->firstsurface, out->numsurfaces, loadmodel->num_surfaces);
+                       Con_Printf("Mod_Q2BSP_LoadNodes: invalid surface index range %i+%i (file has only %i surfaces)\n", out->firstsurface, out->numsurfaces, loadmodel->num_surfaces);
                        out->firstsurface = 0;
                        out->numsurfaces = 0;
                }
@@ -4415,8 +4442,9 @@ static void Mod_Q2BSP_LoadTexinfo(sizebuf_t *sb)
        // if we encounter the textures out of order, the later ones won't mark the earlier ones in a sequence, so the earlier 
        for (i = 0, out = loadmodel->brushq1.texinfo;i < count;i++, out++)
        {
-               int j = i;
+               int j;
                texture_t *t = loadmodel->data_textures + out->textureindex;
+               t->currentframe = t; // fix the reallocated pointer
 
                // if this is not animated, skip it
                // if this is already processed, skip it (part of an existing sequence)