From 13fc204b90b45f9561fc7b5b54716374a3fb31b2 Mon Sep 17 00:00:00 2001
From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sun, 26 Sep 2010 16:45:18 +0000
Subject: [PATCH] fix autoload semantics of drawpics

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10499 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=e8aced660a23cd4ad64764b8ed161a8811262fd3
---
 gl_draw.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gl_draw.c b/gl_draw.c
index 212d4ef1..6b5c7622 100644
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -334,7 +334,12 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
 			if(!((pic->texflags ^ texflags) & ~(TEXF_COMPRESS))) // ignore TEXF_COMPRESS when comparing, because fallback pics remove the flag
 			{
 				if(!(cachepicflags & CACHEPICFLAG_NOTPERSISTENT))
-					pic->autoload = false; // persist it
+				{
+					if(pic->tex)
+						pic->autoload = false; // persist it
+					else
+						goto reload; // load it below, and then persist
+				}
 				return pic;
 			}
 
@@ -350,6 +355,7 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
 	pic->chain = cachepichash[hashkey];
 	cachepichash[hashkey] = pic;
 
+reload:
 	// check whether it is an dynamic texture (if so, we can directly use its texture handler)
 	pic->tex = CL_GetDynTexture( path );
 	// if so, set the width/height, too
-- 
2.39.5