X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Flib%2Fnet.qh;h=03e5c9dd8941d6a1143effdf28ce3290638f9333;hb=d271f27a5ac351a3a7b39636932f6d661492be1d;hp=81f126b74fd86e7e9c0f48d4f6651adbc10329ae;hpb=446aed55e6fb9668f5094100de43c76c38e8cce7;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 81f126b74..03e5c9dd8 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -41,7 +41,7 @@ STATIC_INIT(RegisterTempEntities_renumber) { FOREACH(TempEntities, true, it.m_id #define REGISTER_NET_LINKED(id) \ [[accumulate]] NET_HANDLE(id, bool isnew) \ { \ - this = self; \ + this = __self; \ this.sourceLoc = __FILE__ ":" STR(__LINE__); \ if (!this) isnew = true; \ } \ @@ -101,13 +101,13 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } /** return false to remove from the client */ .bool(entity this, entity to, int sendflags) SendEntity3; - bool SendEntity_self(entity to, int sendflags) { return self.SendEntity3(self, to, sendflags); } + bool SendEntity_self(entity to, int sendflags) { SELFPARAM(); return this.SendEntity3(this, to, sendflags); } void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc) { if (e.classname == "") e.classname = "net_linked"; - if (e.model == "" || self.modelindex == 0) + if (e.model == "" || e.modelindex == 0) { vector mi = e.mins; vector ma = e.maxs; @@ -145,9 +145,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } void UncustomizeEntitiesRun() { - FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, LAMBDA( - WITH(entity, self, it, it.uncustomizeentityforclient()); - )); + FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITHSELF(it, it.uncustomizeentityforclient())); } STRING_ITERATOR(g_buf, string_null, 0); @@ -265,28 +263,14 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } v += ReadByte(); // note: this is unsigned return v; } - vector ReadInt48_t() - { - vector v; - v.x = ReadInt24_t(); - v.y = ReadInt24_t(); - v.z = 0; - return v; - } - vector ReadInt72_t() - { - vector v; - v.x = ReadInt24_t(); - v.y = ReadInt24_t(); - v.z = ReadInt24_t(); - return v; - } + #define ReadInt48_t() vec3(ReadInt24_t(), ReadInt24_t(), 0) + #define ReadInt72_t() vec3(ReadInt24_t(), ReadInt24_t(), ReadInt24_t()) int _ReadSByte; #define ReadSByte() (_ReadSByte = ReadByte(), (_ReadSByte & BIT(7) ? -128 : 0) + (_ReadSByte & BITS(7))) #define ReadFloat() ReadCoord() - vector ReadVector() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = ReadFloat(); return v; } - vector ReadVector2D() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = 0; return v; } + #define ReadVector() vec3(ReadFloat(), ReadFloat(), ReadFloat()) + #define ReadVector2D() vec3(ReadFloat(), ReadFloat(), 0) float ReadApproxPastTime() {