]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use macros for the vector reading functions
authorMario <mario@smbclan.net>
Tue, 8 Mar 2016 11:42:31 +0000 (21:42 +1000)
committerMario <mario@smbclan.net>
Tue, 8 Mar 2016 11:42:31 +0000 (21:42 +1000)
qcsrc/common/util.qh
qcsrc/lib/net.qh

index fd5c888893959c10879ce42cfab80248e54e4853..4f5bbef61d8a9208bcd80de17bb6af02acc65d6c 100644 (file)
@@ -159,8 +159,6 @@ string getcurrentmod();
 #ifndef MENUQC
 #ifdef CSQC
 int ReadInt24_t();
-vector ReadInt48_t();
-vector ReadInt72_t();
 #else
 void WriteInt24_t(float dest, float val);
 void WriteInt48_t(float dest, vector val);
index b0320eadb13f3e006fa72f0f301378dfac24ffb9..7ac732f8b65b451608897f313fdd996d32b4bcb4 100644 (file)
@@ -265,28 +265,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()
                {