2 //**************************************************************************
4 //** h2def.h : Heretic 2 : Raven Software, Corp.
11 //**************************************************************************
21 #include <sys/types.h>
25 #define VERSION_TEXT "v1.1"
27 // Uncomment, to enable all timebomb stuff
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)
33 // if rangecheck is undefined, most parameter validation debugging code
34 // will not be compiled
35 #ifndef NORANGECHECKING
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
50 #define VERSIONTEXT "Version 1.3 +R "__DATE__" (BCP)"
52 #define VERSIONTEXT "Version 1.3 "__DATE__" (BCP)"
56 #define VERSIONTEXT "Version 1.3 +R "__DATE__" ("VER_ID")"
58 #define VERSIONTEXT "Version 1.3 "__DATE__" ("VER_ID")"
62 // all exterior data is defined here
65 // all important printed strings
68 // header generated by multigen utility
71 extern byte *destview, *destscreen; // PC direct to screen pointers
74 // most key data are simple ascii (uppercased)
76 #define KEY_RIGHTARROW 0xae
77 #define KEY_LEFTARROW 0xac
78 #define KEY_UPARROW 0xad
79 #define KEY_DOWNARROW 0xaf
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)
95 #define KEY_BACKSPACE 127
96 #define KEY_PAUSE 0xff
98 #define KEY_EQUALS 0x3d
99 #define KEY_MINUS 0x2d
101 #define KEY_RSHIFT (0x80+0x36)
102 #define KEY_RCTRL (0x80+0x1d)
103 #define KEY_RALT (0x80+0x38)
105 #define KEY_LALT KEY_RALT
107 #define KEY_FIVE 0x35
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
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)
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)
126 #define FINEANGLES 8192
127 #define FINEMASK (FINEANGLES-1)
128 #define ANGLETOFINESHIFT 19 // 0x100000000 to 0x2000
131 ===============================================================================
135 ===============================================================================
138 //#define NUMARTIFCTS 28
140 #define TICRATE 35 // number of tics / second
141 #define TICSPERSEC 35
143 #define MINIMUM_HEAP_SIZE 0x800000 // 8 meg
144 #define MAXIMUM_HEAP_SIZE 0x2000000 // 32 meg
147 #define FRACUNIT (1<<FRACBITS)
151 typedef unsigned int uint;
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)
162 #define ANG45 0x20000000
163 #define ANG90 0x40000000
164 #define ANG180 0x80000000
165 #define ANG270 0xc0000000
167 typedef unsigned angle_t;
189 int data1; // keys / mouse/joystick buttons
190 int data2; // mouse/joystick x move
191 int data3; // mouse/joystick y move
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
202 byte lookfly; // look/fly up/down/centering
203 byte arti; // artitype_t to use
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
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
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
267 int scantranslate; // PC scan code hack
268 int untranslated; // lousy hack
271 ===============================================================================
275 ===============================================================================
278 // think_t is a function pointer to a routine to handle an actor
279 typedef void (*think_t) ();
281 typedef struct thinker_s
283 struct thinker_s *prev, *next;
289 typedef struct mobj_s
291 thinker_t thinker; // thinker node
295 struct mobj_s *snext, *sprev; // links in sector (if needed)
297 spritenum_t sprite; // used to find patch_t and flip value
298 int frame; // might be ord with FF_FULLBRIGHT
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
309 mobjinfo_t *info; // &mobjinfo[mobj->type]
310 int tics; // state tic counter
312 int damage; // For missiles
314 int flags2; // Heretic flags
315 int special1; // Special info
316 int special2; // Special info
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
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
336 // each sector has a degenmobj_t in it's center for sound origin purposes
339 thinker_t thinker; // not used for anything
343 // Most damage defined using HITDICE
344 #define HITDICE(a) ((1+(P_Random()&7))*a)
349 #define FF_FULLBRIGHT 0x8000 // flag in thing->frame
350 #define FF_FRAMEMASK 0x7fff
352 // --- mobj.flags ---
354 #define MF_SPECIAL 1 // call P_SpecialThing when touched
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)
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
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
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
383 #define MF_COUNTKILL 0x400000 // count towards intermission kill total
384 #define MF_ICECORPSE 0x800000 // a frozen corpse (for blasting)
386 #define MF_SKULLFLY 0x1000000 // skull in flight
387 #define MF_NOTDMATCH 0x2000000 // don't spawn in death match (key cards)
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
394 // --- mobj.flags2 ---
396 #define MF2_LOGRAV 0x00000001 // alternate gravity setting
397 #define MF2_WINDTHRUST 0x00000002 // gets pushed around by the wind
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
407 #define MF2_PUSHABLE 0x00000200 // can be pushed by other moving
409 #define MF2_SLIDE 0x00000400 // slides against walls
410 #define MF2_ONMOBJ 0x00000800 // mobj is resting on top of another
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
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
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
438 //=============================================================================
440 // ===== Player Class Types =====
454 PST_DEAD, // dead on the ground
455 PST_REBORN // ready to restart
458 // psprites are scaled shapes directly on the view screen
459 // coordinates are given for a 320*200 view screen
469 state_t *state; // a NULL state means not active
474 /* Old Heretic key type
545 extern weaponinfo_t WeaponInfo[NUMWEAPONS][NUMCLASSES];
550 arti_invulnerability,
567 arti_puzzskull = arti_firstpuzzitem,
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)
611 #define MESSAGETICS (4*35)
612 #define BLINKTHRESHOLD (4*35)
614 #define NUMINVENTORYSLOTS NUMARTIFACTS
630 typedef struct player_s
633 playerstate_t playerstate;
636 #if defined( __cplusplus )
637 pclass_t c_class; // player class type
639 pclass_t class; // player class type
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
650 int health; // only used between levels, mo->health
651 // is used during levels
652 int armorpoints[NUMARMOR];
654 inventory_t inventory[NUMINVENTORYSLOTS];
655 artitype_t readyArtifact;
657 int inventorySlotNum;
658 int powers[NUMPOWERS];
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];
666 int attackdown, usedown; // true if button down last tic
667 int cheats; // bit flags
669 int refire; // refired shots are less accurate
671 int killcount, itemcount, secretcount; // for intermission
672 char message[80]; // hint messages
673 int messageTics; // counter for showing messages
674 short ultimateMessage;
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
691 #define CF_NOMOMENTUM 4 // not really a cheat, just a debug aid
694 #define BACKUPTICS 12
698 unsigned checksum; // high bit is retransmit request
699 byte retransmitfrom; // only valid if NCMD_RETRANSMIT
701 byte player, numtics;
702 ticcmd_t cmds[BACKUPTICS];
708 short intnum; // DOOM executes an int to execute commands
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
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
725 // info specific to this node
728 short angleoffset; // 1 = left, 0 = center, -1 = right
729 short drone; // 1 = drone
731 // packet data to be sent
735 #define DOOMCOM_ID 0x12345678l
737 extern doomcom_t *doomcom;
738 extern doomdata_t *netbuffer; // points inside doomcom
740 #define MAXNETNODES 16 // max computers in a game
746 #define SBARHEIGHT 39 // status bar height at bottom of screen
748 void NET_SendFrags(player_t *player);
751 ===============================================================================
755 ===============================================================================
758 #define TELEFOGHEIGHT (32*FRACUNIT)
762 extern event_t events[MAXEVENTS];
763 extern int eventhead;
764 extern int eventtail;
766 extern fixed_t finesine[5*FINEANGLES/4];
767 extern fixed_t *finecosine;
769 extern gameaction_t gameaction;
771 extern boolean paused;
773 extern boolean shareware; // true if other episodes not present
775 extern boolean DevMaps; // true = map development mode
776 extern char *DevMapsDir; // development maps directory
778 extern boolean nomonsters; // checkparm of -nomonsters
780 extern boolean respawnparm; // checkparm of -respawn
782 extern boolean randomclass; // checkparm of -randclass
784 extern boolean debugmode; // checkparm of -debug
786 extern boolean usergame; // ok to save / end game
788 extern boolean ravpic; // checkparm of -ravpic
790 extern boolean altpal; // checkparm to use an alternate palette routine
792 extern boolean cdrom; // true if cd-rom mode active ("-cdrom")
794 extern boolean deathmatch; // only if started as net death
796 extern boolean netgame; // only true if >1 player
798 extern boolean cmdfrag; // true if a CMD_FRAG packet should be sent out every
801 extern boolean playeringame[MAXPLAYERS];
802 extern pclass_t PlayerClass[MAXPLAYERS];
804 extern int consoleplayer; // player taking events and displaying
806 extern int displayplayer;
808 extern int viewangleoffset; // ANG90 = left side, ANG270 = right
810 extern player_t players[MAXPLAYERS];
812 extern boolean singletics; // debug flag to cancel adaptiveness
814 extern boolean DebugSound; // debug flag for displaying sound info
816 extern boolean demoplayback;
817 extern int maxzone; // Maximum chunk allocated for zone heap
819 extern int Sky1Texture;
820 extern int Sky2Texture;
822 extern gamestate_t gamestate;
823 extern skill_t gameskill;
824 //extern boolean respawnmonsters;
825 extern int gameepisode;
828 extern int levelstarttic; // gametic at level start
829 extern int leveltime; // tics in game play for par
831 extern ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
834 //#define MAXNETNODES 8
836 extern ticcmd_t localcmds[BACKUPTICS];
838 extern int gametic, maketic;
839 extern int nettics[MAXNETNODES];
841 #define MAXDEATHMATCHSTARTS 16
842 extern mapthing_t *deathmatch_p;
843 extern mapthing_t deathmatchstarts[MAXDEATHMATCHSTARTS];
845 // Position indicator for cooperative net-play reborn
846 extern int RebornPosition;
848 #define MAX_PLAYER_STARTS 8
849 extern mapthing_t playerstarts[MAX_PLAYER_STARTS][MAXPLAYERS];
851 extern int viewwindowx;
852 extern int viewwindowy;
853 extern int viewwidth;
854 extern int scaledviewwidth;
855 extern int viewheight;
857 extern int mouseSensitivity;
859 extern boolean precache; // if true, load all graphics at level load
861 extern byte *screen; // off screen work buffer, from V_video.c
863 extern boolean singledemo; // quit after playing a demo from cmdline
865 extern FILE *debugfile;
866 extern int bodyqueslot;
867 extern skill_t startskill;
868 extern int startepisode;
870 extern boolean autostart;
874 ===============================================================================
878 ===============================================================================
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);
888 #define FixedMul(fa,fb) ({ int __value, __fb = (fb); \
889 __asm__("imul %%ebx; shrd $16,%%edx,%%eax" \
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" \
896 : "0" (fa), "b" (fb) \
897 : "edx" ); __value; })
900 #ifdef __BIG_ENDIAN__
901 short ShortSwap(short);
903 #define SHORT(x) ShortSwap(x)
904 #define LONG(x) LongSwap(x)
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
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);
936 typedef struct memblock_s
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;
945 #define Z_ChangeTag(p,t) \
947 if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
948 I_Error("Z_CT at "__FILE__":%i",__LINE__); \
958 int handle,position,size;
961 extern lumpinfo_t *lumpinfo;
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);
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
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
993 void H2_PostEvent(event_t *ev);
994 // called by IO functions when input is detected
996 void NetUpdate (void);
997 // create any new ticcmds and broadcast to other players
999 void D_QuitNetGame (void);
1000 // broadcasts special packets to other players to notify of game exit
1002 void TryRunTics (void);
1008 #define SCREENWIDTH 320
1009 #define SCREENHEIGHT 200
1011 #define SCREENWIDTH 560
1012 #define SCREENHEIGHT 375
1015 byte *I_ZoneBase (int *size);
1016 // called by startup code to get the ammount of memory to malloc
1017 // for the zone management
1019 int I_GetTime (void);
1020 // called by H2_GameLoop
1021 // returns current time in tics
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
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
1035 // asyncronous interrupt functions should maintain private ques that are
1036 // read by the syncronous functions to be converted into events
1039 // called by H2_Main
1040 // determines the hardware configuration and sets up the video mode
1042 void I_InitGraphics (void);
1044 void I_InitNetwork (void);
1045 void I_NetCmd (void);
1047 void I_CheckExternDriver(void);
1049 void I_Error (char *error, ...);
1050 // called by anything that can generate a terminal error
1051 // bad exit with diagnostic message
1054 // called by M_Responder when quit is selected
1055 // clean exit, displays sell blurb
1057 void I_SetPalette (byte *palette);
1058 // takes full 8 bit values
1060 void I_Update(void);
1061 // Copy buffer to video
1063 void I_WipeUpdate(wipe_t wipe);
1064 // Copy buffer to video with wipe effect
1066 void I_WaitVBL(int count);
1067 // wait for vertical retrace or pause a bit
1069 void I_BeginRead (void);
1070 void I_EndRead (void);
1072 byte *I_AllocLow (int length);
1073 // allocates from low memory under dos, just mallocs under unix
1075 void I_Tactile (int on, int off, int total);
1077 #if defined(__linux)
1078 extern boolean useexterndriver;
1081 #define EBT_OPENDOOR 2
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
1096 short vector; // Interrupt vector
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
1112 void G_DeathMatchSpawnPlayer (int playernum);
1114 void G_InitNew (skill_t skill, int episode, int map);
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
1120 void G_DeferredNewGame(skill_t skill);
1122 void G_DeferedPlayDemo (char *demo);
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);
1129 void G_SaveGame (int slot, char *description);
1130 // called by M_Responder
1132 void G_RecordDemo (skill_t skill, int numplayers, int episode
1133 , int map, char *name);
1134 // only called by startup code
1136 void G_PlayDemo (char *name);
1137 void G_TimeDemo (char *name);
1139 void G_TeleportNewMap(int map, int position);
1141 void G_Completed(int map, int position);
1142 //void G_ExitLevel (void);
1143 //void G_SecretExitLevel (void);
1145 void G_StartNewGame(skill_t skill);
1146 void G_StartNewInit(void);
1148 void G_WorldDone (void);
1150 void G_Ticker (void);
1151 boolean G_Responder (event_t *ev);
1153 void G_ScreenShot (void);
1159 #define HXS_VERSION_TEXT "HXS Ver 2.37"
1160 #define HXS_VERSION_TEXT_LENGTH 16
1161 #define HXS_DESCRIPTION_LENGTH 24
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);
1178 void P_Ticker (void);
1179 // called by C_Ticker
1180 // can call G_PlayerExited
1181 // carries out all thinking of monsters and players
1183 void P_SetupLevel (int episode, int map, int playermask, skill_t skill);
1184 // called by W_Ticker
1187 // called by startup code
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);
1215 extern boolean setsizeneeded;
1217 extern boolean BorderNeedRefresh;
1218 extern boolean BorderTopRefresh;
1220 extern int UpdateState;
1221 // define the different areas for the dirty map
1222 #define I_NOUPDATE 0
1223 #define I_FULLVIEW 1
1225 #define I_MESSAGES 4
1226 #define I_FULLSCRN 8
1228 void R_RenderPlayerView (player_t *player);
1229 // called by G_Drawer
1232 // called by startup code
1234 void R_DrawViewBorder (void);
1235 void R_DrawTopBorder (void);
1236 // if the view size is not full screen, draws a border around it
1238 void R_SetViewSize (int blocks, int detail);
1239 // called by M_Responder
1241 int R_FlatNumForName (char *name);
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
1253 extern char **myargv;
1254 extern int localQuakeHappening[MAXPLAYERS];
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);
1260 void M_ExtractFileBase(char *path, char *dest);
1262 void M_ForceUppercase(char *text);
1263 // Changes a string to uppercase
1265 int M_Random (void);
1266 // returns a number from 0 to 255
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
1273 void M_ClearRandom (void);
1274 // fix randoms for demos
1276 void M_FindResponseFile(void);
1278 void M_ClearBox (fixed_t *box);
1279 void M_AddToBox (fixed_t *box, fixed_t x, fixed_t y);
1280 // bounding box functions
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);
1286 void M_ScreenShot (void);
1288 void M_LoadDefaults(char *fileName);
1290 void M_SaveDefaults (void);
1292 int M_DrawText (int x, int y, boolean direct, char *string);
1294 //------------------------------
1296 //------------------------------
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);
1315 extern char *sc_String;
1316 extern int sc_Number;
1318 extern boolean sc_End;
1319 extern boolean sc_Crossed;
1320 extern boolean sc_FileScripts;
1321 extern char *sc_ScriptsDir;
1323 //------------------------------
1325 //------------------------------
1330 SEQ_PLATFORM_HEAVY, // same script as a normal platform
1332 SEQ_PLATFORM_CREAK, // same script as a normal platform
1333 SEQ_PLATFORM_SILENCE,
1338 SEQ_PLATFORM_METAL2,
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);
1379 typedef struct seqnode_s seqnode_t;
1393 extern int ActiveSequences;
1394 extern seqnode_t *SequenceListHead;
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 //----------------------
1406 #define MAX_INTRMSN_MESSAGE_SIZE 1024
1408 extern boolean intermission;
1409 extern char ClusterMessage[MAX_INTRMSN_MESSAGE_SIZE];
1411 void IN_Start(void);
1412 void IN_Ticker(void);
1413 void IN_Drawer(void);
1415 //----------------------
1416 // Chat mode (CT_chat.c)
1417 //----------------------
1420 void CT_Drawer(void);
1421 boolean CT_Responder(event_t *ev);
1422 void CT_Ticker(void);
1423 char CT_dequeueChatChar(void);
1425 extern boolean chatmodeon;
1427 //--------------------
1428 // Finale (F_finale.c)
1429 //--------------------
1431 void F_Drawer(void);
1432 void F_Ticker(void);
1433 void F_StartFinale(void);
1435 //----------------------
1436 // STATUS BAR (SB_bar.c)
1437 //----------------------
1441 extern int SB_state;
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);
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);
1471 extern int dirtybox[4];
1472 extern byte gammatable[5][256];
1473 extern int usegamma;
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);
1485 #define FIX2FLT(x) ((float)((x)>>FRACBITS) + (float)((x)&(FRACUNIT-1)) / (float)(FRACUNIT))
1486 #define Q_FIX2FLT(x) ((float)((x)>>FRACBITS))