Devilution
Diablo devolved - magic behind the 1996 computer game
defs.h
Go to the documentation of this file.
1
7
#define DMAXX 40
8
#define DMAXY 40
9
10
#define LIGHTSIZE 6912 // 27 * 256
11
12
#define GMENU_SLIDER 0x40000000
13
#define GMENU_ENABLED 0x80000000
14
15
// must be unsigned to generate unsigned comparisons with pnum
16
#define MAX_PLRS 4
17
18
#define MAX_CHARACTERS 10
19
#define MAX_LVLMTYPES 16
20
// #define MAX_PATH 260
21
#define MAX_SEND_STR_LEN 80
22
#define MAX_SPELLS 37
23
24
#define MAXDEAD 31
25
#define MAXDUNX 112
26
#define MAXDUNY 112
27
#define MAXITEMS 127
28
#define MAXBELTITEMS 8
29
#define MAXLIGHTS 32
30
#define MAXMISSILES 125
31
#define MAXMONSTERS 200
32
#define MAXMULTIQUESTS 4
33
#define MAXOBJECTS 127
34
#define MAXPORTAL 4
35
#define MAXQUESTS 16
36
#define MAXTHEMES 50
37
#define MAXTILES 2048
38
#define MAXTRIGGERS 5
39
#define MAXVISION 32
40
#define MDMAXX 40
41
#define MDMAXY 40
42
#define MAXCHARLEVEL 51
43
#define ITEMTYPES 35
44
45
// number of inventory grid cells
46
#define NUM_INV_GRID_ELEM 40
47
#define INV_SLOT_SIZE_PX 28
48
49
// Item indestructible durability
50
#define DUR_INDESTRUCTIBLE 255
51
52
#define VOLUME_MIN -1600
53
#define VOLUME_MAX 0
54
55
// todo: enums
56
#define NUMLEVELS 17
57
#define SMITH_ITEMS 20
58
#define SMITH_PREMIUM_ITEMS 6
59
#define SMITH_MAX_VALUE 140000
60
#define SMITH_MAX_PREMIUM_VALUE 140000
61
62
// from diablo 2 beta
63
#define MAXEXP 2000000000
64
#define MAXRESIST 75
65
66
#define GOLD_SMALL_LIMIT 1000
67
#define GOLD_MEDIUM_LIMIT 2500
68
#define GOLD_MAX_LIMIT 5000
69
70
#define PLR_NAME_LEN 32
71
72
#define MAXPATHNODES 300
73
74
#define MAX_PATH_LENGTH 25
75
76
// 256 kilobytes + 3 bytes (demo leftover) for file magic (262147)
77
// final game uses 4-byte magic instead of 3
78
#define FILEBUFF ((256*1024)+3)
79
80
#define PMSG_COUNT 8
81
82
// Diablo Retail Version Game ID
83
#define GAME_ID ((int)'DRTL')
84
85
// Diablo uses a 256 color palette
86
// Entry 0-127 (0x00-0x7F) are level specific
87
// Entry 128-255 (0x80-0xFF) are global
88
89
// standard palette for all levels
90
// 8 or 16 shades per color
91
// example (dark blue): PAL16_BLUE+14, PAL8_BLUE+7
92
// example (light red): PAL16_RED+2, PAL8_RED
93
// example (orange): PAL16_ORANGE+8, PAL8_ORANGE+4
94
#define PAL8_BLUE 128
95
#define PAL8_RED 136
96
#define PAL8_YELLOW 144
97
#define PAL8_ORANGE 152
98
#define PAL16_BEIGE 160
99
#define PAL16_BLUE 176
100
#define PAL16_YELLOW 192
101
#define PAL16_ORANGE 208
102
#define PAL16_RED 224
103
#define PAL16_GRAY 240
104
105
#define SCREEN_WIDTH 640
106
#define SCREEN_HEIGHT 480
107
108
#define ZOOM_WIDTH 384
109
#define ZOOM_HEIGHT 224
110
111
// If defined, use 32-bit colors instead of 8-bit [Default -> Undefined]
112
//#define RGBMODE
113
114
#ifndef RGBMODE
115
#define SCREEN_BPP 8
116
#else
117
#define SCREEN_BPP 32
118
#endif
119
120
#define BORDER_LEFT 64
121
#define BORDER_TOP 160
122
#define BORDER_RIGHT 64
123
#define BORDER_BOTTOM 16
124
125
#define SCREEN_X BORDER_LEFT
126
#define SCREEN_Y BORDER_TOP
127
128
#define BUFFER_WIDTH (BORDER_LEFT + SCREEN_WIDTH + BORDER_RIGHT)
129
#define BUFFER_HEIGHT (BORDER_TOP + SCREEN_HEIGHT + BORDER_BOTTOM)
130
#define TILE_SIZE 32
131
132
#define PANEL_WIDTH 640
133
#define PANEL_HEIGHT 128
134
#define PANEL_TOP (SCREEN_HEIGHT - PANEL_HEIGHT)
135
#define PANEL_LEFT (SCREEN_WIDTH - PANEL_WIDTH) / 2
136
#define PANEL_X (SCREEN_X + PANEL_LEFT)
137
#define PANEL_Y (SCREEN_Y + PANEL_TOP)
138
139
#define SPANEL_WIDTH 320
140
#define SPANEL_HEIGHT 352
141
#define PANELS_COVER (SCREEN_WIDTH <= PANEL_WIDTH && SCREEN_HEIGHT <= SPANEL_HEIGHT + PANEL_HEIGHT)
142
143
#define RIGHT_PANEL (SCREEN_WIDTH - SPANEL_WIDTH)
144
#define RIGHT_PANEL_X (SCREEN_X + RIGHT_PANEL)
145
146
#if SCREEN_WIDTH <= PANEL_WIDTH
147
#define VIEWPORT_HEIGHT (SCREEN_HEIGHT - PANEL_HEIGHT)
148
#else
149
#define VIEWPORT_HEIGHT SCREEN_HEIGHT
150
#endif
151
152
#define DIALOG_TOP ((SCREEN_HEIGHT - PANEL_HEIGHT) / 2 - 18)
153
#define DIALOG_Y (SCREEN_Y + DIALOG_TOP)
154
155
#define SCREENXY(x, y) ((x) + SCREEN_X + ((y) + SCREEN_Y) * BUFFER_WIDTH)
156
157
#define MemFreeDbg(p) \
158
{ \
159
void *p__p; \
160
p__p = p; \
161
p = NULL; \
162
mem_free_dbg(p__p); \
163
}
164
165
#undef assert
166
167
#ifndef _DEBUG
168
#define assert(exp) ((void)0)
169
#else
170
#define assert(exp) (void)( (exp) || (assert_fail(__LINE__, __FILE__, #exp), 0) )
171
#endif
172
173
#define ERR_DLG(title, text) ErrDlg(title, text, __FILE__, __LINE__)
174
175
// To apply to certain functions which have local variables aligned by 1 for unknown yet reason
176
#if (_MSC_VER == 1200)
177
#define ALIGN_BY_1 __declspec(align(1))
178
#else
179
#define ALIGN_BY_1
180
#endif
181
182
#define SwapLE32 SDL_SwapLE32
183
#define SwapLE16 SDL_SwapLE16
184
185
#define ErrSdl() ErrDlg("SDL Error", SDL_GetError(), __FILE__, __LINE__)
186
187
#ifdef _MSC_VER
188
#define strcasecmp _stricmp
189
#define strncasecmp _strnicmp
190
#endif
Generated by
1.8.17