X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=gl_textures.c;h=341be6c02769d498c258f3139309fe09499f3d68;hb=8468ffaf8162a4fe8361127385c40141c375661d;hp=9a2229dd0d043b080733ae650115327342adcdbf;hpb=2af1ea2c4bb9d2128a17cf6eab43a8dcb828fdc2;p=xonotic%2Fdarkplaces.git diff --git a/gl_textures.c b/gl_textures.c index 9a2229dd..341be6c0 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -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; @@ -157,7 +157,7 @@ void GL_TextureStats_f(void) char engineversion[40]; //void GL_UploadTexture (gltexture_t *glt); -void r_textures_start() +void r_textures_start(void) { // int i; // gltexture_t *glt; @@ -165,11 +165,11 @@ void r_textures_start() // GL_UploadTexture(glt); } -void r_textures_shutdown() +void r_textures_shutdown(void) { } -void r_textures_newmap() +void r_textures_newmap(void) { } @@ -304,7 +304,7 @@ void R_ResampleTexture (void *indata, int inwidth, int inheight, void *outdata, out += 16; row1 += 16; row2 += 16; - j--; + j -= 4; } if (j & 2) { @@ -364,13 +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 -= 4; } if (j & 2) { @@ -604,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) @@ -698,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;