avoid message spam for unloaded preview images

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5362 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
flowtron
2010-07-13 18:46:26 +00:00
parent 70b08ce124
commit 65447c694c
3 changed files with 8 additions and 3 deletions
+2
View File
@@ -390,8 +390,10 @@ struct mitemmaploadmanual : mitemmanual
else formatstring(maptitle)("-n/a-:%s", filename);
}
defformatstring(p2p)("%s/preview/%s.jpg", cgzpath, filename);
silent_texture_load = true;
image = textureload(p2p, 3);
if(image==notexture) image = textureload("packages/misc/nopreview.jpg", 3);
silent_texture_load = false;
}
else { formatstring(maptitle)("-n/a-:%s", filename); image = textureload("packages/misc/nopreview.png", 3); }
copystring(mapstats, "");
+1
View File
@@ -256,6 +256,7 @@ struct Texture
GLuint id;
};
extern Texture *notexture, *noworldtexture;
extern bool silent_texture_load;
extern void scaletexture(uchar *src, uint sw, uint sh, uint bpp, uchar *dst, uint dw, uint dh);
extern void createtexture(int tnum, int w, int h, void *pixels, int clamp, bool mipmap, bool canreduce, GLenum format);
+5 -3
View File
@@ -239,7 +239,7 @@ int fixcl(SDL_Surface *s, bool check = true, Uint8 value = 0, Uint8 mlimit = 255
else *p >>= t;
break;
}
case 2:
case 2:
{
if (check) pixel = *(Uint16 *)p;
else { p[0] >>= t; p[1] >>= t; }
@@ -335,13 +335,15 @@ SDL_Surface *texdecal(SDL_Surface *s)
return m;
}
bool silent_texture_load = false;
GLuint loadsurface(const char *texname, int &xs, int &ys, int &bpp, int clamp = 0, bool mipmap = true, bool canreduce = false)
{
const char *file = texname;
if(texname[0]=='<')
{
file = strchr(texname, '>');
if(!file) { conoutf("could not load texture %s", texname); return 0; }
if(!file) { if(!silent_texture_load) conoutf("could not load texture %s", texname); return 0; }
file++;
}
@@ -358,7 +360,7 @@ GLuint loadsurface(const char *texname, int &xs, int &ys, int &bpp, int clamp =
delete z;
}
if(!s) s = IMG_Load(findfile(file, "rb"));
if(!s) { conoutf("couldn't load texture %s", texname); return 0; }
if(!s) { if(!silent_texture_load) conoutf("couldn't load texture %s", texname); return 0; }
s = fixsurfaceformat(s);
Uint8 x = 0;
if(strstr(texname,"playermodel") && (x = fixcl(s)) > 35) { fixcl(s,false,x,35); }