📄 h2def.h
字号:
NUMARMOR} armortype_t;typedef enum{ WP_FIRST, WP_SECOND, WP_THIRD, WP_FOURTH, NUMWEAPONS, WP_NOCHANGE} weapontype_t; typedef enum{ MANA_1, MANA_2, NUMMANA, MANA_BOTH, MANA_NONE} manatype_t;#define MAX_MANA 200#define WPIECE1 1#define WPIECE2 2#define WPIECE3 4typedef struct{ manatype_t mana; int upstate; int downstate; int readystate; int atkstate; int holdatkstate; int flashstate;} weaponinfo_t;extern weaponinfo_t WeaponInfo[NUMWEAPONS][NUMCLASSES];typedef enum{ arti_none, arti_invulnerability, arti_health, arti_superhealth, arti_healingradius, arti_summon, arti_torch, arti_egg, arti_fly, arti_blastradius, arti_poisonbag, arti_teleportother, arti_speed, arti_boostmana, arti_boostarmor, arti_teleport, // Puzzle artifacts arti_firstpuzzitem, arti_puzzskull = arti_firstpuzzitem, arti_puzzgembig, arti_puzzgemred, arti_puzzgemgreen1, arti_puzzgemgreen2, arti_puzzgemblue1, arti_puzzgemblue2, arti_puzzbook1, arti_puzzbook2, arti_puzzskull2, arti_puzzfweapon, arti_puzzcweapon, arti_puzzmweapon, arti_puzzgear1, arti_puzzgear2, arti_puzzgear3, arti_puzzgear4, NUMARTIFACTS} artitype_t;typedef enum{ pw_None, pw_invulnerability, pw_allmap, pw_infrared, pw_flight, pw_shield, pw_health2, pw_speed, pw_minotaur, NUMPOWERS} powertype_t;#define INVULNTICS (30*35)#define INVISTICS (60*35)#define INFRATICS (120*35)#define IRONTICS (60*35)#define WPNLEV2TICS (40*35)#define FLIGHTTICS (60*35)#define SPEEDTICS (45*35)#define MORPHTICS (40*35)#define MAULATORTICS (25*35)#define MESSAGETICS (4*35)#define BLINKTHRESHOLD (4*35)#define NUMINVENTORYSLOTS NUMARTIFACTStypedef struct{ int type; int count;} inventory_t;/*================== player_t=================*/typedef struct player_s{ mobj_t *mo; playerstate_t playerstate; ticcmd_t cmd; pclass_t class; // player class type fixed_t viewz; // focal origin above r.z fixed_t viewheight; // base height above floor for viewz fixed_t deltaviewheight; // squat speed fixed_t bob; // bounded/scaled total momentum int flyheight; int lookdir; boolean centering; int health; // only used between levels, mo->health // is used during levels int armorpoints[NUMARMOR]; inventory_t inventory[NUMINVENTORYSLOTS]; artitype_t readyArtifact; int artifactCount; int inventorySlotNum; int powers[NUMPOWERS]; int keys; int pieces; // Fourth Weapon pieces signed int frags[MAXPLAYERS]; // kills of other players weapontype_t readyweapon; weapontype_t pendingweapon; // wp_nochange if not changing boolean weaponowned[NUMWEAPONS]; int mana[NUMMANA]; int attackdown, usedown; // true if button down last tic int cheats; // bit flags int refire; // refired shots are less accurate int killcount, itemcount, secretcount; // for intermission char message[80]; // hint messages int messageTics; // counter for showing messages short ultimateMessage; short yellowMessage; int damagecount, bonuscount;// for screen flashing int poisoncount; // screen flash for poison damage mobj_t *poisoner; // NULL for non-player mobjs mobj_t *attacker; // who did damage (NULL for floors) int extralight; // so gun flashes light up areas int fixedcolormap; // can be set to REDCOLORMAP, etc int colormap; // 0-3 for which color to draw player pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc) int morphTics; // player is a pig if > 0 uint jumpTics; // delay the next jump for a moment unsigned int worldTimer; // total time the player's been playing} player_t;#define CF_NOCLIP 1#define CF_GODMODE 2#define CF_NOMOMENTUM 4 // not really a cheat, just a debug aid#define BACKUPTICS 12typedef struct{ unsigned checksum; // high bit is retransmit request byte retransmitfrom; // only valid if NCMD_RETRANSMIT byte starttic; byte player, numtics; ticcmd_t cmds[BACKUPTICS];} doomdata_t;
typedef struct
{
long id;
short intnum; // DOOM executes an int to execute commands
// communication between DOOM and the driver
short command; // CMD_SEND or CMD_GET
short remotenode; // dest for send, set by get (-1 = no packet)
short datalength; // bytes in doomdata to be sent
// info common to all nodes
short numnodes; // console is allways node 0
short ticdup; // 1 = no duplication, 2-5 = dup for slow nets
short extratics; // 1 = send a backup tic in every packet
short deathmatch; // 1 = deathmatch
short savegame; // -1 = new game, 0-5 = load savegame
short episode; // 1-3
short map; // 1-9
short skill; // 1-5
// info specific to this node
short consoleplayer;
short numplayers;
short angleoffset; // 1 = left, 0 = center, -1 = right
short drone; // 1 = drone
// packet data to be sent
doomdata_t data;
} doomcom_t;
#define DOOMCOM_ID 0x12345678l
extern doomcom_t *doomcom;extern doomdata_t *netbuffer; // points inside doomcom#define MAXNETNODES 16 // max computers in a game
#define CMD_SEND 1
#define CMD_GET 2
#define CMD_FRAG 3#define SBARHEIGHT 39 // status bar height at bottom of screenvoid NET_SendFrags(player_t *player);/*=============================================================================== GLOBAL VARIABLES===============================================================================*/#define TELEFOGHEIGHT (32*FRACUNIT)#define MAXEVENTS 64extern event_t events[MAXEVENTS];extern int eventhead;extern int eventtail;extern fixed_t finesine[5*FINEANGLES/4];extern fixed_t *finecosine;extern gameaction_t gameaction;extern boolean paused;extern boolean shareware; // true if other episodes not presentextern boolean DevMaps; // true = map development modeextern char *DevMapsDir; // development maps directoryextern boolean nomonsters; // checkparm of -nomonstersextern boolean respawnparm; // checkparm of -respawnextern boolean randomclass; // checkparm of -randclassextern boolean debugmode; // checkparm of -debugextern boolean usergame; // ok to save / end gameextern boolean ravpic; // checkparm of -ravpicextern boolean altpal; // checkparm to use an alternate palette routineextern boolean cdrom; // true if cd-rom mode active ("-cdrom")extern boolean deathmatch; // only if started as net deathextern boolean netgame; // only true if >1 playerextern boolean cmdfrag; // true if a CMD_FRAG packet should be sent out every // killextern boolean playeringame[MAXPLAYERS];extern pclass_t PlayerClass[MAXPLAYERS];extern int consoleplayer; // player taking events and displayingextern int displayplayer;extern int viewangleoffset; // ANG90 = left side, ANG270 = rightextern player_t players[MAXPLAYERS];extern boolean singletics; // debug flag to cancel adaptivenessextern boolean DebugSound; // debug flag for displaying sound infoextern boolean demoplayback;extern int maxzone; // Maximum chunk allocated for zone heapextern int Sky1Texture;extern int Sky2Texture;extern gamestate_t gamestate;extern skill_t gameskill;//extern boolean respawnmonsters;extern int gameepisode;extern int gamemap;extern int prevmap;extern int levelstarttic; // gametic at level startextern int leveltime; // tics in game play for parextern ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];extern int ticdup;//#define MAXNETNODES 8extern ticcmd_t localcmds[BACKUPTICS];extern int rndindex;extern int gametic, maketic;extern int nettics[MAXNETNODES];#define MAXDEATHMATCHSTARTS 16extern mapthing_t *deathmatch_p;extern mapthing_t deathmatchstarts[MAXDEATHMATCHSTARTS];// Position indicator for cooperative net-play rebornextern int RebornPosition;#define MAX_PLAYER_STARTS 8extern mapthing_t playerstarts[MAX_PLAYER_STARTS][MAXPLAYERS];extern int viewwindowx;extern int viewwindowy;extern int viewwidth;extern int scaledviewwidth;extern int viewheight;extern int mouseSensitivity;extern boolean precache; // if true, load all graphics at level loadextern byte *screen; // off screen work buffer, from V_video.cextern boolean singledemo; // quit after playing a demo from cmdlineextern FILE *debugfile;extern int bodyqueslot;extern skill_t startskill;extern int startepisode;extern int startmap;extern boolean autostart;/*=============================================================================== GLOBAL FUNCTIONS===============================================================================*/fixed_t FixedMul (fixed_t a, fixed_t b);fixed_t FixedDiv (fixed_t a, fixed_t b);fixed_t FixedDiv2 (fixed_t a, fixed_t b);#ifdef __WATCOMC__#pragma aux FixedMul = \ "imul ebx", \ "shrd eax,edx,16" \ parm [eax] [ebx] \ value [eax] \ modify exact [eax edx]#pragma aux FixedDiv2 = \ "cdq", \ "shld edx,eax,16", \ "sal eax,16", \ "idiv ebx" \ parm [eax] [ebx] \ value [eax] \ modify exact [eax edx]#endif#ifdef __BIG_ENDIAN__short ShortSwap(short);long LongSwap(long);#define SHORT(x) ShortSwap(x)#define LONG(x) LongSwap(x)#else#define SHORT(x) (x)#define LONG(x) (x)#endif//-----------//MEMORY ZONE//-----------// tags < 100 are not overwritten until freed#define PU_STATIC 1 // static entire execution time#define PU_SOUND 2 // static while playing#define PU_MUSIC 3 // static while playing#define PU_DAVE 4 // anything else Dave wants static#define PU_LEVEL 50 // static until level exited#define PU_LEVSPEC 51 // a special thinker in a level// tags >= 100 are purgable whenever needed#define PU_PURGELEVEL 100#define PU_CACHE 101void Z_Init (void);void *Z_Malloc (int size, int tag, void *ptr);void Z_Free (void *ptr);void Z_FreeTags (int lowtag, int hightag);//void Z_DumpHeap (int lowtag, int hightag);//void Z_FileDumpHeap (FILE *f);void Z_CheckHeap (void);void Z_ChangeTag2 (void *ptr, int tag);//int Z_FreeMemory (void);typedef struct memblock_s{ int size; // including the header and possibly tiny fragments void **user; // NULL if a free block int tag; // purgelevel int id; // should be ZONEID struct memblock_s *next, *prev;} memblock_t;#define Z_ChangeTag(p,t) \{ \if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \ I_Error("Z_CT at "__FILE__":%i",__LINE__); \Z_ChangeTag2(p,t); \};//-------//WADFILE//-------typedef struct{ char name[8]; int handle,position,size;} lumpinfo_t;extern lumpinfo_t *lumpinfo;extern int numlumps;void W_InitMultipleFiles(char **filenames);void W_OpenAuxiliary(char *filename);void W_CloseAuxiliaryFile(void);void W_CloseAuxiliary(void);void W_UsePrimary(void);void W_UseAuxiliary(void);int W_CheckNumForName(char *name);int W_GetNumForName(char *name);int W_LumpLength(int lump);void W_ReadLump(int lump, void *dest);void *W_CacheLumpNum(int lump, int tag);void *W_CacheLumpName(char *name, int tag);//----------//BASE LEVEL//----------void H2_Main(void);// not a globally visible function, just included for source reference// calls all startup code// parses command line options// if not overrided, calls N_AdvanceDemovoid H2_GameLoop(void);// not a globally visible function, just included for source reference// called by H2_Main, never exits// manages timing and IO// calls all ?_Responder, ?_Ticker, and ?_Drawer functions// calls I_GetTime, I_StartFrame, and I_StartTicvoid H2_PostEvent(event_t *ev);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -