]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/maplist.c
Merge remote branch 'origin/master' into samual/menu_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / maplist.c
index 88be8167900674e07a537be087aff6c2a52615e6..650e343c6b29f6c07db10bd00b91983054a3247a 100644 (file)
@@ -51,7 +51,7 @@ void MapList_LoadMap(entity btn, entity me);
 #endif
 
 #ifdef IMPLEMENTATION
-void destroyXonoticMapList(entity me)
+void XonoticMapList_destroy(entity me)
 {
        MapInfo_Shutdown();
 }
@@ -64,22 +64,22 @@ entity makeXonoticMapList()
        return me;
 }
 
-void configureXonoticMapListXonoticMapList(entity me)
+void XonoticMapList_configureXonoticMapList(entity me)
 {
        me.configureXonoticListBox(me);
        me.refilter(me);
 }
 
-void loadCvarsXonoticMapList(entity me)
+void XonoticMapList_loadCvars(entity me)
 {
        me.refilter(me);
 }
 
-float g_maplistCacheQueryXonoticMapList(entity me, float i)
+float XonoticMapList_g_maplistCacheQuery(entity me, float i)
 {
        return stof(substring(me.g_maplistCache, i, 1));
 }
-void g_maplistCacheToggleXonoticMapList(entity me, float i)
+void XonoticMapList_g_maplistCacheToggle(entity me, float i)
 {
        string a, b, c, s, bspname;
        float n;
@@ -113,14 +113,14 @@ void g_maplistCacheToggleXonoticMapList(entity me, float i)
        }
 }
 
-void drawXonoticMapList(entity me)
+void XonoticMapList_draw(entity me)
 {
        if(me.startButton)
                me.startButton.disabled = ((me.selectedItem < 0) || (me.selectedItem >= me.nItems));
        SUPER(XonoticMapList).draw(me);
 }
 
-void resizeNotifyXonoticMapList(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+void XonoticMapList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
        me.itemAbsSize = '0 0 0';
        SUPER(XonoticMapList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
@@ -139,7 +139,7 @@ void resizeNotifyXonoticMapList(entity me, vector relOrigin, vector relSize, vec
        me.checkMarkOrigin = eY + eX * (me.columnPreviewOrigin + me.columnPreviewSize) - me.checkMarkSize;
 }
 
-void clickListBoxItemXonoticMapList(entity me, float i, vector where)
+void XonoticMapList_clickListBoxItem(entity me, float i, vector where)
 {
        if(where_x <= me.columnPreviewOrigin + me.columnPreviewSize)
        {
@@ -163,7 +163,7 @@ void clickListBoxItemXonoticMapList(entity me, float i, vector where)
                        }
 }
 
-void drawListBoxItemXonoticMapList(entity me, float i, vector absSize, float isSelected)
+void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
 {
        // layout: Ping, Map name, Map name, NP, TP, MP
        string s;
@@ -189,7 +189,7 @@ void drawListBoxItemXonoticMapList(entity me, float i, vector absSize, float isS
        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(strcat(MapInfo_Map_bspname, ": ", MapInfo_Map_title), me.columnNameSize, 0, me.realFontSize);
+       s = draw_TextShortenToWidth(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);
        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);
@@ -197,7 +197,7 @@ void drawListBoxItemXonoticMapList(entity me, float i, vector absSize, float isS
        MapInfo_ClearTemps();
 }
 
-void refilterXonoticMapList(entity me)
+void XonoticMapList_refilter(entity me)
 {
        float i, j, n;
        string s;
@@ -233,7 +233,7 @@ void refilterXonoticMapList(entity me)
        }
 }
 
-void refilterCallbackXonoticMapList(entity me, entity cb)
+void XonoticMapList_refilterCallback(entity me, entity cb)
 {
        me.refilter(me);
 }
@@ -242,7 +242,7 @@ void MapList_All(entity btn, entity me)
 {
        float i;
        string s;
-       MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MAPINFO_FLAG_FORBIDDEN, 0); // all
+       MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MAPINFO_FLAG_FORBIDDEN | MAPINFO_FLAG_HIDDEN, 0); // all
        s = "";
        for(i = 0; i < MapInfo_count; ++i)
                s = strcat(s, " ", MapInfo_BSPName_ByID(i));
@@ -275,27 +275,31 @@ void MapList_LoadMap(entity btn, entity me)
        m = MapInfo_BSPName_ByID(i);
        if not(m)
        {
-               print("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n");
+               print(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n"));
+               me.refilter(me);
                return;
        }
        if(MapInfo_CheckMap(m))
        {
                localcmd("\nmenu_loadmap_prepare\n");
                if(cvar("menu_use_default_hostname"))
-                       localcmd("hostname \"", strdecolorize(cvar_string("_cl_name")), "'s Xonotic server\"\n");
-               MapInfo_LoadMap(m);
+                       localcmd("hostname \"", sprintf(_("%s's Xonotic Server"), strdecolorize(cvar_string("_cl_name"))), "\"\n");
+               MapInfo_LoadMap(m, 1);
        }
        else
        {
-               print("Huh? Can't play this (invalid game type). Refiltering so this won't happen again.\n");
+               print(_("Huh? Can't play this (invalid game type). Refiltering so this won't happen again.\n"));
                me.refilter(me);
+               return;
        }
 }
 
-float keyDownXonoticMapList(entity me, float scan, float ascii, float shift)
+float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift)
 {
        string ch, save;
-       if(scan == K_ENTER)
+       if(me.nItems <= 0)
+               return SUPER(XonoticMapList).keyDown(me, scan, ascii, shift);
+       if(scan == K_ENTER || scan == K_KP_ENTER)
        {
                // pop up map info screen
                main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, me.selectedItem, me);