]> 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)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 23 Jul 2010 19:14:35 +0000 (21:14 +0200)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10358 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=e9555fe3b5e40ddc0cfb186e7e36ac1d4ff45245

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

index 20e4aa07d6ff273ed52ba36c3fff5cd4ee917359..f396ae520daf819df8c42a0cf51b995f8b286e86 100644 (file)
@@ -1456,7 +1456,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 408cb7af9bb92f7a4689a5c2db1917b51a771cbd..da6833f8d51201213b8f39c146fd45bc68e53086 100644 (file)
@@ -3286,7 +3286,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 57244c2911b8d4834ae4dad0e350369892a63496..4d5bc08afe56bdd3047684fe1569743960edfb6e 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 b67b940bf9f8ea106f9cab994aa09ff0c5c09600..9417e076164c10dc9f31cc637bb0123d7512dd36 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,