#include "dialog_multiplayer_join_serverinfo.qh"
#include <common/mapinfo.qh>
+#define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv)
+#define IsPromoted(srv) IsServerInList(_Nex_ExtResponseSystem_PromotedServers, srv)
+#define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv)
+
+float m_gethostcachecategory(float entry) { return CategoryOverride(CategoryForEntry(entry)); }
+
void SL_ProcessCategoryOverrides(.string override_field_string, .float override_field)
{
for (int i = 0; i < category_ent_count; ++i)
for(int i = 0; i < category_draw_count; ++i) { category_name[i] = -1; category_item[i] = -1; }
category_draw_count = 0;
+ me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT);
+
if(autocvar_menu_slist_categories >= 0) // if less than 0, don't even draw a category heading for favorites
{
- float itemcount = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT);
- me.nItems = itemcount;
+ int itemcount = me.nItems;
//float visible = floor(me.scrollPos / me.itemHeight);
// ^ unfortunately no such optimization can be made-- we must process through the
me.nItems = itemcount;
}
}
- else { me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }
me.connectButton.disabled = (me.ipAddressBox.text == "");
- //me.disconnectButton.disabled = (!(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)));
me.infoButton.disabled = !owned;
me.favoriteButton.disabled = (me.ipAddressBox.text == "");
if (me.nItems != 0)
main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
- float thisPos = me.getItemStart(me, me.selectedItem);
- float thisHeight = me.getItemHeight(me, me.selectedItem);
+ 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);
// Stats
if(sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS))
- draw_Picture(iconPos, "icon_stats1", iconSize, '1 1 1', 1);
+ {
+ if (sflags & SERVERFLAG_PLAYERSTATS_CUSTOM)
+ draw_Picture(iconPos, "icon_mod_", iconSize, '1 1 1', 1); // TODO: custom stats server icon
+ else
+ draw_Picture(iconPos, "icon_stats1", iconSize, '1 1 1', 1);
+ }
if(isFocused && me.mouseOverIcons && !me.tooltip)
{
if(pure_available)
t = strcat(t, sprintf(" (%s)", (pure) ? _("official settings") : _("modified settings")));
t = strcat(t, ", ");
- t = strcat(t, ((sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) ? _("stats enabled") : _("stats disabled")));
+ t = strcat(t, ((sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) ? ((sflags & SERVERFLAG_PLAYERSTATS_CUSTOM) ? _("custom stats server") : _("stats enabled")) : _("stats disabled")));
setZonedTooltip(me, t, string_null);
}
// --------------
{
if(me.nItems != 0)
{
- float thisPos = me.getItemStart(me, me.selectedItem);
- float thisHeight = me.getItemHeight(me, me.selectedItem);
+ 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);
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] * me.serversHeight;
+ float itempos = i * me.categoriesHeight + itemidx * me.serversHeight;
if (pos >= itempos + me.categoriesHeight + me.serversHeight)
return itemidx + 1 + floor((pos - (itempos + me.categoriesHeight + me.serversHeight)) / me.serversHeight);
if (pos >= itempos)
{
for (int i = category_draw_count - 1; i >= 0; --i) {
int itemidx = category_item[i];
- float itempos = i * me.categoriesHeight + category_item[i] * me.serversHeight;
+ float itempos = i * me.categoriesHeight + itemidx * me.serversHeight;
if (item >= itemidx + 1)
return (itempos + me.categoriesHeight + (1 + item - (itemidx + 1)) * me.serversHeight) * me.itemHeight;
if (item >= itemidx)
{
for (int i = 0; i < category_draw_count; ++i) {
// Matches exactly the headings with increased height.
+ // FIXME server row next to the heading is slightly smaller than others if (autocvar_menu_slist_categories <= 0)
if (item == category_item[i])
- return me.itemHeight * (me.categoriesHeight + 1);
+ return me.itemHeight * (me.categoriesHeight + me.serversHeight);
}
return me.itemHeight * me.serversHeight;
}