]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/_all.inc
Merge branch 'master' into martin-t/globals
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / _all.inc
index 136c4e7f6ffb4ff7b7dc4d56a50c62f2478c15db..3bbb17ccf8715ddfced52d63453e41e7f40cc3e2 100644 (file)
        #define bool float
 #endif
 
+#ifndef QCC_SUPPORT_ACCUMULATE
+       #warning "QCC does not support accumulate, may not compile correctly"
+       #define ACCUMULATE
+#else
+       #define ACCUMULATE [[accumulate]]
+#endif
+
+#ifndef QCC_SUPPORT_ERASEABLE
+       #define ERASEABLE
+#else
+       #define ERASEABLE [[eraseable]]
+#endif
+
+#ifndef QCC_SUPPORT_ALIAS
+    #warning "QCC does not support alias, may not compile correctly"
+    #define ALIAS(var)
+#else
+    #define ALIAS(var) [[alias(var)]]
+#endif
+
 #include <dpdefs/pre.qh>
 
 #if defined(CSQC)
 
 #include <dpdefs/post.qh>
 
+#ifndef QCC_SUPPORT_POW
+    #define pow(a, b) pow(a, b)
+#else
+    #define pow(a, b) ((a) ** (b))
+#endif
+
 #include "self.qh"
 
 #define USING(name, T) typedef T name
        MACRO_END
 #endif
 
-#define   is_float(this) (true || ftoe(this))
-#define isnt_float(this)
-#define   is_vector(this) (true || vtos(this))
-#define isnt_vector(this)
-#define   is_string(this) (true || stof(this))
-#define isnt_string(this)
-#define   is_entity(this) (true || etof(this))
-#define isnt_entity(this)
-bool      is_int(float this) { return this == floor(this); }
-void    isnt_int(float this) { print(ftos(this)); }
-bool      is_bool(float this) { return this == true || this == false; }
-void    isnt_bool(float this) { print(ftos(this)); }
+#if !(NDEBUG)
+       #define   is_float(this) (true || ftoe(this))
+       #define isnt_float(this)
+       #define   is_vector(this) (true || vtos(this))
+       #define isnt_vector(this)
+       #define   is_string(this) (true || stof(this))
+       #define isnt_string(this)
+       #define   is_entity(this) (true || etof(this))
+       #define isnt_entity(this)
+       bool      is_int(float this) { return this == floor(this); }
+       void    isnt_int(float this) { print(ftos(this)); }
+       bool      is_bool(float this) { return this == true || this == false; }
+       void    isnt_bool(float this) { print(ftos(this)); }
+#endif
 
 #include "warpzone/mathlib.qc"
 
@@ -84,9 +112,11 @@ void    isnt_bool(float this) { print(ftos(this)); }
 #include "counting.qh"
 #include "cvar.qh"
 #include "defer.qh"
+#include "deglobalization.qh"
 #include "draw.qh"
 #include "enumclass.qh"
 #include "file.qh"
+#include "float.qh"
 #include "functional.qh"
 #include "i18n.qh"
 #include "intrusivelist.qh"
@@ -105,6 +135,7 @@ void    isnt_bool(float this) { print(ftos(this)); }
 #include "oo.qh"
 #include "p2mathlib.qc"
 #include "progname.qh"
+#include "promise.qc"
 #include "random.qc"
 #include "registry.qh"
 #include "registry_net.qh"
@@ -133,14 +164,14 @@ void make_safe_for_remove(entity this);
     #define objerror_safe(e) make_safe_for_remove(e)
 #endif
 
-#define objerror(this, msg) MACRO_BEGIN \
+#define objerror(this, msg) MACRO_BEGIN \
        LOG_WARN("======OBJECT ERROR======"); \
        entity _e = (this); \
        eprint(_e); \
        objerror_safe(_e); \
        delete(_e); \
        LOG_WARNF("%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information", PROGNAME, __FUNC__, msg); \
-MACRO_END
+MACRO_END
 
 #ifdef MENUQC
        void _m_init();
@@ -174,7 +205,17 @@ void make_safe_for_remove(entity this);
        #define SV_Shutdown _SV_Shutdown
 
        void _StartFrame();
-       void StartFrame() { if (_StartFrame) _StartFrame(); }
+       bool _StartFrame_init;
+       void spawnfunc_worldspawn(entity);
+       void StartFrame() {
+               if (!_StartFrame_init) {
+                       _StartFrame_init = true;
+                       float oldtime = time; time = 1;
+                       __spawnfunc_expecting = 2; NULL.__spawnfunc_constructor(NULL);
+                       time = oldtime;
+        }
+        if (_StartFrame) _StartFrame();
+       }
        #define StartFrame _StartFrame
 
        void _SetNewParms();
@@ -223,7 +264,8 @@ void make_safe_for_remove(entity this);
        void SV_OnEntityPreSpawnFunction()
        {
                ENGINE_EVENT();
-               if (_SV_OnEntityPreSpawnFunction) _SV_OnEntityPreSpawnFunction(this);
+               __spawnfunc_expecting = true;
+               __spawnfunc_expect = this;
        }
        #define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction