]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/unsafe.qh
Merge branch 'TimePath/globalforces' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / unsafe.qh
index e506ea51891d1137a8abb55a595a1a90c1065034..60ad3d88da517e11174910a1a1d5da29085b5b15 100644 (file)
@@ -1,13 +1,16 @@
 #pragma once
 
 #define reinterpret_cast(T, it) _unsafe_cast_##T(0, it)
-#define X(T) T _unsafe_cast_##T(int dummy, ...) { return ...(0, T); }
+#define X(T) \
+    T _unsafe_cast_##T(int dummy, ...) { return ...(0, T); } \
+    USING(T##_fld, .T); T##_fld _unsafe_cast_##T##_fld(int dummy, ...) { return ...(0, T##_fld); }
 X(bool)
 X(int)
 X(float)
+X(vector)
 X(entity)
 X(string)
-typedef float(...) rawfunc;
+USING(rawfunc, float(...));
 X(rawfunc)
 #undef X
 
@@ -24,3 +27,5 @@ STATIC_INIT(INTEGER_ONE)
 {
     INTEGER_ONE = reinterpret_cast(int, _unsafe_fld2) - reinterpret_cast(int, _unsafe_fld1);
 }
+
+#define ARRAY_INDEX(T, arr, idx) (reinterpret_cast(T##_fld, reinterpret_cast(int, arr[0]) + FTOI(idx)))