]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_textures.c
removed unused portalstack array
[xonotic/darkplaces.git] / gl_textures.c
index 4cc437b64abae1c433f7bc4d6efec078f35ad4a1..5ac0614f19908c6b9cc6ca3e2fb30d358af0474f 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)
                        {
@@ -600,11 +600,13 @@ rtexture_t *R_LoadTexture (char *identifier, int width, int height, byte *data,
        gltexture_t             *glt;
        unsigned short  crc;
 
-       if (isDedicated)
+       if (cls.state == ca_dedicated)
                return NULL;
 
        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)
@@ -699,7 +701,9 @@ GL_LoadTexture_setup:
        glt->texeldatasize = R_CalcTexelDataSize(width, height, flags & TEXF_MIPMAP);
 
        precache = false;
-       if (r_precachetextures.value >= 1)
+       if (flags & TEXF_ALWAYSPRECACHE)
+               precache = true;
+       else if (r_precachetextures.value >= 1)
        {
                if (flags & TEXF_PRECACHE)
                        precache = true;