#define TEXF_PICMIP 0x00000100
// indicates texture should be compressed if possible
#define TEXF_COMPRESS 0x00000200
+// use this flag to block R_PurgeTexture from freeing a texture
+#define TEXF_PERSISTENT 0x00000400
// used for checking if textures mismatch
#define TEXF_IMPORTANTBITS (TEXF_ALPHA | TEXF_MIPMAP | TEXF_CLAMP | TEXF_FORCENEAREST | TEXF_FORCELINEAR | TEXF_PICMIP | TEXF_COMPRESS)
// returns the renderer dependent texture slot number (call this before each
// use, as a texture might not have been precached)
-#define R_GetTexture(rt) ((rt) ? ((rt)->texnum >= 0 ? (rt)->texnum : R_RealGetTexture(rt)) : r_texture_white->texnum)
+#define R_GetTexture(rt) ((rt) ? ((rt)->texnum > 0 ? (rt)->texnum : R_RealGetTexture(rt)) : r_texture_white->texnum)
int R_RealGetTexture (rtexture_t *rt);
// returns true if the texture is transparent (useful for rendering code)
// returns height of texture, as was specified when it was uploaded
int R_TextureHeight(rtexture_t *rt);
+// only frees the texture if TEXF_PERSISTENT is not set
+// also resets the variable
+void R_PurgeTexture(rtexture_t *prt);
+
// frees processing buffers each frame, and may someday animate procedural textures
void R_Textures_Frame(void);
// maybe rename this - sounds awful? [11/21/2007 Black]
void R_MarkDirtyTexture(rtexture_t *rt);
-void R_MakeTextureDynamic(rtexture_t *rt, updatecallback_t updatecallback, void *data);
+void R_MakeTextureDynamic(rtexture_t *rt, updatecallback_t updatecallback, void *data);
+
+// Clear the texture's contents
+void R_ClearTexture (rtexture_t *rt);
#endif