mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-07 08:21:59 +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);
|
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.
|
/** Load a qpic from gfx.wad.
|
||||||
\param name name of the was lump to load
|
\param name name of the was lump to load
|
||||||
\return pointer qpic data.
|
\return pointer qpic data.
|
||||||
|
|
|
@ -249,6 +249,21 @@ Draw_CachePic (const char *path, qboolean alpha)
|
||||||
return &pic->pic;
|
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
|
VISIBLE void
|
||||||
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
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;
|
return pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VISIBLE void
|
||||||
|
Draw_UncachePic (const char *path)
|
||||||
|
{
|
||||||
|
Hash_Free (pic_cache, Hash_Del (pic_cache, path));
|
||||||
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
||||||
{
|
{
|
||||||
|
|
|
@ -112,10 +112,15 @@ Draw_CachePic (const char *path, qboolean alpha)
|
||||||
if (!strcmp (path, pic->name))
|
if (!strcmp (path, pic->name))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (i == numcachepics) {
|
||||||
|
for (pic = cachepics, i = 0; i < numcachepics; pic++, i++)
|
||||||
|
if (!pic->name[0])
|
||||||
|
break;
|
||||||
if (i == numcachepics) {
|
if (i == numcachepics) {
|
||||||
if (numcachepics == MAX_CACHED_PICS)
|
if (numcachepics == MAX_CACHED_PICS)
|
||||||
Sys_Error ("numcachepics == MAX_CACHED_PICS");
|
Sys_Error ("numcachepics == MAX_CACHED_PICS");
|
||||||
numcachepics++;
|
numcachepics++;
|
||||||
|
}
|
||||||
strcpy (pic->name, path);
|
strcpy (pic->name, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +142,21 @@ Draw_CachePic (const char *path, qboolean alpha)
|
||||||
return dat;
|
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
|
VISIBLE void
|
||||||
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
||||||
|
|
|
@ -112,10 +112,15 @@ Draw_CachePic (const char *path, qboolean alpha)
|
||||||
if (!strcmp (path, pic->name))
|
if (!strcmp (path, pic->name))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (i == numcachepics) {
|
||||||
|
for (pic = cachepics, i = 0; i < numcachepics; pic++, i++)
|
||||||
|
if (!pic->name[0])
|
||||||
|
break;
|
||||||
if (i == numcachepics) {
|
if (i == numcachepics) {
|
||||||
if (numcachepics == MAX_CACHED_PICS)
|
if (numcachepics == MAX_CACHED_PICS)
|
||||||
Sys_Error ("numcachepics == MAX_CACHED_PICS");
|
Sys_Error ("numcachepics == MAX_CACHED_PICS");
|
||||||
numcachepics++;
|
numcachepics++;
|
||||||
|
}
|
||||||
strcpy (pic->name, path);
|
strcpy (pic->name, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +142,21 @@ Draw_CachePic (const char *path, qboolean alpha)
|
||||||
return dat;
|
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
|
VISIBLE void
|
||||||
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
Draw_TextBox (int x, int y, int width, int lines, byte alpha)
|
||||||
|
|
Loading…
Reference in a new issue