summaryrefslogtreecommitdiffstats
path: root/src/core/common.h
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-04-06 18:26:04 +0200
committerGitHub <noreply@github.com>2020-04-06 18:26:04 +0200
commitb991fd9766c77354454c76c906f7806680605500 (patch)
treef7425645eb83088646a72b713cd08a665947650e /src/core/common.h
parentImplement Init for Stats (diff)
parentfixed look behind bug (diff)
downloadre3-b991fd9766c77354454c76c906f7806680605500.tar
re3-b991fd9766c77354454c76c906f7806680605500.tar.gz
re3-b991fd9766c77354454c76c906f7806680605500.tar.bz2
re3-b991fd9766c77354454c76c906f7806680605500.tar.lz
re3-b991fd9766c77354454c76c906f7806680605500.tar.xz
re3-b991fd9766c77354454c76c906f7806680605500.tar.zst
re3-b991fd9766c77354454c76c906f7806680605500.zip
Diffstat (limited to 'src/core/common.h')
-rw-r--r--src/core/common.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/common.h b/src/core/common.h
index 3127cb12..b58b93af 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -8,9 +8,12 @@
#pragma warning(disable: 4996) // POSIX names
#include <stdint.h>
+#include <string.h>
#include <math.h>
-//#include <assert.h>
-#include <new>
+
+#ifdef WITHWINDOWS
+#include <Windows.h>
+#endif
#ifdef WITHD3D
#include <windows.h>
@@ -30,6 +33,16 @@
#undef near
#endif
+#ifndef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
+#ifndef min
+#define min(a,b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef ARRAYSIZE
+#define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a)))
+#endif
+
typedef uint8_t uint8;
typedef int8_t int8;
typedef uint16_t uint16;
@@ -202,6 +215,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))
+#define lerp(norm, min, max) ( (norm) * ((max) - (min)) + (min) )
#define STRINGIFY(x) #x
#define STR(x) STRINGIFY(x)