]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix the usage of the CACHEPICFLAGS_NOTPERSISTENT flag in Draw_CachePic calls
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 23 Jul 2010 19:14:21 +0000 (19:14 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 23 Jul 2010 19:14:21 +0000 (19:14 +0000)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10358 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
clvm_cmds.c
gl_draw.c
prvm_cmds.c

index 36bc038e1f594467fd5c37f62e8cab48b565595e..affe395a49cdd9cedc7389a224fb2d496f8586d0 100644 (file)
@@ -1459,7 +1459,7 @@ void SHOWLMP_drawall(void)
        int i;
        for (i = 0;i < cl.num_showlmps;i++)
                if (cl.showlmps[i].isactive)
-                       DrawQ_Pic(cl.showlmps[i].x, cl.showlmps[i].y, Draw_CachePic (cl.showlmps[i].pic), 0, 0, 1, 1, 1, 1, 0);
+                       DrawQ_Pic(cl.showlmps[i].x, cl.showlmps[i].y, Draw_CachePic_Flags (cl.showlmps[i].pic, CACHEPICFLAG_NOTPERSISTENT), 0, 0, 1, 1, 1, 1, 0);
 }
 
 /*
index b314ac925da285b9110946817a08414eb4c9c7c4..db6e5f190ebd5618752f6e0bfc45329cdbcc8133 100644 (file)
@@ -3284,7 +3284,7 @@ void Debug_PolygonBegin(const char *picname, int drawflag)
                Con_Printf("Debug_PolygonBegin: called twice without Debug_PolygonEnd after first\n");
                return;
        }
-       debugPolys.begin_texture = picname[0] ? Draw_CachePic (picname)->tex : r_texture_white;
+       debugPolys.begin_texture = picname[0] ? Draw_CachePic_Flags (picname, CACHEPICFLAG_NOTPERSISTENT)->tex : r_texture_white;
        debugPolys.begin_drawflag = drawflag;
        debugPolys.begin_vertices = 0;
        debugPolys.begin_active = true;
index fe79883119e0eb64de13b85a9860443a619ac7c0..af704ea3841c6b04d1018d010a269cb8fbb45b6d 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -331,7 +331,11 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
        for (pic = cachepichash[hashkey];pic;pic = pic->chain)
                if (!strcmp (path, pic->name))
                        if(pic->texflags == texflags)
+                       {
+                               if(!(cachepicflags & CACHEPICFLAG_NOTPERSISTENT))
+                                       pic->autoload = false; // persist it
                                return pic;
+                       }
 
        if (numcachepics == MAX_CACHED_PICS)
        {
@@ -438,7 +442,7 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
 
 cachepic_t *Draw_CachePic (const char *path)
 {
-       return Draw_CachePic_Flags (path, 0);
+       return Draw_CachePic_Flags (path, 0); // default to persistent!
 }
 
 int draw_frame = 1;
index 11221becdbf94b01f8501a31d7d263f5cc1ed99b..20f06119cdf96879b73baafeced6edaf75ad924c 100644 (file)
@@ -3234,7 +3234,7 @@ void VM_precache_pic(void)
        VM_CheckEmptyString (s);
 
        // AK Draw_CachePic is supposed to always return a valid pointer
-       if( Draw_CachePic_Flags(s, CACHEPICFLAG_NOTPERSISTENT)->tex == r_texture_notexture )
+       if( Draw_CachePic_Flags(s, 0)->tex == r_texture_notexture )
                PRVM_G_INT(OFS_RETURN) = OFS_NULL;
 }
 
@@ -3689,7 +3689,7 @@ void VM_drawpic(void)
        if(pos[2] || size[2])
                Con_Printf("VM_drawpic: z value%s from %s discarded\n",(pos[2] && size[2]) ? "s" : " ",((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size")));
 
-       DrawQ_Pic(pos[0], pos[1], Draw_CachePic (picname), size[0], size[1], rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM4), flag);
+       DrawQ_Pic(pos[0], pos[1], Draw_CachePic_Flags (picname, CACHEPICFLAG_NOTPERSISTENT), size[0], size[1], rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM4), flag);
        PRVM_G_FLOAT(OFS_RETURN) = 1;
 }
 /*
@@ -3734,7 +3734,7 @@ void VM_drawrotpic(void)
        if(pos[2] || size[2] || org[2])
                Con_Printf("VM_drawrotpic: z value from pos/size/org discarded\n");
 
-       DrawQ_RotPic(pos[0], pos[1], Draw_CachePic(picname), size[0], size[1], org[0], org[1], PRVM_G_FLOAT(OFS_PARM4), rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM6), flag);
+       DrawQ_RotPic(pos[0], pos[1], Draw_CachePic_Flags(picname, CACHEPICFLAG_NOTPERSISTENT), size[0], size[1], org[0], org[1], PRVM_G_FLOAT(OFS_PARM4), rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM6), flag);
        PRVM_G_FLOAT(OFS_RETURN) = 1;
 }
 /*
@@ -3782,7 +3782,7 @@ void VM_drawsubpic(void)
        if(pos[2] || size[2])
                Con_Printf("VM_drawsubpic: z value%s from %s discarded\n",(pos[2] && size[2]) ? "s" : " ",((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size")));
 
-       DrawQ_SuperPic(pos[0], pos[1], Draw_CachePic (picname),
+       DrawQ_SuperPic(pos[0], pos[1], Draw_CachePic_Flags (picname, CACHEPICFLAG_NOTPERSISTENT),
                size[0], size[1],
                srcPos[0],              srcPos[1],              rgb[0], rgb[1], rgb[2], alpha,
                srcPos[0] + srcSize[0], srcPos[1],              rgb[0], rgb[1], rgb[2], alpha,