]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Added DB1 protocol
authorReki <spiper212@gmail.com>
Thu, 15 Apr 2021 04:01:14 +0000 (00:01 -0400)
committerReki <spiper212@gmail.com>
Thu, 15 Apr 2021 04:01:14 +0000 (00:01 -0400)
cl_input.c
cl_parse.c
common.h
netconn.c
protocol.c
sv_ents5.c

index 151e9e23c6ed670a77d1bc290527617b3c83ab89..3a8ad867d1af8aef76a9609f7e05c17aacc8825d 100644 (file)
@@ -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
index bd402e2fc6fc2c5818e6371f312a8e4b57c468aa..5707a3230c7ae3391afeab94aa7d07d85d7fe1a2 100644 (file)
@@ -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
index 834baeee69dcf2b0b4f95cbac6386cc7a8b46b0c..9fa568b17d4dbc0f39f24696831eb8bbcbd1b428 100644 (file)
--- 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/
index 61ffeeda57765948744ddaa9818e2a282baa01aa..c831d8bc8fa59d4d0326e0d9e5a215468fba0bae 100755 (executable)
--- 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 );
                                        }
                                }
                        }
index 11220c2977f10190353fccdb15df6ee6bcc4b07e..cfdc0ba113927033b10ff9e6c740695ef2e63dc6 100644 (file)
@@ -48,6 +48,7 @@ struct protocolversioninfo_s
 }
 protocolversioninfo[] =
 {
+       { 3601, PROTOCOL_DOOMBRINGER1, "DB1"},
        { 3504, PROTOCOL_DARKPLACES7 , "DP7"},
        { 3503, PROTOCOL_DARKPLACES6 , "DP6"},
        { 3502, PROTOCOL_DARKPLACES5 , "DP5"},
index 9eb7abd89823940fc92abe87f5ace9d1fe561f54..fe2b25c0518326d1544ec64fcac527537260053b 100644 (file)
@@ -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