REGISTRY_CHECK(EntCSProps)
STATIC_INIT(RegisterEntCSProps_renumber) { FOREACH(EntCSProps, true, it.m_id = i); }
+// these entcs_props ids need to be referenced directly
+int ENTCS_PROP_ENTNUM_id = 0;
+int ENTCS_PROP_ORIGIN_id = 0;
+STATIC_INIT(RegisterEntCSProps_setglobalids)
+{
+ FOREACH(EntCSProps, true, {
+ if (it.registered_id == "ENTCS_PROP_ENTNUM")
+ ENTCS_PROP_ENTNUM_id = it.m_id;
+ if (it.registered_id == "ENTCS_PROP_ORIGIN")
+ ENTCS_PROP_ORIGIN_id = it.m_id;
+ });
+}
+
+#ifdef SVQC
+// Force an origin update, for player sounds
+void entcs_force_origin(entity player)
+{
+ CS(player).entcs.m_forceupdate = BIT(ENTCS_PROP_ORIGIN_id);
+}
+#endif
+
.bool m_public;
.bool(entity ent, entity player) m_check;
.void(entity ent, entity player) m_set;
#define ENTCS_PROP_CODED(id, ispublic, checkprop, setprop, decfactor, svsend, clreceive) \
bool id##_check(entity ent, entity player) { \
- return (floor(ent.(checkprop)) / decfactor != floor(player.(checkprop)) * decfactor); \
+ return (floor(ent.(checkprop)) / decfactor != floor(player.(checkprop)) / decfactor); \
} \
_ENTCS_PROP(id, ispublic, checkprop, setprop, svsend, clreceive)
bool _entcs_send(entity this, entity to, int sf, int chan)
{
entity player = this.owner;
- sf |= BIT(0); // assume private
+ sf |= BIT(ENTCS_PROP_ENTNUM_id); // assume private
do {
if (IS_PLAYER(player))
{
e.sv_entnum = n;
int sf = ReadShort();
e.has_sv_origin = false;
- e.m_entcs_private = boolean(sf & BIT(0));
+ e.m_entcs_private = boolean(sf & BIT(ENTCS_PROP_ENTNUM_id));
FOREACH(EntCSProps, sf & BIT(it.m_id),
{
it.m_receive(e);