From: Reki Date: Thu, 15 Apr 2021 04:01:14 +0000 (-0400) Subject: Added DB1 protocol X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dee7bf072908ff5d5119290f6b976df442fbd10e;p=xonotic%2Fdarkplaces.git Added DB1 protocol --- diff --git a/cl_input.c b/cl_input.c index 151e9e23..3a8ad867 100644 --- a/cl_input.c +++ b/cl_input.c @@ -1830,6 +1830,9 @@ void CL_SendMove(void) case PROTOCOL_DARKPLACES7: cl.cmd.predicted = cl_movement.integer != 0; break; + case PROTOCOL_DOOMBRINGER1: + cl.cmd.predicted = cl_movement.integer != 0; + break; default: cl.cmd.predicted = false; break; @@ -1862,6 +1865,10 @@ void CL_SendMove(void) // FIXME: cl.cmd.buttons & 16 is +button5, Nexuiz/Xonotic specific cl.cmd.crouch = (cl.cmd.buttons & 16) != 0; break; + case PROTOCOL_DOOMBRINGER1: + // FIXME: cl.cmd.buttons & 16 is +button5, Nexuiz/Xonotic specific + cl.cmd.crouch = (cl.cmd.buttons & 16) != 0; + break; case PROTOCOL_UNKNOWN: break; } @@ -2030,6 +2037,51 @@ void CL_SendMove(void) if (!cl.cmd.predicted) maxusercmds = 1; + // send the latest moves in order, the old ones will be + // ignored by the server harmlessly, however if the previous + // packets were lost these moves will be used + // + // this reduces packet loss impact on gameplay. + for (j = 0, cmd = &cl.movecmd[maxusercmds-1];j < maxusercmds;j++, cmd--) + { + // don't repeat any stale moves + if (cmd->sequence && cmd->sequence < cls.servermovesequence) + continue; + // 5/9 bytes + MSG_WriteByte (&buf, clc_move); + if (cls.protocol != PROTOCOL_DARKPLACES6) + MSG_WriteLong (&buf, cmd->predicted ? cmd->sequence : 0); + MSG_WriteFloat (&buf, cmd->time); // last server packet time + // 6 bytes + for (i = 0;i < 3;i++) + MSG_WriteAngle16i (&buf, cmd->viewangles[i]); + // 6 bytes + MSG_WriteCoord16i (&buf, cmd->forwardmove); + MSG_WriteCoord16i (&buf, cmd->sidemove); + MSG_WriteCoord16i (&buf, cmd->upmove); + // 5 bytes + MSG_WriteLong (&buf, cmd->buttons); + MSG_WriteByte (&buf, cmd->impulse); + // PRYDON_CLIENTCURSOR + // 30 bytes + MSG_WriteShort (&buf, (short)(cmd->cursor_screen[0] * 32767.0f)); + MSG_WriteShort (&buf, (short)(cmd->cursor_screen[1] * 32767.0f)); + MSG_WriteFloat (&buf, cmd->cursor_start[0]); + MSG_WriteFloat (&buf, cmd->cursor_start[1]); + MSG_WriteFloat (&buf, cmd->cursor_start[2]); + MSG_WriteFloat (&buf, cmd->cursor_impact[0]); + MSG_WriteFloat (&buf, cmd->cursor_impact[1]); + MSG_WriteFloat (&buf, cmd->cursor_impact[2]); + MSG_WriteShort (&buf, cmd->cursor_entitynumber); + } + break; + case PROTOCOL_DOOMBRINGER1: + // set the maxusercmds variable to limit how many should be sent + maxusercmds = bound(1, cl_netrepeatinput.integer + 1, min(3, CL_MAX_USERCMDS)); + // when movement prediction is off, there's not much point in repeating old input as it will just be ignored + if (!cl.cmd.predicted) + maxusercmds = 1; + // send the latest moves in order, the old ones will be // ignored by the server harmlessly, however if the previous // packets were lost these moves will be used diff --git a/cl_parse.c b/cl_parse.c index bd402e2f..5707a323 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -3910,6 +3910,7 @@ void CL_ParseServerMessage(void) strip_pqc = true; break; case PROTOCOL_DARKPLACES7: + case PROTOCOL_DOOMBRINGER1: default: // ProQuake does not support // these protocols diff --git a/common.h b/common.h index 834baeee..9fa568b1 100644 --- a/common.h +++ b/common.h @@ -129,6 +129,7 @@ void StoreLittleShort (unsigned char *buffer, unsigned short i); typedef enum protocolversion_e { PROTOCOL_UNKNOWN, + PROTOCOL_DOOMBRINGER1, PROTOCOL_DARKPLACES7, ///< added QuakeWorld-style movement protocol to allow more consistent prediction PROTOCOL_DARKPLACES6, ///< various changes PROTOCOL_DARKPLACES5, ///< uses EntityFrame5 entity snapshot encoder/decoder which is based on a Tribes networking article at http://www.garagegames.com/articles/networking1/ diff --git a/netconn.c b/netconn.c index 61ffeeda..c831d8bc 100755 --- a/netconn.c +++ b/netconn.c @@ -1771,7 +1771,7 @@ static void NetConn_ClientParsePacket_ServerList_ParseDPList(lhnetaddress_t *sen if (serverlist_consoleoutput && developer_networking.integer) Con_Printf("Requesting info from DarkPlaces server %s\n", ipstring); - if( !NetConn_ClientParsePacket_ServerList_PrepareQuery( PROTOCOL_DARKPLACES7, ipstring, false ) ) { + if( !NetConn_ClientParsePacket_ServerList_PrepareQuery( PROTOCOL_DOOMBRINGER1, ipstring, false ) ) { break; } @@ -3690,7 +3690,7 @@ void NetConn_QueryMasters(qbool querydp, qbool queryqw) if(LHNETADDRESS_GetAddressType(&favorites[j]) == af) { if(LHNETADDRESS_ToString(&favorites[j], request, sizeof(request), true)) - NetConn_ClientParsePacket_ServerList_PrepareQuery( PROTOCOL_DARKPLACES7, request, true ); + NetConn_ClientParsePacket_ServerList_PrepareQuery( PROTOCOL_DOOMBRINGER1, request, true ); } } } diff --git a/protocol.c b/protocol.c index 11220c29..cfdc0ba1 100644 --- a/protocol.c +++ b/protocol.c @@ -48,6 +48,7 @@ struct protocolversioninfo_s } protocolversioninfo[] = { + { 3601, PROTOCOL_DOOMBRINGER1, "DB1"}, { 3504, PROTOCOL_DARKPLACES7 , "DP7"}, { 3503, PROTOCOL_DARKPLACES6 , "DP6"}, { 3502, PROTOCOL_DARKPLACES5 , "DP5"}, diff --git a/sv_ents5.c b/sv_ents5.c index 9eb7abd8..fe2b25c0 100644 --- a/sv_ents5.c +++ b/sv_ents5.c @@ -168,7 +168,7 @@ static int EntityState5_DeltaBits(const entity_state_t *o, const entity_state_t } if (o->traileffectnum != n->traileffectnum) bits |= E5_TRAILEFFECTNUM; - if (o->solid != n->solid) + if (o->solid != n->solid && sv.protocol >= PROTOCOL_DOOMBRINGER1) bits |= E5_SOLID; } else