added gl_texturemode2d

fixed an nq network message corruption bug with large reliables.
CSQC is supported on the server with the DP7 protocol
sv_listen_qw can be switched off leaving sv_listen_dp enabled in order to force DP to connect with a specific protocol. This needs to be improved, but works well enough for what it was added for.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2514 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2007-06-10 05:14:38 +00:00
parent 8c987f6bf9
commit 36f35cff78
11 changed files with 171 additions and 38 deletions

View File

@ -15,7 +15,7 @@ typedef struct {
int entityNum; // entity the contacted surface is a part of
} q3trace_t;
#define Q3_NOENCRYPT //a debugging property, makes it incompatable with q3
//#define Q3_NOENCRYPT //a debugging property, makes it incompatable with q3
#define MAX_Q3_STATS 16
#define MAX_Q3_PERSISTANT 16

View File

@ -30,6 +30,7 @@ void SCR_Viewsize_Callback (struct cvar_s *var, char *oldvalue);
void SCR_Fov_Callback (struct cvar_s *var, char *oldvalue);
#if defined(RGLQUAKE)
void GL_Texturemode_Callback (struct cvar_s *var, char *oldvalue);
void GL_Texturemode2d_Callback (struct cvar_s *var, char *oldvalue);
void GL_Texture_Anisotropic_Filtering_Callback (struct cvar_s *var, char *oldvalue);
#endif
@ -105,6 +106,7 @@ static cvar_t vid_desktopsettings = SCVARF("vid_desktopsettings", "0", CVAR_ARCH
#if defined(RGLQUAKE)
cvar_t gl_texturemode = SCVARFC("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE|CVAR_RENDERERCALLBACK, GL_Texturemode_Callback);
cvar_t gl_texturemode2d = SCVARFC("gl_texturemode2d", "GL_LINEAR", CVAR_ARCHIVE|CVAR_RENDERERCALLBACK, GL_Texturemode2d_Callback);
cvar_t gl_texture_anisotropic_filtering = SCVARFC("gl_texture_anisotropic_filtering", "0", CVAR_ARCHIVE|CVAR_RENDERERCALLBACK, GL_Texture_Anisotropic_Filtering_Callback);
cvar_t gl_conback = SCVARF("gl_conback", "", CVAR_RENDERERCALLBACK);
cvar_t gl_font = SCVARF("gl_font", "", CVAR_RENDERERCALLBACK);
@ -354,6 +356,7 @@ void GLRenderer_Init(void)
Cvar_Register (&r_drawdisk, GLRENDEREROPTIONS);
Cvar_Register (&gl_texturemode, GLRENDEREROPTIONS);
Cvar_Register (&gl_texturemode2d, GLRENDEREROPTIONS);
Cvar_Register (&gl_texture_anisotropic_filtering, GLRENDEREROPTIONS);
Cvar_Register (&gl_savecompressedtex, GLRENDEREROPTIONS);
Cvar_Register (&gl_compress, GLRENDEREROPTIONS);

View File

@ -444,7 +444,28 @@ STAT_H2_MAXHEALTH,
STAT_H2_MAXMANA,
STAT_H2_FLAGS,
MAX_CL_STATS = 128
MAX_CL_STATS = 256
#define STAT_MOVEVARS_WALLFRICTION 237 // DP
#define STAT_MOVEVARS_FRICTION 238 // DP
#define STAT_MOVEVARS_WATERFRICTION 239 // DP
#define STAT_MOVEVARS_TICRATE 240 // DP
#define STAT_MOVEVARS_TIMESCALE 241 // DP
#define STAT_MOVEVARS_GRAVITY 242 // DP
#define STAT_MOVEVARS_STOPSPEED 243 // DP
#define STAT_MOVEVARS_MAXSPEED 244 // DP
#define STAT_MOVEVARS_SPECTATORMAXSPEED 245 // DP
#define STAT_MOVEVARS_ACCELERATE 246 // DP
#define STAT_MOVEVARS_AIRACCELERATE 247 // DP
#define STAT_MOVEVARS_WATERACCELERATE 248 // DP
#define STAT_MOVEVARS_ENTGRAVITY 249 // DP
#define STAT_MOVEVARS_JUMPVELOCITY 250 // DP
#define STAT_MOVEVARS_EDGEFRICTION 251 // DP
#define STAT_MOVEVARS_MAXAIRSPEED 252 // DP
#define STAT_MOVEVARS_STEPHEIGHT 253 // DP
#define STAT_MOVEVARS_AIRACCEL_QW 254 // DP
#define STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION 255 // DP
};
//

View File

@ -373,15 +373,17 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
i = MAX_NQDATAGRAM;
SZ_Write (&send, chan->reliable_buf+chan->reliable_start, i);
if (send.cursize + length < send.maxsize)
{ //throw the unreliable packet into the same one as the reliable (but not sent reliably)
SZ_Write (&send, data, length);
length = 0;
}
if (chan->reliable_start+i == chan->reliable_length)
{
if (send.cursize + length < send.maxsize)
{ //throw the unreliable packet into the same one as the reliable (but not sent reliably)
SZ_Write (&send, data, length);
length = 0;
}
*(int*)send_buf = BigLong(NETFLAG_DATA | NETFLAG_EOM | send.cursize);
}
else
*(int*)send_buf = BigLong(NETFLAG_DATA | send.cursize);
NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address);

View File

@ -80,7 +80,7 @@ extern cvar_t sv_port_ipx;
extern cvar_t sv_port_tcp;
#endif
extern cvar_t sv_public, sv_listen;
extern cvar_t sv_public, sv_listen_qw, sv_listen_nq, sv_listen_dp;
static qboolean allowconnects = false;
@ -2092,7 +2092,7 @@ void NET_InitServer(void)
int port;
port = PORT_SERVER;
if (sv_listen.value)
if (sv_listen_nq.value || sv_listen_dp.value || sv_listen_qw.value)
{
allowconnects = true;

View File

@ -259,6 +259,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svcdp_precache 54 // [short] precacheindex [string] filename, precacheindex is + 0 for modelindex and +32768 for soundindex
#define svcdp_spawnbaseline2 55
#define svcdp_entities 57
#define svcdp_csqcentities 58

View File

@ -112,6 +112,7 @@ int gl_alpha_format = 4;
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
int gl_filter_max = GL_LINEAR;
int gl_filter_max_2d = GL_LINEAR;
int texels;
@ -143,6 +144,7 @@ static gltexture_t *gltextures;
int scrap_allocated[MAX_SCRAPS][BLOCK_WIDTH];
qbyte scrap_texels[MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT];
qboolean scrap_dirty;
int scrap_usedcount;
int scrap_texnum;
// returns a texture number and the position inside it
@ -180,6 +182,9 @@ int Scrap_AllocBlock (int w, int h, int *x, int *y)
for (i=0 ; i<w ; i++)
scrap_allocated[texnum][*x + i] = best + h;
if (scrap_usedcount < texnum+1)
scrap_usedcount = texnum+1;
return texnum;
}
@ -190,9 +195,13 @@ int scrap_uploads;
void Scrap_Upload (void)
{
int i;
scrap_uploads++;
GL_Bind(scrap_texnum);
GL_Upload8 ("scrap", scrap_texels[0], BLOCK_WIDTH, BLOCK_HEIGHT, false, true);
for (i = 0; i < scrap_usedcount; i++)
{
GL_Bind(scrap_texnum + i);
GL_Upload8 ("scrap", scrap_texels[i], BLOCK_WIDTH, BLOCK_HEIGHT, false, true);
}
scrap_dirty = false;
}
@ -655,6 +664,42 @@ void GL_Texturemode_Callback (struct cvar_s *var, char *oldvalue)
}
}
}
void GL_Texturemode2d_Callback (struct cvar_s *var, char *oldvalue)
{
int i;
gltexture_t *glt;
if (qrenderer != QR_OPENGL)
return;
for (i=0 ; i< sizeof(modes)/sizeof(modes[0]) ; i++)
{
if (!Q_strcasecmp (modes[i].name, var->string ) )
break;
if (!Q_strcasecmp (modes[i].altname, var->string ) )
break;
}
if (i == sizeof(modes)/sizeof(modes[0]))
{
Con_Printf ("bad gl_texturemode name\n");
return;
}
// gl_filter_min = modes[i].minimize;
gl_filter_max_2d = modes[i].maximize;
// change all the existing mipmap texture objects
for (glt=gltextures ; glt ; glt=glt->next)
{
if (!glt->mipmap)
{
GL_Bind (glt->texnum);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max_2d);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max_2d);
}
}
Scrap_Upload();
}
#ifdef Q3SHADERS
#define FOG_TEXTURE_WIDTH 32
@ -2927,8 +2972,8 @@ qboolean GL_UploadCompressed (qbyte *file, int *out_width, int *out_height, unsi
}
else
{
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max_2d);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max_2d);
}
return true;
}
@ -3109,8 +3154,8 @@ done:
}
else
{
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max_2d);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max_2d);
}
}
@ -3319,8 +3364,8 @@ done: ;
}
else
{
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max_2d);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max_2d);
}
}
@ -3512,8 +3557,8 @@ void GL_UploadBump(qbyte *data, int width, int height, qboolean mipmap, float bu
}
else
{
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max_2d);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max_2d);
}
// if (gl_texturefilteranisotropic)
@ -3604,8 +3649,8 @@ done: ;
}
else
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max_2d);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max_2d);
}
}
#endif

View File

@ -343,7 +343,10 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg)
if (!writtenheader)
{
writtenheader=true;
MSG_WriteByte(msg, svc_csqcentities);
if (client->protocol != SCP_QUAKEWORLD)
MSG_WriteByte(msg, svcdp_csqcentities);
else
MSG_WriteByte(msg, svc_csqcentities);
}
MSG_WriteShort(msg, ent->entnum);
if (sv.csqcdebug) //optional extra.

View File

@ -114,7 +114,9 @@ cvar_t allow_download_wads = SCVAR("allow_download_wads", "1");
cvar_t allow_download_configs = SCVAR("allow_download_configs", "0");
cvar_t sv_public = SCVAR("sv_public", "0");
cvar_t sv_listen = SCVAR("sv_listen", "1");
cvar_t sv_listen_qw = FCVAR("sv_listen_qw", "sv_listen", "1", 0);
cvar_t sv_listen_nq = SCVAR("sv_listen_nq", "0");
cvar_t sv_listen_dp = SCVAR("sv_listen_dp", "1");
cvar_t sv_reportheartbeats = SCVAR("sv_reportheartbeats", "1");
cvar_t sv_highchars = SCVAR("sv_highchars", "1");
cvar_t sv_loadentfiles = SCVAR("sv_loadentfiles", "1");
@ -1226,11 +1228,12 @@ void SVC_GetChallenge (void)
}
#endif
}
Netchan_OutOfBand(NS_SERVER, net_from, over-buf, buf);
if (sv_listen_qw.value)
Netchan_OutOfBand(NS_SERVER, net_from, over-buf, buf);
if (sv_listen.value >= 2)
if (sv_listen_dp.value)
{
//dp can respond to this (and fte won't get confused because the challenge will be wrong)
//dp (protocol6 upwards) can respond to this (and fte won't get confused because the challenge will be wrong)
buf = va("challenge "DISTRIBUTION"%i", svs.challenges[i].challenge);
Netchan_OutOfBand(NS_SERVER, net_from, strlen(buf)+1, buf);
}
@ -1448,7 +1451,7 @@ client_t *SVC_DirectConnect(void)
if (*(Cmd_Argv(0)+7) == '\\')
{
if (sv_listen.value < 2)
if (!sv_listen_dp.value)
return NULL;
Q_strncpyz (userinfo[0], net_message.data + 11, sizeof(userinfo[0])-1);
@ -1461,7 +1464,14 @@ client_t *SVC_DirectConnect(void)
//it's a darkplaces client.
s = Info_ValueForKey(userinfo[0], "protocols");
if (strstr(s, "DP7"))
if (sizeofcoord != 4)
{ //we allow nq with sv_listen_nq 0...
//reason: dp is too similar for concerns about unsupported code, while the main reason why we disable nq is because of the lack of challenges
//(and no, this isn't a way to bypass invalid challenges)
protocol = SCP_NETQUAKE;
Con_Printf ("* DP without sv_bigcoords 1\n");
}
else if (strstr(s, "DP7"))
protocol = SCP_DARKPLACES7;
else
protocol = SCP_DARKPLACES6;
@ -1636,8 +1646,12 @@ client_t *SVC_DirectConnect(void)
&& ( cl->netchan.qport == qport
|| adr.port == cl->netchan.remote_address.port ))
{
if (cl->state == cs_connected) {
Con_Printf("%s:dup connect\n", NET_AdrToString (adr));
if (cl->state == cs_connected)
{
if (cl->protocol != protocol)
Con_Printf("%s: diff prot connect\n", NET_AdrToString (adr));
else
Con_Printf("%s:dup connect\n", NET_AdrToString (adr));
nextuserid--;
return NULL;
}
@ -2351,7 +2365,7 @@ void SVNQ_ConnectionlessPacket(void)
if (net_from.type == NA_LOOPBACK)
return;
if (sv_listen.value < 2)
if (!sv_listen_nq.value)
return;
if (sv_bigcoords.value)
return; //no, start using dp7 instead.
@ -3074,8 +3088,11 @@ void SV_InitLocal (void)
Cvar_Register (&sv_resetparms, cvargroup_servercontrol);
Cvar_Register (&sv_public, cvargroup_servercontrol);
Cvar_Register (&sv_listen, cvargroup_servercontrol);
sv_listen.restriction = RESTRICT_MAX;
Cvar_Register (&sv_listen_qw, cvargroup_servercontrol);
Cvar_Register (&sv_listen_nq, cvargroup_servercontrol);
Cvar_Register (&sv_listen_dp, cvargroup_servercontrol);
sv_listen_qw.restriction = RESTRICT_MAX;
#ifdef TCPCONNECT
Cvar_Register (&sv_port_tcp, cvargroup_servercontrol);
sv_port_tcp.restriction = RESTRICT_MAX;
@ -3368,7 +3385,7 @@ void Master_Heartbeat (void)
NET_SendPacket (NS_SERVER, strlen(string), string, sv_masterlist[i].adr);
break;
case true:
if (sv_listen.value>=2) //set listen to 1 to allow qw connections, 2 to allow nq connections too.
if (sv_listen_dp.value) //set listen to 1 to allow qw connections, 2 to allow nq connections too.
{
if (sv_reportheartbeats.value)
Con_Printf ("Sending heartbeat to %s\n", NET_AdrToString (sv_masterlist[i].adr));

View File

@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CHAN_ITEM 3
#define CHAN_BODY 4
extern cvar_t sv_gravity, sv_friction, sv_waterfriction, sv_gamespeed, sv_stopspeed, sv_spectatormaxspeed, sv_accelerate, sv_airaccelerate, sv_wateraccelerate, sv_edgefriction;
/*
=============================================================================
@ -1303,6 +1305,30 @@ void SV_UpdateClientStats (client_t *client, int pnum)
else
stats[STAT_VIEWZOOM] = ent->v->viewzoom*255;
if (host_client->protocol == SCP_DARKPLACES7)
{
float *statsf = (float*)stats;
// statsf[STAT_MOVEVARS_WALLFRICTION] = sv_wall
statsf[STAT_MOVEVARS_FRICTION] = sv_friction.value;
statsf[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value;
statsf[STAT_MOVEVARS_TICRATE] = 72;
statsf[STAT_MOVEVARS_TIMESCALE] = sv_gamespeed.value;
statsf[STAT_MOVEVARS_GRAVITY] = sv_gravity.value;
statsf[STAT_MOVEVARS_STOPSPEED] = sv_stopspeed.value;
statsf[STAT_MOVEVARS_MAXSPEED] = host_client->maxspeed;
statsf[STAT_MOVEVARS_SPECTATORMAXSPEED] = sv_spectatormaxspeed.value;
statsf[STAT_MOVEVARS_ACCELERATE] = sv_accelerate.value;
statsf[STAT_MOVEVARS_AIRACCELERATE] = sv_airaccelerate.value;
statsf[STAT_MOVEVARS_WATERACCELERATE] = sv_wateraccelerate.value;
statsf[STAT_MOVEVARS_ENTGRAVITY] = host_client->entgravity;
statsf[STAT_MOVEVARS_JUMPVELOCITY] = 280;//sv_jumpvelocity.value; //bah
statsf[STAT_MOVEVARS_EDGEFRICTION] = sv_edgefriction.value;
statsf[STAT_MOVEVARS_MAXAIRSPEED] = host_client->maxspeed;
statsf[STAT_MOVEVARS_STEPHEIGHT] = 18;
statsf[STAT_MOVEVARS_AIRACCEL_QW] = 1;
statsf[STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION] = sv_gravity.value;
}
SV_UpdateQCStats(ent, stats);
//dmw tweek for stats
@ -1601,7 +1627,6 @@ void SV_UpdateToReliableMessages (void)
}
{
extern cvar_t sv_gravity;
// maxspeed/entgravity changes
ent = host_client->edict;

View File

@ -343,6 +343,23 @@ void SVNQ_New_f (void)
#endif
MSG_WriteString (&host_client->netchan.message,message);
if (host_client->protocol == SCP_DARKPLACES7)
{
char *f;
f = COM_LoadTempFile("csprogs.dat");
if (f)
{
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
MSG_WriteString (&host_client->netchan.message, va("csqc_progname %s\n", "csprogs.dat"));
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
MSG_WriteString (&host_client->netchan.message, va("csqc_progsize %i\n", com_filesize));
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
MSG_WriteString (&host_client->netchan.message, va("csqc_progcrc %i\n", QCRC_Block(f, com_filesize)));
host_client->csqcactive = true;
}
}
MSG_WriteByte (&host_client->netchan.message, svc_serverdata);
switch(host_client->protocol)
{
@ -382,7 +399,6 @@ void SVNQ_New_f (void)
MSG_WriteString (&host_client->netchan.message, sv.strings.sound_precache[i]);
MSG_WriteByte (&host_client->netchan.message, 0);
// send music
MSG_WriteByte (&host_client->netchan.message, svc_cdtrack);
MSG_WriteByte (&host_client->netchan.message, sv.edicts->v->sounds);
@ -4992,7 +5008,7 @@ void SVNQ_ReadClientMove (usercmd_t *move)
move->sidemove = MSG_ReadShort ();
move->upmove = MSG_ReadShort ();
move->msec=100;
move->msec=(1/72.0f)*1000;//MSG_ReadFloat;
// read buttons
if (host_client->protocol == SCP_DARKPLACES6 || host_client->protocol == SCP_DARKPLACES7)