| 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 |
#include <stdbool.h> |
| 43 |
typedef int dboolean; |
| 44 |
|
| 45 |
typedef unsigned char byte; |
| 46 |
|
| 47 |
//e6y |
| 48 |
#ifndef MAX |
| 49 |
#define MAX(a,b) ((a)>(b)?(a):(b)) |
| 50 |
#endif |
| 51 |
#ifndef MIN |
| 52 |
#define MIN(a,b) ((a)<(b)?(a):(b)) |
| 53 |
#endif |
| 54 |
#ifndef BETWEEN |
| 55 |
#define BETWEEN(l,u,x) ((l)>(x)?(l):(x)>(u)?(u):(x)) |
| 56 |
#endif |
| 57 |
|
| 58 |
#include <inttypes.h> |
| 59 |
#include <limits.h> |
| 60 |
|
| 61 |
#ifdef _MSC_VER |
| 62 |
#define strcasecmp _stricmp |
| 63 |
#define strncasecmp _strnicmp |
| 64 |
#endif |
| 65 |
|
| 66 |
#ifndef PATH_MAX |
| 67 |
#ifdef MAX_PATH |
| 68 |
#define PATH_MAX MAX_PATH |
| 69 |
#else |
| 70 |
#define PATH_MAX 1024 |
| 71 |
#endif |
| 72 |
#endif |
| 73 |
|
| 74 |
#ifdef __GNUC__ |
| 75 |
#define CONSTFUNC __attribute__((const)) |
| 76 |
#define PUREFUNC __attribute__((pure)) |
| 77 |
#define NORETURN __attribute__ ((noreturn)) |
| 78 |
#else |
| 79 |
#define CONSTFUNC |
| 80 |
#define PUREFUNC |
| 81 |
#define NORETURN |
| 82 |
#endif |
| 83 |
|
| 84 |
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L |
| 85 |
#define NORETURNC11 _Noreturn |
| 86 |
#else |
| 87 |
#define NORETURNC11 |
| 88 |
#endif |
| 89 |
|
| 90 |
// Definition of PACKEDATTR from Chocolate Doom |
| 91 |
#ifdef __GNUC__ |
| 92 |
#if defined(_WIN32) && !defined(__clang__) |
| 93 |
#define PACKEDATTR __attribute__((packed,gcc_struct)) |
| 94 |
#else |
| 95 |
#define PACKEDATTR __attribute__((packed)) |
| 96 |
#endif |
| 97 |
#else |
| 98 |
#define PACKEDATTR |
| 99 |
#endif |
| 100 |
|
| 101 |
#ifdef WIN32 |
| 102 |
#define C_DECL __cdecl |
| 103 |
#else |
| 104 |
#define C_DECL |
| 105 |
#endif |
| 106 |
|
| 107 |
#ifdef _MSC_VER |
| 108 |
#define INLINE __forceinline /* use __forceinline (VC++ specific) */ |
| 109 |
#else |
| 110 |
#define INLINE inline /* use standard inline */ |
| 111 |
#endif |
| 112 |
|
| 113 |
typedef enum { |
| 114 |
doom_12_compatibility, /* Doom v1.2 */ |
| 115 |
doom_1666_compatibility, /* Doom v1.666 */ |
| 116 |
doom2_19_compatibility, /* Doom & Doom 2 v1.9 */ |
| 117 |
ultdoom_compatibility, /* Ultimate Doom and Doom95 */ |
| 118 |
finaldoom_compatibility, /* Final Doom */ |
| 119 |
dosdoom_compatibility, /* DosDoom 0.47 */ |
| 120 |
tasdoom_compatibility, /* TASDoom */ |
| 121 |
boom_compatibility_compatibility, /* Boom's compatibility mode */ |
| 122 |
boom_201_compatibility, /* Boom v2.01 */ |
| 123 |
boom_202_compatibility, /* Boom v2.02 */ |
| 124 |
lxdoom_1_compatibility, /* LxDoom v1.3.2+ */ |
| 125 |
mbf_compatibility, /* MBF */ |
| 126 |
prboom_1_compatibility, /* PrBoom 2.03beta? */ |
| 127 |
prboom_2_compatibility, /* PrBoom 2.1.0-2.1.1 */ |
| 128 |
prboom_3_compatibility, /* PrBoom 2.2.x */ |
| 129 |
prboom_4_compatibility, /* PrBoom 2.3.x */ |
| 130 |
prboom_5_compatibility, /* PrBoom 2.4.0 */ |
| 131 |
prboom_6_compatibility, /* Latest PrBoom */ |
| 132 |
placeholder_18_compatibility, |
| 133 |
placeholder_19_compatibility, |
| 134 |
placeholder_20_compatibility, |
| 135 |
mbf21_compatibility, /* MBF21 */ |
| 136 |
MAX_COMPATIBILITY_LEVEL, /* Must be last entry */ |
| 137 |
/* Aliases follow */ |
| 138 |
boom_compatibility = boom_201_compatibility, /* Alias used by G_Compatibility */ |
| 139 |
best_compatibility = mbf21_compatibility |
| 140 |
} complevel_t_e; |
| 141 |
typedef int complevel_t; |
| 142 |
|
| 143 |
/* cph - from v_video.h, needed by gl_struct.h */ |
| 144 |
#define VPT_ALIGN_MASK 0xf |
| 145 |
#define VPT_STRETCH_MASK 0x1f |
| 146 |
enum patch_translation_e { |
| 147 |
// e6y: wide-res |
| 148 |
VPT_ALIGN_LEFT = 1, |
| 149 |
VPT_ALIGN_RIGHT = 2, |
| 150 |
VPT_ALIGN_TOP = 3, |
| 151 |
VPT_ALIGN_LEFT_TOP = 4, |
| 152 |
VPT_ALIGN_RIGHT_TOP = 5, |
| 153 |
VPT_ALIGN_BOTTOM = 6, |
| 154 |
VPT_ALIGN_WIDE = 7, |
| 155 |
VPT_ALIGN_LEFT_BOTTOM = 8, |
| 156 |
VPT_ALIGN_RIGHT_BOTTOM = 9, |
| 157 |
VPT_ALIGN_MAX = 10, |
| 158 |
VPT_STRETCH = 16, // Stretch to compensate for high-res |
| 159 |
VPT_EX_TEXT = 32, |
| 160 |
|
| 161 |
VPT_NONE = 128, // Normal |
| 162 |
VPT_FLIP = 256, // Flip image horizontally |
| 163 |
VPT_TRANS = 512, // Translate image via a translation table |
| 164 |
VPT_NOOFFSET = 1024, |
| 165 |
VPT_STRETCH_REAL = 2048, // [XA] VPT_STRETCH in gld_fillRect means "tile", rather than "stretch"... these flags probably need a rename. |
| 166 |
}; |
| 167 |
|
| 168 |
extern int global_patch_top_offset; |
| 169 |
|
| 170 |
#define BOTTOM_ALIGNMENT(x) ((x) == VPT_ALIGN_BOTTOM || \ |
| 171 |
(x) == VPT_ALIGN_LEFT_BOTTOM || \ |
| 172 |
(x) == VPT_ALIGN_RIGHT_BOTTOM) |
| 173 |
|
| 174 |
#define TOP_ALIGNMENT(x) ((x) == VPT_ALIGN_TOP || \ |
| 175 |
(x) == VPT_ALIGN_LEFT_TOP || \ |
| 176 |
(x) == VPT_ALIGN_RIGHT_TOP) |
| 177 |
|
| 178 |
#define arrlen(array) (sizeof(array) / sizeof(*array)) |
| 179 |
|
| 180 |
#endif |