From: Cloudwalk Date: Fri, 25 Sep 2020 17:39:54 +0000 (-0400) Subject: protocol: Add ReadFrame pointer to protocol_t and set it X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ee1f8d5706bb1fbcc93662a951c1f930a2bfd5fb;p=xonotic%2Fdarkplaces.git protocol: Add ReadFrame pointer to protocol_t and set it --- diff --git a/cl_protocol_ext.h b/cl_protocol_ext.h index 80d05fcb..c1d703b7 100644 --- a/cl_protocol_ext.h +++ b/cl_protocol_ext.h @@ -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 diff --git a/protocol.c b/protocol.c index c1f72bf9..e01f38cd 100644 --- a/protocol.c +++ b/protocol.c @@ -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 }; diff --git a/protocol.h b/protocol.h index 623f8136..fe57136d 100644 --- a/protocol.h +++ b/protocol.h @@ -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;