/
dd_types.h
211 lines (181 loc) · 5.86 KB
/
dd_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/**\file dd_types.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2011 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2007-2011 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2006-2008 Jamie Jones <jamie_jones_au@yahoo.com.au>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/**
* Type Definitions
*/
#ifndef LIBDENG_TYPES_H
#define LIBDENG_TYPES_H
/** In Win32 TCHAR and related macros change size depending on if they are
using wide characters (unicode utf-16le) or ansi for functions and strings.
on Linux and OSX we use utf-8 by default - which conveniently maps to the
CHAR type. As a general guide, any other Win32 T style functions used,
should also be re-implemented here in an ANSI style form for use on Linix,
OSX, and any other UNIX style operating systems or build environments */
#ifndef WIN32
#define TCHAR CHAR
#define _T(__v__) __v__
#endif
#ifndef _MSC_VER
#include <stdint.h> // Not MSVC so use C99 standard header
#else
/* MSVC must define them ouselves.
ISO C9x Integer types - not all of them though, just what we need
If we need more the this, best of taking the header from MinGW for MSVC users */
/* 7.18.1.1 Exact-width integer types */
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
/* 7.18.1.2 Minimum-width integer types */
typedef signed char int_least8_t;
typedef unsigned char uint_least8_t;
typedef short int_least16_t;
typedef unsigned short uint_least16_t;
typedef int int_least32_t;
typedef unsigned uint_least32_t;
typedef long long int_least64_t;
typedef unsigned long long uint_least64_t;
/* 7.18.1.3 Fastest minimum-width integer types
* Not actually guaranteed to be fastest for all purposes
* Here we use the exact-width types for 8 and 16-bit ints.
*/
typedef char int_fast8_t;
typedef unsigned char uint_fast8_t;
typedef short int_fast16_t;
typedef unsigned short uint_fast16_t;
typedef int int_fast32_t;
typedef unsigned int uint_fast32_t;
typedef long long int_fast64_t;
typedef unsigned long long uint_fast64_t;
/* 7.18.1.5 Greatest-width integer types */
typedef long long intmax_t;
typedef unsigned long long uintmax_t;
#endif
// The C_DECL macro, used with functions.
#ifndef C_DECL
# ifdef WIN32
# define C_DECL __cdecl
# endif
# ifdef UNIX
# define C_DECL
# endif
#endif
#ifndef UNIX
typedef unsigned int uint;
typedef unsigned short ushort;
#else
typedef uint32_t uint;
typedef uint16_t ushort;
#endif
typedef int fixed_t;
typedef unsigned int angle_t;
typedef unsigned char byte;
typedef uint32_t ident_t;
typedef int gameid_t;
typedef uint32_t patchid_t;
typedef uint32_t materialnum_t;
typedef int lumpnum_t;
typedef int spritenum_t;
typedef unsigned short nodeindex_t;
typedef unsigned short thid_t;
typedef double timespan_t;
/**
* Unique identifier allocated by this subsystem and associated to each
* known font. Used as a logical public reference/handle to a font.
*/
typedef uint32_t fontid_t;
#define LUMPNAME_T_MAXLEN 9
#define LUMPNAME_T_LASTINDEX 8
typedef signed char lumpname_t[LUMPNAME_T_MAXLEN];
/**
* Resource Class.
*
* @ingroup fs
*/
typedef enum {
RC_NULL = -2, /// Not a real class, used internally during resource locator init.
RC_UNKNOWN = -1, /// Attempt to guess the class using heuristic evaluation of the path.
RESOURCECLASS_FIRST = 0,
RC_PACKAGE = RESOURCECLASS_FIRST,
RC_DEFINITION,
RC_GRAPHIC,
RC_MODEL,
RC_SOUND,
RC_MUSIC,
RC_FONT,
RESOURCECLASS_COUNT
} resourceclass_t;
#define VALID_RESOURCE_CLASS(n) ((n) >= RESOURCECLASS_FIRST && (n) < RESOURCECLASS_COUNT)
typedef struct trigger_s {
timespan_t duration;
timespan_t accum;
} trigger_t;
#ifdef __cplusplus
# define boolean int
#else // Plain C.
# ifndef __BYTEBOOL__
# define __BYTEBOOL__
# endif
typedef enum ddboolean_e { false, true } ddboolean_t;
# define boolean ddboolean_t
#endif
#define BAMS_BITS 16
#if BAMS_BITS == 32
typedef unsigned long binangle_t;
#elif BAMS_BITS == 16
typedef unsigned short binangle_t;
#else
typedef unsigned char binangle_t;
#endif
#define DDMAXCHAR ((char)0x7f)
#define DDMAXSHORT ((short)0x7fff)
#define DDMAXINT ((int)0x7fffffff) // max pos 32-bit int
#define DDMAXLONG ((long)0x7fffffff)
#define DDMAXFLOAT ((float)1E+37)
#define DDMINCHAR ((char)0x80)
#define DDMINSHORT ((short)0x8000)
#define DDMININT ((int)0x80000000) // max negative 32-bit integer
#define DDMINLONG ((long)0x80000000)
#define DDMINFLOAT ((float)-(1E+37))
// Predeclarations for map data types. The contents of these structs is
// declared in p_maptypes.h.
struct node_s;
struct vertex_s;
struct linedef_s;
struct side_s;
struct seg_s;
struct subsector_s;
struct sector_s;
struct polyblock_s;
struct polyobj_s;
struct plane_s;
struct surface_s;
struct material_s;
#include "dd_string.h"
#endif /* LIBDENG_TYPES_H */