]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/maplist.c
Merge remote-tracking branch 'origin/Mario/respawn_delays'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / maplist.c
index 9ce298082c2fca2f236ba1ea987ebe001005a1f4..ce937e4add00cca264c454249a3094785a2654d6 100644 (file)
@@ -84,7 +84,7 @@ void XonoticMapList_g_maplistCacheToggle(entity me, float i)
        string a, b, c, s, bspname;
        float n;
        s = me.g_maplistCache;
-       if not(s)
+       if (!s)
                return;
        b = substring(s, i, 1);
        if(b == "0")
@@ -98,7 +98,7 @@ void XonoticMapList_g_maplistCacheToggle(entity me, float i)
        strunzone(s);
        me.g_maplistCache = strzone(strcat(a, b, c));
        // TODO also update the actual cvar
-       if not((bspname = MapInfo_BSPName_ByID(i)))
+       if (!((bspname = MapInfo_BSPName_ByID(i))))
                return;
        if(b == "1")
                cvar_set("g_maplist", strcat(bspname, " ", cvar_string("g_maplist")));
@@ -167,7 +167,6 @@ void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float is
 {
        // layout: Ping, Map name, Map name, NP, TP, MP
        string s;
-       float p;
        float theAlpha;
        float included;
 
@@ -185,13 +184,16 @@ void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float is
        else if(included)
                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(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);
+
        if(included)
                draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
-       s = draw_TextShortenToWidth(MapInfo_Map_titlestring, me.columnNameSize, 0, me.realFontSize);
+       s = draw_TextShortenToWidth(strdecolorize(MapInfo_Map_titlestring), me.columnNameSize, 0, me.realFontSize);
        draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_TITLE, theAlpha, 0);
-       s = draw_TextShortenToWidth(MapInfo_Map_author, me.columnNameSize, 0,  me.realFontSize);
+       s = draw_TextShortenToWidth(strdecolorize(MapInfo_Map_author), me.columnNameSize, 0,  me.realFontSize);
        draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_AUTHOR, theAlpha, 0);
 
        MapInfo_ClearTemps();
@@ -242,7 +244,7 @@ void MapList_All(entity btn, entity me)
 {
        float i;
        string s;
-       MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MAPINFO_FLAG_FORBIDDEN | MAPINFO_FLAG_HIDDEN, 0); // all
+       MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MapInfo_ForbiddenFlags(), 0); // all
        s = "";
        for(i = 0; i < MapInfo_count; ++i)
                s = strcat(s, " ", MapInfo_BSPName_ByID(i));
@@ -273,7 +275,7 @@ void MapList_LoadMap(entity btn, entity me)
                return;
 
        m = MapInfo_BSPName_ByID(i);
-       if not(m)
+       if (!m)
        {
                print(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n"));
                me.refilter(me);
@@ -284,7 +286,7 @@ void MapList_LoadMap(entity btn, entity me)
                localcmd("\nmenu_loadmap_prepare\n");
                if(cvar("menu_use_default_hostname"))
                        localcmd("hostname \"", sprintf(_("%s's Xonotic Server"), strdecolorize(cvar_string("_cl_name"))), "\"\n");
-               MapInfo_LoadMap(m);
+               MapInfo_LoadMap(m, 1);
        }
        else
        {
@@ -311,7 +313,7 @@ float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift)
        }
        else if(ascii == 43) // +
        {
-               if not(me.g_maplistCacheQuery(me, me.selectedItem))
+               if (!me.g_maplistCacheQuery(me, me.selectedItem))
                        me.g_maplistCacheToggle(me, me.selectedItem);
        }
        else if(ascii == 45) // -