From: Mario Date: Fri, 1 Jul 2022 15:48:18 +0000 (+1000) Subject: Remove the wrapper around SendEntity and use it directly X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=49b9f996ac49505c050e6efac028eace611f3d17;p=xonotic%2Fxonotic-data.pk3dir.git Remove the wrapper around SendEntity and use it directly --- diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 5648d7982..7f44a959d 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -1,6 +1,7 @@ #pragma once #include "registry.qh" +#include "self.qh" #include "sort.qh" #include "yenc.qh" @@ -111,10 +112,19 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } const int MSG_ENTITY = 5; .int SendFlags; + .bool(entity this, int sendflags) SendEntity; 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, to, sendflags); + } + void Net_LinkEntity(entity e, bool docull, bool checkmodel, float dt, bool(entity this, entity to, int sendflags) sendfunc) { if (e.classname == "") @@ -131,7 +141,8 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } setsize(e, mi, ma); } - setSendEntity(e, sendfunc); + e.net_sendentity = sendfunc; + e.SendEntity = Net_SendEntity; e.SendFlags = 0xFFFFFF; if (!docull) e.effects |= EF_NODEPTHTEST; @@ -145,7 +156,8 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } void Net_UnlinkEntity(entity e) { - setSendEntity(e, func_null); + e.net_sendentity = func_null; + e.SendEntity = func_null; } .void(entity this) uncustomizeentityforclient; diff --git a/qcsrc/lib/self.qh b/qcsrc/lib/self.qh index d5ddf202d..2e10a37c8 100644 --- a/qcsrc/lib/self.qh +++ b/qcsrc/lib/self.qh @@ -92,10 +92,13 @@ 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__))