-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
h2def.h
420 lines (348 loc) · 9.89 KB
/
h2def.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
/**\file h2def.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1999 Activision
*
* 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
*/
#ifndef __H2DEF_H__
#define __H2DEF_H__
#ifndef __JHEXEN__
# error "Using jHexen headers without __JHEXEN__"
#endif
#include <stdio.h>
#include <string.h>
#ifdef WIN32
# pragma warning(disable:4244)
# define stricmp _stricmp
# define strnicmp _strnicmp
# define strlwr _strlwr
# define strupr _strupr
#endif
#include <de/c_wrapper.h>
#include <de/fixedpoint.h>
#include <de/gui/ddkey.h>
#include "doomsday.h"
#include "version.h"
#include "info.h"
// Predefined with some OS.
#ifdef UNIX
#include <limits.h>
#define MAXCHAR SCHAR_MAX
#define MAXSHORT SHRT_MAX
#define MAXINT INT_MAX
#define MAXLONG LONG_MAX
#define MINCHAR SCHAR_MIN
#define MINSHORT SHRT_MIN
#define MININT INT_MIN
#define MINLONG LONG_MIN
#else /* not UNIX */
#define MAXCHAR ((char)0x7f)
#define MAXSHORT ((short)0x7fff)
// Max pos 32-bit int.
#define MAXINT ((int)0x7fffffff)
#define MAXLONG ((long)0x7fffffff)
#define MINCHAR ((char)0x80)
#define MINSHORT ((short)0x8000)
// Max negative 32-bit integer.
#define MININT ((int)0x80000000)
#define MINLONG ((long)0x80000000)
#endif
#define Set DD_SetInteger
#define Get DD_GetInteger
// Verbose messages.
#define VERBOSE(code) { if(verbose >= 1) { code; } }
#define VERBOSE2(code) { if(verbose >= 2) { code; } }
DENG_EXTERN_C game_export_t gx;
//
// Global parameters/defines.
//
#define MOBJINFO (*_api_InternalData.mobjInfo)
#define STATES (*_api_InternalData.states)
#define VALIDCOUNT (*_api_InternalData.validCount)
typedef enum {
hexen_demo,
hexen,
hexen_deathkings,
hexen_betademo, // hexen_demo with some bugs
hexen_v10, // Hexen release 1.0
NUM_GAME_MODES
} gamemode_t;
// Game mode bits for the above.
#define GM_HEXEN_DEMO 0x1
#define GM_HEXEN 0x2
#define GM_HEXEN_DEATHKINGS 0x4
#define GM_HEXEN_BETA 0x8
#define GM_HEXEN_V10 0x10
#define GM_ANY (GM_HEXEN_DEMO|GM_HEXEN|GM_HEXEN_DEATHKINGS|GM_HEXEN_BETA|GM_HEXEN_V10)
#define SCREENWIDTH 320
#define SCREENHEIGHT 200
#define SCREEN_MUL 1
#define MAXPLAYERS 8
#define NUMPLAYERCOLORS 8
#define NUMTEAMS 8 // Color = team.
// Playsim, core timing rate in cycles per second.
#define TICRATE 35
#define TICSPERSEC 35
#define NUMSAVESLOTS 6
/**
* Difficulty/skill settings/filters.
*/
typedef enum {
SM_BABY,
SM_EASY,
SM_MEDIUM,
SM_HARD,
SM_NIGHTMARE,
NUM_SKILL_MODES
} skillmode_t;
/**
* Armor types.
*/
typedef enum {
ARMOR_FIRST,
ARMOR_ARMOR = ARMOR_FIRST,
ARMOR_SHIELD,
ARMOR_HELMET,
ARMOR_AMULET,
NUMARMOR
} armortype_t;
/**
* Player Classes
*/
typedef enum {
PCLASS_NONE = -1,
PCLASS_FIRST = 0,
PCLASS_FIGHTER = PCLASS_FIRST,
PCLASS_CLERIC,
PCLASS_MAGE,
PCLASS_PIG,
NUM_PLAYER_CLASSES
} playerclass_t;
#define VALID_PLAYER_CLASS(c) ((c) >= PCLASS_FIRST && (c) < NUM_PLAYER_CLASSES)
#define PCLASS_INFO(c) (&classInfo[c])
typedef struct classinfo_s{
playerclass_t plrClass;
const char* niceName;
boolean userSelectable;
mobjtype_t mobjType;
int normalState;
int runState;
int attackState;
int attackEndState;
int maxArmor;
int autoArmorSave;
fixed_t maxMove;
fixed_t forwardMove[2]; // walk, run.
fixed_t sideMove[2]; // walk, run.
int moveMul; // multiplier for above.
int turnSpeed[3]; // [normal, speed, initial].
int jumpTics; // wait inbetween jumps.
int failUseSound; // sound played when a use fails.
int armorIncrement[NUMARMOR];
int pieceX[3]; // temp.
textenum_t skillModeNames[NUM_SKILL_MODES];
} classinfo_t;
extern classinfo_t classInfo[NUM_PLAYER_CLASSES];
/**
* Game state (hi-level).
*
* The current state of the game: whether we are playing, gazing at the
* intermission screen, the game final animation, or a demo.
*/
typedef enum {
GS_MAP,
GS_INTERMISSION,
GS_FINALE,
GS_STARTUP,
GS_WAITING,
GS_INFINE,
NUM_GAME_STATES
} gamestate_t;
/**
* Keys (as in, keys to lockables).
*/
typedef enum {
KT_FIRST,
KT_KEY1 = KT_FIRST,
KT_KEY2,
KT_KEY3,
KT_KEY4,
KT_KEY5,
KT_KEY6,
KT_KEY7,
KT_KEY8,
KT_KEY9,
KT_KEYA,
KT_KEYB,
NUM_KEY_TYPES
} keytype_t;
/**
* Weapon ids.
*
* The defined weapons, including a marker indicating user has not changed
* weapon.
*/
typedef enum {
WT_FIRST,
WT_SECOND,
WT_THIRD,
WT_FOURTH,
NUM_WEAPON_TYPES,
WT_NOCHANGE // No pending weapon change.
} weapontype_t;
#define WPIECE1 1
#define WPIECE2 2
#define WPIECE3 4
#define VALID_WEAPONTYPE(val) ((val) >= WT_FIRST && (val) < WT_FIRST + NUM_WEAPON_TYPES)
#define NUMWEAPLEVELS 1 // Number of weapon power levels.
/**
* Ammunition types.
*/
typedef enum {
AT_FIRST,
AT_BLUEMANA = AT_FIRST,
AT_GREENMANA,
NUM_AMMO_TYPES,
AT_NOAMMO // Takes no ammo, used for staff, gauntlets.
} ammotype_t;
#define MAX_MANA 200
/**
* Powers, bestowable upon players only.
*/
typedef enum {
PT_NONE,
PT_INVULNERABILITY,
PT_ALLMAP,
PT_INFRARED,
PT_FLIGHT,
PT_SHIELD,
PT_HEALTH2,
PT_SPEED,
PT_MINOTAUR,
NUM_POWER_TYPES
} powertype_t;
#define INVULNTICS (30*TICRATE)
#define INVISTICS (60*TICRATE)
#define INFRATICS (120*TICRATE)
#define IRONTICS (60*TICRATE)
#define WPNLEV2TICS (40*TICRATE)
#define FLIGHTTICS (60*TICRATE)
#define SPEEDTICS (45*TICRATE)
#define MORPHTICS (40*TICRATE)
//#define MAULATORTICS (25*TICRATE)
/**
* Inventory Item Types:
*/
typedef enum {
IIT_NONE = 0,
IIT_FIRST = 1,
IIT_INVULNERABILITY = IIT_FIRST,
IIT_HEALTH,
IIT_SUPERHEALTH,
IIT_HEALINGRADIUS,
IIT_SUMMON,
IIT_TORCH,
IIT_EGG,
IIT_FLY,
IIT_BLASTRADIUS,
IIT_POISONBAG,
IIT_TELEPORTOTHER,
IIT_SPEED,
IIT_BOOSTMANA,
IIT_BOOSTARMOR,
IIT_TELEPORT,
// Puzzle items:
IIT_FIRSTPUZZITEM,
IIT_PUZZSKULL = IIT_FIRSTPUZZITEM,
IIT_PUZZGEMBIG,
IIT_PUZZGEMRED,
IIT_PUZZGEMGREEN1,
IIT_PUZZGEMGREEN2,
IIT_PUZZGEMBLUE1,
IIT_PUZZGEMBLUE2,
IIT_PUZZBOOK1,
IIT_PUZZBOOK2,
IIT_PUZZSKULL2,
IIT_PUZZFWEAPON,
IIT_PUZZCWEAPON,
IIT_PUZZMWEAPON,
IIT_PUZZGEAR1,
IIT_PUZZGEAR2,
IIT_PUZZGEAR3,
IIT_PUZZGEAR4,
NUM_INVENTORYITEM_TYPES
} inventoryitemtype_t;
#define MAXINVITEMCOUNT (25)
#define BLINKTHRESHOLD (4*TICRATE)
//enum { VX, VY, VZ }; // Vertex indices.
enum { CR, CG, CB, CA }; // Color indices.
#define IS_SERVER (Get(DD_SERVER))
#define IS_CLIENT (Get(DD_CLIENT))
#define IS_NETGAME (Get(DD_NETGAME))
#define IS_DEDICATED (Get(DD_DEDICATED))
#define SFXVOLUME (Get(DD_SFX_VOLUME)/17)
#define MUSICVOLUME (Get(DD_MUSIC_VOLUME)/17)
#define CONSOLEPLAYER (Get(DD_CONSOLEPLAYER))
#define DISPLAYPLAYER (Get(DD_DISPLAYPLAYER))
#define GAMETIC (*((timespan_t*) DD_GetVariable(DD_GAMETIC)))
// Uncomment, to enable all timebomb stuff.
#define TIMEBOMB_YEAR (95) // years since 1900
#define TIMEBOMB_STARTDATE (268) // initial date (9/26)
#define TIMEBOMB_ENDDATE (301) // end date (10/29)
extern int maulatorSeconds;
#define MAULATORTICS ((unsigned int) maulatorSeconds * TICSPERSEC)
// Most damage defined using HITDICE
#define HITDICE(a) ((1 + (P_Random() & 7)) * (a))
#define SBARHEIGHT (39) // status bar height at bottom of screen
#define TELEFOGHEIGHT (32)
#define DEFAULT_PLAYER_VIEWHEIGHT (48)
extern fixed_t finesine[5 * FINEANGLES / 4];
extern fixed_t *finecosine;
// Set if homebrew PWAD stuff has been added.
extern boolean modifiedgame;
#define MAX_PLAYER_STARTS (8)
void H2_Main(void);
void P_Init(void);
extern int localQuakeHappening[MAXPLAYERS];
byte P_Random(void);
void M_ResetRandom(void);
void SC_Open(const char* name);
void SC_OpenLump(lumpnum_t lumpNum);
void SC_OpenFile(const char* name);
void SC_Close(void);
boolean SC_GetString(void);
void SC_MustGetString(void);
void SC_MustGetStringName(char* name);
boolean SC_GetNumber(void);
void SC_MustGetNumber(void);
void SC_UnGet(void);
boolean SC_Compare(char* text);
int SC_MatchString(char** strings);
int SC_MustMatchString(char** strings);
void SC_ScriptError(char* message);
extern char* sc_String;
extern int sc_Number;
extern int sc_Line;
extern boolean sc_End;
extern boolean sc_Crossed;
extern boolean sc_FileScripts;
extern const char* sc_ScriptsDir;
#endif // __H2DEF_H__