2005-02-28 07:16:19 +00:00
|
|
|
#include "quakedef.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2014-09-08 23:47:19 +00:00
|
|
|
#if defined(CL_MASTER) && !defined(NOBUILTINMENUS)
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "cl_master.h"
|
2015-06-16 23:53:58 +00:00
|
|
|
#include "shader.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
//filtering
|
2015-06-16 23:53:58 +00:00
|
|
|
static cvar_t sb_sortcolumn = CVARF("sb_sortcolumn", "0", CVAR_ARCHIVE);
|
2015-06-28 03:43:10 +00:00
|
|
|
static cvar_t sb_filtertext = CVARF("sb_filtertext", "", CVAR_NOSAVE);
|
2015-06-16 23:53:58 +00:00
|
|
|
static cvar_t sb_hideempty = CVARF("sb_hideempty", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_hidenotempty = CVARF("sb_hidenotempty", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_hidefull = CVARF("sb_hidefull", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_hidedead = CVARF("sb_hidedead", "1", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_hidenetquake = CVARF("sb_hidenetquake", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_hidequakeworld = CVARF("sb_hidequakeworld","0", CVAR_ARCHIVE);
|
2015-06-19 16:56:50 +00:00
|
|
|
static cvar_t sb_hideproxies = CVARF("sb_hideproxies", "1", CVAR_ARCHIVE);
|
2015-06-16 23:53:58 +00:00
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef FTE_TARGET_WEB
|
|
|
|
static cvar_t sb_showping = CVARF("sb_showping", "0", CVAR_ARCHIVE); //not really much point showing pings.
|
|
|
|
#else
|
2015-06-16 23:53:58 +00:00
|
|
|
static cvar_t sb_showping = CVARF("sb_showping", "1", CVAR_ARCHIVE);
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-06-16 23:53:58 +00:00
|
|
|
static cvar_t sb_showaddress = CVARF("sb_showaddress", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showmap = CVARF("sb_showmap", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showgamedir = CVARF("sb_showgamedir", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showplayers = CVARF("sb_showplayers", "1", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showfraglimit = CVARF("sb_showfraglimit", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showtimelimit = CVARF("sb_showtimelimit", "0", CVAR_ARCHIVE);
|
|
|
|
|
2015-06-28 03:43:10 +00:00
|
|
|
static cvar_t sb_alpha = CVARF("sb_alpha", "0.7", CVAR_ARCHIVE);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2016-02-10 23:23:43 +00:00
|
|
|
vrect_t joinbutton, specbutton;
|
2015-06-18 22:11:30 +00:00
|
|
|
static float refreshedtime;
|
|
|
|
static int isrefreshing;
|
2021-10-22 22:27:58 +00:00
|
|
|
static enum
|
|
|
|
{
|
|
|
|
SVPV_NO,
|
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
SVPV_PLAYERS,
|
|
|
|
#endif
|
|
|
|
SVPV_RULES,
|
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
SVPV_HELP,
|
|
|
|
SVPV_ROUTE,
|
|
|
|
SVPV_LAST=SVPV_ROUTE,
|
|
|
|
#else
|
|
|
|
SVPV_LAST=SVPV_RULES,
|
|
|
|
#endif
|
|
|
|
} serverpreview;
|
2005-09-28 23:37:15 +00:00
|
|
|
extern cvar_t slist_writeserverstxt;
|
|
|
|
extern cvar_t slist_cacheinfo;
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void CalcFilters(emenu_t *menu);
|
2015-06-16 23:53:58 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Serverlist_Init(void)
|
|
|
|
{
|
|
|
|
char *grp = "Server Browser Vars";
|
|
|
|
|
2015-06-16 23:53:58 +00:00
|
|
|
Cvar_Register(&sb_alpha, grp);
|
2004-08-23 00:15:46 +00:00
|
|
|
Cvar_Register(&sb_hideempty, grp);
|
|
|
|
Cvar_Register(&sb_hidenotempty, grp);
|
|
|
|
Cvar_Register(&sb_hidefull, grp);
|
|
|
|
Cvar_Register(&sb_hidedead, grp);
|
|
|
|
Cvar_Register(&sb_hidenetquake, grp);
|
|
|
|
Cvar_Register(&sb_hidequakeworld, grp);
|
2014-12-23 15:26:42 +00:00
|
|
|
Cvar_Register(&sb_hideproxies, grp);
|
2015-06-16 23:53:58 +00:00
|
|
|
Cvar_Register(&sb_filtertext, grp);
|
|
|
|
Cvar_Register(&sb_sortcolumn, grp);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
Cvar_Register(&sb_showping, grp);
|
|
|
|
Cvar_Register(&sb_showaddress, grp);
|
|
|
|
Cvar_Register(&sb_showmap, grp);
|
|
|
|
Cvar_Register(&sb_showgamedir, grp);
|
|
|
|
Cvar_Register(&sb_showplayers, grp);
|
|
|
|
Cvar_Register(&sb_showfraglimit, grp);
|
|
|
|
Cvar_Register(&sb_showtimelimit, grp);
|
2005-09-28 23:37:15 +00:00
|
|
|
|
|
|
|
Cvar_Register(&slist_writeserverstxt, grp);
|
|
|
|
Cvar_Register(&slist_cacheinfo, grp);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2020-03-08 07:02:37 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SLFILTER_HIDENETQUAKE,
|
|
|
|
SLFILTER_HIDEQUAKEWORLD,
|
|
|
|
SLFILTER_HIDEPROXIES,
|
|
|
|
SLFILTER_ONLYFAVOURITES,
|
|
|
|
SLFILTER_HIDEEMPTY,
|
|
|
|
SLFILTER_HIDEFULL,
|
|
|
|
SLFILTER_MAX
|
|
|
|
};
|
2006-02-28 00:46:04 +00:00
|
|
|
typedef struct {
|
2016-02-10 23:23:43 +00:00
|
|
|
int servers_top;
|
2006-02-28 00:46:04 +00:00
|
|
|
int visibleslots;
|
|
|
|
int scrollpos;
|
|
|
|
int selectedpos;
|
2015-06-16 23:53:58 +00:00
|
|
|
int filtermodcount;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
int numslots;
|
|
|
|
qboolean stillpolling;
|
2020-03-08 07:02:37 +00:00
|
|
|
qbyte filter[SLFILTER_MAX];
|
|
|
|
|
2015-06-16 23:53:58 +00:00
|
|
|
menuedit_t *filtertext;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2011-06-16 02:03:57 +00:00
|
|
|
char refreshtext[64];
|
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
qboolean sliderpressed;
|
|
|
|
|
|
|
|
menupicture_t *mappic;
|
|
|
|
} serverlist_t;
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void SL_DrawColumnTitle (int *x, int y, int xlen, int mx, char *str, qboolean recolor, qbyte clr, qboolean *filldraw)
|
2006-03-23 06:45:17 +00:00
|
|
|
{
|
|
|
|
int xmin;
|
|
|
|
|
|
|
|
if (x == NULL)
|
|
|
|
xmin = 0;
|
|
|
|
else
|
|
|
|
xmin = (*x - xlen);
|
|
|
|
|
|
|
|
if (recolor)
|
|
|
|
str = va("^&%c-%s", clr, str);
|
2006-03-23 22:18:31 +00:00
|
|
|
if (mx >= xmin && !(*filldraw))
|
2006-03-23 06:45:17 +00:00
|
|
|
{
|
|
|
|
*filldraw = true;
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ImageColours((sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08, 1.0);
|
|
|
|
R2D_FillBlock(xmin, y, xlen, 8);
|
2015-12-12 19:25:15 +00:00
|
|
|
R2D_ImageColours(1,1,1,1);
|
2006-03-23 06:45:17 +00:00
|
|
|
}
|
2013-10-29 17:38:22 +00:00
|
|
|
Draw_FunStringWidth(xmin, y, str, xlen, false, false);
|
2006-03-23 06:45:17 +00:00
|
|
|
|
|
|
|
if (x != NULL)
|
2009-11-04 21:16:50 +00:00
|
|
|
*x -= xlen + 8;
|
2006-03-23 06:45:17 +00:00
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void SL_TitlesDraw (int x, int y, menucustom_t *ths, emenu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
2006-03-14 01:18:47 +00:00
|
|
|
int sf = Master_GetSortField();
|
2009-11-04 21:16:50 +00:00
|
|
|
int mx = mousecursor_x;
|
2006-03-23 06:45:17 +00:00
|
|
|
qboolean filldraw = false;
|
|
|
|
qbyte clr;
|
|
|
|
|
2006-03-14 01:18:47 +00:00
|
|
|
if (Master_GetSortDescending())
|
2006-03-23 06:45:17 +00:00
|
|
|
clr = 'D';
|
2006-03-14 01:18:47 +00:00
|
|
|
else
|
2006-03-23 06:45:17 +00:00
|
|
|
clr = 'B';
|
2009-11-04 21:16:50 +00:00
|
|
|
x = ths->common.width;
|
2022-07-28 02:17:27 +00:00
|
|
|
if ((mx > x || mousecursor_y < y || mousecursor_y >= y+8) && !serverpreview)
|
2006-03-23 06:45:17 +00:00
|
|
|
filldraw = true;
|
2009-11-04 21:16:50 +00:00
|
|
|
if (sb_showtimelimit.value) {SL_DrawColumnTitle(&x, y, 3*8, mx, "tl", (sf==SLKEY_TIMELIMIT), clr, &filldraw);}
|
|
|
|
if (sb_showfraglimit.value) {SL_DrawColumnTitle(&x, y, 3*8, mx, "fl", (sf==SLKEY_FRAGLIMIT), clr, &filldraw);}
|
2015-06-19 16:56:50 +00:00
|
|
|
if (sb_showplayers.value) {SL_DrawColumnTitle(&x, y, 5*8, mx, "plyrs", (sf==SLKEY_NUMHUMANS), clr, &filldraw);}
|
2009-11-04 21:16:50 +00:00
|
|
|
if (sb_showmap.value) {SL_DrawColumnTitle(&x, y, 8*8, mx, "map", (sf==SLKEY_MAP), clr, &filldraw);}
|
|
|
|
if (sb_showgamedir.value) {SL_DrawColumnTitle(&x, y, 8*8, mx, "gamedir", (sf==SLKEY_GAMEDIR), clr, &filldraw);}
|
|
|
|
if (sb_showping.value) {SL_DrawColumnTitle(&x, y, 3*8, mx, "png", (sf==SLKEY_PING), clr, &filldraw);}
|
|
|
|
if (sb_showaddress.value) {SL_DrawColumnTitle(&x, y, 21*8, mx, "address", (sf==SLKEY_ADDRESS), clr, &filldraw);}
|
|
|
|
SL_DrawColumnTitle(NULL, y, x, mx, "hostname ", (sf==SLKEY_NAME), clr, &filldraw);
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static qboolean SL_TitlesKey (menucustom_t *ths, emenu_t *menu, int key, unsigned int unicode)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int mx = mousecursor_x/8;
|
|
|
|
int sortkey;
|
2015-06-16 23:53:58 +00:00
|
|
|
qboolean descending;
|
|
|
|
char sortchar = 0;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
if (key != K_MOUSE1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
do {
|
|
|
|
x = ths->common.width/8;
|
|
|
|
if (mx > x) return false; //out of bounds
|
2015-06-16 23:53:58 +00:00
|
|
|
if (sb_showtimelimit.value) {x-=4;if (mx > x) {sortkey = SLKEY_TIMELIMIT; sortchar='t'; break;}}
|
|
|
|
if (sb_showfraglimit.value) {x-=4;if (mx > x) {sortkey = SLKEY_FRAGLIMIT; sortchar='f'; break;}}
|
2015-06-19 16:56:50 +00:00
|
|
|
if (sb_showplayers.value) {x-=6;if (mx > x) {sortkey = SLKEY_NUMHUMANS; sortchar='p'; break;}}
|
2015-06-16 23:53:58 +00:00
|
|
|
if (sb_showmap.value) {x-=9;if (mx > x) {sortkey = SLKEY_MAP; sortchar='m'; break;}}
|
|
|
|
if (sb_showgamedir.value) {x-=9;if (mx > x) {sortkey = SLKEY_GAMEDIR; sortchar='g'; break;}}
|
|
|
|
if (sb_showping.value) {x-=4;if (mx > x) {sortkey = SLKEY_PING; sortchar='l'; break;}}
|
|
|
|
if (sb_showaddress.value) {x-=22;if (mx > x) {sortkey = SLKEY_ADDRESS; sortchar='a'; break;}}
|
|
|
|
sortkey = SLKEY_NAME; sortchar='n'; break;
|
2006-02-28 00:46:04 +00:00
|
|
|
} while (0);
|
|
|
|
|
2015-06-16 23:53:58 +00:00
|
|
|
// if (sortkey == SLKEY_ADDRESS)
|
|
|
|
// return true;
|
2006-03-14 01:18:47 +00:00
|
|
|
|
2014-05-21 06:21:09 +00:00
|
|
|
switch(sortkey)
|
|
|
|
{
|
|
|
|
case SLKEY_NUMPLAYERS:
|
2015-06-19 16:56:50 +00:00
|
|
|
case SLKEY_NUMHUMANS:
|
2014-05-21 06:21:09 +00:00
|
|
|
//favour descending order (low first)
|
2015-06-16 23:53:58 +00:00
|
|
|
descending = Master_GetSortField()!=sortkey||!Master_GetSortDescending();
|
2014-05-21 06:21:09 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
//favour ascending order (low first)
|
2015-06-16 23:53:58 +00:00
|
|
|
descending = Master_GetSortField()==sortkey&&!Master_GetSortDescending();
|
2014-05-21 06:21:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2015-06-16 23:53:58 +00:00
|
|
|
if (descending)
|
|
|
|
Cvar_Set(&sb_sortcolumn, va("-%c", sortchar));
|
|
|
|
else
|
|
|
|
Cvar_Set(&sb_sortcolumn, va("+%c", sortchar));
|
|
|
|
Master_SetSortField(sortkey, descending);
|
2015-06-19 16:56:50 +00:00
|
|
|
Master_SortServers();
|
2006-02-28 00:46:04 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-03-12 23:05:25 +00:00
|
|
|
typedef enum {
|
|
|
|
ST_NORMALQW,
|
|
|
|
ST_FTESERVER,
|
|
|
|
ST_QUAKE2,
|
|
|
|
ST_QUAKE3,
|
|
|
|
ST_NETQUAKE,
|
2006-09-17 00:59:22 +00:00
|
|
|
ST_QTV,
|
|
|
|
ST_PROXY,
|
2006-03-12 23:05:25 +00:00
|
|
|
ST_FAVORITE,
|
|
|
|
MAX_SERVERTYPES
|
|
|
|
} servertypes_t;
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static float serverbackcolor[MAX_SERVERTYPES * 2][3] =
|
2006-03-12 23:05:25 +00:00
|
|
|
{
|
|
|
|
{0.08, 0.08, 0.08}, // default
|
|
|
|
{0.16, 0.16, 0.16},
|
|
|
|
{0.14, 0.07, 0.07}, // FTE server
|
|
|
|
{0.28, 0.14, 0.14},
|
|
|
|
{0.04, 0.09, 0.04}, // Quake 2
|
|
|
|
{0.08, 0.18, 0.08},
|
|
|
|
{0.05, 0.05, 0.12}, // Quake 3
|
|
|
|
{0.10, 0.10, 0.24},
|
|
|
|
{0.12, 0.08, 0.02}, // NetQuake
|
|
|
|
{0.24, 0.16, 0.04},
|
|
|
|
{0.10, 0.05, 0.10}, // FTEQTV
|
|
|
|
{0.20, 0.10, 0.20},
|
2006-09-17 00:59:22 +00:00
|
|
|
{0.10, 0.05, 0.10}, // qizmo
|
|
|
|
{0.20, 0.10, 0.20},
|
2006-04-02 03:47:06 +00:00
|
|
|
{0.01, 0.13, 0.13}, // Favorite
|
|
|
|
{0.02, 0.26, 0.26}
|
2006-03-12 23:05:25 +00:00
|
|
|
};
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static float serverhighlight[MAX_SERVERTYPES][3] =
|
2006-03-12 23:05:25 +00:00
|
|
|
{
|
|
|
|
{0.35, 0.35, 0.45}, // Default
|
|
|
|
{0.60, 0.30, 0.30}, // FTE Server
|
|
|
|
{0.25, 0.45, 0.25}, // Quake 2
|
|
|
|
{0.20, 0.20, 0.60}, // Quake 3
|
|
|
|
{0.40, 0.40, 0.25}, // NetQuake
|
|
|
|
{0.45, 0.20, 0.45}, // FTEQTV
|
2006-09-17 00:59:22 +00:00
|
|
|
{0.45, 0.20, 0.45}, // qizmo
|
2006-04-02 08:16:00 +00:00
|
|
|
{0.10, 0.60, 0.60} // Favorite
|
2006-03-12 23:05:25 +00:00
|
|
|
};
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static servertypes_t flagstoservertype(int flags)
|
2006-03-12 23:05:25 +00:00
|
|
|
{
|
|
|
|
if (flags & SS_FAVORITE)
|
|
|
|
return ST_FAVORITE;
|
2006-09-17 00:59:22 +00:00
|
|
|
if (flags & SS_PROXY)
|
|
|
|
{
|
|
|
|
if (flags & SS_FTESERVER)
|
|
|
|
return ST_QTV;
|
|
|
|
else
|
|
|
|
return ST_PROXY;
|
|
|
|
}
|
2011-12-23 03:12:29 +00:00
|
|
|
#ifdef _DEBUG
|
2006-03-12 23:05:25 +00:00
|
|
|
if (flags & SS_FTESERVER)
|
|
|
|
return ST_FTESERVER;
|
2011-12-23 03:12:29 +00:00
|
|
|
#endif
|
2014-12-23 15:26:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
switch(flags & SS_PROTOCOLMASK)
|
|
|
|
{
|
2022-07-28 02:17:27 +00:00
|
|
|
case SS_QEPROT:
|
|
|
|
return ST_NETQUAKE;
|
2014-12-23 15:26:42 +00:00
|
|
|
case SS_NETQUAKE:
|
2006-03-12 23:05:25 +00:00
|
|
|
return ST_NETQUAKE;
|
2014-12-23 15:26:42 +00:00
|
|
|
case SS_QUAKE2:
|
2006-03-12 23:05:25 +00:00
|
|
|
return ST_QUAKE2;
|
2014-12-23 15:26:42 +00:00
|
|
|
case SS_QUAKE3:
|
2006-03-12 23:05:25 +00:00
|
|
|
return ST_QUAKE3;
|
2014-12-23 15:26:42 +00:00
|
|
|
case SS_QUAKEWORLD:
|
|
|
|
return ST_NORMALQW;
|
|
|
|
case SS_UNKNOWN:
|
|
|
|
return ST_NORMALQW;
|
|
|
|
default:
|
|
|
|
return ST_FTESERVER; //bug
|
|
|
|
}
|
2006-03-12 23:05:25 +00:00
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void SL_ServerDraw (int x, int y, menucustom_t *ths, emenu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
serverinfo_t *si;
|
2013-03-12 22:47:42 +00:00
|
|
|
int thisone = ths->dint + info->scrollpos;
|
2006-03-12 23:05:25 +00:00
|
|
|
servertypes_t stype;
|
2008-06-08 14:37:57 +00:00
|
|
|
char adr[MAX_ADR_SIZE];
|
|
|
|
|
2022-03-08 05:31:34 +00:00
|
|
|
if (sb_filtertext.modifiedcount != info->filtermodcount)
|
2015-06-16 23:53:58 +00:00
|
|
|
CalcFilters(menu);
|
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
si = Master_SortedServer(thisone);
|
|
|
|
if (si)
|
|
|
|
{
|
|
|
|
x = ths->common.width;
|
2006-03-12 23:05:25 +00:00
|
|
|
stype = flagstoservertype(si->special);
|
2006-02-28 00:46:04 +00:00
|
|
|
if (thisone == info->selectedpos)
|
2006-03-12 23:05:25 +00:00
|
|
|
{
|
2019-05-10 09:31:21 +00:00
|
|
|
R2D_ImageColours(SRGBA(
|
2006-03-12 23:05:25 +00:00
|
|
|
serverhighlight[(int)stype][0],
|
|
|
|
serverhighlight[(int)stype][1],
|
2011-03-30 17:34:37 +00:00
|
|
|
serverhighlight[(int)stype][2],
|
2019-05-10 09:31:21 +00:00
|
|
|
1.0));
|
2006-03-12 23:05:25 +00:00
|
|
|
}
|
2022-07-28 02:17:27 +00:00
|
|
|
else if (thisone == info->scrollpos + (int)(mousecursor_y-info->servers_top)/8 && mousecursor_x < x && !serverpreview)
|
2019-05-10 09:31:21 +00:00
|
|
|
R2D_ImageColours(SRGBA((sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08, sb_alpha.value));
|
2020-02-11 18:06:10 +00:00
|
|
|
else if (selectedserver.inuse && NET_CompareAdr(&si->adr, &selectedserver.adr) && !strcmp(si->brokerid, selectedserver.brokerid))
|
2019-05-10 09:31:21 +00:00
|
|
|
R2D_ImageColours(SRGBA(((sin(realtime*4.4)*0.25)+0.5) * 0.5, ((sin(realtime*4.4)*0.25)+0.5)*0.5, 0.08*0.5, sb_alpha.value));
|
2006-02-28 00:46:04 +00:00
|
|
|
else
|
2011-05-29 04:26:29 +00:00
|
|
|
{
|
2019-05-10 09:31:21 +00:00
|
|
|
R2D_ImageColours(SRGBA(
|
2006-03-12 23:05:25 +00:00
|
|
|
serverbackcolor[(int)stype * 2 + (thisone & 1)][0],
|
|
|
|
serverbackcolor[(int)stype * 2 + (thisone & 1)][1],
|
2011-03-30 17:34:37 +00:00
|
|
|
serverbackcolor[(int)stype * 2 + (thisone & 1)][2],
|
2019-05-10 09:31:21 +00:00
|
|
|
sb_alpha.value));
|
2006-03-12 23:05:25 +00:00
|
|
|
}
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_FillBlock(0, y, ths->common.width, 8);
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2015-12-12 19:25:15 +00:00
|
|
|
R2D_ImageColours(1,1,1,1);
|
2013-10-29 17:38:22 +00:00
|
|
|
if (sb_showtimelimit.value) {Draw_FunStringWidth((x-3*8), y, va("%i", si->tl), 3*8, false, false); x-=4*8;}
|
|
|
|
if (sb_showfraglimit.value) {Draw_FunStringWidth((x-3*8), y, va("%i", si->fl), 3*8, false, false); x-=4*8;}
|
2015-06-19 16:56:50 +00:00
|
|
|
if (sb_showplayers.value) {Draw_FunStringWidth((x-5*8), y, va("%2i/%2i", si->numhumans, si->maxplayers), 5*8, false, false); x-=6*8;}
|
2013-10-29 17:38:22 +00:00
|
|
|
if (sb_showmap.value) {Draw_FunStringWidth((x-8*8), y, si->map, 8*8, false, false); x-=9*8;}
|
|
|
|
if (sb_showgamedir.value) {Draw_FunStringWidth((x-8*8), y, si->gamedir, 8*8, false, false); x-=9*8;}
|
2020-02-11 18:06:10 +00:00
|
|
|
if (sb_showping.value) {Draw_FunStringWidth((x-3*8), y, *si->brokerid?"---":va("%i", si->ping), 3*8, false, false); x-=4*8;}
|
|
|
|
if (sb_showaddress.value) {Draw_FunStringWidth((x-21*8), y, Master_ServerToString(adr, sizeof(adr), si), 21*8, false, false); x-=22*8;}
|
2013-10-29 17:38:22 +00:00
|
|
|
Draw_FunStringWidth(0, y, si->name, x, false, false);
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
2015-06-16 23:53:58 +00:00
|
|
|
void MC_EditBox_Key(menuedit_t *edit, int key, unsigned int unicode);
|
2019-09-04 07:59:40 +00:00
|
|
|
static qboolean SL_ServerKey (menucustom_t *ths, emenu_t *menu, int key, unsigned int unicode)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
2006-03-10 03:50:08 +00:00
|
|
|
static int lastclick;
|
|
|
|
int curtime;
|
|
|
|
int oldselection;
|
2006-02-28 00:46:04 +00:00
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
serverinfo_t *server;
|
2015-06-16 23:53:58 +00:00
|
|
|
qboolean ctrl = keydown[K_LCTRL] || keydown[K_RCTRL];
|
2008-06-08 14:37:57 +00:00
|
|
|
|
2023-01-09 05:12:59 +00:00
|
|
|
if (key == K_MOUSE1 || key == K_TOUCH)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
2006-03-10 03:50:08 +00:00
|
|
|
oldselection = info->selectedpos;
|
2016-02-10 23:23:43 +00:00
|
|
|
info->selectedpos = info->scrollpos + (mousecursor_y-info->servers_top)/8;
|
2006-03-10 03:50:08 +00:00
|
|
|
server = Master_SortedServer(info->selectedpos);
|
2006-09-17 00:59:22 +00:00
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
selectedserver.inuse = true;
|
|
|
|
SListOptionChanged(server);
|
2006-09-17 00:59:22 +00:00
|
|
|
|
2006-03-10 03:50:08 +00:00
|
|
|
if (server)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
2006-03-10 03:50:08 +00:00
|
|
|
snprintf(info->mappic->picturename, 32, "levelshots/%s", server->map);
|
2014-12-23 15:26:42 +00:00
|
|
|
if (!*server->map || !R2D_SafeCachePic(info->mappic->picturename))
|
2006-09-17 00:59:22 +00:00
|
|
|
snprintf(info->mappic->picturename, 32, "levelshots/nomap");
|
2006-03-10 03:50:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(info->mappic->picturename, 32, "levelshots/nomap");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
curtime = Sys_Milliseconds();
|
|
|
|
if (lastclick > curtime || lastclick < curtime-250)
|
|
|
|
{ //shouldn't happen, or too old a click
|
|
|
|
lastclick = curtime;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (oldselection == info->selectedpos)
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = 1;
|
2006-03-10 03:50:08 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-16 23:53:58 +00:00
|
|
|
else if (ctrl && key == 'f')
|
2006-03-10 03:50:08 +00:00
|
|
|
{
|
|
|
|
server = Master_SortedServer(info->selectedpos);
|
|
|
|
if (server)
|
|
|
|
{
|
|
|
|
server->special ^= SS_FAVORITE;
|
2017-12-09 21:22:46 +00:00
|
|
|
sb_favouriteschanged = true;
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
2006-03-10 03:50:08 +00:00
|
|
|
|
2023-01-09 05:12:59 +00:00
|
|
|
else if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_DIAMOND_CONFIRM || (ctrl && (key == 's' || key == 'j')) || key == K_SPACE)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
2006-03-10 03:50:08 +00:00
|
|
|
server = Master_SortedServer(info->selectedpos);
|
2006-02-28 00:46:04 +00:00
|
|
|
if (server)
|
|
|
|
{
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = 1;
|
2015-06-19 16:56:50 +00:00
|
|
|
selectedserver.inuse = true;
|
|
|
|
SListOptionChanged(server);
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2015-06-16 23:53:58 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
MC_EditBox_Key(info->filtertext, key, unicode);
|
|
|
|
return true;
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
return false;
|
|
|
|
}
|
2019-09-04 07:59:40 +00:00
|
|
|
static void SL_PreDraw (emenu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
2012-04-09 19:12:12 +00:00
|
|
|
Master_CheckPollSockets();
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2015-06-18 22:11:30 +00:00
|
|
|
if (isrefreshing)
|
|
|
|
{
|
2015-06-19 16:56:50 +00:00
|
|
|
if (!CL_QueryServers())
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
|
|
|
//extra second, to ensure we got replies
|
2015-06-19 16:56:50 +00:00
|
|
|
if (isrefreshing != 2)
|
|
|
|
{
|
|
|
|
isrefreshing = 2;
|
|
|
|
refreshedtime = Sys_DoubleTime()+1;
|
|
|
|
}
|
2015-06-18 22:11:30 +00:00
|
|
|
}
|
2015-06-19 16:56:50 +00:00
|
|
|
else
|
|
|
|
isrefreshing = 1; //something new came up
|
2015-06-18 22:11:30 +00:00
|
|
|
|
|
|
|
if (isrefreshing == 2)
|
|
|
|
{
|
|
|
|
if (refreshedtime < Sys_DoubleTime())
|
|
|
|
{
|
|
|
|
isrefreshing = false;
|
|
|
|
Master_SortServers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
info->numslots = Master_NumSorted();
|
2016-07-12 00:40:13 +00:00
|
|
|
snprintf(info->refreshtext, sizeof(info->refreshtext), "Refresh - %u/%u/%u\n", info->numslots, Master_NumAlive(), Master_TotalCount());
|
2015-06-18 22:11:30 +00:00
|
|
|
}
|
2018-03-07 20:31:09 +00:00
|
|
|
qboolean NET_SendPollPacket(int len, void *data, netadr_t to);
|
2019-09-04 07:59:40 +00:00
|
|
|
static void SL_PostDraw (emenu_t *menu)
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
2015-06-18 22:11:30 +00:00
|
|
|
static char *helpstrings[] =
|
|
|
|
{
|
|
|
|
"rmb: cancel",
|
|
|
|
"j: join",
|
|
|
|
"o: observe",
|
2015-07-07 02:03:31 +00:00
|
|
|
"b: join with automatic best route",
|
2015-06-18 22:11:30 +00:00
|
|
|
"v: say server info",
|
|
|
|
"ctrl-v: say_team server info",
|
|
|
|
"c: copy server info to clipboard",
|
|
|
|
"ctrl-c: copy server info only to clipboard",
|
|
|
|
"i: view serverinfo",
|
|
|
|
"k: toggle this info"
|
|
|
|
};
|
2021-10-22 22:27:58 +00:00
|
|
|
int skins = 0;
|
|
|
|
#endif
|
2015-06-18 22:11:30 +00:00
|
|
|
|
|
|
|
char buf[64];
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
Master_CheckPollSockets();
|
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
if (serverpreview != SVPV_NO)
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
2020-02-11 18:06:10 +00:00
|
|
|
serverinfo_t *server = selectedserver.inuse?Master_InfoForServer(&selectedserver.adr, selectedserver.brokerid):NULL;
|
2015-06-19 16:56:50 +00:00
|
|
|
int h = 0;
|
|
|
|
int w = 240;
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
2015-06-28 03:43:10 +00:00
|
|
|
if (server && selectedserver.refreshtime < realtime)
|
|
|
|
{
|
|
|
|
selectedserver.refreshtime = realtime + 4;
|
|
|
|
server->sends++;
|
2016-09-08 19:04:35 +00:00
|
|
|
#ifdef NQPROT
|
|
|
|
//we might have gotten stuck. reset the poll
|
|
|
|
if ((server->special&SS_PROTOCOLMASK) == SS_NETQUAKE)
|
|
|
|
{ //start spamming the server to get all of its details. silly protocols.
|
|
|
|
selectedserver.lastplayer = 0;
|
|
|
|
*selectedserver.lastrule = 0;
|
|
|
|
|
|
|
|
SZ_Clear(&net_message);
|
|
|
|
net_message.packing = SZ_RAWBYTES;
|
|
|
|
net_message.currentbit = 0;
|
|
|
|
MSG_WriteLong(&net_message, 0);// save space for the header, filled in later
|
|
|
|
MSG_WriteByte(&net_message, CCREQ_PLAYER_INFO);
|
|
|
|
MSG_WriteByte(&net_message, selectedserver.lastplayer);
|
|
|
|
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
|
|
|
NET_SendPollPacket(net_message.cursize, net_message.data, server->adr);
|
|
|
|
SZ_Clear(&net_message);
|
|
|
|
MSG_WriteLong(&net_message, 0);// save space for the header, filled in later
|
|
|
|
MSG_WriteByte(&net_message, CCREQ_RULE_INFO);
|
|
|
|
MSG_WriteString(&net_message, selectedserver.lastrule);
|
|
|
|
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
|
|
|
NET_SendPollPacket(net_message.cursize, net_message.data, server->adr);
|
|
|
|
SZ_Clear(&net_message);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
Master_QueryServer(server);
|
2015-06-28 03:43:10 +00:00
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-06-18 22:11:30 +00:00
|
|
|
R2D_ImageColours(1,1,1,1);
|
|
|
|
if (server && server->moreinfo)
|
|
|
|
{
|
|
|
|
int lx, x, y, i;
|
2021-10-22 22:27:58 +00:00
|
|
|
if (serverpreview == SVPV_RULES)
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
|
|
|
for (i = 0; ; i++)
|
|
|
|
{
|
|
|
|
char *key = Info_KeyForNumber(server->moreinfo->info, i);
|
|
|
|
if (!strcmp(key, "hostname") || !strcmp(key, "status")) //these are part of the header
|
|
|
|
;
|
|
|
|
else if (*key)
|
|
|
|
h++;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
else if (serverpreview == SVPV_HELP)
|
|
|
|
h = countof(helpstrings);
|
|
|
|
else if (serverpreview == SVPV_ROUTE)
|
|
|
|
{
|
|
|
|
//count the number of proxies the best route will need
|
|
|
|
serverinfo_t *prox;
|
|
|
|
for (h = 1, prox = server; prox; h++, prox = prox->prevpeer)
|
|
|
|
;
|
|
|
|
w += 120;
|
|
|
|
}
|
|
|
|
else if (serverpreview == SVPV_PLAYERS)
|
2016-07-12 00:40:13 +00:00
|
|
|
{
|
2015-06-18 22:11:30 +00:00
|
|
|
h += server->moreinfo->numplayers+2;
|
2016-07-12 00:40:13 +00:00
|
|
|
|
|
|
|
for (i = 0; i < server->moreinfo->numplayers; i++)
|
|
|
|
{
|
|
|
|
if (*server->moreinfo->players[i].skin && strcmp(server->moreinfo->players[i].skin, "base"))
|
|
|
|
{
|
|
|
|
skins = true;
|
|
|
|
w += 8*8+8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-06-18 22:11:30 +00:00
|
|
|
h += 4;
|
|
|
|
h *= 8;
|
|
|
|
|
2020-04-19 01:23:32 +00:00
|
|
|
Draw_ApproxTextBox(vid.width/2.0f - w/2-4, vid.height/2.0f - h/2 - 8, w+8, h+8);
|
2015-06-18 22:11:30 +00:00
|
|
|
|
2015-06-19 16:56:50 +00:00
|
|
|
lx = vid.width/2 - w/2;
|
2015-06-18 22:11:30 +00:00
|
|
|
y = vid.height/2 - h/2 - 4;
|
|
|
|
|
|
|
|
x = lx;
|
2015-06-19 16:56:50 +00:00
|
|
|
Draw_FunStringWidth (x, y, Info_ValueForKey(server->moreinfo->info, "hostname"), w, 2, false);
|
2015-06-18 22:11:30 +00:00
|
|
|
y += 8;
|
2015-06-19 16:56:50 +00:00
|
|
|
Draw_FunStringWidth (x, y, Info_ValueForKey(server->moreinfo->info, "status"), w, 2, false);
|
2015-06-18 22:11:30 +00:00
|
|
|
y += 8;
|
2020-02-11 18:06:10 +00:00
|
|
|
Draw_FunStringWidth (x, y, Master_ServerToString(buf, sizeof(buf), server), w, 2, false);
|
2015-06-18 22:11:30 +00:00
|
|
|
y += 8;
|
|
|
|
|
2015-06-19 16:56:50 +00:00
|
|
|
Draw_FunStringWidth (x, y, "^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f", w, 2, false);
|
2015-06-18 22:11:30 +00:00
|
|
|
y+=8;
|
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
if (serverpreview == SVPV_RULES)
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
|
|
|
for (i = 0; ; i++)
|
|
|
|
{
|
|
|
|
char *key = Info_KeyForNumber(server->moreinfo->info, i);
|
|
|
|
if (!strcmp(key, "hostname") || !strcmp(key, "status"))
|
|
|
|
;
|
|
|
|
else if (*key)
|
|
|
|
{
|
|
|
|
char *value = Info_ValueForKey(server->moreinfo->info, key);
|
|
|
|
x = lx;
|
2015-06-19 16:56:50 +00:00
|
|
|
Draw_FunStringWidth (x, y, key, w/2 - 8, true, true);
|
|
|
|
x+=w/2;
|
|
|
|
Draw_FunStringWidth (x, y, value, w/2, false, false);
|
2015-06-18 22:11:30 +00:00
|
|
|
y += 8;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
else if (serverpreview == SVPV_HELP)
|
|
|
|
{
|
|
|
|
x = lx;
|
|
|
|
for (i = 0; i < countof(helpstrings); i++)
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth (x, y, helpstrings[i], w, false, false);
|
|
|
|
y += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (serverpreview == SVPV_ROUTE)
|
|
|
|
{
|
|
|
|
serverinfo_t *prox;
|
|
|
|
for (prox = server; prox; prox = prox->prevpeer)
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth (x, y, va("%i", prox->cost), 32-8, true, false);
|
|
|
|
Draw_FunStringWidth (x + 32, y, Master_ServerToString(buf, sizeof(buf), prox), w/2 - 8 - 32, true, false);
|
|
|
|
Draw_FunStringWidth (x + w/2, y, prox->name, w/2, false, false);
|
|
|
|
y += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (serverpreview == SVPV_PLAYERS)
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
|
|
|
int teamplay = atoi(Info_ValueForKey(server->moreinfo->info, "teamplay"));
|
|
|
|
x = lx;
|
2015-06-19 16:56:50 +00:00
|
|
|
Draw_FunStringWidth (x, y, "^mFrgs", 28, true, false);
|
2015-06-22 11:49:15 +00:00
|
|
|
x += 32+8;
|
2015-06-19 16:56:50 +00:00
|
|
|
Draw_FunStringWidth (x, y, "^mPng", 28, true, false);
|
2015-06-18 22:11:30 +00:00
|
|
|
x += 3*8+8;
|
|
|
|
|
|
|
|
if (teamplay)
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth (x, y, "^mTeam", 4*8, false, false);
|
|
|
|
x += 4*8+8;
|
|
|
|
Draw_FunStringWidth (x, y, "^mName", 12*8, false, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth (x, y, "^mName", 16*8, false, false);
|
2016-07-12 00:40:13 +00:00
|
|
|
}
|
|
|
|
if (skins)
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth (lx+w-(8*8+8), y, "^mSkin", 8*8, false, false);
|
|
|
|
x = lx+w;
|
2015-06-18 22:11:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
y+=8;
|
|
|
|
for (i = 0; i < server->moreinfo->numplayers; i++)
|
|
|
|
{
|
|
|
|
x = lx;
|
2016-07-12 00:40:13 +00:00
|
|
|
if (server->moreinfo->players[i].isspec&1)
|
2015-06-22 11:49:15 +00:00
|
|
|
Draw_FunStringWidth (x, y, "spec", 32, true, false);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
R2D_ImagePaletteColour (Sbar_ColorForMap(server->moreinfo->players[i].topc), 1.0);
|
|
|
|
R2D_FillBlock (x, y+1, 32, 3);
|
|
|
|
R2D_ImagePaletteColour (Sbar_ColorForMap(server->moreinfo->players[i].botc), 1.0);
|
|
|
|
R2D_FillBlock (x, y+4, 32, 4);
|
2016-02-10 23:23:43 +00:00
|
|
|
R2D_ImageColours (1.0, 1.0, 1.0, 1.0);
|
2015-06-28 03:43:10 +00:00
|
|
|
Draw_FunStringWidth (x, y, va("%3i", server->moreinfo->players[i].frags), 32-4, true, false);
|
2015-06-22 11:49:15 +00:00
|
|
|
}
|
|
|
|
x += 32+8;
|
2016-07-12 00:40:13 +00:00
|
|
|
if (server->moreinfo->players[i].isspec&2)
|
|
|
|
Draw_FunStringWidth (x-8, y, "bot", 3*8+8, true, false);
|
|
|
|
else
|
|
|
|
Draw_FunStringWidth (x-8, y, va("%3i", server->moreinfo->players[i].ping), 3*8+8, true, false);
|
2015-06-18 22:11:30 +00:00
|
|
|
x += 3*8+8;
|
|
|
|
|
|
|
|
if (teamplay)
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth (x, y, server->moreinfo->players[i].team, 4*8, false, false);
|
|
|
|
x += 4*8+8;
|
|
|
|
}
|
|
|
|
|
2016-07-12 00:40:13 +00:00
|
|
|
if (skins)
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth (x, y, server->moreinfo->players[i].name, lx+w-(8*8+8)-x, false, false);
|
|
|
|
x += lx+w-(8*8+8)-x;
|
|
|
|
Draw_FunStringWidth (x, y, server->moreinfo->players[i].skin, 8*8, false, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Draw_FunStringWidth (x, y, server->moreinfo->players[i].name, lx+w-x, false, false);
|
2015-06-19 16:56:50 +00:00
|
|
|
|
2015-06-18 22:11:30 +00:00
|
|
|
y += 8;
|
|
|
|
}
|
|
|
|
|
2015-08-28 03:13:45 +00:00
|
|
|
Draw_FunStringWidth (lx, y, "^h(left/rightarrow for different info)", w, false, false);
|
2015-06-18 22:11:30 +00:00
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-06-18 22:11:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-19 01:23:32 +00:00
|
|
|
Draw_ApproxTextBox(vid.width/2 - 100, vid.height/2 - 16, 200, 16*3);
|
2015-06-18 22:11:30 +00:00
|
|
|
Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 - 8, "Querying server", 200, 2, false);
|
|
|
|
Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 + 0, "Please wait", 200, 2, false);
|
|
|
|
}
|
2015-06-19 16:56:50 +00:00
|
|
|
|
2020-02-11 18:06:10 +00:00
|
|
|
if (server && (server->special & SS_PROTOCOLMASK) == SS_QUAKEWORLD)
|
2015-06-19 16:56:50 +00:00
|
|
|
{
|
|
|
|
int lx = vid.width/2 - w/2;
|
|
|
|
int y = vid.height/2 - h/2 - 4 + h;
|
2016-02-10 23:23:43 +00:00
|
|
|
int bh, bw;
|
2015-06-19 16:56:50 +00:00
|
|
|
qboolean active = false;
|
2016-02-10 23:23:43 +00:00
|
|
|
bw = w+16+12;
|
|
|
|
bh = 24;
|
|
|
|
// lx += bw-12;
|
|
|
|
bw = strlen("Observe")*8 + 24;
|
|
|
|
bw = ((bw+15)/16) * 16; //width must be a multiple of 16
|
|
|
|
// lx -= bw;
|
|
|
|
|
|
|
|
specbutton.x = lx;
|
|
|
|
specbutton.y = y;
|
|
|
|
specbutton.width = bw + 16;
|
|
|
|
specbutton.height = bh + 16;
|
|
|
|
R2D_ImageColours(1,1,1,1);
|
|
|
|
y += 8;
|
2020-04-19 01:23:32 +00:00
|
|
|
Draw_ApproxTextBox(lx, y, bw, bh);
|
2016-02-10 23:23:43 +00:00
|
|
|
|
|
|
|
if (mousecursor_x >= specbutton.x && mousecursor_x < specbutton.x+specbutton.width)
|
|
|
|
if (mousecursor_y >= specbutton.y && mousecursor_y < specbutton.y+specbutton.height)
|
|
|
|
active = true;
|
|
|
|
|
|
|
|
Draw_FunStringWidth(lx, y + (bh-8)/2, "Observe", bw, 2, active);y+=8;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
int lx = vid.width/2 - w/2;
|
|
|
|
int y = vid.height/2 - h/2 - 4 + h;
|
|
|
|
int bw, bh;
|
|
|
|
qboolean active = false;
|
|
|
|
bw = w+16;
|
|
|
|
bh = 24;
|
2015-06-19 16:56:50 +00:00
|
|
|
lx += w-12;
|
2016-02-10 23:23:43 +00:00
|
|
|
bw = strlen("Join")*8 + 24;
|
|
|
|
bw = ((bw+15)/16) * 16; //width must be a multiple of 16
|
|
|
|
lx -= bw;
|
2015-06-19 16:56:50 +00:00
|
|
|
|
|
|
|
joinbutton.x = lx;
|
|
|
|
joinbutton.y = y;
|
2016-02-10 23:23:43 +00:00
|
|
|
joinbutton.width = bw + 16;
|
|
|
|
joinbutton.height = bh + 16;
|
2015-06-19 16:56:50 +00:00
|
|
|
R2D_ImageColours(1,1,1,1);
|
|
|
|
y += 8;
|
|
|
|
lx += 8;
|
2020-04-19 01:23:32 +00:00
|
|
|
Draw_ApproxTextBox(lx, y, bw, bh);
|
2015-06-19 16:56:50 +00:00
|
|
|
|
|
|
|
if (mousecursor_x >= joinbutton.x && mousecursor_x < joinbutton.x+joinbutton.width)
|
|
|
|
if (mousecursor_y >= joinbutton.y && mousecursor_y < joinbutton.y+joinbutton.height)
|
|
|
|
active = true;
|
|
|
|
|
2016-02-10 23:23:43 +00:00
|
|
|
Draw_FunStringWidth(lx, y + (bh-8)/2, "Join", bw, 2, active);y+=8;
|
2015-06-19 16:56:50 +00:00
|
|
|
}
|
2015-06-18 22:11:30 +00:00
|
|
|
}
|
|
|
|
else if (isrefreshing)
|
|
|
|
{
|
|
|
|
R2D_ImageColours(1,1,1,1);
|
2020-04-19 01:23:32 +00:00
|
|
|
Draw_ApproxTextBox(vid.width/2 - 100-4, vid.height/2 - 24, 200, 64);
|
2015-06-18 22:11:30 +00:00
|
|
|
Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 - 8, "Refreshing, please wait", 200, 2, false);
|
|
|
|
Draw_FunStringWidth(vid.width/2 - 100, vid.height/2 + 0, va("%i of %i", Master_NumPolled(), Master_TotalCount()), 200, 2, false);
|
|
|
|
}
|
|
|
|
else if (!info->numslots)
|
|
|
|
{
|
|
|
|
R2D_ImageColours(1,1,1,1);
|
|
|
|
if (!Master_TotalCount())
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth(0, vid.height/2 - 8, "No servers found", vid.width, 2, false);
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
2015-06-18 22:11:30 +00:00
|
|
|
Draw_FunStringWidth(0, vid.height/2 + 0, "Check internet connection", vid.width, 2, false);
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-06-18 22:11:30 +00:00
|
|
|
}
|
2016-07-12 00:40:13 +00:00
|
|
|
else if (!Master_NumAlive())
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth(0, vid.height/2 - 8, "No servers responding", vid.width, 2, false);
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
2016-07-12 00:40:13 +00:00
|
|
|
Draw_FunStringWidth(0, vid.height/2 + 0, "Check udp internet connection", vid.width, 2, false);
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2016-07-12 00:40:13 +00:00
|
|
|
}
|
2015-06-18 22:11:30 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Draw_FunStringWidth(0, vid.height/2 - 8, "All servers were filtered out", vid.width, 2, false);
|
|
|
|
Draw_FunStringWidth(0, vid.height/2 + 0, "Change filter settings", vid.width, 2, false);
|
|
|
|
}
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
2023-03-27 17:19:00 +00:00
|
|
|
static qboolean SL_Key (emenu_t *menu, int key, unsigned int unicode)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
if (serverpreview != SVPV_NO)
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
|
|
|
char buf[64];
|
2020-02-11 18:06:10 +00:00
|
|
|
serverinfo_t *server = selectedserver.inuse?Master_InfoForServer(&selectedserver.adr, selectedserver.brokerid):NULL;
|
2015-06-18 22:11:30 +00:00
|
|
|
qboolean ctrldown = keydown[K_LCTRL] || keydown[K_RCTRL];
|
|
|
|
|
2023-01-09 05:12:59 +00:00
|
|
|
if (key == K_ESCAPE || key == K_GP_DIAMOND_CANCEL || key == K_MOUSE2 || key == K_MOUSE4)
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = SVPV_NO;
|
2015-06-18 22:11:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
2023-01-09 05:12:59 +00:00
|
|
|
else if (key == K_MOUSE1 || key == K_TOUCH)
|
2015-06-19 16:56:50 +00:00
|
|
|
{
|
|
|
|
if (mousecursor_x >= joinbutton.x && mousecursor_x < joinbutton.x+joinbutton.width)
|
|
|
|
if (mousecursor_y >= joinbutton.y && mousecursor_y < joinbutton.y+joinbutton.height)
|
|
|
|
{
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = SVPV_NO;
|
2016-02-10 23:23:43 +00:00
|
|
|
goto dojoin;
|
|
|
|
}
|
|
|
|
if (mousecursor_x >= specbutton.x && mousecursor_x < specbutton.x+joinbutton.width)
|
|
|
|
if (mousecursor_y >= specbutton.y && mousecursor_y < specbutton.y+joinbutton.height)
|
|
|
|
{
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = SVPV_NO;
|
2016-02-10 23:23:43 +00:00
|
|
|
goto dospec;
|
2015-06-19 16:56:50 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
2015-06-18 22:11:30 +00:00
|
|
|
else if (key == 'i')
|
|
|
|
{
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = ((serverpreview==SVPV_RULES)?1:SVPV_RULES);
|
2015-06-18 22:11:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (key == 'k')
|
|
|
|
{
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = ((serverpreview==SVPV_HELP)?1:SVPV_HELP);
|
2015-06-18 22:11:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2017-08-16 02:14:07 +00:00
|
|
|
else if (key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_GP_DPAD_LEFT)
|
2015-06-28 03:43:10 +00:00
|
|
|
{
|
|
|
|
if (--serverpreview < 1)
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = SVPV_LAST;
|
2015-07-07 02:03:31 +00:00
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
if (serverpreview == SVPV_ROUTE && server)
|
2015-07-07 02:03:31 +00:00
|
|
|
Master_FindRoute(server->adr);
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-06-28 03:43:10 +00:00
|
|
|
return true;
|
|
|
|
}
|
2017-08-16 02:14:07 +00:00
|
|
|
else if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_GP_DPAD_RIGHT)
|
2015-06-28 03:43:10 +00:00
|
|
|
{
|
2021-10-22 22:27:58 +00:00
|
|
|
if (++serverpreview > SVPV_LAST)
|
2015-06-28 03:43:10 +00:00
|
|
|
serverpreview = 1;
|
2015-07-07 02:03:31 +00:00
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
if (serverpreview == SVPV_ROUTE && server)
|
2015-07-07 02:03:31 +00:00
|
|
|
Master_FindRoute(server->adr);
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-06-28 03:43:10 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
else if (key == 'b' && serverpreview != SVPV_ROUTE)
|
2015-07-07 02:03:31 +00:00
|
|
|
{
|
2020-02-11 18:06:10 +00:00
|
|
|
if (server)
|
|
|
|
Master_FindRoute(server->adr);
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = SVPV_ROUTE;
|
2022-01-28 10:48:01 +00:00
|
|
|
return true;
|
2015-07-07 02:03:31 +00:00
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2023-01-09 05:12:59 +00:00
|
|
|
else if (key == 'b' || key == 'o' || key == 'j' || key == K_ENTER || key == K_KP_ENTER || key == K_GP_DIAMOND_CONFIRM || key == K_GP_DIAMOND_ALTCONFIRM) //join
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
2023-01-09 05:12:59 +00:00
|
|
|
if (key == 's' || key == 'o' || key == K_GP_DIAMOND_ALTCONFIRM)
|
2016-02-10 23:23:43 +00:00
|
|
|
{
|
|
|
|
dospec:
|
2015-06-18 22:11:30 +00:00
|
|
|
Cbuf_AddText("spectator 1\n", RESTRICT_LOCAL);
|
2016-02-10 23:23:43 +00:00
|
|
|
}
|
2023-01-09 05:12:59 +00:00
|
|
|
else if (key == 'j' || key == K_GP_DIAMOND_CONFIRM)
|
2015-06-19 16:56:50 +00:00
|
|
|
{
|
2016-02-10 23:23:43 +00:00
|
|
|
dojoin:
|
2015-06-18 22:11:30 +00:00
|
|
|
Cbuf_AddText("spectator 0\n", RESTRICT_LOCAL);
|
2015-06-19 16:56:50 +00:00
|
|
|
}
|
2015-06-18 22:11:30 +00:00
|
|
|
|
2015-07-07 02:03:31 +00:00
|
|
|
//which connect command are we using?
|
2022-07-28 02:17:27 +00:00
|
|
|
#ifdef NQPROT
|
|
|
|
if ((server->special & SS_PROTOCOLMASK) == SS_QEPROT)
|
|
|
|
Cbuf_AddText("connectqe ", RESTRICT_LOCAL);
|
2015-06-18 22:11:30 +00:00
|
|
|
else
|
2022-07-28 02:17:27 +00:00
|
|
|
#endif
|
2015-07-07 02:03:31 +00:00
|
|
|
Cbuf_AddText("connect ", RESTRICT_LOCAL);
|
|
|
|
|
|
|
|
//output the server's address
|
2020-02-11 18:06:10 +00:00
|
|
|
Cbuf_AddText(va("%s", Master_ServerToString(buf, sizeof(buf), server)), RESTRICT_LOCAL);
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
if (serverpreview == SVPV_ROUTE || key == 'b')
|
2015-07-07 02:03:31 +00:00
|
|
|
{ //and postfix it with routing info if we're going for a proxied route.
|
2021-10-22 22:27:58 +00:00
|
|
|
if (serverpreview != SVPV_ROUTE)
|
2015-07-07 02:03:31 +00:00
|
|
|
Master_FindRoute(server->adr);
|
|
|
|
for (server = server->prevpeer; server; server = server->prevpeer)
|
2020-02-11 18:06:10 +00:00
|
|
|
Cbuf_AddText(va("@%s", Master_ServerToString(buf, sizeof(buf), server)), RESTRICT_LOCAL);
|
2015-07-07 02:03:31 +00:00
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-07-07 02:03:31 +00:00
|
|
|
Cbuf_AddText("\n", RESTRICT_LOCAL);
|
|
|
|
|
2015-06-19 16:56:50 +00:00
|
|
|
|
2015-07-14 14:47:00 +00:00
|
|
|
M_RemoveAllMenus(true);
|
2015-06-18 22:11:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (server && key == 'c' && ctrldown) //copy to clip
|
|
|
|
{
|
2020-02-11 18:06:10 +00:00
|
|
|
Sys_SaveClipboard(CBT_CLIPBOARD, Master_ServerToString(buf, sizeof(buf), server));
|
2015-06-18 22:11:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (server && (key == 'v' || key == 'c')) //say to current server
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
char safename[128];
|
|
|
|
Q_strncpyz(safename, server->name, sizeof(safename));
|
|
|
|
//ALWAYS sanitize your inputs.
|
2016-02-15 06:01:17 +00:00
|
|
|
while((s = strchr(safename, ';')))
|
2015-06-18 22:11:30 +00:00
|
|
|
*s = ' ';
|
2016-02-15 06:01:17 +00:00
|
|
|
while((s = strchr(safename, '\n')))
|
2015-06-18 22:11:30 +00:00
|
|
|
*s = ' ';
|
|
|
|
if (key == 'c')
|
2020-02-11 18:06:10 +00:00
|
|
|
Sys_SaveClipboard(CBT_CLIPBOARD, va("%s - %s\n", server->name, Master_ServerToString(buf, sizeof(buf), server)));
|
2015-06-18 22:11:30 +00:00
|
|
|
else if (ctrldown)
|
2020-02-11 18:06:10 +00:00
|
|
|
Cbuf_AddText(va("say_team %s - %s\n", server->name, Master_ServerToString(buf, sizeof(buf), server)), RESTRICT_LOCAL);
|
2015-06-18 22:11:30 +00:00
|
|
|
else
|
2020-02-11 18:06:10 +00:00
|
|
|
Cbuf_AddText(va("say %s - %s\n", server->name, Master_ServerToString(buf, sizeof(buf), server)), RESTRICT_LOCAL);
|
2015-06-18 22:11:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
//eat (nearly) all keys
|
2017-08-16 02:14:07 +00:00
|
|
|
else if (!(key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP || key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN))
|
2015-06-18 22:11:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
if (key == K_HOME)
|
|
|
|
{
|
|
|
|
info->scrollpos = 0;
|
|
|
|
info->selectedpos = 0;
|
|
|
|
}
|
2015-06-28 03:43:10 +00:00
|
|
|
else if (key == K_END)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
info->selectedpos = info->numslots-1;
|
2015-06-18 22:11:30 +00:00
|
|
|
info->scrollpos = info->selectedpos - (vid.height-16-7)/8+8;
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
2015-06-28 03:43:10 +00:00
|
|
|
else if (key == K_PGDN)
|
2006-02-28 00:46:04 +00:00
|
|
|
info->selectedpos += 10;
|
|
|
|
else if (key == K_PGUP)
|
|
|
|
info->selectedpos -= 10;
|
2017-08-16 02:14:07 +00:00
|
|
|
else if (key == K_DOWNARROW || key == K_KP_DOWNARROW || key == K_GP_DPAD_DOWN)
|
2006-02-28 00:46:04 +00:00
|
|
|
info->selectedpos += 1;
|
2017-08-16 02:14:07 +00:00
|
|
|
else if (key == K_UPARROW || key == K_KP_UPARROW || key == K_GP_DPAD_UP)
|
2006-02-28 00:46:04 +00:00
|
|
|
info->selectedpos -= 1;
|
|
|
|
else if (key == K_MWHEELUP)
|
|
|
|
info->selectedpos -= 3;
|
|
|
|
else if (key == K_MWHEELDOWN)
|
|
|
|
info->selectedpos += 3;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
|
|
|
|
{
|
|
|
|
serverinfo_t *server;
|
|
|
|
server = Master_SortedServer(info->selectedpos);
|
2006-09-17 00:59:22 +00:00
|
|
|
|
|
|
|
// selectedserver.inuse = true;
|
|
|
|
// SListOptionChanged(server);
|
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
if (server)
|
|
|
|
{
|
2006-03-06 01:41:09 +00:00
|
|
|
snprintf(info->mappic->picturename, 32, "levelshots/%s", server->map);
|
2014-12-23 15:26:42 +00:00
|
|
|
if (!*server->map || !R2D_SafeCachePic(info->mappic->picturename))
|
2006-09-17 00:59:22 +00:00
|
|
|
snprintf(info->mappic->picturename, 32, "levelshots/nomap");
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-06 01:41:09 +00:00
|
|
|
snprintf(info->mappic->picturename, 32, "levelshots/nomap");
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
2015-06-18 22:11:30 +00:00
|
|
|
|
2015-06-28 03:43:10 +00:00
|
|
|
if (/*serverpreview &&*/ server)
|
2015-06-18 22:11:30 +00:00
|
|
|
{
|
|
|
|
selectedserver.inuse = true;
|
|
|
|
SListOptionChanged(server);
|
2015-07-07 02:03:31 +00:00
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
|
|
|
if (serverpreview == SVPV_ROUTE)
|
2015-07-07 02:03:31 +00:00
|
|
|
Master_FindRoute(server->adr);
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2015-06-18 22:11:30 +00:00
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (info->selectedpos < 0)
|
|
|
|
info->selectedpos = 0;
|
|
|
|
if (info->selectedpos > info->numslots-1)
|
|
|
|
info->selectedpos = info->numslots-1;
|
|
|
|
if (info->scrollpos < info->selectedpos - info->visibleslots)
|
|
|
|
info->scrollpos = info->selectedpos - info->visibleslots;
|
|
|
|
if (info->selectedpos < info->scrollpos)
|
|
|
|
info->scrollpos = info->selectedpos;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void SL_ServerPlayer (int x, int y, menucustom_t *ths, emenu_t *menu)
|
2006-09-17 00:59:22 +00:00
|
|
|
{
|
|
|
|
if (selectedserver.inuse)
|
|
|
|
{
|
|
|
|
if (selectedserver.detail)
|
2013-03-12 22:47:42 +00:00
|
|
|
if (ths->dint < selectedserver.detail->numplayers)
|
2006-09-17 00:59:22 +00:00
|
|
|
{
|
2013-03-12 22:47:42 +00:00
|
|
|
int i = ths->dint;
|
2016-07-12 00:40:13 +00:00
|
|
|
if (selectedserver.detail->players[i].isspec&1)
|
2015-06-28 03:43:10 +00:00
|
|
|
Draw_FunStringWidth (x, y, "spectator", 32, false, false);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
R2D_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].topc), 1.0);
|
|
|
|
R2D_FillBlock (x, y, 32, 4);
|
|
|
|
R2D_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].botc), 1.0);
|
|
|
|
R2D_FillBlock (x, y+4, 32, 4);
|
2016-02-10 23:23:43 +00:00
|
|
|
R2D_ImageColours (1.0, 1.0, 1.0, 1.0);
|
2015-06-28 03:43:10 +00:00
|
|
|
Draw_FunStringWidth (x, y, va("%3i", selectedserver.detail->players[i].frags), 32-4, true, false);
|
|
|
|
}
|
2006-09-17 00:59:22 +00:00
|
|
|
|
2015-06-28 03:43:10 +00:00
|
|
|
Draw_FunStringWidth (x+36, y, selectedserver.detail->players[i].name, 128-36, false, false);
|
2006-09-17 00:59:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void SL_SliderDraw (int x, int y, menucustom_t *ths, emenu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
2006-03-23 18:52:53 +00:00
|
|
|
mpic_t *pic;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2015-08-11 09:14:33 +00:00
|
|
|
R2D_ImageColours(1,1,1,1);
|
|
|
|
|
2015-04-27 06:19:33 +00:00
|
|
|
pic = R2D_SafeCachePic("scrollbars/slidebg.tga");
|
2015-06-16 23:53:58 +00:00
|
|
|
if (pic && R_GetShaderSizes(pic, NULL, NULL, false)>0)
|
2006-03-23 18:52:53 +00:00
|
|
|
{
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ScalePic(x + ths->common.width - 8, y+8, 8, ths->common.height-16, pic);
|
2006-03-23 18:52:53 +00:00
|
|
|
|
2015-04-27 06:19:33 +00:00
|
|
|
pic = R2D_SafeCachePic("scrollbars/arrow_up.tga");
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ScalePic(x + ths->common.width - 8, y, 8, 8, pic);
|
2006-03-23 18:52:53 +00:00
|
|
|
|
2015-04-27 06:19:33 +00:00
|
|
|
pic = R2D_SafeCachePic("scrollbars/arrow_down.tga");
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ScalePic(x + ths->common.width - 8, y + ths->common.height - 8, 8, 8, pic);
|
2006-03-23 18:52:53 +00:00
|
|
|
|
|
|
|
y += ((info->scrollpos) / ((float)info->numslots - info->visibleslots)) * (float)(ths->common.height-(64+16-1));
|
|
|
|
|
|
|
|
y += 8;
|
|
|
|
|
2015-04-27 06:19:33 +00:00
|
|
|
pic = R2D_SafeCachePic("scrollbars/slider.tga");
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ScalePic(x + ths->common.width - 8, y, 8, 64, pic);
|
2006-03-23 18:52:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-05-10 09:31:21 +00:00
|
|
|
R2D_ImageColours(SRGBA(0.1, 0.1, 0.2, 1.0));
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_FillBlock(x, y, ths->common.width, ths->common.height);
|
2006-03-23 18:52:53 +00:00
|
|
|
|
|
|
|
y += ((info->scrollpos) / ((float)info->numslots - info->visibleslots)) * (ths->common.height-8);
|
|
|
|
|
2019-05-10 09:31:21 +00:00
|
|
|
R2D_ImageColours(SRGBA(0.35, 0.35, 0.55, 1.0));
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_FillBlock(x, y, 8, 8);
|
2015-12-12 19:25:15 +00:00
|
|
|
R2D_ImageColours(1,1,1,1);
|
2006-03-23 18:52:53 +00:00
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2023-01-09 05:12:59 +00:00
|
|
|
if (keydown[K_MOUSE1] || keydown[K_TOUCH])
|
2015-06-18 22:11:30 +00:00
|
|
|
if (mousecursor_x >= ths->common.posx && mousecursor_x < ths->common.posx + ths->common.width)
|
|
|
|
if (mousecursor_y >= ths->common.posy && mousecursor_y < ths->common.posy + ths->common.height)
|
|
|
|
info->sliderpressed = true;
|
2006-02-28 00:46:04 +00:00
|
|
|
if (info->sliderpressed)
|
|
|
|
{
|
2023-01-09 05:12:59 +00:00
|
|
|
if (keydown[K_MOUSE1] || keydown[K_TOUCH])
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
float my;
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
|
|
|
my = mousecursor_y;
|
|
|
|
my -= ths->common.posy;
|
2015-06-18 22:11:30 +00:00
|
|
|
if (R_GetShaderSizes(R2D_SafeCachePic("scrollbars/slidebg.tga"), NULL, NULL, false)>0)
|
2006-03-23 18:52:53 +00:00
|
|
|
{
|
|
|
|
my -= 32+8;
|
|
|
|
my /= ths->common.height - (64+16);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
my /= ths->common.height;
|
2006-02-28 00:46:04 +00:00
|
|
|
my *= (info->numslots-info->visibleslots);
|
|
|
|
|
|
|
|
if (my > info->numslots-info->visibleslots-1)
|
|
|
|
my = info->numslots-info->visibleslots-1;
|
|
|
|
if (my < 0)
|
|
|
|
my = 0;
|
|
|
|
|
|
|
|
info->scrollpos = my;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
info->sliderpressed = false;
|
|
|
|
}
|
|
|
|
}
|
2019-09-04 07:59:40 +00:00
|
|
|
static qboolean SL_SliderKey (menucustom_t *ths, emenu_t *menu, int key, unsigned int unicode)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
2023-01-09 05:12:59 +00:00
|
|
|
if (key == K_MOUSE1 || key == K_TOUCH)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
float my;
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
|
|
|
my = mousecursor_y;
|
|
|
|
my -= ths->common.posy;
|
2015-06-18 22:11:30 +00:00
|
|
|
if (R_GetShaderSizes(R2D_SafeCachePic("scrollbars/slidebg.tga"), NULL, NULL, false)>0)
|
2006-03-23 18:52:53 +00:00
|
|
|
{
|
|
|
|
my -= 32+8;
|
|
|
|
my /= ths->common.height - (64+16);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
my /= ths->common.height;
|
2006-02-28 00:46:04 +00:00
|
|
|
my *= (info->numslots-info->visibleslots);
|
|
|
|
|
|
|
|
if (my > info->numslots-info->visibleslots-1)
|
|
|
|
my = info->numslots-info->visibleslots-1;
|
|
|
|
if (my < 0)
|
|
|
|
my = 0;
|
|
|
|
|
|
|
|
info->scrollpos = my;
|
|
|
|
info->sliderpressed = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void CalcFilters(emenu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
2022-03-08 05:31:34 +00:00
|
|
|
info->filtermodcount = sb_filtertext.modifiedcount;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
Master_ClearMasks();
|
|
|
|
|
2014-12-23 15:26:42 +00:00
|
|
|
// Master_SetMaskInteger(false, SLKEY_PING, 0, SLIST_TEST_GREATEREQUAL);
|
|
|
|
Master_SetMaskInteger(false, SLKEY_BASEGAME, SS_UNKNOWN, SLIST_TEST_NOTEQUAL);
|
2020-03-08 07:02:37 +00:00
|
|
|
if (info->filter[SLFILTER_HIDENETQUAKE] && info->filter[SLFILTER_HIDEQUAKEWORLD])
|
|
|
|
Master_SetMaskInteger(false, SLKEY_FLAGS, SS_PROXY, SLIST_TEST_CONTAINS); //show only proxies
|
2014-12-23 15:26:42 +00:00
|
|
|
else
|
|
|
|
{
|
2020-03-08 07:02:37 +00:00
|
|
|
if (info->filter[SLFILTER_HIDENETQUAKE]) Master_SetMaskInteger(false, SLKEY_BASEGAME, SS_NETQUAKE, SLIST_TEST_NOTEQUAL);
|
|
|
|
if (info->filter[SLFILTER_HIDEQUAKEWORLD]) Master_SetMaskInteger(false, SLKEY_BASEGAME, SS_QUAKEWORLD, SLIST_TEST_NOTEQUAL);
|
2014-12-23 15:26:42 +00:00
|
|
|
}
|
2020-03-08 07:02:37 +00:00
|
|
|
if (info->filter[SLFILTER_HIDEPROXIES]) Master_SetMaskInteger(false, SLKEY_FLAGS, SS_PROXY, SLIST_TEST_NOTCONTAIN);
|
|
|
|
if (!info->filter[SLFILTER_ONLYFAVOURITES]) Master_SetMaskInteger(false, SLKEY_FLAGS, SS_FAVORITE, SLIST_TEST_CONTAINS);
|
|
|
|
if (info->filter[SLFILTER_HIDEEMPTY]) Master_SetMaskInteger(false, SLKEY_NUMHUMANS, 0, SLIST_TEST_NOTEQUAL);
|
|
|
|
if (info->filter[SLFILTER_HIDEFULL]) Master_SetMaskInteger(false, SLKEY_FREEPLAYERS, 0, SLIST_TEST_NOTEQUAL);
|
2015-06-16 23:53:58 +00:00
|
|
|
|
|
|
|
if (*sb_filtertext.string) Master_SetMaskString(false, SLKEY_NAME, sb_filtertext.string, SLIST_TEST_CONTAINS);
|
2015-06-19 16:56:50 +00:00
|
|
|
|
|
|
|
Master_SortServers();
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static qboolean SL_ReFilter (menucheck_t *option, emenu_t *menu, chk_set_t set)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
switch(set)
|
|
|
|
{
|
|
|
|
case CHK_CHECKED:
|
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
|
|
|
return !info->filter[option->bits];
|
2006-02-28 00:46:04 +00:00
|
|
|
case CHK_TOGGLE:
|
2020-03-08 07:02:37 +00:00
|
|
|
info->filter[option->bits] ^= 1;
|
|
|
|
Cvar_Set(&sb_hidenetquake, info->filter[SLFILTER_HIDENETQUAKE]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hidequakeworld, info->filter[SLFILTER_HIDEQUAKEWORLD]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hideproxies, info->filter[SLFILTER_HIDEPROXIES]?"1":"0");
|
2006-03-14 01:18:47 +00:00
|
|
|
|
2020-03-08 07:02:37 +00:00
|
|
|
Cvar_Set(&sb_hideempty, info->filter[SLFILTER_HIDEEMPTY]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hidefull, info->filter[SLFILTER_HIDEFULL]?"1":"0");
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
CalcFilters(menu);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void SL_Remove (emenu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
2020-03-08 07:02:37 +00:00
|
|
|
Cvar_Set(&sb_hidenetquake, info->filter[SLFILTER_HIDENETQUAKE]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hidequakeworld, info->filter[SLFILTER_HIDEQUAKEWORLD]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hideproxies, info->filter[SLFILTER_HIDEPROXIES]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hideempty, info->filter[SLFILTER_HIDEEMPTY]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hidefull, info->filter[SLFILTER_HIDEFULL]?"1":"0");
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static qboolean SL_DoRefresh (menuoption_t *opt, emenu_t *menu, int key)
|
2006-03-10 03:50:08 +00:00
|
|
|
{
|
2023-01-09 05:12:59 +00:00
|
|
|
if (key == K_MOUSE1 || key == K_TOUCH || key == K_ENTER || key == K_KP_ENTER || key == K_GP_DIAMOND_CONFIRM)
|
2018-05-06 16:09:07 +00:00
|
|
|
{
|
|
|
|
MasterInfo_Refresh(false);
|
|
|
|
isrefreshing = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2006-03-10 03:50:08 +00:00
|
|
|
}
|
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
void M_Menu_ServerList2_f(void)
|
|
|
|
{
|
2006-09-17 00:59:22 +00:00
|
|
|
int i, y, x;
|
2019-09-04 07:59:40 +00:00
|
|
|
emenu_t *menu;
|
2006-02-28 00:46:04 +00:00
|
|
|
menucustom_t *cust;
|
|
|
|
serverlist_t *info;
|
2015-06-16 23:53:58 +00:00
|
|
|
qboolean descending;
|
|
|
|
int sortkey;
|
|
|
|
char *sc;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2010-12-05 02:46:07 +00:00
|
|
|
if (!qrenderer)
|
|
|
|
{
|
|
|
|
Cbuf_AddText("wait; menu_servers\n", Cmd_ExecLevel);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
serverpreview = SVPV_NO; //in case it was lingering.
|
2015-06-19 16:56:50 +00:00
|
|
|
|
2015-06-22 11:49:15 +00:00
|
|
|
Key_Dest_Remove(kdm_console);
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
menu = M_CreateMenu(sizeof(serverlist_t));
|
2015-06-18 22:11:30 +00:00
|
|
|
menu->predraw = SL_PreDraw;
|
|
|
|
menu->postdraw = SL_PostDraw;
|
2006-02-28 00:46:04 +00:00
|
|
|
menu->key = SL_Key;
|
|
|
|
menu->remove = SL_Remove;
|
|
|
|
|
|
|
|
info = (serverlist_t*)(menu + 1);
|
|
|
|
|
2016-02-10 23:23:43 +00:00
|
|
|
y = 16;
|
2019-01-15 14:12:49 +00:00
|
|
|
cust = MC_AddCustom(menu, 0, y, NULL, 0, NULL);
|
2006-02-28 00:46:04 +00:00
|
|
|
cust->draw = SL_TitlesDraw;
|
|
|
|
cust->key = SL_TitlesKey;
|
|
|
|
cust->common.height = 8;
|
|
|
|
cust->common.width = vid.width-8;
|
2016-02-10 23:23:43 +00:00
|
|
|
y+=8;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2016-02-10 23:23:43 +00:00
|
|
|
info->servers_top = y;
|
|
|
|
info->visibleslots = (vid.height-info->servers_top - 64);
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2019-01-15 14:12:49 +00:00
|
|
|
cust = MC_AddCustom(menu, vid.width-8, 16, NULL, 0, NULL);
|
2006-02-28 00:46:04 +00:00
|
|
|
cust->draw = SL_SliderDraw;
|
|
|
|
cust->key = SL_SliderKey;
|
|
|
|
cust->common.height = info->visibleslots;
|
|
|
|
cust->common.width = 8;
|
|
|
|
|
2015-06-18 22:11:30 +00:00
|
|
|
info->visibleslots = (info->visibleslots-8)/8;
|
2016-02-10 23:23:43 +00:00
|
|
|
for (i = 0, y = info->servers_top; i <= info->visibleslots; y +=8, i++)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
2019-01-15 14:12:49 +00:00
|
|
|
cust = MC_AddCustom(menu, 0, y, NULL, i, NULL);
|
2015-06-16 23:53:58 +00:00
|
|
|
if (i==0)
|
|
|
|
menu->selecteditem = (menuoption_t*)&cust->common;
|
2006-02-28 00:46:04 +00:00
|
|
|
cust->draw = SL_ServerDraw;
|
|
|
|
cust->key = SL_ServerKey;
|
|
|
|
cust->common.height = 8;
|
|
|
|
cust->common.width = vid.width-8;
|
2006-03-06 01:41:09 +00:00
|
|
|
cust->common.noselectionsound = true;
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
menu->dontexpand = true;
|
|
|
|
|
2006-09-17 00:59:22 +00:00
|
|
|
i = 0;
|
|
|
|
for (x = 256; x < vid.width-64; x += 128)
|
|
|
|
{
|
|
|
|
for (y = vid.height-64+8; y < vid.height; y += 8, i++)
|
|
|
|
{
|
2019-01-15 14:12:49 +00:00
|
|
|
cust = MC_AddCustom(menu, x+16, y, NULL, i, NULL);
|
2006-09-17 00:59:22 +00:00
|
|
|
cust->draw = SL_ServerPlayer;
|
|
|
|
cust->key = NULL;
|
|
|
|
cust->common.height = 8;
|
|
|
|
cust->common.width = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-16 02:03:57 +00:00
|
|
|
strcpy(info->refreshtext, "Refresh");
|
|
|
|
|
2013-10-29 17:38:22 +00:00
|
|
|
MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*1, "Ping ", &sb_showping, 1);
|
|
|
|
MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*2, "Address ", &sb_showaddress, 1);
|
|
|
|
MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*3, "Map ", &sb_showmap, 1);
|
|
|
|
MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*4, "Gamedir ", &sb_showgamedir, 1);
|
|
|
|
MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*5, "Players ", &sb_showplayers, 1);
|
|
|
|
MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*6, "Fraglimit", &sb_showfraglimit, 1);
|
|
|
|
MC_AddCheckBox(menu, 0, 72, vid.height - 64+8*7, "Timelimit", &sb_showtimelimit, 1);
|
2006-02-28 00:46:04 +00:00
|
|
|
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
#ifdef NQPROT
|
2014-12-23 15:26:42 +00:00
|
|
|
if (M_GameType() == MGT_QUAKE1)
|
|
|
|
{
|
2020-03-08 07:02:37 +00:00
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*1, "Show NQ ", SL_ReFilter, SLFILTER_HIDENETQUAKE);
|
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*2, "Show QW ", SL_ReFilter, SLFILTER_HIDEQUAKEWORLD);
|
2014-12-23 15:26:42 +00:00
|
|
|
}
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
#endif
|
2020-03-08 07:02:37 +00:00
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*3, "Show Proxies", SL_ReFilter, SLFILTER_HIDEPROXIES);
|
2015-06-16 23:53:58 +00:00
|
|
|
info->filtertext =
|
2015-06-18 22:11:30 +00:00
|
|
|
MC_AddEditCvar (menu, 128, 200, vid.height - 64+8*4, "Filter ", sb_filtertext.name, true);
|
2020-03-08 07:02:37 +00:00
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*5, "Only Favs ", SL_ReFilter, SLFILTER_ONLYFAVOURITES);
|
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*6, "Show Empty", SL_ReFilter, SLFILTER_HIDEEMPTY);
|
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*7, "Show Full ", SL_ReFilter, SLFILTER_HIDEFULL);
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2014-12-23 15:26:42 +00:00
|
|
|
MC_AddCommand(menu, 64, 320, 0, info->refreshtext, SL_DoRefresh);
|
2006-03-10 03:50:08 +00:00
|
|
|
|
2020-03-08 07:02:37 +00:00
|
|
|
info->filter[SLFILTER_HIDENETQUAKE] = !!sb_hidenetquake.value;
|
|
|
|
info->filter[SLFILTER_HIDEQUAKEWORLD] = !!sb_hidequakeworld.value;
|
|
|
|
info->filter[SLFILTER_HIDEPROXIES] = !!sb_hideproxies.value;
|
|
|
|
info->filter[SLFILTER_ONLYFAVOURITES] = true;//!sb_showonlyfavourites.value;
|
|
|
|
info->filter[SLFILTER_HIDEEMPTY] = !!sb_hideempty.value;
|
|
|
|
info->filter[SLFILTER_HIDEFULL] = !!sb_hidefull.value;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
info->mappic = (menupicture_t *)MC_AddPicture(menu, vid.width - 64, vid.height - 64, 64, 64, "012345678901234567890123456789012");
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2015-06-16 23:53:58 +00:00
|
|
|
descending = false;
|
|
|
|
|
|
|
|
sc = sb_sortcolumn.string;
|
|
|
|
if (*sc == '-')
|
|
|
|
descending = true;
|
|
|
|
else if (*sc == '+')
|
|
|
|
descending = false;
|
|
|
|
else
|
|
|
|
sc--;
|
|
|
|
sc++;
|
|
|
|
switch(*sc)
|
|
|
|
{
|
|
|
|
case 't': sortkey = SLKEY_TIMELIMIT; break;
|
|
|
|
case 'f': sortkey = SLKEY_FRAGLIMIT; break;
|
2015-06-19 16:56:50 +00:00
|
|
|
case 'p': sortkey = SLKEY_NUMHUMANS; break;
|
2015-06-16 23:53:58 +00:00
|
|
|
case 'm': sortkey = SLKEY_MAP; break;
|
|
|
|
case 'g': sortkey = SLKEY_GAMEDIR; break;
|
|
|
|
case 'l': sortkey = SLKEY_PING; break;
|
|
|
|
case 'a': sortkey = SLKEY_ADDRESS; break;
|
|
|
|
case 'n': sortkey = SLKEY_NAME; break;
|
|
|
|
default: sortkey = SLKEY_PING; break;
|
|
|
|
}
|
|
|
|
Master_SetSortField(sortkey, descending);
|
2011-06-16 02:03:57 +00:00
|
|
|
|
2015-06-19 16:56:50 +00:00
|
|
|
if (!Master_TotalCount())
|
|
|
|
{
|
2018-05-06 16:09:07 +00:00
|
|
|
MasterInfo_Refresh(true);
|
2015-06-19 16:56:50 +00:00
|
|
|
isrefreshing = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
CalcFilters(menu);
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
|
2021-10-22 22:27:58 +00:00
|
|
|
#ifdef HAVE_PACKET
|
2011-12-23 03:12:29 +00:00
|
|
|
static float quickconnecttimeout;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void M_QuickConnect_PreDraw(emenu_t *menu)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
serverinfo_t *best = NULL;
|
|
|
|
serverinfo_t *s;
|
2008-06-08 14:37:57 +00:00
|
|
|
char adr[MAX_ADR_SIZE];
|
2017-10-13 17:50:28 +00:00
|
|
|
int ping;
|
2008-06-08 14:37:57 +00:00
|
|
|
|
2012-04-09 19:12:12 +00:00
|
|
|
Master_CheckPollSockets(); //see if we were told something important.
|
2006-12-25 18:29:05 +00:00
|
|
|
CL_QueryServers();
|
|
|
|
|
|
|
|
if (Sys_DoubleTime() > quickconnecttimeout)
|
|
|
|
{
|
2017-10-13 17:50:28 +00:00
|
|
|
quickconnecttimeout = Sys_DoubleTime() + 15;
|
|
|
|
|
|
|
|
for (ping = 50; ping < 200 && !best; ping += 50)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
2017-10-13 17:50:28 +00:00
|
|
|
for (s = firstserver; s; s = s->next)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
2017-10-13 17:50:28 +00:00
|
|
|
if (!s->maxplayers) //no response?
|
|
|
|
continue;
|
|
|
|
if (s->players == s->maxplayers)
|
|
|
|
continue; //server is full already
|
|
|
|
if (s->special & SS_PROXY)
|
|
|
|
continue; //don't quickconnect to a proxy. their player counts are often wrong (especially with qtv)
|
|
|
|
if (s->ping < ping) //don't like servers with too high a ping
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
2017-10-13 17:50:28 +00:00
|
|
|
if (s->numhumans > 0)
|
|
|
|
{
|
|
|
|
if (best)
|
|
|
|
if (best->numhumans > s->numhumans)
|
|
|
|
continue; //go for the one with most players
|
|
|
|
best = s;
|
|
|
|
}
|
2006-12-25 18:29:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (best)
|
|
|
|
{
|
2017-10-13 17:50:28 +00:00
|
|
|
Con_Printf("Quick connect found %s (gamedir %s, players %i/%i/%i, ping %ims)\n", best->name, best->gamedir, best->numhumans, best->players, best->maxplayers, best->ping);
|
2006-12-25 18:29:05 +00:00
|
|
|
|
2022-07-28 02:17:27 +00:00
|
|
|
#ifdef NQPROT
|
|
|
|
if ((best->special & SS_PROTOCOLMASK) == SS_QEPROT)
|
|
|
|
Cbuf_AddText(va("connectqe %s\n", Master_ServerToString(adr, sizeof(adr), best)), RESTRICT_LOCAL);
|
2006-12-25 18:29:05 +00:00
|
|
|
else
|
2022-07-28 02:17:27 +00:00
|
|
|
#endif
|
2020-02-11 18:06:10 +00:00
|
|
|
Cbuf_AddText(va("join %s\n", Master_ServerToString(adr, sizeof(adr), best)), RESTRICT_LOCAL);
|
2006-12-25 18:29:05 +00:00
|
|
|
|
|
|
|
M_ToggleMenu_f();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//retry
|
2018-05-06 16:09:07 +00:00
|
|
|
MasterInfo_Refresh(false);
|
2015-06-18 22:11:30 +00:00
|
|
|
isrefreshing = true;
|
2006-12-25 18:29:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-27 17:19:00 +00:00
|
|
|
static qboolean M_QuickConnect_Key (emenu_t *menu, int key, unsigned int unicode)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void M_QuickConnect_Remove (emenu_t *menu)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static qboolean M_QuickConnect_Cancel (menuoption_t *opt, emenu_t *menu, int key)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void M_QuickConnect_DrawStatus (int x, int y, menucustom_t *ths, emenu_t *menu)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
2009-11-04 21:16:50 +00:00
|
|
|
Draw_FunString(x, y, va("Polling, %i secs\n", (int)(quickconnecttimeout - Sys_DoubleTime() + 0.9)));
|
2006-12-25 18:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void M_QuickConnect_f(void)
|
|
|
|
{
|
|
|
|
menucustom_t *cust;
|
2019-09-04 07:59:40 +00:00
|
|
|
emenu_t *menu;
|
2006-12-25 18:29:05 +00:00
|
|
|
|
2018-05-06 16:09:07 +00:00
|
|
|
MasterInfo_Refresh(false);
|
2015-06-18 22:11:30 +00:00
|
|
|
isrefreshing = true;
|
2006-12-25 18:29:05 +00:00
|
|
|
|
|
|
|
quickconnecttimeout = Sys_DoubleTime() + 5;
|
|
|
|
|
|
|
|
menu = M_CreateMenu(sizeof(serverlist_t));
|
2015-06-18 22:11:30 +00:00
|
|
|
menu->predraw = M_QuickConnect_PreDraw;
|
2006-12-25 18:29:05 +00:00
|
|
|
menu->key = M_QuickConnect_Key;
|
|
|
|
menu->remove = M_QuickConnect_Remove;
|
|
|
|
|
2019-01-15 14:12:49 +00:00
|
|
|
cust = MC_AddCustom(menu, 64, 64, NULL, 0, NULL);
|
2006-12-25 18:29:05 +00:00
|
|
|
cust->draw = M_QuickConnect_DrawStatus;
|
|
|
|
cust->common.height = 8;
|
|
|
|
cust->common.width = vid.width-8;
|
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
MC_AddCommand(menu, 64, 0, 128, "Refresh", SL_DoRefresh);
|
|
|
|
MC_AddCommand(menu, 64, 0, 136, "Cancel", M_QuickConnect_Cancel);
|
2006-12-25 18:29:05 +00:00
|
|
|
}
|
2021-10-22 22:27:58 +00:00
|
|
|
#endif
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|