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