2 //**************************************************************************
4 //** h2def.h : Heretic 2 : Raven Software, Corp.
11 //**************************************************************************
21 #include <sys/types.h>
25 #define VERSION_TEXT "v1.1"
28 #define VERSION_PLATFORM "Linux"
29 #elif defined (__FreeBSD__)
30 #define VERSION_PLATFORM "FreeBSD"
32 #define VERSION_PLATFORM "Windows"
34 #define VERSION_PLATFORM "Unknown"
39 // Uncomment, to enable all timebomb stuff
41 #define TIMEBOMB_YEAR 95 // years since 1900
42 #define TIMEBOMB_STARTDATE 268 // initial date (9/26)
43 #define TIMEBOMB_ENDDATE 301 // end date (10/29)
45 // if rangecheck is undefined, most parameter validation debugging code
46 // will not be compiled
47 #ifndef NORANGECHECKING
55 //#define VERSIONTEXT "ID V1.2"
56 //#define VERSIONTEXT "RETAIL STORE BETA" // 9/26/95
57 //#define VERSIONTEXT "DVL BETA 10 05 95" // Used for GT for testing
58 //#define VERSIONTEXT "DVL BETA 10 07 95" // Just an update for Romero
59 //#define VERSIONTEXT "FINAL 1.0 (10 13 95)" // Just an update for Romero
62 #define VERSIONTEXT "Version 1.3 +R "__DATE__" (BCP)"
64 #define VERSIONTEXT "Version 1.3 "__DATE__" (BCP)"
68 #define VERSIONTEXT "Version 1.3 +R "__DATE__" ("VER_ID")"
70 #define VERSIONTEXT "Version 1.3 "__DATE__" ("VER_ID")"
74 // all exterior data is defined here
77 // all important printed strings
80 // header generated by multigen utility
83 extern byte *destview, *destscreen; // PC direct to screen pointers
86 // most key data are simple ascii (uppercased)
88 #define KEY_RIGHTARROW 0xae
89 #define KEY_LEFTARROW 0xac
90 #define KEY_UPARROW 0xad
91 #define KEY_DOWNARROW 0xaf
94 #define KEY_F1 (0x80+0x3b)
95 #define KEY_F2 (0x80+0x3c)
96 #define KEY_F3 (0x80+0x3d)
97 #define KEY_F4 (0x80+0x3e)
98 #define KEY_F5 (0x80+0x3f)
99 #define KEY_F6 (0x80+0x40)
100 #define KEY_F7 (0x80+0x41)
101 #define KEY_F8 (0x80+0x42)
102 #define KEY_F9 (0x80+0x43)
103 #define KEY_F10 (0x80+0x44)
104 #define KEY_F11 (0x80+0x57)
105 #define KEY_F12 (0x80+0x58)
107 #define KEY_BACKSPACE 127
108 #define KEY_PAUSE 0xff
110 #define KEY_EQUALS 0x3d
111 #define KEY_MINUS 0x2d
113 #define KEY_RSHIFT (0x80+0x36)
114 #define KEY_RCTRL (0x80+0x1d)
115 #define KEY_RALT (0x80+0x38)
117 #define KEY_LALT KEY_RALT
119 #define KEY_FIVE 0x35
121 #define KEY_SEVEN 0x37
122 #define KEY_EIGHT 0x38
123 #define KEY_NINE 0x39
124 #define KEY_ZERO 0x30
125 #define KEY_BACKSLASH 0x5C
128 #define MAXCHAR ((char)0x7f)
129 #define MAXSHORT ((short)0x7fff)
130 #define MAXINT ((int)0x7fffffff) /* max pos 32-bit int */
131 #define MAXLONG ((long)0x7fffffff)
133 #define MINCHAR ((char)0x80)
134 #define MINSHORT ((short)0x8000)
135 #define MININT ((int)0x80000000) /* max negative 32-bit integer */
136 #define MINLONG ((long)0x80000000)
138 #define FINEANGLES 8192
139 #define FINEMASK (FINEANGLES-1)
140 #define ANGLETOFINESHIFT 19 // 0x100000000 to 0x2000
143 ===============================================================================
147 ===============================================================================
150 //#define NUMARTIFCTS 28
152 #define TICRATE 35 // number of tics / second
153 #define TICSPERSEC 35
155 #define MINIMUM_HEAP_SIZE 0x800000 // 8 meg
156 #define MAXIMUM_HEAP_SIZE 0x2000000 // 32 meg
159 #define FRACUNIT (1<<FRACBITS)
163 typedef unsigned int uint;
166 //#define ANGLE_1 0x01000000
167 #define ANGLE_45 0x20000000
168 #define ANGLE_90 0x40000000
169 #define ANGLE_180 0x80000000
170 #define ANGLE_MAX 0xffffffff
171 #define ANGLE_1 (ANGLE_45/45)
172 #define ANGLE_60 (ANGLE_180/3)
174 #define ANG45 0x20000000
175 #define ANG90 0x40000000
176 #define ANG180 0x80000000
177 #define ANG270 0xc0000000
179 typedef unsigned angle_t;
201 int data1; // keys / mouse/joystick buttons
202 int data2; // mouse/joystick x move
203 int data3; // mouse/joystick y move
208 char forwardmove; // *2048 for move
209 char sidemove; // *2048 for move
210 short angleturn; // <<16 for angle delta
211 short consistancy; // checks for net game
214 byte lookfly; // look/fly up/down/centering
215 byte arti; // artitype_t to use
220 #define BT_CHANGE 4 // if true, the next 3 bits hold weapon num
221 #define BT_WEAPONMASK (8+16+32)
222 #define BT_WEAPONSHIFT 3
224 #define BT_SPECIAL 128 // game events, not really buttons
225 #define BTS_SAVEMASK (4+8+16)
226 #define BTS_SAVESHIFT 2
227 #define BT_SPECIALMASK 3
228 #define BTS_PAUSE 1 // pause the game
229 #define BTS_SAVEGAME 2 // save the game at each console
230 // savegame slot numbers occupy the second byte of buttons
232 // The top 3 bits of the artifact field in the ticcmd_t struct are used
233 // as additional flags
234 #define AFLAG_MASK 0x3F
235 #define AFLAG_SUICIDE 0x40
236 #define AFLAG_JUMP 0x80
279 int scantranslate; // PC scan code hack
280 int untranslated; // lousy hack
283 ===============================================================================
287 ===============================================================================
290 // think_t is a function pointer to a routine to handle an actor
291 typedef void (*think_t) ();
293 typedef struct thinker_s
295 struct thinker_s *prev, *next;
301 typedef struct mobj_s
303 thinker_t thinker; // thinker node
307 struct mobj_s *snext, *sprev; // links in sector (if needed)
309 spritenum_t sprite; // used to find patch_t and flip value
310 int frame; // might be ord with FF_FULLBRIGHT
313 struct mobj_s *bnext, *bprev; // links in blocks (if needed)
314 struct subsector_s *subsector;
315 fixed_t floorz, ceilingz; // closest together of contacted secs
316 fixed_t floorpic; // contacted sec floorpic
317 fixed_t radius, height; // for movement checking
318 fixed_t momx, momy, momz; // momentums
319 int validcount; // if == validcount, already checked
321 mobjinfo_t *info; // &mobjinfo[mobj->type]
322 int tics; // state tic counter
324 int damage; // For missiles
326 int flags2; // Heretic flags
327 int special1; // Special info
328 int special2; // Special info
331 int movecount; // when 0, select a new dir
332 struct mobj_s *target; // thing being chased/attacked (or NULL)
333 // also the originator for missiles
334 int reactiontime; // if non 0, don't attack yet
335 // used by player to freeze a bit after
337 int threshold; // if > 0, the target will be chased
338 // no matter what (even if shot)
339 struct player_s *player; // only valid if type == MT_PLAYER
340 int lastlook; // player number last looked for
341 fixed_t floorclip; // value to use for floor clipping
342 int archiveNum; // Identity during archive
343 short tid; // thing identifier
344 byte special; // special
345 byte args[5]; // special arguments
348 // each sector has a degenmobj_t in it's center for sound origin purposes
351 thinker_t thinker; // not used for anything
355 // Most damage defined using HITDICE
356 #define HITDICE(a) ((1+(P_Random()&7))*a)
361 #define FF_FULLBRIGHT 0x8000 // flag in thing->frame
362 #define FF_FRAMEMASK 0x7fff
364 // --- mobj.flags ---
366 #define MF_SPECIAL 1 // call P_SpecialThing when touched
368 #define MF_SHOOTABLE 4
369 #define MF_NOSECTOR 8 // don't use the sector links
370 // (invisible but touchable)
371 #define MF_NOBLOCKMAP 16 // don't use the blocklinks
372 // (inert but displayable)
374 #define MF_JUSTHIT 64 // try to attack right back
375 #define MF_JUSTATTACKED 128 // take at least one step before attacking
376 #define MF_SPAWNCEILING 256 // hang from ceiling instead of floor
377 #define MF_NOGRAVITY 512 // don't apply gravity every tic
380 #define MF_DROPOFF 0x400 // allow jumps from high places
381 #define MF_PICKUP 0x800 // for players to pick up items
382 #define MF_NOCLIP 0x1000 // player cheat
383 #define MF_SLIDE 0x2000 // keep info about sliding along walls
384 #define MF_FLOAT 0x4000 // allow moves to any height, no gravity
385 #define MF_TELEPORT 0x8000 // don't cross lines or look at heights
386 #define MF_MISSILE 0x10000 // don't hit same species, explode on block
388 #define MF_ALTSHADOW 0x20000 // alternate fuzzy draw
389 #define MF_SHADOW 0x40000 // use fuzzy draw (shadow demons / invis)
390 #define MF_NOBLOOD 0x80000 // don't bleed when shot (use puff)
391 #define MF_CORPSE 0x100000 // don't stop moving halfway off a step
392 #define MF_INFLOAT 0x200000 // floating to a height for a move, don't
393 // auto float to target's height
395 #define MF_COUNTKILL 0x400000 // count towards intermission kill total
396 #define MF_ICECORPSE 0x800000 // a frozen corpse (for blasting)
398 #define MF_SKULLFLY 0x1000000 // skull in flight
399 #define MF_NOTDMATCH 0x2000000 // don't spawn in death match (key cards)
401 //#define MF_TRANSLATION 0xc000000 // if 0x4 0x8 or 0xc, use a translation
402 #define MF_TRANSLATION 0x1c000000 // use a translation table (>>MF_TRANSHIFT)
403 #define MF_TRANSSHIFT 26 // table for player colormaps
406 // --- mobj.flags2 ---
408 #define MF2_LOGRAV 0x00000001 // alternate gravity setting
409 #define MF2_WINDTHRUST 0x00000002 // gets pushed around by the wind
411 #define MF2_FLOORBOUNCE 0x00000004 // bounces off the floor
412 #define MF2_BLASTED 0x00000008 // missile will pass through ghosts
413 #define MF2_FLY 0x00000010 // fly mode is active
414 #define MF2_FLOORCLIP 0x00000020 // if feet are allowed to be clipped
415 #define MF2_SPAWNFLOAT 0x00000040 // spawn random float z
416 #define MF2_NOTELEPORT 0x00000080 // does not teleport
417 #define MF2_RIP 0x00000100 // missile rips through solid
419 #define MF2_PUSHABLE 0x00000200 // can be pushed by other moving
421 #define MF2_SLIDE 0x00000400 // slides against walls
422 #define MF2_ONMOBJ 0x00000800 // mobj is resting on top of another
424 #define MF2_PASSMOBJ 0x00001000 // Enable z block checking. If on,
425 // this flag will allow the mobj to
426 // pass over/under other mobjs.
427 #define MF2_CANNOTPUSH 0x00002000 // cannot push other pushable mobjs
428 #define MF2_DROPPED 0x00004000 // dropped by a demon
429 #define MF2_BOSS 0x00008000 // mobj is a major boss
430 #define MF2_FIREDAMAGE 0x00010000 // does fire damage
431 #define MF2_NODMGTHRUST 0x00020000 // does not thrust target when
433 #define MF2_TELESTOMP 0x00040000 // mobj can stomp another
434 #define MF2_FLOATBOB 0x00080000 // use float bobbing z movement
435 #define MF2_DONTDRAW 0x00100000 // don't generate a vissprite
436 #define MF2_IMPACT 0x00200000 // an MF_MISSILE mobj can activate
438 #define MF2_PUSHWALL 0x00400000 // mobj can push walls
439 #define MF2_MCROSS 0x00800000 // can activate monster cross lines
440 #define MF2_PCROSS 0x01000000 // can activate projectile cross lines
441 #define MF2_CANTLEAVEFLOORPIC 0x02000000 // stay within a certain floor type
442 #define MF2_NONSHOOTABLE 0x04000000 // mobj is totally non-shootable,
443 // but still considered solid
444 #define MF2_INVULNERABLE 0x08000000 // mobj is invulnerable
445 #define MF2_DORMANT 0x10000000 // thing is dormant
446 #define MF2_ICEDAMAGE 0x20000000 // does ice damage
447 #define MF2_SEEKERMISSILE 0x40000000 // is a seeker (for reflection)
448 #define MF2_REFLECTIVE 0x80000000 // reflects missiles
450 //=============================================================================
452 // ===== Player Class Types =====
466 PST_DEAD, // dead on the ground
467 PST_REBORN // ready to restart
470 // psprites are scaled shapes directly on the view screen
471 // coordinates are given for a 320*200 view screen
481 state_t *state; // a NULL state means not active
486 /* Old Heretic key type
557 extern weaponinfo_t WeaponInfo[NUMWEAPONS][NUMCLASSES];
562 arti_invulnerability,
579 arti_puzzskull = arti_firstpuzzitem,
613 #define INVULNTICS (30*35)
614 #define INVISTICS (60*35)
615 #define INFRATICS (120*35)
616 #define IRONTICS (60*35)
617 #define WPNLEV2TICS (40*35)
618 #define FLIGHTTICS (60*35)
619 #define SPEEDTICS (45*35)
620 #define MORPHTICS (40*35)
621 #define MAULATORTICS (25*35)
623 #define MESSAGETICS (4*35)
624 #define BLINKTHRESHOLD (4*35)
626 #define NUMINVENTORYSLOTS NUMARTIFACTS
642 typedef struct player_s
645 playerstate_t playerstate;
648 #if defined( __cplusplus )
649 pclass_t c_class; // player class type
651 pclass_t class; // player class type
654 fixed_t viewz; // focal origin above r.z
655 fixed_t viewheight; // base height above floor for viewz
656 fixed_t deltaviewheight; // squat speed
657 fixed_t bob; // bounded/scaled total momentum
662 int health; // only used between levels, mo->health
663 // is used during levels
664 int armorpoints[NUMARMOR];
666 inventory_t inventory[NUMINVENTORYSLOTS];
667 artitype_t readyArtifact;
669 int inventorySlotNum;
670 int powers[NUMPOWERS];
672 int pieces; // Fourth Weapon pieces
673 signed int frags[MAXPLAYERS]; // kills of other players
674 weapontype_t readyweapon;
675 weapontype_t pendingweapon; // wp_nochange if not changing
676 boolean weaponowned[NUMWEAPONS];
678 int attackdown, usedown; // true if button down last tic
679 int cheats; // bit flags
681 int refire; // refired shots are less accurate
683 int killcount, itemcount, secretcount; // for intermission
684 char message[80]; // hint messages
685 int messageTics; // counter for showing messages
686 short ultimateMessage;
688 int damagecount, bonuscount;// for screen flashing
689 int poisoncount; // screen flash for poison damage
690 mobj_t *poisoner; // NULL for non-player mobjs
691 mobj_t *attacker; // who did damage (NULL for floors)
692 int extralight; // so gun flashes light up areas
693 int fixedcolormap; // can be set to REDCOLORMAP, etc
694 int colormap; // 0-3 for which color to draw player
695 pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc)
696 int morphTics; // player is a pig if > 0
697 uint jumpTics; // delay the next jump for a moment
698 unsigned int worldTimer; // total time the player's been playing
703 #define CF_NOMOMENTUM 4 // not really a cheat, just a debug aid
706 #define BACKUPTICS 12
710 unsigned checksum; // high bit is retransmit request
711 byte retransmitfrom; // only valid if NCMD_RETRANSMIT
713 byte player, numtics;
714 ticcmd_t cmds[BACKUPTICS];
720 short intnum; // DOOM executes an int to execute commands
722 // communication between DOOM and the driver
723 short command; // CMD_SEND or CMD_GET
724 short remotenode; // dest for send, set by get (-1 = no packet)
725 short datalength; // bytes in doomdata to be sent
727 // info common to all nodes
728 short numnodes; // console is allways node 0
729 short ticdup; // 1 = no duplication, 2-5 = dup for slow nets
730 short extratics; // 1 = send a backup tic in every packet
731 short deathmatch; // 1 = deathmatch
732 short savegame; // -1 = new game, 0-5 = load savegame
733 short episode; // 1-3
737 // info specific to this node
740 short angleoffset; // 1 = left, 0 = center, -1 = right
741 short drone; // 1 = drone
743 // packet data to be sent
747 #define DOOMCOM_ID 0x12345678l
749 extern doomcom_t *doomcom;
750 extern doomdata_t *netbuffer; // points inside doomcom
752 #define MAXNETNODES 16 // max computers in a game
758 #define SBARHEIGHT 39 // status bar height at bottom of screen
760 void NET_SendFrags(player_t *player);
763 ===============================================================================
767 ===============================================================================
770 #define TELEFOGHEIGHT (32*FRACUNIT)
774 extern event_t events[MAXEVENTS];
775 extern int eventhead;
776 extern int eventtail;
778 extern fixed_t finesine[5*FINEANGLES/4];
779 extern fixed_t *finecosine;
781 extern gameaction_t gameaction;
783 extern boolean paused;
785 extern boolean shareware; // true if other episodes not present
787 extern boolean DevMaps; // true = map development mode
788 extern char *DevMapsDir; // development maps directory
790 extern boolean nomonsters; // checkparm of -nomonsters
792 extern boolean respawnparm; // checkparm of -respawn
794 extern boolean randomclass; // checkparm of -randclass
796 extern boolean debugmode; // checkparm of -debug
798 extern boolean usergame; // ok to save / end game
800 extern boolean ravpic; // checkparm of -ravpic
802 extern boolean altpal; // checkparm to use an alternate palette routine
804 extern boolean cdrom; // true if cd-rom mode active ("-cdrom")
806 extern boolean deathmatch; // only if started as net death
808 extern boolean netgame; // only true if >1 player
810 extern boolean cmdfrag; // true if a CMD_FRAG packet should be sent out every
813 extern boolean playeringame[MAXPLAYERS];
814 extern pclass_t PlayerClass[MAXPLAYERS];
816 extern int consoleplayer; // player taking events and displaying
818 extern int displayplayer;
820 extern int viewangleoffset; // ANG90 = left side, ANG270 = right
822 extern player_t players[MAXPLAYERS];
824 extern boolean singletics; // debug flag to cancel adaptiveness
826 extern boolean DebugSound; // debug flag for displaying sound info
828 extern boolean demoplayback;
829 extern int maxzone; // Maximum chunk allocated for zone heap
831 extern int Sky1Texture;
832 extern int Sky2Texture;
834 extern gamestate_t gamestate;
835 extern skill_t gameskill;
836 //extern boolean respawnmonsters;
837 extern int gameepisode;
840 extern int levelstarttic; // gametic at level start
841 extern int leveltime; // tics in game play for par
843 extern ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
846 //#define MAXNETNODES 8
848 extern ticcmd_t localcmds[BACKUPTICS];
850 extern int gametic, maketic;
851 extern int nettics[MAXNETNODES];
853 #define MAXDEATHMATCHSTARTS 16
854 extern mapthing_t *deathmatch_p;
855 extern mapthing_t deathmatchstarts[MAXDEATHMATCHSTARTS];
857 // Position indicator for cooperative net-play reborn
858 extern int RebornPosition;
860 #define MAX_PLAYER_STARTS 8
861 extern mapthing_t playerstarts[MAX_PLAYER_STARTS][MAXPLAYERS];
863 extern int viewwindowx;
864 extern int viewwindowy;
865 extern int viewwidth;
866 extern int scaledviewwidth;
867 extern int viewheight;
869 extern int mouseSensitivity;
871 extern boolean precache; // if true, load all graphics at level load
873 extern byte *screen; // off screen work buffer, from V_video.c
875 extern boolean singledemo; // quit after playing a demo from cmdline
877 extern FILE *debugfile;
878 extern int bodyqueslot;
879 extern skill_t startskill;
880 extern int startepisode;
882 extern boolean autostart;
886 ===============================================================================
890 ===============================================================================
894 fixed_t FixedMul (fixed_t a, fixed_t b);
895 fixed_t FixedDiv (fixed_t a, fixed_t b);
896 fixed_t FixedDiv2 (fixed_t a, fixed_t b);
900 #define FixedMul(fa,fb) ({ int __value, __fb = (fb); \
901 __asm__("imul %%ebx; shrd $16,%%edx,%%eax" \
903 : "0" (fa), "b" (__fb) \
904 : "edx" ); __value; })
905 #define FixedDiv2(fa,fb) ({ int __value; \
906 __asm__("cdq; shld $16,%%eax,%%edx; sall $16,%%eax; idiv %%ebx" \
908 : "0" (fa), "b" (fb) \
909 : "edx" ); __value; })
912 #ifdef __BIG_ENDIAN__
913 short ShortSwap(short);
915 #define SHORT(x) ShortSwap(x)
916 #define LONG(x) LongSwap(x)
926 // tags < 100 are not overwritten until freed
927 #define PU_STATIC 1 // static entire execution time
928 #define PU_SOUND 2 // static while playing
929 #define PU_MUSIC 3 // static while playing
930 #define PU_DAVE 4 // anything else Dave wants static
931 #define PU_LEVEL 50 // static until level exited
932 #define PU_LEVSPEC 51 // a special thinker in a level
933 // tags >= 100 are purgable whenever needed
934 #define PU_PURGELEVEL 100
939 void *Z_Malloc (int size, int tag, void *ptr);
940 void Z_Free (void *ptr);
941 void Z_FreeTags (int lowtag, int hightag);
942 //void Z_DumpHeap (int lowtag, int hightag);
943 //void Z_FileDumpHeap (FILE *f);
944 void Z_CheckHeap (void);
945 void Z_ChangeTag2 (void *ptr, int tag);
946 //int Z_FreeMemory (void);
948 typedef struct memblock_s
950 int size; // including the header and possibly tiny fragments
951 void **user; // NULL if a free block
952 int tag; // purgelevel
953 int id; // should be ZONEID
954 struct memblock_s *next, *prev;
957 #define Z_ChangeTag(p,t) \
959 if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
960 I_Error("Z_CT at "__FILE__":%i",__LINE__); \
970 int handle,position,size;
973 extern lumpinfo_t *lumpinfo;
976 void W_InitMultipleFiles(char **filenames);
977 void W_OpenAuxiliary(char *filename);
978 void W_CloseAuxiliaryFile(void);
979 void W_CloseAuxiliary(void);
980 void W_UsePrimary(void);
981 void W_UseAuxiliary(void);
982 int W_CheckNumForName(char *name);
983 int W_GetNumForName(char *name);
984 int W_LumpLength(int lump);
985 void W_ReadLump(int lump, void *dest);
986 void *W_CacheLumpNum(int lump, int tag);
987 void *W_CacheLumpName(char *name, int tag);
988 void W_CheckForOldFiles(void);
994 // not a globally visible function, just included for source reference
995 // calls all startup code
996 // parses command line options
997 // if not overrided, calls N_AdvanceDemo
999 void H2_GameLoop(void);
1000 // not a globally visible function, just included for source reference
1001 // called by H2_Main, never exits
1002 // manages timing and IO
1003 // calls all ?_Responder, ?_Ticker, and ?_Drawer functions
1004 // calls I_GetTime, I_StartFrame, and I_StartTic
1006 void H2_PostEvent(event_t *ev);
1007 // called by IO functions when input is detected
1009 void NetUpdate (void);
1010 // create any new ticcmds and broadcast to other players
1012 void D_QuitNetGame (void);
1013 // broadcasts special packets to other players to notify of game exit
1015 void TryRunTics (void);
1021 #define SCREENWIDTH 320
1022 #define SCREENHEIGHT 200
1024 #define SCREENWIDTH 560
1025 #define SCREENHEIGHT 375
1028 byte *I_ZoneBase (int *size);
1029 // called by startup code to get the ammount of memory to malloc
1030 // for the zone management
1032 int I_GetTime (void);
1033 // called by H2_GameLoop
1034 // returns current time in tics
1036 void I_StartFrame (void);
1037 // called by H2_GameLoop
1038 // called before processing any tics in a frame (just after displaying a frame)
1039 // time consuming syncronous operations are performed here (joystick reading)
1040 // can call H2_PostEvent
1042 void I_StartTic (void);
1043 // called by H2_GameLoop
1044 // called before processing each tic in a frame
1045 // quick syncronous operations are performed here
1046 // can call H2_PostEvent
1048 // asyncronous interrupt functions should maintain private ques that are
1049 // read by the syncronous functions to be converted into events
1052 // called by H2_Main
1053 // determines the hardware configuration and sets up the video mode
1055 void I_InitGraphics (void);
1057 void I_InitNetwork (void);
1058 void I_NetCmd (void);
1060 void I_CheckExternDriver(void);
1062 void I_Error (char *error, ...);
1063 // called by anything that can generate a terminal error
1064 // bad exit with diagnostic message
1067 // called by M_Responder when quit is selected
1068 // clean exit, displays sell blurb
1070 void I_SetPalette (byte *palette);
1071 // takes full 8 bit values
1073 void I_Update(void);
1074 // Copy buffer to video
1076 void I_WipeUpdate(wipe_t wipe);
1077 // Copy buffer to video with wipe effect
1079 void I_WaitVBL(int count);
1080 // wait for vertical retrace or pause a bit
1082 void I_BeginRead (void);
1083 void I_EndRead (void);
1085 byte *I_AllocLow (int length);
1086 // allocates from low memory under dos, just mallocs under unix
1088 void I_Tactile (int on, int off, int total);
1090 #if defined(__linux)
1091 extern boolean useexterndriver;
1094 #define EBT_OPENDOOR 2
1096 #define EBT_STRAFE 8
1097 #define EBT_MAP 0x10
1098 #define EBT_INVENTORYLEFT 0x20
1099 #define EBT_INVENTORYRIGHT 0x40
1100 #define EBT_USEARTIFACT 0x80
1101 #define EBT_FLYDROP 0x100
1102 #define EBT_CENTERVIEW 0x200
1103 #define EBT_PAUSE 0x400
1104 #define EBT_WEAPONCYCLE 0x800
1105 #define EBT_JUMP 0x1000
1109 short vector; // Interrupt vector
1111 signed char moveForward; // forward/backward (maxes at 50)
1112 signed char moveSideways; // strafe (maxes at 24)
1113 short angleTurn; // turning speed (640 [slow] 1280 [fast])
1114 short angleHead; // head angle (+2080 [left] : 0 [center] : -2048 [right])
1115 signed char pitch; // look up/down (-110 : +90)
1116 signed char flyDirection; // flyheight (+1/-1)
1117 unsigned short buttons; // EBT_* flags
1125 void G_DeathMatchSpawnPlayer (int playernum);
1127 void G_InitNew (skill_t skill, int episode, int map);
1129 void G_DeferedInitNew (skill_t skill, int episode, int map);
1130 // can be called by the startup code or M_Responder
1131 // a normal game starts at map 1, but a warp test can start elsewhere
1133 void G_DeferredNewGame(skill_t skill);
1135 void G_DeferedPlayDemo (char *demo);
1137 void G_LoadGame(int slot);
1138 // can be called by the startup code or M_Responder
1139 // calls P_SetupLevel or W_EnterWorld
1140 void G_DoLoadGame (void);
1142 void G_SaveGame (int slot, char *description);
1143 // called by M_Responder
1145 void G_RecordDemo (skill_t skill, int numplayers, int episode
1146 , int map, char *name);
1147 // only called by startup code
1149 void G_PlayDemo (char *name);
1150 void G_TimeDemo (char *name);
1152 void G_TeleportNewMap(int map, int position);
1154 void G_Completed(int map, int position);
1155 //void G_ExitLevel (void);
1156 //void G_SecretExitLevel (void);
1158 void G_StartNewGame(skill_t skill);
1159 void G_StartNewInit(void);
1161 void G_WorldDone (void);
1163 void G_Ticker (void);
1164 boolean G_Responder (event_t *ev);
1166 void G_ScreenShot (void);
1172 #define HXS_VERSION_TEXT "HXS Ver 2.37"
1173 #define HXS_VERSION_TEXT_LENGTH 16
1174 #define HXS_DESCRIPTION_LENGTH 24
1176 void SV_SaveGame(int slot, char *description);
1177 void SV_SaveMap(boolean savePlayers);
1178 void SV_LoadGame(int slot);
1179 void SV_MapTeleport(int map, int position);
1180 void SV_LoadMap(void);
1181 void SV_InitBaseSlot(void);
1182 void SV_UpdateRebornSlot(void);
1183 void SV_ClearRebornSlot(void);
1184 boolean SV_RebornSlotAvailable(void);
1185 int SV_GetRebornSlot(void);
1191 void P_Ticker (void);
1192 // called by C_Ticker
1193 // can call G_PlayerExited
1194 // carries out all thinking of monsters and players
1196 void P_SetupLevel (int episode, int map, int playermask, skill_t skill);
1197 // called by W_Ticker
1200 // called by startup code
1202 int P_GetMapCluster(int map);
1203 int P_TranslateMap(int map);
1204 int P_GetMapCDTrack(int map);
1205 int P_GetMapWarpTrans(int map);
1206 int P_GetMapNextMap(int map);
1207 int P_GetMapSky1Texture(int map);
1208 int P_GetMapSky2Texture(int map);
1209 char *P_GetMapName(int map);
1210 fixed_t P_GetMapSky1ScrollDelta(int map);
1211 fixed_t P_GetMapSky2ScrollDelta(int map);
1212 boolean P_GetMapDoubleSky(int map);
1213 boolean P_GetMapLightning(int map);
1214 boolean P_GetMapFadeTable(int map);
1215 char *P_GetMapSongLump(int map);
1216 void P_PutMapSongLump(int map, char *lumpName);
1217 int P_GetCDStartTrack(void);
1218 int P_GetCDEnd1Track(void);
1219 int P_GetCDEnd2Track(void);
1220 int P_GetCDEnd3Track(void);
1221 int P_GetCDIntermissionTrack(void);
1222 int P_GetCDTitleTrack(void);
1228 extern boolean setsizeneeded;
1230 extern boolean BorderNeedRefresh;
1231 extern boolean BorderTopRefresh;
1233 extern int UpdateState;
1234 // define the different areas for the dirty map
1235 #define I_NOUPDATE 0
1236 #define I_FULLVIEW 1
1238 #define I_MESSAGES 4
1239 #define I_FULLSCRN 8
1241 void R_RenderPlayerView (player_t *player);
1242 // called by G_Drawer
1245 // called by startup code
1247 void R_DrawViewBorder (void);
1248 void R_DrawTopBorder (void);
1249 // if the view size is not full screen, draws a border around it
1251 void R_SetViewSize (int blocks, int detail);
1252 // called by M_Responder
1254 int R_FlatNumForName (char *name);
1256 int R_TextureNumForName (char *name);
1257 int R_CheckTextureNumForName (char *name);
1258 // called by P_Ticker for switches and animations
1259 // returns the texture number for the texture name
1266 extern char **myargv;
1267 extern int localQuakeHappening[MAXPLAYERS];
1269 int M_CheckParm(char *check);
1270 // returns the position of the given parameter in the arg list (0 if not found)
1271 boolean M_ParmExists(char *check);
1273 void M_ExtractFileBase(char *path, char *dest);
1275 void M_ForceUppercase(char *text);
1276 // Changes a string to uppercase
1278 int M_Random (void);
1279 // returns a number from 0 to 255
1281 extern unsigned char rndtable[256];
1282 extern int prndindex;
1283 #define P_Random() rndtable[(++prndindex)&0xff]
1284 // as M_Random, but used only by the play simulation
1286 void M_ClearRandom (void);
1287 // fix randoms for demos
1289 void M_FindResponseFile(void);
1291 void M_ClearBox (fixed_t *box);
1292 void M_AddToBox (fixed_t *box, fixed_t x, fixed_t y);
1293 // bounding box functions
1295 boolean M_WriteFile(char const *name, void *source, int length);
1296 int M_ReadFile(char const *name, byte **buffer);
1297 int M_ReadFileCLib(char const *name, byte **buffer);
1299 void M_ScreenShot (void);
1301 void M_LoadDefaults(char *fileName);
1303 void M_SaveDefaults (void);
1305 int M_DrawText (int x, int y, boolean direct, char *string);
1307 //------------------------------
1309 //------------------------------
1311 void SC_Open(char *name);
1312 void SC_OpenLump(char *name);
1313 void SC_OpenFile(char *name);
1314 void SC_OpenFileCLib(char *name);
1315 void SC_Close(void);
1316 boolean SC_GetString(void);
1317 void SC_MustGetString(void);
1318 void SC_MustGetStringName(char *name);
1319 boolean SC_GetNumber(void);
1320 void SC_MustGetNumber(void);
1321 void SC_UnGet(void);
1322 //boolean SC_Check(void);
1323 boolean SC_Compare(char *text);
1324 int SC_MatchString(char **strings);
1325 int SC_MustMatchString(char **strings);
1326 void SC_ScriptError(char *message);
1328 extern char *sc_String;
1329 extern int sc_Number;
1331 extern boolean sc_End;
1332 extern boolean sc_Crossed;
1333 extern boolean sc_FileScripts;
1334 extern char *sc_ScriptsDir;
1336 //------------------------------
1338 //------------------------------
1343 SEQ_PLATFORM_HEAVY, // same script as a normal platform
1345 SEQ_PLATFORM_CREAK, // same script as a normal platform
1346 SEQ_PLATFORM_SILENCE,
1351 SEQ_PLATFORM_METAL2,
1381 void SN_InitSequenceScript(void);
1382 void SN_StartSequence(mobj_t *mobj, int sequence);
1383 void SN_StartSequenceName(mobj_t *mobj, char *name);
1384 void SN_StopSequence(mobj_t *mobj);
1385 void SN_UpdateActiveSequences(void);
1386 void SN_StopAllSequences(void);
1387 int SN_GetSequenceOffset(int sequence, int *sequencePtr);
1388 void SN_ChangeNodeData(int nodeNum, int seqOffset, int delayTics, int volume,
1389 int currentSoundID);
1392 typedef struct seqnode_s seqnode_t;
1406 extern int ActiveSequences;
1407 extern seqnode_t *SequenceListHead;
1409 extern boolean nosound;
1410 extern int mouselook;
1411 extern int globheight;
1412 extern int globwidth;
1413 extern int lu2sux(int x);
1414 extern int lu2suy(int y);
1415 //----------------------
1416 // Interlude (IN_lude.c)
1417 //----------------------
1419 #define MAX_INTRMSN_MESSAGE_SIZE 1024
1421 extern boolean intermission;
1422 extern char ClusterMessage[MAX_INTRMSN_MESSAGE_SIZE];
1424 void IN_Start(void);
1425 void IN_Ticker(void);
1426 void IN_Drawer(void);
1428 //----------------------
1429 // Chat mode (CT_chat.c)
1430 //----------------------
1433 void CT_Drawer(void);
1434 boolean CT_Responder(event_t *ev);
1435 void CT_Ticker(void);
1436 char CT_dequeueChatChar(void);
1438 extern boolean chatmodeon;
1440 //--------------------
1441 // Finale (F_finale.c)
1442 //--------------------
1444 void F_Drawer(void);
1445 void F_Ticker(void);
1446 void F_StartFinale(void);
1448 //----------------------
1449 // STATUS BAR (SB_bar.c)
1450 //----------------------
1454 extern int SB_state;
1456 void SB_SetClassData(void);
1457 boolean SB_Responder(event_t *event);
1458 void SB_Ticker(void);
1459 void SB_Drawer(void);
1460 void Draw_TeleportIcon(void);
1461 void Draw_SaveIcon(void);
1462 void Draw_LoadIcon(void);
1469 void MN_ActivateMenu(void);
1470 void MN_DeactivateMenu(void);
1471 boolean MN_Responder(event_t *event);
1472 void MN_Ticker(void);
1473 void MN_Drawer(void);
1474 void MN_DrTextA(char *text, int x, int y);
1475 void MN_DrTextAYellow(char *text, int x, int y);
1476 int MN_TextAWidth(char *text);
1477 void MN_DrTextB(char *text, int x, int y);
1478 int MN_TextBWidth(char *text);
1484 extern int dirtybox[4];
1485 extern byte gammatable[5][256];
1486 extern int usegamma;
1488 void V_Init(void); // Allocates buffer screens, call before R_Init
1489 void V_DrawPatch(int x, int y, patch_t *patch);
1490 void V_DrawFuzzPatch(int x, int y, patch_t *patch);
1491 void V_DrawAltFuzzPatch(int x, int y, patch_t *patch);
1492 void V_DrawShadowedPatch(int x, int y, patch_t *patch);
1493 void V_DrawRawScreen(byte *raw);
1498 #define FIX2FLT(x) ((float)((x)>>FRACBITS) + (float)((x)&(FRACUNIT-1)) / (float)(FRACUNIT))
1499 #define Q_FIX2FLT(x) ((float)((x)>>FRACBITS))