From 4519fe7035d66ee6bc2fc74c2d63484b178cf25e Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 12 Mar 2013 22:13:26 +0000 Subject: [PATCH] ------------------------------------------------------------------------ r4166 | acceptthis | 2012-12-22 07:03:26 +0000 (Sat, 22 Dec 2012) | 1 line Should fix 3 bugs in the server. One crash, one that breaks server browsers, and one minor. ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4166 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_cam.c | 62 +++++++++++++++++++++++++++++++++++++++-- engine/client/cl_pred.c | 2 +- engine/server/sv_main.c | 35 +++++++++++++++-------- engine/server/sv_mvd.c | 13 +++++++-- 4 files changed, 96 insertions(+), 16 deletions(-) diff --git a/engine/client/cl_cam.c b/engine/client/cl_cam.c index 5b084b4b7..295297fcc 100644 --- a/engine/client/cl_cam.c +++ b/engine/client/cl_cam.c @@ -134,6 +134,7 @@ void Cam_Lock(int pnum, int playernum) if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV) { memcpy(&cl.playerview[pnum].stats, cl.players[playernum].stats, sizeof(cl.playerview[pnum].stats)); + locked[pnum] = true; //instantly lock if the player is valid. } Sbar_Changed(); @@ -470,8 +471,6 @@ void Cam_Track(int pnum, usercmd_t *cmd) if (scr_chatmode != 2) cam_lastviewtime[pnum] = realtime; - cmd->forwardmove = cmd->sidemove = cmd->upmove = 0; - VectorCopy(player->viewangles, cl.playerview[pnum].viewangles); if (memcmp(player->origin, &self->origin, sizeof(player->origin)) != 0) { @@ -555,6 +554,7 @@ void Cam_FinishMove(int pnum, usercmd_t *cmd) int i; player_info_t *s; int end; + extern cvar_t cl_demospeed, cl_splitscreen; if (cls.state != ca_active) return; @@ -562,6 +562,64 @@ void Cam_FinishMove(int pnum, usercmd_t *cmd) if (!cl.spectator && (cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV)) // only in spectator mode return; + if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV) + { + int nb; + nb = (cmd->sidemove<0)?4:0; + nb |= (cmd->sidemove>0)?8:0; + nb |= (cmd->forwardmove<0)?16:0; + nb |= (cmd->forwardmove>0)?32:0; + nb |= (cmd->upmove<0)?64:0; + nb |= (cmd->upmove>0)?128:0; + if (nb & (nb ^ oldbuttons[pnum]) & 4) + Cvar_SetValue(&cl_demospeed, max(cl_demospeed.value - 0.1, 0)); + if (nb & (nb ^ oldbuttons[pnum]) & 8) + Cvar_SetValue(&cl_demospeed, min(cl_demospeed.value + 0.1, 10)); + if (nb & (nb ^ oldbuttons[pnum]) & (4|8)) + Con_Printf("playback speed: %g%%\n", cl_demospeed.value*100); + if (nb & (nb ^ oldbuttons[pnum]) & 16) + Cbuf_AddText("demo_jump +10", RESTRICT_LOCAL); + if (nb & (nb ^ oldbuttons[pnum]) & 32) + Cbuf_AddText("demo_jump -10", RESTRICT_LOCAL); + if (nb & (nb ^ oldbuttons[pnum]) & (4|8)) + Con_Printf("playback speed: %g%%\n", cl_demospeed.value*100); + if (nb & (nb ^ oldbuttons[pnum]) & 64) + Cvar_SetValue(&cl_splitscreen, max(cl_splitscreen.ival - 1, 0)); + if (nb & (nb ^ oldbuttons[pnum]) & 128) + Cvar_SetValue(&cl_splitscreen, min(cl_splitscreen.ival + 1, MAX_SPLITS-1)); + oldbuttons[pnum] = (oldbuttons[pnum] & 3) | (nb & ~3); + if (cmd->impulse) + { + int pl = cmd->impulse; + for (i = 0; ; i++) + { + if (i == MAX_CLIENTS) + { + if (pl == cmd->impulse) + break; + i = 0; + } + + s = &cl.players[i]; + if (s->name[0] && !s->spectator) + { + pl--; + if (!pl) + { + Cam_Lock(pnum, i); + + pnum++; + if (pnum < cl.splitclients) + pl = 1; + else + break; + } + } + } + return; + } + } + if (cmd->buttons & BUTTON_ATTACK) { if (!(oldbuttons[pnum] & BUTTON_ATTACK)) diff --git a/engine/client/cl_pred.c b/engine/client/cl_pred.c index a3926dbfa..2e99d51af 100644 --- a/engine/client/cl_pred.c +++ b/engine/client/cl_pred.c @@ -1047,7 +1047,7 @@ fixedorg: for (i=0 ; i<3 ; i++) { lrp[i] = to->playerstate[spec_track[pnum]].origin[i] + - f * (from->playerstate[spec_track[pnum]].origin[i] - to->playerstate[cl.playernum[pnum]].origin[i]); + f * (from->playerstate[spec_track[pnum]].origin[i] - to->playerstate[spec_track[pnum]].origin[i]); lrpv[i] = to->playerstate[spec_track[pnum]].velocity[i] + f * (from->playerstate[spec_track[pnum]].velocity[i] - to->playerstate[spec_track[pnum]].velocity[i]); diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 5941fe84b..827cdec72 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -1735,6 +1735,7 @@ client_t *SVC_DirectConnect(void) unsigned int protextsupported=0; unsigned int protextsupported2=0; + extern cvar_t pr_maxedicts; char *name; @@ -1993,19 +1994,28 @@ client_t *SVC_DirectConnect(void) newcl->maxmodels = 256; if (protocol == SCP_QUAKEWORLD) //readd? { - newcl->max_net_ents = 512; - if (newcl->fteprotocolextensions & PEXT_ENTITYDBL) - newcl->max_net_ents += 512; - if (newcl->fteprotocolextensions & PEXT_ENTITYDBL2) - newcl->max_net_ents += 1024; + if (newcl->fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS) + { + //you need to reconnect for this to update, of course. so make sure its not *too* low... + newcl->max_net_ents = bound(512, pr_maxedicts.ival, 32768); + newcl->maxmodels = MAX_MODELS; //protocol limited to 14 bits. + } + else + { + newcl->max_net_ents = 512; + if (newcl->fteprotocolextensions & PEXT_ENTITYDBL) + newcl->max_net_ents += 512; + if (newcl->fteprotocolextensions & PEXT_ENTITYDBL2) + newcl->max_net_ents += 1024; + } if (newcl->fteprotocolextensions & PEXT_MODELDBL) newcl->maxmodels = MAX_MODELS; } else if (ISDPCLIENT(newcl)) { - newcl->max_net_ents = 32767; - newcl->maxmodels = 1024; + newcl->max_net_ents = bound(512, pr_maxedicts.ival, 32768); + newcl->maxmodels = 1024; //protocol limit of 16bits. 15bits for late precaches. client limit of 1k } else newcl->max_net_ents = 600; @@ -2371,7 +2381,10 @@ client_t *SVC_DirectConnect(void) #endif newcl->datagram.allowoverflow = true; newcl->datagram.data = newcl->datagram_buf; - newcl->datagram.maxsize = sizeof(newcl->datagram_buf); + if (mtu >= 64) + newcl->datagram.maxsize = sizeof(newcl->datagram_buf); + else + newcl->datagram.maxsize = MAX_DATAGRAM; newcl->netchan.netprim = svs.netprim; newcl->datagram.prim = svs.netprim; @@ -2846,10 +2859,10 @@ qboolean SVC_ThrottleInfo (void) /*don't allow it to go beyond curtime or we get issues with the logic above*/ if (inc > curtime-blockuntil) - return true; + return false; blockuntil += inc; - return false; + return true; } /* ================= @@ -3023,7 +3036,7 @@ void SVNQ_ConnectionlessPacket(void) { client_t *newcl; /*okay, so this is a reliable packet from a client, containing a 'cmd challengeconnect $challenge' response*/ - str = va("connect %i %i %s \"\\name\\unconnected\\mod\\%s\\modver\\%s\\flags\\%s\\password\\%s\"", NET_PROTOCOL_VERSION, 0, Cmd_Argv(1), Cmd_Argv(2), Cmd_Argv(3), Cmd_Argv(4)); + str = va("connect %i %i %s \"\\name\\unconnected\\mod\\%s\\modver\\%s\\flags\\%s\\password\\%s\"", NET_PROTOCOL_VERSION, 0, Cmd_Argv(1), Cmd_Argv(2), Cmd_Argv(3), Cmd_Argv(4), Cmd_Argv(5)); Cmd_TokenizeString (str, false, false); newcl = SVC_DirectConnect(); diff --git a/engine/server/sv_mvd.c b/engine/server/sv_mvd.c index a0089b3e1..51cae22d1 100644 --- a/engine/server/sv_mvd.c +++ b/engine/server/sv_mvd.c @@ -1598,8 +1598,8 @@ static qboolean SV_MVD_Record (mvddest_t *dest) demo.recorder.fteprotocolextensions2 = PEXT2_VOICECHAT; demo.recorder.zquake_extensions = Z_EXT_PM_TYPE | Z_EXT_PM_TYPE_NEW | Z_EXT_VIEWHEIGHT | Z_EXT_SERVERTIME | Z_EXT_PITCHLIMITS | Z_EXT_JOIN_OBSERVE | Z_EXT_VWEP; } - else - { + else if (sv_demoExtensions.ival) + { /*everything*/ demo.recorder.fteprotocolextensions = PEXT_CSQC | PEXT_COLOURMOD | PEXT_DPFLAGS | PEXT_CUSTOMTEMPEFFECTS | PEXT_ENTITYDBL | PEXT_ENTITYDBL2 | PEXT_FATNESS | PEXT_HEXEN2 | PEXT_HULLSIZE | PEXT_LIGHTSTYLECOL | PEXT_MODELDBL | PEXT_SCALE | PEXT_SETATTACHMENT | PEXT_SETVIEW | PEXT_SOUNDDBL | PEXT_SPAWNSTATIC2 | PEXT_TRANS | PEXT_VIEW2; demo.recorder.fteprotocolextensions2 = PEXT2_VOICECHAT | PEXT2_SETANGLEDELTA | PEXT2_PRYDONCURSOR; /*assume that all playback will be done with a valid csprogs that can correctly decode*/ @@ -1607,6 +1607,12 @@ static qboolean SV_MVD_Record (mvddest_t *dest) /*enable these, because we might as well (stat ones are always useful)*/ demo.recorder.zquake_extensions = Z_EXT_PM_TYPE | Z_EXT_PM_TYPE_NEW | Z_EXT_VIEWHEIGHT | Z_EXT_SERVERTIME | Z_EXT_PITCHLIMITS | Z_EXT_JOIN_OBSERVE | Z_EXT_VWEP; } + else + { + demo.recorder.fteprotocolextensions = 0; + demo.recorder.fteprotocolextensions2 = 0; + demo.recorder.zquake_extensions = Z_EXT_PM_TYPE | Z_EXT_PM_TYPE_NEW | Z_EXT_VIEWHEIGHT | Z_EXT_SERVERTIME | Z_EXT_PITCHLIMITS | Z_EXT_JOIN_OBSERVE | Z_EXT_VWEP; + } //pointless extensions that are redundant with mvds demo.recorder.fteprotocolextensions &= ~PEXT_ACCURATETIMINGS | PEXT_HLBSP|PEXT_Q2BSP|PEXT_Q3BSP; @@ -1617,6 +1623,9 @@ static qboolean SV_MVD_Record (mvddest_t *dest) if (demo.recorder.fteprotocolextensions & PEXT_ENTITYDBL2) demo.recorder.max_net_ents += 1024; + if (demo.recorder.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS) + demo.recorder.max_net_ents = 32767; + if (demo.recorder.fteprotocolextensions & PEXT_MODELDBL) demo.recorder.maxmodels = MAX_MODELS; else