2005-02-28 07:16:19 +00:00
|
|
|
#include "quakedef.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
#ifdef CL_MASTER
|
|
|
|
#include "cl_master.h"
|
|
|
|
|
|
|
|
//filtering
|
2011-12-23 03:12:29 +00:00
|
|
|
static cvar_t sb_hideempty = SCVARF("sb_hideempty", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_hidenotempty = SCVARF("sb_hidenotempty", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_hidefull = SCVARF("sb_hidefull", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_hidedead = SCVARF("sb_hidedead", "1", CVAR_ARCHIVE);
|
2006-02-11 02:09:43 +00:00
|
|
|
cvar_t sb_hidequake2 = SCVARF("sb_hidequake2", "1", CVAR_ARCHIVE);
|
|
|
|
cvar_t sb_hidequake3 = SCVARF("sb_hidequake3", "1", CVAR_ARCHIVE);
|
|
|
|
cvar_t sb_hidenetquake = SCVARF("sb_hidenetquake", "1", CVAR_ARCHIVE);
|
|
|
|
cvar_t sb_hidequakeworld = SCVARF("sb_hidequakeworld","0", CVAR_ARCHIVE);
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static cvar_t sb_showping = SCVARF("sb_showping", "1", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showaddress = SCVARF("sb_showaddress", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showmap = SCVARF("sb_showmap", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showgamedir = SCVARF("sb_showgamedir", "0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showplayers = SCVARF("sb_showplayers", "1", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showfraglimit = SCVARF("sb_showfraglimit","0", CVAR_ARCHIVE);
|
|
|
|
static cvar_t sb_showtimelimit = SCVARF("sb_showtimelimit","0", CVAR_ARCHIVE);
|
2006-02-11 02:09:43 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-09-28 23:37:15 +00:00
|
|
|
extern cvar_t slist_writeserverstxt;
|
|
|
|
extern cvar_t slist_cacheinfo;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Serverlist_Init(void)
|
|
|
|
{
|
|
|
|
char *grp = "Server Browser Vars";
|
|
|
|
|
|
|
|
Cvar_Register(&sb_hideempty, grp);
|
|
|
|
Cvar_Register(&sb_hidenotempty, grp);
|
|
|
|
Cvar_Register(&sb_hidefull, grp);
|
|
|
|
Cvar_Register(&sb_hidedead, grp);
|
|
|
|
Cvar_Register(&sb_hidequake2, grp);
|
2005-08-26 22:56:51 +00:00
|
|
|
Cvar_Register(&sb_hidequake3, grp);
|
2004-08-23 00:15:46 +00:00
|
|
|
Cvar_Register(&sb_hidenetquake, grp);
|
|
|
|
Cvar_Register(&sb_hidequakeworld, grp);
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
typedef struct {
|
|
|
|
int visibleslots;
|
|
|
|
int scrollpos;
|
|
|
|
int selectedpos;
|
|
|
|
|
|
|
|
int numslots;
|
|
|
|
qboolean stillpolling;
|
|
|
|
qbyte filter[8];
|
|
|
|
|
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);
|
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
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void SL_TitlesDraw (int x, int y, menucustom_t *ths, menu_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;
|
2006-03-23 06:45:17 +00:00
|
|
|
if (mx > x || mousecursor_y < y || mousecursor_y >= y+8)
|
|
|
|
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);}
|
|
|
|
if (sb_showplayers.value) {SL_DrawColumnTitle(&x, y, 5*8, mx, "plyrs", (sf==SLKEY_NUMPLAYERS), clr, &filldraw);}
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static qboolean SL_TitlesKey (menucustom_t *ths, menu_t *menu, int key)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int mx = mousecursor_x/8;
|
|
|
|
int sortkey;
|
|
|
|
|
|
|
|
if (key != K_MOUSE1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
do {
|
|
|
|
x = ths->common.width/8;
|
|
|
|
if (mx > x) return false; //out of bounds
|
2006-03-14 01:18:47 +00:00
|
|
|
if (sb_showtimelimit.value) {x-=4;if (mx > x) {sortkey = SLKEY_TIMELIMIT; break;}}
|
|
|
|
if (sb_showfraglimit.value) {x-=4;if (mx > x) {sortkey = SLKEY_FRAGLIMIT; break;}}
|
2006-02-28 00:46:04 +00:00
|
|
|
if (sb_showplayers.value) {x-=6;if (mx > x) {sortkey = SLKEY_NUMPLAYERS; break;}}
|
|
|
|
if (sb_showmap.value) {x-=9;if (mx > x) {sortkey = SLKEY_MAP; break;}}
|
|
|
|
if (sb_showgamedir.value) {x-=9;if (mx > x) {sortkey = SLKEY_GAMEDIR; break;}}
|
|
|
|
if (sb_showping.value) {x-=4;if (mx > x) {sortkey = SLKEY_PING; break;}}
|
|
|
|
if (sb_showaddress.value) {x-=22;if (mx > x) {sortkey = SLKEY_ADDRESS; break;}}
|
|
|
|
sortkey = SLKEY_NAME;break;
|
|
|
|
} while (0);
|
|
|
|
|
2006-03-14 01:18:47 +00:00
|
|
|
if (sortkey == SLKEY_ADDRESS)
|
|
|
|
return true;
|
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
Master_SetSortField(sortkey, Master_GetSortField()!=sortkey||!Master_GetSortDescending());
|
|
|
|
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
|
2006-03-12 23:05:25 +00:00
|
|
|
if ((flags & SS_NETQUAKE) || (flags & SS_DARKPLACES))
|
|
|
|
return ST_NETQUAKE;
|
|
|
|
if (flags & SS_QUAKE2)
|
|
|
|
return ST_QUAKE2;
|
|
|
|
if (flags & SS_QUAKE3)
|
|
|
|
return ST_QUAKE3;
|
|
|
|
|
|
|
|
return ST_NORMALQW;
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void SL_ServerDraw (int x, int y, menucustom_t *ths, menu_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];
|
|
|
|
|
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
|
|
|
{
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ImageColours(
|
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],
|
|
|
|
1.0);
|
2006-03-12 23:05:25 +00:00
|
|
|
}
|
2013-10-29 17:38:22 +00:00
|
|
|
else if (thisone == info->scrollpos + (int)(mousecursor_y-16)/8 && mousecursor_x < x)
|
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);
|
2013-05-03 04:28:08 +00:00
|
|
|
else if (selectedserver.inuse && NET_CompareAdr(&si->adr, &selectedserver.adr))
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ImageColours(((sin(realtime*4.4)*0.25)+0.5) * 0.5, ((sin(realtime*4.4)*0.25)+0.5)*0.5, 0.08*0.5, 1.0);
|
2006-02-28 00:46:04 +00:00
|
|
|
else
|
2011-05-29 04:26:29 +00:00
|
|
|
{
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ImageColours(
|
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],
|
|
|
|
1.0);
|
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
|
|
|
|
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;}
|
|
|
|
if (sb_showplayers.value) {Draw_FunStringWidth((x-5*8), y, va("%2i/%2i", si->players, si->maxplayers), 5*8, false, false); x-=6*8;}
|
|
|
|
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;}
|
|
|
|
if (sb_showping.value) {Draw_FunStringWidth((x-3*8), y, va("%i", si->ping), 3*8, false, false); x-=4*8;}
|
|
|
|
if (sb_showaddress.value) {Draw_FunStringWidth((x-21*8), y, NET_AdrToString(adr, sizeof(adr), &si->adr), 21*8, false, false); x-=22*8;}
|
|
|
|
Draw_FunStringWidth(0, y, si->name, x, false, false);
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-23 03:12:29 +00:00
|
|
|
static qboolean SL_ServerKey (menucustom_t *ths, menu_t *menu, int key)
|
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;
|
2008-06-08 14:37:57 +00:00
|
|
|
char adr[MAX_ADR_SIZE];
|
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
if (key == K_MOUSE1)
|
|
|
|
{
|
2006-03-10 03:50:08 +00:00
|
|
|
oldselection = info->selectedpos;
|
2006-02-28 00:46:04 +00:00
|
|
|
info->selectedpos = info->scrollpos + (mousecursor_y-16)/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);
|
2011-03-31 01:14:01 +00:00
|
|
|
if (!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)
|
|
|
|
goto joinserver;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key == 'f')
|
|
|
|
{
|
|
|
|
server = Master_SortedServer(info->selectedpos);
|
|
|
|
if (server)
|
|
|
|
{
|
|
|
|
server->special ^= SS_FAVORITE;
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
2006-03-10 03:50:08 +00:00
|
|
|
|
2013-05-03 04:28:08 +00:00
|
|
|
if (key == K_ENTER || key == K_KP_ENTER || key == K_KP_ENTER || 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)
|
|
|
|
{
|
2006-03-10 03:50:08 +00:00
|
|
|
if (key == 's' || key == K_SPACE)
|
2006-02-28 00:46:04 +00:00
|
|
|
Cbuf_AddText("spectator 1\n", RESTRICT_LOCAL);
|
|
|
|
else if (key == 'j')
|
2006-03-10 03:50:08 +00:00
|
|
|
{
|
|
|
|
joinserver:
|
2006-02-28 00:46:04 +00:00
|
|
|
Cbuf_AddText("spectator 0\n", RESTRICT_LOCAL);
|
2006-03-10 03:50:08 +00:00
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
if (server->special & SS_NETQUAKE)
|
2013-05-03 04:28:08 +00:00
|
|
|
Cbuf_AddText(va("nqconnect %s\n", NET_AdrToString(adr, sizeof(adr), &server->adr)), RESTRICT_LOCAL);
|
2006-02-28 00:46:04 +00:00
|
|
|
else
|
2013-05-03 04:28:08 +00:00
|
|
|
Cbuf_AddText(va("connect %s\n", NET_AdrToString(adr, sizeof(adr), &server->adr)), RESTRICT_LOCAL);
|
2006-03-10 03:50:08 +00:00
|
|
|
|
|
|
|
M_RemoveAllMenus();
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2011-12-23 03:12:29 +00:00
|
|
|
static void SL_PreDraw (menu_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
|
|
|
|
|
|
|
CL_QueryServers();
|
|
|
|
|
2011-06-16 02:03:57 +00:00
|
|
|
snprintf(info->refreshtext, sizeof(info->refreshtext), "Refresh - %u of %u\n", Master_NumPolled(), Master_TotalCount());
|
2006-02-28 00:46:04 +00:00
|
|
|
info->numslots = Master_NumSorted();
|
|
|
|
}
|
2011-12-23 03:12:29 +00:00
|
|
|
static qboolean SL_Key (int key, menu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
|
|
|
if (key == K_HOME)
|
|
|
|
{
|
|
|
|
info->scrollpos = 0;
|
|
|
|
info->selectedpos = 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (key == K_END)
|
|
|
|
{
|
|
|
|
info->selectedpos = info->numslots-1;
|
|
|
|
info->scrollpos = info->selectedpos - (vid.height-16-7)/8;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (key == K_PGDN)
|
|
|
|
info->selectedpos += 10;
|
|
|
|
else if (key == K_PGUP)
|
|
|
|
info->selectedpos -= 10;
|
|
|
|
else if (key == K_DOWNARROW)
|
|
|
|
info->selectedpos += 1;
|
|
|
|
else if (key == K_UPARROW)
|
|
|
|
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);
|
2011-03-31 01:14:01 +00:00
|
|
|
if (!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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void SL_ServerPlayer (int x, int y, menucustom_t *ths, menu_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;
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].topc), 1.0);
|
|
|
|
R2D_FillBlock (x, y, 28, 4);
|
|
|
|
R2D_ImagePaletteColour (Sbar_ColorForMap(selectedserver.detail->players[i].botc), 1.0);
|
|
|
|
R2D_FillBlock (x, y+4, 28, 4);
|
2013-10-29 17:38:22 +00:00
|
|
|
Draw_FunStringWidth (x, y, va("%3i", selectedserver.detail->players[i].frags), 28, false, false);
|
2006-09-17 00:59:22 +00:00
|
|
|
|
2013-10-29 17:38:22 +00:00
|
|
|
Draw_FunStringWidth (x+28, y, selectedserver.detail->players[i].name, 12*8, false, false);
|
2006-09-17 00:59:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void SL_SliderDraw (int x, int y, menucustom_t *ths, menu_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
|
|
|
|
2011-03-31 01:14:01 +00:00
|
|
|
pic = R2D_SafeCachePic("scrollbars/slidebg.png");
|
2006-03-23 18:52:53 +00:00
|
|
|
if (pic)
|
|
|
|
{
|
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
|
|
|
|
2011-03-31 01:14:01 +00:00
|
|
|
pic = R2D_SafeCachePic("scrollbars/arrow_up.png");
|
|
|
|
R2D_ScalePic(x + ths->common.width - 8, y, 8, 8, pic);
|
2006-03-23 18:52:53 +00:00
|
|
|
|
2011-03-31 01:14:01 +00:00
|
|
|
pic = R2D_SafeCachePic("scrollbars/arrow_down.png");
|
|
|
|
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;
|
|
|
|
|
2011-03-31 01:14:01 +00:00
|
|
|
pic = R2D_SafeCachePic("scrollbars/slider.png");
|
|
|
|
R2D_ScalePic(x + ths->common.width - 8, y, 8, 64, pic);
|
2006-03-23 18:52:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ImageColours(0.1, 0.1, 0.2, 1.0);
|
|
|
|
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);
|
|
|
|
|
2011-03-31 01:14:01 +00:00
|
|
|
R2D_ImageColours(0.35, 0.35, 0.55, 1.0);
|
|
|
|
R2D_FillBlock(x, y, 8, 8);
|
2006-03-23 18:52:53 +00:00
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
if (info->sliderpressed)
|
|
|
|
{
|
|
|
|
extern qboolean keydown[K_MAX];
|
|
|
|
if (keydown[K_MOUSE1])
|
|
|
|
{
|
|
|
|
float my;
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
|
|
|
my = mousecursor_y;
|
|
|
|
my -= ths->common.posy;
|
2011-03-31 01:14:01 +00:00
|
|
|
if (R2D_SafeCachePic("scrollbars/slidebg.png"))
|
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;
|
|
|
|
}
|
|
|
|
}
|
2011-12-23 03:12:29 +00:00
|
|
|
static qboolean SL_SliderKey (menucustom_t *ths, menu_t *menu, int key)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
if (key == K_MOUSE1)
|
|
|
|
{
|
|
|
|
float my;
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
|
|
|
my = mousecursor_y;
|
|
|
|
my -= ths->common.posy;
|
2011-03-31 01:14:01 +00:00
|
|
|
if (R2D_SafeCachePic("scrollbars/slidebg.png"))
|
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;
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void CalcFilters(menu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
|
|
|
Master_ClearMasks();
|
|
|
|
|
|
|
|
Master_SetMaskInteger(false, SLKEY_PING, 0, SLIST_TEST_LESS);
|
|
|
|
if (info->filter[1]) Master_SetMaskInteger(true, SLKEY_BASEGAME, SS_NETQUAKE|SS_DARKPLACES, SLIST_TEST_CONTAINS);
|
|
|
|
if (info->filter[2]) Master_SetMaskInteger(true, SLKEY_BASEGAME, SS_NETQUAKE|SS_DARKPLACES|SS_QUAKE2|SS_QUAKE3, SLIST_TEST_NOTCONTAIN);
|
|
|
|
if (info->filter[3]) Master_SetMaskInteger(true, SLKEY_BASEGAME, SS_QUAKE2, SLIST_TEST_CONTAINS);
|
|
|
|
if (info->filter[4]) Master_SetMaskInteger(true, SLKEY_BASEGAME, SS_QUAKE3, SLIST_TEST_CONTAINS);
|
2006-03-10 03:50:08 +00:00
|
|
|
if (info->filter[5]) Master_SetMaskInteger(false, SLKEY_BASEGAME, SS_FAVORITE, SLIST_TEST_CONTAINS);
|
2006-02-28 00:46:04 +00:00
|
|
|
if (info->filter[6]) Master_SetMaskInteger(false, SLKEY_NUMPLAYERS, 0, SLIST_TEST_NOTEQUAL);
|
|
|
|
if (info->filter[7]) Master_SetMaskInteger(false, SLKEY_FREEPLAYERS, 0, SLIST_TEST_NOTEQUAL);
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static qboolean SL_ReFilter (menucheck_t *option, menu_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:
|
|
|
|
return info->filter[option->bits];
|
|
|
|
case CHK_TOGGLE:
|
|
|
|
if (option->bits>0)
|
2006-03-14 01:18:47 +00:00
|
|
|
{
|
2006-02-28 00:46:04 +00:00
|
|
|
info->filter[option->bits] ^= 1;
|
2006-03-14 01:18:47 +00:00
|
|
|
Cvar_Set(&sb_hidenetquake, info->filter[1]?"0":"1");
|
|
|
|
Cvar_Set(&sb_hidequakeworld, info->filter[2]?"0":"1");
|
|
|
|
Cvar_Set(&sb_hidequake2, info->filter[3]?"0":"1");
|
|
|
|
Cvar_Set(&sb_hidequake3, info->filter[4]?"0":"1");
|
|
|
|
|
|
|
|
Cvar_Set(&sb_hideempty, info->filter[6]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hidefull, info->filter[7]?"1":"0");
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
CalcFilters(menu);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void SL_Remove (menu_t *menu)
|
2006-02-28 00:46:04 +00:00
|
|
|
{
|
|
|
|
serverlist_t *info = (serverlist_t*)(menu + 1);
|
|
|
|
|
|
|
|
Cvar_Set(&sb_hidenetquake, info->filter[1]?"0":"1");
|
|
|
|
Cvar_Set(&sb_hidequakeworld, info->filter[2]?"0":"1");
|
|
|
|
Cvar_Set(&sb_hidequake2, info->filter[3]?"0":"1");
|
|
|
|
Cvar_Set(&sb_hidequake3, info->filter[4]?"0":"1");
|
|
|
|
|
|
|
|
Cvar_Set(&sb_hideempty, info->filter[6]?"1":"0");
|
|
|
|
Cvar_Set(&sb_hidefull, info->filter[7]?"1":"0");
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static qboolean SL_DoRefresh (menuoption_t *opt, menu_t *menu, int key)
|
2006-03-10 03:50:08 +00:00
|
|
|
{
|
2011-06-16 02:03:57 +00:00
|
|
|
MasterInfo_Refresh();
|
2006-03-10 03:50:08 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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;
|
2006-02-28 00:46:04 +00:00
|
|
|
menu_t *menu;
|
|
|
|
menucustom_t *cust;
|
|
|
|
serverlist_t *info;
|
|
|
|
|
2010-12-05 02:46:07 +00:00
|
|
|
if (!qrenderer)
|
|
|
|
{
|
|
|
|
Cbuf_AddText("wait; menu_servers\n", Cmd_ExecLevel);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-10-08 14:28:11 +00:00
|
|
|
Key_Dest_Add(kdm_menu);
|
2006-02-28 00:46:04 +00:00
|
|
|
m_state = m_complex;
|
|
|
|
|
|
|
|
menu = M_CreateMenu(sizeof(serverlist_t));
|
|
|
|
menu->event = SL_PreDraw;
|
|
|
|
menu->key = SL_Key;
|
|
|
|
menu->remove = SL_Remove;
|
|
|
|
|
|
|
|
info = (serverlist_t*)(menu + 1);
|
|
|
|
|
|
|
|
y = 8;
|
2013-03-12 22:47:42 +00:00
|
|
|
cust = MC_AddCustom(menu, 0, y, NULL, 0);
|
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;
|
|
|
|
|
|
|
|
info->visibleslots = (vid.height-16 - 64);
|
|
|
|
|
2013-03-12 22:47:42 +00:00
|
|
|
cust = MC_AddCustom(menu, vid.width-8, 16, NULL, 0);
|
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;
|
|
|
|
|
|
|
|
info->visibleslots = (info->visibleslots-7)/8;
|
|
|
|
for (i = 0, y = 16; i <= info->visibleslots; y +=8, i++)
|
|
|
|
{
|
2013-03-12 22:47:42 +00:00
|
|
|
cust = MC_AddCustom(menu, 0, y, NULL, i);
|
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++)
|
|
|
|
{
|
2013-03-12 22:47:42 +00:00
|
|
|
cust = MC_AddCustom(menu, x+16, y, NULL, i);
|
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
|
2013-10-29 17:38:22 +00:00
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*1, "List NQ ", SL_ReFilter, 1);
|
------------------------------------------------------------------------
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
|
2013-10-29 17:38:22 +00:00
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*2, "List QW ", SL_ReFilter, 2);
|
------------------------------------------------------------------------
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 Q2CLIENT
|
2013-10-29 17:38:22 +00:00
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*3, "List Q2 ", SL_ReFilter, 3);
|
------------------------------------------------------------------------
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
|
|
|
|
#ifdef Q3CLIENT
|
2013-10-29 17:38:22 +00:00
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*4, "List Q3 ", SL_ReFilter, 4);
|
------------------------------------------------------------------------
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
|
2013-10-29 17:38:22 +00:00
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*5, "Only Favs ", SL_ReFilter, 5);
|
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*6, "Hide Empty", SL_ReFilter, 6);
|
|
|
|
MC_AddCheckBoxFunc(menu, 128, 208, vid.height - 64+8*7, "Hide Full ", SL_ReFilter, 7);
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2011-06-16 02:03:57 +00:00
|
|
|
MC_AddCommand(menu, 64, 0, info->refreshtext, SL_DoRefresh);
|
2006-03-10 03:50:08 +00:00
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
info->filter[1] = !sb_hidenetquake.value;
|
|
|
|
info->filter[2] = !sb_hidequakeworld.value;
|
|
|
|
info->filter[3] = !sb_hidequake2.value;
|
|
|
|
info->filter[4] = !sb_hidequake3.value;
|
|
|
|
info->filter[6] = !!sb_hideempty.value;
|
|
|
|
info->filter[7] = !!sb_hidefull.value;
|
|
|
|
|
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
|
|
|
|
|
|
|
CalcFilters(menu);
|
|
|
|
|
|
|
|
Master_SetSortField(SLKEY_PING, true);
|
2011-06-16 02:03:57 +00:00
|
|
|
|
|
|
|
MasterInfo_Refresh();
|
2006-02-28 00:46:04 +00:00
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static float quickconnecttimeout;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void M_QuickConnect_PreDraw(menu_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];
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
for (s = firstserver; s; s = s->next)
|
|
|
|
{
|
|
|
|
if (!s->maxplayers) //no response?
|
|
|
|
continue;
|
|
|
|
if (s->players == s->maxplayers)
|
|
|
|
continue; //server is full already
|
|
|
|
if (s->special & SS_PROXY)
|
2007-10-05 17:43:26 +00:00
|
|
|
continue; //don't quickconnect to a proxy. their player counts are often wrong (especially with qtv)
|
2006-12-25 18:29:05 +00:00
|
|
|
if (s->ping < 50) //don't like servers with too high a ping
|
|
|
|
{
|
|
|
|
if (s->players > 0)
|
|
|
|
{
|
|
|
|
if (best)
|
|
|
|
if (best->players > s->players)
|
|
|
|
continue; //go for the one with most players
|
|
|
|
best = s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (best)
|
|
|
|
{
|
|
|
|
Con_Printf("Quick connect found %s (gamedir %s, players %i/%i, ping %ims)\n", best->name, best->gamedir, best->players, best->maxplayers, best->ping);
|
|
|
|
|
|
|
|
if (best->special & SS_NETQUAKE)
|
2013-05-03 04:28:08 +00:00
|
|
|
Cbuf_AddText(va("nqconnect %s\n", NET_AdrToString(adr, sizeof(adr), &best->adr)), RESTRICT_LOCAL);
|
2006-12-25 18:29:05 +00:00
|
|
|
else
|
2013-05-03 04:28:08 +00:00
|
|
|
Cbuf_AddText(va("join %s\n", NET_AdrToString(adr, sizeof(adr), &best->adr)), RESTRICT_LOCAL);
|
2006-12-25 18:29:05 +00:00
|
|
|
|
|
|
|
M_ToggleMenu_f();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//retry
|
2011-06-16 02:03:57 +00:00
|
|
|
MasterInfo_Refresh();
|
2006-12-25 18:29:05 +00:00
|
|
|
|
|
|
|
quickconnecttimeout = Sys_DoubleTime() + 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static qboolean M_QuickConnect_Key (int key, menu_t *menu)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void M_QuickConnect_Remove (menu_t *menu)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static qboolean M_QuickConnect_Cancel (menuoption_t *opt, menu_t *menu, int key)
|
2006-12-25 18:29:05 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2011-12-23 03:12:29 +00:00
|
|
|
static void M_QuickConnect_DrawStatus (int x, int y, menucustom_t *ths, menu_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;
|
|
|
|
menu_t *menu;
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2013-10-08 14:28:11 +00:00
|
|
|
Key_Dest_Add(kdm_menu);
|
2006-12-25 18:29:05 +00:00
|
|
|
m_state = m_complex;
|
|
|
|
|
2011-06-16 02:03:57 +00:00
|
|
|
MasterInfo_Refresh();
|
2006-12-25 18:29:05 +00:00
|
|
|
|
|
|
|
quickconnecttimeout = Sys_DoubleTime() + 5;
|
|
|
|
|
|
|
|
menu = M_CreateMenu(sizeof(serverlist_t));
|
|
|
|
menu->event = M_QuickConnect_PreDraw;
|
|
|
|
menu->key = M_QuickConnect_Key;
|
|
|
|
menu->remove = M_QuickConnect_Remove;
|
|
|
|
|
2013-03-12 22:47:42 +00:00
|
|
|
cust = MC_AddCustom(menu, 64, 64, NULL, 0);
|
2006-12-25 18:29:05 +00:00
|
|
|
cust->draw = M_QuickConnect_DrawStatus;
|
|
|
|
cust->common.height = 8;
|
|
|
|
cust->common.width = vid.width-8;
|
|
|
|
|
|
|
|
MC_AddCommand(menu, 64, 128, "Refresh", SL_DoRefresh);
|
|
|
|
MC_AddCommand(menu, 64, 136, "Cancel", M_QuickConnect_Cancel);
|
|
|
|
}
|
2006-02-28 00:46:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|