cleanup of BD style game elements in level editor
[rocksndiamonds.git] / src / libgame / types.h
1 // ============================================================================
2 // Artsoft Retro-Game Library
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // types.h
10 // ============================================================================
11
12 #ifndef TYPES_H
13 #define TYPES_H
14
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <stdarg.h>
18 #include <string.h>
19 #include <sys/types.h>
20
21
22 #if !defined(PLATFORM_WINDOWS)
23 typedef int boolean;
24 typedef unsigned char byte;
25 #endif
26
27 #ifdef TRUE
28 #undef TRUE
29 #endif
30
31 #ifdef FALSE
32 #undef FALSE
33 #endif
34
35 #ifdef AUTO
36 #undef AUTO
37 #endif
38
39 #define TRUE                    1
40 #define FALSE                   0
41 #define AUTO                    -1
42
43 #ifndef MIN
44 #define MIN(a, b)               ((a) < (b) ? (a) : (b))
45 #endif
46
47 #ifndef MAX
48 #define MAX(a, b)               ((a) > (b) ? (a) : (b))
49 #endif
50
51 #ifndef ABS
52 #define ABS(a)                  ((a) < 0 ? -(a) : (a))
53 #endif
54
55 #ifndef SIGN
56 #define SIGN(a)                 ((a) < 0 ? -1 : ((a) > 0 ? 1 : 0))
57 #endif
58
59 #ifndef ODD
60 #define ODD(a)                  (((a) & 1) == 1)
61 #endif
62
63 #ifndef EVEN
64 #define EVEN(a)                 (((a) & 1) == 0)
65 #endif
66
67 #define ARRAY_SIZE(array)       (sizeof(array) / sizeof(array[0]))
68
69 #define PTR_TO_INT(p)           ((int) (long) (p))
70 #define PTR_TO_UINT(p)          ((unsigned int) (unsigned long) (p))
71
72 #define INT_TO_PTR(i)           ((void *) (long) (i))
73 #define UINT_TO_PTR(u)          ((void *) (unsigned long) (u))
74
75 #define STRUCT_OFFSET(s, m)     (offsetof(s, m))
76
77
78 struct ListNode
79 {
80   char *key;
81   void *content;
82   struct ListNode *prev;
83   struct ListNode *next;
84 };
85 typedef struct ListNode ListNode;
86
87 struct DelayCounter
88 {
89   unsigned int value;
90   unsigned int count;
91 };
92 typedef struct DelayCounter DelayCounter;
93
94 #endif // TYPES_H