]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_textures.c
added CVAR_SAVE and CVAR_NOTIFY flags to cvar_t structure (at the beginning), updated...
[xonotic/darkplaces.git] / gl_textures.c
index 3cc49e4d4db659d183387cb680166029f5b408b2..341be6c02769d498c258f3139309fe09499f3d68 100644 (file)
@@ -1,10 +1,10 @@
 #include "quakedef.h"
 
-cvar_t         r_max_size = {"r_max_size", "2048"};
-cvar_t         r_picmip = {"r_picmip", "0"};
-cvar_t         r_lerpimages = {"r_lerpimages", "1"};
-cvar_t         r_upload = {"r_upload", "1"};
-cvar_t         r_precachetextures = {"r_precachetextures", "1", true};
+cvar_t         r_max_size = {0, "r_max_size", "2048"};
+cvar_t         r_picmip = {0, "r_picmip", "0"};
+cvar_t         r_lerpimages = {CVAR_SAVE, "r_lerpimages", "1"};
+cvar_t         r_upload = {0, "r_upload", "1"};
+cvar_t         r_precachetextures = {CVAR_SAVE, "r_precachetextures", "1"};
 
 int            gl_filter_min = GL_LINEAR_MIPMAP_LINEAR; //NEAREST;
 int            gl_filter_max = GL_LINEAR;
@@ -364,14 +364,14 @@ void R_ResampleTexture (void *indata, int inwidth, int inheight, void *outdata,
                        inrow = (int *)indata + inwidth*(i*inheight/outheight);
                        frac = fracstep >> 1;
                        j = outwidth - 4;
-                       while(j >= 0)
+                       while (j >= 0)
                        {
                                out[0] = inrow[frac >> 16];frac += fracstep;
                                out[1] = inrow[frac >> 16];frac += fracstep;
                                out[2] = inrow[frac >> 16];frac += fracstep;
                                out[3] = inrow[frac >> 16];frac += fracstep;
                                out += 4;
-                               j--;
+                               j -= 4;
                        }
                        if (j & 2)
                        {
@@ -605,6 +605,8 @@ rtexture_t *R_LoadTexture (char *identifier, int width, int height, byte *data,
 
        if (!identifier[0])
                Host_Error("R_LoadTexture: no identifier\n");
+       if (data == NULL)
+               Host_Error("R_LoadTexture: \"%s\" has no data\n", identifier);
 
        // clear the alpha flag if the texture has no transparent pixels
        if (flags & TEXF_ALPHA)