X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fserverlist.c;h=3d848c9c59d78df666d39f87776c7a179363e7bb;hb=bb450e879647c09efd145e95637ee17508d1d1cb;hp=e656b963e2ca7bf9e65432d4e75a4431b69ce32c;hpb=bc20da5a3271b337049a25f68ddecad472b8db98;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/serverlist.c b/qcsrc/menu/xonotic/serverlist.c index e656b963e..3d848c9c5 100644 --- a/qcsrc/menu/xonotic/serverlist.c +++ b/qcsrc/menu/xonotic/serverlist.c @@ -4,7 +4,7 @@ CLASS(XonoticServerList) EXTENDS(XonoticListBox) ATTRIB(XonoticServerList, rowsPerItem, float, 1) METHOD(XonoticServerList, draw, void(entity)) METHOD(XonoticServerList, drawListBoxItem, void(entity, float, vector, float)) - METHOD(XonoticServerList, clickListBoxItem, void(entity, float, vector)) + METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector)) METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector)) METHOD(XonoticServerList, keyDown, float(entity, float, float, float)) METHOD(XonoticServerList, toggleFavorite, void(entity, string)) @@ -49,8 +49,6 @@ CLASS(XonoticServerList) EXTENDS(XonoticListBox) ATTRIB(XonoticServerList, infoButton, entity, NULL) ATTRIB(XonoticServerList, currentSortOrder, float, 0) ATTRIB(XonoticServerList, currentSortField, float, -1) - ATTRIB(XonoticServerList, lastClickedServer, float, -1) - ATTRIB(XonoticServerList, lastClickedTime, float, 0) ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1) @@ -152,7 +150,7 @@ float category_draw_count; SLIST_CATEGORY(CAT_XPM, "CAT_NORMAL", "CAT_SERVERS", ZCTX(_("SLCAT^Competitive Mode"))) \ SLIST_CATEGORY(CAT_MODIFIED, "", "CAT_SERVERS", ZCTX(_("SLCAT^Modified Servers"))) \ SLIST_CATEGORY(CAT_OVERKILL, "", "CAT_SERVERS", ZCTX(_("SLCAT^Overkill Mode"))) \ - SLIST_CATEGORY(CAT_MINSTAGIB, "", "CAT_SERVERS", ZCTX(_("SLCAT^MinstaGib Mode"))) \ + SLIST_CATEGORY(CAT_INSTAGIB, "", "CAT_SERVERS", ZCTX(_("SLCAT^InstaGib Mode"))) \ SLIST_CATEGORY(CAT_DEFRAG, "", "CAT_SERVERS", ZCTX(_("SLCAT^Defrag Mode"))) #define SLIST_CATEGORY_AUTOCVAR(name) autocvar_menu_slist_categories_##name##_override @@ -205,11 +203,11 @@ void RegisterSLCategories() } \ else \ { \ - print(sprintf( \ + printf( \ "RegisterSLCategories(): Improper override '%s' for category '%s'!\n", \ s, \ categories[i].cat_name \ - )); \ + ); \ } \ } \ strunzone(categories[i].override_string); \ @@ -361,8 +359,9 @@ float CheckCategoryForEntry(float entry) // old servers which don't report their mod name are considered modified now case "": { return CAT_MODIFIED; } - case "xpm": { return CAT_XPM; } - case "minstagib": { return CAT_MINSTAGIB; } + case "xpm": { return CAT_XPM; } + case "minstagib": + case "instagib": { return CAT_INSTAGIB; } case "overkill": { return CAT_OVERKILL; } //case "nix": { return CAT_NIX; } //case "newtoys": { return CAT_NEWTOYS; } @@ -371,7 +370,7 @@ float CheckCategoryForEntry(float entry) case "cts": case "xdf": { return CAT_DEFRAG; } - default: { dprint(sprintf("Found strange mod type: %s\n", modtype)); return CAT_MODIFIED; } + default: { dprintf("Found strange mod type: %s\n", modtype); return CAT_MODIFIED; } } } @@ -414,7 +413,7 @@ void XonoticServerList_toggleFavorite(entity me, string srv) f = 1; --i; } - + if(!f) { s1 = ""; @@ -562,6 +561,7 @@ void XonoticServerList_refreshServerList(entity me, float mode) } void XonoticServerList_focusEnter(entity me) { + SUPER(XonoticServerList).focusEnter(me); if(time < me.nextRefreshTime) { //print("sorry, no refresh yet\n"); @@ -721,11 +721,7 @@ void XonoticServerList_draw(entity me) { if(gethostcachestring(SLIST_FIELD_CNAME, i) == me.selectedServer) { - if(i != me.selectedItem) - { - me.lastClickedServer = -1; - me.selectedItem = i; - } + me.selectedItem = i; found = 1; break; } @@ -948,6 +944,7 @@ void ServerList_Favorite_Click(entity btn, entity me) ipstr = netaddress_resolve(me.ipAddressBox.text, 26000); if(ipstr != "") { + m_play_click_sound(MENU_SOUND_SELECT); me.toggleFavorite(me, me.ipAddressBox.text); me.ipAddressBoxFocused = -1; } @@ -956,18 +953,14 @@ void ServerList_Info_Click(entity btn, entity me) { if (me.nItems != 0) main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem); - DialogOpenButton_Click(me, main.serverInfoDialog); + + vector org = boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size); + vector sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size); + DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz); } -void XonoticServerList_clickListBoxItem(entity me, float i, vector where) +void XonoticServerList_doubleClickListBoxItem(entity me, float i, vector where) { - if(i == me.lastClickedServer) - if(time < me.lastClickedTime + 0.3) - { - // DOUBLE CLICK! - ServerList_Connect_Click(NULL, me); - } - me.lastClickedServer = i; - me.lastClickedTime = time; + ServerList_Connect_Click(NULL, me); } void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) { @@ -979,7 +972,7 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float float m, pure, freeslots, j, sflags; string s, typestr, versionstr, k, v, modname; - //print(sprintf("time: %f, i: %d, item: %d, nitems: %d\n", time, i, item, me.nItems)); + //printf("time: %f, i: %d, item: %d, nitems: %d\n", time, i, item, me.nItems); vector oldscale = draw_scale; vector oldshift = draw_shift; @@ -1013,8 +1006,8 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float strcat(catent.cat_string, ":"), #endif me.realFontSize, - '1 1 1', - SKINALPHA_TEXT, + SKINCOLOR_SERVERLIST_CATEGORY, + SKINALPHA_SERVERLIST_CATEGORY, 0 ); SET_YRANGE(me.categoriesHeight / (me.categoriesHeight + 1), 1); @@ -1067,7 +1060,7 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float // list the mods here on which the pure server check actually works if(modname != "Xonotic") - if(modname != "MinstaGib") + if(modname != "InstaGib" || modname != "MinstaGib") if(modname != "CTS") if(modname != "NIX") if(modname != "NewToys") @@ -1077,7 +1070,7 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float theAlpha = SKINALPHA_SERVERLIST_FULL; else if(freeslots == 0) theAlpha = SKINALPHA_SERVERLIST_FULL; // g_maxplayers support - else if not(gethostcachenumber(SLIST_FIELD_NUMHUMANS, i)) + else if (!gethostcachenumber(SLIST_FIELD_NUMHUMANS, i)) theAlpha = SKINALPHA_SERVERLIST_EMPTY; else theAlpha = 1; @@ -1163,7 +1156,7 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float string n; - if not(me.seenIPv4 && me.seenIPv6) + if (!(me.seenIPv4 && me.seenIPv6)) { iconPos_x += iconSize_x * 0.5; } @@ -1254,6 +1247,7 @@ float XonoticServerList_keyDown(entity me, float scan, float ascii, float shift) { if(me.nItems != 0) { + m_play_click_sound(MENU_SOUND_OPEN); main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem); DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz); return 1;