mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Allow uncaching of qpics.
qpics loaded via Draw_CachePic can now be uncached via Draw_UncachePic.
This commit is contained in:
parent
a849cf7698
commit
7e406c20e5
5 changed files with 75 additions and 6 deletions
|
@ -175,6 +175,14 @@ void Draw_BlendScreen (quat_t color);
|
|||
*/
|
||||
qpic_t *Draw_CachePic (const char *path, qboolean alpha);
|
||||
|
||||
/** Remove a qpic from the qpic cache.
|
||||
|
||||
This affects only those qpics that were loaded via Draw_CachePic.
|
||||
|
||||
\param path path of the file within the quake filesystem
|
||||
*/
|
||||
void Draw_UncachePic (const char *path);
|
||||
|
||||
/** Load a qpic from gfx.wad.
|
||||
\param name name of the was lump to load
|
||||
\return pointer qpic data.
|
||||
|
|
|
@ -249,6 +249,21 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
return &pic->pic;
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_UncachePic (const char *path)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
|
||||
//FIXME chachpic and uncachepic suck in GL
|
||||
for (pic = cachepics, i = 0; i < numcachepics; pic++, i++) {
|
||||
if ((!strcmp (path, pic->name)) && !pic->dirty) {
|
||||
pic->dirty = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
||||
{
|
||||
|
|
|
@ -299,6 +299,12 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
return pic;
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_UncachePic (const char *path)
|
||||
{
|
||||
Hash_Free (pic_cache, Hash_Del (pic_cache, path));
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
||||
{
|
||||
|
|
|
@ -113,9 +113,14 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
break;
|
||||
|
||||
if (i == numcachepics) {
|
||||
if (numcachepics == MAX_CACHED_PICS)
|
||||
Sys_Error ("numcachepics == MAX_CACHED_PICS");
|
||||
numcachepics++;
|
||||
for (pic = cachepics, i = 0; i < numcachepics; pic++, i++)
|
||||
if (!pic->name[0])
|
||||
break;
|
||||
if (i == numcachepics) {
|
||||
if (numcachepics == MAX_CACHED_PICS)
|
||||
Sys_Error ("numcachepics == MAX_CACHED_PICS");
|
||||
numcachepics++;
|
||||
}
|
||||
strcpy (pic->name, path);
|
||||
}
|
||||
|
||||
|
@ -137,6 +142,21 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
return dat;
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_UncachePic (const char *path)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
|
||||
for (pic = cachepics, i = 0; i < numcachepics; pic++, i++) {
|
||||
if (!strcmp (path, pic->name)) {
|
||||
Cache_Release (&pic->cache);
|
||||
pic->name[0] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VISIBLE void
|
||||
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
||||
|
|
|
@ -113,9 +113,14 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
break;
|
||||
|
||||
if (i == numcachepics) {
|
||||
if (numcachepics == MAX_CACHED_PICS)
|
||||
Sys_Error ("numcachepics == MAX_CACHED_PICS");
|
||||
numcachepics++;
|
||||
for (pic = cachepics, i = 0; i < numcachepics; pic++, i++)
|
||||
if (!pic->name[0])
|
||||
break;
|
||||
if (i == numcachepics) {
|
||||
if (numcachepics == MAX_CACHED_PICS)
|
||||
Sys_Error ("numcachepics == MAX_CACHED_PICS");
|
||||
numcachepics++;
|
||||
}
|
||||
strcpy (pic->name, path);
|
||||
}
|
||||
|
||||
|
@ -137,6 +142,21 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
return dat;
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Draw_UncachePic (const char *path)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
|
||||
for (pic = cachepics, i = 0; i < numcachepics; pic++, i++) {
|
||||
if (!strcmp (path, pic->name)) {
|
||||
Cache_Release (&pic->cache);
|
||||
pic->name[0] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VISIBLE void
|
||||
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
||||
|
|
Loading…
Reference in a new issue