10 #define strcasecmp strcmpi
11 #define strncasecmp strnicmp
19 #define VERSION_TEXT "v1.3"
20 #define HHERETIC_VERSION "0.1"
22 // if rangecheck is undefined, most parameter validation debugging code
23 // will not be compiled
26 // all external data is defined here
29 // all important printed strings
32 // header generated by multigen utility
35 extern byte *destview, *destscreen; // PC direct to screen pointers
38 // most key data are simple ascii (uppercased)
40 #define KEY_RIGHTARROW 0xae
41 #define KEY_LEFTARROW 0xac
42 #define KEY_UPARROW 0xad
43 #define KEY_DOWNARROW 0xaf
46 #define KEY_F1 (0x80+0x3b)
47 #define KEY_F2 (0x80+0x3c)
48 #define KEY_F3 (0x80+0x3d)
49 #define KEY_F4 (0x80+0x3e)
50 #define KEY_F5 (0x80+0x3f)
51 #define KEY_F6 (0x80+0x40)
52 #define KEY_F7 (0x80+0x41)
53 #define KEY_F8 (0x80+0x42)
54 #define KEY_F9 (0x80+0x43)
55 #define KEY_F10 (0x80+0x44)
56 #define KEY_F11 (0x80+0x57)
57 #define KEY_F12 (0x80+0x58)
59 #define KEY_BACKSPACE 127
60 #define KEY_PAUSE 0xff
62 #define KEY_EQUALS 0x3d
63 #define KEY_MINUS 0x2d
65 #define KEY_RSHIFT (0x80+0x36)
66 #define KEY_RCTRL (0x80+0x1d)
67 #define KEY_RALT (0x80+0x38)
69 #define KEY_LALT KEY_RALT
73 #define MAXCHAR ((char)0x7f)
74 #define MAXSHORT ((short)0x7fff)
75 #define MAXINT ((int)0x7fffffff) /* max pos 32-bit int */
76 #define MAXLONG ((long)0x7fffffff)
78 #define MINCHAR ((char)0x80)
79 #define MINSHORT ((short)0x8000)
80 #define MININT ((int)0x80000000) /* max negative 32-bit integer */
81 #define MINLONG ((long)0x80000000)
83 #define FINEANGLES 8192
84 #define FINEMASK (FINEANGLES-1)
85 #define ANGLETOFINESHIFT 19 // 0x100000000 to 0x2000
87 #define SAVEGAMENAME "hticsav"
88 #define SAVEGAMENAMECD "c:\\heretic.cd\\hticsav"
91 ===============================================================================
95 ===============================================================================
98 #define NUMARTIFCTS 28
100 #define TICRATE 35 // number of tics / second
101 #define TICSPERSEC 35
104 #define FRACUNIT (1<<FRACBITS)
107 #define ANGLE_1 0x01000000
108 #define ANGLE_45 0x20000000
109 #define ANGLE_90 0x40000000
110 #define ANGLE_180 0x80000000
111 #define ANGLE_MAX 0xffffffff
113 #define ANG45 0x20000000
114 #define ANG90 0x40000000
115 #define ANG180 0x80000000
116 #define ANG270 0xc0000000
118 typedef unsigned angle_t;
140 int data1; // keys / mouse/joystick buttons
141 int data2; // mouse/joystick x move
142 int data3; // mouse/joystick y move
147 char forwardmove; // *2048 for move
148 char sidemove; // *2048 for move
149 short angleturn; // <<16 for angle delta
150 short consistancy; // checks for net game
153 byte lookfly; // look/fly up/down/centering
154 byte arti; // artitype_t to use
159 #define BT_CHANGE 4 // if true, the next 3 bits hold weapon num
160 #define BT_WEAPONMASK (8+16+32)
161 #define BT_WEAPONSHIFT 3
163 #define BT_SPECIAL 128 // game events, not really buttons
164 #define BTS_SAVEMASK (4+8+16)
165 #define BTS_SAVESHIFT 2
166 #define BT_SPECIALMASK 3
167 #define BTS_PAUSE 1 // pause the game
168 #define BTS_SAVEGAME 2 // save the game at each console
169 // savegame slot numbers occupy the second byte of buttons
205 ===============================================================================
209 ===============================================================================
212 // think_t is a function pointer to a routine to handle an actor
213 typedef void (*think_t) ();
215 typedef struct thinker_s
217 struct thinker_s *prev, *next;
223 typedef struct mobj_s
225 thinker_t thinker; // thinker links
229 struct mobj_s *snext, *sprev; // links in sector (if needed)
231 spritenum_t sprite; // used to find patch_t and flip value
232 int frame; // might be ord with FF_FULLBRIGHT
235 struct mobj_s *bnext, *bprev; // links in blocks (if needed)
236 struct subsector_s *subsector;
237 fixed_t floorz, ceilingz; // closest together of contacted secs
238 fixed_t radius, height; // for movement checking
239 fixed_t momx, momy, momz; // momentums
241 int validcount; // if == validcount, already checked
244 mobjinfo_t *info; // &mobjinfo[mobj->type]
245 int tics; // state tic counter
247 int damage; // For missiles
249 int flags2; // Heretic flags
250 intptr_t special1; // Special info
251 intptr_t special2; // Special info
254 int movecount; // when 0, select a new dir
255 struct mobj_s *target; // thing being chased/attacked (or NULL)
256 // also the originator for missiles
257 int reactiontime; // if non 0, don't attack yet
258 // used by player to freeze a bit after
260 int threshold; // if >0, the target will be chased
261 // no matter what (even if shot)
262 struct player_s *player; // only valid if type == MT_PLAYER
263 int lastlook; // player number last looked for
265 mapthing_t spawnpoint; // for nightmare respawn
268 // each sector has a degenmobj_t in it's center for sound origin purposes
271 thinker_t thinker; // not used for anything
275 // Most damage defined using HITDICE
276 #define HITDICE(a) ((1+(P_Random()&7))*a)
281 #define FF_FULLBRIGHT 0x8000 // flag in thing->frame
282 #define FF_FRAMEMASK 0x7fff
284 // --- mobj.flags ---
286 #define MF_SPECIAL 1 // call P_SpecialThing when touched
288 #define MF_SHOOTABLE 4
289 #define MF_NOSECTOR 8 // don't use the sector links
290 // (invisible but touchable)
291 #define MF_NOBLOCKMAP 16 // don't use the blocklinks
292 // (inert but displayable)
294 #define MF_JUSTHIT 64 // try to attack right back
295 #define MF_JUSTATTACKED 128 // take at least one step before attacking
296 #define MF_SPAWNCEILING 256 // hang from ceiling instead of floor
297 #define MF_NOGRAVITY 512 // don't apply gravity every tic
300 #define MF_DROPOFF 0x400 // allow jumps from high places
301 #define MF_PICKUP 0x800 // for players to pick up items
302 #define MF_NOCLIP 0x1000 // player cheat
303 #define MF_SLIDE 0x2000 // keep info about sliding along walls
304 #define MF_FLOAT 0x4000 // allow moves to any height, no gravity
305 #define MF_TELEPORT 0x8000 // don't cross lines or look at heights
306 #define MF_MISSILE 0x10000 // don't hit same species, explode on block
308 #define MF_DROPPED 0x20000 // dropped by a demon, not level spawned
309 #define MF_SHADOW 0x40000 // use fuzzy draw (shadow demons / invis)
310 #define MF_NOBLOOD 0x80000 // don't bleed when shot (use puff)
311 #define MF_CORPSE 0x100000 // don't stop moving halfway off a step
312 #define MF_INFLOAT 0x200000 // floating to a height for a move, don't
313 // auto float to target's height
315 #define MF_COUNTKILL 0x400000 // count towards intermission kill total
316 #define MF_COUNTITEM 0x800000 // count towards intermission item total
318 #define MF_SKULLFLY 0x1000000 // skull in flight
319 #define MF_NOTDMATCH 0x2000000 // don't spawn in death match (key cards)
321 #define MF_TRANSLATION 0xc000000 // if 0x4 0x8 or 0xc, use a translation
322 #define MF_TRANSSHIFT 26 // table for player colormaps
324 // --- mobj.flags2 ---
326 #define MF2_LOGRAV 0x00000001 // alternate gravity setting
327 #define MF2_WINDTHRUST 0x00000002 // gets pushed around by the wind
329 #define MF2_FLOORBOUNCE 0x00000004 // bounces off the floor
330 #define MF2_THRUGHOST 0x00000008 // missile will pass through ghosts
331 #define MF2_FLY 0x00000010 // fly mode is active
332 #define MF2_FOOTCLIP 0x00000020 // if feet are allowed to be clipped
333 #define MF2_SPAWNFLOAT 0x00000040 // spawn random float z
334 #define MF2_NOTELEPORT 0x00000080 // does not teleport
335 #define MF2_RIP 0x00000100 // missile rips through solid
337 #define MF2_PUSHABLE 0x00000200 // can be pushed by other moving
339 #define MF2_SLIDE 0x00000400 // slides against walls
340 #define MF2_ONMOBJ 0x00000800 // mobj is resting on top of another
342 #define MF2_PASSMOBJ 0x00001000 // Enable z block checking. If on,
343 // this flag will allow the mobj to
344 // pass over/under other mobjs.
345 #define MF2_CANNOTPUSH 0x00002000 // cannot push other pushable mobjs
346 #define MF2_FEETARECLIPPED 0x00004000 // a mobj's feet are now being cut
347 #define MF2_BOSS 0x00008000 // mobj is a major boss
348 #define MF2_FIREDAMAGE 0x00010000 // does fire damage
349 #define MF2_NODMGTHRUST 0x00020000 // does not thrust target when
351 #define MF2_TELESTOMP 0x00040000 // mobj can stomp another
352 #define MF2_FLOATBOB 0x00080000 // use float bobbing z movement
353 #define MF2_DONTDRAW 0X00100000 // don't generate a vissprite
355 //=============================================================================
359 PST_DEAD, // dead on the ground
360 PST_REBORN // ready to restart
363 // psprites are scaled shapes directly on the view screen
364 // coordinates are given for a 320*200 view screen
374 state_t *state; // a NULL state means not active
402 #define AMMO_GWND_WIMPY 10
403 #define AMMO_GWND_HEFTY 50
404 #define AMMO_CBOW_WIMPY 5
405 #define AMMO_CBOW_HEFTY 20
406 #define AMMO_BLSR_WIMPY 10
407 #define AMMO_BLSR_HEFTY 25
408 #define AMMO_SKRD_WIMPY 20
409 #define AMMO_SKRD_HEFTY 100
410 #define AMMO_PHRD_WIMPY 1
411 #define AMMO_PHRD_HEFTY 10
412 #define AMMO_MACE_WIMPY 20
413 #define AMMO_MACE_HEFTY 100
424 am_noammo // staff, gauntlets
438 extern weaponinfo_t wpnlev1info[NUMWEAPONS];
439 extern weaponinfo_t wpnlev2info[NUMWEAPONS];
444 arti_invulnerability,
471 #define INVULNTICS (30*35)
472 #define INVISTICS (60*35)
473 #define INFRATICS (120*35)
474 #define IRONTICS (60*35)
475 #define WPNLEV2TICS (40*35)
476 #define FLIGHTTICS (60*35)
478 #define CHICKENTICS (40*35)
480 #define MESSAGETICS (4*35)
481 #define BLINKTHRESHOLD (4*32)
483 #define NUMINVENTORYSLOTS 14
498 typedef struct player_s
501 playerstate_t playerstate;
504 fixed_t viewz; // focal origin above r.z
505 fixed_t viewheight; // base height above floor for viewz
506 fixed_t deltaviewheight; // squat speed
507 fixed_t bob; // bounded/scaled total momentum
512 int health; // only used between levels, mo->health
513 // is used during levels
514 int armorpoints, armortype; // armor type is 0-2
516 inventory_t inventory[NUMINVENTORYSLOTS];
517 artitype_t readyArtifact;
519 int inventorySlotNum;
520 int powers[NUMPOWERS];
521 boolean keys[NUMKEYS];
523 signed int frags[MAXPLAYERS]; // kills of other players
524 weapontype_t readyweapon;
525 weapontype_t pendingweapon; // wp_nochange if not changing
526 boolean weaponowned[NUMWEAPONS];
528 int maxammo[NUMAMMO];
529 int attackdown, usedown; // true if button down last tic
530 int cheats; // bit flags
532 int refire; // refired shots are less accurate
534 int killcount, itemcount, secretcount; // for intermission
535 char *message; // hint messages
536 int messageTics; // counter for showing messages
537 int damagecount, bonuscount;// for screen flashing
538 int flamecount; // for flame thrower duration
539 mobj_t *attacker; // who did damage (NULL for floors)
540 int extralight; // so gun flashes light up areas
541 int fixedcolormap; // can be set to REDCOLORMAP, etc
542 int colormap; // 0-3 for which color to draw player
543 pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc)
544 boolean didsecret; // true if secret level has been done
545 int chickenTics; // player is a chicken if > 0
546 int chickenPeck; // chicken peck countdown
547 mobj_t *rain1; // active rain maker 1
548 mobj_t *rain2; // active rain maker 2
553 #define CF_NOMOMENTUM 4 // not really a cheat, just a debug aid
556 #define BACKUPTICS 12 // CHANGED FROM 12 !?!?
560 unsigned checksum; // high bit is retransmit request
561 byte retransmitfrom; // only valid if NCMD_RETRANSMIT
563 byte player, numtics;
564 ticcmd_t cmds[BACKUPTICS];
570 short intnum; // DOOM executes an int to execute commands
572 // communication between DOOM and the driver
573 short command; // CMD_SEND or CMD_GET
574 short remotenode; // dest for send, set by get (-1 = no packet)
575 short datalength; // bytes in doomdata to be sent
577 // info common to all nodes
578 short numnodes; // console is allways node 0
579 short ticdup; // 1 = no duplication, 2-5 = dup for slow nets
580 short extratics; // 1 = send a backup tic in every packet
581 short deathmatch; // 1 = deathmatch
582 short savegame; // -1 = new game, 0-5 = load savegame
583 short episode; // 1-3
587 // info specific to this node
590 short angleoffset; // 1 = left, 0 = center, -1 = right
591 short drone; // 1 = drone
593 // packet data to be sent
597 #define DOOMCOM_ID 0x12345678l
599 extern doomcom_t *doomcom;
600 extern doomdata_t *netbuffer; // points inside doomcom
602 #define MAXNETNODES 8 // max computers in a game
607 #define SBARHEIGHT 42 // status bar height at bottom of screen
611 ===============================================================================
615 ===============================================================================
618 #define TELEFOGHEIGHT (32*FRACUNIT)
622 extern event_t events[MAXEVENTS];
623 extern int eventhead;
624 extern int eventtail;
626 extern fixed_t finesine[5*FINEANGLES/4];
627 extern fixed_t *finecosine;
629 extern gameaction_t gameaction;
631 extern boolean paused;
633 extern boolean shareware; // true if main WAD is the shareware version
634 extern boolean ExtendedWAD; // true if main WAD is the extended version
636 extern boolean nomonsters; // checkparm of -nomonsters
638 extern boolean respawnparm; // checkparm of -respawn
640 extern boolean debugmode; // checkparm of -debug
642 extern boolean usergame; // ok to save / end game
644 extern boolean ravpic; // checkparm of -ravpic
646 extern boolean altpal; // checkparm to use an alternate palette routine
648 extern boolean cdrom; // true if cd-rom mode active ("-cdrom")
650 extern boolean deathmatch; // only if started as net death
652 extern boolean netgame; // only true if >1 player
654 extern boolean playeringame[MAXPLAYERS];
656 extern int consoleplayer; // player taking events and displaying
658 extern int displayplayer;
660 extern int viewangleoffset; // ANG90 = left side, ANG270 = right
662 extern player_t players[MAXPLAYERS];
664 extern boolean singletics; // debug flag to cancel adaptiveness
666 extern boolean DebugSound; // debug flag for displaying sound info
668 extern int maxammo[NUMAMMO];
670 extern boolean demoplayback;
671 extern int skytexture;
673 extern gamestate_t gamestate;
674 extern skill_t gameskill;
675 extern boolean respawnmonsters;
676 extern int gameepisode;
679 extern int totalkills, totalitems, totalsecret; // for intermission
680 extern int levelstarttic; // gametic at level start
681 extern int leveltime; // tics in game play for par
683 extern ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
686 #define MAXNETNODES 8
687 extern ticcmd_t localcmds[BACKUPTICS];
689 extern int gametic, maketic;
690 extern int nettics[MAXNETNODES];
692 #define SAVEGAMESIZE 0x30000
693 #define SAVESTRINGSIZE 24
694 extern byte *savebuffer;
697 extern mapthing_t *deathmatch_p;
698 extern mapthing_t deathmatchstarts[10];
699 extern mapthing_t playerstarts[MAXPLAYERS];
701 extern int viewwindowx;
702 extern int viewwindowy;
703 extern int viewwidth;
704 extern int scaledviewwidth;
705 extern int viewheight;
707 extern int mouseSensitivity;
709 extern boolean precache; // if true, load all graphics at level load
711 extern byte *screen; // off screen work buffer, from V_video.c
713 extern boolean singledemo; // quit after playing a demo from cmdline
715 extern FILE *debugfile;
716 extern int bodyqueslot;
717 extern skill_t startskill;
718 extern int startepisode;
720 extern boolean autostart;
723 ===============================================================================
727 ===============================================================================
731 fixed_t FixedMul (fixed_t a, fixed_t b);
732 fixed_t FixedDiv (fixed_t a, fixed_t b);
733 fixed_t FixedDiv2 (fixed_t a, fixed_t b);
736 #pragma aux FixedMul = \
741 modify exact [eax edx]
743 #pragma aux FixedDiv2 = \
750 modify exact [eax edx]
753 #ifdef __BIG_ENDIAN__
754 short ShortSwap(short);
756 #define SHORT(x) ShortSwap(x)
757 #define LONG(x) LongSwap(x)
767 // tags < 100 are not overwritten until freed
768 #define PU_STATIC 1 // static entire execution time
769 #define PU_SOUND 2 // static while playing
770 #define PU_MUSIC 3 // static while playing
771 #define PU_DAVE 4 // anything else Dave wants static
772 #define PU_LEVEL 50 // static until level exited
773 #define PU_LEVSPEC 51 // a special thinker in a level
774 // tags >= 100 are purgable whenever needed
775 #define PU_PURGELEVEL 100
779 void *Z_Malloc (int size, int tag, void *ptr);
780 void Z_Free (void *ptr);
781 void Z_FreeTags (int lowtag, int hightag);
782 void Z_DumpHeap (int lowtag, int hightag);
783 void Z_FileDumpHeap (FILE *f);
784 void Z_CheckHeap (void);
785 void Z_ChangeTag2 (void *ptr, int tag);
786 int Z_FreeMemory (void);
787 void Z_Shutdown (void);
789 extern boolean MallocFailureOk;
791 typedef struct memblock_s
793 int size; // including the header and possibly tiny fragments
794 void **user; // NULL if a free block
795 int tag; // purgelevel
796 int id; // should be ZONEID
797 struct memblock_s *next, *prev;
800 #define Z_ChangeTag(p,t) \
802 if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
803 I_Error("Z_CT at "__FILE__":%i",__LINE__); \
813 int handle,position,size;
816 extern lumpinfo_t *lumpinfo;
819 void W_InitMultipleFiles (char **filenames);
821 int W_CheckNumForName (char *name);
822 int W_GetNumForName (char *name);
824 int W_LumpLength (int lump);
825 void W_ReadLump (int lump, void *dest);
827 void *W_CacheLumpNum (int lump, int tag);
828 void *W_CacheLumpName (char *name, int tag);
829 void W_Shutdown (void);
836 void D_DoomMain (void);
837 void IncThermo(void);
838 void InitThermo(int max);
839 void tprintf(char *string, int initflag);
840 // not a globally visible function, just included for source reference
841 // calls all startup code
842 // parses command line options
843 // if not overrided, calls N_AdvanceDemo
845 void D_DoomLoop (void);
846 // not a globally visible function, just included for source reference
847 // called by D_DoomMain, never exits
848 // manages timing and IO
849 // calls all ?_Responder, ?_Ticker, and ?_Drawer functions
850 // calls I_GetTime, I_StartFrame, and I_StartTic
852 void D_PostEvent (event_t *ev);
853 // called by IO functions when input is detected
855 void NetUpdate (void);
856 // create any new ticcmds and broadcast to other players
858 void D_QuitNetGame (void);
859 // broadcasts special packets to other players to notify of game exit
861 void TryRunTics (void);
867 #define SCREENWIDTH 320
868 #define SCREENHEIGHT 200
870 #define SCREENWIDTH 560
871 #define SCREENHEIGHT 375
874 byte *I_ZoneBase (int *size);
875 // called by startup code to get the ammount of memory to malloc
876 // for the zone management
878 int I_GetTime (void);
879 // called by D_DoomLoop
880 // returns current time in tics
882 void I_StartFrame (void);
883 // called by D_DoomLoop
884 // called before processing any tics in a frame (just after displaying a frame)
885 // time consuming syncronous operations are performed here (joystick reading)
886 // can call D_PostEvent
888 void I_StartTic (void);
889 // called by D_DoomLoop
890 // called before processing each tic in a frame
891 // quick syncronous operations are performed here
892 // can call D_PostEvent
894 // asyncronous interrupt functions should maintain private ques that are
895 // read by the syncronous functions to be converted into events
898 // called by D_DoomMain
899 // determines the hardware configuration and sets up the video mode
901 void I_InitGraphics (void);
903 void I_InitNetwork (void);
904 void I_NetCmd (void);
906 void I_Error (char *error, ...);
907 // called by anything that can generate a terminal error
908 // bad exit with diagnostic message
911 // called by M_Responder when quit is selected
912 // clean exit, displays sell blurb
914 void I_SetPalette (byte *palette);
915 // takes full 8 bit values
918 // Copy buffer to video
920 void I_WipeUpdate(wipe_t wipe);
921 // Copy buffer to video with wipe effect
923 void I_WaitVBL(int count);
924 // wait for vertical retrace or pause a bit
926 void I_BeginRead (void);
927 void I_EndRead (void);
929 byte *I_AllocLow (int length);
930 // allocates from low memory under dos, just mallocs under unix
932 void I_Tactile (int on, int off, int total);
934 extern boolean useexterndriver;
937 #define EBT_OPENDOOR 2
941 #define EBT_INVENTORYLEFT 0x20
942 #define EBT_INVENTORYRIGHT 0x40
943 #define EBT_USEARTIFACT 0x80
944 #define EBT_FLYDROP 0x100
945 #define EBT_CENTERVIEW 0x200
946 #define EBT_PAUSE 0x400
947 #define EBT_WEAPONCYCLE 0x800
951 short vector; // Interrupt vector
953 signed char moveForward; // forward/backward (maxes at 50)
954 signed char moveSideways; // strafe (maxes at 24)
955 short angleTurn; // turning speed (640 [slow] 1280 [fast])
956 short angleHead; // head angle (+2080 [left] : 0 [center] : -2048 [right])
957 signed char pitch; // look up/down (-110 : +90)
958 signed char flyDirection; // flyheight (+1/-1)
959 unsigned short buttons; // EBT_* flags
966 void G_DeathMatchSpawnPlayer (int playernum);
968 void G_InitNew (skill_t skill, int episode, int map);
970 void G_DeferedInitNew (skill_t skill, int episode, int map);
971 // can be called by the startup code or M_Responder
972 // a normal game starts at map 1, but a warp test can start elsewhere
974 void G_DeferedPlayDemo (char *demo);
976 void G_LoadGame (char *name);
977 // can be called by the startup code or M_Responder
978 // calls P_SetupLevel or W_EnterWorld
979 void G_DoLoadGame (void);
981 void G_SaveGame (int slot, char *description);
982 // called by M_Responder
984 // Support routines for saving games
985 void SV_Open(char *fileName);
986 void SV_Close(char *fileName);
987 void SV_Write(void *buffer, int size);
988 void SV_WriteByte(byte val);
989 void SV_WriteWord(unsigned short val);
990 void SV_WriteLong(unsigned int val);
992 void G_RecordDemo (skill_t skill, int numplayers, int episode
993 , int map, char *name);
994 // only called by startup code
996 void G_PlayDemo (char *name);
997 void G_TimeDemo (char *name);
999 void G_ExitLevel (void);
1000 void G_SecretExitLevel (void);
1002 void G_WorldDone (void);
1004 void G_Ticker (void);
1005 boolean G_Responder (event_t *ev);
1007 void G_ScreenShot (void);
1013 void P_Ticker (void);
1014 // called by C_Ticker
1015 // can call G_PlayerExited
1016 // carries out all thinking of monsters and players
1018 void P_SetupLevel (int episode, int map, int playermask, skill_t skill);
1019 // called by W_Ticker
1022 // called by startup code
1024 void P_ArchivePlayers (void);
1025 void P_UnArchivePlayers (void);
1026 void P_ArchiveWorld (void);
1027 void P_UnArchiveWorld (void);
1028 void P_ArchiveThinkers (void);
1029 void P_UnArchiveThinkers (void);
1030 void P_ArchiveSpecials (void);
1031 void P_UnArchiveSpecials (void);
1032 // load / save game routines
1039 extern boolean setsizeneeded;
1041 extern boolean BorderNeedRefresh;
1042 extern boolean BorderTopRefresh;
1044 extern int UpdateState;
1045 // define the different areas for the dirty map
1046 #define I_NOUPDATE 0
1047 #define I_FULLVIEW 1
1049 #define I_MESSAGES 4
1050 #define I_FULLSCRN 8
1052 void R_RenderPlayerView (player_t *player);
1053 // called by G_Drawer
1056 // called by startup code
1058 void R_DrawViewBorder (void);
1059 void R_DrawTopBorder (void);
1060 // if the view size is not full screen, draws a border around it
1062 void R_SetViewSize (int blocks, int detail);
1063 // called by M_Responder
1065 int R_FlatNumForName (char *name);
1067 int R_TextureNumForName (char *name);
1068 int R_CheckTextureNumForName (char *name);
1069 // called by P_Ticker for switches and animations
1070 // returns the texture number for the texture name
1077 extern char **myargv;
1079 int M_CheckParm (char *check);
1080 // returns the position of the given parameter in the arg list (0 if not found)
1082 boolean M_ValidEpisodeMap(int episode, int map);
1083 // returns true if the episode/map combo is valid for the current
1084 // game configuration
1086 void M_ForceUppercase(char *text);
1087 // Changes a string to uppercase
1089 int M_Random (void);
1090 // returns a number from 0 to 255
1091 int P_Random (void);
1092 // as M_Random, but used only by the play simulation
1094 void M_ClearRandom (void);
1095 // fix randoms for demos
1097 void M_FindResponseFile(void);
1099 void M_ClearBox (fixed_t *box);
1100 void M_AddToBox (fixed_t *box, fixed_t x, fixed_t y);
1101 // bounding box functions
1103 boolean M_WriteFile (char const *name, void *source, int length);
1104 int M_ReadFile (char const *name, byte **buffer);
1106 void M_ScreenShot (void);
1108 void M_LoadDefaults (void);
1110 void M_SaveDefaults (void);
1112 int M_DrawText (int x, int y, boolean direct, char *string);
1114 //----------------------
1115 // Interlude (IN_lude.c)
1116 //----------------------
1118 extern boolean intermission;
1120 void IN_Start(void);
1121 void IN_Ticker(void);
1122 void IN_Drawer(void);
1124 //----------------------
1125 // Chat mode (CT_chat.c)
1126 //----------------------
1129 void CT_Drawer(void);
1130 boolean CT_Responder(event_t *ev);
1131 void CT_Ticker(void);
1132 char CT_dequeueChatChar(void);
1134 extern boolean chatmodeon;
1135 extern boolean ultimatemsg;
1137 //--------------------
1138 // Finale (F_finale.c)
1139 //--------------------
1141 void F_Drawer(void);
1142 void F_Ticker(void);
1143 void F_StartFinale(void);
1145 //----------------------
1146 // STATUS BAR (SB_bar.c)
1147 //----------------------
1149 extern int SB_state;
1151 boolean SB_Responder(event_t *event);
1152 void SB_Ticker(void);
1153 void SB_Drawer(void);
1160 void MN_ActivateMenu(void);
1161 void MN_DeactivateMenu(void);
1162 boolean MN_Responder(event_t *event);
1163 void MN_Ticker(void);
1164 void MN_Drawer(void);
1165 void MN_DrTextA(char *text, int x, int y);
1166 int MN_TextAWidth(char *text);
1167 void MN_DrTextB(char *text, int x, int y);
1168 int MN_TextBWidth(char *text);
1174 extern int dirtybox[4];
1175 extern byte gammatable[5][256];
1176 extern int usegamma;
1178 void V_Init(void); // Allocates buffer screens, call before R_Init
1179 void V_DrawPatch(int x, int y, patch_t *patch);
1180 void V_DrawFuzzPatch(int x, int y, patch_t *patch);
1181 void V_DrawShadowedPatch(int x, int y, patch_t *patch);
1182 void V_DrawRawScreen(byte *raw);
1187 #define FIX2FLT(x) ((float)((x)>>FRACBITS) + (float)((x)&(FRACUNIT-1)) / (float)(FRACUNIT))
1188 #define Q_FIX2FLT(x) ((float)((x)>>FRACBITS))
1191 #endif // __DOOMDEF__