rtexture_t *tex;
// used for hash lookups
struct cachepic_s *chain;
+ // flags - CACHEPICFLAG_NEWPIC for example
+ unsigned int flags;
// has alpha?
qboolean hasalpha;
// name of pic
CACHEPICFLAG_NOTPERSISTENT = 1,
CACHEPICFLAG_QUIET = 2,
CACHEPICFLAG_NOCOMPRESSION = 4,
- CACHEPICFLAG_NOCLAMP = 8
+ CACHEPICFLAG_NOCLAMP = 8,
+ CACHEPICFLAG_NEWPIC = 16 // disables matching texflags check, because a pic created with Draw_NewPic should not be subject to that
}
cachepicflags_t;
crc = CRC_Block((unsigned char *)path, strlen(path));
hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE;
for (pic = cachepichash[hashkey];pic;pic = pic->chain)
+ {
if (!strcmp (path, pic->name))
- if(!((pic->texflags ^ texflags) & ~(TEXF_COMPRESS))) // ignore TEXF_COMPRESS when comparing, because fallback pics remove the flag
+ {
+ // if it was created (or replaced) by Draw_NewPic, just return it
+ if(pic->flags & CACHEPICFLAG_NEWPIC)
+ return pic;
+ if (!((pic->texflags ^ texflags) & ~(TEXF_COMPRESS))) // ignore TEXF_COMPRESS when comparing, because fallback pics remove the flag
{
if(!(cachepicflags & CACHEPICFLAG_NOTPERSISTENT))
{
}
return pic;
}
+ }
+ }
if (numcachepics == MAX_CACHED_PICS)
{
reload:
// check whether it is an dynamic texture (if so, we can directly use its texture handler)
+ pic->flags = cachepicflags;
pic->tex = CL_GetDynTexture( path );
// if so, set the width/height, too
if( pic->tex ) {
if (pic)
{
- if (pic->tex && pic->width == width && pic->height == height)
+ if (pic->flags == CACHEPICFLAG_NEWPIC && pic->tex && pic->width == width && pic->height == height)
{
R_UpdateTexture(pic->tex, pixels_bgra, 0, 0, 0, width, height, 1);
return pic;
}
}
+ pic->flags = CACHEPICFLAG_NEWPIC; // disable texflags checks in Draw_CachePic
pic->width = width;
pic->height = height;
if (pic->tex)