From: Mario Date: Sun, 25 Sep 2022 13:47:12 +0000 (+1000) Subject: Revert boilerplate net_sendentity handling, keep Net_LinkEntity added parameter so... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3c33f03f6690f35884f55cdda3e56b0e6e5ca4e6;p=xonotic%2Fxonotic-data.pk3dir.git Revert boilerplate net_sendentity handling, keep Net_LinkEntity added parameter so that it can be used everywhere --- diff --git a/qcsrc/common/mapobjects/subs.qc b/qcsrc/common/mapobjects/subs.qc index a7e7c3edb..c0b137404 100644 --- a/qcsrc/common/mapobjects/subs.qc +++ b/qcsrc/common/mapobjects/subs.qc @@ -512,7 +512,7 @@ void LODmodel_attach(entity this) } if(this.lodmodelindex1) - if (!this.net_sendentity) + if (!getSendEntity(this)) SetCustomizer(this, LOD_customize, LOD_uncustomize); } diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 842af0a2b..a1be9aa06 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -117,14 +117,6 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } IntrusiveList g_uncustomizables; STATIC_INIT(g_uncustomizables) { g_uncustomizables = IL_NEW(); } - .bool(entity this, entity to, int sendflags) net_sendentity; - - bool Net_SendEntity(entity to, int sendflags) - { - ENGINE_EVENT(); - return (this.net_sendentity) ? this.net_sendentity(this, to, sendflags) : false; - } - void Net_LinkEntity(entity e, bool docull, bool checkmodel, float dt, bool(entity this, entity to, int sendflags) sendfunc) { if (e.classname == "") @@ -141,8 +133,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } setsize(e, mi, ma); } - e.net_sendentity = sendfunc; - e.SendEntity = Net_SendEntity; + setSendEntity(e, sendfunc); e.SendFlags = 0xFFFFFF; if (!docull) e.effects |= EF_NODEPTHTEST; @@ -156,8 +147,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } void Net_UnlinkEntity(entity e) { - e.net_sendentity = func_null; - e.SendEntity = func_null; + setSendEntity(e, func_null); } .void(entity this) uncustomizeentityforclient; diff --git a/qcsrc/lib/self.qh b/qcsrc/lib/self.qh index 2e10a37c8..d5ddf202d 100644 --- a/qcsrc/lib/self.qh +++ b/qcsrc/lib/self.qh @@ -92,13 +92,10 @@ SELFWRAP(customizeentityforclient, bool, (), (entity this, entity client), (this SELFWRAP(camera_transform, vector, (vector org, vector ang), (entity this, vector org, vector ang), (this, org, ang)) #define setcamera_transform(e, f) SELFWRAP_SET(camera_transform, e, f) -// NOTE: still references self via ENGINE_EVENT -#if 0 /** return false to remove from the client */ SELFWRAP(SendEntity, bool, (entity to, int sendflags), (entity this, entity to, int sendflags), (this, to, sendflags)) #define setSendEntity(e, f) SELFWRAP_SET(SendEntity, e, f) #define getSendEntity(e) SELFWRAP_GET(SendEntity, e) -#endif #define ChangeYaw(e, ...) (__self = (e), builtin_ChangeYaw(__VA_ARGS__)) #define checkclient(e, ...) (__self = (e), builtin_checkclient(__VA_ARGS__)) diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index b0eac54f5..7d1c46f3f 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -91,7 +91,7 @@ void ItemUpdate(entity this) void UpdateItemAfterTeleport(entity this) { - if(this.net_sendentity == ItemSend) + if(getSendEntity(this) == ItemSend) ItemUpdate(this); } diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index 6c3addcc0..7170d3ed6 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -98,13 +98,13 @@ void CSQCProjectile(entity e, float clientanimate, int type, float docull) void UpdateCSQCProjectile(entity e) { - if(e.net_sendentity == CSQCProjectile_SendEntity) + if(getSendEntity(e) == CSQCProjectile_SendEntity) { // send new origin data e.SendFlags |= 0x01; } // FIXME HACK - else if(e.net_sendentity == ItemSend) + else if(getSendEntity(e) == ItemSend) { ItemUpdate(e); } @@ -113,7 +113,7 @@ void UpdateCSQCProjectile(entity e) void UpdateCSQCProjectileAfterTeleport(entity e) { - if(e.net_sendentity == CSQCProjectile_SendEntity) + if(getSendEntity(e) == CSQCProjectile_SendEntity) { // send new origin data e.SendFlags |= 0x01;