summaryrefslogtreecommitdiff
path: root/src/qcommon/q_shared.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon/q_shared.h')
-rw-r--r--src/qcommon/q_shared.h35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 3f2cb9d5..1cedf6a8 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -38,8 +38,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
#define GAMENAME_FOR_MASTER "Tremulous"
+#define HEARTBEAT_FOR_MASTER GAMENAME_FOR_MASTER
+#define FLATLINE_FOR_MASTER GAMENAME_FOR_MASTER "dead"
#define MAX_TEAMNAME 32
+#define MAX_MASTER_SERVERS 5 // number of supported master servers
+
+#define DEMOEXT "dm_" // standard demo extension
#ifdef _MSC_VER
@@ -118,16 +123,6 @@ typedef int intptr_t;
#include <ctype.h>
#include <limits.h>
-// vsnprintf is ISO/IEC 9899:1999
-// abstracting this to make it portable
-#ifdef _WIN32
- #define Q_vsnprintf _vsnprintf
- #define Q_snprintf _snprintf
-#else
- #define Q_vsnprintf vsnprintf
- #define Q_snprintf snprintf
-#endif
-
#ifdef _MSC_VER
#include <io.h>
@@ -139,8 +134,15 @@ typedef int intptr_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
+
+ // vsnprintf is ISO/IEC 9899:1999
+ // abstracting this to make it portable
+ int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap);
#else
#include <stdint.h>
+
+ #define Q_vsnprintf vsnprintf
+ #define Q_snprintf snprintf
#endif
#endif
@@ -165,12 +167,13 @@ typedef int sfxHandle_t;
typedef int fileHandle_t;
typedef int clipHandle_t;
-#define PAD(x,y) (((x)+(y)-1) & ~((y)-1))
+#define PAD(x,y) (((x)+(y)-1) & ~((y)-1))
+#define PADLEN(x,y) (PAD((x), (y)) - (x))
#ifdef __GNUC__
-#define ALIGN(x) __attribute__((aligned(x)))
+#define QALIGN(x) __attribute__((aligned(x)))
#else
-#define ALIGN(x)
+#define QALIGN(x)
#endif
#ifndef NULL
@@ -184,7 +187,7 @@ typedef int clipHandle_t;
#define MAX_QINT 0x7fffffff
#define MIN_QINT (-MAX_QINT-1)
-#define ARRAY_LEN(x) (sizeof(x) / sizeof(*x))
+#define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x)))
// angle indexes
@@ -886,6 +889,7 @@ default values.
#define CVAR_SERVER_CREATED 0x0800 // cvar was created by a server the client connected to.
#define CVAR_VM_CREATED 0x1000 // cvar was created exclusively in one of the VMs.
+#define CVAR_PROTECTED 0x2000 // prevent modifying this var from VMs or the server
#define CVAR_NONEXISTENT 0xFFFFFFFF // Cvar doesn't exist.
// nothing outside the Cvar_*() functions should modify these fields!
@@ -1414,4 +1418,7 @@ typedef struct
#define DLP_PROMPTED 0x20 // prompt has been processed by client
#define DLP_STALE 0x40 // prompt is not being shown by UI VM
+#define LERP( a, b, w ) ( ( a ) * ( 1.0f - ( w ) ) + ( b ) * ( w ) )
+#define LUMA( red, green, blue ) ( 0.2126f * ( red ) + 0.7152f * ( green ) + 0.0722f * ( blue ) )
+
#endif // __Q_SHARED_H