]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove the wrapper around SendEntity and use it directly
authorMario <mario.mario@y7mail.com>
Fri, 1 Jul 2022 15:48:18 +0000 (01:48 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 1 Jul 2022 15:48:18 +0000 (01:48 +1000)
qcsrc/lib/net.qh
qcsrc/lib/self.qh

index 5648d79829db052609e2e9f96e347089e9e3ac27..7f44a959d866161dc2443755aa97c138c5c43166 100644 (file)
@@ -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;
index d5ddf202d43b93573ef4d6af6ac927ca6bb9a43a..2e10a37c88faa6eaed811afce851da186e2be732 100644 (file)
@@ -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__))