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