entity e = me.favoriteButton;
if(IsFavorite(me.ipAddressBox.text))
{
- e.setText(e, _("Remove favorite"));
+ e.setText(e, ZCTX(_("SERVER^Remove favorite")));
setZonedTooltip(e, _("Remove the currently highlighted server from bookmarks"), string_null);
}
else
{
- e.setText(e, _("Favorite"));
+ e.setText(e, ZCTX(_("SERVER^Favorite")));
setZonedTooltip(e, _("Bookmark the currently highlighted server so that it's faster to find in the future"), string_null);
}
}
if(!me.filterShowEmpty)
sethostcachemasknumber(++m, SLIST_FIELD_NUMHUMANS, 1, SLIST_TEST_GREATEREQUAL);
+ // show laggy button
+ if(!me.filterShowLaggy && autocvar_menu_slist_maxping > 0)
+ sethostcachemasknumber(++m, SLIST_FIELD_PING, autocvar_menu_slist_maxping, SLIST_TEST_LESSEQUAL);
+
// gametype filtering
if(typestr != "")
sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(typestr, ":"), SLIST_TEST_STARTSWITH);
void XonoticServerList_draw(entity me)
{
+ me.serversHeight = (autocvar_menu_slist_categories > 0 ? 1.0 : me.categoriesHeight);
+
if(_Nex_ExtResponseSystem_BannedServersNeedsRefresh)
{
if(!me.needsRefresh)
}
else { me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }
- me.connectButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
+ me.connectButton.disabled = (me.ipAddressBox.text == "");
//me.disconnectButton.disabled = (!(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)));
- me.infoButton.disabled = (me.lockedSelectedItem || me.nItems == 0 || !owned);
- me.favoriteButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
+ me.infoButton.disabled = !owned;
+ me.favoriteButton.disabled = (me.ipAddressBox.text == "");
bool found = false;
if(me.lockedSelectedItem)
// the type was found
// choose the next one
flag = true;
- s = MapInfo_Type_ToString(Gametypes_from(it.m_id + 1));
+ s = MapInfo_Type_ToString(REGISTRY_GET(Gametypes, it.m_id + 1));
if (s == "") s = MapInfo_Type_ToString(first);
break;
});
me.ipAddressBox.cursorPos = 0;
me.ipAddressBoxFocused = -1;
}
+void ServerList_ShowLaggy_Click(entity box, entity me)
+{
+ box.setChecked(box, me.filterShowLaggy = !me.filterShowLaggy);
+ me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
+
+ me.ipAddressBox.setText(me.ipAddressBox, "");
+ me.ipAddressBox.cursorPos = 0;
+ me.ipAddressBoxFocused = -1;
+}
void XonoticServerList_setSortOrder(entity me, int fld, int direction)
{
if(me.currentSortField == fld)
}
void ServerList_Connect_Click(entity btn, entity me)
{
- if (me.lockedSelectedItem)
- return;
- string sv = (me.ipAddressBox.text != "") ? me.ipAddressBox.text : me.selectedServer;
- localcmd(sprintf("connect %s\n", sv));
+ if (me.ipAddressBox.text != "")
+ localcmd(sprintf("connect %s\n", me.ipAddressBox.text));
}
void ServerList_Favorite_Click(entity btn, entity this)
{
if (me.nItems != 0)
main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
- 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);
+ float thisPos = me.getItemStart(me, me.selectedItem);
+ float thisHeight = me.getItemHeight(me, me.selectedItem);
+ vector org = boxToGlobal(eY * (thisPos - me.scrollPos), me.origin, me.size);
+ vector sz = boxToGlobalSize(eY * thisHeight + eX * (1 - me.controlWidth), me.size);
DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
}
void XonoticServerList_doubleClickListBoxItem(entity me, int i, vector where)
vector oldscale = draw_scale;
vector oldshift = draw_shift;
#define SET_YRANGE(start,end) \
- draw_scale = boxToGlobalSize(eX + eY * (end - start), oldscale); \
- draw_shift = boxToGlobal(eY * start, oldshift, oldscale);
+ draw_scale = boxToGlobalSize(eX + eY * ((end) - (start)), oldscale); \
+ draw_shift = boxToGlobal(eY * (start), oldshift, oldscale);
int c;
for (c = 0; c < category_draw_count; ++c) {
}
}
+ // Now categories are done. Set the Y range in stone.
+ oldscale = draw_scale;
+ oldshift = draw_shift;
+
if(isSelected && !me.lockedSelectedItem)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
else if(isFocused)
// --------------
vector iconSize = '0 0 0';
iconSize_y = me.realFontSize.y * me.iconsSizeFactor;
- iconSize_x = me.realFontSize.x * me.iconsSizeFactor;
+ iconSize_x = me.realFontSize.x * me.iconsSizeFactor * me.serversHeight;
vector iconPos = '0 0 0';
iconPos_x = (me.columnIconsSize - 3 * iconSize.x) * 0.5;
// RENDER TEXT
// --------------
+ // Center it in the row.
+ SET_YRANGE(
+ 0.5 - 0.5 / me.serversHeight,
+ 0.5 + 0.5 / me.serversHeight
+ );
+
// ping
s = ftos(ping);
draw_Text(me.realUpperMargin * eY + (me.columnPingOrigin + me.columnPingSize - draw_TextWidth(s, 0, me.realFontSize)) * eX, s, me.realFontSize, theColor, theAlpha, 0);
{
if(me.nItems != 0)
{
- 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);
+ float thisPos = me.getItemStart(me, me.selectedItem);
+ float thisHeight = me.getItemHeight(me, me.selectedItem);
+ vector org = boxToGlobal(eY * (thisPos - me.scrollPos), me.origin, me.size);
+ vector sz = boxToGlobalSize(eY * thisHeight + eX * (1 - me.controlWidth), me.size);
m_play_click_sound(MENU_SOUND_OPEN);
main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
{
float num_normal_rows = me.nItems;
int num_headers = category_draw_count;
- return me.itemHeight * (num_normal_rows + me.categoriesHeight * num_headers);
+ return me.itemHeight * (me.serversHeight * num_normal_rows + me.categoriesHeight * num_headers);
}
int XonoticServerList_getItemAtPos(entity me, float pos)
{
pos = pos / me.itemHeight;
for (int i = category_draw_count - 1; i >= 0; --i) {
int itemidx = category_item[i];
- float itempos = i * me.categoriesHeight + category_item[i];
- if (pos >= itempos + me.categoriesHeight + 1)
- return itemidx + 1 + floor(pos - (itempos + me.categoriesHeight + 1));
+ float itempos = i * me.categoriesHeight + category_item[i] * me.serversHeight;
+ if (pos >= itempos + me.categoriesHeight + me.serversHeight)
+ return itemidx + 1 + floor((pos - (itempos + me.categoriesHeight + me.serversHeight)) / me.serversHeight);
if (pos >= itempos)
return itemidx;
}
// No category matches? Note that category 0 is... 0. Therefore no headings exist at all.
- return floor(pos);
+ return floor(pos / me.serversHeight);
}
float XonoticServerList_getItemStart(entity me, int item)
{
for (int i = category_draw_count - 1; i >= 0; --i) {
int itemidx = category_item[i];
- float itempos = i * me.categoriesHeight + category_item[i];
+ float itempos = i * me.categoriesHeight + category_item[i] * me.serversHeight;
if (item >= itemidx + 1)
- return (itempos + me.categoriesHeight + 1 + item - (itemidx + 1)) * me.itemHeight;
+ return (itempos + me.categoriesHeight + (1 + item - (itemidx + 1)) * me.serversHeight) * me.itemHeight;
if (item >= itemidx)
return itempos * me.itemHeight;
}
// No category matches? Note that category 0 is... 0. Therefore no headings exist at all.
- return item * me.itemHeight;
+ return item * me.serversHeight * me.itemHeight;
}
float XonoticServerList_getItemHeight(entity me, int item)
{
if (item == category_item[i])
return me.itemHeight * (me.categoriesHeight + 1);
}
- return me.itemHeight;
+ return me.itemHeight * me.serversHeight;
}