1 //
2 // Copyright(C) 1993-1996 Id Software, Inc.
3 // Copyright(C) 1993-2008 Raven Software
4 // Copyright(C) 2005-2014 Simon Howard
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 
17 // DoomDef.h
18 
19 #ifndef __DOOMDEF__
20 #define __DOOMDEF__
21 #include <stdio.h>
22 #include <string.h>
23 //haleyjd: removed WATCOMC
24 #include <limits.h>
25 
26 #define HERETIC_VERSION 130
27 #define HERETIC_VERSION_TEXT "v1.3"
28 
29 // if rangecheck is undefined, most parameter validation debugging code
30 // will not be compiled
31 //#define RANGECHECK
32 
33 // all external data is defined here
34 #include "doomdata.h"
35 
36 // all important printed strings
37 #include "dstrings.h"
38 
39 // header generated by multigen utility
40 #include "info.h"
41 
42 // WAD file access
43 #include "w_wad.h"
44 
45 // fixed_t
46 #include "m_fixed.h"
47 
48 // angle_t
49 #include "tables.h"
50 
51 // events
52 #include "d_event.h"
53 
54 // gamemode/mission
55 #include "d_mode.h"
56 
57 // ticcmd_t
58 #include "d_ticcmd.h"
59 
60 #include "d_loop.h"
61 
62 #define	SAVEGAMENAME "hticsav"
63 
64 /*
65 ===============================================================================
66 
67 						GLOBAL TYPES
68 
69 ===============================================================================
70 */
71 
72 #define NUMARTIFCTS	28
73 #define MAXPLAYERS	4
74 
75 #define	BT_ATTACK		1
76 #define	BT_USE			2
77 #define	BT_CHANGE		4       // if true, the next 3 bits hold weapon num
78 #define	BT_WEAPONMASK	(8+16+32)
79 #define	BT_WEAPONSHIFT	3
80 
81 #define BT_SPECIAL		128     // game events, not really buttons
82 #define	BTS_SAVEMASK	(4+8+16)
83 #define	BTS_SAVESHIFT	2
84 #define	BT_SPECIALMASK	3
85 #define	BTS_PAUSE		1       // pause the game
86 #define	BTS_SAVEGAME	2       // save the game at each console
87 // savegame slot numbers occupy the second byte of buttons
88 
89 typedef enum
90 {
91     GS_LEVEL,
92     GS_INTERMISSION,
93     GS_FINALE,
94     GS_DEMOSCREEN
95 } gamestate_t;
96 
97 typedef enum
98 {
99     ga_nothing,
100     ga_loadlevel,
101     ga_newgame,
102     ga_loadgame,
103     ga_savegame,
104     ga_playdemo,
105     ga_completed,
106     ga_victory,
107     ga_worlddone,
108     ga_screenshot
109 } gameaction_t;
110 
111 typedef enum
112 {
113     wipe_0,
114     wipe_1,
115     wipe_2,
116     wipe_3,
117     wipe_4,
118     NUMWIPES,
119     wipe_random
120 } wipe_t;
121 
122 /*
123 ===============================================================================
124 
125 							MAPOBJ DATA
126 
127 ===============================================================================
128 */
129 
130 // think_t is a function pointer to a routine to handle an actor
131 typedef void (*think_t) ();
132 
133 typedef struct thinker_s
134 {
135     struct thinker_s *prev, *next;
136     think_t function;
137 } thinker_t;
138 
139 typedef union
140 {
141     int i;
142     struct mobj_s *m;
143 } specialval_t;
144 
145 struct player_s;
146 
147 typedef struct mobj_s
148 {
149     thinker_t thinker;          // thinker links
150 
151 // info for drawing
152     fixed_t x, y, z;
153     struct mobj_s *snext, *sprev;       // links in sector (if needed)
154     angle_t angle;
155     spritenum_t sprite;         // used to find patch_t and flip value
156     int frame;                  // might be ord with FF_FULLBRIGHT
157 
158 // interaction info
159     struct mobj_s *bnext, *bprev;       // links in blocks (if needed)
160     struct subsector_s *subsector;
161     fixed_t floorz, ceilingz;   // closest together of contacted secs
162     fixed_t radius, height;     // for movement checking
163     fixed_t momx, momy, momz;   // momentums
164 
165     int validcount;             // if == validcount, already checked
166 
167     mobjtype_t type;
168     mobjinfo_t *info;           // &mobjinfo[mobj->type]
169     int tics;                   // state tic counter
170     state_t *state;
171     int damage;                 // For missiles
172     int flags;
173     int flags2;                 // Heretic flags
174     specialval_t special1;      // Special info
175     specialval_t special2;      // Special info
176     int health;
177     int movedir;                // 0-7
178     int movecount;              // when 0, select a new dir
179     struct mobj_s *target;      // thing being chased/attacked (or NULL)
180     // also the originator for missiles
181     int reactiontime;           // if non 0, don't attack yet
182     // used by player to freeze a bit after
183     // teleporting
184     int threshold;              // if >0, the target will be chased
185     // no matter what (even if shot)
186     struct player_s *player;    // only valid if type == MT_PLAYER
187     int lastlook;               // player number last looked for
188 
189     mapthing_t spawnpoint;      // for nightmare respawn
190 
191     // [AM] If true, ok to interpolate this tic.
192     int                 interp;
193 
194     // [AM] Previous position of mobj before think.
195     //      Used to interpolate between positions.
196     fixed_t		oldx;
197     fixed_t		oldy;
198     fixed_t		oldz;
199     angle_t		oldangle;
200 } mobj_t;
201 
202 // each sector has a degenmobj_t in it's center for sound origin purposes
203 typedef struct
204 {
205     thinker_t thinker;          // not used for anything
206     fixed_t x, y, z;
207 } degenmobj_t;
208 
209 //
210 // frame flags
211 //
212 #define	FF_FULLBRIGHT	0x8000  // flag in thing->frame
213 #define FF_FRAMEMASK	0x7fff
214 
215 // --- mobj.flags ---
216 
217 #define	MF_SPECIAL	1         // call P_SpecialThing when touched
218 #define	MF_SOLID	2
219 #define	MF_SHOOTABLE	4
220 #define	MF_NOSECTOR	8         // don't use the sector links
221                                   // (invisible but touchable)
222 #define	MF_NOBLOCKMAP	16        // don't use the blocklinks
223                                   // (inert but displayable)
224 #define	MF_AMBUSH	32
225 #define	MF_JUSTHIT	64        // try to attack right back
226 #define	MF_JUSTATTACKED	128       // take at least one step before attacking
227 #define	MF_SPAWNCEILING	256       // hang from ceiling instead of floor
228 #define	MF_NOGRAVITY	512       // don't apply gravity every tic
229 
230 // movement flags
231 #define	MF_DROPOFF	0x400     // allow jumps from high places
232 #define	MF_PICKUP	0x800     // for players to pick up items
233 #define	MF_NOCLIP	0x1000    // player cheat
234 #define	MF_SLIDE	0x2000    // keep info about sliding along walls
235 #define	MF_FLOAT	0x4000    // allow moves to any height, no gravity
236 #define	MF_TELEPORT	0x8000    // don't cross lines or look at heights
237 #define MF_MISSILE	0x10000   // don't hit same species, explode on block
238 
239 #define	MF_DROPPED	0x20000   // dropped by a demon, not level spawned
240 #define	MF_SHADOW	0x40000   // use translucent draw (shadow demons / invis)
241 #define	MF_NOBLOOD	0x80000   // don't bleed when shot (use puff)
242 #define	MF_CORPSE	0x100000  // don't stop moving halfway off a step
243 #define	MF_INFLOAT	0x200000  // floating to a height for a move, don't
244                                   // auto float to target's height
245 
246 #define	MF_COUNTKILL	0x400000  // count towards intermission kill total
247 #define	MF_COUNTITEM	0x800000  // count towards intermission item total
248 
249 #define	MF_SKULLFLY	0x1000000 // skull in flight
250 #define	MF_NOTDMATCH	0x2000000 // don't spawn in death match (key cards)
251 
252 #define	MF_TRANSLATION	0xc000000 // if 0x4 0x8 or 0xc, use a translation
253 #define	MF_TRANSSHIFT	26      // table for player colormaps
254 
255 // --- mobj.flags2 ---
256 
257 #define MF2_LOGRAV		0x00000001  // alternate gravity setting
258 #define MF2_WINDTHRUST		0x00000002  // gets pushed around by the wind
259                                             // specials
260 #define MF2_FLOORBOUNCE		0x00000004  // bounces off the floor
261 #define MF2_THRUGHOST		0x00000008  // missile will pass through ghosts
262 #define MF2_FLY			0x00000010  // fly mode is active
263 #define MF2_FOOTCLIP		0x00000020  // if feet are allowed to be clipped
264 #define MF2_SPAWNFLOAT		0x00000040  // spawn random float z
265 #define MF2_NOTELEPORT		0x00000080  // does not teleport
266 #define MF2_RIP			0x00000100  // missile rips through solid
267                                             // targets
268 #define MF2_PUSHABLE		0x00000200  // can be pushed by other moving
269                                             // mobjs
270 #define MF2_SLIDE		0x00000400  // slides against walls
271 #define MF2_ONMOBJ		0x00000800  // mobj is resting on top of another
272                                             // mobj
273 #define MF2_PASSMOBJ		0x00001000  // Enable z block checking.  If on,
274                                             // this flag will allow the mobj to
275                                             // pass over/under other mobjs.
276 #define MF2_CANNOTPUSH		0x00002000  // cannot push other pushable mobjs
277 #define MF2_FEETARECLIPPED	0x00004000  // a mobj's feet are now being cut
278 #define MF2_BOSS		0x00008000  // mobj is a major boss
279 #define MF2_FIREDAMAGE		0x00010000  // does fire damage
280 #define MF2_NODMGTHRUST		0x00020000  // does not thrust target when
281                                             // damaging
282 #define MF2_TELESTOMP		0x00040000  // mobj can stomp another
283 #define MF2_FLOATBOB		0x00080000  // use float bobbing z movement
284 #define MF2_DONTDRAW		0X00100000  // don't generate a vissprite
285 
286 //=============================================================================
287 typedef enum
288 {
289     PST_LIVE,                   // playing
290     PST_DEAD,                   // dead on the ground
291     PST_REBORN                  // ready to restart
292 } playerstate_t;
293 
294 // psprites are scaled shapes directly on the view screen
295 // coordinates are given for a 320*200 view screen
296 typedef enum
297 {
298     ps_weapon,
299     ps_flash,
300     NUMPSPRITES
301 } psprnum_t;
302 
303 typedef struct
304 {
305     state_t *state;             // a NULL state means not active
306     int tics;
307     fixed_t sx, sy;
308 } pspdef_t;
309 
310 typedef enum
311 {
312     key_yellow,
313     key_green,
314     key_blue,
315     NUMKEYS
316 } keytype_t;
317 
318 typedef enum
319 {
320     wp_staff,
321     wp_goldwand,
322     wp_crossbow,
323     wp_blaster,
324     wp_skullrod,
325     wp_phoenixrod,
326     wp_mace,
327     wp_gauntlets,
328     wp_beak,
329     NUMWEAPONS,
330     wp_nochange
331 } weapontype_t;
332 
333 #define AMMO_GWND_WIMPY 10
334 #define AMMO_GWND_HEFTY 50
335 #define AMMO_CBOW_WIMPY 5
336 #define AMMO_CBOW_HEFTY 20
337 #define AMMO_BLSR_WIMPY 10
338 #define AMMO_BLSR_HEFTY 25
339 #define AMMO_SKRD_WIMPY 20
340 #define AMMO_SKRD_HEFTY 100
341 #define AMMO_PHRD_WIMPY 1
342 #define AMMO_PHRD_HEFTY 10
343 #define AMMO_MACE_WIMPY 20
344 #define AMMO_MACE_HEFTY 100
345 
346 typedef enum
347 {
348     am_goldwand,
349     am_crossbow,
350     am_blaster,
351     am_skullrod,
352     am_phoenixrod,
353     am_mace,
354     NUMAMMO,
355     am_noammo                   // staff, gauntlets
356 } ammotype_t;
357 
358 typedef struct
359 {
360     ammotype_t ammo;
361     int upstate;
362     int downstate;
363     int readystate;
364     int atkstate;
365     int holdatkstate;
366     int flashstate;
367 } weaponinfo_t;
368 
369 extern weaponinfo_t wpnlev1info[NUMWEAPONS];
370 extern weaponinfo_t wpnlev2info[NUMWEAPONS];
371 
372 typedef enum
373 {
374     arti_none,
375     arti_invulnerability,
376     arti_invisibility,
377     arti_health,
378     arti_superhealth,
379     arti_tomeofpower,
380     arti_torch,
381     arti_firebomb,
382     arti_egg,
383     arti_fly,
384     arti_teleport,
385     NUMARTIFACTS
386 } artitype_t;
387 
388 typedef enum
389 {
390     pw_None,
391     pw_invulnerability,
392     pw_invisibility,
393     pw_allmap,
394     pw_infrared,
395     pw_weaponlevel2,
396     pw_flight,
397     pw_shield,
398     pw_health2,
399     NUMPOWERS
400 } powertype_t;
401 
402 #define	INVULNTICS (30*35)
403 #define	INVISTICS (60*35)
404 #define	INFRATICS (120*35)
405 #define	IRONTICS (60*35)
406 #define WPNLEV2TICS (40*35)
407 #define FLIGHTTICS (60*35)
408 
409 #define CHICKENTICS (40*35)
410 
411 #define MESSAGETICS (4*35)
412 #define BLINKTHRESHOLD (4*32)
413 
414 #define NUMINVENTORYSLOTS	14
415 typedef struct
416 {
417     int type;
418     int count;
419 } inventory_t;
420 
421 /*
422 ================
423 =
424 = player_t
425 =
426 ================
427 */
428 
429 typedef struct player_s
430 {
431     mobj_t *mo;
432     playerstate_t playerstate;
433     ticcmd_t cmd;
434 
435     fixed_t viewz;              // focal origin above r.z
436     fixed_t viewheight;         // base height above floor for viewz
437     fixed_t deltaviewheight;    // squat speed
438     fixed_t bob;                // bounded/scaled total momentum
439 
440     int flyheight;
441     int lookdir;
442     boolean centering;
443     int health;                 // only used between levels, mo->health
444     // is used during levels
445     int armorpoints, armortype; // armor type is 0-2
446 
447     inventory_t inventory[NUMINVENTORYSLOTS];
448     artitype_t readyArtifact;
449     int artifactCount;
450     int inventorySlotNum;
451     int powers[NUMPOWERS];
452     boolean keys[NUMKEYS];
453     boolean backpack;
454     signed int frags[MAXPLAYERS];       // kills of other players
455     weapontype_t readyweapon;
456     weapontype_t pendingweapon; // wp_nochange if not changing
457     boolean weaponowned[NUMWEAPONS];
458     int ammo[NUMAMMO];
459     int maxammo[NUMAMMO];
460     int attackdown, usedown;    // true if button down last tic
461     int cheats;                 // bit flags
462 
463     int refire;                 // refired shots are less accurate
464 
465     int killcount, itemcount, secretcount;      // for intermission
466     const char *message;        // hint messages
467     int messageTics;            // counter for showing messages
468     int damagecount, bonuscount;        // for screen flashing
469     int flamecount;             // for flame thrower duration
470     mobj_t *attacker;           // who did damage (NULL for floors)
471     int extralight;             // so gun flashes light up areas
472     int fixedcolormap;          // can be set to REDCOLORMAP, etc
473     int colormap;               // 0-3 for which color to draw player
474     pspdef_t psprites[NUMPSPRITES];     // view sprites (gun, etc)
475     boolean didsecret;          // true if secret level has been done
476     int chickenTics;            // player is a chicken if > 0
477     int chickenPeck;            // chicken peck countdown
478     mobj_t *rain1;              // active rain maker 1
479     mobj_t *rain2;              // active rain maker 2
480 
481     // [crispy] show centered "Secret Revealed!" message
482     const char *centerMessage;
483     int centerMessageTics;            // counter for showing centered messages
484 
485     // [AM] Previous position of viewz before think.
486     //      Used to interpolate between camera positions.
487     angle_t		oldviewz;
488 } player_t;
489 
490 #define CF_NOCLIP		1
491 #define	CF_GODMODE		2
492 #define	CF_NOMOMENTUM	4       // not really a cheat, just a debug aid
493 #define CF_SHOWFPS      8       // [crispy] "Cheat" to show FPS
494 #define CF_NOTARGET     16      // [crispy] toggle notarget mode: monsters don't target player
495 
496 #define	SBARHEIGHT	(42 << crispy->hires)      // status bar height at bottom of screen
497 
498 
499 /*
500 ===============================================================================
501 
502 					GLOBAL VARIABLES
503 
504 ===============================================================================
505 */
506 
507 #define TELEFOGHEIGHT (32*FRACUNIT)
508 
509 extern gameaction_t gameaction;
510 
511 extern boolean paused;
512 
513 extern GameMode_t gamemode;
514 
515 extern boolean ExtendedWAD;     // true if main WAD is the extended version
516 
517 extern boolean nomonsters;      // checkparm of -nomonsters
518 
519 extern boolean respawnparm;     // checkparm of -respawn
520 
521 extern boolean debugmode;       // checkparm of -debug
522 
523 extern boolean usergame;        // ok to save / end game
524 
525 extern boolean ravpic;          // checkparm of -ravpic
526 
527 extern boolean altpal;          // checkparm to use an alternate palette routine
528 
529 extern boolean cdrom;           // true if cd-rom mode active ("-cdrom")
530 
531 extern boolean deathmatch;      // only if started as net death
532 
533 extern boolean netgame;         // only true if >1 player
534 
535 extern boolean playeringame[MAXPLAYERS];
536 
537 extern int consoleplayer;       // player taking events and displaying
538 
539 extern int displayplayer;
540 
541 extern int viewangleoffset;     // ANG90 = left side, ANG270 = right
542 
543 extern player_t players[MAXPLAYERS];
544 
545 extern boolean DebugSound;      // debug flag for displaying sound info
546 
547 extern int GetWeaponAmmo[NUMWEAPONS];
548 
549 extern boolean demorecording;
550 extern boolean demoplayback;
551 extern boolean demoextend;      // allow demos to persist through exit/respawn
552 extern int skytexture;
553 
554 // Truncate angleturn in ticcmds to nearest 256.
555 // Used when recording Vanilla demos in netgames.
556 extern boolean lowres_turn;
557 
558 extern gamestate_t gamestate;
559 extern skill_t gameskill;
560 extern boolean respawnmonsters;
561 extern int gameepisode;
562 extern int gamemap;
563 extern int prevmap;
564 extern int totalkills, totalitems, totalsecret; // for intermission
565 extern int levelstarttic;       // gametic at level start
566 extern int leveltime;           // tics in game play for par
567 extern int totalleveltimes; // [crispy] total time for all completed levels
568 
569 extern boolean finalintermission; // [crispy] track intermission at end of episode
570 
571 extern ticcmd_t *netcmds;
572 
573 #define SAVEGAMESIZE 0x30000*16
574 #define SAVESTRINGSIZE 24
575 
576 extern mapthing_t *deathmatch_p;
577 extern mapthing_t deathmatchstarts[10];
578 extern mapthing_t playerstarts[MAXPLAYERS];
579 extern boolean playerstartsingame[MAXPLAYERS];
580 
581 extern int mouseSensitivity;
582 extern int mouseSensitivity_x2;
583 extern int mouseSensitivity_y;
584 
585 extern boolean precache;        // if true, load all graphics at level load
586 
587 extern boolean singledemo;      // quit after playing a demo from cmdline
588 
589 extern int bodyqueslot;
590 extern skill_t startskill;
591 extern int startepisode;
592 extern int startmap;
593 extern boolean autostart;
594 
595 extern  boolean nodrawers; // [crispy] for the demowarp feature
596 
597 extern boolean testcontrols;
598 extern int testcontrols_mousespeed;
599 
600 extern int vanilla_savegame_limit;
601 extern int vanilla_demo_limit;
602 
603 /*
604 ===============================================================================
605 
606 					GLOBAL FUNCTIONS
607 
608 ===============================================================================
609 */
610 
611 #include "z_zone.h"
612 
613 //----------
614 //BASE LEVEL
615 //----------
616 void D_DoomMain(void);
617 void IncThermo(void);
618 void InitThermo(int max);
619 void tprintf(const char *string, int initflag);
620 // not a globally visible function, just included for source reference
621 // calls all startup code
622 // parses command line options
623 // if not overrided, calls N_AdvanceDemo
624 
625 void D_DoomLoop(void);
626 // not a globally visible function, just included for source reference
627 // called by D_DoomMain, never exits
628 // manages timing and IO
629 // calls all ?_Responder, ?_Ticker, and ?_Drawer functions
630 // calls I_GetTime, I_StartFrame, and I_StartTic
631 
632 //---------
633 //SYSTEM IO
634 //---------
635 byte *I_AllocLow(int length);
636 // allocates from low memory under dos, just mallocs under unix
637 
638 // haleyjd: was WATCOMC, preserved for historical interest.
639 // This is similar to the -control structure in DOOM v1.4 and Strife.
640 #if 0
641 extern boolean useexterndriver;
642 
643 #define EBT_FIRE			1
644 #define EBT_OPENDOOR 		2
645 #define EBT_SPEED			4
646 #define EBT_STRAFE			8
647 #define EBT_MAP				0x10
648 #define EBT_INVENTORYLEFT 	0x20
649 #define EBT_INVENTORYRIGHT 	0x40
650 #define EBT_USEARTIFACT		0x80
651 #define EBT_FLYDROP			0x100
652 #define EBT_CENTERVIEW		0x200
653 #define EBT_PAUSE			0x400
654 #define EBT_WEAPONCYCLE 	0x800
655 
656 typedef struct
657 {
658     short vector;               // Interrupt vector
659 
660     signed char moveForward;    // forward/backward (maxes at 50)
661     signed char moveSideways;   // strafe (maxes at 24)
662     short angleTurn;            // turning speed (640 [slow] 1280 [fast])
663     short angleHead;            // head angle (+2080 [left] : 0 [center] : -2048 [right])
664     signed char pitch;          // look up/down (-110 : +90)
665     signed char flyDirection;   // flyheight (+1/-1)
666     unsigned short buttons;     // EBT_* flags
667 } externdata_t;
668 #endif
669 
670 //----
671 //GAME
672 //----
673 
674 void G_DeathMatchSpawnPlayer(int playernum);
675 
676 void G_InitNew(skill_t skill, int episode, int map);
677 
678 void G_DeferedInitNew(skill_t skill, int episode, int map);
679 // can be called by the startup code or M_Responder
680 // a normal game starts at map 1, but a warp test can start elsewhere
681 
682 void G_DeferedPlayDemo(const char *demo);
683 
684 void G_LoadGame(char *name);
685 // can be called by the startup code or M_Responder
686 // calls P_SetupLevel or W_EnterWorld
687 void G_DoLoadGame(void);
688 
689 void G_SaveGame(int slot, char *description);
690 // called by M_Responder
691 
692 #define SAVE_GAME_TERMINATOR 0x1d
693 // Support routines for saving games
694 char *SV_Filename(int slot);
695 void SV_Open(char *fileName);
696 void SV_OpenRead(char *fileName);
697 void SV_Close(char *fileName);
698 void SV_Write(void *buffer, int size);
699 void SV_WriteByte(byte val);
700 void SV_WriteWord(unsigned short val);
701 void SV_WriteLong(unsigned int val);
702 void SV_Read(void *buffer, int size);
703 byte SV_ReadByte(void);
704 uint16_t SV_ReadWord(void);
705 uint32_t SV_ReadLong(void);
706 
707 extern char *savegamedir;
708 
709 void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
710                   const char *name);
711 // only called by startup code
712 
713 void G_PlayDemo(char *name);
714 void G_TimeDemo(char *name);
715 
716 void G_ExitLevel(void);
717 void G_SecretExitLevel(void);
718 
719 void G_WorldDone(void);
720 
721 void G_Ticker(void);
722 boolean G_Responder(event_t * ev);
723 
724 void G_ScreenShot(void);
725 
726 //-----
727 //PLAY
728 //-----
729 
730 void P_Ticker(void);
731 // called by C_Ticker
732 // can call G_PlayerExited
733 // carries out all thinking of monsters and players
734 
735 void P_SetupLevel(int episode, int map, int playermask, skill_t skill);
736 // called by W_Ticker
737 
738 void P_Init(void);
739 // called by startup code
740 
741 void P_ArchivePlayers(void);
742 void P_UnArchivePlayers(void);
743 void P_ArchiveWorld(void);
744 void P_UnArchiveWorld(void);
745 void P_ArchiveThinkers(void);
746 void P_UnArchiveThinkers(void);
747 void P_ArchiveSpecials(void);
748 void P_UnArchiveSpecials(void);
749 // load / save game routines
750 
751 
752 //-------
753 //REFRESH
754 //-------
755 
756 extern boolean setsizeneeded;
757 
758 extern boolean BorderNeedRefresh;
759 extern boolean BorderTopRefresh;
760 
761 extern int UpdateState;
762 // define the different areas for the dirty map
763 #define I_NOUPDATE	0
764 #define I_FULLVIEW	1
765 #define I_STATBAR	2
766 #define I_MESSAGES	4
767 #define I_FULLSCRN	8
768 
769 void R_RenderPlayerView(player_t * player);
770 // called by G_Drawer
771 
772 void R_Init(void);
773 // called by startup code
774 
775 void R_DrawViewBorder(void);
776 void R_DrawTopBorder(void);
777 // if the view size is not full screen, draws a border around it
778 
779 void R_SetViewSize(int blocks, int detail);
780 // called by M_Responder
781 
782 int R_FlatNumForName(const char *name);
783 
784 int R_TextureNumForName(const char *name);
785 int R_CheckTextureNumForName(const char *name);
786 // called by P_Ticker for switches and animations
787 // returns the texture number for the texture name
788 
789 
790 //----
791 //MISC
792 //----
793 // returns the position of the given parameter in the arg list (0 if not found)
794 
795 int M_DrawText(int x, int y, boolean direct, char *string);
796 
797 //----------------------
798 // Interlude (IN_lude.c)
799 //----------------------
800 
801 extern boolean intermission;
802 
803 void IN_Start(void);
804 void IN_Ticker(void);
805 void IN_Drawer(void);
806 
807 //----------------------
808 // Chat mode (CT_chat.c)
809 //----------------------
810 
811 void CT_Init(void);
812 void CT_Drawer(void);
813 boolean CT_Responder(event_t * ev);
814 void CT_Ticker(void);
815 char CT_dequeueChatChar(void);
816 
817 extern boolean chatmodeon;
818 extern boolean ultimatemsg;
819 
820 //--------------------
821 // Finale (F_finale.c)
822 //--------------------
823 
824 void F_Drawer(void);
825 void F_Ticker(void);
826 void F_StartFinale(void);
827 
828 //----------------------
829 // STATUS BAR (SB_bar.c)
830 //----------------------
831 
832 void SB_Init(void);
833 boolean SB_Responder(event_t * event);
834 void SB_Ticker(void);
835 void SB_Drawer(void);
836 
837 //-----------------
838 // MENU (MN_menu.c)
839 //-----------------
840 
841 extern boolean MenuActive;
842 
843 void MN_Init(void);
844 void MN_ActivateMenu(void);
845 void MN_DeactivateMenu(void);
846 boolean MN_Responder(event_t * event);
847 void MN_Ticker(void);
848 void MN_Drawer(void);
849 void MN_DrTextA(const char *text, int x, int y);
850 int MN_TextAWidth(const char *text);
851 void MN_DrTextB(const char *text, int x, int y);
852 int MN_TextBWidth(const char *text);
853 
854 #include "sounds.h"
855 
856 #endif // __DOOMDEF__
857