1 //
2 // Copyright(C) 1993-1996 Id Software, Inc.
3 // Copyright(C) 1993-2008 Raven Software
4 // Copyright(C) 2005-2014 Simon Howard
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 
17 
18 #ifndef __H2DEF__
19 #define __H2DEF__
20 #include <stdio.h>
21 #include <string.h>
22 #include <stdlib.h>
23 //#include <values.h>
24 
25 #include "st_start.h"
26 // haleyjd: removed WATCOMC
27 
28 // ticcmd:
29 
30 #include "d_ticcmd.h"
31 
32 // events
33 
34 #include "d_event.h"
35 
36 // gamemode/mission
37 
38 #include "d_mode.h"
39 
40 // for fixed_t:
41 
42 #include "m_fixed.h"
43 
44 // angle definitions:
45 
46 #include "tables.h"
47 
48 #include "d_loop.h"
49 #include "net_defs.h"
50 
51 #define HEXEN_VERSION 110
52 #define HEXEN_VERSION_TEXT "v1.1"
53 
54 // if rangecheck is undefined, most parameter validation debugging code
55 // will not be compiled
56 #ifndef NORANGECHECKING
57 #define RANGECHECK
58 #endif
59 
60 // Past distributions
61 //#ifndef VER_ID
62 //#define VER_ID "DVL"
63 //#endif
64 //#define HEXEN_VERSIONTEXT "ID V1.2"
65 //#define HEXEN_VERSIONTEXT "RETAIL STORE BETA"               // 9/26/95
66 //#define HEXEN_VERSIONTEXT "DVL BETA 10 05 95" // Used for GT for testing
67 //#define HEXEN_VERSIONTEXT "DVL BETA 10 07 95" // Just an update for Romero
68 //#define HEXEN_VERSIONTEXT "FINAL 1.0 (10 13 95)" // Just an update for Romero
69 //#ifdef RANGECHECK
70 //#define HEXEN_VERSIONTEXT "Version 1.1 +R "__DATE__" ("VER_ID")"
71 //#else
72 //#define HEXEN_VERSIONTEXT "Version 1.1 "__DATE__" ("VER_ID")"
73 //#endif
74 #define HEXEN_VERSIONTEXT ((gamemode == shareware) ? \
75                            "DEMO 10 16 95" : \
76                            "VERSION 1.1 MAR 22 1996 (BCP)")
77 
78 // all exterior data is defined here
79 #include "xddefs.h"
80 
81 // all important printed strings
82 #include "textdefs.h"
83 
84 // header generated by multigen utility
85 #include "info.h"
86 
87 /*
88 ===============================================================================
89 
90 						GLOBAL TYPES
91 
92 ===============================================================================
93 */
94 
95 //#define NUMARTIFCTS   28
96 #define MAXPLAYERS	8
97 
98 #define	BT_ATTACK		1
99 #define	BT_USE			2
100 #define	BT_CHANGE		4       // if true, the next 3 bits hold weapon num
101 #define	BT_WEAPONMASK	(8+16+32)
102 #define	BT_WEAPONSHIFT	3
103 
104 #define BT_SPECIAL		128     // game events, not really buttons
105 #define	BTS_SAVEMASK	(4+8+16)
106 #define	BTS_SAVESHIFT	2
107 #define	BT_SPECIALMASK	3
108 #define	BTS_PAUSE		1       // pause the game
109 #define	BTS_SAVEGAME	2       // save the game at each console
110 // savegame slot numbers occupy the second byte of buttons
111 
112 // The top 3 bits of the artifact field in the ticcmd_t struct are used
113 //              as additional flags
114 #define AFLAG_MASK			0x3F
115 #define AFLAG_SUICIDE		0x40
116 #define AFLAG_JUMP			0x80
117 
118 typedef enum
119 {
120     GS_LEVEL,
121     GS_INTERMISSION,
122     GS_FINALE,
123     GS_DEMOSCREEN
124 } gamestate_t;
125 
126 typedef enum
127 {
128     ga_nothing,
129     ga_loadlevel,
130     ga_initnew,
131     ga_newgame,
132     ga_loadgame,
133     ga_savegame,
134     ga_playdemo,
135     ga_completed,
136     ga_leavemap,
137     ga_singlereborn,
138     ga_victory,
139     ga_worlddone,
140     ga_screenshot
141 } gameaction_t;
142 
143 typedef enum
144 {
145     wipe_0,
146     wipe_1,
147     wipe_2,
148     wipe_3,
149     wipe_4,
150     NUMWIPES,
151     wipe_random
152 } wipe_t;
153 
154 /*
155 ===============================================================================
156 
157 							MAPOBJ DATA
158 
159 ===============================================================================
160 */
161 
162 // think_t is a function pointer to a routine to handle an actor
163 typedef void (*think_t) ();
164 
165 typedef struct thinker_s
166 {
167     struct thinker_s *prev, *next;
168     think_t function;
169 } thinker_t;
170 
171 struct player_s;
172 
173 typedef union
174 {
175     intptr_t i;
176     struct mobj_s *m;
177     struct player_s *p;
178 } specialval_t;
179 
180 typedef struct mobj_s
181 {
182     thinker_t thinker;          // thinker node
183 
184 // info for drawing
185     fixed_t x, y, z;
186     struct mobj_s *snext, *sprev;       // links in sector (if needed)
187     angle_t angle;
188     spritenum_t sprite;         // used to find patch_t and flip value
189     int frame;                  // might be ord with FF_FULLBRIGHT
190 
191 // interaction info
192     struct mobj_s *bnext, *bprev;       // links in blocks (if needed)
193     struct subsector_s *subsector;
194     fixed_t floorz, ceilingz;   // closest together of contacted secs
195     fixed_t floorpic;           // contacted sec floorpic
196     fixed_t radius, height;     // for movement checking
197     fixed_t momx, momy, momz;   // momentums
198     int validcount;             // if == validcount, already checked
199     mobjtype_t type;
200     mobjinfo_t *info;           // &mobjinfo[mobj->type]
201     int tics;                   // state tic counter
202     state_t *state;
203     int damage;                 // For missiles
204     int flags;
205     int flags2;                 // Heretic flags
206     specialval_t special1;      // Special info
207     specialval_t special2;      // Special info
208     int health;
209     int movedir;                // 0-7
210     int movecount;              // when 0, select a new dir
211     struct mobj_s *target;      // thing being chased/attacked (or NULL)
212     // also the originator for missiles
213     int reactiontime;           // if non 0, don't attack yet
214     // used by player to freeze a bit after
215     // teleporting
216     int threshold;              // if > 0, the target will be chased
217     // no matter what (even if shot)
218     struct player_s *player;    // only valid if type == MT_PLAYER
219     int lastlook;               // player number last looked for
220     fixed_t floorclip;          // value to use for floor clipping
221     int archiveNum;             // Identity during archive
222     short tid;                  // thing identifier
223     byte special;               // special
224     byte args[5];               // special arguments
225 } mobj_t;
226 
227 // each sector has a degenmobj_t in it's center for sound origin purposes
228 typedef struct
229 {
230     thinker_t thinker;          // not used for anything
231     fixed_t x, y, z;
232 } degenmobj_t;
233 
234 //
235 // frame flags
236 //
237 #define	FF_FULLBRIGHT	0x8000  // flag in thing->frame
238 #define FF_FRAMEMASK	0x7fff
239 
240 // --- mobj.flags ---
241 
242 #define	MF_SPECIAL		1       // call P_SpecialThing when touched
243 #define	MF_SOLID		2
244 #define	MF_SHOOTABLE	4
245 #define	MF_NOSECTOR		8       // don't use the sector links
246                                                                         // (invisible but touchable)
247 #define	MF_NOBLOCKMAP	16      // don't use the blocklinks
248                                                                         // (inert but displayable)
249 #define	MF_AMBUSH		32
250 #define	MF_JUSTHIT		64      // try to attack right back
251 #define	MF_JUSTATTACKED	128     // take at least one step before attacking
252 #define	MF_SPAWNCEILING	256     // hang from ceiling instead of floor
253 #define	MF_NOGRAVITY	512     // don't apply gravity every tic
254 
255 // movement flags
256 #define	MF_DROPOFF		0x400   // allow jumps from high places
257 #define	MF_PICKUP		0x800   // for players to pick up items
258 #define	MF_NOCLIP		0x1000  // player cheat
259 #define	MF_SLIDE		0x2000  // keep info about sliding along walls
260 #define	MF_FLOAT		0x4000  // allow moves to any height, no gravity
261 #define	MF_TELEPORT		0x8000  // don't cross lines or look at heights
262 #define MF_MISSILE		0x10000 // don't hit same species, explode on block
263 
264 #define	MF_ALTSHADOW	0x20000 // alternate translucent draw
265 #define	MF_SHADOW		0x40000 // use translucent draw (shadow demons / invis)
266 #define	MF_NOBLOOD		0x80000 // don't bleed when shot (use puff)
267 #define	MF_CORPSE		0x100000        // don't stop moving halfway off a step
268 #define	MF_INFLOAT		0x200000        // floating to a height for a move, don't
269                                                                         // auto float to target's height
270 
271 #define	MF_COUNTKILL	0x400000        // count towards intermission kill total
272 #define	MF_ICECORPSE	0x800000        // a frozen corpse (for blasting)
273 
274 #define	MF_SKULLFLY		0x1000000       // skull in flight
275 #define	MF_NOTDMATCH	0x2000000       // don't spawn in death match (key cards)
276 
277 //#define       MF_TRANSLATION  0xc000000       // if 0x4 0x8 or 0xc, use a translation
278 #define	MF_TRANSLATION	0x1c000000      // use a translation table (>>MF_TRANSHIFT)
279 #define	MF_TRANSSHIFT	26      // table for player colormaps
280 
281 
282 // --- mobj.flags2 ---
283 
284 #define MF2_LOGRAV			0x00000001      // alternate gravity setting
285 #define MF2_WINDTHRUST		0x00000002      // gets pushed around by the wind
286                                                                                 // specials
287 #define MF2_FLOORBOUNCE		0x00000004      // bounces off the floor
288 #define MF2_BLASTED			0x00000008      // missile will pass through ghosts
289 #define MF2_FLY				0x00000010      // fly mode is active
290 #define MF2_FLOORCLIP		0x00000020      // if feet are allowed to be clipped
291 #define MF2_SPAWNFLOAT		0x00000040      // spawn random float z
292 #define MF2_NOTELEPORT		0x00000080      // does not teleport
293 #define MF2_RIP				0x00000100      // missile rips through solid
294                                                                                 // targets
295 #define MF2_PUSHABLE		0x00000200      // can be pushed by other moving
296                                                                                 // mobjs
297 #define MF2_SLIDE			0x00000400      // slides against walls
298 #define MF2_ONMOBJ			0x00000800      // mobj is resting on top of another
299                                                                                 // mobj
300 #define MF2_PASSMOBJ		0x00001000      // Enable z block checking.  If on,
301                                                                                 // this flag will allow the mobj to
302                                                                                 // pass over/under other mobjs.
303 #define MF2_CANNOTPUSH		0x00002000      // cannot push other pushable mobjs
304 #define MF2_DROPPED			0x00004000      // dropped by a demon
305 #define MF2_BOSS			0x00008000      // mobj is a major boss
306 #define MF2_FIREDAMAGE		0x00010000      // does fire damage
307 #define MF2_NODMGTHRUST		0x00020000      // does not thrust target when
308                                                                                 // damaging
309 #define MF2_TELESTOMP		0x00040000      // mobj can stomp another
310 #define MF2_FLOATBOB		0x00080000      // use float bobbing z movement
311 #define MF2_DONTDRAW		0x00100000      // don't generate a vissprite
312 #define MF2_IMPACT			0x00200000      // an MF_MISSILE mobj can activate
313                                                                                 // SPAC_IMPACT
314 #define MF2_PUSHWALL		0x00400000      // mobj can push walls
315 #define MF2_MCROSS			0x00800000      // can activate monster cross lines
316 #define MF2_PCROSS			0x01000000      // can activate projectile cross lines
317 #define MF2_CANTLEAVEFLOORPIC 0x02000000        // stay within a certain floor type
318 #define MF2_NONSHOOTABLE	0x04000000      // mobj is totally non-shootable,
319                                                                                 // but still considered solid
320 #define MF2_INVULNERABLE	0x08000000      // mobj is invulnerable
321 #define MF2_DORMANT			0x10000000      // thing is dormant
322 #define MF2_ICEDAMAGE		0x20000000      // does ice damage
323 #define MF2_SEEKERMISSILE	0x40000000      // is a seeker (for reflection)
324 #define MF2_REFLECTIVE		0x80000000      // reflects missiles
325 
326 //=============================================================================
327 
328 // ===== Player Class Types =====
329 typedef enum
330 {
331     PCLASS_FIGHTER,
332     PCLASS_CLERIC,
333     PCLASS_MAGE,
334     PCLASS_PIG,
335     NUMCLASSES
336 } pclass_t;
337 
338 typedef enum
339 {
340     PST_LIVE,                   // playing
341     PST_DEAD,                   // dead on the ground
342     PST_REBORN                  // ready to restart
343 } playerstate_t;
344 
345 // psprites are scaled shapes directly on the view screen
346 // coordinates are given for a 320*200 view screen
347 typedef enum
348 {
349     ps_weapon,
350     ps_flash,
351     NUMPSPRITES
352 } psprnum_t;
353 
354 typedef struct
355 {
356     state_t *state;             // a NULL state means not active
357     int tics;
358     fixed_t sx, sy;
359 } pspdef_t;
360 
361 /* Old Heretic key type
362 typedef enum
363 {
364 	key_yellow,
365 	key_green,
366 	key_blue,
367 	NUMKEYS
368 } keytype_t;
369 */
370 
371 typedef enum
372 {
373     KEY_1,
374     KEY_2,
375     KEY_3,
376     KEY_4,
377     KEY_5,
378     KEY_6,
379     KEY_7,
380     KEY_8,
381     KEY_9,
382     KEY_A,
383     KEY_B,
384     NUMKEYS
385 } keytype_t;
386 
387 typedef enum
388 {
389     ARMOR_ARMOR,
390     ARMOR_SHIELD,
391     ARMOR_HELMET,
392     ARMOR_AMULET,
393     NUMARMOR
394 } armortype_t;
395 
396 typedef enum
397 {
398     WP_FIRST,
399     WP_SECOND,
400     WP_THIRD,
401     WP_FOURTH,
402     NUMWEAPONS,
403     WP_NOCHANGE
404 } weapontype_t;
405 
406 typedef enum
407 {
408     MANA_1,
409     MANA_2,
410     NUMMANA,
411     MANA_BOTH,
412     MANA_NONE
413 } manatype_t;
414 
415 #define MAX_MANA	200
416 
417 #define WPIECE1		1
418 #define WPIECE2		2
419 #define WPIECE3		4
420 
421 typedef struct
422 {
423     manatype_t mana;
424     int upstate;
425     int downstate;
426     int readystate;
427     int atkstate;
428     int holdatkstate;
429     int flashstate;
430 } weaponinfo_t;
431 
432 extern weaponinfo_t WeaponInfo[NUMWEAPONS][NUMCLASSES];
433 
434 typedef enum
435 {
436     arti_none,
437     arti_invulnerability,
438     arti_health,
439     arti_superhealth,
440     arti_healingradius,
441     arti_summon,
442     arti_torch,
443     arti_egg,
444     arti_fly,
445     arti_blastradius,
446     arti_poisonbag,
447     arti_teleportother,
448     arti_speed,
449     arti_boostmana,
450     arti_boostarmor,
451     arti_teleport,
452     // Puzzle artifacts
453     arti_firstpuzzitem,
454     arti_puzzskull = arti_firstpuzzitem,
455     arti_puzzgembig,
456     arti_puzzgemred,
457     arti_puzzgemgreen1,
458     arti_puzzgemgreen2,
459     arti_puzzgemblue1,
460     arti_puzzgemblue2,
461     arti_puzzbook1,
462     arti_puzzbook2,
463     arti_puzzskull2,
464     arti_puzzfweapon,
465     arti_puzzcweapon,
466     arti_puzzmweapon,
467     arti_puzzgear1,
468     arti_puzzgear2,
469     arti_puzzgear3,
470     arti_puzzgear4,
471     NUMARTIFACTS
472 } artitype_t;
473 
474 typedef enum
475 {
476     pw_None,
477     pw_invulnerability,
478     pw_allmap,
479     pw_infrared,
480     pw_flight,
481     pw_shield,
482     pw_health2,
483     pw_speed,
484     pw_minotaur,
485     NUMPOWERS
486 } powertype_t;
487 
488 #define	INVULNTICS (30*35)
489 #define	INVISTICS (60*35)
490 #define	INFRATICS (120*35)
491 #define	IRONTICS (60*35)
492 #define WPNLEV2TICS (40*35)
493 #define FLIGHTTICS (60*35)
494 #define SPEEDTICS (45*35)
495 #define MORPHTICS (40*35)
496 #define MAULATORTICS (25*35)
497 
498 #define MESSAGETICS (4*35)
499 #define BLINKTHRESHOLD (4*35)
500 
501 #define NUMINVENTORYSLOTS	NUMARTIFACTS
502 
503 typedef struct
504 {
505     int type;
506     int count;
507 } inventory_t;
508 
509 /*
510 ================
511 =
512 = player_t
513 =
514 ================
515 */
516 
517 typedef struct player_s
518 {
519     mobj_t *mo;
520     playerstate_t playerstate;
521     ticcmd_t cmd;
522 
523     pclass_t class;             // player class type
524 
525     fixed_t viewz;              // focal origin above r.z
526     fixed_t viewheight;         // base height above floor for viewz
527     fixed_t deltaviewheight;    // squat speed
528     fixed_t bob;                // bounded/scaled total momentum
529 
530     int flyheight;
531     int lookdir;
532     boolean centering;
533     int health;                 // only used between levels, mo->health
534     // is used during levels
535     int armorpoints[NUMARMOR];
536 
537     inventory_t inventory[NUMINVENTORYSLOTS];
538     artitype_t readyArtifact;
539     int artifactCount;
540     int inventorySlotNum;
541     int powers[NUMPOWERS];
542     int keys;
543     int pieces;                 // Fourth Weapon pieces
544     signed int frags[MAXPLAYERS];       // kills of other players
545     weapontype_t readyweapon;
546     weapontype_t pendingweapon; // wp_nochange if not changing
547     boolean weaponowned[NUMWEAPONS];
548     int mana[NUMMANA];
549     int attackdown, usedown;    // true if button down last tic
550     int cheats;                 // bit flags
551 
552     int refire;                 // refired shots are less accurate
553 
554     int killcount, itemcount, secretcount;      // for intermission
555     char message[80];           // hint messages
556     int messageTics;            // counter for showing messages
557     short ultimateMessage;
558     short yellowMessage;
559     int damagecount, bonuscount;        // for screen flashing
560     int poisoncount;            // screen flash for poison damage
561     mobj_t *poisoner;           // NULL for non-player mobjs
562     mobj_t *attacker;           // who did damage (NULL for floors)
563     int extralight;             // so gun flashes light up areas
564     int fixedcolormap;          // can be set to REDCOLORMAP, etc
565     int colormap;               // 0-3 for which color to draw player
566     pspdef_t psprites[NUMPSPRITES];     // view sprites (gun, etc)
567     int morphTics;              // player is a pig if > 0
568     unsigned int jumpTics;      // delay the next jump for a moment
569     unsigned int worldTimer;    // total time the player's been playing
570 } player_t;
571 
572 #define CF_NOCLIP		1
573 #define	CF_GODMODE		2
574 #define	CF_NOMOMENTUM	4       // not really a cheat, just a debug aid
575 
576 #define	SBARHEIGHT	(39 << crispy->hires)      // status bar height at bottom of screen
577 
578 void NET_SendFrags(player_t * player);
579 
580 /*
581 ===============================================================================
582 
583 					GLOBAL VARIABLES
584 
585 ===============================================================================
586 */
587 
588 #define TELEFOGHEIGHT (32*FRACUNIT)
589 
590 extern GameMode_t gamemode;         // Always commercial
591 
592 extern gameaction_t gameaction;
593 
594 extern boolean paused;
595 
596 extern boolean DevMaps;         // true = map development mode
597 extern char *DevMapsDir;        // development maps directory
598 
599 extern boolean nomonsters;      // checkparm of -nomonsters
600 
601 extern boolean respawnparm;     // checkparm of -respawn
602 
603 extern boolean randomclass;     // checkparm of -randclass
604 
605 extern boolean debugmode;       // checkparm of -debug
606 
607 extern boolean usergame;        // ok to save / end game
608 
609 extern boolean ravpic;          // checkparm of -ravpic
610 
611 extern boolean altpal;          // checkparm to use an alternate palette routine
612 
613 extern boolean cdrom;           // true if cd-rom mode active ("-cdrom")
614 
615 extern boolean deathmatch;      // only if started as net death
616 
617 extern boolean netgame;         // only true if >1 player
618 
619 extern boolean cmdfrag;         // true if a CMD_FRAG packet should be sent out every
620                                                 // kill
621 
622 extern boolean playeringame[MAXPLAYERS];
623 extern pclass_t PlayerClass[MAXPLAYERS];
624 
625 extern int consoleplayer;       // player taking events and displaying
626 
627 extern int displayplayer;
628 
629 extern int viewangleoffset;     // ANG90 = left side, ANG270 = right
630 
631 extern player_t players[MAXPLAYERS];
632 
633 extern boolean DebugSound;      // debug flag for displaying sound info
634 
635 extern boolean demoplayback;
636 extern boolean demoextend;      // allow demos to persist through exit/respawn
637 extern int maxzone;             // Maximum chunk allocated for zone heap
638 
639 // Truncate angleturn in ticcmds to nearest 256.
640 // Used when recording Vanilla demos in netgames.
641 extern boolean lowres_turn;
642 
643 extern int Sky1Texture;
644 extern int Sky2Texture;
645 
646 extern gamestate_t gamestate;
647 extern skill_t gameskill;
648 //extern        boolean         respawnmonsters;
649 extern int gameepisode;
650 extern int gamemap;
651 extern int prevmap;
652 extern int levelstarttic;       // gametic at level start
653 extern int leveltime;           // tics in game play for par
654 
655 extern ticcmd_t *netcmds;
656 
657 #define MAXDEATHMATCHSTARTS 16
658 extern mapthing_t *deathmatch_p;
659 extern mapthing_t deathmatchstarts[MAXDEATHMATCHSTARTS];
660 
661 // Position indicator for cooperative net-play reborn
662 extern int RebornPosition;
663 
664 #define MAX_PLAYER_STARTS 8
665 extern mapthing_t playerstarts[MAX_PLAYER_STARTS][MAXPLAYERS];
666 extern int maxplayers;
667 
668 extern int mouseSensitivity;
669 
670 extern boolean precache;        // if true, load all graphics at level load
671 
672 extern byte *screen;            // off screen work buffer, from V_video.c
673 
674 extern boolean singledemo;      // quit after playing a demo from cmdline
675 
676 extern int bodyqueslot;
677 extern skill_t startskill;
678 extern int startepisode;
679 extern int startmap;
680 extern boolean autostart;
681 
682 extern boolean testcontrols;
683 extern int testcontrols_mousespeed;
684 
685 extern int vanilla_savegame_limit;
686 extern int vanilla_demo_limit;
687 
688 /*
689 ===============================================================================
690 
691 					GLOBAL FUNCTIONS
692 
693 ===============================================================================
694 */
695 
696 #include "w_wad.h"
697 #include "z_zone.h"
698 
699 //----------
700 //BASE LEVEL
701 //----------
702 void H2_Main(void);
703 // not a globally visible function, just included for source reference
704 // calls all startup code
705 // parses command line options
706 // if not overrided, calls N_AdvanceDemo
707 
708 void H2_GameLoop(void);
709 // not a globally visible function, just included for source reference
710 // called by H2_Main, never exits
711 // manages timing and IO
712 // calls all ?_Responder, ?_Ticker, and ?_Drawer functions
713 // calls I_GetTime, I_StartFrame, and I_StartTic
714 
715 //---------
716 //SYSTEM IO
717 //---------
718 byte *I_AllocLow(int length);
719 // allocates from low memory under dos, just mallocs under unix
720 
721 // haleyjd: was WATCOMC, again preserved for historical interest as in Heretic
722 #if 0
723 extern boolean useexterndriver;
724 
725 #define EBT_FIRE			1
726 #define EBT_OPENDOOR 		2
727 #define EBT_SPEED			4
728 #define EBT_STRAFE			8
729 #define EBT_MAP				0x10
730 #define EBT_INVENTORYLEFT 	0x20
731 #define EBT_INVENTORYRIGHT 	0x40
732 #define EBT_USEARTIFACT		0x80
733 #define EBT_FLYDROP			0x100
734 #define EBT_CENTERVIEW		0x200
735 #define EBT_PAUSE			0x400
736 #define EBT_WEAPONCYCLE		0x800
737 #define EBT_JUMP			0x1000
738 
739 typedef struct
740 {
741     short vector;               // Interrupt vector
742 
743     signed char moveForward;    // forward/backward (maxes at 50)
744     signed char moveSideways;   // strafe (maxes at 24)
745     short angleTurn;            // turning speed (640 [slow] 1280 [fast])
746     short angleHead;            // head angle (+2080 [left] : 0 [center] : -2048 [right])
747     signed char pitch;          // look up/down (-110 : +90)
748     signed char flyDirection;   // flyheight (+1/-1)
749     unsigned short buttons;     // EBT_* flags
750 } externdata_t;
751 #endif
752 
753 //----
754 //GAME
755 //----
756 
757 void G_DeathMatchSpawnPlayer(int playernum);
758 
759 void G_InitNew(skill_t skill, int episode, int map);
760 
761 void G_DeferedInitNew(skill_t skill, int episode, int map);
762 // can be called by the startup code or M_Responder
763 // a normal game starts at map 1, but a warp test can start elsewhere
764 
765 void G_DeferredNewGame(skill_t skill);
766 
767 void G_DeferedPlayDemo(const char *demo);
768 
769 void G_LoadGame(int slot);
770 // can be called by the startup code or M_Responder
771 // calls P_SetupLevel or W_EnterWorld
772 void G_DoLoadGame(void);
773 
774 void G_SaveGame(int slot, char *description);
775 // called by M_Responder
776 
777 void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
778                   const char *name);
779 // only called by startup code
780 
781 void G_PlayDemo(char *name);
782 void G_TimeDemo(char *name);
783 
784 void G_TeleportNewMap(int map, int position);
785 
786 void G_Completed(int map, int position);
787 //void G_ExitLevel (void);
788 //void G_SecretExitLevel (void);
789 
790 void G_StartNewGame(skill_t skill);
791 void G_StartNewInit(void);
792 
793 void G_WorldDone(void);
794 
795 void G_Ticker(void);
796 boolean G_Responder(event_t * ev);
797 
798 void G_ScreenShot(void);
799 
800 //-------
801 //SV_SAVE
802 //-------
803 
804 #define HXS_VERSION_TEXT "HXS Ver 2.37"
805 #define HXS_VERSION_TEXT_LENGTH 16
806 #define HXS_DESCRIPTION_LENGTH 24
807 
808 extern char *SavePath;
809 
810 void SV_SaveGame(int slot, const char *description);
811 void SV_SaveMap(boolean savePlayers);
812 void SV_LoadGame(int slot);
813 void SV_MapTeleport(int map, int position);
814 void SV_LoadMap(void);
815 void SV_InitBaseSlot(void);
816 void SV_UpdateRebornSlot(void);
817 void SV_ClearRebornSlot(void);
818 boolean SV_RebornSlotAvailable(void);
819 int SV_GetRebornSlot(void);
820 
821 //-----
822 //PLAY
823 //-----
824 
825 void P_Ticker(void);
826 // called by C_Ticker
827 // can call G_PlayerExited
828 // carries out all thinking of monsters and players
829 
830 void P_SetupLevel(int episode, int map, int playermask, skill_t skill);
831 // called by W_Ticker
832 
833 void P_Init(void);
834 // called by startup code
835 
836 int P_GetMapCluster(int map);
837 int P_TranslateMap(int map);
838 int P_GetMapCDTrack(int map);
839 int P_GetMapWarpTrans(int map);
840 int P_GetMapNextMap(int map);
841 int P_GetMapSky1Texture(int map);
842 int P_GetMapSky2Texture(int map);
843 char *P_GetMapName(int map);
844 fixed_t P_GetMapSky1ScrollDelta(int map);
845 fixed_t P_GetMapSky2ScrollDelta(int map);
846 boolean P_GetMapDoubleSky(int map);
847 boolean P_GetMapLightning(int map);
848 boolean P_GetMapFadeTable(int map);
849 char *P_GetMapSongLump(int map);
850 void P_PutMapSongLump(int map, char *lumpName);
851 int P_GetCDStartTrack(void);
852 int P_GetCDEnd1Track(void);
853 int P_GetCDEnd2Track(void);
854 int P_GetCDEnd3Track(void);
855 int P_GetCDIntermissionTrack(void);
856 int P_GetCDTitleTrack(void);
857 
858 //-------
859 //REFRESH
860 //-------
861 
862 extern boolean setsizeneeded;
863 
864 extern boolean BorderNeedRefresh;
865 extern boolean BorderTopRefresh;
866 
867 extern int UpdateState;
868 // define the different areas for the dirty map
869 #define I_NOUPDATE	0
870 #define I_FULLVIEW	1
871 #define I_STATBAR	2
872 #define I_MESSAGES	4
873 #define I_FULLSCRN	8
874 
875 void R_RenderPlayerView(player_t * player);
876 // called by G_Drawer
877 
878 void R_Init(void);
879 // called by startup code
880 
881 void R_DrawViewBorder(void);
882 void R_DrawTopBorder(void);
883 // if the view size is not full screen, draws a border around it
884 
885 void R_SetViewSize(int blocks, int detail);
886 // called by M_Responder
887 
888 int R_FlatNumForName(const char *name);
889 
890 int R_TextureNumForName(const char *name);
891 int R_CheckTextureNumForName(const char *name);
892 // called by P_Ticker for switches and animations
893 // returns the texture number for the texture name
894 
895 
896 //----
897 //MISC
898 //----
899 extern int localQuakeHappening[MAXPLAYERS];
900 
901 int M_DrawText(int x, int y, boolean direct, char *string);
902 
903 //------------------------------
904 // SC_man.c
905 //------------------------------
906 
907 void SC_Open(const char *name);
908 void SC_OpenLump(const char *name);
909 void SC_OpenFile(const char *name);
910 void SC_Close(void);
911 boolean SC_GetString(void);
912 void SC_MustGetString(void);
913 void SC_MustGetStringName(char *name);
914 boolean SC_GetNumber(void);
915 void SC_MustGetNumber(void);
916 void SC_UnGet(void);
917 //boolean SC_Check(void);
918 boolean SC_Compare(const char *text);
919 int SC_MatchString(const char **strings);
920 int SC_MustMatchString(const char **strings);
921 void SC_ScriptError(const char *message);
922 
923 extern char *sc_String;
924 extern int sc_Number;
925 extern int sc_Line;
926 extern boolean sc_End;
927 extern boolean sc_Crossed;
928 extern boolean sc_FileScripts;
929 extern const char *sc_ScriptsDir;
930 
931 //------------------------------
932 // SN_sonix.c
933 //------------------------------
934 
935 enum
936 {
937     SEQ_PLATFORM,
938     SEQ_PLATFORM_HEAVY,         // same script as a normal platform
939     SEQ_PLATFORM_METAL,
940     SEQ_PLATFORM_CREAK,         // same script as a normal platform
941     SEQ_PLATFORM_SILENCE,
942     SEQ_PLATFORM_LAVA,
943     SEQ_PLATFORM_WATER,
944     SEQ_PLATFORM_ICE,
945     SEQ_PLATFORM_EARTH,
946     SEQ_PLATFORM_METAL2,
947     SEQ_DOOR_STONE,
948     SEQ_DOOR_HEAVY,
949     SEQ_DOOR_METAL,
950     SEQ_DOOR_CREAK,
951     SEQ_DOOR_SILENCE,
952     SEQ_DOOR_LAVA,
953     SEQ_DOOR_WATER,
954     SEQ_DOOR_ICE,
955     SEQ_DOOR_EARTH,
956     SEQ_DOOR_METAL2,
957     SEQ_ESOUND_WIND,
958     SEQ_NUMSEQ
959 };
960 
961 typedef enum
962 {
963     SEQTYPE_STONE,
964     SEQTYPE_HEAVY,
965     SEQTYPE_METAL,
966     SEQTYPE_CREAK,
967     SEQTYPE_SILENCE,
968     SEQTYPE_LAVA,
969     SEQTYPE_WATER,
970     SEQTYPE_ICE,
971     SEQTYPE_EARTH,
972     SEQTYPE_METAL2,
973     SEQTYPE_NUMSEQ
974 } seqtype_t;
975 
976 void SN_InitSequenceScript(void);
977 void SN_StartSequence(mobj_t * mobj, int sequence);
978 void SN_StartSequenceName(mobj_t * mobj, char *name);
979 void SN_StopSequence(mobj_t * mobj);
980 void SN_UpdateActiveSequences(void);
981 void SN_StopAllSequences(void);
982 int SN_GetSequenceOffset(int sequence, int *sequencePtr);
983 void SN_ChangeNodeData(int nodeNum, int seqOffset, int delayTics, int volume,
984                        int currentSoundID);
985 
986 
987 typedef struct seqnode_s seqnode_t;
988 struct seqnode_s
989 {
990     int *sequencePtr;
991     int sequence;
992     mobj_t *mobj;
993     int currentSoundID;
994     int delayTics;
995     int volume;
996     int stopSound;
997     seqnode_t *prev;
998     seqnode_t *next;
999 };
1000 
1001 extern int ActiveSequences;
1002 extern seqnode_t *SequenceListHead;
1003 
1004 //----------------------
1005 // Interlude (IN_lude.c)
1006 //----------------------
1007 
1008 #define MAX_INTRMSN_MESSAGE_SIZE 1024
1009 
1010 extern boolean intermission;
1011 extern char ClusterMessage[MAX_INTRMSN_MESSAGE_SIZE];
1012 
1013 void IN_Start(void);
1014 void IN_Ticker(void);
1015 void IN_Drawer(void);
1016 
1017 //----------------------
1018 // Chat mode (CT_chat.c)
1019 //----------------------
1020 
1021 void CT_Init(void);
1022 void CT_Drawer(void);
1023 boolean CT_Responder(event_t * ev);
1024 void CT_Ticker(void);
1025 char CT_dequeueChatChar(void);
1026 
1027 extern boolean chatmodeon;
1028 
1029 //--------------------
1030 // Finale (F_finale.c)
1031 //--------------------
1032 
1033 void F_Drawer(void);
1034 void F_Ticker(void);
1035 void F_StartFinale(void);
1036 
1037 //----------------------
1038 // STATUS BAR (SB_bar.c)
1039 //----------------------
1040 
1041 extern int inv_ptr;
1042 extern int curpos;
1043 void SB_Init(void);
1044 void SB_SetClassData(void);
1045 boolean SB_Responder(event_t * event);
1046 void SB_Ticker(void);
1047 void SB_Drawer(void);
1048 void Draw_TeleportIcon(void);
1049 void Draw_SaveIcon(void);
1050 void Draw_LoadIcon(void);
1051 
1052 //-----------------
1053 // MENU (MN_menu.c)
1054 //-----------------
1055 
1056 void MN_Init(void);
1057 void MN_ActivateMenu(void);
1058 void MN_DeactivateMenu(void);
1059 boolean MN_Responder(event_t * event);
1060 void MN_Ticker(void);
1061 void MN_Drawer(void);
1062 void MN_DrTextA(const char *text, int x, int y);
1063 void MN_DrTextAYellow(const char *text, int x, int y);
1064 int MN_TextAWidth(const char *text);
1065 void MN_DrTextB(const char *text, int x, int y);
1066 int MN_TextBWidth(const char *text);
1067 
1068 extern int messageson;
1069 
1070 #include "sounds.h"
1071 
1072 #endif // __H2DEF__
1073