]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
for purposes of better compatibility with proquake servers, darkplaces
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 18 Nov 2010 15:47:52 +0000 (15:47 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 18 Nov 2010 15:47:52 +0000 (15:47 +0000)
client now pretends to be proquake 3.40 when connecting to quake
protocol servers, this enables precise aim and the proquake NAT fix
(which the server only supports on proquake clients...  grr)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10607 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
client.h
netconn.c

index 86596afad25274a9c6854716e610dce3aff9a4cd..256a2f726369a3aef24e6e310edf6c21e27e9611 100644 (file)
@@ -1914,9 +1914,17 @@ void CL_SendMove(void)
                        // 5 bytes
                        MSG_WriteByte (&buf, clc_move);
                        MSG_WriteFloat (&buf, cl.cmd.time); // last server packet time
-                       // 3 bytes
-                       for (i = 0;i < 3;i++)
-                               MSG_WriteAngle8i (&buf, cl.cmd.viewangles[i]);
+                       // 3 bytes (6 bytes in proquake)
+                       if (cls.proquake_servermod == 1) // MOD_PROQUAKE
+                       {
+                               for (i = 0;i < 3;i++)
+                                       MSG_WriteAngle16i (&buf, cl.cmd.viewangles[i]);
+                       }
+                       else
+                       {
+                               for (i = 0;i < 3;i++)
+                                       MSG_WriteAngle8i (&buf, cl.cmd.viewangles[i]);
+                       }
                        // 6 bytes
                        MSG_WriteCoord16i (&buf, cl.cmd.forwardmove);
                        MSG_WriteCoord16i (&buf, cl.cmd.sidemove);
index 3fcec6a20665484c98ae65a9a4926f55fbbf33dd..f3d1cccebf2c4e621fe149f502144e3d120c670e 100644 (file)
--- a/client.h
+++ b/client.h
@@ -718,6 +718,11 @@ typedef struct client_static_s
 
        // crypto channel
        crypto_t crypto;
+
+       // ProQuake compatibility stuff
+       int proquake_servermod; // 0 = not proquake, 1 = proquake
+       int proquake_serverversion; // actual proquake server version * 10 (3.40 = 34, etc)
+       int proquake_serverflags; // 0 (PQF_CHEATFREE not supported)
 }
 client_static_t;
 
index 2c1d03ee3b48492954d95257814c7cd38dae8362..3253b7989109115f0a162c91f9d6f6a8a140d984 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -2037,6 +2037,21 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                                lhnetaddress_t clientportaddress;
                                clientportaddress = *peeraddress;
                                LHNETADDRESS_SetPort(&clientportaddress, MSG_ReadLong());
+                               // extra ProQuake stuff
+                               if (length >= 6)
+                                       cls.proquake_servermod = MSG_ReadByte(); // MOD_PROQUAKE
+                               else
+                                       cls.proquake_servermod = 0;
+                               if (length >= 7)
+                                       cls.proquake_serverversion = MSG_ReadByte(); // version * 10
+                               else
+                                       cls.proquake_serverversion = 0;
+                               if (length >= 8)
+                                       cls.proquake_serverflags = MSG_ReadByte(); // flags (mainly PQF_CHEATFREE)
+                               else
+                                       cls.proquake_serverflags = 0;
+                               if (cls.proquake_servermod == 1)
+                                       Con_Printf("Connected to ProQuake %.1f server, enabling precise aim\n", cls.proquake_serverversion / 10.0f);
                                // update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command)
                                InfoString_SetValue(cls.userinfo, sizeof(cls.userinfo), "*ip", addressstring2);
                                M_Update_Return_Reason("Accepted");
@@ -2217,6 +2232,15 @@ void NetConn_ClientFrame(void)
                MSG_WriteByte(&net_message, CCREQ_CONNECT);
                MSG_WriteString(&net_message, "QUAKE");
                MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION);
+               // extended proquake stuff
+               MSG_WriteByte(&net_message, 1); // mod = MOD_PROQUAKE
+               // this version matches ProQuake 3.40, the first version to support
+               // the NAT fix, and it only supports the NAT fix for ProQuake 3.40 or
+               // higher clients, so we pretend we are that version...
+               MSG_WriteByte(&net_message, 34); // version * 10
+               MSG_WriteByte(&net_message, 0); // flags
+               MSG_WriteLong(&net_message, 0); // password
+               // write the packetsize now...
                StoreBigLong(net_message.data, NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
                NetConn_Write(cls.connect_mysocket, net_message.data, net_message.cursize, &cls.connect_address);
                SZ_Clear(&net_message);