Uncrustify lib/*
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 27 Oct 2015 01:06:10 +0000 (12:06 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 27 Oct 2015 01:06:34 +0000 (12:06 +1100)
46 files changed:
qcsrc/lib/_all.inc
qcsrc/lib/accumulate.qh
qcsrc/lib/bits.qh
qcsrc/lib/bool.qh
qcsrc/lib/color.qh
qcsrc/lib/compiler.qh
qcsrc/lib/counting.qh
qcsrc/lib/cvar.qh
qcsrc/lib/defer.qh
qcsrc/lib/draw.qh
qcsrc/lib/file.qh
qcsrc/lib/functional.qh
qcsrc/lib/i18n.qh
qcsrc/lib/int.qh
qcsrc/lib/iter.qh
qcsrc/lib/lazy.qh
qcsrc/lib/linkedlist.qh
qcsrc/lib/log.qh
qcsrc/lib/math.qh
qcsrc/lib/misc.qh
qcsrc/lib/net.qh
qcsrc/lib/nil.qh
qcsrc/lib/noise.qc
qcsrc/lib/oo.qh
qcsrc/lib/p2mathlib.qc
qcsrc/lib/p2mathlib.qh
qcsrc/lib/player.qh
qcsrc/lib/progname.qh
qcsrc/lib/random.qc
qcsrc/lib/random.qh
qcsrc/lib/registry.qh
qcsrc/lib/replicate.qh
qcsrc/lib/self.qh
qcsrc/lib/sort.qh
qcsrc/lib/sortlist.qc
qcsrc/lib/sortlist.qh
qcsrc/lib/spawnfunc.qh
qcsrc/lib/static.qh
qcsrc/lib/string.qh
qcsrc/lib/struct.qh
qcsrc/lib/test.qc
qcsrc/lib/test.qh
qcsrc/lib/urllib.qc
qcsrc/lib/urllib.qh
qcsrc/lib/vector.qh
qcsrc/uncrustify.cfg

index 9bc9ca2..5a6b739 100644 (file)
@@ -1,28 +1,28 @@
 #ifndef NOCOMPAT
-    #define COMPAT_NO_MOD_IS_XONOTIC
+       #define COMPAT_NO_MOD_IS_XONOTIC
 #endif
 
 #include "compiler.qh"
 
 #ifndef QCC_SUPPORT_INT
-    #define int float
+       #define int float
 #endif
 
 #ifndef QCC_SUPPORT_BOOL
-    #define bool float
+       #define bool float
 #endif
 
 #if defined(CSQC)
-    #include "../dpdefs/csprogsdefs.qh"
-    #include "../dpdefs/keycodes.qh"
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "../dpdefs/keycodes.qh"
 #elif defined(SVQC)
-    #include "../server/sys-pre.qh"
-    #include "../dpdefs/progsdefs.qh"
-    #include "../dpdefs/dpextensions.qh"
-    #include "../server/sys-post.qh"
+       #include "../server/sys-pre.qh"
+       #include "../dpdefs/progsdefs.qh"
+       #include "../dpdefs/dpextensions.qh"
+       #include "../server/sys-post.qh"
 #elif defined(MENUQC)
-    #include "../dpdefs/menudefs.qh"
-    #include "../dpdefs/keycodes.qh"
+       #include "../dpdefs/menudefs.qh"
+       #include "../dpdefs/keycodes.qh"
 #endif
 
 #include "warpzone/mathlib.qc"
index 7e1a1ed..a2f6714 100644 (file)
@@ -2,51 +2,56 @@
 #define ACCUMULATE_H
 
 #ifdef QCC_SUPPORT_ACCUMULATE
-# define ACCUMULATE_FUNCTION(func, otherfunc) \
-    [[accumulate]] void func() { otherfunc(); }
-# define CALL_ACCUMULATED_FUNCTION(func) \
-    func()
+       #define ACCUMULATE_FUNCTION(func, otherfunc) \
+               [[accumulate]] void func() \
+               { \
+                       otherfunc(); \
+               }
+       #define CALL_ACCUMULATED_FUNCTION(func) \
+               func()
 #else
-#ifdef HAVE_YO_DAWG_CPP
+       #ifdef HAVE_YO_DAWG_CPP
 // TODO make ascii art pic of xzibit
 // YO DAWG!
 // I HERD YO LIEK MACROS
 // SO I PUT A MACRO DEFINITION IN YO MACRO DEFINITION
 // SO YO CAN EXPAND MACROS WHILE YO EXPAND MACROS
-# define ACCUMULATE_FUNCTION(func,otherfunc) \
-    #ifdef func \
-    void __merge__##otherfunc() { func(); otherfunc(); } \
-    #undef func \
-    #define func __merge__##otherfunc \
-    #else \
-    #define func otherfunc \
-    #endif
-# define CALL_ACCUMULATED_FUNCTION(func) \
-    func()
-#else
-# define ACCUMULATE_FUNCTION(func,otherfunc) \
-    .float _ACCUMULATE_##func##__##otherfunc;
-void ACCUMULATE_call(string func)
-{
-    float i;
-    float n = numentityfields();
-    string funcprefix = strcat("_ACCUMULATE_", func, "__");
-    float funcprefixlen = strlen(funcprefix);
-    for(i = 0; i < n; ++i)
-    {
-        string name = entityfieldname(i);
-        if(substring(name, 0, funcprefixlen) == funcprefix)
-            callfunction(substring(name, funcprefixlen, -1));
-    }
-}
-# define CALL_ACCUMULATED_FUNCTION(func) \
-    ACCUMULATE_call(#func)
-#endif
+               #define ACCUMULATE_FUNCTION(func, otherfunc) \
+                       #ifdef func \
+                       void __merge__##otherfunc() \
+                       { \
+                               func(); otherfunc(); \
+                       } \
+                       #undef func \
+                       #define func __merge__##otherfunc \
+                       #else \
+                               #define func otherfunc \
+                               #endif
+               #define CALL_ACCUMULATED_FUNCTION(func) \
+                       func()
+       #else
+               #define ACCUMULATE_FUNCTION(func, otherfunc) \
+                       .float _ACCUMULATE_##func##__##otherfunc;
+               void ACCUMULATE_call(string func)
+               {
+                       float i;
+                       float n = numentityfields();
+                       string funcprefix = strcat("_ACCUMULATE_", func, "__");
+                       float funcprefixlen = strlen(funcprefix);
+                       for (i = 0; i < n; ++i)
+                       {
+                               string name = entityfieldname(i);
+                               if (substring(name, 0, funcprefixlen) == funcprefix) callfunction(substring(name, funcprefixlen, -1));
+                       }
+               }
+               #define CALL_ACCUMULATED_FUNCTION(func) \
+                       ACCUMULATE_call( #func)
+       #endif
 #endif
 
 // used for simplifying ACCUMULATE_FUNCTIONs
-#define SET_FIRST_OR_LAST(input,first,count) if(!input) { input = (first + count); }
-#define SET_FIELD_COUNT(field,first,count) if(!field) { field = (first + count); ++count; }
-#define CHECK_MAX_COUNT(name,max,count,type) if(count > max) { error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n")); }
+#define SET_FIRST_OR_LAST(input, first, count) if (!input) { input = (first + count); }
+#define SET_FIELD_COUNT(field, first, count) if (!field) { field = (first + count); ++count; }
+#define CHECK_MAX_COUNT(name, max, count, type) if (count > max) { error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n")); }
 
 #endif
index 86b5df5..33d719a 100644 (file)
@@ -4,19 +4,19 @@
 #define BIT(n) (1 << (n))
 #define BITS(n) (BIT(n) - 1)
 #ifndef BRANCHLESS_BITSET
-    #define BITSET(var, mask, flag) (flag ? (var) | (mask) : (var) &~ (mask))
+       #define BITSET(var, mask, flag) (flag ? (var) | (mask) : (var) & ~(mask))
 #else
-    #define BITSET(var, mask, flag) ((var) ^ (-(flag) ^ (var)) & (mask))
+       #define BITSET(var, mask, flag) ((var) ^ (-(flag) ^ (var)) & (mask))
 #endif
 
 int lowestbit(int f)
 {
-    f &= ~(f << 1);
-    f &= ~(f << 2);
-    f &= ~(f << 4);
-    f &= ~(f << 8);
-    f &= ~(f << 16);
-    return f;
+       f &= ~(f << 1);
+       f &= ~(f << 2);
+       f &= ~(f << 4);
+       f &= ~(f << 8);
+       f &= ~(f << 16);
+       return f;
 }
 
 #endif
index 7a719af..34e8bfc 100644 (file)
@@ -2,36 +2,34 @@
 #define BOOL_H
 
 #ifndef QCC_SUPPORT_BOOL
-    // Boolean Constants
-    const int true     = 1;
-    const int false = 0;
+       // Boolean Constants
+       const int true  = 1;
+       const int false = 0;
 #endif
 
 // Transitional aliases
-[[deprecated("use true")]] [[alias("true")]] const bool TRUE;
-[[deprecated("use false")]] [[alias("false")]] const bool FALSE;
+[[deprecated("use true")]][[alias("true")]] const bool TRUE;
+[[deprecated("use false")]][[alias("false")]] const bool FALSE;
 
 // get true/false value of a string with multiple different inputs
 float InterpretBoolean(string input)
 {
-    switch (strtolower(input))
-    {
-        case "yes":
-        case "true":
-        case "on":
-            return true;
+       switch (strtolower(input))
+       {
+               case "yes":
+               case "true":
+               case "on":
+                       return true;
 
-        case "no":
-        case "false":
-        case "off":
-            return false;
+               case "no":
+               case "false":
+               case "off":
+                       return false;
 
-        default: return stof(input);
-    }
+               default: return stof(input);
+       }
 }
 
-float boolean(float value) { // if value is 0 return false (0), otherwise return true (1)
-    return (value == 0) ? false : true;
-}
+#define boolean(value) ((value) != 0)
 
 #endif
index d21dab8..e1748a9 100644 (file)
@@ -4,35 +4,34 @@
 #define colormapPaletteColor(c, isPants) colormapPaletteColor_(c, isPants, time)
 vector colormapPaletteColor_(int c, bool isPants, float t)
 {
-    switch (c) {
-        case  0: return '1.000000 1.000000 1.000000';
-        case  1: return '1.000000 0.333333 0.000000';
-        case  2: return '0.000000 1.000000 0.501961';
-        case  3: return '0.000000 1.000000 0.000000';
-        case  4: return '1.000000 0.000000 0.000000';
-        case  5: return '0.000000 0.666667 1.000000';
-        case  6: return '0.000000 1.000000 1.000000';
-        case  7: return '0.501961 1.000000 0.000000';
-        case  8: return '0.501961 0.000000 1.000000';
-        case  9: return '1.000000 0.000000 1.000000';
-        case 10: return '1.000000 0.000000 0.501961';
-        case 11: return '0.000000 0.000000 1.000000';
-        case 12: return '1.000000 1.000000 0.000000';
-        case 13: return '0.000000 0.333333 1.000000';
-        case 14: return '1.000000 0.666667 0.000000';
-        case 15:
-            if (isPants)
-                return
-                      '1 0 0' * (0.502 + 0.498 * sin(t / 2.7182818285 + 0.0000000000))
-                    + '0 1 0' * (0.502 + 0.498 * sin(t / 2.7182818285 + 2.0943951024))
-                    + '0 0 1' * (0.502 + 0.498 * sin(t / 2.7182818285 + 4.1887902048));
-            else
-                return
-                      '1 0 0' * (0.502 + 0.498 * sin(t / 3.1415926536 + 5.2359877560))
-                    + '0 1 0' * (0.502 + 0.498 * sin(t / 3.1415926536 + 3.1415926536))
-                    + '0 0 1' * (0.502 + 0.498 * sin(t / 3.1415926536 + 1.0471975512));
-        default: return '0.000 0.000 0.000';
-    }
+       switch (c)
+       {
+               case  0: return '1.000000 1.000000 1.000000';
+               case  1: return '1.000000 0.333333 0.000000';
+               case  2: return '0.000000 1.000000 0.501961';
+               case  3: return '0.000000 1.000000 0.000000';
+               case  4: return '1.000000 0.000000 0.000000';
+               case  5: return '0.000000 0.666667 1.000000';
+               case  6: return '0.000000 1.000000 1.000000';
+               case  7: return '0.501961 1.000000 0.000000';
+               case  8: return '0.501961 0.000000 1.000000';
+               case  9: return '1.000000 0.000000 1.000000';
+               case 10: return '1.000000 0.000000 0.501961';
+               case 11: return '0.000000 0.000000 1.000000';
+               case 12: return '1.000000 1.000000 0.000000';
+               case 13: return '0.000000 0.333333 1.000000';
+               case 14: return '1.000000 0.666667 0.000000';
+               case 15:
+                       if (isPants)
+                               return '1 0 0' * (0.502 + 0.498 * sin(t / 2.7182818285 + 0.0000000000))
+                                      + '0 1 0' * (0.502 + 0.498 * sin(t / 2.7182818285 + 2.0943951024))
+                                      + '0 0 1' * (0.502 + 0.498 * sin(t / 2.7182818285 + 4.1887902048));
+                       else
+                               return '1 0 0' * (0.502 + 0.498 * sin(t / 3.1415926536 + 5.2359877560))
+                                      + '0 1 0' * (0.502 + 0.498 * sin(t / 3.1415926536 + 3.1415926536))
+                                      + '0 0 1' * (0.502 + 0.498 * sin(t / 3.1415926536 + 1.0471975512));
+               default: return '0.000 0.000 0.000';
+       }
 }
 
 #endif
index 69aad5c..d389248 100644 (file)
@@ -2,15 +2,15 @@
 #define COMPILER_H
 
 #ifndef QCC_SUPPORT_ACCUMULATE
-    #ifdef GMQCC
-        #define QCC_SUPPORT_ACCUMULATE
-    #endif
+       #ifdef GMQCC
+               #define QCC_SUPPORT_ACCUMULATE
+       #endif
 #endif
 
 #ifndef QCC_SUPPORT_NIL
-    #ifdef GMQCC
-        #define QCC_SUPPORT_NIL
-    #endif
+       #ifdef GMQCC
+               #define QCC_SUPPORT_NIL
+       #endif
 #endif
 
 #endif
index 81103a5..24ce56d 100644 (file)
@@ -7,54 +7,60 @@
 //  Time processing and counting functions/macros
 // ===============================================
 
-#define count_years_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s years")), ftos_decimals(time, decs))
-#define count_years(time) count_fill(time, \
-               ZCTX(_("CI_ZER^%d years")), /* zeroth */ \
-               ZCTX(_("CI_FIR^%d year")),  /* first */ \
-               ZCTX(_("CI_SEC^%d years")), /* year */ \
-               ZCTX(_("CI_THI^%d years")), /* third */ \
-               ZCTX(_("CI_MUL^%d years"))) /* multi */
-
-#define count_weeks_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s weeks")), ftos_decimals(time, decs))
-#define count_weeks(time) count_fill(time, \
-               ZCTX(_("CI_ZER^%d weeks")), /* zeroth */ \
-               ZCTX(_("CI_FIR^%d week")),  /* first */ \
-               ZCTX(_("CI_SEC^%d weeks")), /* week */ \
-               ZCTX(_("CI_THI^%d weeks")), /* third */ \
-               ZCTX(_("CI_MUL^%d weeks"))) /* multi */
-
-#define count_days_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s days")), ftos_decimals(time, decs))
-#define count_days(time) count_fill(time, \
-               ZCTX(_("CI_ZER^%d days")), /* zeroth */ \
-               ZCTX(_("CI_FIR^%d day")),  /* first */ \
-               ZCTX(_("CI_SEC^%d days")), /* day */ \
-               ZCTX(_("CI_THI^%d days")), /* third */ \
-               ZCTX(_("CI_MUL^%d days"))) /* multi */
-
-#define count_hours_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s hours")), ftos_decimals(time, decs))
-#define count_hours(time) count_fill(time, \
-               ZCTX(_("CI_ZER^%d hours")), /* zeroth */ \
-               ZCTX(_("CI_FIR^%d hour")),  /* first */ \
-               ZCTX(_("CI_SEC^%d hours")), /* hour */ \
-               ZCTX(_("CI_THI^%d hours")), /* third */ \
-               ZCTX(_("CI_MUL^%d hours"))) /* multi */
-
-
-#define count_minutes_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s minutes")), ftos_decimals(time, decs))
-#define count_minutes(time) count_fill(time, \
-               ZCTX(_("CI_ZER^%d minutes")), /* zeroth */ \
-               ZCTX(_("CI_FIR^%d minute")),  /* first */ \
-               ZCTX(_("CI_SEC^%d minutes")), /* minute */ \
-               ZCTX(_("CI_THI^%d minutes")), /* third */ \
-               ZCTX(_("CI_MUL^%d minutes"))) /* multi */
-
-#define count_seconds_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s seconds")), ftos_decimals(time, decs))
-#define count_seconds(time) count_fill(time, \
-               ZCTX(_("CI_ZER^%d seconds")), /* zeroth */ \
-               ZCTX(_("CI_FIR^%d second")),  /* first */ \
-               ZCTX(_("CI_SEC^%d seconds")), /* second */ \
-               ZCTX(_("CI_THI^%d seconds")), /* third */ \
-               ZCTX(_("CI_MUL^%d seconds"))) /* multi */
+#define count_years_decs(time, decs) sprintf(ZCTX(_("CI_DEC^%s years")), ftos_decimals(time, decs))
+#define count_years(time) \
+       count_fill(time, \
+       ZCTX(_("CI_ZER^%d years")), /* zeroth */ \
+       ZCTX(_("CI_FIR^%d year")),  /* first */ \
+       ZCTX(_("CI_SEC^%d years")), /* year */ \
+       ZCTX(_("CI_THI^%d years")), /* third */ \
+       ZCTX(_("CI_MUL^%d years"))) /* multi */
+
+#define count_weeks_decs(time, decs) sprintf(ZCTX(_("CI_DEC^%s weeks")), ftos_decimals(time, decs))
+#define count_weeks(time) \
+       count_fill(time, \
+       ZCTX(_("CI_ZER^%d weeks")), /* zeroth */ \
+       ZCTX(_("CI_FIR^%d week")),  /* first */ \
+       ZCTX(_("CI_SEC^%d weeks")), /* week */ \
+       ZCTX(_("CI_THI^%d weeks")), /* third */ \
+       ZCTX(_("CI_MUL^%d weeks"))) /* multi */
+
+#define count_days_decs(time, decs) sprintf(ZCTX(_("CI_DEC^%s days")), ftos_decimals(time, decs))
+#define count_days(time) \
+       count_fill(time, \
+       ZCTX(_("CI_ZER^%d days")), /* zeroth */ \
+       ZCTX(_("CI_FIR^%d day")),  /* first */ \
+       ZCTX(_("CI_SEC^%d days")), /* day */ \
+       ZCTX(_("CI_THI^%d days")), /* third */ \
+       ZCTX(_("CI_MUL^%d days"))) /* multi */
+
+#define count_hours_decs(time, decs) sprintf(ZCTX(_("CI_DEC^%s hours")), ftos_decimals(time, decs))
+#define count_hours(time) \
+       count_fill(time, \
+       ZCTX(_("CI_ZER^%d hours")), /* zeroth */ \
+       ZCTX(_("CI_FIR^%d hour")),  /* first */ \
+       ZCTX(_("CI_SEC^%d hours")), /* hour */ \
+       ZCTX(_("CI_THI^%d hours")), /* third */ \
+       ZCTX(_("CI_MUL^%d hours"))) /* multi */
+
+
+#define count_minutes_decs(time, decs) sprintf(ZCTX(_("CI_DEC^%s minutes")), ftos_decimals(time, decs))
+#define count_minutes(time) \
+       count_fill(time, \
+       ZCTX(_("CI_ZER^%d minutes")), /* zeroth */ \
+       ZCTX(_("CI_FIR^%d minute")),  /* first */ \
+       ZCTX(_("CI_SEC^%d minutes")), /* minute */ \
+       ZCTX(_("CI_THI^%d minutes")), /* third */ \
+       ZCTX(_("CI_MUL^%d minutes"))) /* multi */
+
+#define count_seconds_decs(time, decs) sprintf(ZCTX(_("CI_DEC^%s seconds")), ftos_decimals(time, decs))
+#define count_seconds(time) \
+       count_fill(time, \
+       ZCTX(_("CI_ZER^%d seconds")), /* zeroth */ \
+       ZCTX(_("CI_FIR^%d second")),  /* first */ \
+       ZCTX(_("CI_SEC^%d seconds")), /* second */ \
+       ZCTX(_("CI_THI^%d seconds")), /* third */ \
+       ZCTX(_("CI_MUL^%d seconds"))) /* multi */
 
 string count_ordinal(int interval)
 {
@@ -65,10 +71,10 @@ string count_ordinal(int interval)
        // Basically, it just allows you to represent a number or count in different ways
        // depending on the number... like, with count_ordinal you can provide integers
        // and retrieve 1st, 2nd, 3rd, nth ordinal numbers in a clean and simple way.
-       if(floor((interval % 100)/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block
+       if (floor((interval % 100) / 10) * 10 != 10)  // examples: 12th, 111th, 213th will not execute this block
        {
                // otherwise, check normally for 1st,2nd,3rd insertions
-               switch(interval % 10)
+               switch (interval % 10)
                {
                        case 1: return sprintf(_("%dst"), interval);
                        case 2: return sprintf(_("%dnd"), interval);
@@ -95,15 +101,14 @@ string count_fill(float interval, string zeroth, string first, string second, st
        //   3 seconds
        //   etc... minutes, hours, days, etc.
 
-       switch(floor(interval))
+       switch (floor(interval))
        {
                case 0: return sprintf(zeroth, interval);
                case 1:
                {
-                       if(interval == 1) // EXACTLY value of 1
+                       if (interval == 1)  // EXACTLY value of 1
                                return sprintf(first, interval);
-                       else
-                               return sprintf(multi, interval);
+                       else return sprintf(multi, interval);
                }
                case 2: return sprintf(second, interval);
                case 3: return sprintf(third, interval);
@@ -119,26 +124,26 @@ string process_time(float outputtype, float seconds)
 
        tmp_seconds = floor(seconds);
 
-       if(tmp_seconds)
+       if (tmp_seconds)
        {
                tmp_minutes = floor(tmp_seconds / 60);
 
-               if(tmp_minutes)
+               if (tmp_minutes)
                {
                        tmp_seconds -= (tmp_minutes * 60);
                        tmp_hours = floor(tmp_minutes / 60);
 
-                       if(tmp_hours)
+                       if (tmp_hours)
                        {
                                tmp_minutes -= (tmp_hours * 60);
                                tmp_days = floor(tmp_hours / 24);
 
-                               if(tmp_days)
+                               if (tmp_days)
                                {
                                        tmp_hours -= (tmp_days * 24);
                                        tmp_weeks = floor(tmp_days / 7);
 
-                                       if(tmp_weeks)
+                                       if (tmp_weeks)
                                        {
                                                tmp_days -= (tmp_weeks * 7);
                                                tmp_years = floor(tmp_weeks / 52);
@@ -148,7 +153,7 @@ string process_time(float outputtype, float seconds)
                }
        }
 
-       switch(outputtype)
+       switch (outputtype)
        {
                case 1: return sprintf("%02d:%02d:%02d", tmp_hours, tmp_minutes, tmp_seconds);
                case 2:
@@ -157,7 +162,7 @@ string process_time(float outputtype, float seconds)
 
                        output = count_seconds(tmp_seconds);
 
-                       if(tmp_minutes)
+                       if (tmp_minutes)
                        {
                                output = sprintf(
                                        "%s%s",
@@ -165,7 +170,7 @@ string process_time(float outputtype, float seconds)
                                        ((output != "") ? sprintf(", %s", output) : ""));
                        }
 
-                       if(tmp_hours)
+                       if (tmp_hours)
                        {
                                output = sprintf(
                                        "%s%s",
@@ -173,7 +178,7 @@ string process_time(float outputtype, float seconds)
                                        ((output != "") ? sprintf(", %s", output) : ""));
                        }
 
-                       if(tmp_days)
+                       if (tmp_days)
                        {
                                output = sprintf(
                                        "%s%s",
@@ -181,7 +186,7 @@ string process_time(float outputtype, float seconds)
                                        ((output != "") ? sprintf(", %s", output) : ""));
                        }
 
-                       if(tmp_weeks)
+                       if (tmp_weeks)
                        {
                                output = sprintf(
                                        "%s%s",
@@ -189,7 +194,7 @@ string process_time(float outputtype, float seconds)
                                        ((output != "") ? sprintf(", %s", output) : ""));
                        }
 
-                       if(tmp_years)
+                       if (tmp_years)
                        {
                                output = sprintf(
                                        "%s%s",
@@ -205,9 +210,9 @@ string process_time(float outputtype, float seconds)
 
                        output = count_hours(tmp_hours);
 
-                       if(tmp_weeks) { tmp_days += (tmp_weeks * 7); }
-                       if(tmp_years) { tmp_days += (tmp_years * 365); }
-                       if(tmp_days)
+                       if (tmp_weeks) tmp_days += (tmp_weeks * 7);
+                       if (tmp_years) tmp_days += (tmp_years * 365);
+                       if (tmp_days)
                        {
                                output = sprintf(
                                        "%s%s",
index 5ee3222..81aaffe 100644 (file)
@@ -5,7 +5,7 @@
 #include "progname.qh"
 #include "static.qh"
 
-void RegisterCvars(void(string name, string def, string desc, bool archive, string file) f) { }
+void RegisterCvars(void(string name, string def, string desc, bool archive, string file)f) {}
 
 /** escape the string to make it safe for consoles */
 string MakeConsoleSafe(string input)
@@ -17,34 +17,38 @@ string MakeConsoleSafe(string input)
        return input;
 }
 
-void cvar_describe(string name, string desc) {
-    localcmd(sprintf("\nset %1$s \"$%1$s\" \"%2$s\"\n", name, MakeConsoleSafe(desc)));
+void cvar_describe(string name, string desc)
+{
+       localcmd(sprintf("\nset %1$s \"$%1$s\" \"%2$s\"\n", name, MakeConsoleSafe(desc)));
 }
 
-void cvar_archive(string name) {
-    localcmd(sprintf("\nseta %1$s \"$%1$s\"\n", name));
+void cvar_archive(string name)
+{
+       localcmd(sprintf("\nseta %1$s \"$%1$s\"\n", name));
 }
 
 void RegisterCvars_Set(string name, string def, string desc, bool archive, string file)
 {
-    cvar_describe(name, desc);
-    if (archive) cvar_archive(name);
+       cvar_describe(name, desc);
+       if (archive) cvar_archive(name);
 }
 
 int RegisterCvars_Save_fd;
 void RegisterCvars_Save(string name, string def, string desc, bool archive, string file)
 {
-    if (!archive) return;
-    fputs(RegisterCvars_Save_fd, sprintf("seta %s \"%s\"\n", name, def));
+       if (!archive) return;
+       fputs(RegisterCvars_Save_fd, sprintf("seta %s \"%s\"\n", name, def));
 }
 
-STATIC_INIT_LATE(Cvars) {
-    RegisterCvars(RegisterCvars_Set);
-    RegisterCvars_Save_fd = fopen(sprintf("default%s.cfg", PROGNAME), FILE_WRITE);
-    if (RegisterCvars_Save_fd >= 0) {
-        RegisterCvars(RegisterCvars_Save);
-        fclose(RegisterCvars_Save_fd);
-    }
+STATIC_INIT_LATE(Cvars)
+{
+       RegisterCvars(RegisterCvars_Set);
+       RegisterCvars_Save_fd = fopen(sprintf("default%s.cfg", PROGNAME), FILE_WRITE);
+       if (RegisterCvars_Save_fd >= 0)
+       {
+               RegisterCvars(RegisterCvars_Save);
+               fclose(RegisterCvars_Save_fd);
+       }
 }
 
 const noref bool default_bool = false;
@@ -53,19 +57,22 @@ const noref float default_float = 0;
 const noref string default_string = "";
 const noref vector default_vector = '0 0 0';
 
-#define repr_cvar_bool(x)   ((x) ? "1" : "0")
-#define repr_cvar_int(x)    (ftos(x))
-#define repr_cvar_float(x)  (ftos(x))
+#define repr_cvar_bool(x) ((x) ? "1" : "0")
+#define repr_cvar_int(x) (ftos(x))
+#define repr_cvar_float(x) (ftos(x))
 #define repr_cvar_string(x) (x)
 #define repr_cvar_vector(x) (sprintf("%v", x))
 
 #define __AUTOCVAR(file, archive, var, type, desc, default) \
-    [[accumulate]] void RegisterCvars(void(string, string, string, bool, string) f) { f(#var, repr_cvar_##type(default), desc, archive, file); } \
-    type autocvar_##var = default
+       [[accumulate]] void RegisterCvars(void(string, string, string, bool, string)f) \
+       { \
+               f( #var, repr_cvar_##type(default), desc, archive, file); \
+       } \
+       type autocvar_##var = default
 #define AUTOCVAR_5(file, archive, var, type, desc) \
-    __AUTOCVAR(file, archive, var, type, desc, default_##type)
+       __AUTOCVAR(file, archive, var, type, desc, default_##type)
 #define AUTOCVAR_6(file, archive, var, type, default, desc) \
-    __AUTOCVAR(file, archive, var, type, desc, default)
+       __AUTOCVAR(file, archive, var, type, desc, default)
 #define _AUTOCVAR(...) EVAL(OVERLOAD(AUTOCVAR, __FILE__, __VA_ARGS__))
 #define AUTOCVAR_SAVE(...) _AUTOCVAR(true, __VA_ARGS__)
 #define AUTOCVAR(...) _AUTOCVAR(false, __VA_ARGS__)
index 6c49566..eb56dce 100644 (file)
@@ -1,14 +1,14 @@
-#ifndef MENUQC
 #ifndef DEFER_H
 #define DEFER_H
+#ifndef MENUQC
 
-#include "oo.qh"
-#include "self.qh"
+       #include "oo.qh"
+       #include "self.qh"
 
-entityclass(Defer);
-class(Defer) .entity owner;
-class(Defer) .void() think;
-class(Defer) .float nextthink;
+       entityclass(Defer);
+       class(Defer).entity owner;
+       class(Defer).void() think;
+       class(Defer).float nextthink;
 
 /*
 ==================
@@ -17,32 +17,35 @@ SUB_Remove
 Remove self
 ==================
 */
-void SUB_Remove()
-{SELFPARAM();
-       remove (self);
-}
-
-void defer_think()
-{SELFPARAM();
-    self.think     = SUB_Remove;
-    self.nextthink = time;
-    WITH(entity, self, self.owner, self.use());
-}
+       void SUB_Remove()
+       {
+               SELFPARAM();
+               remove(self);
+       }
+
+       void defer_think()
+       {
+               SELFPARAM();
+               self.think     = SUB_Remove;
+               self.nextthink = time;
+               WITH(entity, self, self.owner, self.use());
+       }
 
 /*
     Execute func() after time + fdelay.
     self when func is executed = self when defer is called
 */
-void defer(float fdelay, void() func)
-{SELFPARAM();
-    entity e;
-
-    e           = spawn();
-    e.owner     = self;
-    e.use       = func;
-    e.think     = defer_think;
-    e.nextthink = time + fdelay;
-}
+       void defer(float fdelay, void() func)
+       {
+               SELFPARAM();
+               entity e;
+
+               e           = spawn();
+               e.owner     = self;
+               e.use       = func;
+               e.think     = defer_think;
+               e.nextthink = time + fdelay;
+       }
 
 #endif
 #endif
index 90abcb2..40900b8 100644 (file)
@@ -1,38 +1,38 @@
 #ifdef CSQC
 #ifndef DRAW_H
-#define DRAW_H
+       #define DRAW_H
 
-#include "i18n.qh"
-#include "vector.qh"
+       #include "i18n.qh"
+       #include "vector.qh"
 
-#include "../client/defs.qh"
+       #include "../client/defs.qh"
 
-void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
-{
-       // I want to draw a quad...
-       // from and to are MIDPOINTS.
+       void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
+       {
+               // I want to draw a quad...
+               // from and to are MIDPOINTS.
 
-       vector axis, thickdir, A, B, C, D;
-       float length_tex;
+               vector axis, thickdir, A, B, C, D;
+               float length_tex;
 
-       axis = normalize(to - from);
-       length_tex = aspect * vlen(to - from) / thickness;
+               axis = normalize(to - from);
+               length_tex = aspect * vlen(to - from) / thickness;
 
-       // direction is perpendicular to the view normal, and perpendicular to the axis
-       thickdir = normalize(cross(axis, vieworg - from));
+               // direction is perpendicular to the view normal, and perpendicular to the axis
+               thickdir = normalize(cross(axis, vieworg - from));
 
-       A = from - thickdir * (thickness / 2);
-       B = from + thickdir * (thickness / 2);
-       C = to + thickdir * (thickness / 2);
-       D = to - thickdir * (thickness / 2);
+               A = from - thickdir * (thickness / 2);
+               B = from + thickdir * (thickness / 2);
+               C = to + thickdir * (thickness / 2);
+               D = to - thickdir * (thickness / 2);
 
-       R_BeginPolygon(texture, drawflag);
-       R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
-       R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
-       R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
-       R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
-       R_EndPolygon();
-}
+               R_BeginPolygon(texture, drawflag);
+               R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
+               R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
+               R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
+               R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
+               R_EndPolygon();
+       }
 
 // a border picture is a texture containing nine parts:
 //   1/4 width: left part
@@ -42,92 +42,92 @@ void Draw_CylindricLine(vector from, vector to, float thickness, string texture,
 //   1/4 height: top part
 //   1/2 height: middle part (stretched)
 //   1/4 height: bottom part
-void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
-{
-    if (theBorderSize.x < 0 && theBorderSize.y < 0) // draw whole image as it is
-    {
-               drawpic(theOrigin, pic, theSize, theColor, theAlpha, 0);
-               return;
-    }
-       if (theBorderSize.x == 0 && theBorderSize.y == 0) // no border
+       void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
        {
-               // draw only the central part
-               drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
-               return;
-       }
-
-       vector dX, dY;
-       vector width, height;
-       vector bW, bH;
-       //pic = draw_UseSkinFor(pic);
-       width = eX * theSize.x;
-       height = eY * theSize.y;
-       if(theSize.x <= theBorderSize.x * 2)
-       {
-               // not wide enough... draw just left and right then
-               bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
-               if(theSize.y <= theBorderSize.y * 2)
+               if (theBorderSize.x < 0 && theBorderSize.y < 0)  // draw whole image as it is
                {
-                       // not high enough... draw just corners
-                       bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
-                       drawsubpic(theOrigin,                 width * 0.5 + height * 0.5, pic, '0 0 0',           bW + bH, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + width   * 0.5, width * 0.5 + height * 0.5, pic, eX - bW,           bW + bH, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + height  * 0.5, width * 0.5 + height * 0.5, pic, eY - bH,           bW + bH, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, eX + eY - bW - bH, bW + bH, theColor, theAlpha, 0);
+                       drawpic(theOrigin, pic, theSize, theColor, theAlpha, 0);
+                       return;
                }
-               else
+               if (theBorderSize.x == 0 && theBorderSize.y == 0)  // no border
                {
-                       dY = theBorderSize.x * eY;
-                       drawsubpic(theOrigin,                             width * 0.5          +     dY, pic, '0 0    0',           '0 0.25 0' + bW, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + width * 0.5,               width * 0.5          +     dY, pic, '0 0    0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin                        + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0',           '0 0.5  0' + bW, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + width * 0.5          + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0' + eX - bW, '0 0.5  0' + bW, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin               + height - dY, width * 0.5          +     dY, pic, '0 0.75 0',           '0 0.25 0' + bW, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + width * 0.5 + height - dY, width * 0.5          +     dY, pic, '0 0.75 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
+                       // draw only the central part
+                       drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
+                       return;
                }
-       }
-       else
-       {
-               if(theSize.y <= theBorderSize.y * 2)
+
+               vector dX, dY;
+               vector width, height;
+               vector bW, bH;
+               // pic = draw_UseSkinFor(pic);
+               width = eX * theSize.x;
+               height = eY * theSize.y;
+               if (theSize.x <= theBorderSize.x * 2)
                {
-                       // not high enough... draw just top and bottom then
-                       bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
-                       dX = theBorderSize.x * eX;
-                       drawsubpic(theOrigin,                                         dX + height * 0.5, pic, '0    0 0',           '0.25 0 0' + bH, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + dX,                        width - 2 * dX + height * 0.5, pic, '0.25 0 0',           '0.5  0 0' + bH, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + width - dX,                            dX + height * 0.5, pic, '0.75 0 0',           '0.25 0 0' + bH, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin              + height * 0.5,             dX + height * 0.5, pic, '0    0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + dX         + height * 0.5, width - 2 * dX + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5  0 0' + bH, theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + width - dX + height * 0.5,             dX + height * 0.5, pic, '0.75 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
+                       // not wide enough... draw just left and right then
+                       bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
+                       if (theSize.y <= theBorderSize.y * 2)
+                       {
+                               // not high enough... draw just corners
+                               bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
+                               drawsubpic(theOrigin,                 width * 0.5 + height * 0.5, pic, '0 0 0',           bW + bH, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + width   * 0.5, width * 0.5 + height * 0.5, pic, eX - bW,           bW + bH, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + height  * 0.5, width * 0.5 + height * 0.5, pic, eY - bH,           bW + bH, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, eX + eY - bW - bH, bW + bH, theColor, theAlpha, 0);
+                       }
+                       else
+                       {
+                               dY = theBorderSize.x * eY;
+                               drawsubpic(theOrigin,                             width * 0.5          +     dY, pic, '0 0    0',           '0 0.25 0' + bW, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + width * 0.5,               width * 0.5          +     dY, pic, '0 0    0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin                        + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0',           '0 0.5  0' + bW, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + width * 0.5          + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0' + eX - bW, '0 0.5  0' + bW, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin               + height - dY, width * 0.5          +     dY, pic, '0 0.75 0',           '0 0.25 0' + bW, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + width * 0.5 + height - dY, width * 0.5          +     dY, pic, '0 0.75 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
+                       }
                }
                else
                {
-                       dX = theBorderSize.x * eX;
-                       dY = theBorderSize.x * eY;
-                       drawsubpic(theOrigin,                                        dX          +     dY, pic, '0    0    0', '0.25 0.25 0', theColor, theAlpha, 0);
-                       drawsubpic(theOrigin                  + dX,      width - 2 * dX          +     dY, pic, '0.25 0    0', '0.5  0.25 0', theColor, theAlpha, 0);
-                       drawsubpic(theOrigin          + width - dX,                  dX          +     dY, pic, '0.75 0    0', '0.25 0.25 0', theColor, theAlpha, 0);
-                       drawsubpic(theOrigin          + dY,                          dX + height - 2 * dY, pic, '0    0.25 0', '0.25 0.5  0', theColor, theAlpha, 0);
-                       drawsubpic(theOrigin          + dY         + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5  0.5  0', theColor, theAlpha, 0);
-                       drawsubpic(theOrigin          + dY + width - dX,             dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5  0', theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + height - dY,                          dX          +     dY, pic, '0    0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + height - dY         + dX, width - 2 * dX          +     dY, pic, '0.25 0.75 0', '0.5  0.25 0', theColor, theAlpha, 0);
-                       drawsubpic(theOrigin + height - dY + width - dX,             dX          +     dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+                       if (theSize.y <= theBorderSize.y * 2)
+                       {
+                               // not high enough... draw just top and bottom then
+                               bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
+                               dX = theBorderSize.x * eX;
+                               drawsubpic(theOrigin,                                         dX + height * 0.5, pic, '0    0 0',           '0.25 0 0' + bH, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + dX,                        width - 2 * dX + height * 0.5, pic, '0.25 0 0',           '0.5  0 0' + bH, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + width - dX,                            dX + height * 0.5, pic, '0.75 0 0',           '0.25 0 0' + bH, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin              + height * 0.5,             dX + height * 0.5, pic, '0    0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + dX         + height * 0.5, width - 2 * dX + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5  0 0' + bH, theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + width - dX + height * 0.5,             dX + height * 0.5, pic, '0.75 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
+                       }
+                       else
+                       {
+                               dX = theBorderSize.x * eX;
+                               dY = theBorderSize.x * eY;
+                               drawsubpic(theOrigin,                                        dX          +     dY, pic, '0    0    0', '0.25 0.25 0', theColor, theAlpha, 0);
+                               drawsubpic(theOrigin                  + dX,      width - 2 * dX          +     dY, pic, '0.25 0    0', '0.5  0.25 0', theColor, theAlpha, 0);
+                               drawsubpic(theOrigin          + width - dX,                  dX          +     dY, pic, '0.75 0    0', '0.25 0.25 0', theColor, theAlpha, 0);
+                               drawsubpic(theOrigin          + dY,                          dX + height - 2 * dY, pic, '0    0.25 0', '0.25 0.5  0', theColor, theAlpha, 0);
+                               drawsubpic(theOrigin          + dY         + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5  0.5  0', theColor, theAlpha, 0);
+                               drawsubpic(theOrigin          + dY + width - dX,             dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5  0', theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + height - dY,                          dX          +     dY, pic, '0    0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + height - dY         + dX, width - 2 * dX          +     dY, pic, '0.25 0.75 0', '0.5  0.25 0', theColor, theAlpha, 0);
+                               drawsubpic(theOrigin + height - dY + width - dX,             dX          +     dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+                       }
                }
        }
-}
 
-void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
-{
-       position.x -= 2 / 3 * strlen(text) * theScale.x;
-       drawstring(position, text, theScale, rgb, theAlpha, flag);
-}
+       void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
+       {
+               position.x -= 2 / 3 * strlen(text) * theScale.x;
+               drawstring(position, text, theScale, rgb, theAlpha, flag);
+       }
 
-void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
-{
-       position.x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x);
-       drawstring(position, text, theScale, rgb, theAlpha, flag);
-}
+       void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
+       {
+               position.x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x);
+               drawstring(position, text, theScale, rgb, theAlpha, flag);
+       }
 
 #endif
 #endif
index f732bfe..87d1460 100644 (file)
@@ -3,11 +3,10 @@
 
 bool fexists(string f)
 {
-    int fh = fopen(f, FILE_READ);
-    if (fh < 0)
-        return false;
-    fclose(fh);
-    return true;
+       int fh = fopen(f, FILE_READ);
+       if (fh < 0) return false;
+       fclose(fh);
+       return true;
 }
 
 #endif
index 2bbe7d5..237492d 100644 (file)
@@ -3,24 +3,24 @@
 
 #define MAP(f, ...) EVAL(OVERLOAD(MAP, f, __VA_ARGS__))
 #define MAP_2(f, it) f(it)
-#define MAP_3(f, it, ...) f(it)MAP_2(f, __VA_ARGS__)
-#define MAP_4(f, it, ...) f(it)MAP_3(f, __VA_ARGS__)
-#define MAP_5(f, it, ...) f(it)MAP_4(f, __VA_ARGS__)
-#define MAP_6(f, it, ...) f(it)MAP_5(f, __VA_ARGS__)
-#define MAP_7(f, it, ...) f(it)MAP_6(f, __VA_ARGS__)
-#define MAP_8(f, it, ...) f(it)MAP_7(f, __VA_ARGS__)
-#define MAP_9(f, it, ...) f(it)MAP_8(f, __VA_ARGS__)
-#define MAP_10(f, it, ...) f(it)MAP_9(f, __VA_ARGS__)
-#define MAP_11(f, it, ...) f(it)MAP_10(f, __VA_ARGS__)
-#define MAP_12(f, it, ...) f(it)MAP_11(f, __VA_ARGS__)
-#define MAP_13(f, it, ...) f(it)MAP_12(f, __VA_ARGS__)
-#define MAP_14(f, it, ...) f(it)MAP_13(f, __VA_ARGS__)
-#define MAP_15(f, it, ...) f(it)MAP_14(f, __VA_ARGS__)
-#define MAP_16(f, it, ...) f(it)MAP_15(f, __VA_ARGS__)
-#define MAP_17(f, it, ...) f(it)MAP_16(f, __VA_ARGS__)
-#define MAP_18(f, it, ...) f(it)MAP_17(f, __VA_ARGS__)
-#define MAP_19(f, it, ...) f(it)MAP_18(f, __VA_ARGS__)
-#define MAP_20(f, it, ...) f(it)MAP_19(f, __VA_ARGS__)
+#define MAP_3(f, it, ...) f(it) MAP_2(f, __VA_ARGS__)
+#define MAP_4(f, it, ...) f(it) MAP_3(f, __VA_ARGS__)
+#define MAP_5(f, it, ...) f(it) MAP_4(f, __VA_ARGS__)
+#define MAP_6(f, it, ...) f(it) MAP_5(f, __VA_ARGS__)
+#define MAP_7(f, it, ...) f(it) MAP_6(f, __VA_ARGS__)
+#define MAP_8(f, it, ...) f(it) MAP_7(f, __VA_ARGS__)
+#define MAP_9(f, it, ...) f(it) MAP_8(f, __VA_ARGS__)
+#define MAP_10(f, it, ...) f(it) MAP_9(f, __VA_ARGS__)
+#define MAP_11(f, it, ...) f(it) MAP_10(f, __VA_ARGS__)
+#define MAP_12(f, it, ...) f(it) MAP_11(f, __VA_ARGS__)
+#define MAP_13(f, it, ...) f(it) MAP_12(f, __VA_ARGS__)
+#define MAP_14(f, it, ...) f(it) MAP_13(f, __VA_ARGS__)
+#define MAP_15(f, it, ...) f(it) MAP_14(f, __VA_ARGS__)
+#define MAP_16(f, it, ...) f(it) MAP_15(f, __VA_ARGS__)
+#define MAP_17(f, it, ...) f(it) MAP_16(f, __VA_ARGS__)
+#define MAP_18(f, it, ...) f(it) MAP_17(f, __VA_ARGS__)
+#define MAP_19(f, it, ...) f(it) MAP_18(f, __VA_ARGS__)
+#define MAP_20(f, it, ...) f(it) MAP_19(f, __VA_ARGS__)
 
 #define IDENTITY(it) it
 
 #define APPLY(f, ...) f(__VA_ARGS__)
 
 #ifdef SVQC
-    #define SV(f, ...) f(__VA_ARGS__)
+       #define SV(f, ...) f(__VA_ARGS__)
 #else
-    #define SV(f, ...)
+       #define SV(f, ...)
 #endif
 
 #ifdef CSQC
-    #define CL(f, ...) f(__VA_ARGS__)
+       #define CL(f, ...) f(__VA_ARGS__)
 #else
-    #define CL(f, ...)
+       #define CL(f, ...)
 #endif
 
 #define IF(cond, f, ...) cond(f, __VA_ARGS__)
index 87c41cd..3773e16 100644 (file)
@@ -8,25 +8,23 @@ string prvm_language;
 
 string language_filename(string s)
 {
-    string fn = prvm_language;
-    if (fn == "" || fn == "dump")
-        return s;
-    fn = strcat(s, ".", fn);
-    int fh = fopen(fn, FILE_READ);
-    if (fh >= 0)
-    {
-        fclose(fh);
-        return fn;
-    }
-    return s;
+       string fn = prvm_language;
+       if (fn == "" || fn == "dump") return s;
+       fn = strcat(s, ".", fn);
+       int fh = fopen(fn, FILE_READ);
+       if (fh >= 0)
+       {
+               fclose(fh);
+               return fn;
+       }
+       return s;
 }
 
 string CTX(string s)
 {
-    int p = strstrofs(s, "^", 0);
-    if (p < 0)
-        return s;
-    return substring(s, p + 1, -1);
+       int p = strstrofs(s, "^", 0);
+       if (p < 0) return s;
+       return substring(s, p + 1, -1);
 }
 
 #define ZCTX(s) strzone(CTX(s))
index d9ea61f..9bd129b 100644 (file)
@@ -2,13 +2,13 @@
 #define INT_H
 
 #ifndef QCC_SUPPORT_INT
-    #define stoi(s) stof(s)
-    #define stob(s) stof(s)
-    #define itos(i) ftos(i)
+       #define stoi(s) stof(s)
+       #define stob(s) stof(s)
+       #define itos(i) ftos(i)
 #else
-    #define stoi(s) ((int) stof(s))
-    #define stob(s) ((bool) stof(s))
-    #define itos(i) ftos(i)
+       #define stoi(s) ((int) stof(s))
+       #define stob(s) ((bool) stof(s))
+       #define itos(i) ftos(i)
 #endif
 
 #endif
index 53b3d66..b0a602c 100644 (file)
@@ -1,19 +1,27 @@
 #ifndef ITER_H
 #define ITER_H
 
-#define FOREACH_ARRAY(arr, start, end, cond, body) do { \
-    for (int i = start; i < end; ++i) {                 \
-        const noref entity it = arr[i];                 \
-        if (cond) { body }                              \
-    }                                                   \
-} while(0)
+#define FOREACH_ARRAY(arr, start, end, cond, body) \
+       do \
+       { \
+               for (int i = start; i < end; ++i) \
+               {                 \
+                       const noref entity it = arr[i];                 \
+                       if (cond) { body }                              \
+               }                                                   \
+       } \
+       while (0)
 
-#define FOREACH_LIST(list, next, cond, body) do {               \
-    noref int i = 0;                                            \
-    for (entity it = list##_first; it; (it = it.next, ++i)) {   \
-        if (cond) { body }                                      \
-    }                                                           \
-} while(0)
+#define FOREACH_LIST(list, next, cond, body) \
+       do \
+       {               \
+               noref int i = 0;                                            \
+               for (entity it = list##_first; it; (it = it.next, ++i)) \
+               {   \
+                       if (cond) { body }                                      \
+               }                                                           \
+       } \
+       while (0)
 
 #define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body)
 
index f632b38..5e0329b 100644 (file)
@@ -4,15 +4,19 @@
 #include "oo.qh"
 
 CLASS(Lazy, Object)
-    ATTRIB(Lazy, m_get, entity(), func_null);
-    CONSTRUCTOR(Lazy, entity() _compute) { this.m_get = _compute; }
+       ATTRIB(Lazy, m_get, entity(), func_null);
+       CONSTRUCTOR(Lazy, entity() _compute)
+       {
+               this.m_get = _compute;
+       }
 ENDCLASS(Lazy)
 
 #define LAZY(id) __lazy_##id
-#define LAZY_NEW(id, compute) entity LAZY(id)() { \
-    static bool done; \
-    static entity it; \
-    if (!done) { it = compute; done = true; } \
-    return it; \
-}
+#define LAZY_NEW(id, compute) \
+       entity LAZY(id)() { \
+               static bool done; \
+               static entity it; \
+               if (!done) { it = compute; done = true; } \
+               return it; \
+       }
 #endif
index be57bb5..8311bec 100644 (file)
@@ -2,14 +2,14 @@
 #define LINKEDLIST_H
 
 CLASS(LinkedListNode, Object)
-    ATTRIB(LinkedListNode, ll_data, entity, NULL)
-    ATTRIB(LinkedListNode, ll_prev, LinkedListNode, NULL)
-    ATTRIB(LinkedListNode, ll_next, LinkedListNode, NULL)
+       ATTRIB(LinkedListNode, ll_data, entity, NULL)
+       ATTRIB(LinkedListNode, ll_prev, LinkedListNode, NULL)
+       ATTRIB(LinkedListNode, ll_next, LinkedListNode, NULL)
 ENDCLASS(LinkedListNode)
 
 CLASS(LinkedList, Object)
-    ATTRIB(LinkedList, ll_head, LinkedListNode, NULL);
-    ATTRIB(LinkedList, ll_tail, LinkedListNode, NULL);
+       ATTRIB(LinkedList, ll_head, LinkedListNode, NULL);
+       ATTRIB(LinkedList, ll_tail, LinkedListNode, NULL);
 ENDCLASS(LinkedList)
 
 #define LL_NEW() NEW(LinkedList)
@@ -17,41 +17,41 @@ ENDCLASS(LinkedList)
 /**
  * Push to tail
  */
-entity LL_PUSH(LinkedList this, entity e) {
-    LinkedListNode n = NEW(LinkedListNode);
-    n.ll_data = e;
-    n.ll_prev = this.ll_tail;
-    LinkedListNode tail = this.ll_tail;
-    if (tail) {
-        tail.ll_next = n;
-    } else {
-        this.ll_head = this.ll_tail = n;
-    }
-    return e;
+entity LL_PUSH(LinkedList this, entity e)
+{
+       LinkedListNode n = NEW(LinkedListNode);
+       n.ll_data = e;
+       n.ll_prev = this.ll_tail;
+       LinkedListNode tail = this.ll_tail;
+       if (tail) tail.ll_next = n;
+       else this.ll_head = this.ll_tail = n;
+       return e;
 }
 
 /**
  * Pop from tail
  */
-entity LL_POP(LinkedList this) {
-    if (!this.ll_tail) return NULL;
-    LinkedListNode n = this.ll_tail;
-    entity e = n.ll_data;
-    LinkedListNode prev = n.ll_prev;
-    if (prev) {
-        prev.ll_next = NULL;
-    } else {
-        this.ll_head = this.ll_tail = NULL;
-    }
-    return e;
+entity LL_POP(LinkedList this)
+{
+       if (!this.ll_tail) return NULL;
+       LinkedListNode n = this.ll_tail;
+       entity e = n.ll_data;
+       LinkedListNode prev = n.ll_prev;
+       if (prev) prev.ll_next = NULL;
+       else this.ll_head = this.ll_tail = NULL;
+       return e;
 }
 
-#define LL_EACH(list, cond, body) do {                                  \
-    noref int i = 0;                                                    \
-    for (entity _it = list.ll_head; _it; (_it = _it.ll_next, ++i)) {    \
-        noref entity it = _it.ll_data;                                  \
-        if (cond) { body }                                              \
-    }                                                                   \
-} while(0)
+#define LL_EACH(list, cond, body) \
+       do \
+       {                                  \
+               noref int i = 0;                                                    \
+               for (entity _it = list.ll_head; _it; (_it = _it.ll_next, ++i)) \
+               {    \
+                       noref entity it = _it.ll_data;                                  \
+                       if (cond) { body }                                              \
+               }                                                                   \
+       } \
+       while (0)
 
 #endif
index 3d186e3..e24bd8f 100644 (file)
@@ -1,64 +1,94 @@
 #ifndef LOG_H
 #define LOG_H
 
-#define _printferr(...)     error(sprintf(__VA_ARGS__))
-#define _printfbt(...)      backtrace(sprintf(__VA_ARGS__))
-#define printf(...)         print(sprintf(__VA_ARGS__))
-#define dprintf(...)        dprint(sprintf(__VA_ARGS__))
-#define _dprintf2(...)      do { if (autocvar_developer > 1) dprintf(__VA_ARGS__); } while (0)
+#define _printferr(...) error(sprintf(__VA_ARGS__))
+#define _printfbt(...) backtrace(sprintf(__VA_ARGS__))
+#define printf(...) print(sprintf(__VA_ARGS__))
+#define dprintf(...) dprint(sprintf(__VA_ARGS__))
+#define _dprintf2(...) \
+       do \
+       { \
+               if (autocvar_developer > 1) dprintf(__VA_ARGS__); \
+       } \
+       while (0)
 
-#define assert(expr, ...)   do { if (!(expr)) LOG_WARNINGF(__VA_ARGS__); } while (0)
+#define assert(expr, ...) \
+       do \
+       { \
+               if (!(expr)) LOG_WARNINGF(__VA_ARGS__); \
+       } \
+       while (0)
 
-#define _LOG(f, level, s)   f("[::"level"] ["__FILE__":%s:%.0f] %s", __FUNC__, __LINE__, s)
+#define _LOG(f, level, s) f("[::"level "] ["__FILE__ ":%s:%.0f] %s", __FUNC__, __LINE__, s)
 
-#define  LOG_FATAL(...)     _LOG_FATAL(strcat("", __VA_ARGS__))
-#define  LOG_FATALF(...)    _LOG_FATAL(sprintf(__VA_ARGS__))
-#define _LOG_FATAL(s)       _LOG(_printferr, "FATAL", s)
+#define  LOG_FATAL(...) _LOG_FATAL(strcat("", __VA_ARGS__))
+#define  LOG_FATALF(...) _LOG_FATAL(sprintf(__VA_ARGS__))
+#define _LOG_FATAL(s) _LOG(_printferr, "FATAL", s)
 
-#define  LOG_SEVERE(...)    _LOG_SEVERE(strcat("", __VA_ARGS__))
-#define  LOG_SEVEREF(...)   _LOG_SEVERE(sprintf(__VA_ARGS__))
-#define _LOG_SEVERE(s)      _LOG(_printfbt, "SEVERE", s)
+#define  LOG_SEVERE(...) _LOG_SEVERE(strcat("", __VA_ARGS__))
+#define  LOG_SEVEREF(...) _LOG_SEVERE(sprintf(__VA_ARGS__))
+#define _LOG_SEVERE(s) _LOG(_printfbt, "SEVERE", s)
 
-#define  LOG_WARNING(...)   _LOG_WARNING(strcat("", __VA_ARGS__))
-#define  LOG_WARNINGF(...)  _LOG_WARNING(sprintf(__VA_ARGS__))
-#define _LOG_WARNING(s)     _LOG(printf, "WARNING", s)
+#define  LOG_WARNING(...) _LOG_WARNING(strcat("", __VA_ARGS__))
+#define  LOG_WARNINGF(...) _LOG_WARNING(sprintf(__VA_ARGS__))
+#define _LOG_WARNING(s) _LOG(printf, "WARNING", s)
 
-#define  LOG_INFO(...)      do { if (autocvar_developer) _LOG_INFO(strcat("", __VA_ARGS__)); else print (__VA_ARGS__); } while (0)
-#define  LOG_INFOF(...)     do { if (autocvar_developer) _LOG_INFO(sprintf(__VA_ARGS__));    else printf(__VA_ARGS__); } while (0)
-#define _LOG_INFO(s)        _LOG(printf, "INFO", s)
+#define  LOG_INFO(...) \
+       do \
+       { \
+               if (autocvar_developer) _LOG_INFO(strcat("", __VA_ARGS__)); \
+               else print(__VA_ARGS__); \
+       } \
+       while (0)
+#define  LOG_INFOF(...) \
+       do \
+       { \
+               if (autocvar_developer) _LOG_INFO(sprintf(__VA_ARGS__)); \
+               else printf(__VA_ARGS__); \
+       } \
+       while (0)
+#define _LOG_INFO(s) _LOG(printf, "INFO", s)
 
-#define  LOG_TRACE(...)     _LOG_TRACE(strcat("", __VA_ARGS__))
-#define  LOG_TRACEF(...)    _LOG_TRACE(sprintf(__VA_ARGS__))
-#define _LOG_TRACE(s)       _LOG(dprintf, "TRACE", s)
+#define  LOG_TRACE(...) _LOG_TRACE(strcat("", __VA_ARGS__))
+#define  LOG_TRACEF(...) _LOG_TRACE(sprintf(__VA_ARGS__))
+#define _LOG_TRACE(s) _LOG(dprintf, "TRACE", s)
 
-#define  LOG_DEBUG(...)     _LOG_DEBUG(strcat("", __VA_ARGS__))
-#define  LOG_DEBUGF(...)    _LOG_DEBUG(sprintf(__VA_ARGS__))
-#define _LOG_DEBUG(s)       _LOG(_dprintf2, "DEBUG", s)
+#define  LOG_DEBUG(...) _LOG_DEBUG(strcat("", __VA_ARGS__))
+#define  LOG_DEBUGF(...) _LOG_DEBUG(sprintf(__VA_ARGS__))
+#define _LOG_DEBUG(s) _LOG(_dprintf2, "DEBUG", s)
 
 // TODO: this sucks, lets find a better way to do backtraces?
 #ifdef SVQC
-void builtin_remove(entity);
-#define _backtrace() builtin_remove(NULL)
+       void builtin_remove(entity);
+       #define _backtrace() builtin_remove(NULL)
 #else
-void remove(entity);
-#define _backtrace() remove(NULL)
+       void remove(entity);
+       #define _backtrace() remove(NULL)
 #endif
 
 noref int autocvar_developer;
 noref bool autocvar_prvm_backtraceforwarnings;
 
-#define backtrace(msg) do { \
-    int dev = autocvar_developer; \
-    bool war = autocvar_prvm_backtraceforwarnings; \
-    cvar_set("developer", "1"); \
-    cvar_set("prvm_backtraceforwarnings", "1"); \
-    print("\n--- CUT HERE ---\n", msg, "\n"); \
-    _backtrace(); \
-    print("\n--- CUT UNTIL HERE ---\n"); \
-    cvar_set("developer", ftos(dev)); \
-    cvar_set("prvm_backtraceforwarnings", ftos(war)); \
-} while (0)
+#define backtrace(msg) \
+       do \
+       { \
+               int dev = autocvar_developer; \
+               bool war = autocvar_prvm_backtraceforwarnings; \
+               cvar_set("developer", "1"); \
+               cvar_set("prvm_backtraceforwarnings", "1"); \
+               print("\n--- CUT HERE ---\n", msg, "\n"); \
+               _backtrace(); \
+               print("\n--- CUT UNTIL HERE ---\n"); \
+               cvar_set("developer", ftos(dev)); \
+               cvar_set("prvm_backtraceforwarnings", ftos(war)); \
+       } \
+       while (0)
 
-#define ASSERT(expr) do { if (!(expr)) LOG_FATAL("assertion failed: " #expr "\n"); } while (0)
+#define ASSERT(expr) \
+       do \
+       { \
+               if (!(expr)) LOG_FATAL("assertion failed: " #expr "\n"); \
+       } \
+       while (0)
 
 #endif
index 1a707a4..7459a06 100644 (file)
@@ -3,28 +3,22 @@
 
 void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
 {
-    if (weight == 0)
-        return;
-    if (mean == 0)
-        e.(a) *= pow(value, weight);
-    else
-        e.(a) += pow(value, mean) * weight;
-    e.(c) += weight;
+       if (weight == 0) return;
+       if (mean == 0) e.(a) *= pow(value, weight);
+       else e.(a) += pow(value, mean) * weight;
+       e.(c) += weight;
 }
 
 float mean_evaluate(entity e, .float a, .float c, float mean)
 {
-    if (e.(c) == 0)
-        return 0;
-    if (mean == 0)
-        return pow(e.(a), 1.0 / e.(c));
-    else
-        return pow(e.(a) / e.(c), 1.0 / mean);
+       if (e.(c) == 0) return 0;
+       if (mean == 0) return pow(e.(a), 1.0 / e.(c));
+       else return pow(e.(a) / e.(c), 1.0 / mean);
 }
 
-#define MEAN_ACCUMULATE(prefix,v,w) mean_accumulate(self,prefix##_accumulator,prefix##_count,prefix##_mean,v,w)
-#define MEAN_EVALUATE(prefix) mean_evaluate(self,prefix##_accumulator,prefix##_count,prefix##_mean)
-#define MEAN_DECLARE(prefix,m) float prefix##_mean = m; .float prefix##_count, prefix##_accumulator
+#define MEAN_ACCUMULATE(prefix, v, w) mean_accumulate(self, prefix##_accumulator, prefix##_count, prefix##_mean, v, w)
+#define MEAN_EVALUATE(prefix) mean_evaluate(self, prefix##_accumulator, prefix##_count, prefix##_mean)
+#define MEAN_DECLARE(prefix, m) float prefix##_mean = m; .float prefix##_count, prefix##_accumulator
 
 /*
 ==================
@@ -35,7 +29,7 @@ Returns a random number between -1.0 and 1.0
 */
 float crandom()
 {
-    return 2 * (random() - 0.5);
+       return 2 * (random() - 0.5);
 }
 
 
@@ -48,235 +42,211 @@ Angc used for animations
 
 float angc(float a1, float a2)
 {
-    while (a1 > 180) a1 -= 360;
-    while (a1 < -179) a1 += 360;
-    while (a2 > 180) a2 -= 360;
-    while (a2 < -179) a2 += 360;
-    float a = a1 - a2;
-    while (a > 180) a -= 360;
-    while (a < -179) a += 360;
-    return a;
+       while (a1 > 180)
+               a1 -= 360;
+       while (a1 < -179)
+               a1 += 360;
+       while (a2 > 180)
+               a2 -= 360;
+       while (a2 < -179)
+               a2 += 360;
+       float a = a1 - a2;
+       while (a > 180)
+               a -= 360;
+       while (a < -179)
+               a += 360;
+       return a;
 }
 
-float fsnap(float val,float fsize)
+float fsnap(float val, float fsize)
 {
-    return rint(val / fsize) * fsize;
+       return rint(val / fsize) * fsize;
 }
 
-vector vsnap(vector point,float fsize)
+vector vsnap(vector point, float fsize)
 {
-    vector vret;
+       vector vret;
 
-    vret.x = rint(point.x / fsize) * fsize;
-    vret.y = rint(point.y / fsize) * fsize;
-    vret.z = ceil(point.z / fsize) * fsize;
+       vret.x = rint(point.x / fsize) * fsize;
+       vret.y = rint(point.y / fsize) * fsize;
+       vret.z = ceil(point.z / fsize) * fsize;
 
-    return vret;
+       return vret;
 }
 
 vector lerpv(float t0, vector v0, float t1, vector v1, float t)
 {
-    return v0 + (v1 - v0) * ((t - t0) / (t1 - t0));
+       return v0 + (v1 - v0) * ((t - t0) / (t1 - t0));
 }
 
 vector bezier_quadratic_getpoint(vector a, vector b, vector c, float t)
 {
-    return
-        (c - 2 * b + a) * (t * t) +
-        (b - a) * (2 * t) +
-        a;
+       return (c - 2 * b + a) * (t * t)
+              + (b - a) * (2 * t)
+              + a;
 }
 
 vector bezier_quadratic_getderivative(vector a, vector b, vector c, float t)
 {
-    return
-        (c - 2 * b + a) * (2 * t) +
-        (b - a) * 2;
+       return (c - 2 * b + a) * (2 * t)
+              + (b - a) * 2;
 }
 
 float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x)
 {
-    return
-        (((     startspeedfactor + endspeedfactor - 2
-        ) * x - 2 * startspeedfactor - endspeedfactor + 3
-        ) * x + startspeedfactor
-        ) * x;
+       return (((startspeedfactor + endspeedfactor - 2
+                ) * x - 2 * startspeedfactor - endspeedfactor + 3
+               ) * x + startspeedfactor
+              ) * x;
 }
 
 bool cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor)
 {
-    if (startspeedfactor < 0 || endspeedfactor < 0)
-        return false;
-
-    /*
-    // if this is the case, the possible zeros of the first derivative are outside
-    // 0..1
-    We can calculate this condition as condition
-    if(se <= 3)
-        return true;
-    */
-
-    // better, see below:
-    if (startspeedfactor <= 3 && endspeedfactor <= 3)
-        return true;
-
-    // if this is the case, the first derivative has no zeros at all
-    float se = startspeedfactor + endspeedfactor;
-    float s_e = startspeedfactor - endspeedfactor;
-    if (3 * (se - 4) * (se - 4) + s_e * s_e <= 12) // an ellipse
-        return true;
-
-    // Now let s <= 3, s <= 3, s+e >= 3 (triangle) then we get se <= 6 (top right corner).
-    // we also get s_e <= 6 - se
-    // 3 * (se - 4)^2 + (6 - se)^2
-    // is quadratic, has value 12 at 3 and 6, and value < 12 in between.
-    // Therefore, above "better" check works!
-
-    return false;
-
-    // known good cases:
-    // (0, [0..3])
-    // (0.5, [0..3.8])
-    // (1, [0..4])
-    // (1.5, [0..3.9])
-    // (2, [0..3.7])
-    // (2.5, [0..3.4])
-    // (3, [0..3])
-    // (3.5, [0.2..2.3])
-    // (4, 1)
-
-    /*
-       On another note:
-       inflection point is always at (2s + e - 3) / (3s + 3e - 6).
-
-       s + e - 2 == 0: no inflection
-
-       s + e > 2:
-       0 < inflection < 1 if:
-       0 < 2s + e - 3 < 3s + 3e - 6
-       2s + e > 3 and 2e + s > 3
-
-       s + e < 2:
-       0 < inflection < 1 if:
-       0 > 2s + e - 3 > 3s + 3e - 6
-       2s + e < 3 and 2e + s < 3
-
-       Therefore: there is an inflection point iff:
-       e outside (3 - s)/2 .. 3 - s*2
-
-       in other words, if (s,e) in triangle (1,1)(0,3)(0,1.5) or in triangle (1,1)(3,0)(1.5,0)
-    */
+       if (startspeedfactor < 0 || endspeedfactor < 0) return false;
+
+       /*
+       // if this is the case, the possible zeros of the first derivative are outside
+       // 0..1
+       We can calculate this condition as condition
+       if(se <= 3)
+           return true;
+       */
+
+       // better, see below:
+       if (startspeedfactor <= 3 && endspeedfactor <= 3) return true;
+
+       // if this is the case, the first derivative has no zeros at all
+       float se = startspeedfactor + endspeedfactor;
+       float s_e = startspeedfactor - endspeedfactor;
+       if (3 * (se - 4) * (se - 4) + s_e * s_e <= 12)  // an ellipse
+               return true;
+
+       // Now let s <= 3, s <= 3, s+e >= 3 (triangle) then we get se <= 6 (top right corner).
+       // we also get s_e <= 6 - se
+       // 3 * (se - 4)^2 + (6 - se)^2
+       // is quadratic, has value 12 at 3 and 6, and value < 12 in between.
+       // Therefore, above "better" check works!
+
+       return false;
+
+       // known good cases:
+       // (0, [0..3])
+       // (0.5, [0..3.8])
+       // (1, [0..4])
+       // (1.5, [0..3.9])
+       // (2, [0..3.7])
+       // (2.5, [0..3.4])
+       // (3, [0..3])
+       // (3.5, [0.2..2.3])
+       // (4, 1)
+
+       /*
+          On another note:
+          inflection point is always at (2s + e - 3) / (3s + 3e - 6).
+
+          s + e - 2 == 0: no inflection
+
+          s + e > 2:
+          0 < inflection < 1 if:
+          0 < 2s + e - 3 < 3s + 3e - 6
+          2s + e > 3 and 2e + s > 3
+
+          s + e < 2:
+          0 < inflection < 1 if:
+          0 > 2s + e - 3 > 3s + 3e - 6
+          2s + e < 3 and 2e + s < 3
+
+          Therefore: there is an inflection point iff:
+          e outside (3 - s)/2 .. 3 - s*2
+
+          in other words, if (s,e) in triangle (1,1)(0,3)(0,1.5) or in triangle (1,1)(3,0)(1.5,0)
+       */
 }
 
 /** continuous function mapping all reals into -1..1 */
 float float2range11(float f)
 {
-    return f / (fabs(f) + 1);
+       return f / (fabs(f) + 1);
 }
 
 /** continuous function mapping all reals into 0..1 */
 float float2range01(float f)
 {
-    return 0.5 + 0.5 * float2range11(f);
+       return 0.5 + 0.5 * float2range11(f);
 }
 
 float median(float a, float b, float c)
 {
-    return (a < c) ? bound(a, b, c) : bound(c, b, a);
+       return (a < c) ? bound(a, b, c) : bound(c, b, a);
 }
 
 float almost_equals(float a, float b)
 {
-    float eps = (max(a, -a) + max(b, -b)) * 0.001;
-    return a - b < eps && b - a < eps;
+       float eps = (max(a, -a) + max(b, -b)) * 0.001;
+       return a - b < eps && b - a < eps;
 }
 
 float almost_in_bounds(float a, float b, float c)
 {
-    float eps = (max(a, -a) + max(c, -c)) * 0.001;
-    if (a > c)
-        eps = -eps;
-    return b == median(a - eps, b, c + eps);
+       float eps = (max(a, -a) + max(c, -c)) * 0.001;
+       if (a > c) eps = -eps;
+       return b == median(a - eps, b, c + eps);
 }
 
 float power2of(float e)
 {
-    return pow(2, e);
+       return pow(2, e);
 }
 
 float log2of(float x)
 {
-    // NOTE: generated code
-    if (x > 2048)
-        if (x > 131072)
-            if (x > 1048576)
-                if (x > 4194304)
-                    return 23;
-                else
-                    if (x > 2097152)
-                        return 22;
-                    else
-                        return 21;
-            else
-                if (x > 524288)
-                    return 20;
-                else
-                    if (x > 262144)
-                        return 19;
-                    else
-                        return 18;
-        else
-            if (x > 16384)
-                if (x > 65536)
-                    return 17;
-                else
-                    if (x > 32768)
-                        return 16;
-                    else
-                        return 15;
-            else
-                if (x > 8192)
-                    return 14;
-                else
-                    if (x > 4096)
-                        return 13;
-                    else
-                        return 12;
-    else
-        if (x > 32)
-            if (x > 256)
-                if (x > 1024)
-                    return 11;
-                else
-                    if (x > 512)
-                        return 10;
-                    else
-                        return 9;
-            else
-                if (x > 128)
-                    return 8;
-                else
-                    if (x > 64)
-                        return 7;
-                    else
-                        return 6;
-        else
-            if (x > 4)
-                if (x > 16)
-                    return 5;
-                else
-                    if (x > 8)
-                        return 4;
-                    else
-                        return 3;
-            else
-                if (x > 2)
-                    return 2;
-                else
-                    if (x > 1)
-                        return 1;
-                    else
-                        return 0;
+       // NOTE: generated code
+       if (x > 2048)
+               if (x > 131072)
+                       if (x > 1048576)
+                               if (x > 4194304) return 23;
+                               else
+                                       if (x > 2097152) return 22;
+                                       else return 21;
+                       else
+                               if (x > 524288) return 20;
+                               else
+                                       if (x > 262144) return 19;
+                                       else return 18;
+               else
+                       if (x > 16384)
+                               if (x > 65536) return 17;
+                               else
+                                       if (x > 32768) return 16;
+                                       else return 15;
+                       else
+                               if (x > 8192) return 14;
+                               else
+                                       if (x > 4096) return 13;
+                                       else return 12;
+       else
+               if (x > 32)
+                       if (x > 256)
+                               if (x > 1024) return 11;
+                               else
+                                       if (x > 512) return 10;
+                                       else return 9;
+                       else
+                               if (x > 128) return 8;
+                               else
+                                       if (x > 64) return 7;
+                                       else return 6;
+               else
+                       if (x > 4)
+                               if (x > 16) return 5;
+                               else
+                                       if (x > 8) return 4;
+                                       else return 3;
+                       else
+                               if (x > 2) return 2;
+                               else
+                                       if (x > 1) return 1;
+                                       else return 0;
 }
 
 
index 8a6e117..f6abd8e 100644 (file)
@@ -2,38 +2,42 @@
 #define MISC_H
 
 #ifdef GMQCC
-    #define EVAL(...)           __VA_ARGS__
+       #define EVAL(...) __VA_ARGS__
 
-    #define OVERLOAD_(F, ...)   F##_##__VA_COUNT__(__VA_ARGS__)
-    #define OVERLOAD(F, ...)    F##_##__VA_COUNT__(__VA_ARGS__)
+       #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
+       #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
 #else
-    #define EMPTY()
-    #define DEFER(id) id EMPTY()
-
-    #define EVAL(...)  EVAL1(EVAL1(EVAL1(__VA_ARGS__)))
-    #define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__)))
-    #define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__)))
-    #define EVAL3(...) EVAL4(EVAL4(EVAL4(__VA_ARGS__)))
-    #define EVAL4(...) EVAL5(EVAL5(EVAL5(__VA_ARGS__)))
-    #define EVAL5(...) __VA_ARGS__
-
-    #define OVERLOAD___(F,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n
-    #define OVERLOAD__(F, ...)  OVERLOAD___(F,##__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
-    #define OVERLOAD_(...)      DEFER(OVERLOAD__(__VA_ARGS__))
-    #define OVERLOAD(F, ...)    OVERLOAD_(F,##__VA_ARGS__)(__VA_ARGS__)
+       #define EMPTY()
+       #define DEFER(id) id EMPTY()
+
+       #define EVAL(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__)))
+       #define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__)))
+       #define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__)))
+       #define EVAL3(...) EVAL4(EVAL4(EVAL4(__VA_ARGS__)))
+       #define EVAL4(...) EVAL5(EVAL5(EVAL5(__VA_ARGS__)))
+       #define EVAL5(...) __VA_ARGS__
+
+       #define OVERLOAD___(F, _16, _15, _14, _13, _12, _11, _10, _9, _8, _7, _6, _5, _4, _3, _2, _1, n, ...) F##_##n
+       #define OVERLOAD__(F, ...) OVERLOAD___(F,##__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
+       #define OVERLOAD_(...) DEFER(OVERLOAD__(__VA_ARGS__))
+       #define OVERLOAD(F, ...) OVERLOAD_(F,##__VA_ARGS__)(__VA_ARGS__)
 #endif
 
 #define GET(name) name##get
 #define GETTER(type, name) type GET(name)() { return name; }
 
-#define LAMBDA(...) { __VA_ARGS__ ; }
+#define LAMBDA(...) { __VA_ARGS__; }
 
 // Can't wrap with do-while as block may contain continue or break
-#define WITH(type, name, value, block) { \
-    type __with_save = (name); \
-    name = (value); \
-    LAMBDA(block) \
-    name = __with_save; \
-} do { } while (0)
+#define WITH(type, name, value, block) \
+       { \
+               type __with_save = (name); \
+               name = (value); \
+               LAMBDA(block) \
+               name = __with_save; \
+       } do \
+       { \
+       } \
+       while (0)
 
 #endif
index 834de76..c304380 100644 (file)
@@ -2,52 +2,53 @@
 #define NET_H
 
 #ifdef SVQC
-.int Version; // deprecated, use SendFlags
-.int SendFlags;
-.bool(entity to, int sendflags) SendEntity;
-.bool(entity this, entity to, int sendflags) SendEntity3;
-
-bool SendEntity_self(entity to, int sendflags) { return self.SendEntity3(self, to, sendflags); }
-
-void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
-{
-    if (e.classname == "") e.classname = "net_linked";
-
-    if (e.model == "" || self.modelindex == 0) {
-        vector mi = e.mins;
-        vector ma = e.maxs;
-        _setmodel(e, "null");
-        setsize(e, mi, ma);
-    }
-
-    e.SendEntity = SendEntity_self;
-    e.SendEntity3 = sendfunc;
-    e.SendFlags = 0xFFFFFF;
-
-    if (!docull) e.effects |= EF_NODEPTHTEST;
-
-    if (dt) {
-        e.nextthink = time + dt;
-        e.think = SUB_Remove;
-    }
-}
-
-.void() uncustomizeentityforclient;
-.float uncustomizeentityforclient_set;
-
-void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer)
-{
-    e.customizeentityforclient = customizer;
-    e.uncustomizeentityforclient = uncustomizer;
-    e.uncustomizeentityforclient_set = !!uncustomizer;
-}
-
-void UncustomizeEntitiesRun()
-{
-    for (entity e = NULL; (e = findfloat(e, uncustomizeentityforclient_set, 1)); ) {
-        WITH(entity, self, e, e.uncustomizeentityforclient());
-    }
-}
+       .int Version;  // deprecated, use SendFlags
+       .int SendFlags;
+       .bool(entity to, int sendflags)SendEntity;
+       .bool(entity this, entity to, int sendflags)SendEntity3;
+
+       bool SendEntity_self(entity to, int sendflags) { return self.SendEntity3(self, to, sendflags); }
+
+       void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags)sendfunc)
+       {
+               if (e.classname == "") e.classname = "net_linked";
+
+               if (e.model == "" || self.modelindex == 0)
+               {
+                       vector mi = e.mins;
+                       vector ma = e.maxs;
+                       _setmodel(e, "null");
+                       setsize(e, mi, ma);
+               }
+
+               e.SendEntity = SendEntity_self;
+               e.SendEntity3 = sendfunc;
+               e.SendFlags = 0xFFFFFF;
+
+               if (!docull) e.effects |= EF_NODEPTHTEST;
+
+               if (dt)
+               {
+                       e.nextthink = time + dt;
+                       e.think = SUB_Remove;
+               }
+       }
+
+       .void() uncustomizeentityforclient;
+       .float uncustomizeentityforclient_set;
+
+       void SetCustomizer(entity e, float(void)customizer, void(void)uncustomizer)
+       {
+               e.customizeentityforclient = customizer;
+               e.uncustomizeentityforclient = uncustomizer;
+               e.uncustomizeentityforclient_set = !!uncustomizer;
+       }
+
+       void UncustomizeEntitiesRun()
+       {
+               for (entity e = NULL; (e = findfloat(e, uncustomizeentityforclient_set, 1)); )
+                       WITH(entity, self, e, e.uncustomizeentityforclient());
+       }
 
 #endif
 
@@ -56,111 +57,131 @@ void UncustomizeEntitiesRun()
 
 .string netname;
 .int m_id;
-.void(entity this, bool isNew) m_read;
+.void(entity this, bool isNew)m_read;
 
 #ifdef CSQC
-    #define Net_Accept() do { if (!this)    this = spawn(); } while (0)
-    #define Net_Reject() do { if (this)     remove(this);   } while (0)
+       #define Net_Accept() \
+               do \
+               { \
+                       if (!this)    this = spawn(); \
+               } \
+               while (0)
+       #define Net_Reject() \
+               do \
+               { \
+                       if (this)     remove(this); \
+               } \
+               while (0)
 #else
-    #define WriteHeader(to, id) do { \
-        if (NET_##id##_istemp) WriteByte(to, SVC_TEMPENTITY); \
-        WriteByte(to, NET_##id.m_id); \
-    } while (0)
+       #define WriteHeader(to, id) \
+               do \
+               { \
+                       if (NET_##id##_istemp) WriteByte(to, SVC_TEMPENTITY); \
+                       WriteByte(to, NET_##id.m_id); \
+               } \
+               while (0)
 #endif
 
 #ifdef CSQC
-    #define REGISTER_NET_LINKED(id, param) \
-        void Ent_Read##id(entity this, param) { this = self; } \
-        REGISTER(RegisterLinkedEntities, NET, LinkedEntities, id, m_id, spawn()) { \
-            this.netname = #id; \
-            this.m_read = Ent_Read##id; \
-        } \
-        [[accumulate]] void Ent_Read##id(entity this, param)
+       #define REGISTER_NET_LINKED(id, param) \
+               void Ent_Read##id(entity this, param) \
+               { \
+                       this = self; \
+               } \
+               REGISTER(RegisterLinkedEntities, NET, LinkedEntities, id, m_id, spawn()) \
+               { \
+                       this.netname = #id; \
+                       this.m_read = Ent_Read##id; \
+               } \
+               [[accumulate]] void Ent_Read##id(entity this, param)
 #else
-    #define REGISTER_NET_LINKED(id, param) \
-        const bool NET_##id##_istemp = false; \
-        REGISTER(RegisterLinkedEntities, NET, LinkedEntities, id, m_id, spawn()) { \
-            this.netname = #id; \
-        }
+       #define REGISTER_NET_LINKED(id, param) \
+               const bool NET_##id##_istemp = false; \
+               REGISTER(RegisterLinkedEntities, NET, LinkedEntities, id, m_id, spawn()) \
+               { \
+                       this.netname = #id; \
+               }
 #endif
 
 REGISTRY(LinkedEntities, BIT(0))
 REGISTER_REGISTRY(RegisterLinkedEntities)
 REGISTRY_SORT(LinkedEntities, netname, 0)
-STATIC_INIT(RegisterLinkedEntities_renumber) {
-    for (int i = 0; i < LinkedEntities_COUNT; ++i) {
-        LinkedEntities[i].m_id = 100 + i;
-    }
+STATIC_INIT(RegisterLinkedEntities_renumber)
+{
+       for (int i = 0; i < LinkedEntities_COUNT; ++i)
+               LinkedEntities[i].m_id = 100 + i;
 }
 
 #ifdef CSQC
-    #define REGISTER_NET_TEMP(id, param) \
-        void Net_Read##id(entity this, param); \
-        REGISTER(RegisterTempEntities, NET, TempEntities, id, m_id, spawn()) { \
-            this.netname = #id; \
-            this.m_read = Net_Read##id; \
-        } \
-        void Net_Read##id(entity this, param)
+       #define REGISTER_NET_TEMP(id, param) \
+               void Net_Read##id(entity this, param); \
+               REGISTER(RegisterTempEntities, NET, TempEntities, id, m_id, spawn()) \
+               { \
+                       this.netname = #id; \
+                       this.m_read = Net_Read##id; \
+               } \
+               void Net_Read##id(entity this, param)
 #else
-    #define REGISTER_NET_TEMP(id, param) \
-        const bool NET_##id##_istemp = true; \
-        REGISTER(RegisterTempEntities, NET, TempEntities, id, m_id, spawn()) { \
-            this.netname = #id; \
-        }
+       #define REGISTER_NET_TEMP(id, param) \
+               const bool NET_##id##_istemp = true; \
+               REGISTER(RegisterTempEntities, NET, TempEntities, id, m_id, spawn()) \
+               { \
+                       this.netname = #id; \
+               }
 #endif
 
 REGISTRY(TempEntities, BIT(0))
 REGISTER_REGISTRY(RegisterTempEntities)
 REGISTRY_SORT(TempEntities, netname, 0)
-STATIC_INIT(RegisterTempEntities_renumber) {
-    for (int i = 0; i < TempEntities_COUNT; ++i) {
-        TempEntities[i].m_id = 115 + i;
-    }
+STATIC_INIT(RegisterTempEntities_renumber)
+{
+       for (int i = 0; i < TempEntities_COUNT; ++i)
+               TempEntities[i].m_id = 115 + i;
 }
 
 #ifndef MENUQC
-#ifdef CSQC
-int ReadInt24_t()
-{
-    int v = ReadShort() << 8; // note: this is signed
-    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;
-}
-#else
-void WriteInt24_t(float dst, float val)
-{
-    float v;
-    WriteShort(dst, (v = floor(val >> 8)));
-    WriteByte(dst, val - (v << 8)); // 0..255
-}
-void WriteInt48_t(float dst, vector val)
-{
-    WriteInt24_t(dst, val.x);
-    WriteInt24_t(dst, val.y);
-}
-void WriteInt72_t(float dst, vector val)
-{
-    WriteInt24_t(dst, val.x);
-    WriteInt24_t(dst, val.y);
-    WriteInt24_t(dst, val.z);
-}
-#endif
+       #ifdef CSQC
+               int ReadInt24_t()
+               {
+                       int v = ReadShort() << 8; // note: this is signed
+                       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;
+               }
+       #else
+               void WriteInt24_t(float dst, float val)
+               {
+                       float v;
+                       WriteShort(dst, (v = floor(val >> 8)));
+                       WriteByte(dst, val - (v << 8));  // 0..255
+               }
+               void WriteInt48_t(float dst, vector val)
+               {
+                       WriteInt24_t(dst, val.x);
+                       WriteInt24_t(dst, val.y);
+               }
+               void WriteInt72_t(float dst, vector val)
+               {
+                       WriteInt24_t(dst, val.x);
+                       WriteInt24_t(dst, val.y);
+                       WriteInt24_t(dst, val.z);
+               }
+       #endif
 #endif
 
 #endif
index 87e3aea..6b9cdd0 100644 (file)
@@ -2,12 +2,12 @@
 #define NIL_H
 
 #ifdef QCC_SUPPORT_NIL
-#define func_null nil
-#define string_null nil
+       #define func_null nil
+       #define string_null nil
 #else
 // the NULL function
-var void func_null(void);
-string string_null;
+       var void func_null(void);
+       string string_null;
 #endif
 
 #endif
index 5bd6ad6..2987f78 100644 (file)
@@ -1,14 +1,14 @@
 // noises "usually" start in the range -1..1
 entityclass(Noise);
-class(Noise) .float noise_baccum;
-class(Noise) .float noise_paccum;
-class(Noise) .float noise_paccum2;
-class(Noise) .float noise_paccum3;
-class(Noise) .float noise_bstate;
+class(Noise).float noise_baccum;
+class(Noise).float noise_paccum;
+class(Noise).float noise_paccum2;
+class(Noise).float noise_paccum3;
+class(Noise).float noise_bstate;
 
 float Noise_Brown(entity e, float dt)
 {
-       e.noise_baccum += random() * sqrt(dt); // same stddev for all dt
+       e.noise_baccum += random() * sqrt(dt);  // same stddev for all dt
        return e.noise_baccum;
 }
 float Noise_Pink(entity e, float dt)
@@ -16,12 +16,9 @@ float Noise_Pink(entity e, float dt)
        float f;
        f = dt * 60;
        // http://home.earthlink.net/~ltrammell/tech/pinkalg.htm
-       if(random() > pow(0.3190, f))
-               e.noise_paccum = 0.34848 * (2 * random() - 1);
-       if(random() > pow(0.7756, f))
-               e.noise_paccum2 = 0.28768 * (2 * random() - 1);
-       if(random() > pow(0.9613, f))
-               e.noise_paccum3 = 0.43488 * (2 * random() - 1);
+       if (random() > pow(0.3190, f)) e.noise_paccum = 0.34848 * (2 * random() - 1);
+       if (random() > pow(0.7756, f)) e.noise_paccum2 = 0.28768 * (2 * random() - 1);
+       if (random() > pow(0.9613, f)) e.noise_paccum3 = 0.43488 * (2 * random() - 1);
        return e.noise_paccum + e.noise_paccum2 + e.noise_paccum3;
 }
 float Noise_White(entity e, float dt)
@@ -31,7 +28,6 @@ float Noise_White(entity e, float dt)
 /** +1 or -1 */
 float Noise_Burst(entity e, float dt, float p)
 {
-       if(random() > pow(p, dt))
-               e.noise_bstate = !e.noise_bstate;
+       if (random() > pow(p, dt)) e.noise_bstate = !e.noise_bstate;
        return 2 * e.noise_bstate - 1;
 }
index 0615282..8d60cda 100644 (file)
@@ -5,9 +5,9 @@
 #include "nil.qh"
 
 #ifdef MENUQC
-    #define NULL (null_entity)
+       #define NULL (null_entity)
 #else
-    #define NULL (world)
+       #define NULL (world)
 #endif
 
 .string classname;
 .string sourceLocFile;
 .int sourceLocLine;
 entity _spawn();
-entity __spawn(string _classname, string _sourceFile, int _sourceLine) {
-    entity this = _spawn();
-    this.classname = _classname;
-    this.sourceLocFile = _sourceFile;
-    this.sourceLocLine = _sourceLine;
-    return this;
+entity __spawn(string _classname, string _sourceFile, int _sourceLine)
+{
+       entity this = _spawn();
+       this.classname = _classname;
+       this.sourceLocFile = _sourceFile;
+       this.sourceLocLine = _sourceLine;
+       return this;
 }
 
 
-
 #define entityclass(...) EVAL(OVERLOAD(entityclass, __VA_ARGS__))
 #define entityclass_1(name) entityclass_2(name, Object)
 #ifndef QCC_SUPPORT_ENTITYCLASS
-    #define entityclass_2(name, base) typedef entity name
-    #define class(name)
-    #define new(class) __spawn(#class, __FILE__, __LINE__)
+       #define entityclass_2(name, base) typedef entity name
+       #define class(name)
+       #define new(class) __spawn( #class, __FILE__, __LINE__)
 #else
-    #define entityclass_2(name, base) entityclass name : base {}
-    #define class(name) [[class(name)]]
-    #define new(class) ((class) __spawn(#class, __FILE__, __LINE__))
+       #define entityclass_2(name, base) entityclass name : base {}
+       #define class(name) [[class(name)]]
+       #define new(class) ((class) __spawn( #class, __FILE__, __LINE__))
 #endif
 #define spawn() new(entity)
 
@@ -43,87 +43,107 @@ entity __spawn(string _classname, string _sourceFile, int _sourceLine) {
 
 // Macros to hide this implementation detail:
 #ifdef GMQCC
-#define NEW(cname, ...) \
-    OVERLOAD(spawn##cname, new(cname), ##__VA_ARGS__)
+       #define NEW(cname, ...) \
+               OVERLOAD(spawn##cname, new(cname),##__VA_ARGS__)
 
-#define CONSTRUCT(cname, ...) \
-    OVERLOAD(spawn##cname, this, ##__VA_ARGS__)
+       #define CONSTRUCT(cname, ...) \
+               OVERLOAD(spawn##cname, this,##__VA_ARGS__)
 #else
-#define NEW_(cname, ...) \
-    OVERLOAD_(spawn##cname, __VA_ARGS__)
-#define NEW(cname, ...) \
-    NEW_(cname, new(cname), ##__VA_ARGS__)(new(cname), ##__VA_ARGS__)
-
-#define CONSTRUCT_(cname, ...) \
-    OVERLOAD_(spawn##cname, __VA_ARGS__)
-#define CONSTRUCT(cname, ...) \
-    CONSTRUCT_(cname, this, ##__VA_ARGS__)(this, ##__VA_ARGS__)
+       #define NEW_(cname, ...) \
+               OVERLOAD_(spawn##cname, __VA_ARGS__)
+       #define NEW(cname, ...) \
+               NEW_(cname, new(cname),##__VA_ARGS__)(new(cname),##__VA_ARGS__)
+
+       #define CONSTRUCT_(cname, ...) \
+               OVERLOAD_(spawn##cname, __VA_ARGS__)
+       #define CONSTRUCT(cname, ...) \
+               CONSTRUCT_(cname, this,##__VA_ARGS__)(this,##__VA_ARGS__)
 #endif
 
 #define CONSTRUCTOR(cname, ...) \
-    cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) { return = this; } \
-    [[accumulate]] cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__)
+       cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) \
+       { \
+               return = this; \
+       } \
+       [[accumulate]] cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__)
 
 .string vtblname;
 .entity vtblbase;
 
-void RegisterClasses() { }
-STATIC_INIT(RegisterClasses) { RegisterClasses(); }
+void RegisterClasses() {}
+STATIC_INIT(RegisterClasses)
+{
+       RegisterClasses();
+}
 
 #define VTBL(cname, base) \
-    INIT_STATIC(cname); \
-    entity cname##_vtbl; \
-    void cname##_vtbl_init() { \
-        cname e = new(vtbl); \
-        spawn##cname##_static(e); \
-        e.vtblname = #cname; \
-        /* Top level objects refer to themselves */ \
-        e.vtblbase = base##_vtbl ? base##_vtbl : e; \
-        cname##_vtbl = e; \
-    } \
-    ACCUMULATE_FUNCTION(RegisterClasses, cname##_vtbl_init)
+       INIT_STATIC(cname); \
+       entity cname##_vtbl; \
+       void cname##_vtbl_init() \
+       { \
+               cname e = new(vtbl); \
+               spawn##cname##_static(e); \
+               e.vtblname = #cname; \
+               /* Top level objects refer to themselves */ \
+               e.vtblbase = base##_vtbl ? base##_vtbl : e; \
+               cname##_vtbl = e; \
+       } \
+       ACCUMULATE_FUNCTION(RegisterClasses, cname##_vtbl_init)
 
 #define INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this)
 #define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this)
 
 #define CLASS(cname, base)                  \
-    entityclass(cname, base);               \
-    class(cname) .bool instanceOf##cname;   \
-    VTBL(cname, base)                       \
-    INIT_STATIC(cname) {                    \
-        if (cname##_vtbl) {                 \
-            copyentity(cname##_vtbl, this); \
-            return;                         \
-        }                                   \
-        spawn##base##_static(this);         \
-        this.instanceOf##cname = true;      \
-    }                                       \
-    INIT(cname) {                           \
-        /* Only statically initialize the current class, it contains everything it inherits */ \
-        if (cname##_vtbl.vtblname == this.classname) { \
-            spawn##cname##_static(this);    \
-            this.classname = #cname;        \
-            this.vtblname = string_null;    \
-            this.vtblbase = cname##_vtbl;   \
-        }                                   \
-        spawn##base##_1(this);              \
-    }
+       entityclass(cname, base);               \
+       class(cname).bool instanceOf##cname;   \
+       VTBL(cname, base)                       \
+       INIT_STATIC(cname) \
+       {                    \
+               if (cname##_vtbl) \
+               {                 \
+                       copyentity(cname##_vtbl, this); \
+                       return;                         \
+               }                                   \
+               spawn##base##_static(this);         \
+               this.instanceOf##cname = true;      \
+       }                                       \
+       INIT(cname) \
+       {                           \
+               /* Only statically initialize the current class, it contains everything it inherits */ \
+               if (cname##_vtbl.vtblname == this.classname) \
+               { \
+                       spawn##cname##_static(this);    \
+                       this.classname = #cname;        \
+                       this.vtblname = string_null;    \
+                       this.vtblbase = cname##_vtbl;   \
+               }                                   \
+               spawn##base##_1(this);              \
+       }
 
 #define METHOD(cname, name, prototype)      \
-    class(cname) .prototype name;           \
-    prototype cname##_##name;               \
-    INIT_STATIC(cname) { this.name = cname##_##name; } \
-    prototype cname##_##name
+       class(cname).prototype name;           \
+       prototype cname##_##name;               \
+       INIT_STATIC(cname) \
+       { \
+               this.name = cname##_##name; \
+       } \
+       prototype cname##_##name
 
 #define ATTRIB(cname, name, type, val)      \
-    class(cname) .type name;                \
-    INIT(cname) { this.name = val; }
+       class(cname).type name;                \
+       INIT(cname) \
+       { \
+               this.name = val; \
+       }
 
 #define ATTRIBARRAY(cname, name, type, cnt) \
-    class(cname) .type name[cnt];
+       class(cname).type name[cnt];
 
 #define ENDCLASS(cname) \
-    [[last]] INIT(cname) { return this; }
+       [[last]] INIT(cname) \
+       { \
+               return this; \
+       }
 
 #define SUPER(cname) (cname##_vtbl.vtblbase)
 #define super (this.vtblbase.vtblbase)
@@ -132,19 +152,23 @@ STATIC_INIT(RegisterClasses) { RegisterClasses(); }
 #define spawn_1(this)
 #define _vtbl NULL
 CLASS(Object, );
-    METHOD(Object, describe, string(entity this)) {
-        string s = _("No description");
-        if (cvar("developer")) {
-            for (int i = 0, n = numentityfields(); i < n; ++i) {
-                string value = getentityfieldstring(i, this);
-                if (value != "") s = sprintf("%s\n%s = %s", s, entityfieldname(i), value);
-            }
-        }
-        return s;
-    }
-    METHOD(Object, display, void(entity this, void(string name, string icon) returns)) {
-        returns(sprintf("entity %i", this), "nopreview_map");
-    }
+       METHOD(Object, describe, string(entity this))
+       {
+               string s = _("No description");
+               if (cvar("developer"))
+               {
+                       for (int i = 0, n = numentityfields(); i < n; ++i)
+                       {
+                               string value = getentityfieldstring(i, this);
+                               if (value != "") s = sprintf("%s\n%s = %s", s, entityfieldname(i), value);
+                       }
+               }
+               return s;
+       }
+       METHOD(Object, display, void(entity this, void(string name, string icon)returns))
+       {
+               returns(sprintf("entity %i", this), "nopreview_map");
+       }
 ENDCLASS(Object)
 #undef spawn_static
 #undef spawn_1
index 85c5396..ac04034 100644 (file)
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
-vector vec_bias(vector v, float f){
+vector vec_bias(vector v, float f)
+{
        vector c;
        c_x = v_x + f;
        c_y = v_y + f;
        c_z = v_z + f;
        return c;
 }
-vector vec_to_min (vector a, vector b) {
+vector vec_to_min(vector a, vector b)
+{
        vector c;
-       c_x = min (a_x, b_x);
-       c_y = min (a_y, b_y);
-       c_z = min (a_z, b_z);
+       c_x = min(a_x, b_x);
+       c_y = min(a_y, b_y);
+       c_z = min(a_z, b_z);
        return c;
 }
 
-vector vec_to_max (vector a, vector b) {
+vector vec_to_max(vector a, vector b)
+{
        vector c;
-       c_x = max (a_x, b_x);
-       c_y = max (a_y, b_y);
-       c_z = max (a_z, b_z);
+       c_x = max(a_x, b_x);
+       c_y = max(a_y, b_y);
+       c_z = max(a_z, b_z);
        return c;
 }
 
 // there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
-vector vec_bounds_in (vector point, vector a, vector b) {
+vector vec_bounds_in(vector point, vector a, vector b)
+{
        vector c, d, e;
 
-       d = vec_to_min(a,b);
-       e = vec_to_max(a,b);
+       d = vec_to_min(a, b);
+       e = vec_to_max(a, b);
 
        c = vec_to_max(point, d);
        c = vec_to_min(c, e);
 
        return c;
-
 }
 
-vector vec_bounds_out (vector point, vector a, vector b) {
+vector vec_bounds_out(vector point, vector a, vector b)
+{
        vector c, d, e;
 
-       d = vec_to_max(a,b);
-       e = vec_to_min(a,b);
+       d = vec_to_max(a, b);
+       e = vec_to_min(a, b);
 
        c = vec_to_max(point, d);
        c = vec_to_min(c, e);
 
        return c;
-
 }
 
-float angle_snap_f (float f, float increment){
-
+float angle_snap_f(float f, float increment)
+{
        float i;
-       for (i = 0; i <= 360; ){
-               if (f <= i - increment)
-                       return  i - increment;
+       for (i = 0; i <= 360; )
+       {
+               if (f <= i - increment) return i - increment;
                i = i + increment;
        }
 
        return 0;
 }
 
-vector angle_snap_vec (vector v,  float increment) {
+vector angle_snap_vec(vector v,  float increment)
+{
        vector c;
-       c_x = angle_snap_f (v_x, increment);
-       c_y = angle_snap_f (v_y, increment);
-       c_z = angle_snap_f (v_z, increment);
+       c_x = angle_snap_f(v_x, increment);
+       c_y = angle_snap_f(v_y, increment);
+       c_z = angle_snap_f(v_z, increment);
        return c;
 }
 
-vector aim_vec (vector origin, vector target) {
+vector aim_vec(vector origin, vector target)
+{
        vector v;
-       //we float around x and y, but rotate around z
+       // we float around x and y, but rotate around z
        v_x = target_x - origin_x;
        v_y = target_y - origin_y;
        v_z = origin_z - target_z;
-       //get the angles actual
+       // get the angles actual
        return vectoangles(normalize(v));
 }
index c92f26a..b1886ae 100644 (file)
 vector vec_bias(vector v, float f);
 
 
-vector vec_to_min (vector a, vector b);
-vector vec_to_max (vector a, vector b);
+vector vec_to_min(vector a, vector b);
+vector vec_to_max(vector a, vector b);
 
 // there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
-vector vec_bounds_in (vector point, vector a, vector b);
-vector vec_bounds_out (vector point, vector a, vector b);
+vector vec_bounds_in(vector point, vector a, vector b);
+vector vec_bounds_out(vector point, vector a, vector b);
 
-float angle_snap_f (float f, float increment);
-vector angle_snap_vec (vector v,  float increment);
+float angle_snap_f(float f, float increment);
+vector angle_snap_vec(vector v,  float increment);
 
-vector aim_vec (vector origin, vector target);
+vector aim_vec(vector origin, vector target);
index f89a3b0..6a8ce03 100644 (file)
@@ -1,34 +1,30 @@
 #ifdef CSQC
 #ifndef PLAYER_H
-#define PLAYER_H
+       #define PLAYER_H
 
-#include "string.qh"
+       #include "string.qh"
 
-#include "../client/main.qh"
-#include "../common/teams.qh"
+       #include "../client/main.qh"
+       #include "../common/teams.qh"
 
-int GetPlayerColorForce(int i)
-{
-       if(!teamplay)
-               return 0;
-       else
-               return stof(getplayerkeyvalue(i, "colors")) & 15;
-}
+       int GetPlayerColorForce(int i)
+       {
+               if (!teamplay) return 0;
+               else return stof(getplayerkeyvalue(i, "colors")) & 15;
+       }
 
-int GetPlayerColor(int i)
-{
-       if(!playerslots[i].gotscores) // unconnected
-               return NUM_SPECTATOR;
-       else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
-               return NUM_SPECTATOR;
-       else
-               return GetPlayerColorForce(i);
-}
+       int GetPlayerColor(int i)
+       {
+               if (!playerslots[i].gotscores)  // unconnected
+                       return NUM_SPECTATOR;
+               else if (stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR) return NUM_SPECTATOR;
+               else return GetPlayerColorForce(i);
+       }
 
-string GetPlayerName(int i)
-{
-       return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
-}
+       string GetPlayerName(int i)
+       {
+               return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
+       }
 
 #endif
 #endif
index ed112a5..f072946 100644 (file)
@@ -2,13 +2,13 @@
 #define PROGNAME_H
 
 #if defined(MENUQC)
-    #define PROGNAME "MENUQC"
+       #define PROGNAME "MENUQC"
 #elif defined(SVQC)
-    #define PROGNAME "SVQC"
+       #define PROGNAME "SVQC"
 #elif defined(CSQC)
-    #define PROGNAME "CSQC"
+       #define PROGNAME "CSQC"
 #else
-    #error "Unable to detect PROGNAME"
+       #error "Unable to detect PROGNAME"
 #endif
 
 #endif
index 149323b..6ae0f78 100644 (file)
@@ -2,80 +2,80 @@
 
 void RandomSelection_Init()
 {
-    RandomSelection_totalweight = 0;
-    RandomSelection_chosen_ent = NULL;
-    RandomSelection_chosen_float = 0;
-    RandomSelection_chosen_string = string_null;
-    RandomSelection_best_priority = -1;
+       RandomSelection_totalweight = 0;
+       RandomSelection_chosen_ent = NULL;
+       RandomSelection_chosen_float = 0;
+       RandomSelection_chosen_string = string_null;
+       RandomSelection_best_priority = -1;
 }
 
 void RandomSelection_Add(entity e, float f, string s, float weight, float priority)
 {
-    if (priority > RandomSelection_best_priority)
-    {
-        RandomSelection_best_priority = priority;
-        RandomSelection_chosen_ent = e;
-        RandomSelection_chosen_float = f;
-        RandomSelection_chosen_string = s;
-        RandomSelection_totalweight = weight;
-    }
-    else if (priority == RandomSelection_best_priority)
-    {
-        RandomSelection_totalweight += weight;
-        if (random() * RandomSelection_totalweight <= weight)
-        {
-            RandomSelection_chosen_ent = e;
-            RandomSelection_chosen_float = f;
-            RandomSelection_chosen_string = s;
-        }
-    }
+       if (priority > RandomSelection_best_priority)
+       {
+               RandomSelection_best_priority = priority;
+               RandomSelection_chosen_ent = e;
+               RandomSelection_chosen_float = f;
+               RandomSelection_chosen_string = s;
+               RandomSelection_totalweight = weight;
+       }
+       else if (priority == RandomSelection_best_priority)
+       {
+               RandomSelection_totalweight += weight;
+               if (random() * RandomSelection_totalweight <= weight)
+               {
+                       RandomSelection_chosen_ent = e;
+                       RandomSelection_chosen_float = f;
+                       RandomSelection_chosen_string = s;
+               }
+       }
 }
 
 
 // prandom - PREDICTABLE random number generator (not seeded yet)
 
 #ifdef USE_PRANDOM
-float prandom_seed;
-float prandom()
-{
-    float c;
-    c = crc16(false, strcat(ftos(prandom_seed), ftos(prandom_seed + M_PI)));
-    prandom_seed = c;
+       float prandom_seed;
+       float prandom()
+       {
+               float c;
+               c = crc16(false, strcat(ftos(prandom_seed), ftos(prandom_seed + M_PI)));
+               prandom_seed = c;
 
-#ifdef USE_PRANDOM_DEBUG
-    LOG_TRACE("RANDOM -> ", ftos(c), "\n");
-#endif
+       #ifdef USE_PRANDOM_DEBUG
+                       LOG_TRACE("RANDOM -> ", ftos(c), "\n");
+       #endif
 
-    return c / 65536; // in [0..1[
-}
+               return c / 65536;  // in [0..1[
+       }
 
-vector prandomvec()
-{
-    vector v;
+       vector prandomvec()
+       {
+               vector v;
 
-    do
-    {
-        v.x = prandom();
-        v.y = prandom();
-        v.z = prandom();
-    }
-    while(v * v > 1);
+               do
+               {
+                       v.x = prandom();
+                       v.y = prandom();
+                       v.z = prandom();
+               }
+               while (v * v > 1);
 
-    return v;
-}
+               return v;
+       }
 
-void psrandom(float seed)
-{
-    prandom_seed = seed;
-#ifdef USE_PRANDOM_DEBUG
-    LOG_TRACE("SRANDOM ", ftos(seed), "\n");
-#endif
-}
+       void psrandom(float seed)
+       {
+               prandom_seed = seed;
+       #ifdef USE_PRANDOM_DEBUG
+                       LOG_TRACE("SRANDOM ", ftos(seed), "\n");
+       #endif
+       }
 
-#ifdef USE_PRANDOM_DEBUG
-void prandom_debug()
-{
-    LOG_TRACE("Current random seed = ", ftos(prandom_seed), "\n");
-}
-#endif
+       #ifdef USE_PRANDOM_DEBUG
+               void prandom_debug()
+               {
+                       LOG_TRACE("Current random seed = ", ftos(prandom_seed), "\n");
+               }
+       #endif
 #endif
index 551cf21..5b7fb0d 100644 (file)
@@ -15,19 +15,19 @@ void RandomSelection_Add(entity e, float f, string s, float weight, float priori
 #define USE_PRANDOM
 
 #ifdef USE_PRANDOM
-float prandom();
-vector prandomvec();
+       float prandom();
+       vector prandomvec();
 
-void psrandom(float seed);
-#ifdef USE_PRANDOM_DEBUG
-void prandom_debug();
+       void psrandom(float seed);
+       #ifdef USE_PRANDOM_DEBUG
+               void prandom_debug();
+       #else
+               #define prandom_debug()
+       #endif
 #else
-#define prandom_debug()
-#endif
-#else
-#define prandom random
-#define prandomvec randomvec
-#define psrandom(x)
-#define prandom_debug()
+       #define prandom random
+       #define prandomvec randomvec
+       #define psrandom(x)
+       #define prandom_debug()
 #endif
 #endif
index 4c39a9d..811bbf3 100644 (file)
@@ -7,10 +7,10 @@
 #define REGISTER_INIT_POST(ns, id) [[accumulate]] void Register_##ns##_##id##_init_post(entity this)
 
 #define REGISTRY(id, max) \
-    void Register##id() {} \
-    const int id##_MAX = max; \
-    noref entity id[id##_MAX], id##_first, id##_last; \
-    int id##_COUNT;
+       void Register##id() {} \
+       const int id##_MAX = max; \
+       noref entity id[id##_MAX], id##_first, id##_last; \
+       int id##_COUNT;
 
 /**
  * Register a new entity with a global constructor.
  * @param inst      An expression to create a new instance, invoked for every registration
  */
 #define REGISTER(initfunc, ns, array, id, fld, inst)                \
-    entity ns##_##id;                                               \
-    REGISTER_INIT(ns, id) { }                                       \
-    REGISTER_INIT_POST(ns, id) { }                                  \
-    void Register_##ns##_##id() {                                   \
-        if (array##_COUNT >= array##_MAX) LOG_FATALF("Registry capacity exceeded (%s)", ftos(array##_MAX)); \
-        entity this = inst;                                         \
-        ns##_##id = this;                                           \
-        this.fld = array##_COUNT;                                   \
-        array[array##_COUNT++] = this;                              \
-        if (!array##_first)    array##_first = this;                \
-        if ( array##_last)     array##_last.REGISTRY_NEXT = this;   \
-        array##_last = this;                                        \
-        Register_##ns##_##id##_init(this);                          \
-        Register_##ns##_##id##_init_post(this);                     \
-    }                                                               \
-    ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id)             \
-    REGISTER_INIT(ns, id)
+       entity ns##_##id;                                               \
+       REGISTER_INIT(ns, id) {}                                       \
+       REGISTER_INIT_POST(ns, id) {}                                  \
+       void Register_##ns##_##id() \
+       {                                   \
+               if (array##_COUNT >= array##_MAX) LOG_FATALF("Registry capacity exceeded (%s)", ftos(array##_MAX)); \
+               entity this = inst;                                         \
+               ns##_##id = this;                                           \
+               this.fld = array##_COUNT;                                   \
+               array[array##_COUNT++] = this;                              \
+               if (!array##_first)    array##_first = this;                \
+               if (array##_last)     array##_last.REGISTRY_NEXT = this;   \
+               array##_last = this;                                        \
+               Register_##ns##_##id##_init(this);                          \
+               Register_##ns##_##id##_init_post(this);                     \
+       }                                                               \
+       ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id)             \
+       REGISTER_INIT(ns, id)
 
 /** internal next pointer */
 #define REGISTRY_NEXT enemy
 .entity REGISTRY_NEXT;
 
 #define REGISTRY_SORT(id, field, skip)                              \
-    void _REGISTRY_SWAP_##id(int i, int j, entity pass) {           \
-        i += skip; j += skip;                                       \
+       void _REGISTRY_SWAP_##id(int i, int j, entity pass) \
+       {           \
+               i += skip; j += skip;                                       \
                                                                     \
-        entity a = id[i], b = id[j];                                \
-        id[i] = b;                                                  \
-        id[j] = a;                                                  \
+               entity a = id[i], b = id[j];                                \
+               id[i] = b;                                                  \
+               id[j] = a;                                                  \
                                                                     \
-        entity a_next = a.REGISTRY_NEXT, b_next = b.REGISTRY_NEXT;  \
-        a.REGISTRY_NEXT = b_next;                                   \
-        b.REGISTRY_NEXT = a_next;                                   \
+               entity a_next = a.REGISTRY_NEXT, b_next = b.REGISTRY_NEXT;  \
+               a.REGISTRY_NEXT = b_next;                                   \
+               b.REGISTRY_NEXT = a_next;                                   \
                                                                     \
-        if (i == 0) id##_first = b;                                 \
-        else id[i - 1].REGISTRY_NEXT = b;                           \
+               if (i == 0) id##_first = b;                                 \
+               else id[i - 1].REGISTRY_NEXT = b;                           \
                                                                     \
-        if (j == 0) id##_first = a;                                 \
-        else id[j - 1].REGISTRY_NEXT = a;                           \
-    }                                                               \
-    float _REGISTRY_CMP_##id(int i, int j, entity pass) {           \
-        i += skip; j += skip;                                       \
-        string a = id[i].field;                                     \
-        string b = id[j].field;                                     \
-        return strcasecmp(a, b);                                    \
-    }                                                               \
-    STATIC_INIT(Registry_sort_##id) {                               \
-        heapsort(id##_COUNT - (skip), _REGISTRY_SWAP_##id, _REGISTRY_CMP_##id, NULL); \
-    }
+               if (j == 0) id##_first = a;                                 \
+               else id[j - 1].REGISTRY_NEXT = a;                           \
+       }                                                               \
+       float _REGISTRY_CMP_##id(int i, int j, entity pass) \
+       {           \
+               i += skip; j += skip;                                       \
+               string a = id[i].field;                                     \
+               string b = id[j].field;                                     \
+               return strcasecmp(a, b);                                    \
+       }                                                               \
+       STATIC_INIT(Registry_sort_##id) \
+       {                               \
+               heapsort(id##_COUNT - (skip), _REGISTRY_SWAP_##id, _REGISTRY_CMP_##id, NULL); \
+       }
 
 #endif
index 6ff7713..b74a881 100644 (file)
@@ -2,48 +2,55 @@
 #define REPLICATE_H
 #ifndef MENUQC
 
-#define REPLICATE(...) EVAL(OVERLOAD(REPLICATE, __VA_ARGS__))
+       #define REPLICATE(...) EVAL(OVERLOAD(REPLICATE, __VA_ARGS__))
 
-[[accumulate]] void ReplicateVars(entity this, string thisname, int i) { }
+       [[accumulate]] void ReplicateVars(entity this, string thisname, int i) {}
 
-#define REPLICATE_3(fld, type, var)         REPLICATE_4(fld, type, var, )
-#define REPLICATE_4(fld, type, var, func)   REPLICATE_##type(fld, var, func)
-#define REPLICATE_string(fld, var, func)    REPLICATE_7(fld, string, var, , \
-    { if (field) strunzone(field); field = strzone(it); }, \
-    { if (field) strunzone(field); field = string_null; }, \
-    { \
-        /* also initialize to the default value of func when requesting cvars */ \
-        string s = func(field); \
-        if (s != field) { \
-            strunzone(field); \
-            field = strzone(s); \
-        } \
-    })
-#define REPLICATE_float(fld, var, func)     REPLICATE_7(fld, float, var, func,  { field = stof(it); },          , )
-#define REPLICATE_bool(fld, var, func)      REPLICATE_7(fld, bool, var, func,   { field = boolean(stoi(it)); }, , )
-#define REPLICATE_int(fld, var, func)       REPLICATE_7(fld, int, var, func,    { field = stoi(it); },          , )
+       #define REPLICATE_3(fld, type, var) REPLICATE_4(fld, type, var, )
+       #define REPLICATE_4(fld, type, var, func) REPLICATE_##type(fld, var, func)
+       #define REPLICATE_string(fld, var, func) \
+               REPLICATE_7(fld, string, var, , \
+       { if (field) strunzone(field); field = strzone(it); }, \
+       { if (field) strunzone(field); field = string_null; }, \
+       { \
+               /* also initialize to the default value of func when requesting cvars */ \
+               string s = func(field); \
+               if (s != field) \
+               { \
+                   strunzone(field); \
+                   field = strzone(s); \
+               } \
+       })
+       #define REPLICATE_float(fld, var, func) REPLICATE_7(fld, float, var, func,  { field = stof(it); },          , )
+       #define REPLICATE_bool(fld, var, func) REPLICATE_7(fld, bool, var, func,   { field = boolean(stoi(it)); }, , )
+       #define REPLICATE_int(fld, var, func) REPLICATE_7(fld, int, var, func,    { field = stoi(it); },          , )
 
-#if defined(SVQC)
-    #define REPLICATE_7(fld, type, var, func, create, destroy, after) \
-        void ReplicateVars(entity this, string thisname, int i) { \
-            type field = this.fld; \
-            if (i < 0) { destroy } \
-            else { \
-                string it = func(argv(i + 1)); \
-                bool current = thisname == var; \
-                if (i > 0) { \
-                    if (current) { create } \
-                } else { \
-                    stuffcmd(this, "cl_cmd sendcvar " var "\n"); \
-                } \
-                if (current) { after } \
-            } \
-            this.fld = field; \
-        }
-#elif defined(CSQC)
-    // TODO
-    #define REPLICATE_7(fld, type, var, func, create, destroy, after)
-#endif
+       #if defined(SVQC)
+               #define REPLICATE_7(fld, type, var, func, create, destroy, after) \
+                       void ReplicateVars(entity this, string thisname, int i) \
+                       { \
+                               type field = this.fld; \
+                               if (i < 0) { destroy } \
+                               else \
+                               { \
+                                       string it = func(argv(i + 1)); \
+                                       bool current = thisname == var; \
+                                       if (i > 0) \
+                                       { \
+                                               if (current) { create } \
+                                       } \
+                                       else \
+                                       { \
+                                               stuffcmd(this, "cl_cmd sendcvar " var "\n"); \
+                                       } \
+                                       if (current) { after } \
+                               } \
+                               this.fld = field; \
+                       }
+       #elif defined(CSQC)
+               // TODO
+               #define REPLICATE_7(fld, type, var, func, create, destroy, after)
+       #endif
 
 #endif
 #endif
index eac0c64..743214a 100644 (file)
@@ -7,31 +7,31 @@
 
 // Step 1: auto oldself
 #if 1
-#define SELFPARAM() noref entity this = __self
-#define setself(s) (__self = s)
-#define self __self
+       #define SELFPARAM() noref entity this = __self
+       #define setself(s) (__self = s)
+       #define self __self
 #endif
 
 // Step 2: check SELFPARAM() is present for functions that use self
 #if 0
-#define SELFPARAM() [[alias("__self")]] noref entity this = __self
-#define setself(s) (__self = s)
-#define self this
+       #define SELFPARAM() [[alias("__self")]] noref entity this = __self
+       #define setself(s) (__self = s)
+       #define self this
 #endif
 
 // Step 3: const self
 #if 0
-#define SELFPARAM() noref const entity this = __self
-entity setself(entity e) { return self = e; }
-entity getself() { return self; }
-#define self getself()
+       #define SELFPARAM() noref const entity this = __self
+       entity setself(entity e) { return self = e; }
+       entity getself() { return self; }
+       #define self getself()
 #endif
 
 // Step 4: enable when possible
 // TODO: Remove SELFPARAM in favor of a parameter
 #if 0
-#define SELFPARAM() noref const entity this = __self
-#define self this
+       #define SELFPARAM() noref const entity this = __self
+       #define self this
 #endif
 
 #endif
index 0d3177a..7f2b61f 100644 (file)
@@ -2,74 +2,80 @@
 #define SORT_H
 
 /** is only ever called for i1 < i2 */
-typedef void(float i1, float i2, entity pass) swapfunc_t;
+typedef void (float i1, float i2, entity pass) swapfunc_t;
 /** <0 for <, ==0 for ==, >0 for > (like strcmp) */
-typedef float(float i1, float i2, entity pass) comparefunc_t;
+typedef float (float i1, float i2, entity pass) comparefunc_t;
 
 void heapsort(float n, swapfunc_t swap, comparefunc_t cmp, entity pass)
 {
-    int root, child;
+       int root, child;
 
-    // heapify
-    int start = floor((n - 2) / 2);
-    while (start >= 0) {
-        // siftdown(start, n - 1);
-        root = start;
-        while (root * 2 + 1 <= n - 1) {
-            child = root * 2 + 1;
-            if (child < n - 1 && cmp(child, child + 1, pass) < 0) {
-                child += 1;
-            }
-            if (cmp(root, child, pass) < 0) {
-                swap(root, child, pass);
-                root = child;
-            } else {
-                break;
-            }
-        }
-        // end of siftdown
-        --start;
-    }
+       // heapify
+       int start = floor((n - 2) / 2);
+       while (start >= 0)
+       {
+               // siftdown(start, n - 1);
+               root = start;
+               while (root * 2 + 1 <= n - 1)
+               {
+                       child = root * 2 + 1;
+                       if (child < n - 1 && cmp(child, child + 1, pass) < 0) child += 1;
+                       if (cmp(root, child, pass) < 0)
+                       {
+                               swap(root, child, pass);
+                               root = child;
+                       }
+                       else
+                       {
+                               break;
+                       }
+               }
+               // end of siftdown
+               --start;
+       }
 
-    // extract
-    int end = n - 1;
-    while (end > 0) {
-        swap(0, end, pass);
-        end -= 1;
-        // siftdown(0, end);
-        root = 0;
-        while (root * 2 + 1 <= end) {
-            child = root * 2 + 1;
-            if (child < end && cmp(child, child+1, pass) < 0) {
-                child += 1;
-            }
-            if (cmp(root, child, pass) < 0) {
-                swap(root, child, pass);
-                root = child;
-            } else {
-                break;
-            }
-        }
-        // end of siftdown
-    }
+       // extract
+       int end = n - 1;
+       while (end > 0)
+       {
+               swap(0, end, pass);
+               end -= 1;
+               // siftdown(0, end);
+               root = 0;
+               while (root * 2 + 1 <= end)
+               {
+                       child = root * 2 + 1;
+                       if (child < end && cmp(child, child + 1, pass) < 0) child += 1;
+                       if (cmp(root, child, pass) < 0)
+                       {
+                               swap(root, child, pass);
+                               root = child;
+                       }
+                       else
+                       {
+                               break;
+                       }
+               }
+               // end of siftdown
+       }
 }
 
 void shuffle(float n, swapfunc_t swap, entity pass)
 {
-    for (int i = 1; i < n; ++i) {
-        // swap i-th item at a random position from 0 to i
-        // proof for even distribution:
-        //   n = 1: obvious
-        //   n -> n+1:
-        //     item n+1 gets at any position with chance 1/(n+1)
-        //     all others will get their 1/n chance reduced by factor n/(n+1)
-        //     to be on place n+1, their chance will be 1/(n+1)
-        //     1/n * n/(n+1) = 1/(n+1)
-        //     q.e.d.
-        int j = floor(random() * (i + 1));
-        if (j != i)
-            swap(j, i, pass);
-    }
+       for (int i = 1; i < n; ++i)
+       {
+               // swap i-th item at a random position from 0 to i
+               // proof for even distribution:
+               //   n = 1: obvious
+               //   n -> n+1:
+               //     item n+1 gets at any position with chance 1/(n+1)
+               //     all others will get their 1/n chance reduced by factor n/(n+1)
+               //     to be on place n+1, their chance will be 1/(n+1)
+               //     1/n * n/(n+1) = 1/(n+1)
+               //     q.e.d.
+               int j = floor(random() * (i + 1));
+               if (j != i) swap(j, i, pass);
+       }
 }
 
 #endif
index fcaf6be..dfb3d7f 100644 (file)
@@ -11,111 +11,111 @@ entity Sort_Spawn()
 /*
 entity Sort_New(float(entity,entity) cmp)
 {
-       entity sort;
-       sort = spawn();
-       sort.sort_cmp = cmp;
-       sort.sort_next = world;
-       sort.chain = sort;
-       return sort;
+    entity sort;
+    sort = spawn();
+    sort.sort_cmp = cmp;
+    sort.sort_next = world;
+    sort.chain = sort;
+    return sort;
 }
 
 void Sort_Remove(entity sort)
 {
-       entity next;
-       while(sort.sort_next)
-       {
-               next = sort.sort_next;
-               remove(sort);
-               sort = next;
-       }
-       remove(sort);
+    entity next;
+    while(sort.sort_next)
+    {
+        next = sort.sort_next;
+        remove(sort);
+        sort = next;
+    }
+    remove(sort);
 }
 
 void Sort_Add(entity sort, entity ent)
 {
-       entity next, parent;
-       parent = sort;
-       next = sort.sort_next;
-       while(next)
-       {
-               if(!sort.sort_cmp(next, ent))
-                       break;
-               parent = next;
-               next = next.sort_next;
-       }
-       ent.sort_next = next;
-       ent.sort_prev = parent;
-       parent.sort_next = ent;
-       if(next)
-               next.sort_prev = ent;
+    entity next, parent;
+    parent = sort;
+    next = sort.sort_next;
+    while(next)
+    {
+        if(!sort.sort_cmp(next, ent))
+            break;
+        parent = next;
+        next = next.sort_next;
+    }
+    ent.sort_next = next;
+    ent.sort_prev = parent;
+    parent.sort_next = ent;
+    if(next)
+        next.sort_prev = ent;
 }
 
 void Sort_Reset(entity sort)
 {
-       sort.chain = sort;
+    sort.chain = sort;
 }
 
 float Sort_HasNext(entity sort)
 {
-       return (sort.chain.sort_next != world);
+    return (sort.chain.sort_next != world);
 }
 
 entity Sort_Next(entity sort)
 {
-       entity next;
-       next = sort.chain.sort_next;
-       if(!next) {
-               next = spawn();
-               sort.chain.sort_next = next;
-               next.sort_prev = sort.chain;
-               next.sort_next = world;
-       }
-       sort.chain = next;
-       return next;
+    entity next;
+    next = sort.chain.sort_next;
+    if(!next) {
+        next = spawn();
+        sort.chain.sort_next = next;
+        next.sort_prev = sort.chain;
+        next.sort_next = world;
+    }
+    sort.chain = next;
+    return next;
 }
 
 void Sort_Finish(entity sort)
 {
-       entity next;
-       next = sort.chain;
-       if(!next)
-               return;
+    entity next;
+    next = sort.chain;
+    if(!next)
+        return;
 
-       while(next.sort_next)
-       {
-               sort = next.sort_next;
-               next.sort_next = sort.sort_next;
-               remove(sort);
-       }
+    while(next.sort_next)
+    {
+        sort = next.sort_next;
+        next.sort_next = sort.sort_next;
+        remove(sort);
+    }
 }
 
 entity Sort_Get(entity sort, float i)
 {
-       for (; sort.sort_next && i > 0; --i)
-               sort = sort.sort_next;
-       return sort;
+    for (; sort.sort_next && i > 0; --i)
+        sort = sort.sort_next;
+    return sort;
 }
 */
 
 /*
 void Sort_Erase(entity ent)
 {
-       ent.sort_prev.sort_next = ent.sort_next;
-       if(ent.sort_next)
-               ent.sort_next.sort_prev = ent.sort_prev;
-       remove(ent);
+    ent.sort_prev.sort_next = ent.sort_next;
+    if(ent.sort_next)
+        ent.sort_next.sort_prev = ent.sort_prev;
+    remove(ent);
 }
 
 void Sort_RemoveOld(entity sort)
 {
-       entity tmp;
-       for(tmp = sort.sort_next; tmp; tmp = tmp.sort_next)
-       {
-               if(tmp.frame < time)
-               {
-                       tmp = tmp.sort_prev;
-                       Sort_Erase(tmp.sort_next);
-               }
-       }
+    entity tmp;
+    for(tmp = sort.sort_next; tmp; tmp = tmp.sort_next)
+    {
+        if(tmp.frame < time)
+        {
+            tmp = tmp.sort_prev;
+            Sort_Erase(tmp.sort_next);
+        }
+    }
 }
 */
index d4a1f18..eb8103f 100644 (file)
@@ -2,8 +2,8 @@
 #define SORTLIST_H
 
 entityclass(Sort);
-//.float(entity,entity) sort_cmp;
-class(Sort) .entity chain, sort_next, sort_prev;
+// .float(entity,entity) sort_cmp;
+class(Sort).entity chain, sort_next, sort_prev;
 
 entity Sort_Spawn();
 
@@ -12,12 +12,12 @@ entity Sort_Spawn();
  * @param a FIRST entity
  * @param b entity after a
  */
-#define SORT_SWAP(a,b)                                                                 \
-       b.sort_prev = a.sort_prev;                                                      \
-       a.sort_next = b.sort_next;                                                      \
-       if(b.sort_next) b.sort_next.sort_prev = a;                      \
-       if(a.sort_prev) a.sort_prev.sort_next = b;                      \
-       a.sort_prev = b;                                                                        \
+#define SORT_SWAP(a, b)                                  \
+       b.sort_prev = a.sort_prev;                          \
+       a.sort_next = b.sort_next;                          \
+       if (b.sort_next) b.sort_next.sort_prev = a;          \
+       if (a.sort_prev) a.sort_prev.sort_next = b;          \
+       a.sort_prev = b;                                    \
        b.sort_next = a
 
 #endif
index 1ab059c..f4242eb 100644 (file)
@@ -7,161 +7,168 @@ noref bool require_spawnfunc_prefix;
 
 // Optional type checking; increases compile time too much to be enabled by default
 #if 0
-bool entityfieldassignablefromeditor(int i) {
-    switch (entityfieldtype(i)) {
-        case FIELD_STRING:
-        case FIELD_FLOAT:
-        case FIELD_VECTOR:
-            return true;
-    }
-    return false;
-}
+       bool entityfieldassignablefromeditor(int i)
+       {
+               switch (entityfieldtype(i))
+               {
+                       case FIELD_STRING:
+                       case FIELD_FLOAT:
+                       case FIELD_VECTOR:
+                               return true;
+               }
+               return false;
+       }
 
-#define _spawnfunc_checktypes(fld) if (fieldname == #fld) \
-    if (!entityfieldassignablefromeditor(i)) LOG_FATALF("Entity field '%s' cannot be whitelisted\n", fieldname);
+       #define _spawnfunc_checktypes(fld) \
+               if (fieldname == #fld) \
+                       if (!entityfieldassignablefromeditor(i)) LOG_FATALF("Entity field '%s' cannot be whitelisted\n", fieldname);
 #else
-#define _spawnfunc_checktypes(fld)
+       #define _spawnfunc_checktypes(fld)
 #endif
-#define _spawnfunc_check(fld) if (fieldname == #fld) \
-    continue;
+       #define _spawnfunc_check(fld) \
+               if (fieldname == #fld) continue;
 
-#define spawnfunc_1(id, whitelist) spawnfunc_2(id, whitelist)
-#define spawnfunc_2(id, whitelist) void spawnfunc_##id(entity this) { \
-    this = self; \
-    if (!this.spawnfunc_checked) { \
-        for (int i = 0, n = numentityfields(); i < n; ++i) { \
-            string value = getentityfieldstring(i, this); \
-            string fieldname = entityfieldname(i); \
-            whitelist(_spawnfunc_checktypes) \
-            if (value == "") continue; \
-            if (fieldname == "") continue; \
-            FIELDS_COMMON(_spawnfunc_check) \
-            whitelist(_spawnfunc_check) \
-            LOG_WARNINGF(_("Entity field %s.%s (%s) is not whitelisted. If you believe this is an error, please file an issue.\n"), #id, fieldname, value); \
-        } \
-        this.spawnfunc_checked = true; \
-    } \
-} \
-[[accumulate]] void spawnfunc_##id(entity this)
+               #define spawnfunc_1(id, whitelist) spawnfunc_2(id, whitelist)
+       #define spawnfunc_2(id, whitelist) \
+               void spawnfunc_##id(entity this) \
+               { \
+                       this = self; \
+                       if (!this.spawnfunc_checked) \
+                       { \
+                               for (int i = 0, n = numentityfields(); i < n; ++i) \
+                               { \
+                                       string value = getentityfieldstring(i, this); \
+                                       string fieldname = entityfieldname(i); \
+                                       whitelist(_spawnfunc_checktypes) \
+                                       if (value == "") continue; \
+                                       if (fieldname == "") continue; \
+                                       FIELDS_COMMON(_spawnfunc_check) \
+                                       whitelist(_spawnfunc_check) \
+                                       LOG_WARNINGF(_("Entity field %s.%s (%s) is not whitelisted. If you believe this is an error, please file an issue.\n"), #id, fieldname, value); \
+                               } \
+                               this.spawnfunc_checked = true; \
+                       } \
+               } \
+               [[accumulate]] void spawnfunc_##id(entity this)
 
-#define FIELD_SCALAR(fld, n) \
-    fld(n)
-#define FIELD_VEC(fld, n) \
-    fld(n) \
-    fld(n##_x) \
-    fld(n##_y) \
-    fld(n##_z)
+       #define FIELD_SCALAR(fld, n) \
+               fld(n)
+       #define FIELD_VEC(fld, n) \
+               fld(n) \
+               fld(n##_x) \
+               fld(n##_y) \
+               fld(n##_z)
 
-#define FIELDS_NONE(fld)
-#define FIELDS_ALL(fld) if (false)
+       #define FIELDS_NONE(fld)
+       #define FIELDS_ALL(fld) if (false)
 
-#define FIELDS_COMMON(fld) \
-    FIELD_SCALAR(fld, classname) \
-    FIELD_SCALAR(fld, spawnfunc_checked) \
-    /**/
+       #define FIELDS_COMMON(fld) \
+               FIELD_SCALAR(fld, classname) \
+               FIELD_SCALAR(fld, spawnfunc_checked) \
+               /**/
 
-#define FIELDS_UNION(fld) \
-    FIELD_SCALAR(fld, Version) \
-    FIELD_SCALAR(fld, ammo_cells) \
-    FIELD_SCALAR(fld, ammo_nails) \
-    FIELD_SCALAR(fld, ammo_rockets) \
-    FIELD_SCALAR(fld, armorvalue) \
-    FIELD_SCALAR(fld, atten) \
-    FIELD_SCALAR(fld, bgmscriptdecay) \
-    FIELD_SCALAR(fld, bgmscriptsustain) \
-    FIELD_SCALAR(fld, bgmscript) \
-    FIELD_SCALAR(fld, button0) \
-    FIELD_SCALAR(fld, cnt) \
-    FIELD_SCALAR(fld, colormap) \
-    FIELD_SCALAR(fld, count) \
-    FIELD_SCALAR(fld, curvetarget) \
-    FIELD_SCALAR(fld, cvarfilter) \
-    FIELD_SCALAR(fld, debrisdamageforcescale) \
-    FIELD_SCALAR(fld, debrisfadetime) \
-    FIELD_SCALAR(fld, debristimejitter) \
-    FIELD_SCALAR(fld, debristime) \
-    FIELD_SCALAR(fld, debris) \
-    FIELD_SCALAR(fld, delay) \
-    FIELD_SCALAR(fld, dmgtime) \
-    FIELD_SCALAR(fld, dmg) \
-    FIELD_SCALAR(fld, dmg_edge) \
-    FIELD_SCALAR(fld, dmg_force) \
-    FIELD_SCALAR(fld, dmg_radius) \
-    FIELD_SCALAR(fld, effects) \
-    FIELD_SCALAR(fld, flags) \
-    FIELD_SCALAR(fld, fog) \
-    FIELD_SCALAR(fld, frags) \
-    FIELD_SCALAR(fld, frame) \
-    FIELD_SCALAR(fld, gametypefilter) \
-    FIELD_SCALAR(fld, geomtype) \
-    FIELD_SCALAR(fld, gravity) \
-    FIELD_SCALAR(fld, health) \
-    FIELD_SCALAR(fld, height) \
-    FIELD_SCALAR(fld, impulse) \
-    FIELD_SCALAR(fld, killtarget) \
-    FIELD_SCALAR(fld, lerpfrac) \
-    FIELD_SCALAR(fld, light_lev) \
-    FIELD_SCALAR(fld, lip) \
-    FIELD_SCALAR(fld, loddistance1) \
-    FIELD_SCALAR(fld, lodmodel1) \
-    FIELD_SCALAR(fld, ltime) \
-    FIELD_SCALAR(fld, mdl) \
-    FIELD_SCALAR(fld, message2) \
-    FIELD_SCALAR(fld, message) \
-    FIELD_SCALAR(fld, modelindex) \
-    FIELD_SCALAR(fld, modelscale) \
-    FIELD_SCALAR(fld, model) \
-    FIELD_SCALAR(fld, monster_moveflags) \
-    FIELD_SCALAR(fld, movetype) \
-    FIELD_SCALAR(fld, netname) \
-    FIELD_SCALAR(fld, nextthink) \
-    FIELD_SCALAR(fld, noalign) \
-    FIELD_SCALAR(fld, noise1) \
-    FIELD_SCALAR(fld, noise2) \
-    FIELD_SCALAR(fld, noise) \
-    FIELD_SCALAR(fld, phase) \
-    FIELD_SCALAR(fld, platmovetype) \
-    FIELD_SCALAR(fld, race_place) \
-    FIELD_SCALAR(fld, radius) \
-    FIELD_SCALAR(fld, respawntimejitter) \
-    FIELD_SCALAR(fld, respawntime) \
-    FIELD_SCALAR(fld, restriction) \
-    FIELD_SCALAR(fld, scale) \
-    FIELD_SCALAR(fld, skin) \
-    FIELD_SCALAR(fld, solid) \
-    FIELD_SCALAR(fld, sound1) \
-    FIELD_SCALAR(fld, sounds) \
-    FIELD_SCALAR(fld, spawnflags) \
-    FIELD_SCALAR(fld, speed) \
-    FIELD_SCALAR(fld, strength) \
-    FIELD_SCALAR(fld, target2) \
-    FIELD_SCALAR(fld, target3) \
-    FIELD_SCALAR(fld, target4) \
-    FIELD_SCALAR(fld, targetname) \
-    FIELD_SCALAR(fld, target) \
-    FIELD_SCALAR(fld, target_random) \
-    FIELD_SCALAR(fld, target_range) \
-    FIELD_SCALAR(fld, team) \
-    FIELD_SCALAR(fld, turret_scale_health) \
-    FIELD_SCALAR(fld, turret_scale_range) \
-    FIELD_SCALAR(fld, turret_scale_respawn) \
-    FIELD_SCALAR(fld, volume) \
-    FIELD_SCALAR(fld, wait) \
-    FIELD_SCALAR(fld, warpzone_fadeend) \
-    FIELD_SCALAR(fld, warpzone_fadestart) \
-    FIELD_SCALAR(fld, weapon) \
-    FIELD_VEC(fld, absmax) \
-    FIELD_VEC(fld, absmin) \
-    FIELD_VEC(fld, angles) \
-    FIELD_VEC(fld, avelocity) \
-    FIELD_VEC(fld, maxs) \
-    FIELD_VEC(fld, maxs) \
-    FIELD_VEC(fld, mins) \
-    FIELD_VEC(fld, modelscale_vec) \
-    FIELD_VEC(fld, origin) \
-    FIELD_VEC(fld, velocity) \
-    /**/
+       #define FIELDS_UNION(fld) \
+               FIELD_SCALAR(fld, Version) \
+               FIELD_SCALAR(fld, ammo_cells) \
+               FIELD_SCALAR(fld, ammo_nails) \
+               FIELD_SCALAR(fld, ammo_rockets) \
+               FIELD_SCALAR(fld, armorvalue) \
+               FIELD_SCALAR(fld, atten) \
+               FIELD_SCALAR(fld, bgmscriptdecay) \
+               FIELD_SCALAR(fld, bgmscriptsustain) \
+               FIELD_SCALAR(fld, bgmscript) \
+               FIELD_SCALAR(fld, button0) \
+               FIELD_SCALAR(fld, cnt) \
+               FIELD_SCALAR(fld, colormap) \
+               FIELD_SCALAR(fld, count) \
+               FIELD_SCALAR(fld, curvetarget) \
+               FIELD_SCALAR(fld, cvarfilter) \
+               FIELD_SCALAR(fld, debrisdamageforcescale) \
+               FIELD_SCALAR(fld, debrisfadetime) \
+               FIELD_SCALAR(fld, debristimejitter) \
+               FIELD_SCALAR(fld, debristime) \
+               FIELD_SCALAR(fld, debris) \
+               FIELD_SCALAR(fld, delay) \
+               FIELD_SCALAR(fld, dmgtime) \
+               FIELD_SCALAR(fld, dmg) \
+               FIELD_SCALAR(fld, dmg_edge) \
+               FIELD_SCALAR(fld, dmg_force) \
+               FIELD_SCALAR(fld, dmg_radius) \
+               FIELD_SCALAR(fld, effects) \
+               FIELD_SCALAR(fld, flags) \
+               FIELD_SCALAR(fld, fog) \
+               FIELD_SCALAR(fld, frags) \
+               FIELD_SCALAR(fld, frame) \
+               FIELD_SCALAR(fld, gametypefilter) \
+               FIELD_SCALAR(fld, geomtype) \
+               FIELD_SCALAR(fld, gravity) \
+               FIELD_SCALAR(fld, health) \
+               FIELD_SCALAR(fld, height) \
+               FIELD_SCALAR(fld, impulse) \
+               FIELD_SCALAR(fld, killtarget) \
+               FIELD_SCALAR(fld, lerpfrac) \
+               FIELD_SCALAR(fld, light_lev) \
+               FIELD_SCALAR(fld, lip) \
+               FIELD_SCALAR(fld, loddistance1) \
+               FIELD_SCALAR(fld, lodmodel1) \
+               FIELD_SCALAR(fld, ltime) \
+               FIELD_SCALAR(fld, mdl) \
+               FIELD_SCALAR(fld, message2) \
+               FIELD_SCALAR(fld, message) \
+               FIELD_SCALAR(fld, modelindex) \
+               FIELD_SCALAR(fld, modelscale) \
+               FIELD_SCALAR(fld, model) \
+               FIELD_SCALAR(fld, monster_moveflags) \
+               FIELD_SCALAR(fld, movetype) \
+               FIELD_SCALAR(fld, netname) \
+               FIELD_SCALAR(fld, nextthink) \
+               FIELD_SCALAR(fld, noalign) \
+               FIELD_SCALAR(fld, noise1) \
+               FIELD_SCALAR(fld, noise2) \
+               FIELD_SCALAR(fld, noise) \
+               FIELD_SCALAR(fld, phase) \
+               FIELD_SCALAR(fld, platmovetype) \
+               FIELD_SCALAR(fld, race_place) \
+               FIELD_SCALAR(fld, radius) \
+               FIELD_SCALAR(fld, respawntimejitter) \
+               FIELD_SCALAR(fld, respawntime) \
+               FIELD_SCALAR(fld, restriction) \
+               FIELD_SCALAR(fld, scale) \
+               FIELD_SCALAR(fld, skin) \
+               FIELD_SCALAR(fld, solid) \
+               FIELD_SCALAR(fld, sound1) \
+               FIELD_SCALAR(fld, sounds) \
+               FIELD_SCALAR(fld, spawnflags) \
+               FIELD_SCALAR(fld, speed) \
+               FIELD_SCALAR(fld, strength) \
+               FIELD_SCALAR(fld, target2) \
+               FIELD_SCALAR(fld, target3) \
+               FIELD_SCALAR(fld, target4) \
+               FIELD_SCALAR(fld, targetname) \
+               FIELD_SCALAR(fld, target) \
+               FIELD_SCALAR(fld, target_random) \
+               FIELD_SCALAR(fld, target_range) \
+               FIELD_SCALAR(fld, team) \
+               FIELD_SCALAR(fld, turret_scale_health) \
+               FIELD_SCALAR(fld, turret_scale_range) \
+               FIELD_SCALAR(fld, turret_scale_respawn) \
+               FIELD_SCALAR(fld, volume) \
+               FIELD_SCALAR(fld, wait) \
+               FIELD_SCALAR(fld, warpzone_fadeend) \
+               FIELD_SCALAR(fld, warpzone_fadestart) \
+               FIELD_SCALAR(fld, weapon) \
+               FIELD_VEC(fld, absmax) \
+               FIELD_VEC(fld, absmin) \
+               FIELD_VEC(fld, angles) \
+               FIELD_VEC(fld, avelocity) \
+               FIELD_VEC(fld, maxs) \
+               FIELD_VEC(fld, maxs) \
+               FIELD_VEC(fld, mins) \
+               FIELD_VEC(fld, modelscale_vec) \
+               FIELD_VEC(fld, origin) \
+               FIELD_VEC(fld, velocity) \
+               /**/
 
-#define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__, FIELDS_UNION))
+       #define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__, FIELDS_UNION))
 
 #endif
index f7bcdcc..49ce802 100644 (file)
@@ -1,19 +1,19 @@
 #ifndef STATIC_H
 #define STATIC_H
 
-void __static_init() { }
+void __static_init() {}
 #define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
-void __static_init_late() {  }
+void __static_init_late() {}
 #define static_init_late() CALL_ACCUMULATED_FUNCTION(__static_init_late)
 
 #define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init, func)
 
 #define _STATIC_INIT(where, func) \
-    void _static_##func(); \
-    ACCUMULATE_FUNCTION(where, _static_##func) \
-    void _static_##func()
+       void _static_##func(); \
+       ACCUMULATE_FUNCTION(where, _static_##func) \
+       void _static_##func()
 
-#define STATIC_INIT(func)       _STATIC_INIT(__static_init,         func)
-#define STATIC_INIT_LATE(func)  _STATIC_INIT(__static_init_late,    func##_late)
+#define STATIC_INIT(func) _STATIC_INIT(__static_init,         func)
+#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init_late,    func##_late)
 
 #endif
index ede2edf..ca82ecc 100644 (file)
@@ -2,15 +2,15 @@
 #define STRING_H
 
 #ifndef SVQC
-float stringwidth_colors(string s, vector theSize)
-{
-    return stringwidth(s, true, theSize);
-}
-
-float stringwidth_nocolors(string s, vector theSize)
-{
-    return stringwidth(s, false, theSize);
-}
+       float stringwidth_colors(string s, vector theSize)
+       {
+               return stringwidth(s, true, theSize);
+       }
+
+       float stringwidth_nocolors(string s, vector theSize)
+       {
+               return stringwidth(s, false, theSize);
+       }
 #endif
 
 // Timer (#5)
@@ -18,16 +18,16 @@ float stringwidth_nocolors(string s, vector theSize)
 // TODO: macro
 string seconds_tostring(float sec)
 {
-    float minutes = floor(sec / 60);
-    sec -= minutes * 60;
-    return sprintf("%d:%02d", minutes, sec);
+       float minutes = floor(sec / 60);
+       sec -= minutes * 60;
+       return sprintf("%d:%02d", minutes, sec);
 }
 
 int ColorTranslateMode;
 
 string ColorTranslateRGB(string s)
 {
-    return (ColorTranslateMode & 1) ? strdecolorize(s) : s;
+       return (ColorTranslateMode & 1) ? strdecolorize(s) : s;
 }
 
 // color code replace, place inside of sprintf and parse the string... defaults described as constants
@@ -37,155 +37,155 @@ string autocvar_hud_colorset_foreground_2 = "3"; // F2 - Yellow // secondary pri
 string autocvar_hud_colorset_foreground_3 = "4"; // F3 - Blue   // tertiary priority or relatively inconsequential text
 string autocvar_hud_colorset_foreground_4 = "1"; // F4 - Red    // notice/attention grabbing texting
 // "kill" colors
-string autocvar_hud_colorset_kill_1 = "1"; // K1 - Red    // "bad" or "dangerous" text (death messages against you, kill notifications, etc)
-string autocvar_hud_colorset_kill_2 = "3"; // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type
-string autocvar_hud_colorset_kill_3 = "4"; // K3 - Blue   // "good" or "beneficial" text (you fragging someone, etc)
+string autocvar_hud_colorset_kill_1 = "1";       // K1 - Red    // "bad" or "dangerous" text (death messages against you, kill notifications, etc)
+string autocvar_hud_colorset_kill_2 = "3";       // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type
+string autocvar_hud_colorset_kill_3 = "4";       // K3 - Blue   // "good" or "beneficial" text (you fragging someone, etc)
 // background color
-string autocvar_hud_colorset_background = "7"; // BG - White // neutral/unimportant text
+string autocvar_hud_colorset_background = "7";   // BG - White // neutral/unimportant text
 
 /** color code replace, place inside of sprintf and parse the string */
 string CCR(string input)
 {
-    // See the autocvar declarations in util.qh for default values
+       // See the autocvar declarations in util.qh for default values
 
-    // foreground/normal colors
-    input = strreplace("^F1", strcat("^", autocvar_hud_colorset_foreground_1), input);
-    input = strreplace("^F2", strcat("^", autocvar_hud_colorset_foreground_2), input);
-    input = strreplace("^F3", strcat("^", autocvar_hud_colorset_foreground_3), input);
-    input = strreplace("^F4", strcat("^", autocvar_hud_colorset_foreground_4), input);
+       // foreground/normal colors
+       input = strreplace("^F1", strcat("^", autocvar_hud_colorset_foreground_1), input);
+       input = strreplace("^F2", strcat("^", autocvar_hud_colorset_foreground_2), input);
+       input = strreplace("^F3", strcat("^", autocvar_hud_colorset_foreground_3), input);
+       input = strreplace("^F4", strcat("^", autocvar_hud_colorset_foreground_4), input);
 
-    // "kill" colors
-    input = strreplace("^K1", strcat("^", autocvar_hud_colorset_kill_1), input);
-    input = strreplace("^K2", strcat("^", autocvar_hud_colorset_kill_2), input);
-    input = strreplace("^K3", strcat("^", autocvar_hud_colorset_kill_3), input);
+       // "kill" colors
+       input = strreplace("^K1", strcat("^", autocvar_hud_colorset_kill_1), input);
+       input = strreplace("^K2", strcat("^", autocvar_hud_colorset_kill_2), input);
+       input = strreplace("^K3", strcat("^", autocvar_hud_colorset_kill_3), input);
 
-    // background colors
-    input = strreplace("^BG", strcat("^", autocvar_hud_colorset_background), input);
-    input = strreplace("^N", "^7", input); // "none"-- reset to white...
-    return input;
+       // background colors
+       input = strreplace("^BG", strcat("^", autocvar_hud_colorset_background), input);
+       input = strreplace("^N", "^7", input);  // "none"-- reset to white...
+       return input;
 }
 
 bool startsWith(string haystack, string needle)
 {
-    return substring(haystack, 0, strlen(needle)) == needle;
+       return substring(haystack, 0, strlen(needle)) == needle;
 }
 
 bool startsWithNocase(string haystack, string needle)
 {
-    return strcasecmp(substring(haystack, 0, strlen(needle)), needle) == 0;
+       return strcasecmp(substring(haystack, 0, strlen(needle)), needle) == 0;
 }
 
 /** unzone the string, and return it as tempstring. Safe to be called on string_null */
 string fstrunzone(string s)
 {
-    if (!s) return s;
-    string sc = strcat(s, "");
-    strunzone(s);
-    return sc;
+       if (!s) return s;
+       string sc = strcat(s, "");
+       strunzone(s);
+       return sc;
 }
 
 string car(string s)
 {
-    int o = strstrofs(s, " ", 0);
-    if (o < 0) return s;
-    return substring(s, 0, o);
+       int o = strstrofs(s, " ", 0);
+       if (o < 0) return s;
+       return substring(s, 0, o);
 }
 
 string cdr(string s)
 {
-    int o = strstrofs(s, " ", 0);
-    if (o < 0) return string_null;
-    return substring(s, o + 1, strlen(s) - (o + 1));
+       int o = strstrofs(s, " ", 0);
+       if (o < 0) return string_null;
+       return substring(s, o + 1, strlen(s) - (o + 1));
 }
 
 string substring_range(string s, float b, float e)
 {
-    return substring(s, b, e - b);
+       return substring(s, b, e - b);
 }
 
 string swapwords(string str, float i, float j)
 {
-    float n;
-    string s1, s2, s3, s4, s5;
-    float si, ei, sj, ej, s0, en;
-    n = tokenizebyseparator(str, " "); // must match g_maplist processing in ShuffleMaplist and "shuffle"
-    si = argv_start_index(i);
-    sj = argv_start_index(j);
-    ei = argv_end_index(i);
-    ej = argv_end_index(j);
-    s0 = argv_start_index(0);
-    en = argv_end_index(n-1);
-    s1 = substring_range(str, s0, si);
-    s2 = substring_range(str, si, ei);
-    s3 = substring_range(str, ei, sj);
-    s4 = substring_range(str, sj, ej);
-    s5 = substring_range(str, ej, en);
-    return strcat(s1, s4, s3, s2, s5);
+       float n;
+       string s1, s2, s3, s4, s5;
+       float si, ei, sj, ej, s0, en;
+       n = tokenizebyseparator(str, " ");  // must match g_maplist processing in ShuffleMaplist and "shuffle"
+       si = argv_start_index(i);
+       sj = argv_start_index(j);
+       ei = argv_end_index(i);
+       ej = argv_end_index(j);
+       s0 = argv_start_index(0);
+       en = argv_end_index(n - 1);
+       s1 = substring_range(str, s0, si);
+       s2 = substring_range(str, si, ei);
+       s3 = substring_range(str, ei, sj);
+       s4 = substring_range(str, sj, ej);
+       s5 = substring_range(str, ej, en);
+       return strcat(s1, s4, s3, s2, s5);
 }
 
 string _shufflewords_str;
 void _shufflewords_swapfunc(float i, float j, entity pass)
 {
-    _shufflewords_str = swapwords(_shufflewords_str, i, j);
+       _shufflewords_str = swapwords(_shufflewords_str, i, j);
 }
 string shufflewords(string str)
 {
-    _shufflewords_str = str;
-    int n = tokenizebyseparator(str, " ");
-    shuffle(n, _shufflewords_swapfunc, NULL);
-    str = _shufflewords_str;
-    _shufflewords_str = string_null;
-    return str;
+       _shufflewords_str = str;
+       int n = tokenizebyseparator(str, " ");
+       shuffle(n, _shufflewords_swapfunc, NULL);
+       str = _shufflewords_str;
+       _shufflewords_str = string_null;
+       return str;
 }
 
 string unescape(string in)
 {
-    in = strzone(in); // but it doesn't seem to be necessary in my tests at least
-
-    int len = strlen(in);
-    string str = "";
-    for (int i = 0; i < len; ++i) {
-        string s = substring(in, i, 1);
-        if (s == "\\") {
-            s = substring(in, i + 1, 1);
-            if (s == "n")
-                str = strcat(str, "\n");
-            else if (s == "\\")
-                str = strcat(str, "\\");
-            else
-                str = strcat(str, substring(in, i, 2));
-            ++i;
-            continue;
-        }
-        str = strcat(str, s);
-    }
-    strunzone(in);
-    return str;
+       in = strzone(in);  // but it doesn't seem to be necessary in my tests at least
+
+       int len = strlen(in);
+       string str = "";
+       for (int i = 0; i < len; ++i)
+       {
+               string s = substring(in, i, 1);
+               if (s == "\\")
+               {
+                       s = substring(in, i + 1, 1);
+                       if (s == "n") str = strcat(str, "\n");
+                       else if (s == "\\") str = strcat(str, "\\");
+                       else str = strcat(str, substring(in, i, 2));
+                       ++i;
+                       continue;
+               }
+               str = strcat(str, s);
+       }
+       strunzone(in);
+       return str;
 }
 
 string strwords(string s, int w)
 {
-    int endpos = 0;
-    for (; w && endpos >= 0; --w) endpos = strstrofs(s, " ", endpos + 1);
-    if (endpos < 0) return s;
-    return substring(s, 0, endpos);
+       int endpos = 0;
+       for ( ; w && endpos >= 0; --w)
+               endpos = strstrofs(s, " ", endpos + 1);
+       if (endpos < 0) return s;
+       return substring(s, 0, endpos);
 }
 
 bool strhasword(string s, string w)
 {
-    return strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0;
+       return strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0;
 }
 
 int u8_strsize(string s)
 {
-    int l = 0;
-    for (int i = 0, c; (c = str2chr(s, i)) > 0; ++i, ++l)
-    {
-        l += (c >= 0x80);
-        l += (c >= 0x800);
-        l += (c >= 0x10000);
-    }
-    return l;
+       int l = 0;
+       for (int i = 0, c; (c = str2chr(s, i)) > 0; ++i, ++l)
+       {
+               l += (c >= 0x80);
+               l += (c >= 0x800);
+               l += (c >= 0x10000);
+       }
+       return l;
 }
 
 #endif
index 507c417..bce19f4 100644 (file)
@@ -2,34 +2,34 @@
 #define STRUCT_H
 
 #ifndef QCC_SUPPORT_STRUCT
-    #define _STRUCT_DECLARE(x, id, type, END) noref type x ##_## id ;
-    #define STRUCT_DECLARE(id, s) s(_STRUCT_DECLARE, id)
+       #define _STRUCT_DECLARE(x, id, type, END) noref type x##_##id;
+       #define STRUCT_DECLARE(id, s) s(_STRUCT_DECLARE, id)
 
-    #define _STRUCT_PARAM_(x, id, type) type x ##_## id ,
-    #define _STRUCT_PARAM_END(x, id, type) type x ##_## id
-    #define _STRUCT_PARAM(x, id, type, isend) _STRUCT_PARAM_##isend(x, id, type)
-    #define STRUCT_PARAM(id, s) s(_STRUCT_PARAM, id)
+       #define _STRUCT_PARAM_(x, id, type) type x##_##id,
+       #define _STRUCT_PARAM_END(x, id, type) type x##_##id
+       #define _STRUCT_PARAM(x, id, type, isend) _STRUCT_PARAM_##isend(x, id, type)
+       #define STRUCT_PARAM(id, s) s(_STRUCT_PARAM, id)
 
-    #define _STRUCT_PASS_(x, id, type) x ##_## id ,
-    #define _STRUCT_PASS_END(x, id, type) x ##_## id
-    #define _STRUCT_PASS(x, id, type, END) _STRUCT_PASS_##END(x, id, type)
-    #define STRUCT_PASS(id, s) s(_STRUCT_PASS, id)
+       #define _STRUCT_PASS_(x, id, type) x##_##id,
+       #define _STRUCT_PASS_END(x, id, type) x##_##id
+       #define _STRUCT_PASS(x, id, type, END) _STRUCT_PASS_##END(x, id, type)
+       #define STRUCT_PASS(id, s) s(_STRUCT_PASS, id)
 
-    #define _STRUCT_STORE_DST(_, it) it
-    #define _STRUCT_STORE_SRC(it, _) it
-    #define _CONCAT3_(a, b, c) a ## b ## c
-    #define _CONCAT3(a, b, c) _CONCAT3_(a, b, c)
-    #define _STRUCT_STORE(x, id, type, END) _CONCAT3(_STRUCT_STORE_DST x, _, id) = _CONCAT3(_STRUCT_STORE_SRC x, _, id);
-    #define STRUCT_STORE(from, to, s) s(_STRUCT_STORE, (from, to))
+       #define _STRUCT_STORE_DST(_, it) it
+       #define _STRUCT_STORE_SRC(it, _) it
+       #define _CONCAT3_(a, b, c) a##b##c
+       #define _CONCAT3(a, b, c) _CONCAT3_(a, b, c)
+       #define _STRUCT_STORE(x, id, type, END) _CONCAT3(_STRUCT_STORE_DST x, _, id) = _CONCAT3(_STRUCT_STORE_SRC x, _, id);
+       #define STRUCT_STORE(from, to, s) s(_STRUCT_STORE, (from, to))
 
-    #define STRUCT(id, ...)
+       #define STRUCT(id, ...)
 #else
-    #define STRUCT_DECLARE(id, type) type id;
-    #define STRUCT_PARAM(id, type) type id
-    #define STRUCT_PASS(id, type) id
-    #define STRUCT_STORE(from, to, s) to = from
-    #define _STRUCT_MEMBER(my, id, type, END) type id;
-    #define STRUCT(id, s) struct STRUCT_##id { s(_STRUCT_MEMBER, ) };
+       #define STRUCT_DECLARE(id, type) type id;
+       #define STRUCT_PARAM(id, type) type id
+       #define STRUCT_PASS(id, type) id
+       #define STRUCT_STORE(from, to, s) to = from
+       #define _STRUCT_MEMBER(my, id, type, END) type id;
+       #define STRUCT(id, s) struct STRUCT_##id { s(_STRUCT_MEMBER, ) };
 #endif
 
 #endif
index 23907fe..3929bf1 100644 (file)
@@ -6,7 +6,7 @@ float TEST_ok;
 void TEST_Fail(string cond)
 {
        LOG_INFOF("Assertion failed: ", cond);
-       //backtrace();
+       // backtrace();
        ++TEST_failed;
 }
 
@@ -19,14 +19,13 @@ float TEST_RunAll()
 {
        int f = 0;
        float n = numentityfields();
-       for(int i = 0; i < n; ++i)
+       for (int i = 0; i < n; ++i)
        {
                string name = entityfieldname(i);
-               if(substring(name, 0, 6) == "_TEST_")
-                       if(!TEST_Run(substring(name, 6, -1)))
-                               ++f;
+               if (substring(name, 0, 6) == "_TEST_")
+                       if (!TEST_Run(substring(name, 6, -1))) ++f;
        }
-       if(f)
+       if (f)
        {
                LOG_INFOF("%d tests failed\n", f);
                return 1;
@@ -43,12 +42,12 @@ float TEST_Run(string s)
        LOG_INFOF("%s: testing...\n", s);
        TEST_failed = TEST_ok = 0;
        callfunction(strcat("_TEST_", s));
-       if(TEST_failed > 0)
+       if (TEST_failed > 0)
        {
                LOG_INFOF("%s: %d items failed.\n", s, TEST_failed);
                return 0;
        }
-       else if(!TEST_ok)
+       else if (!TEST_ok)
        {
                LOG_INFOF("%s: did not complete.\n", s);
                return 0;
index edc2f5b..6cddb12 100644 (file)
@@ -1,7 +1,12 @@
 #ifndef TEST_H
 #define TEST_H
 
-#define TEST_Check(cond) do { if(!(cond)) TEST_Fail(#cond); } while(0)
+#define TEST_Check(cond) \
+       do \
+       { \
+               if (!(cond)) TEST_Fail( #cond); \
+       } \
+       while (0)
 
 void TEST_OK();
 void TEST_Fail(string cond);
index 9648b20..c60201b 100644 (file)
@@ -24,16 +24,13 @@ int autocvar__urllib_nextslot;
 
 float url_URI_Get_Callback(int id, float status, string data)
 {
-       if(id < MIN_URL_ID)
-               return 0;
+       if (id < MIN_URL_ID) return 0;
        id -= MIN_URL_ID;
-       if(id >= NUM_URL_ID)
-               return 0;
+       if (id >= NUM_URL_ID) return 0;
        entity e;
        e = url_fromid[id];
-       if(!e)
-               return 0;
-       if(e.url_rbuf >= 0 || e.url_wbuf >= 0)
+       if (!e) return 0;
+       if (e.url_rbuf >= 0 || e.url_wbuf >= 0)
        {
                LOG_INFOF("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url);
                return 0;
@@ -43,16 +40,15 @@ float url_URI_Get_Callback(int id, float status, string data)
        url_fromid[id] = NULL;
 
        // if we get here, we MUST have both buffers cleared
-       if(e.url_rbuf != -1 || e.url_wbuf != -1 || e.url_fh != URL_FH_CURL)
-               error("url_URI_Get_Callback: not a request waiting for data");
+       if (e.url_rbuf != -1 || e.url_wbuf != -1 || e.url_fh != URL_FH_CURL) error("url_URI_Get_Callback: not a request waiting for data");
 
-       if(status == 0)
+       if (status == 0)
        {
                // WE GOT DATA!
                float n, i;
                n = tokenizebyseparator(data, "\n");
                e.url_rbuf = buf_create();
-               if(e.url_rbuf < 0)
+               if (e.url_rbuf < 0)
                {
                        LOG_INFO("url_URI_Get_Callback: out of memory in buf_create\n");
                        e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
@@ -61,7 +57,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                        return 1;
                }
                e.url_rbufpos = 0;
-               if(e.url_rbuf < 0)
+               if (e.url_rbuf < 0)
                {
                        LOG_INFO("url_URI_Get_Callback: out of memory in buf_create\n");
                        e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
@@ -69,7 +65,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                        remove(e);
                        return 1;
                }
-               for(i = 0; i < n; ++i)
+               for (i = 0; i < n; ++i)
                        bufstr_set(e.url_rbuf, i, argv(i));
                e.url_ready(e, e.url_ready_pass, URL_READY_CANREAD);
                return 1;
@@ -88,9 +84,9 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
 {
        entity e;
        int i;
-       if(strstrofs(url, "://", 0) >= 0)
+       if (strstrofs(url, "://", 0) >= 0)
        {
-               switch(mode)
+               switch (mode)
                {
                        case FILE_WRITE:
                        case FILE_APPEND:
@@ -103,7 +99,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                e.url_url = strzone(url);
                                e.url_fh = URL_FH_CURL;
                                e.url_wbuf = buf_create();
-                               if(e.url_wbuf < 0)
+                               if (e.url_wbuf < 0)
                                {
                                        LOG_INFO("url_single_fopen: out of memory in buf_create\n");
                                        rdy(e, pass, URL_READY_ERROR);
@@ -122,15 +118,13 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                // read data only
 
                                // get slot for HTTP request
-                               for(i = autocvar__urllib_nextslot; i < NUM_URL_ID; ++i)
-                                       if(url_fromid[i] == NULL)
-                                               break;
-                               if(i >= NUM_URL_ID)
+                               for (i = autocvar__urllib_nextslot; i < NUM_URL_ID; ++i)
+                                       if (url_fromid[i] == NULL) break;
+                               if (i >= NUM_URL_ID)
                                {
-                                       for(i = 0; i < autocvar__urllib_nextslot; ++i)
-                                               if(url_fromid[i] == NULL)
-                                                       break;
-                                       if(i >= autocvar__urllib_nextslot)
+                                       for (i = 0; i < autocvar__urllib_nextslot; ++i)
+                                               if (url_fromid[i] == NULL) break;
+                                       if (i >= autocvar__urllib_nextslot)
                                        {
                                                LOG_INFO("url_single_fopen: too many concurrent requests\n");
                                                rdy(NULL, pass, URL_READY_ERROR);
@@ -139,7 +133,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                }
 
                                // GET the data
-                               if(!crypto_uri_postbuf(url, i + MIN_URL_ID, string_null, string_null, -1, 0))
+                               if (!crypto_uri_postbuf(url, i + MIN_URL_ID, string_null, string_null, -1, 0))
                                {
                                        LOG_INFO("url_single_fopen: failure in crypto_uri_postbuf\n");
                                        rdy(NULL, pass, URL_READY_ERROR);
@@ -165,9 +159,9 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                break;
                }
        }
-       else if(url == "-")
+       else if (url == "-")
        {
-               switch(mode)
+               switch (mode)
                {
                        case FILE_WRITE:
                        case FILE_APPEND:
@@ -188,7 +182,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
        {
                float fh;
                fh = fopen(url, mode);
-               if(fh < 0)
+               if (fh < 0)
                {
                        rdy(NULL, pass, URL_READY_ERROR);
                        return;
@@ -200,10 +194,8 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                        e.url_fh = fh;
                        e.url_ready = rdy;
                        e.url_ready_pass = pass;
-                       if(mode == FILE_READ)
-                               rdy(e, pass, URL_READY_CANREAD);
-                       else
-                               rdy(e, pass, URL_READY_CANWRITE);
+                       if (mode == FILE_READ) rdy(e, pass, URL_READY_CANREAD);
+                       else rdy(e, pass, URL_READY_CANWRITE);
                }
        }
 }
@@ -213,30 +205,28 @@ void url_fclose(entity e)
 {
        int i;
 
-       if(e.url_fh == URL_FH_CURL)
+       if (e.url_fh == URL_FH_CURL)
        {
-               if(e.url_rbuf == -1 || e.url_wbuf != -1) // not(post GET/POST request)
-               if(e.url_rbuf != -1 || e.url_wbuf == -1) // not(pre POST request)
-                       error("url_fclose: not closable in current state");
+               if (e.url_rbuf == -1 || e.url_wbuf != -1)     // not(post GET/POST request)
+                       if (e.url_rbuf != -1 || e.url_wbuf == -1) // not(pre POST request)
+                               error("url_fclose: not closable in current state");
 
                // closing an URL!
-               if(e.url_wbuf >= 0)
+               if (e.url_wbuf >= 0)
                {
                        // we are closing the write end (HTTP POST request)
 
                        // get slot for HTTP request
-                       for(i = autocvar__urllib_nextslot; i < NUM_URL_ID; ++i)
-                               if(url_fromid[i] == NULL)
-                                       break;
-                       if(i >= NUM_URL_ID)
+                       for (i = autocvar__urllib_nextslot; i < NUM_URL_ID; ++i)
+                               if (url_fromid[i] == NULL) break;
+                       if (i >= NUM_URL_ID)
                        {
-                               for(i = 0; i < autocvar__urllib_nextslot; ++i)
-                                       if(url_fromid[i] == NULL)
-                                               break;
-                               if(i >= autocvar__urllib_nextslot)
+                               for (i = 0; i < autocvar__urllib_nextslot; ++i)
+                                       if (url_fromid[i] == NULL) break;
+                               if (i >= autocvar__urllib_nextslot)
                                {
                                        LOG_INFO("url_fclose: too many concurrent requests\n");
-                                       e.url_ready(e,e.url_ready_pass, URL_READY_ERROR);
+                                       e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
                                        buf_del(e.url_wbuf);
                                        strunzone(e.url_url);
                                        remove(e);
@@ -245,7 +235,7 @@ void url_fclose(entity e)
                        }
 
                        // POST the data
-                       if(!crypto_uri_postbuf(e.url_url, i + MIN_URL_ID, "text/plain", "", e.url_wbuf, 0))
+                       if (!crypto_uri_postbuf(e.url_url, i + MIN_URL_ID, "text/plain", "", e.url_wbuf, 0))
                        {
                                LOG_INFO("url_fclose: failure in crypto_uri_postbuf\n");
                                e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
@@ -275,16 +265,16 @@ void url_fclose(entity e)
                        remove(e);
                }
        }
-       else if(e.url_fh == URL_FH_STDOUT)
+       else if (e.url_fh == URL_FH_STDOUT)
        {
-               e.url_ready(e, e.url_ready_pass, URL_READY_CLOSED); // closing creates no reading handle
+               e.url_ready(e, e.url_ready_pass, URL_READY_CLOSED);  // closing creates no reading handle
                remove(e);
        }
        else
        {
                // file
                fclose(e.url_fh);
-               e.url_ready(e, e.url_ready_pass, URL_READY_CLOSED); // closing creates no reading handle
+               e.url_ready(e, e.url_ready_pass, URL_READY_CLOSED);  // closing creates no reading handle
                remove(e);
        }
 }
@@ -292,17 +282,16 @@ void url_fclose(entity e)
 // with \n (blame FRIK_FILE)
 string url_fgets(entity e)
 {
-       if(e.url_fh == URL_FH_CURL)
+       if (e.url_fh == URL_FH_CURL)
        {
-               if(e.url_rbuf == -1)
-                       error("url_fgets: not readable in current state");
+               if (e.url_rbuf == -1) error("url_fgets: not readable in current state");
                // curl
                string s;
                s = bufstr_get(e.url_rbuf, e.url_rbufpos);
                e.url_rbufpos += 1;
                return s;
        }
-       else if(e.url_fh == URL_FH_STDOUT)
+       else if (e.url_fh == URL_FH_STDOUT)
        {
                // stdout
                return string_null;
@@ -317,15 +306,14 @@ string url_fgets(entity e)
 // without \n (blame FRIK_FILE)
 void url_fputs(entity e, string s)
 {
-       if(e.url_fh == URL_FH_CURL)
+       if (e.url_fh == URL_FH_CURL)
        {
-               if(e.url_wbuf == -1)
-                       error("url_fputs: not writable in current state");
+               if (e.url_wbuf == -1) error("url_fputs: not writable in current state");
                // curl
                bufstr_set(e.url_wbuf, e.url_wbufpos, s);
                e.url_wbufpos += 1;
        }
-       else if(e.url_fh == URL_FH_STDOUT)
+       else if (e.url_fh == URL_FH_STDOUT)
        {
                // stdout
                LOG_INFO(s);
@@ -341,9 +329,9 @@ void url_fputs(entity e, string s)
 void url_multi_ready(entity fh, entity me, float status)
 {
        float n;
-       if(status == URL_READY_ERROR || status < 0)
+       if (status == URL_READY_ERROR || status < 0)
        {
-               if(status == -422) // Unprocessable Entity
+               if (status == -422)  // Unprocessable Entity
                {
                        LOG_INFO("uri_multi_ready: got HTTP error 422, data is in unusable format - not continuing\n");
                        me.url_ready(fh, me.url_ready_pass, status);
@@ -353,7 +341,7 @@ void url_multi_ready(entity fh, entity me, float status)
                }
                me.url_attempt += 1;
                n = tokenize_console(me.url_url);
-               if(n <= me.url_attempt)
+               if (n <= me.url_attempt)
                {
                        me.url_ready(fh, me.url_ready_pass, status);
                        strunzone(me.url_url);
@@ -369,7 +357,7 @@ void url_multi_fopen(string url, int mode, url_ready_func rdy, entity pass)
 {
        float n;
        n = tokenize_console(url);
-       if(n <= 0)
+       if (n <= 0)
        {
                LOG_INFO("url_multi_fopen: need at least one URL\n");
                rdy(NULL, pass, URL_READY_ERROR);
index e4b8a8f..918504f 100644 (file)
@@ -16,7 +16,7 @@ const float URL_READY_CLOSED   =  0;
 const float URL_READY_CANWRITE =  1;
 const float URL_READY_CANREAD  =  2;
 // errors: -1, or negative HTTP status code
-typedef void(entity handle, entity pass, float status) url_ready_func;
+typedef void (entity handle, entity pass, float status) url_ready_func;
 
 void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass);
 void url_fclose(entity e);
index b57e27a..de32d20 100644 (file)
@@ -7,86 +7,90 @@ const vector eZ = '0 0 1';
 
 vector randompos(vector m1, vector m2)
 {
-    vector v;
-    m2 = m2 - m1;
-    v_x = m2_x * random() + m1_x;
-    v_y = m2_y * random() + m1_y;
-    v_z = m2_z * random() + m1_z;
-    return     v;
+       vector v;
+       m2 = m2 - m1;
+       v_x = m2_x * random() + m1_x;
+       v_y = m2_y * random() + m1_y;
+       v_z = m2_z * random() + m1_z;
+       return v;
 }
 
 float vlen2d(vector v)
 {
-    return sqrt(v.x * v.x + v.y * v.y);
+       return sqrt(v.x * v.x + v.y * v.y);
 }
 
 float vlen_maxnorm2d(vector v)
 {
-    return max(v.x, v.y, -v.x, -v.y);
+       return max(v.x, v.y, -v.x, -v.y);
 }
 
 float vlen_minnorm2d(vector v)
 {
-    return min(max(v.x, -v.x), max(v.y, -v.y));
+       return min(max(v.x, -v.x), max(v.y, -v.y));
 }
 
 float dist_point_line(vector p, vector l0, vector ldir)
 {
-    ldir = normalize(ldir);
+       ldir = normalize(ldir);
 
-    // remove the component in line direction
-    p = p - (p * ldir) * ldir;
+       // remove the component in line direction
+       p = p - (p * ldir) * ldir;
 
-    // vlen of the remaining vector
-    return vlen(p);
+       // vlen of the remaining vector
+       return vlen(p);
 }
 
 /** requires that m2>m1 in all coordinates, and that m4>m3 */
-float boxesoverlap(vector m1, vector m2, vector m3, vector m4) {return m2_x >= m3_x && m1_x <= m4_x && m2_y >= m3_y && m1_y <= m4_y && m2_z >= m3_z && m1_z <= m4_z;}
+float boxesoverlap(vector m1, vector m2, vector m3, vector m4) { return m2_x >= m3_x && m1_x <= m4_x && m2_y >= m3_y && m1_y <= m4_y && m2_z >= m3_z && m1_z <= m4_z; }
 
 /** requires the same as boxesoverlap, but is a stronger condition */
-float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) {return smins.x >= bmins.x && smaxs.x <= bmaxs.x && smins.y >= bmins.y && smaxs.y <= bmaxs.y && smins.z >= bmins.z && smaxs.z <= bmaxs.z;}
+float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) { return smins.x >= bmins.x && smaxs.x <= bmaxs.x && smins.y >= bmins.y && smaxs.y <= bmaxs.y && smins.z >= bmins.z && smaxs.z <= bmaxs.z; }
 
 
 vector vec2(vector v)
 {
-    v.z = 0;
-    return v;
+       v.z = 0;
+       return v;
 }
 
 vector vec3(float x, float y, float z)
 {
-    vector v; v.x = x; v.y = y; v.z = z;
-    return v;
+       vector v;
+       v.x = x;
+       v.y = y;
+       v.z = z;
+       return v;
 }
 
 #ifndef MENUQC
-vector get_corner_position(entity box, int corner)
-{
-    switch (corner) {
-        case 1: return vec3(box.absmin.x, box.absmin.y, box.absmin.z);
-        case 2: return vec3(box.absmax.x, box.absmin.y, box.absmin.z);
-        case 3: return vec3(box.absmin.x, box.absmax.y, box.absmin.z);
-        case 4: return vec3(box.absmin.x, box.absmin.y, box.absmax.z);
-        case 5: return vec3(box.absmax.x, box.absmax.y, box.absmin.z);
-        case 6: return vec3(box.absmin.x, box.absmax.y, box.absmax.z);
-        case 7: return vec3(box.absmax.x, box.absmin.y, box.absmax.z);
-        case 8: return vec3(box.absmax.x, box.absmax.y, box.absmax.z);
-        default: return '0 0 0';
-    }
-}
-
-vector NearestPointOnBox(entity box, vector org)
-{
-    vector m1 = box.mins + box.origin;
-    vector m2 = box.maxs + box.origin;
-
-    vector ret;
-    ret.x = bound(m1.x, org.x, m2.x);
-    ret.y = bound(m1.y, org.y, m2.y);
-    ret.z = bound(m1.z, org.z, m2.z);
-    return ret;
-}
+       vector get_corner_position(entity box, int corner)
+       {
+               switch (corner)
+               {
+                       case 1: return vec3(box.absmin.x, box.absmin.y, box.absmin.z);
+                       case 2: return vec3(box.absmax.x, box.absmin.y, box.absmin.z);
+                       case 3: return vec3(box.absmin.x, box.absmax.y, box.absmin.z);
+                       case 4: return vec3(box.absmin.x, box.absmin.y, box.absmax.z);
+                       case 5: return vec3(box.absmax.x, box.absmax.y, box.absmin.z);
+                       case 6: return vec3(box.absmin.x, box.absmax.y, box.absmax.z);
+                       case 7: return vec3(box.absmax.x, box.absmin.y, box.absmax.z);
+                       case 8: return vec3(box.absmax.x, box.absmax.y, box.absmax.z);
+                       default: return '0 0 0';
+               }
+       }
+
+       vector NearestPointOnBox(entity box, vector org)
+       {
+               vector m1 = box.mins + box.origin;
+               vector m2 = box.maxs + box.origin;
+
+               vector ret;
+               ret.x = bound(m1.x, org.x, m2.x);
+               ret.y = bound(m1.y, org.y, m2.y);
+               ret.z = bound(m1.z, org.z, m2.z);
+               return ret;
+       }
 #endif
 
 #endif
index 5af29fc..5b169f0 100644 (file)
@@ -1016,23 +1016,23 @@ align_oc_decl_colon                      = false    # false/true #ignore
 #
 
 # Whether to collapse empty blocks between '{' and '}'
-nl_collapse_empty_body                   = false    # false/true
+nl_collapse_empty_body                   = true     # false/true
 
 # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };'
 # WARNING: Code doesn't seem to use this feature - delete from the config?
-nl_assign_leave_one_liners               = false    # false/true
+nl_assign_leave_one_liners               = true     # false/true
 
 # Don't split one-line braced statements inside a class xx { } body
 # WARNING: Code doesn't seem to use this feature - delete from the config?
-nl_class_leave_one_liners                = false    # false/true
+nl_class_leave_one_liners                = true     # false/true
 
 # Don't split one-line enums: 'enum foo { BAR = 15 };'
 # WARNING: Code doesn't seem to use this feature - delete from the config?
-nl_enum_leave_one_liners                 = false    # false/true
+nl_enum_leave_one_liners                 = true     # false/true
 
 # Don't split one-line get or set functions
 # WARNING: Code doesn't seem to use this feature - delete from the config?
-nl_getset_leave_one_liners               = false    # false/true
+nl_getset_leave_one_liners               = true     # false/true
 
 # Don't split one-line function definitions - 'int foo() { return 0; }'
 nl_func_leave_one_liners                 = true     # false/true
@@ -1200,7 +1200,7 @@ nl_switch_brace                          = add      # ignore/add/remove/force
 nl_multi_line_cond                       = false    # false/true
 
 # Force a newline in a define after the macro name for multi-line defines.
-nl_multi_line_define                     = false    # false/true
+nl_multi_line_define                     = true     # false/true
 
 # Whether to put a newline before 'case' statement
 nl_before_case                           = false    # false/true
@@ -1307,7 +1307,7 @@ nl_fdef_brace                            = add      # ignore/add/remove/force
 nl_return_expr                           = remove   # ignore/add/remove/force
 
 # Whether to put a newline after semicolons, except in 'for' statements
-nl_after_semicolon                       = false    # false/true
+nl_after_semicolon                       = true     # false/true
 
 # Whether to put a newline after brace open.
 # This also adds a newline before the matching brace close.
@@ -1340,7 +1340,7 @@ nl_after_vbrace_close                    = false    # false/true
 nl_brace_struct_var                      = remove   # ignore/add/remove/force
 
 # Whether to alter newlines in '#define' macros
-nl_define_macro                          = false    # false/true
+nl_define_macro                          = true     # false/true
 
 # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'
 nl_squeeze_ifdef                         = false    # false/true
@@ -1390,7 +1390,7 @@ nl_class_colon                           = ignore   # ignore/add/remove/force
 
 # Change simple unbraced if statements into a one-liner
 # 'if(b)\n i++;' => 'if(b) i++;'
-nl_create_if_one_liner                   = false    # false/true
+nl_create_if_one_liner                   = true     # false/true
 
 # Change simple unbraced for statements into a one-liner
 # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);'
@@ -1636,7 +1636,7 @@ mod_sort_using                           = false    # false/true
 
 # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C]
 # This is generally a bad idea, as it may break your code.
-mod_sort_include                         = true     # false/true
+mod_sort_include                         = false     # false/true
 
 # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace.
 # WARNING: Code doesn't seem to use this feature - delete from the config?
@@ -1748,14 +1748,14 @@ cmt_insert_before_preproc                = false    # false/true
 
 # Control indent of preprocessors inside #if blocks at brace level 0
 # WARNING: Indifferent... please decide manually.
-pp_indent                                = ignore   # ignore/add/remove/force
+pp_indent                                = force    # ignore/add/remove/force
 
 # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false)
 pp_indent_at_level                       = false    # false/true
 
 # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1.
 # WARNING: Code doesn't seem to use this feature - delete from the config?
-pp_indent_count                          = 0        # number
+pp_indent_count                          = 4        # number
 
 # Add or remove space after # based on pp_level of #if blocks
 # NOTE: is 28 worse than ignore
@@ -1771,14 +1771,14 @@ pp_indent_region                         = 0        # number
 
 # Whether to indent the code between #region and #endregion
 # WARNING: Code doesn't seem to use this feature - delete from the config?
-pp_region_indent_code                    = false    # false/true
+pp_region_indent_code                    = true    # false/true
 
 # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level
 # WARNING: Code doesn't seem to use this feature - delete from the config?
-pp_indent_if                             = 0        # number
+pp_indent_if                             = 4        # number
 
 # Control whether to indent the code between #if, #else and #endif when not at file-level
-pp_if_indent_code                        = false    # false/true
+pp_if_indent_code                        = true    # false/true
 
 # Whether to indent '#define' at the brace level (true) or from column 1 (false)
 pp_define_at_level                       = true     # false/true