From 239ec6623369a55e14b83ef100fd638abc3b875c Mon Sep 17 00:00:00 2001 From: temx Date: Mon, 5 Sep 2022 23:56:30 +0300 Subject: [PATCH] Only send baseline/static scales when using PROTOCOL_RMQ --- Quake/pr_cmds.c | 20 +++++++++++--------- Quake/protocol.h | 2 +- Quake/sv_main.c | 9 ++++++++- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Quake/pr_cmds.c b/Quake/pr_cmds.c index a861ade1..4f33758f 100644 --- a/Quake/pr_cmds.c +++ b/Quake/pr_cmds.c @@ -1601,8 +1601,6 @@ static void PF_makestatic (void) } else { - eval_t *val; - if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00) bits |= B_LARGEMODEL; if ((int)(ent->v.frame) & 0xFF00) @@ -1610,14 +1608,18 @@ static void PF_makestatic (void) if (ent->alpha != ENTALPHA_DEFAULT) bits |= B_ALPHA; - val = GetEdictFieldValue(ent, "scale"); - if (val) - ent->scale = ENTSCALE_ENCODE(val->_float); - else - ent->scale = ENTSCALE_DEFAULT; + if (sv.protocol == PROTOCOL_RMQ) + { + eval_t* val; + val = GetEdictFieldValue(ent, "scale"); + if (val) + ent->scale = ENTSCALE_ENCODE(val->_float); + else + ent->scale = ENTSCALE_DEFAULT; - if (ent->scale != ENTSCALE_DEFAULT) - bits |= B_SCALE; + if (ent->scale != ENTSCALE_DEFAULT) + bits |= B_SCALE; + } } if (bits) diff --git a/Quake/protocol.h b/Quake/protocol.h index 06ab1b19..d645ab45 100644 --- a/Quake/protocol.h +++ b/Quake/protocol.h @@ -63,7 +63,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define U_FRAME2 (1<<17) // 1 byte, this is .frame & 0xFF00 (second byte) #define U_MODEL2 (1<<18) // 1 byte, this is .modelindex & 0xFF00 (second byte) #define U_LERPFINISH (1<<19) // 1 byte, 0.0-1.0 maps to 0-255, not sent if exactly 0.1, this is ent->v.nextthink - sv.time, used for lerping -#define U_SCALE (1<<20) // 1 byte, for PROTOCOL_RMQ PRFL_EDICTSCALE, currently read but ignored +#define U_SCALE (1<<20) // 1 byte, for PROTOCOL_RMQ PRFL_EDICTSCALE #define U_UNUSED21 (1<<21) #define U_UNUSED22 (1<<22) #define U_EXTEND2 (1<<23) // another byte to follow, future expansion diff --git a/Quake/sv_main.c b/Quake/sv_main.c index 4eebaef6..5e2e55bd 100644 --- a/Quake/sv_main.c +++ b/Quake/sv_main.c @@ -641,7 +641,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) // johnfitz -- max size for protocol 15 is 18 bytes, not 16 as originally // assumed here. And, for protocol 85 the max size is actually 24 bytes. - // For float coords and angles the limit is 40. + // For float coords and angles the limit is 40. // FIXME: Use tighter limit according to protocol flags and send bits. if (msg->cursize + 40 > msg->maxsize) { @@ -1248,6 +1248,13 @@ void SV_CreateBaseline (void) svent->baseline.modelindex = SV_ModelIndex(PR_GetString(svent->v.model)); svent->baseline.alpha = svent->alpha; //johnfitz -- alpha support svent->baseline.scale = ENTSCALE_DEFAULT; + if (sv.protocol == PROTOCOL_RMQ) + { + eval_t* val; + val = GetEdictFieldValue(svent, "scale"); + if (val) + svent->baseline.scale = ENTSCALE_ENCODE(val->_float); + } } //johnfitz -- PROTOCOL_FITZQUAKE