]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
protocol: Add ReadFrame pointer to protocol_t and set it
authorCloudwalk <cloudwalk009@gmail.com>
Fri, 25 Sep 2020 17:39:54 +0000 (13:39 -0400)
committerCloudwalk <cloudwalk009@gmail.com>
Fri, 25 Sep 2020 17:39:54 +0000 (13:39 -0400)
cl_protocol_ext.h
protocol.c
protocol.h

index 80d05fcbad6ddd1cc3d5a5f110b99b6321d1c08e..c1d703b7fe834c55434a27dc33eec9febdb31b26 100644 (file)
@@ -127,12 +127,8 @@ static void Netmsg_svc_entities (protocol_t *protocol) //                  57              // [int] deltafr
                cls.signon = SIGNONS;
                CL_SignonReply ();
        }
-       if (protocol == &protocol_dpp1 || protocol == &protocol_dpp2 || protocol == &protocol_dpp3)
-               EntityFrame_CL_ReadFrame();
-       else if (protocol == &protocol_dpp4)
-               EntityFrame4_CL_ReadFrame();
-       else
-               EntityFrame5_CL_ReadFrame();
+
+       protocol->ReadFrame();
 }
 
 static void Netmsg_svc_csqcentities (protocol_t *protocol) //          58              // [short] entnum [variable length] entitydata ... [short] 0x0000
index c1f72bf97fe19a3b3c8443eb6e4fb6bd5c470e16..e01f38cd685565d486434571a2638334aa9bf4ed 100644 (file)
@@ -65,6 +65,7 @@ protocol_t protocol_quakedp =
        .ReadCoord = MSG_ReadCoord13i,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector13i,
+       .ReadFrame = EntityFrame5_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -94,6 +95,7 @@ protocol_t protocol_dpp1 =
        .ReadCoord = MSG_ReadCoord32f,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector32f,
+       .ReadFrame = EntityFrame_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -109,6 +111,7 @@ protocol_t protocol_dpp2 =
        .ReadCoord = MSG_ReadCoord16i,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector16i,
+       .ReadFrame = EntityFrame_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -124,6 +127,7 @@ protocol_t protocol_dpp3 =
        .ReadCoord = MSG_ReadCoord16i,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector16i,
+       .ReadFrame = EntityFrame_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -139,6 +143,7 @@ protocol_t protocol_dpp4 =
        .ReadCoord = MSG_ReadCoord16i,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector16i,
+       .ReadFrame = EntityFrame4_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -154,6 +159,7 @@ protocol_t protocol_dpp5 =
        .ReadCoord = MSG_ReadCoord32f,
        .ReadAngle = MSG_ReadAngle16i,
        .ReadVector = MSG_ReadVector32f,
+       .ReadFrame = EntityFrame5_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -169,6 +175,7 @@ protocol_t protocol_dpp6 =
        .ReadCoord = MSG_ReadCoord32f,
        .ReadAngle = MSG_ReadAngle16i,
        .ReadVector = MSG_ReadVector32f,
+       .ReadFrame = EntityFrame5_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -184,6 +191,7 @@ protocol_t protocol_dpp7 =
        .ReadCoord = MSG_ReadCoord32f,
        .ReadAngle = MSG_ReadAngle16i,
        .ReadVector = MSG_ReadVector32f,
+       .ReadFrame = EntityFrame5_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 
@@ -200,6 +208,7 @@ protocol_t protocol_nehahramovie =
        .ReadCoord = MSG_ReadCoord13i,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector13i,
+       .ReadFrame = EntityFrame5_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -215,6 +224,7 @@ protocol_t protocol_nehahrabjp =
        .ReadCoord = MSG_ReadCoord13i,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector13i,
+       .ReadFrame = EntityFrame5_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -230,6 +240,7 @@ protocol_t protocol_nehahrabjp2 =
        .ReadCoord = MSG_ReadCoord13i,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector13i,
+       .ReadFrame = EntityFrame5_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
@@ -245,6 +256,7 @@ protocol_t protocol_nehahrabjp3 =
        .ReadCoord = MSG_ReadCoord13i,
        .ReadAngle = MSG_ReadAngle8i,
        .ReadVector = MSG_ReadVector13i,
+       .ReadFrame = EntityFrame5_CL_ReadFrame,
        .svc = &netmsg_dpext_svc,
        .clc = &netmsg_base_clc
 };
index 623f813672ab6bbd083341491f03d101837482c7..fe57136db5dc5a722b0fc3c4a80686e79fef0374 100644 (file)
@@ -58,6 +58,8 @@ struct protocol_s
        float (*ReadAngle)(sizebuf_t *);
        void (*ReadVector)(sizebuf_t *, vec3_t);
 
+       void (*ReadFrame)(void);
+
        // TODO: Other info?
        struct protocol_netmsg_s *svc;
        struct protocol_netmsg_s *clc;