From 83e22715bc574631e4b9c0a39eac3522541f83d3 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Sun, 2 Apr 2006 08:11:17 +0000 Subject: [PATCH] remove some unnecessary of unsafe caches, fixing menu_servers2 not being able to load without slidebar graphics git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2142 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/m_master.c | 12 ++++++------ engine/client/m_mp3.c | 5 +++-- engine/client/m_single.c | 2 +- engine/client/menu.c | 6 +++++- engine/client/sbar.c | 10 ++++++---- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/engine/client/m_master.c b/engine/client/m_master.c index 5b4a6ae41..5a6615fda 100644 --- a/engine/client/m_master.c +++ b/engine/client/m_master.c @@ -1213,22 +1213,22 @@ void SL_SliderDraw (int x, int y, menucustom_t *ths, menu_t *menu) mpic_t *pic; - pic = Draw_CachePic("scrollbars/slidebg.png"); + pic = Draw_SafeCachePic("scrollbars/slidebg.png"); if (pic) { Draw_ScalePic(x + ths->common.width - 8, y+8, 8, ths->common.height-16, pic); - pic = Draw_CachePic("scrollbars/arrow_down.png"); + pic = Draw_SafeCachePic("scrollbars/arrow_down.png"); Draw_ScalePic(x + ths->common.width - 8, y, 8, 8, pic); - pic = Draw_CachePic("scrollbars/arrow_up.png"); + pic = Draw_SafeCachePic("scrollbars/arrow_up.png"); Draw_ScalePic(x + ths->common.width - 8, y + ths->common.height - 8, 8, 8, pic); y += ((info->scrollpos) / ((float)info->numslots - info->visibleslots)) * (float)(ths->common.height-(64+16-1)); y += 8; - pic = Draw_CachePic("scrollbars/slider.png"); + pic = Draw_SafeCachePic("scrollbars/slider.png"); Draw_ScalePic(x + ths->common.width - 8, y, 8, 64, pic); } else @@ -1252,7 +1252,7 @@ void SL_SliderDraw (int x, int y, menucustom_t *ths, menu_t *menu) my = mousecursor_y; my -= ths->common.posy; - if (Draw_CachePic("scrollbars/slidebg.png")) + if (Draw_SafeCachePic("scrollbars/slidebg.png")) { my -= 32+8; my /= ths->common.height - (64+16); @@ -1282,7 +1282,7 @@ qboolean SL_SliderKey (menucustom_t *ths, menu_t *menu, int key) my = mousecursor_y; my -= ths->common.posy; - if (Draw_CachePic("scrollbars/slidebg.png")) + if (Draw_SafeCachePic("scrollbars/slidebg.png")) { my -= 32+8; my /= ths->common.height - (64+16); diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index 7fee1c98e..5e8874f14 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -312,8 +312,9 @@ void M_Media_Draw (void) #define MP_Hightlight(x,y,text,hl) (hl?M_PrintWhite(x, y, text):M_Print(x, y, text)) - p = Draw_CachePic ("gfx/p_option.lmp"); - M_DrawPic ( (320-p->width)/2, 4, p); + p = Draw_SafeCachePic ("gfx/p_option.lmp"); + if (p) + M_DrawPic ( (320-p->width)/2, 4, p); if (!bgmvolume.value) M_Print (12, 32, "Not playing - no volume"); else if (!*currenttrack.nicename) diff --git a/engine/client/m_single.c b/engine/client/m_single.c index 4e666fcb2..4cb6f0199 100644 --- a/engine/client/m_single.c +++ b/engine/client/m_single.c @@ -210,7 +210,7 @@ void M_Menu_SinglePlayer_f (void) MC_AddCenterPicture(menu, 4, "gfx/p_option.lmp"); } - p = Draw_CachePic("gfx/sp_menu.lmp"); + p = Draw_SafeCachePic("gfx/sp_menu.lmp"); if (!p) { MC_AddBox (menu, 60, 10*8, 23, 4); diff --git a/engine/client/menu.c b/engine/client/menu.c index cc9510c9f..8929ae310 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -175,7 +175,11 @@ void M_DrawTextBox (int x, int y, int width, int lines) { cy += 8; if (n == 1) - p = Draw_CachePic ("gfx/box_mm2.lmp"); + { + p = Draw_SafeCachePic ("gfx/box_mm2.lmp"); + if (!p) + break; + } M_DrawTransPic (cx, cy, p); } p = Draw_SafeCachePic ("gfx/box_bm.lmp"); diff --git a/engine/client/sbar.c b/engine/client/sbar.c index 943a549f8..e34f9b568 100644 --- a/engine/client/sbar.c +++ b/engine/client/sbar.c @@ -2379,8 +2379,9 @@ void Sbar_CoopIntermission (void) return; Draw_Pic ((sbar_rect.width - 320)/2 + 64, (sbar_rect.height - 200)/2 + 24, pic); - pic = Draw_CachePic ("gfx/inter.lmp"); - Draw_TransPic ((sbar_rect.width - 320)/2 + 0, (sbar_rect.height - 200)/2 + 56, pic); + pic = Draw_SafeCachePic ("gfx/inter.lmp"); + if (pic) + Draw_TransPic ((sbar_rect.width - 320)/2 + 0, (sbar_rect.height - 200)/2 + 56, pic); // time dig = cl.completed_time/60; @@ -2437,7 +2438,8 @@ void Sbar_FinaleOverlay (void) if (UI_DrawFinale()>0) return; #endif - pic = Draw_CachePic ("gfx/finale.lmp"); - Draw_TransPic ( (vid.width-pic->width)/2, 16, pic); + pic = Draw_SafeCachePic ("gfx/finale.lmp"); + if (pic) + Draw_TransPic ( (vid.width-pic->width)/2, 16, pic); }