From fad209b4dffad1902c1a6f949419ff7937c60cc9 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 15 Mar 2021 18:36:22 +0100 Subject: [PATCH] Rearrange csqcmodel settings bitflags to free up some bits without increasing networked data --- qcsrc/common/csqcmodel_settings.qh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index 6838f4ca0..a65617b3c 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -39,14 +39,23 @@ #endif // add properties you want networked to CSQC here +// NOTE: some properties share the same flag due to the limited number of bits (24) we can use +// generally the grouped ones are cheap (1 byte and less frequently networked) #define CSQCMODEL_EXTRAPROPERTIES \ CSQCMODEL_PROPERTY(BIT(0), int, ReadShort, WriteShort, colormap) \ CSQCMODEL_PROPERTY(BIT(1), int, ReadInt24_t, WriteInt24_t, effects) \ CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, modelflags) \ + CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, skin) \ + CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, traileffect) \ + CSQCMODEL_PROPERTY(BIT(3), int, ReadByte, WriteByte, move_movetype) \ CSQCMODEL_PROPERTY_SCALED(BIT(3), float, ReadByte, WriteByte, ALPHA, 254, -1, 254) /* NOTE: update the use of this in cl_model.qc if you change the bitflag number! */ \ - CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, skin) \ + CSQCMODEL_PROPERTY(BIT(3), float, ReadByte, WriteByte, solid) \ + CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, multijump_count) \ + CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, clipgroup) \ CSQCMODEL_PROPERTY(BIT(5), float, ReadApproxPastTime, WriteApproxPastTime, death_time) \ - CSQCMODEL_PROPERTY(BIT(6), float, ReadByte, WriteByte, solid) \ + CSQCMODEL_IF(isplayer) \ + CSQCMODEL_PROPERTY(BIT(6), GROUNDENTITY_TYPE, ReadShort, WriteEntity, GROUNDENTITY_NAME) \ + CSQCMODEL_ENDIF \ CSQCMODEL_IF(!isplayer) \ CSQCMODEL_PROPERTY(BIT(7), TAG_ENTITY_TYPE, ReadShort, WriteEntity, TAG_ENTITY_NAME) \ CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_x, 254, -1, 254) \ @@ -67,18 +76,13 @@ CSQCMODEL_PROPERTY(BIT(9), float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \ CSQCMODEL_ENDIF \ CSQCMODEL_PROPERTY(BIT(10), float, ReadAngle, WriteAngle, v_angle_x) \ - CSQCMODEL_PROPERTY(BIT(11), int, ReadByte, WriteByte, traileffect) \ + /*-- BIT(11) available --*/ \ CSQCMODEL_PROPERTY(BIT(12), float, ReadCoord, WriteCoord, scale) \ CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \ CSQCMODEL_PROPERTY(BIT(14), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) /* NOTE: update the use of this in cl_model.qc if you change the bitflag number! */ \ - /* bit 15 should NOT be reused, it is large enough sending the model's hitbox vectors! */ \ - CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, multijump_count) \ - CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, move_movetype) \ - CSQCMODEL_IF(isplayer) \ - CSQCMODEL_PROPERTY(BIT(17), GROUNDENTITY_TYPE, ReadShort, WriteEntity, GROUNDENTITY_NAME) \ - CSQCMODEL_ENDIF \ - CSQCMODEL_PROPERTY(BIT(17), int, ReadByte, WriteByte, clipgroup) + /**/ // NOTE: bits above 15 are defined in lib/csqcmodel/common.qh, avoid reusing them if possible +// in particular bit 15 should NOT be reused, it is large enough sending the model's hitbox vectors! // TODO get rid of colormod/glowmod here; also get rid of some useless properties on non-players that only exist for CopyBody // add hook function calls here -- 2.39.2