From: Mario Date: Fri, 23 Jan 2015 05:08:11 +0000 (+1100) Subject: Move TRUE and FALSE definitions to util-pre.qh and hide them under a definition check... X-Git-Tag: xonotic-v0.8.1~133^2~60 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=57d8600929c6c07cd22e75323d791d483709c1b3;p=xonotic%2Fxonotic-data.pk3dir.git Move TRUE and FALSE definitions to util-pre.qh and hide them under a definition check for bool support --- diff --git a/qcsrc/client/csqc_constants.qc b/qcsrc/client/csqc_constants.qc index 4d966476f..919fbc768 100644 --- a/qcsrc/client/csqc_constants.qc +++ b/qcsrc/client/csqc_constants.qc @@ -49,12 +49,6 @@ const float CONTENT_SLIME = -4; const float CONTENT_LAVA = -5; const float CONTENT_SKY = -6; -// Boolean Constants -const float true = 1; -const float false = 0; -const float TRUE = 1; -const float FALSE = 0; - // Vector / Hull Constants const vector VEC_1 = '1 1 1'; const vector VEC_0 = '0 0 0'; diff --git a/qcsrc/common/util-pre.qh b/qcsrc/common/util-pre.qh index 634b0fdf1..6e2cffa30 100644 --- a/qcsrc/common/util-pre.qh +++ b/qcsrc/common/util-pre.qh @@ -1,3 +1,17 @@ #ifndef NOCOMPAT # define COMPAT_NO_MOD_IS_XONOTIC #endif + +#ifndef QCC_SUPPORT_INT +#define int float +#endif + +#ifndef QCC_SUPPORT_BOOL +#define bool float + +// Boolean Constants +const float true = 1; +const float false = 0; +const float TRUE = 1; +const float FALSE = 0; +#endif diff --git a/qcsrc/dpdefs/csprogsdefs.qc b/qcsrc/dpdefs/csprogsdefs.qc index 8f4ec8b41..50586fcc8 100644 --- a/qcsrc/dpdefs/csprogsdefs.qc +++ b/qcsrc/dpdefs/csprogsdefs.qc @@ -253,12 +253,6 @@ const float MOVE_NORMAL = 0; const float MOVE_NOMONSTERS = 1; const float MOVE_MISSILE = 2; -// Boolean Constants -const float true = 1; -const float false = 0; -const float TRUE = 1; -const float FALSE = 0; - const float EXTRA_LOW = -99999999; const float EXTRA_HIGH = 99999999; @@ -393,7 +387,7 @@ string(entity ent) etos = #65; string(string s) precache_file = #68; void(entity e) makestatic = #69; -void(string var, string val) cvar_set = #72; +void(string name, string value) cvar_set = #72; void(vector pos, string samp, float vol, float atten) ambientsound = #74; string(string s) precache_model2 = #75; diff --git a/qcsrc/dpdefs/menudefs.qc b/qcsrc/dpdefs/menudefs.qc index 0d6c25370..58a2ef585 100644 --- a/qcsrc/dpdefs/menudefs.qc +++ b/qcsrc/dpdefs/menudefs.qc @@ -37,18 +37,6 @@ float FILE_READ = 0; float FILE_APPEND = 1; float FILE_WRITE = 2; -/////////////////////////// -// logical constants (just for completeness) - -float TRUE = 1; -float FALSE = 0; - -/////////////////////////// -// boolean constants - -float true = 1; -float false = 0; - /////////////////////////// // msg constants diff --git a/qcsrc/dpdefs/progsdefs.qc b/qcsrc/dpdefs/progsdefs.qc index 2ccd84314..c25d4ef45 100644 --- a/qcsrc/dpdefs/progsdefs.qc +++ b/qcsrc/dpdefs/progsdefs.qc @@ -225,9 +225,6 @@ void end_sys_fields; // flag for structure dumping // constants // -float FALSE = 0; -float TRUE = 1; - // edict.flags float FL_FLY = 1; float FL_SWIM = 2; @@ -490,7 +487,7 @@ void(string s) changelevel = #70; //#71 was removed -void(string var, string val) cvar_set = #72; // sets cvar.value +void(string name, string value) cvar_set = #72; // sets cvar.value void(entity client, string s, ...) centerprint = #73; // sprint, but in middle diff --git a/qcsrc/server/sys-post.qh b/qcsrc/server/sys-post.qh index 9c389da43..10b1abcef 100644 --- a/qcsrc/server/sys-post.qh +++ b/qcsrc/server/sys-post.qh @@ -9,6 +9,6 @@ #undef cvar_string #undef cvar -var float(string var) cvar; -var string(string var) cvar_string; -var void(string var, string val) cvar_set; +var float(string name) cvar; +var string(string name) cvar_string; +var void(string name, string value) cvar_set; diff --git a/qcsrc/warpzonelib/mathlib.qh b/qcsrc/warpzonelib/mathlib.qh index 9c8b969fb..18d402a36 100644 --- a/qcsrc/warpzonelib/mathlib.qh +++ b/qcsrc/warpzonelib/mathlib.qh @@ -3,8 +3,6 @@ // The commented-out functions need no implementation because DarkPlaces offers // them as builtins. They are listed here anyway for completeness sake. -#define int float - #define FP_NAN 0 #define FP_INFINITE 1 #define FP_ZERO 2