X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Flib%2F_all.inc;h=d44c5e89cdda2acacbd1b615bfbc55dc8bb93b9f;hb=35b5d15a47d8e309396453c03e36ac717789c600;hp=61755fe94322e1d360390792823fcb0d9ed77d6e;hpb=fc15d72b041c9a748b605ba28735380fbe5b5b01;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index 61755fe94..d44c5e89c 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -2,6 +2,18 @@ #define COMPAT_NO_MOD_IS_XONOTIC #endif +#ifdef CSQC +#define IS_CSQC 1 +#else +#define IS_CSQC 0 +#endif + +#ifdef SVQC +#define IS_SVQC 1 +#else +#define IS_SVQC 0 +#endif + #include "compiler.qh" #ifndef QCC_SUPPORT_INT @@ -12,6 +24,12 @@ #define bool float #endif +#ifndef QCC_SUPPORT_ERASEABLE + #define ERASEABLE +#else + #define ERASEABLE [[eraseable]] +#endif + #include #if defined(CSQC) @@ -43,24 +61,26 @@ #else #define TC(T, sym) MACRO_BEGIN \ if (!is_##T(sym)) { \ - LOG_WARNINGF("Type check failed: " #sym " :: " #T); \ + LOG_WARNF("Type check failed: " #sym " :: " #T); \ isnt_##T(sym); \ } \ 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" @@ -77,6 +97,7 @@ void isnt_bool(float this) { print(ftos(this)); } #include "file.qh" #include "functional.qh" #include "i18n.qh" +#include "intrusivelist.qh" #include "iter.qh" #include "json.qc" #include "lazy.qh" @@ -109,7 +130,25 @@ void isnt_bool(float this) { print(ftos(this)); } #include "vector.qh" #include "yenc.qh" -#include "matrix/_mod.inc" +#if XONOTIC + #include "matrix/_mod.inc" +#endif + +#ifndef SVQC +#define objerror_safe(e) +#else +void make_safe_for_remove(entity this); + #define objerror_safe(e) make_safe_for_remove(e) +#endif + +#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 #ifdef MENUQC void _m_init(); @@ -143,7 +182,17 @@ void isnt_bool(float this) { print(ftos(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(); @@ -154,6 +203,12 @@ void isnt_bool(float this) { print(ftos(this)); } void SetChangeParms() { ENGINE_EVENT(); if (_SetChangeParms) _SetChangeParms(this); } #define SetChangeParms _SetChangeParms +#ifdef DP_EXT_PRECONNECT + void _ClientPreConnect(entity this); + void ClientPreConnect() { ENGINE_EVENT(); if (_ClientPreConnect) _ClientPreConnect(this); } + #define ClientPreConnect _ClientPreConnect +#endif + void _ClientConnect(entity this); void ClientConnect() { ENGINE_EVENT(); if (_ClientConnect) _ClientConnect(this); } #define ClientConnect _ClientConnect @@ -186,7 +241,8 @@ void isnt_bool(float this) { print(ftos(this)); } void SV_OnEntityPreSpawnFunction() { ENGINE_EVENT(); - if (_SV_OnEntityPreSpawnFunction) _SV_OnEntityPreSpawnFunction(this); + __spawnfunc_expecting = true; + __spawnfunc_expect = this; } #define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction @@ -236,3 +292,9 @@ void isnt_bool(float this) { print(ftos(this)); } #define CSQC_Ent_Remove _CSQC_Ent_Remove #endif #undef ENGINE_EVENT + +#if XONOTIC +#ifdef GAMEQC + #include +#endif +#endif