1 /* Emacs style mode select   -*- C++ -*-
2  *-----------------------------------------------------------------------------
3  *
4  *
5  *  PrBoom: a Doom port merged with LxDoom and LSDLDoom
6  *  based on BOOM, a modified and improved DOOM engine
7  *  Copyright (C) 1999 by
8  *  id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9  *  Copyright (C) 1999-2006 by
10  *  Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
11  *  Copyright 2005, 2006 by
12  *  Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
13  *
14  *  This program is free software; you can redistribute it and/or
15  *  modify it under the terms of the GNU General Public License
16  *  as published by the Free Software Foundation; either version 2
17  *  of the License, or (at your option) any later version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  You should have received a copy of the GNU General Public License
25  *  along with this program; if not, write to the Free Software
26  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27  *  02111-1307, USA.
28  *
29  * DESCRIPTION:
30  *      Simple basic typedefs, isolated here to make it easier
31  *       separating modules.
32  *
33  *-----------------------------------------------------------------------------*/
34 
35 #ifndef __DOOMTYPE__
36 #define __DOOMTYPE__
37 
38 #ifdef HAVE_CONFIG_H
39 #include "config.h"
40 #endif
41 
42 #ifndef __BYTEBOOL__
43 #define __BYTEBOOL__
44 /* Fixed to use builtin bool type with C++. */
45 #ifdef __cplusplus
46 typedef bool dboolean;
47 #else
48 typedef enum {false, true} dboolean;
49 #endif
50 typedef unsigned char byte;
51 #endif
52 
53 //e6y
54 #ifndef MAX
55 #define MAX(a,b) ((a)>(b)?(a):(b))
56 #endif
57 #ifndef MIN
58 #define MIN(a,b) ((a)<(b)?(a):(b))
59 #endif
60 #ifndef BETWEEN
61 #define BETWEEN(l,u,x) ((l)>(x)?(l):(x)>(u)?(u):(x))
62 #endif
63 
64 
65 /* cph - Wrapper for the long long type, as Win32 used a different name.
66  * Except I don't know what to test as it's compiler specific
67  * Proff - I fixed it */
68 #ifndef _MSC_VER
69 typedef signed long long int_64_t;
70 typedef unsigned long long uint_64_t;
71 // define compiled-specific long-long contstant notation here
72 #define LONGLONG(num)   (uint_64_t)num ## ll
73 #else
74 typedef __int64 int_64_t;
75 typedef unsigned __int64 uint_64_t;
76 // define compiled-specific long-long contstant notation here
77 #define LONGLONG(num) (uint_64_t)num
78 #undef PATH_MAX
79 #define PATH_MAX 1024
80 #define strcasecmp _stricmp
81 #define strncasecmp _strnicmp
82 #define S_ISDIR(x) (((sbuf.st_mode & S_IFDIR)==S_IFDIR)?1:0)
83 #endif
84 
85 #ifdef __GNUC__
86 #define CONSTFUNC __attribute__((const))
87 #define PUREFUNC __attribute__((pure))
88 #define NORETURN __attribute__ ((noreturn))
89 #else
90 #define CONSTFUNC
91 #define PUREFUNC
92 #define NORETURN
93 #endif
94 
95 #ifdef WIN32
96 #define C_DECL __cdecl
97 #else
98 #define C_DECL
99 #endif
100 
101 #ifdef _MSC_VER
102   #define INLINE __forceinline /* use __forceinline (VC++ specific) */
103 #else
104   #define INLINE inline        /* use standard inline */
105 #endif
106 
107 /* CPhipps - use limits.h instead of depreciated values.h */
108 #include <limits.h>
109 
110 /* cph - move compatibility levels here so we can use them in d_server.c */
111 typedef enum {
112   doom_12_compatibility,   /* Doom v1.2 */
113   doom_1666_compatibility, /* Doom v1.666 */
114   doom2_19_compatibility,  /* Doom & Doom 2 v1.9 */
115   ultdoom_compatibility,   /* Ultimate Doom and Doom95 */
116   finaldoom_compatibility,     /* Final Doom */
117   dosdoom_compatibility,     /* DosDoom 0.47 */
118   tasdoom_compatibility,     /* TASDoom */
119   boom_compatibility_compatibility,      /* Boom's compatibility mode */
120   boom_201_compatibility,                /* Boom v2.01 */
121   boom_202_compatibility,                /* Boom v2.02 */
122   lxdoom_1_compatibility,                /* LxDoom v1.3.2+ */
123   mbf_compatibility,                     /* MBF */
124   prboom_1_compatibility,                /* PrBoom 2.03beta? */
125   prboom_2_compatibility,                /* PrBoom 2.1.0-2.1.1 */
126   prboom_3_compatibility,                /* PrBoom 2.2.x */
127   prboom_4_compatibility,                /* PrBoom 2.3.x */
128   prboom_5_compatibility,                /* PrBoom 2.4.0 */
129   prboom_6_compatibility,                /* Latest PrBoom */
130   MAX_COMPATIBILITY_LEVEL,               /* Must be last entry */
131   /* Aliases follow */
132   boom_compatibility = boom_201_compatibility, /* Alias used by G_Compatibility */
133   best_compatibility = prboom_6_compatibility,
134 } complevel_t_e;
135 typedef int complevel_t;
136 
137 /* cph - from v_video.h, needed by gl_struct.h */
138 #define VPT_ALIGN_MASK 0xf
139 #define VPT_STRETCH_MASK 0x1f
140 enum patch_translation_e {
141   // e6y: wide-res
142   VPT_ALIGN_LEFT         = 1,
143   VPT_ALIGN_RIGHT        = 2,
144   VPT_ALIGN_TOP          = 3,
145   VPT_ALIGN_LEFT_TOP     = 4,
146   VPT_ALIGN_RIGHT_TOP    = 5,
147   VPT_ALIGN_BOTTOM       = 6,
148   VPT_ALIGN_WIDE         = 7,
149   VPT_ALIGN_LEFT_BOTTOM  = 8,
150   VPT_ALIGN_RIGHT_BOTTOM = 9,
151   VPT_ALIGN_MAX          = 10,
152   VPT_STRETCH            = 16, // Stretch to compensate for high-res
153 
154   VPT_NONE    = 128, // Normal
155   VPT_FLIP    = 256, // Flip image horizontally
156   VPT_TRANS   = 512, // Translate image via a translation table
157   VPT_NOOFFSET = 1024,
158 };
159 
160 #endif
161