From e429d70291d8b4ecfd144f8a59bacaf214549726 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Tue, 3 Jan 2012 18:55:47 +0200 Subject: [PATCH] Use draw_PictureSize == '0 0 0' instead of draw_PreloadPicture == "", since preloading causes a memory leak. Requires latest engine to work properly. --- qcsrc/client/mapvoting.qc | 2 +- qcsrc/menu/xonotic/campaign.c | 2 +- qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c | 2 +- qcsrc/menu/xonotic/maplist.c | 2 +- qcsrc/menu/xonotic/playermodel.c | 2 +- qcsrc/menu/xonotic/skinlist.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 1eeb304c7..ebb2c4e74 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -88,7 +88,7 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin } else { - if(precache_pic(pic) == "") + if(drawgetimagesize(pic) == '0 0 0') drawpic(pos, draw_UseSkinFor("nopreview_map"), img_size, '1 1 1', theAlpha, DRAWFLAG_NORMAL); else drawpic(pos, pic, img_size, '1 1 1', theAlpha, DRAWFLAG_NORMAL); diff --git a/qcsrc/menu/xonotic/campaign.c b/qcsrc/menu/xonotic/campaign.c index 72191ac51..0537967bd 100644 --- a/qcsrc/menu/xonotic/campaign.c +++ b/qcsrc/menu/xonotic/campaign.c @@ -275,7 +275,7 @@ void XonoticCampaignList_drawListBoxItem(entity me, float i, vector absSize, flo draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED); s = ftos(p); - if(draw_PreloadPicture(strcat("/maps/", campaign_mapname[i])) == "") + if(draw_PictureSize(strcat("/maps/", campaign_mapname[i])) == '0 0 0') draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); else draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", campaign_mapname[i]), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c index 98395eab4..169e9734b 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c @@ -54,7 +54,7 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb) me.authorLabel.setText(me.authorLabel, me.currentMapAuthor); me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription); me.featuresLabel.setText(me.featuresLabel, me.currentMapFeaturesText); - if(draw_PreloadPicture(me.currentMapPreviewImage) == "") + if(draw_PictureSize(me.currentMapPreviewImage) == '0 0 0') me.previewImage.src = "nopreview_map"; else me.previewImage.src = me.currentMapPreviewImage; diff --git a/qcsrc/menu/xonotic/maplist.c b/qcsrc/menu/xonotic/maplist.c index 1b1255b73..14bf48ec9 100644 --- a/qcsrc/menu/xonotic/maplist.c +++ b/qcsrc/menu/xonotic/maplist.c @@ -186,7 +186,7 @@ void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float is draw_Fill('0 0 0', '1 1 0', SKINCOLOR_MAPLIST_INCLUDEDBG, SKINALPHA_MAPLIST_INCLUDEDBG); s = ftos(p); - if(draw_PreloadPicture(strcat("/maps/", MapInfo_Map_bspname)) == "") + if(draw_PictureSize(strcat("/maps/", MapInfo_Map_bspname)) == '0 0 0') draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); else draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); diff --git a/qcsrc/menu/xonotic/playermodel.c b/qcsrc/menu/xonotic/playermodel.c index 0548e1e8f..61eb4a681 100644 --- a/qcsrc/menu/xonotic/playermodel.c +++ b/qcsrc/menu/xonotic/playermodel.c @@ -137,7 +137,7 @@ void XonoticPlayerModelSelector_go(entity me, float d) me.currentModelDescription = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_DESC)); // fix the image - if(draw_PreloadPicture(me.currentModelImage) == "") + if(draw_PictureSize(me.currentModelImage) == '0 0 0') me.src = "nopreview_player"; else me.src = me.currentModelImage; diff --git a/qcsrc/menu/xonotic/skinlist.c b/qcsrc/menu/xonotic/skinlist.c index f2b2d8a24..68314cd02 100644 --- a/qcsrc/menu/xonotic/skinlist.c +++ b/qcsrc/menu/xonotic/skinlist.c @@ -104,7 +104,7 @@ void XonoticSkinList_getSkins(entity me) bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_NAME, substring(s, 9, strlen(s) - 24)); // the * part bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, _("")); bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_AUTHOR, _("<AUTHOR>")); - if(draw_PreloadPicture(strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview")) == "") + if(draw_PictureSize(strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview")) == '0 0 0') bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, "nopreview_menuskin"); else bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview")); -- 2.39.2