From f92ea8ec725f8cbeda48efd294b1a05badcaf5f6 Mon Sep 17 00:00:00 2001 From: Des Date: Mon, 5 Aug 2024 08:59:10 -0300 Subject: [PATCH] Add resendcsqcents command to ask server to resend all csqc entities, used in demo record restarting. --- protocol.h | 1 + sv_ccmds.c | 15 +++++++++++++++ sv_ents_csqc.c | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/protocol.h b/protocol.h index 92b98dba..a85193a7 100644 --- a/protocol.h +++ b/protocol.h @@ -1077,6 +1077,7 @@ void EntityStateQW_ReadPlayerUpdate(void); void EntityFrameQW_CL_ReadFrame(qbool delta); struct client_s; +void EntityFrameCSQC_LostAllFrames(struct client_s *client); void EntityFrameCSQC_LostFrame(struct client_s *client, int framenum); qbool EntityFrameCSQC_WriteFrame (struct sizebuf_s *msg, int maxsize, int numnumbers, const unsigned short *numbers, int framenum); diff --git a/sv_ccmds.c b/sv_ccmds.c index aa6790e5..ca713b58 100644 --- a/sv_ccmds.c +++ b/sv_ccmds.c @@ -734,6 +734,20 @@ static void SV_Pings_f(cmd_state_t *cmd) MSG_WriteString(&host_client->netconnection->message, "\n"); } +/* +==================== +SV_Resend_All_Csqc_Ents_f + +send all csqc ents from scratch to this player +==================== +*/ +static void SV_Resend_All_Csqc_Ents_f(cmd_state_t *cmd) +{ + if (!host_client->netconnection) + return; + EntityFrameCSQC_LostAllFrames(host_client); //resend all entities +} + /* ================== SV_Status_f @@ -1669,6 +1683,7 @@ void SV_InitOperatorCommands(void) Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "spawn", SV_Spawn_f, "internal use - signon 2 (client has sent player information, and is asking server to send scoreboard rankings)"); Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "begin", SV_Begin_f, "internal use - signon 3 (client asks server to start sending entities, and will go to signon 4 (playing) when the first entity update is received)"); Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "pings", SV_Pings_f, "internal use - command sent by clients to request updated ping and packetloss of players on scoreboard (originally from QW, but also used on NQ servers)"); + Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "resendcsqcents", SV_Resend_All_Csqc_Ents_f, "internal use - command sent by clients to request updated ping and packetloss of players on scoreboard (originally from QW, but also used on NQ servers)"); Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "god", SV_God_f, "god mode (invulnerability)"); Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "notarget", SV_Notarget_f, "notarget mode (monsters do not see you)"); diff --git a/sv_ents_csqc.c b/sv_ents_csqc.c index 3e09b3ca..6c78868c 100644 --- a/sv_ents_csqc.c +++ b/sv_ents_csqc.c @@ -5,7 +5,7 @@ // (including QUAKE), no packet loss handling for CSQC is done, which makes // CSQC basically useless. // Always use the DP5 protocol, or a higher one, when using CSQC entities. -static void EntityFrameCSQC_LostAllFrames(client_t *client) +void EntityFrameCSQC_LostAllFrames(client_t *client) { prvm_prog_t *prog = SVVM_prog; // mark ALL csqc entities as requiring a FULL resend! -- 2.39.2