Skip to content

Commit

Permalink
Only send baseline/static scales when using PROTOCOL_RMQ
Browse files Browse the repository at this point in the history
  • Loading branch information
temx authored and sezero committed Sep 5, 2022
1 parent 6bff956 commit 239ec66
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
22 changes: 12 additions & 10 deletions Quake/pr_cmds.c
Expand Up @@ -1601,23 +1601,25 @@ 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)
bits |= B_LARGEFRAME;
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 (ent->scale != ENTSCALE_DEFAULT)
bits |= B_SCALE;
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 (bits)
Expand Down
2 changes: 1 addition & 1 deletion Quake/protocol.h
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion Quake/sv_main.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 239ec66

Please sign in to comment.