From 1ba01139e68a08aad65aac1c31dabd17889017a3 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 23 Jul 2010 19:14:21 +0000 Subject: [PATCH] Fix the usage of the CACHEPICFLAGS_NOTPERSISTENT flag in Draw_CachePic calls From: MirceaKitsune git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10358 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=e9555fe3b5e40ddc0cfb186e7e36ac1d4ff45245 --- cl_screen.c | 2 +- clvm_cmds.c | 2 +- gl_draw.c | 6 +++++- prvm_cmds.c | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cl_screen.c b/cl_screen.c index 20e4aa07..f396ae52 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -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); } /* diff --git a/clvm_cmds.c b/clvm_cmds.c index 408cb7af..da6833f8 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -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; diff --git a/gl_draw.c b/gl_draw.c index 57244c29..4d5bc08a 100644 --- 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; diff --git a/prvm_cmds.c b/prvm_cmds.c index b67b940b..9417e076 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -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, -- 2.39.2