]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c
Don't draw map previews if the images are missing. Later to be replaced with a "previ...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_multiplayer_create_mapinfo.c
index 2f2f5a2558c3a1c413b0e54dd4bcaa09d7344833..732b4468b02af75039c4109a289a3d1304b5209f 100644 (file)
@@ -2,7 +2,7 @@
 CLASS(XonoticMapInfoDialog) EXTENDS(XonoticDialog)
        METHOD(XonoticMapInfoDialog, fill, void(entity))
        METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity))
-       ATTRIB(XonoticMapInfoDialog, title, string, "Map Information")
+       ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
        ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
        ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
        ATTRIB(XonoticMapInfoDialog, rows, float, 12)
@@ -46,7 +46,7 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb)
        me.currentMapTitle = strzone(MapInfo_Map_title);
        me.currentMapAuthor = strzone(MapInfo_Map_author);
        me.currentMapDescription = strzone(MapInfo_Map_description);
-       me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? "Full item placement" : "MinstaGib only");
+       me.currentMapFeaturesText = strzone((MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_WEAPONS) ? _("Full item placement") : _("MinstaGib only"));
        me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
 
        me.frame.setText(me.frame, me.currentMapBSPName);
@@ -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)
        {
@@ -75,26 +76,25 @@ void XonoticMapInfoDialog_fill(entity me)
                me.previewImage = e;
        me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
        w = me.columns - me.currentColumn;
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Title:"));
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Title:")));
                me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
                        e.colorL = SKINCOLOR_MAPLIST_TITLE;
                        e.allowCut = 1;
                        me.titleLabel = e;
        me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Author:"));
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Author:")));
                me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
                        e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
                        e.allowCut = 1;
                        me.authorLabel = e;
        me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Features:"));
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Features:")));
                me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
                        e.allowCut = 1;
                        me.featuresLabel = e;
        me.TR(me);
-               me.TD(me, 1, w, e = makeXonoticTextLabel(0, "Game types:"));
+               me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Game types:")));
 
-       
        n = ceil(GameType_GetCount() / (me.rows - 6));
        wgt = (w - 0.2) / n;
        for(i = 0; i < GameType_GetCount(); ++i)
@@ -116,10 +116,10 @@ void XonoticMapInfoDialog_fill(entity me)
        me.gotoRC(me, me.rows - 1, 0);
                me.TDempty(me, 0.5);
 
-               me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton("Close", '0 0 0'));
+               me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton(_("Close"), '0 0 0'));
                        e.onClick = Dialog_Close;
                        e.onClickEntity = me;
-               me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton("Play", '0 0 0'));
+               me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton(ZCTX(_("MAP^Play")), '0 0 0'));
                        me.startButton.onClick = MapList_LoadMap;
                        me.startButton.onClickEntity = NULL; // filled later
 }