From d37b8d07ff560f4977ae7629944146ca394c42df Mon Sep 17 00:00:00 2001 From: Shpoike Date: Tue, 11 Apr 2023 09:02:35 +0100 Subject: [PATCH] Try fixing te_gunshot with nq protocols. --- engine/common/net_chan.c | 1 + engine/server/pr_cmds.c | 21 ++++++++---------- engine/server/sv_send.c | 2 +- quakec/csqctest/src/ss/weapons.qc | 36 ++++++++++++++++++------------- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index b68224700..f66c98d3e 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -203,6 +203,7 @@ unsigned int Net_PextMask(unsigned int protover, qboolean fornq) #ifdef PEXT_Q3BSP PEXT_Q3BSP | #endif + PEXT_TE_BULLET | //qw's gunshot+explosions etc. PEXT_FLOATCOORDS | PEXT_HLBSP; //these all depend fully upon the player/entity deltas, and don't make sense for NQ. Implement PEXT2_REPLACEMENTDELTAS instead. diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index c9baafec6..61ded7c1c 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -6081,7 +6081,10 @@ void SV_point_tempentity (vec3_t o, int type, int count) //count (usually 1) is #endif break; case TEQW_NQGUNSHOT: - qwtype[0] = TEQW_NQGUNSHOT; +#ifdef NQPROT + nqtype[0] = TENQ_NQGUNSHOT; + nqtype[1] = TENQ_NQGUNSHOT; +#endif qwtype[1] = TEQW_QWGUNSHOT; split = PEXT_TE_BULLET; break; @@ -6138,8 +6141,9 @@ void SV_point_tempentity (vec3_t o, int type, int count) //count (usually 1) is } else if (nqtype[i] >= 0) { - int nqcount = min(3,count); - do + //messy - TENQ_NQGUNSHOT loops until we reach our counter. should probably randomize positions a little + int nqcount = (nqtype[i] == TENQ_NQGUNSHOT)?min(3,count):1; + while(nqcount-->0) { MSG_WriteByte (&sv.nqmulticast, svc_temp_entity); MSG_WriteByte (&sv.nqmulticast, nqtype[i]); @@ -6149,19 +6153,12 @@ void SV_point_tempentity (vec3_t o, int type, int count) //count (usually 1) is MSG_WriteChar(&sv.nqmulticast, 0); MSG_WriteChar(&sv.nqmulticast, 0); } - else if (/*nqtype == TENQ_QWBLOOD ||*/ nqtype[i] == TENQ_QWGUNSHOT) + else if (nqtype[i] == TENQ_QWGUNSHOT) MSG_WriteByte (&sv.nqmulticast, count); MSG_WriteCoord (&sv.nqmulticast, o[0]); MSG_WriteCoord (&sv.nqmulticast, o[1]); MSG_WriteCoord (&sv.nqmulticast, o[2]); - - //messy - TENQ_NQGUNSHOT looks until we reach our counter. should probably randomize positions a little - if (nqcount > 1 && nqtype[i] == TENQ_NQGUNSHOT) - { - nqcount--; - continue; - } - } while(0); + } } #endif if (i) diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index aa174381d..25e95934b 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -713,7 +713,7 @@ void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int for (split = client, seat = 0; split; split = split->controlled, seat++) { - if (split->protocol == SCP_QUAKEWORLD) + //if (split->protocol == SCP_QUAKEWORLD) { if (split->fteprotocolextensions & without) { diff --git a/quakec/csqctest/src/ss/weapons.qc b/quakec/csqctest/src/ss/weapons.qc index b3eaa0c87..a849e27b2 100644 --- a/quakec/csqctest/src/ss/weapons.qc +++ b/quakec/csqctest/src/ss/weapons.qc @@ -235,14 +235,19 @@ void(float damage, vector dir) TraceAttack = } else { - WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte (MSG_BROADCAST, TE_GUNSHOT); + if (checkbuiltin(te_gunshot)) + te_gunshot(org); + else + { + WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); + WriteByte (MSG_BROADCAST, TE_GUNSHOT); #ifdef QWSSQC - WriteByte (MSG_BROADCAST, 1); //count + WriteByte (MSG_BROADCAST, 1); //count #endif - WriteCoord (MSG_BROADCAST, org_x); - WriteCoord (MSG_BROADCAST, org_y); - WriteCoord (MSG_BROADCAST, org_z); + WriteCoord (MSG_BROADCAST, org_x); + WriteCoord (MSG_BROADCAST, org_y); + WriteCoord (MSG_BROADCAST, org_z); + } } }; @@ -399,15 +404,16 @@ void() BecomeExplosion = self.dimension_seen = DIMENSION_NOCSQC; dimension_send = DIMENSION_NOCSQC; -#if 1 - WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte (MSG_BROADCAST, TE_EXPLOSION); - WriteCoord (MSG_BROADCAST, self.origin_x); - WriteCoord (MSG_BROADCAST, self.origin_y); - WriteCoord (MSG_BROADCAST, self.origin_z); -#else - te_explosion(self.origin); -#endif + if (checkbuiltin(te_explosion)) + te_explosion(self.origin); + else + { + WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); + WriteByte (MSG_BROADCAST, TE_EXPLOSION); + WriteCoord (MSG_BROADCAST, self.origin_x); + WriteCoord (MSG_BROADCAST, self.origin_y); + WriteCoord (MSG_BROADCAST, self.origin_z); + } sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM); self.dimension_seen = DIMENSION_DEFAULT;