1 //**************************************************************************
2 //**
3 //** h2def.h : Heretic 2 : Raven Software, Corp.
4 //**
5 //** $RCSfile: h2def.h,v $
6 //** $Revision: 1.128 $
7 //** $Date: 96/01/16 10:35:31 $
8 //** $Author: bgokey $
9 //**
10 //**************************************************************************
11 
12 #ifndef __H2DEF__
13 #define __H2DEF__
14 #include <stdio.h>
15 #include <string.h>
16 #include <stdlib.h>
17 #include "st_start.h"
18 #ifdef __WATCOMC__
19 #include <malloc.h>
20 #define	strcasecmp strcmpi
21 #define	strncasecmp strnicmp
22 #endif
23 
24 #define VERSION 110
25 #define VERSION_TEXT "v1.1"
26 
27 /* XXX ifdefs */
28 
29 #ifndef __FreeBSD__
30 typedef unsigned int uint;
31 #else
32 #include <sys/types.h>
33 #endif
34 
35 // Uncomment, to enable all timebomb stuff
36 //#define TIMEBOMB
37 #define TIMEBOMB_YEAR	95		// years since 1900
38 #define TIMEBOMB_STARTDATE	268	// initial date (9/26)
39 #define TIMEBOMB_ENDDATE	301	// end date (10/29)
40 
41 // if rangecheck is undefined, most parameter validation debugging code
42 // will not be compiled
43 #ifndef NORANGECHECKING
44 #define RANGECHECK
45 #endif
46 
47 // Past distributions
48 #ifndef VER_ID
49 #define VER_ID "DVL"
50 #endif
51 //#define VERSIONTEXT "ID V1.2"
52 //#define VERSIONTEXT "RETAIL STORE BETA"		// 9/26/95
53 //#define VERSIONTEXT "DVL BETA 10 05 95" // Used for GT for testing
54 //#define VERSIONTEXT "DVL BETA 10 07 95" // Just an update for Romero
55 //#define VERSIONTEXT "FINAL 1.0 (10 13 95)" // Just an update for Romero
56 /*#ifdef RANGECHECK
57 #define VERSIONTEXT "Version 1.1 +R "__DATE__" ("VER_ID")"
58 #else
59 #define VERSIONTEXT "Version 1.1 "__DATE__" ("VER_ID")"
60 #endif*/
61 
62 #define VERSIONTEXT "U-Hexen 0.5 build "__DATE__
63 
64 // all exterior data is defined here
65 #include "xddefs.h"
66 
67 // all important printed strings
68 #include "textdefs.h"
69 
70 // header generated by multigen utility
71 #include "info.h"
72 
73 extern byte *destview, *destscreen;	// PC direct to screen pointers
74 
75 //
76 // most key data are simple ascii (uppercased)
77 //
78 
79 #define	KEY_RIGHTARROW			0xae
80 #define	KEY_LEFTARROW			0xac
81 #define	KEY_UPARROW			0xad
82 #define	KEY_DOWNARROW			0xaf
83 #define	KEY_ESCAPE			27
84 #define	KEY_ENTER			13
85 #define KEY_TAB				9
86 #define	KEY_F1				(0x80+0x3b)
87 #define	KEY_F2				(0x80+0x3c)
88 #define	KEY_F3				(0x80+0x3d)
89 #define	KEY_F4				(0x80+0x3e)
90 #define	KEY_F5				(0x80+0x3f)
91 #define	KEY_F6				(0x80+0x40)
92 #define	KEY_F7				(0x80+0x41)
93 #define	KEY_F8				(0x80+0x42)
94 #define	KEY_F9				(0x80+0x43)
95 #define	KEY_F10				(0x80+0x44)
96 #define	KEY_F11				(0x80+0x57)
97 #define	KEY_F12				(0x80+0x58)
98 
99 #define	KEY_BACKSPACE			127
100 #define	KEY_PAUSE			0xff
101 
102 #define KEY_EQUALS			0x3d
103 #define KEY_MINUS			0x2d
104 
105 #define	KEY_RSHIFT			(0x80+0x36)
106 #define	KEY_RCTRL			(0x80+0x1d)
107 #define	KEY_RALT			(0x80+0x38)
108 
109 #define	KEY_LALT			KEY_RALT
110 
111 #define KEY_FIVE			0x35
112 #define KEY_SIX				0x36
113 #define KEY_SEVEN			0x37
114 #define KEY_EIGHT			0x38
115 #define KEY_NINE			0x39
116 #define KEY_ZERO			0x30
117 #define KEY_BACKSLASH			0x5C
118 
119 /* XXX My definitions */
120 
121 #define KEY_HOME			0x9f+0x00
122 #define KEY_END				0x9f+0x01
123 #define KEY_PGUP			0x9f+0x02
124 #define KEY_PGDN			0x9f+0x03
125 #define KEY_CAPSLOCK			0x9f+0x04
126 
127 #define MAXCHAR ((char)0x7f)
128 #define MAXSHORT ((short)0x7fff)
129 #define MAXINT	((int)0x7fffffff)	/* max pos 32-bit int */
130 #define MAXLONG ((long)0x7fffffff)
131 
132 #define MINCHAR ((char)0x80)
133 #define MINSHORT ((short)0x8000)
134 #define MININT 	((int)0x80000000)	/* max negative 32-bit integer */
135 #define MINLONG ((long)0x80000000)
136 
137 #define	FINEANGLES			8192
138 #define	FINEMASK			(FINEANGLES-1)
139 #define	ANGLETOFINESHIFT	19	// 0x100000000 to 0x2000
140 
141 /*
142 ===============================================================================
143 
144 						GLOBAL TYPES
145 
146 ===============================================================================
147 */
148 
149 //#define NUMARTIFCTS	28
150 #define MAXPLAYERS	4
151 #define TICRATE		35			// number of tics / second
152 #define TICSPERSEC	35
153 
154 #define MINIMUM_HEAP_SIZE	0x800000		//  8 meg
155 #define MAXIMUM_HEAP_SIZE	0x2000000		// 32 meg
156 
157 #define	FRACBITS		16
158 #define	FRACUNIT		(1<<FRACBITS)
159 typedef int fixed_t;
160 
161 // typedef unsigned int uint;
162 
163 //#define ANGLE_1		0x01000000
164 #define ANGLE_45	0x20000000
165 #define ANGLE_90	0x40000000
166 #define ANGLE_180	0x80000000
167 #define ANGLE_MAX	0xffffffff
168 #define ANGLE_1		(ANGLE_45/45)
169 #define ANGLE_60	(ANGLE_180/3)
170 
171 #define	ANG45	0x20000000
172 #define	ANG90	0x40000000
173 #define	ANG180	0x80000000
174 #define	ANG270	0xc0000000
175 
176 typedef unsigned angle_t;
177 
178 typedef enum
179 {
180 	sk_baby,
181 	sk_easy,
182 	sk_medium,
183 	sk_hard,
184 	sk_nightmare
185 } skill_t;
186 
187 typedef enum
188 {
189 	ev_keydown,
190 	ev_keyup,
191 	ev_mouse,
192 	ev_joystick
193 } evtype_t;
194 
195 typedef struct
196 {
197 	evtype_t	type;
198 	int			data1;		// keys / mouse/joystick buttons
199 	int			data2;		// mouse/joystick x move
200 	int			data3;		// mouse/joystick y move
201 } event_t;
202 
203 typedef struct
204 {
205 	char		forwardmove;		// *2048 for move
206 	char		sidemove;			// *2048 for move
207 	short		angleturn;			// <<16 for angle delta
208 	short		consistancy;		// checks for net game
209 	byte		chatchar;
210 	byte		buttons;
211 	byte		lookfly;			// look/fly up/down/centering
212 	byte		arti;				// artitype_t to use
213 } ticcmd_t;
214 
215 #define	BT_ATTACK		1
216 #define	BT_USE			2
217 #define	BT_CHANGE		4			// if true, the next 3 bits hold weapon num
218 #define	BT_WEAPONMASK	(8+16+32)
219 #define	BT_WEAPONSHIFT	3
220 
221 #define BT_SPECIAL		128			// game events, not really buttons
222 #define	BTS_SAVEMASK	(4+8+16)
223 #define	BTS_SAVESHIFT	2
224 #define	BT_SPECIALMASK	3
225 #define	BTS_PAUSE		1			// pause the game
226 #define	BTS_SAVEGAME	2			// save the game at each console
227 // savegame slot numbers occupy the second byte of buttons
228 
229 // The top 3 bits of the artifact field in the ticcmd_t struct are used
230 // 		as additional flags
231 #define AFLAG_MASK			0x3F
232 #define AFLAG_SUICIDE		0x40
233 #define AFLAG_JUMP			0x80
234 
235 typedef enum
236 {
237 	GS_LEVEL,
238 	GS_INTERMISSION,
239 	GS_FINALE,
240 	GS_DEMOSCREEN
241 } gamestate_t;
242 
243 typedef enum
244 {
245 	ga_nothing,
246 	ga_loadlevel,
247 	ga_initnew,
248 	ga_newgame,
249 	ga_loadgame,
250 	ga_savegame,
251 	ga_playdemo,
252 	ga_completed,
253 	ga_leavemap,
254 	ga_singlereborn,
255 	ga_victory,
256 	ga_worlddone,
257 	ga_screenshot
258 } gameaction_t;
259 
260 typedef enum
261 {
262 	wipe_0,
263 	wipe_1,
264 	wipe_2,
265 	wipe_3,
266 	wipe_4,
267 	NUMWIPES,
268 	wipe_random
269 } wipe_t;
270 
271 /*
272 ===============================================================================
273 
274 							MAPOBJ DATA
275 
276 ===============================================================================
277 */
278 
279 // think_t is a function pointer to a routine to handle an actor
280 typedef void (*think_t) ();
281 
282 typedef struct thinker_s
283 {
284 	struct		thinker_s	*prev, *next;
285 	think_t		function;
286 } thinker_t;
287 
288 struct player_s;
289 
290 typedef struct mobj_s
291 {
292 	thinker_t		thinker;			// thinker node
293 
294 // info for drawing
295 	fixed_t			x,y,z;
296 	struct	mobj_s	*snext, *sprev;		// links in sector (if needed)
297 	angle_t			angle;
298 	spritenum_t		sprite;				// used to find patch_t and flip value
299 	int				frame;				// might be ord with FF_FULLBRIGHT
300 
301 // interaction info
302 	struct mobj_s	*bnext, *bprev;		// links in blocks (if needed)
303 	struct subsector_s	*subsector;
304 	fixed_t			floorz, ceilingz;	// closest together of contacted secs
305 	fixed_t			floorpic;			// contacted sec floorpic
306 	fixed_t			radius, height;		// for movement checking
307 	fixed_t			momx, momy, momz;	// momentums
308 	int				validcount;			// if == validcount, already checked
309 	mobjtype_t		type;
310 	mobjinfo_t		*info;				// &mobjinfo[mobj->type]
311 	int				tics;				// state tic counter
312 	state_t			*state;
313 	int				damage;			// For missiles
314 	int				flags;
315 	int				flags2;			// Heretic flags
316 	int				special1;		// Special info
317 	int				special2;		// Special info
318 	int				health;
319 	int				movedir;		// 0-7
320 	int				movecount;		// when 0, select a new dir
321 	struct mobj_s	*target;		// thing being chased/attacked (or NULL)
322 									// also the originator for missiles
323 	int				reactiontime;	// if non 0, don't attack yet
324 									// used by player to freeze a bit after
325 									// teleporting
326 	int				threshold;		// if > 0, the target will be chased
327 									// no matter what (even if shot)
328 	struct player_s	*player;		// only valid if type == MT_PLAYER
329 	int				lastlook;		// player number last looked for
330 	fixed_t			floorclip;		// value to use for floor clipping
331 	int				archiveNum;		// Identity during archive
332 	short			tid;			// thing identifier
333 	byte			special;		// special
334 	byte			args[5];		// special arguments
335 } mobj_t;
336 
337 // each sector has a degenmobj_t in it's center for sound origin purposes
338 typedef struct
339 {
340 	thinker_t		thinker;		// not used for anything
341 	fixed_t			x,y,z;
342 } degenmobj_t;
343 
344 // Most damage defined using HITDICE
345 #define HITDICE(a) ((1+(P_Random()&7))*a)
346 
347 //
348 // frame flags
349 //
350 #define	FF_FULLBRIGHT	0x8000		// flag in thing->frame
351 #define FF_FRAMEMASK	0x7fff
352 
353 // --- mobj.flags ---
354 
355 #define	MF_SPECIAL		1			// call P_SpecialThing when touched
356 #define	MF_SOLID		2
357 #define	MF_SHOOTABLE	4
358 #define	MF_NOSECTOR		8			// don't use the sector links
359 									// (invisible but touchable)
360 #define	MF_NOBLOCKMAP	16			// don't use the blocklinks
361 									// (inert but displayable)
362 #define	MF_AMBUSH		32
363 #define	MF_JUSTHIT		64			// try to attack right back
364 #define	MF_JUSTATTACKED	128			// take at least one step before attacking
365 #define	MF_SPAWNCEILING	256			// hang from ceiling instead of floor
366 #define	MF_NOGRAVITY	512			// don't apply gravity every tic
367 
368 // movement flags
369 #define	MF_DROPOFF		0x400		// allow jumps from high places
370 #define	MF_PICKUP		0x800		// for players to pick up items
371 #define	MF_NOCLIP		0x1000		// player cheat
372 #define	MF_SLIDE		0x2000		// keep info about sliding along walls
373 #define	MF_FLOAT		0x4000		// allow moves to any height, no gravity
374 #define	MF_TELEPORT		0x8000		// don't cross lines or look at heights
375 #define MF_MISSILE		0x10000		// don't hit same species, explode on block
376 
377 #define	MF_ALTSHADOW	0x20000		// alternate fuzzy draw
378 #define	MF_SHADOW		0x40000		// use fuzzy draw (shadow demons / invis)
379 #define	MF_NOBLOOD		0x80000		// don't bleed when shot (use puff)
380 #define	MF_CORPSE		0x100000	// don't stop moving halfway off a step
381 #define	MF_INFLOAT		0x200000	// floating to a height for a move, don't
382 									// auto float to target's height
383 
384 #define	MF_COUNTKILL	0x400000	// count towards intermission kill total
385 #define	MF_ICECORPSE	0x800000	// a frozen corpse (for blasting)
386 
387 #define	MF_SKULLFLY		0x1000000	// skull in flight
388 #define	MF_NOTDMATCH	0x2000000	// don't spawn in death match (key cards)
389 
390 //#define	MF_TRANSLATION	0xc000000	// if 0x4 0x8 or 0xc, use a translation
391 #define	MF_TRANSLATION	0x1c000000	// use a translation table (>>MF_TRANSHIFT)
392 #define	MF_TRANSSHIFT	26			// table for player colormaps
393 
394 
395 // --- mobj.flags2 ---
396 
397 #define MF2_LOGRAV			0x00000001	// alternate gravity setting
398 #define MF2_WINDTHRUST		0x00000002	// gets pushed around by the wind
399 										// specials
400 #define MF2_FLOORBOUNCE		0x00000004	// bounces off the floor
401 #define MF2_BLASTED			0x00000008	// missile will pass through ghosts
402 #define MF2_FLY				0x00000010	// fly mode is active
403 #define MF2_FLOORCLIP		0x00000020	// if feet are allowed to be clipped
404 #define MF2_SPAWNFLOAT		0x00000040	// spawn random float z
405 #define MF2_NOTELEPORT		0x00000080	// does not teleport
406 #define MF2_RIP				0x00000100	// missile rips through solid
407 										// targets
408 #define MF2_PUSHABLE		0x00000200	// can be pushed by other moving
409 										// mobjs
410 #define MF2_SLIDE			0x00000400	// slides against walls
411 #define MF2_ONMOBJ			0x00000800	// mobj is resting on top of another
412 										// mobj
413 #define MF2_PASSMOBJ		0x00001000	// Enable z block checking.  If on,
414 										// this flag will allow the mobj to
415 										// pass over/under other mobjs.
416 #define MF2_CANNOTPUSH		0x00002000	// cannot push other pushable mobjs
417 #define MF2_DROPPED			0x00004000	// dropped by a demon
418 #define MF2_BOSS			0x00008000	// mobj is a major boss
419 #define MF2_FIREDAMAGE		0x00010000	// does fire damage
420 #define MF2_NODMGTHRUST		0x00020000	// does not thrust target when
421 										// damaging
422 #define MF2_TELESTOMP		0x00040000	// mobj can stomp another
423 #define MF2_FLOATBOB		0x00080000	// use float bobbing z movement
424 #define MF2_DONTDRAW		0x00100000	// don't generate a vissprite
425 #define MF2_IMPACT			0x00200000 	// an MF_MISSILE mobj can activate
426 								 		// SPAC_IMPACT
427 #define MF2_PUSHWALL		0x00400000 	// mobj can push walls
428 #define MF2_MCROSS			0x00800000	// can activate monster cross lines
429 #define MF2_PCROSS			0x01000000	// can activate projectile cross lines
430 #define MF2_CANTLEAVEFLOORPIC 0x02000000 // stay within a certain floor type
431 #define MF2_NONSHOOTABLE	0x04000000	// mobj is totally non-shootable,
432 										// but still considered solid
433 #define MF2_INVULNERABLE	0x08000000	// mobj is invulnerable
434 #define MF2_DORMANT			0x10000000	// thing is dormant
435 #define MF2_ICEDAMAGE		0x20000000  // does ice damage
436 #define MF2_SEEKERMISSILE	0x40000000	// is a seeker (for reflection)
437 #define MF2_REFLECTIVE		0x80000000	// reflects missiles
438 
439 //=============================================================================
440 
441 // ===== Player Class Types =====
442 typedef enum
443 {
444 	PCLASS_FIGHTER,
445 	PCLASS_CLERIC,
446 	PCLASS_MAGE,
447 	PCLASS_PIG,
448 	NUMCLASSES
449 } pclass_t;
450 
451 typedef enum
452 {
453 	PST_LIVE,			// playing
454 	PST_DEAD,			// dead on the ground
455 	PST_REBORN			// ready to restart
456 } playerstate_t;
457 
458 // psprites are scaled shapes directly on the view screen
459 // coordinates are given for a 320*200 view screen
460 typedef enum
461 {
462 	ps_weapon,
463 	ps_flash,
464 	NUMPSPRITES
465 } psprnum_t;
466 
467 typedef struct
468 {
469 	state_t	*state;		// a NULL state means not active
470 	int		tics;
471 	fixed_t	sx, sy;
472 } pspdef_t;
473 
474 /* Old Heretic key type
475 typedef enum
476 {
477 	key_yellow,
478 	key_green,
479 	key_blue,
480 	NUMKEYS
481 } keytype_t;
482 */
483 
484 typedef enum
485 {
486 	KEY_1,
487 	KEY_2,
488 	KEY_3,
489 	KEY_4,
490 	KEY_5,
491 	KEY_6,
492 	KEY_7,
493 	KEY_8,
494 	KEY_9,
495 	KEY_A,
496 	KEY_B,
497 	NUMKEYS
498 } keytype_t;
499 
500 typedef enum
501 {
502 	ARMOR_ARMOR,
503 	ARMOR_SHIELD,
504 	ARMOR_HELMET,
505 	ARMOR_AMULET,
506 	NUMARMOR
507 } armortype_t;
508 
509 typedef enum
510 {
511 	WP_FIRST,
512 	WP_SECOND,
513 	WP_THIRD,
514 	WP_FOURTH,
515 	NUMWEAPONS,
516 	WP_NOCHANGE
517 } weapontype_t;
518 
519 typedef enum
520 {
521 	MANA_1,
522 	MANA_2,
523 	NUMMANA,
524 	MANA_BOTH,
525 	MANA_NONE
526 } manatype_t;
527 
528 #define MAX_MANA	200
529 
530 #define WPIECE1		1
531 #define WPIECE2		2
532 #define WPIECE3		4
533 
534 typedef struct
535 {
536 	manatype_t mana;
537 	int upstate;
538 	int downstate;
539 	int readystate;
540 	int atkstate;
541 	int holdatkstate;
542 	int flashstate;
543 } weaponinfo_t;
544 
545 extern weaponinfo_t WeaponInfo[NUMWEAPONS][NUMCLASSES];
546 
547 typedef enum
548 {
549 	arti_none,
550 	arti_invulnerability,
551 	arti_health,
552 	arti_superhealth,
553 	arti_healingradius,
554 	arti_summon,
555 	arti_torch,
556 	arti_egg,
557 	arti_fly,
558 	arti_blastradius,
559 	arti_poisonbag,
560 	arti_teleportother,
561 	arti_speed,
562 	arti_boostmana,
563 	arti_boostarmor,
564 	arti_teleport,
565 	// Puzzle artifacts
566 	arti_firstpuzzitem,
567 	arti_puzzskull = arti_firstpuzzitem,
568 	arti_puzzgembig,
569 	arti_puzzgemred,
570 	arti_puzzgemgreen1,
571 	arti_puzzgemgreen2,
572 	arti_puzzgemblue1,
573 	arti_puzzgemblue2,
574 	arti_puzzbook1,
575 	arti_puzzbook2,
576 	arti_puzzskull2,
577 	arti_puzzfweapon,
578 	arti_puzzcweapon,
579 	arti_puzzmweapon,
580 	arti_puzzgear1,
581 	arti_puzzgear2,
582 	arti_puzzgear3,
583 	arti_puzzgear4,
584 	NUMARTIFACTS
585 } artitype_t;
586 
587 typedef enum
588 {
589 	pw_None,
590 	pw_invulnerability,
591 	pw_allmap,
592 	pw_infrared,
593 	pw_flight,
594 	pw_shield,
595 	pw_health2,
596 	pw_speed,
597 	pw_minotaur,
598 	NUMPOWERS
599 } powertype_t;
600 
601 #define	INVULNTICS (30*35)
602 #define	INVISTICS (60*35)
603 #define	INFRATICS (120*35)
604 #define	IRONTICS (60*35)
605 #define WPNLEV2TICS (40*35)
606 #define FLIGHTTICS (60*35)
607 #define SPEEDTICS (45*35)
608 #define MORPHTICS (40*35)
609 #define MAULATORTICS (25*35)
610 
611 #define MESSAGETICS (4*35)
612 #define BLINKTHRESHOLD (4*35)
613 
614 #define NUMINVENTORYSLOTS	NUMARTIFACTS
615 
616 typedef struct
617 {
618 	int type;
619 	int count;
620 } inventory_t;
621 
622 /*
623 ================
624 =
625 = player_t
626 =
627 ================
628 */
629 
630 typedef struct player_s
631 {
632 	mobj_t *mo;
633 	playerstate_t playerstate;
634 	ticcmd_t cmd;
635 
636 	pclass_t	class;					// player class type
637 
638 	fixed_t		viewz;					// focal origin above r.z
639 	fixed_t		viewheight;				// base height above floor for viewz
640 	fixed_t		deltaviewheight;		// squat speed
641 	fixed_t		bob;					// bounded/scaled total momentum
642 
643 	int			flyheight;
644 	int			lookdir;
645 	boolean		centering;
646 	int			health;					// only used between levels, mo->health
647 										// is used during levels
648 	int	armorpoints[NUMARMOR];
649 
650 	inventory_t	inventory[NUMINVENTORYSLOTS];
651 	artitype_t	readyArtifact;
652 	int			artifactCount;
653 	int 		inventorySlotNum;
654 	int			powers[NUMPOWERS];
655 	int			keys;
656 	int			pieces;					// Fourth Weapon pieces
657 	signed int			frags[MAXPLAYERS];		// kills of other players
658 	weapontype_t	readyweapon;
659 	weapontype_t	pendingweapon;		// wp_nochange if not changing
660 	boolean		weaponowned[NUMWEAPONS];
661 	int			mana[NUMMANA];
662 	int			attackdown, usedown;	// true if button down last tic
663 	int			cheats;					// bit flags
664 
665 	int			refire;					// refired shots are less accurate
666 
667 	int			killcount, itemcount, secretcount;		// for intermission
668 	char		message[80];			// hint messages
669 	int			messageTics;			// counter for showing messages
670 	short		ultimateMessage;
671 	short		yellowMessage;
672 	int			damagecount, bonuscount;// for screen flashing
673 	int			poisoncount;			// screen flash for poison damage
674 	mobj_t		*poisoner;				// NULL for non-player mobjs
675 	mobj_t		*attacker;				// who did damage (NULL for floors)
676 	int			extralight;				// so gun flashes light up areas
677 	int			fixedcolormap;			// can be set to REDCOLORMAP, etc
678 	int			colormap;				// 0-3 for which color to draw player
679 	pspdef_t	psprites[NUMPSPRITES];	// view sprites (gun, etc)
680 	int			morphTics;				// player is a pig if > 0
681 	uint		jumpTics;				// delay the next jump for a moment
682 	unsigned int worldTimer;			// total time the player's been playing
683 } player_t;
684 
685 #define CF_NOCLIP		1
686 #define	CF_GODMODE		2
687 #define	CF_NOMOMENTUM	4 // not really a cheat, just a debug aid
688 #define	CF_FUNNYPIGGY		8
689 
690 
691 #define		BACKUPTICS		12
692 
693 typedef struct
694 {
695 	unsigned	checksum;					// high bit is retransmit request
696 	byte		retransmitfrom;				// only valid if NCMD_RETRANSMIT
697 	byte		starttic;
698 	byte		player, numtics;
699 	ticcmd_t	cmds[BACKUPTICS];
700 } doomdata_t;
701 
702 typedef struct
703 {
704 	long	id;
705 	short	intnum;			// DOOM executes an int to execute commands
706 
707 // communication between DOOM and the driver
708 	short	command;		// CMD_SEND or CMD_GET
709 	short	remotenode;		// dest for send, set by get (-1 = no packet)
710 	short	datalength;		// bytes in doomdata to be sent
711 
712 // info common to all nodes
713 	short	numnodes;		// console is allways node 0
714 	short	ticdup;			// 1 = no duplication, 2-5 = dup for slow nets
715 	short	extratics;		// 1 = send a backup tic in every packet
716 	short	deathmatch;		// 1 = deathmatch
717 	short	savegame;		// -1 = new game, 0-5 = load savegame
718 	short	episode;		// 1-3
719 	short	map;			// 1-9
720 	short	skill;			// 1-5
721 
722 // info specific to this node
723 	short	consoleplayer;
724 	short	numplayers;
725 	short	angleoffset;	// 1 = left, 0 = center, -1 = right
726 	short	drone;			// 1 = drone
727 
728 // packet data to be sent
729 	doomdata_t	data;
730 } doomcom_t;
731 
732 #define	DOOMCOM_ID		0x12345678l
733 
734 extern	doomcom_t		*doomcom;
735 extern	doomdata_t		*netbuffer;		// points inside doomcom
736 
737 #define	MAXNETNODES		16			// max computers in a game
738 
739 #define	CMD_SEND	1
740 #define	CMD_GET		2
741 #define CMD_FRAG	3
742 
743 #define	SBARHEIGHT	39			// status bar height at bottom of screen
744 
745 void NET_SendFrags(player_t *player);
746 
747 /*
748 ===============================================================================
749 
750 					GLOBAL VARIABLES
751 
752 ===============================================================================
753 */
754 
755 #define TELEFOGHEIGHT (32*FRACUNIT)
756 
757 #define MAXEVENTS 64
758 
759 extern event_t events[MAXEVENTS];
760 extern int eventhead;
761 extern int eventtail;
762 
763 extern fixed_t finesine[5*FINEANGLES/4];
764 extern fixed_t *finecosine;
765 
766 extern gameaction_t gameaction;
767 
768 extern boolean paused;
769 
770 extern boolean shareware; // true if other episodes not present
771 
772 extern boolean DevMaps; // true = map development mode
773 extern char *DevMapsDir; // development maps directory
774 
775 extern boolean nomonsters; // checkparm of -nomonsters
776 
777 extern boolean respawnparm; // checkparm of -respawn
778 
779 extern boolean randomclass; // checkparm of -randclass
780 
781 extern boolean debugmode; // checkparm of -debug
782 
783 extern boolean usergame; // ok to save / end game
784 
785 extern boolean ravpic; // checkparm of -ravpic
786 
787 extern boolean altpal; // checkparm to use an alternate palette routine
788 
789 extern boolean cdrom; // true if cd-rom mode active ("-cdrom")
790 
791 extern boolean deathmatch; // only if started as net death
792 
793 extern boolean netgame; // only true if >1 player
794 
795 extern boolean cmdfrag; // true if a CMD_FRAG packet should be sent out every
796 						// kill
797 
798 extern boolean playeringame[MAXPLAYERS];
799 extern pclass_t PlayerClass[MAXPLAYERS];
800 
801 extern int consoleplayer; // player taking events and displaying
802 
803 extern int displayplayer;
804 
805 extern int viewangleoffset;	// ANG90 = left side, ANG270 = right
806 
807 extern player_t players[MAXPLAYERS];
808 
809 extern	boolean		singletics;			// debug flag to cancel adaptiveness
810 
811 extern boolean DebugSound; // debug flag for displaying sound info
812 
813 extern boolean demoplayback;
814 extern int maxzone;				// Maximum chunk allocated for zone heap
815 
816 extern int Sky1Texture;
817 extern int Sky2Texture;
818 
819 extern	gamestate_t	gamestate;
820 extern	skill_t		gameskill;
821 //extern	boolean		respawnmonsters;
822 extern	int			gameepisode;
823 extern	int			gamemap;
824 extern 	int 			prevmap;
825 extern	int			levelstarttic;		// gametic at level start
826 extern	int			leveltime;			// tics in game play for par
827 
828 extern	ticcmd_t	netcmds[MAXPLAYERS][BACKUPTICS];
829 extern int ticdup;
830 
831 //#define	MAXNETNODES		8
832 
833 extern	ticcmd_t		localcmds[BACKUPTICS];
834 extern int rndindex;
835 extern int gametic, maketic;
836 extern	int        	nettics[MAXNETNODES];
837 
838 #define MAXDEATHMATCHSTARTS 16
839 extern mapthing_t *deathmatch_p;
840 extern mapthing_t deathmatchstarts[MAXDEATHMATCHSTARTS];
841 
842 // Position indicator for cooperative net-play reborn
843 extern int RebornPosition;
844 
845 #define MAX_PLAYER_STARTS 8
846 extern mapthing_t playerstarts[MAX_PLAYER_STARTS][MAXPLAYERS];
847 
848 extern int viewwindowx;
849 extern int viewwindowy;
850 extern int viewwidth;
851 extern int scaledviewwidth;
852 extern int viewheight;
853 
854 extern int mouseSensitivity;
855 
856 extern boolean precache; // if true, load all graphics at level load
857 
858 extern byte *screen; // off screen work buffer, from V_video.c
859 
860 extern boolean singledemo; // quit after playing a demo from cmdline
861 
862 extern FILE *debugfile;
863 extern int bodyqueslot;
864 extern skill_t startskill;
865 extern int startepisode;
866 extern int startmap;
867 extern boolean autostart;
868 
869 /*
870 ===============================================================================
871 
872 					GLOBAL FUNCTIONS
873 
874 ===============================================================================
875 */
876 
877 
878 fixed_t	FixedMul (fixed_t a, fixed_t b);
879 fixed_t	FixedDiv (fixed_t a, fixed_t b);
880 fixed_t	FixedDiv2 (fixed_t a, fixed_t b);
881 
882 #ifdef __WATCOMC__
883 #pragma aux FixedMul =	\
884 	"imul ebx",			\
885 	"shrd eax,edx,16"	\
886 	parm	[eax] [ebx] \
887 	value	[eax]		\
888 	modify exact [eax edx]
889 
890 #pragma aux FixedDiv2 =	\
891 	"cdq",				\
892 	"shld edx,eax,16",	\
893 	"sal eax,16",		\
894 	"idiv ebx"			\
895 	parm	[eax] [ebx] \
896 	value	[eax]		\
897 	modify exact [eax edx]
898 #endif
899 
900 #ifdef __BIG_ENDIAN__
901 short ShortSwap(short);
902 long LongSwap(long);
903 #define SHORT(x)	ShortSwap(x)
904 #define LONG(x)		LongSwap(x)
905 #else
906 #define SHORT(x)	(x)
907 #define LONG(x)		(x)
908 #endif
909 
910 
911 //-----------
912 //MEMORY ZONE
913 //-----------
914 // tags < 100 are not overwritten until freed
915 #define	PU_STATIC		1			// static entire execution time
916 #define	PU_SOUND		2			// static while playing
917 #define	PU_MUSIC		3			// static while playing
918 #define	PU_DAVE			4			// anything else Dave wants static
919 #define	PU_LEVEL		50			// static until level exited
920 #define	PU_LEVSPEC		51			// a special thinker in a level
921 // tags >= 100 are purgable whenever needed
922 #define	PU_PURGELEVEL	100
923 #define	PU_CACHE		101
924 
925 
926 void	Z_Init (void);
927 void 	*Z_Malloc (int size, int tag, void *ptr);
928 void 	Z_Free (void *ptr);
929 void 	Z_FreeTags (int lowtag, int hightag);
930 //void 	Z_DumpHeap (int lowtag, int hightag);
931 //void	Z_FileDumpHeap (FILE *f);
932 void	Z_CheckHeap (void);
933 void	Z_ChangeTag2 (void *ptr, int tag);
934 //int 	Z_FreeMemory (void);
935 
936 typedef struct memblock_s
937 {
938 	int                     size;           // including the header and possibly tiny fragments
939 	void            **user;         // NULL if a free block
940 	int                     tag;            // purgelevel
941 	int                     id;                     // should be ZONEID
942 	struct memblock_s       *next, *prev;
943 } memblock_t;
944 
945 #define Z_ChangeTag(p,t) \
946 { \
947 if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
948 	I_Error("Z_CT at "__FILE__":%i",__LINE__); \
949 Z_ChangeTag2(p,t); \
950 };
951 
952 //-------
953 //WADFILE
954 //-------
955 typedef struct
956 {
957 	char		name[8];
958 	FILE		*handle;
959 	int		position,size;
960 } lumpinfo_t;
961 
962 extern lumpinfo_t *lumpinfo;
963 extern int numlumps;
964 
965 void W_InitMultipleFiles(char **filenames);
966 void W_OpenAuxiliary(char *filename);
967 void W_CloseAuxiliaryFile(void);
968 void W_CloseAuxiliary(void);
969 void W_UsePrimary(void);
970 void W_UseAuxiliary(void);
971 int W_CheckNumForName(char *name);
972 int W_GetNumForName(char *name);
973 int W_LumpLength(int lump);
974 void W_ReadLump(int lump, void *dest);
975 void *W_CacheLumpNum(int lump, int tag);
976 void *W_CacheLumpName(char *name, int tag);
977 
978 //----------
979 //BASE LEVEL
980 //----------
981 void H2_Main(void);
982 // not a globally visible function, just included for source reference
983 // calls all startup code
984 // parses command line options
985 // if not overrided, calls N_AdvanceDemo
986 
987 void H2_GameLoop(void);
988 // not a globally visible function, just included for source reference
989 // called by H2_Main, never exits
990 // manages timing and IO
991 // calls all ?_Responder, ?_Ticker, and ?_Drawer functions
992 // calls I_GetTime, I_StartFrame, and I_StartTic
993 
994 void H2_PostEvent(event_t *ev);
995 // called by IO functions when input is detected
996 
997 void NetUpdate (void);
998 // create any new ticcmds and broadcast to other players
999 
1000 void D_QuitNetGame (void);
1001 // broadcasts special packets to other players to notify of game exit
1002 
1003 void TryRunTics (void);
1004 
1005 //---------
1006 //SYSTEM IO
1007 //---------
1008 #if 1
1009 #define	SCREENWIDTH		320
1010 #define	SCREENHEIGHT	200
1011 #else
1012 #define	SCREENWIDTH		560
1013 #define	SCREENHEIGHT	375
1014 #endif
1015 
1016 byte *I_ZoneBase (int *size);
1017 // called by startup code to get the ammount of memory to malloc
1018 // for the zone management
1019 
1020 int I_GetTime (void);
1021 // called by H2_GameLoop
1022 // returns current time in tics
1023 
1024 void I_StartFrame (void);
1025 // called by H2_GameLoop
1026 // called before processing any tics in a frame (just after displaying a frame)
1027 // time consuming syncronous operations are performed here (joystick reading)
1028 // can call H2_PostEvent
1029 
1030 void I_StartTic (void);
1031 // called by H2_GameLoop
1032 // called before processing each tic in a frame
1033 // quick syncronous operations are performed here
1034 // can call H2_PostEvent
1035 
1036 // asyncronous interrupt functions should maintain private ques that are
1037 // read by the syncronous functions to be converted into events
1038 
1039 void I_Init (void);
1040 // called by H2_Main
1041 // determines the hardware configuration and sets up the video mode
1042 
1043 void I_InitGraphics (void);
1044 
1045 void I_InitNetwork (void);
1046 void I_NetCmd (void);
1047 
1048 void I_CheckExternDriver(void);
1049 
1050 void I_Error (char *error, ...);
1051 // called by anything that can generate a terminal error
1052 // bad exit with diagnostic message
1053 
1054 void I_Quit (void);
1055 // called by M_Responder when quit is selected
1056 // clean exit, displays sell blurb
1057 
1058 void I_SetPalette (byte *palette);
1059 // takes full 8 bit values
1060 
1061 void I_Update(void);
1062 void I_UpdateNoBlit(void);
1063 void I_FinishUpdate(void);
1064 // Copy buffer to video
1065 
1066 void I_WipeUpdate(wipe_t wipe);
1067 // Copy buffer to video with wipe effect
1068 
1069 void I_WaitVBL(int count);
1070 // wait for vertical retrace or pause a bit
1071 
1072 void I_BeginRead (void);
1073 void I_EndRead (void);
1074 
1075 byte	*I_AllocLow (int length);
1076 // allocates from low memory under dos, just mallocs under unix
1077 
1078 void I_Tactile (int on, int off, int total);
1079 
1080 #ifdef __WATCOMC__
1081 extern boolean useexterndriver;
1082 
1083 #define EBT_FIRE			1
1084 #define EBT_OPENDOOR 		2
1085 #define EBT_SPEED			4
1086 #define EBT_STRAFE			8
1087 #define EBT_MAP				0x10
1088 #define EBT_INVENTORYLEFT 	0x20
1089 #define EBT_INVENTORYRIGHT 	0x40
1090 #define EBT_USEARTIFACT		0x80
1091 #define EBT_FLYDROP			0x100
1092 #define EBT_CENTERVIEW		0x200
1093 #define EBT_PAUSE			0x400
1094 #define EBT_WEAPONCYCLE		0x800
1095 #define EBT_JUMP			0x1000
1096 
1097 typedef struct
1098 {
1099 	short vector; // Interrupt vector
1100 
1101 	signed char moveForward; // forward/backward (maxes at 50)
1102 	signed char moveSideways; // strafe (maxes at 24)
1103 	short angleTurn; // turning speed (640 [slow] 1280 [fast])
1104 	short angleHead; // head angle (+2080 [left] : 0 [center] : -2048 [right])
1105 	signed char pitch; // look up/down (-110 : +90)
1106 	signed char flyDirection; // flyheight (+1/-1)
1107 	unsigned short buttons; // EBT_* flags
1108 } externdata_t;
1109 #endif
1110 
1111 //----
1112 //GAME
1113 //----
1114 
1115 void G_DeathMatchSpawnPlayer (int playernum);
1116 
1117 void G_InitNew (skill_t skill, int episode, int map);
1118 
1119 void G_DeferedInitNew (skill_t skill, int episode, int map);
1120 // can be called by the startup code or M_Responder
1121 // a normal game starts at map 1, but a warp test can start elsewhere
1122 
1123 void G_DeferredNewGame(skill_t skill);
1124 
1125 void G_DeferedPlayDemo (char *demo);
1126 
1127 void G_LoadGame(int slot);
1128 // can be called by the startup code or M_Responder
1129 // calls P_SetupLevel or W_EnterWorld
1130 void G_DoLoadGame (void);
1131 
1132 void G_SaveGame (int slot, char *description);
1133 // called by M_Responder
1134 
1135 void G_RecordDemo (skill_t skill, int numplayers, int episode
1136 	, int map, char *name);
1137 // only called by startup code
1138 
1139 void G_PlayDemo (char *name);
1140 void G_TimeDemo (char *name);
1141 
1142 void G_TeleportNewMap(int map, int position);
1143 
1144 void G_Completed(int map, int position);
1145 //void G_ExitLevel (void);
1146 //void G_SecretExitLevel (void);
1147 
1148 void G_StartNewGame(skill_t skill);
1149 void G_StartNewInit(void);
1150 
1151 void G_WorldDone (void);
1152 
1153 void G_Ticker (void);
1154 boolean G_Responder (event_t *ev);
1155 
1156 void G_ScreenShot (void);
1157 
1158 //-------
1159 //SV_SAVE
1160 //-------
1161 
1162 #define HXS_VERSION_TEXT "HXS Ver 2.37"
1163 #define HXS_VERSION_TEXT_LENGTH 16
1164 #define HXS_DESCRIPTION_LENGTH 24
1165 
1166 void SV_SaveGame(int slot, char *description);
1167 void SV_SaveMap(boolean savePlayers);
1168 void SV_LoadGame(int slot);
1169 void SV_MapTeleport(int map, int position);
1170 void SV_LoadMap(void);
1171 void SV_InitBaseSlot(void);
1172 void SV_UpdateRebornSlot(void);
1173 void SV_ClearRebornSlot(void);
1174 boolean SV_RebornSlotAvailable(void);
1175 int SV_GetRebornSlot(void);
1176 
1177 //-----
1178 //PLAY
1179 //-----
1180 
1181 void P_Ticker (void);
1182 // called by C_Ticker
1183 // can call G_PlayerExited
1184 // carries out all thinking of monsters and players
1185 
1186 void P_SetupLevel (int episode, int map, int playermask, skill_t skill);
1187 // called by W_Ticker
1188 
1189 void P_Init (void);
1190 // called by startup code
1191 
1192 int P_GetMapCluster(int map);
1193 int P_TranslateMap(int map);
1194 int P_GetMapCDTrack(int map);
1195 int P_GetMapWarpTrans(int map);
1196 int P_GetMapNextMap(int map);
1197 int P_GetMapSky1Texture(int map);
1198 int P_GetMapSky2Texture(int map);
1199 char *P_GetMapName(int map);
1200 fixed_t P_GetMapSky1ScrollDelta(int map);
1201 fixed_t P_GetMapSky2ScrollDelta(int map);
1202 boolean P_GetMapDoubleSky(int map);
1203 boolean P_GetMapLightning(int map);
1204 boolean P_GetMapFadeTable(int map);
1205 char *P_GetMapSongLump(int map);
1206 void P_PutMapSongLump(int map, char *lumpName);
1207 int P_GetCDStartTrack(void);
1208 int P_GetCDEnd1Track(void);
1209 int P_GetCDEnd2Track(void);
1210 int P_GetCDEnd3Track(void);
1211 int P_GetCDIntermissionTrack(void);
1212 int P_GetCDTitleTrack(void);
1213 
1214 //-------
1215 //REFRESH
1216 //-------
1217 
1218 extern boolean setsizeneeded;
1219 
1220 extern boolean BorderNeedRefresh;
1221 extern boolean BorderTopRefresh;
1222 
1223 extern int UpdateState;
1224 // define the different areas for the dirty map
1225 #define I_NOUPDATE	0
1226 #define I_FULLVIEW	1
1227 #define I_STATBAR	2
1228 #define I_MESSAGES	4
1229 #define I_FULLSCRN	8
1230 
1231 void R_RenderPlayerView (player_t *player);
1232 // called by G_Drawer
1233 
1234 void R_Init (void);
1235 // called by startup code
1236 
1237 void R_DrawViewBorder (void);
1238 void R_DrawTopBorder (void);
1239 // if the view size is not full screen, draws a border around it
1240 
1241 void R_SetViewSize (int blocks, int detail);
1242 // called by M_Responder
1243 
1244 int	R_FlatNumForName (char *name);
1245 
1246 int	R_TextureNumForName (char *name);
1247 int	R_CheckTextureNumForName (char *name);
1248 // called by P_Ticker for switches and animations
1249 // returns the texture number for the texture name
1250 
1251 
1252 //----
1253 //MISC
1254 //----
1255 extern	int		myargc;
1256 extern	char	**myargv;
1257 extern	int		localQuakeHappening[MAXPLAYERS];
1258 
1259 int	M_CheckParm(char *check);
1260 // returns the position of the given parameter in the arg list (0 if not found)
1261 boolean M_ParmExists(char *check);
1262 
1263 void M_ExtractFileBase(char *path, char *dest);
1264 
1265 void M_ForceUppercase(char *text);
1266 // Changes a string to uppercase
1267 
1268 int M_Random (void);
1269 // returns a number from 0 to 255
1270 
1271 extern unsigned char rndtable[256];
1272 extern int prndindex;
1273 #define P_Random() rndtable[(++prndindex)&0xff]
1274 // as M_Random, but used only by the play simulation
1275 
1276 void M_ClearRandom (void);
1277 // fix randoms for demos
1278 
1279 void M_FindResponseFile(void);
1280 
1281 void M_ClearBox (fixed_t *box);
1282 void M_AddToBox (fixed_t *box, fixed_t x, fixed_t y);
1283 // bounding box functions
1284 
1285 boolean M_WriteFile(char const *name, void *source, int length);
1286 int M_ReadFile(char const *name, byte **buffer);
1287 int M_ReadFileCLib(char const *name, byte **buffer);
1288 
1289 void M_ScreenShot (void);
1290 
1291 void M_LoadDefaults(char *fileName);
1292 
1293 void M_SaveDefaults (void);
1294 
1295 int M_DrawText (int x, int y, boolean direct, char *string);
1296 
1297 //------------------------------
1298 // SC_man.c
1299 //------------------------------
1300 
1301 void SC_Open(char *name);
1302 void SC_OpenLump(char *name);
1303 void SC_OpenFile(char *name);
1304 void SC_OpenFileCLib(char *name);
1305 void SC_Close(void);
1306 boolean SC_GetString(void);
1307 void SC_MustGetString(void);
1308 void SC_MustGetStringName(char *name);
1309 boolean SC_GetNumber(void);
1310 void SC_MustGetNumber(void);
1311 void SC_UnGet(void);
1312 //boolean SC_Check(void);
1313 boolean SC_Compare(char *text);
1314 int SC_MatchString(char **strings);
1315 int SC_MustMatchString(char **strings);
1316 void SC_ScriptError(char *message);
1317 
1318 extern char *sc_String;
1319 extern int sc_Number;
1320 extern int sc_Line;
1321 extern boolean sc_End;
1322 extern boolean sc_Crossed;
1323 extern boolean sc_FileScripts;
1324 extern char *sc_ScriptsDir;
1325 
1326 //------------------------------
1327 // SN_sonix.c
1328 //------------------------------
1329 
1330 enum
1331 {
1332 	SEQ_PLATFORM,
1333 	SEQ_PLATFORM_HEAVY,		// same script as a normal platform
1334 	SEQ_PLATFORM_METAL,
1335 	SEQ_PLATFORM_CREAK,		// same script as a normal platform
1336 	SEQ_PLATFORM_SILENCE,
1337 	SEQ_PLATFORM_LAVA,
1338 	SEQ_PLATFORM_WATER,
1339 	SEQ_PLATFORM_ICE,
1340 	SEQ_PLATFORM_EARTH,
1341 	SEQ_PLATFORM_METAL2,
1342 	SEQ_DOOR_STONE,
1343 	SEQ_DOOR_HEAVY,
1344 	SEQ_DOOR_METAL,
1345 	SEQ_DOOR_CREAK,
1346 	SEQ_DOOR_SILENCE,
1347 	SEQ_DOOR_LAVA,
1348 	SEQ_DOOR_WATER,
1349 	SEQ_DOOR_ICE,
1350 	SEQ_DOOR_EARTH,
1351 	SEQ_DOOR_METAL2,
1352 	SEQ_ESOUND_WIND,
1353 	SEQ_NUMSEQ
1354 };
1355 
1356 typedef enum
1357 {
1358 	SEQTYPE_STONE,
1359 	SEQTYPE_HEAVY,
1360 	SEQTYPE_METAL,
1361 	SEQTYPE_CREAK,
1362 	SEQTYPE_SILENCE,
1363 	SEQTYPE_LAVA,
1364 	SEQTYPE_WATER,
1365 	SEQTYPE_ICE,
1366 	SEQTYPE_EARTH,
1367 	SEQTYPE_METAL2,
1368 	SEQTYPE_NUMSEQ
1369 } seqtype_t;
1370 
1371 void SN_InitSequenceScript(void);
1372 void SN_StartSequence(mobj_t *mobj, int sequence);
1373 void SN_StartSequenceName(mobj_t *mobj, char *name);
1374 void SN_StopSequence(mobj_t *mobj);
1375 void SN_UpdateActiveSequences(void);
1376 void SN_StopAllSequences(void);
1377 int SN_GetSequenceOffset(int sequence, int *sequencePtr);
1378 void SN_ChangeNodeData(int nodeNum, int seqOffset, int delayTics, int volume,
1379 	int currentSoundID);
1380 
1381 
1382 typedef struct seqnode_s seqnode_t;
1383 struct seqnode_s
1384 {
1385 	int *sequencePtr;
1386 	int	sequence;
1387 	mobj_t *mobj;
1388 	int currentSoundID;
1389 	int delayTics;
1390 	int volume;
1391 	int stopSound;
1392 	seqnode_t *prev;
1393 	seqnode_t *next;
1394 };
1395 
1396 extern int ActiveSequences;
1397 extern seqnode_t *SequenceListHead;
1398 
1399 //----------------------
1400 // Interlude (IN_lude.c)
1401 //----------------------
1402 
1403 #define MAX_INTRMSN_MESSAGE_SIZE 1024
1404 
1405 extern boolean intermission;
1406 extern char ClusterMessage[MAX_INTRMSN_MESSAGE_SIZE];
1407 
1408 void IN_Start(void);
1409 void IN_Ticker(void);
1410 void IN_Drawer(void);
1411 
1412 //----------------------
1413 // Chat mode (CT_chat.c)
1414 //----------------------
1415 
1416 void CT_Init(void);
1417 void CT_Drawer(void);
1418 boolean CT_Responder(event_t *ev);
1419 void CT_Ticker(void);
1420 char CT_dequeueChatChar(void);
1421 
1422 extern boolean chatmodeon;
1423 
1424 //--------------------
1425 // Finale (F_finale.c)
1426 //--------------------
1427 
1428 void F_Drawer(void);
1429 void F_Ticker(void);
1430 void F_StartFinale(void);
1431 
1432 //----------------------
1433 // STATUS BAR (SB_bar.c)
1434 //----------------------
1435 
1436 extern int inv_ptr;
1437 extern int curpos;
1438 extern int SB_state;
1439 void SB_Init(void);
1440 void SB_SetClassData(void);
1441 boolean SB_Responder(event_t *event);
1442 void SB_Ticker(void);
1443 void SB_Drawer(void);
1444 void Draw_TeleportIcon(void);
1445 void Draw_SaveIcon(void);
1446 void Draw_LoadIcon(void);
1447 
1448 //-----------------
1449 // MENU (MN_menu.c)
1450 //-----------------
1451 
1452 void MN_Init(void);
1453 void MN_ActivateMenu(void);
1454 void MN_DeactivateMenu(void);
1455 boolean MN_Responder(event_t *event);
1456 void MN_Ticker(void);
1457 void MN_Drawer(void);
1458 void MN_DrTextA(char *text, int x, int y);
1459 void MN_DrTextAYellow(char *text, int x, int y);
1460 int MN_TextAWidth(char *text);
1461 void MN_DrTextB(char *text, int x, int y);
1462 int MN_TextBWidth(char *text);
1463 
1464 //------
1465 // VIDEO
1466 //------
1467 
1468 extern int dirtybox[4];
1469 extern byte gammatable[5][256];
1470 extern int usegamma;
1471 
1472 void V_Init(void); // Allocates buffer screens, call before R_Init
1473 void V_DrawPatch(int x, int y, patch_t *patch);
1474 void V_DrawFuzzPatch(int x, int y, patch_t *patch);
1475 void V_DrawAltFuzzPatch(int x, int y, patch_t *patch);
1476 void V_DrawShadowedPatch(int x, int y, patch_t *patch);
1477 void V_DrawRawScreen(byte *raw);
1478 
1479 #include "sounds.h"
1480 
1481 /* XXX my defs */
1482 
1483 extern boolean devparm;
1484 
1485 #ifndef MUSTDIE
1486 void strupr(char *);
1487 #endif
1488 
1489 void I_ShutdownSound(void);
1490 void I_ShutdownGraphics(void);
1491 boolean G_CheckDemoStatus(void);
1492 
1493 
1494 #endif // __H2DEF__
1495