From: Mircea Kitsune Date: Fri, 25 Nov 2011 12:23:07 +0000 (+0200) Subject: Don't draw map previews if the images are missing. Later to be replaced with a "previ... X-Git-Tag: xonotic-v0.6.0~188^2~16^2~3^2~26 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3743f4e292e9c54dcea9c86d21f9a8b82b6b1758;p=xonotic%2Fxonotic-data.pk3dir.git Don't draw map previews if the images are missing. Later to be replaced with a "preview missing" image --- diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 201d1a969..5492d5194 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -88,7 +88,8 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin } else { - drawpic(pos, pic, img_size, '1 1 1', alpha, DRAWFLAG_NORMAL); + if(fexists(strcat(pic, ".jpg")) || fexists(strcat(pic, ".png")) || fexists(strcat(pic, ".tga"))) + drawpic(pos, pic, img_size, '1 1 1', alpha, DRAWFLAG_NORMAL); } if(id == mv_ownvote) diff --git a/qcsrc/menu/xonotic/campaign.c b/qcsrc/menu/xonotic/campaign.c index 04f7a083c..9737014d3 100644 --- a/qcsrc/menu/xonotic/campaign.c +++ b/qcsrc/menu/xonotic/campaign.c @@ -275,7 +275,8 @@ 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); - draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", campaign_mapname[i]), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); + if(fexists(strcat("maps/", campaign_mapname[i], ".jpg")) || fexists(strcat("maps/", campaign_mapname[i], ".png")) || fexists(strcat("maps/", campaign_mapname[i], ".tga"))) + draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", campaign_mapname[i]), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); if(i < me.campaignIndex) draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1); if(i <= me.campaignIndex) diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c index e242b6667..732b4468b 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c @@ -54,7 +54,8 @@ 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); - me.previewImage.src = me.currentMapPreviewImage; + if(fexists(strcat("maps/", me.currentMapPreviewImage, ".jpg")) || fexists(strcat("maps/", me.currentMapPreviewImage, ".png")) || fexists(strcat("maps/", me.currentMapPreviewImage, ".tga"))) + me.previewImage.src = me.currentMapPreviewImage; for(i = 0; i < GameType_GetCount(); ++i) { diff --git a/qcsrc/menu/xonotic/maplist.c b/qcsrc/menu/xonotic/maplist.c index 9ce298082..1edb222cd 100644 --- a/qcsrc/menu/xonotic/maplist.c +++ b/qcsrc/menu/xonotic/maplist.c @@ -186,7 +186,8 @@ 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); - draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); + if(fexists(strcat("maps/", MapInfo_Map_bspname, ".jpg")) || fexists(strcat("maps/", MapInfo_Map_bspname, ".png")) || fexists(strcat("maps/", MapInfo_Map_bspname, ".tga"))) + draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); if(included) draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1); s = draw_TextShortenToWidth(MapInfo_Map_titlestring, me.columnNameSize, 0, me.realFontSize);