From 3ebbe127d21a5a50cdbf4af89d8581f532b41aef Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Sat, 15 Oct 2011 09:00:10 +0000 Subject: [PATCH] Reformat headers. --- src/header/ctf.h | 169 ++--- src/header/game.h | 333 ++++----- src/header/local.h | 1718 +++++++++++++++++++++----------------------- src/header/menu.h | 62 +- 4 files changed, 1107 insertions(+), 1175 deletions(-) diff --git a/src/header/ctf.h b/src/header/ctf.h index c42a60c..0e8dd12 100644 --- a/src/header/ctf.h +++ b/src/header/ctf.h @@ -1,75 +1,84 @@ /* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * CTF specific stuff. + * + * ======================================================================= + */ #ifndef CTF_CTF_H #define CTF_CTF_H -#define CTF_VERSION 1.52 -#define CTF_VSTRING2(x) #x +#define CTF_VERSION 1.52 +#define CTF_VSTRING2(x) # x #define CTF_VSTRING(x) CTF_VSTRING2(x) -#define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION) +#define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION) -#define STAT_CTF_TEAM1_PIC 17 -#define STAT_CTF_TEAM1_CAPS 18 -#define STAT_CTF_TEAM2_PIC 19 -#define STAT_CTF_TEAM2_CAPS 20 -#define STAT_CTF_FLAG_PIC 21 -#define STAT_CTF_JOINED_TEAM1_PIC 22 -#define STAT_CTF_JOINED_TEAM2_PIC 23 -#define STAT_CTF_TEAM1_HEADER 24 -#define STAT_CTF_TEAM2_HEADER 25 -#define STAT_CTF_TECH 26 -#define STAT_CTF_ID_VIEW 27 -#define STAT_CTF_MATCH 28 -#define STAT_CTF_ID_VIEW_COLOR 29 -#define STAT_CTF_TEAMINFO 30 +#define STAT_CTF_TEAM1_PIC 17 +#define STAT_CTF_TEAM1_CAPS 18 +#define STAT_CTF_TEAM2_PIC 19 +#define STAT_CTF_TEAM2_CAPS 20 +#define STAT_CTF_FLAG_PIC 21 +#define STAT_CTF_JOINED_TEAM1_PIC 22 +#define STAT_CTF_JOINED_TEAM2_PIC 23 +#define STAT_CTF_TEAM1_HEADER 24 +#define STAT_CTF_TEAM2_HEADER 25 +#define STAT_CTF_TECH 26 +#define STAT_CTF_ID_VIEW 27 +#define STAT_CTF_MATCH 28 +#define STAT_CTF_ID_VIEW_COLOR 29 +#define STAT_CTF_TEAMINFO 30 -#define CONFIG_CTF_MATCH (CS_AIRACCEL-1) -#define CONFIG_CTF_TEAMINFO (CS_AIRACCEL-2) +#define CONFIG_CTF_MATCH (CS_AIRACCEL - 1) +#define CONFIG_CTF_TEAMINFO (CS_AIRACCEL - 2) -typedef enum { +typedef enum +{ CTF_NOTEAM, CTF_TEAM1, CTF_TEAM2 } ctfteam_t; -typedef enum { +typedef enum +{ CTF_GRAPPLE_STATE_FLY, CTF_GRAPPLE_STATE_PULL, CTF_GRAPPLE_STATE_HANG } ctfgrapplestate_t; -typedef struct ghost_s { +typedef struct ghost_s +{ char netname[16]; int number; - // stats + /* stats */ int deaths; int kills; int caps; int basedef; int carrierdef; - int code; // ghost code - int team; // team - int score; // frags at time of disconnect + int code; /* ghost code */ + int team; /* team */ + int score; /* frags at time of disconnect */ edict_t *ent; } ghost_t; @@ -78,36 +87,36 @@ extern cvar_t *ctf; #define CTF_TEAM1_SKIN "ctf_r" #define CTF_TEAM2_SKIN "ctf_b" -#define DF_CTF_FORCEJOIN 131072 -#define DF_ARMOR_PROTECT 262144 -#define DF_CTF_NO_TECH 524288 +#define DF_CTF_FORCEJOIN 131072 +#define DF_ARMOR_PROTECT 262144 +#define DF_CTF_NO_TECH 524288 -#define CTF_CAPTURE_BONUS 15 // what you get for capture -#define CTF_TEAM_BONUS 10 // what your team gets for capture -#define CTF_RECOVERY_BONUS 1 // what you get for recovery -#define CTF_FLAG_BONUS 0 // what you get for picking up enemy flag -#define CTF_FRAG_CARRIER_BONUS 2 // what you get for fragging enemy flag carrier -#define CTF_FLAG_RETURN_TIME 40 // seconds until auto return +#define CTF_CAPTURE_BONUS 15 /* what you get for capture */ +#define CTF_TEAM_BONUS 10 /* what your team gets for capture */ +#define CTF_RECOVERY_BONUS 1 /* what you get for recovery */ +#define CTF_FLAG_BONUS 0 /* what you get for picking up enemy flag */ +#define CTF_FRAG_CARRIER_BONUS 2 /* what you get for fragging enemy flag carrier */ +#define CTF_FLAG_RETURN_TIME 40 /* seconds until auto return */ -#define CTF_CARRIER_DANGER_PROTECT_BONUS 2 // bonus for fraggin someone who has recently hurt your flag carrier -#define CTF_CARRIER_PROTECT_BONUS 1 // bonus for fraggin someone while either you or your target are near your flag carrier -#define CTF_FLAG_DEFENSE_BONUS 1 // bonus for fraggin someone while either you or your target are near your flag -#define CTF_RETURN_FLAG_ASSIST_BONUS 1 // awarded for returning a flag that causes a capture to happen almost immediately -#define CTF_FRAG_CARRIER_ASSIST_BONUS 2 // award for fragging a flag carrier if a capture happens almost immediately +#define CTF_CARRIER_DANGER_PROTECT_BONUS 2 /* bonus for fraggin someone who has recently hurt your flag carrier */ +#define CTF_CARRIER_PROTECT_BONUS 1 /* bonus for fraggin someone while either you or your target are near your flag carrier */ +#define CTF_FLAG_DEFENSE_BONUS 1 /* bonus for fraggin someone while either you or your target are near your flag */ +#define CTF_RETURN_FLAG_ASSIST_BONUS 1 /* awarded for returning a flag that causes a capture to happen almost immediately */ +#define CTF_FRAG_CARRIER_ASSIST_BONUS 2 /* award for fragging a flag carrier if a capture happens almost immediately */ -#define CTF_TARGET_PROTECT_RADIUS 400 // the radius around an object being defended where a target will be worth extra frags -#define CTF_ATTACKER_PROTECT_RADIUS 400 // the radius around an object being defended where an attacker will get extra frags when making kills +#define CTF_TARGET_PROTECT_RADIUS 400 /* the radius around an object being defended where a target will be worth extra frags */ +#define CTF_ATTACKER_PROTECT_RADIUS 400 /* the radius around an object being defended where an attacker will get extra frags when making kills */ -#define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8 -#define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10 -#define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10 +#define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8 +#define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10 +#define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10 -#define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 // number of seconds before dropped flag auto-returns +#define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 /* number of seconds before dropped flag auto-returns */ -#define CTF_TECH_TIMEOUT 60 // seconds before techs spawn again +#define CTF_TECH_TIMEOUT 60 /* seconds before techs spawn again */ -#define CTF_GRAPPLE_SPEED 650 // speed of grapple in flight -#define CTF_GRAPPLE_PULL_SPEED 650 // speed player is pulled at +#define CTF_GRAPPLE_SPEED 650 /* speed of grapple in flight */ +#define CTF_GRAPPLE_PULL_SPEED 650 /* speed player is pulled at */ void CTFInit(void); void CTFSpawn(void); @@ -120,31 +129,31 @@ char *CTFTeamName(int team); char *CTFOtherTeamName(int team); void CTFAssignSkin(edict_t *ent, char *s); void CTFAssignTeam(gclient_t *who); -edict_t *SelectCTFSpawnPoint (edict_t *ent); +edict_t *SelectCTFSpawnPoint(edict_t *ent); qboolean CTFPickup_Flag(edict_t *ent, edict_t *other); void CTFDrop_Flag(edict_t *ent, gitem_t *item); void CTFEffects(edict_t *player); void CTFCalcScores(void); void SetCTFStats(edict_t *ent); void CTFDeadDropFlag(edict_t *self); -void CTFScoreboardMessage (edict_t *ent, edict_t *killer); -void CTFTeam_f (edict_t *ent); -void CTFID_f (edict_t *ent); +void CTFScoreboardMessage(edict_t *ent, edict_t *killer); +void CTFTeam_f(edict_t *ent); +void CTFID_f(edict_t *ent); void CTFSay_Team(edict_t *who, char *msg); -void CTFFlagSetup (edict_t *ent); +void CTFFlagSetup(edict_t *ent); void CTFResetFlag(int ctf_team); void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker); void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker); -// GRAPPLE -void CTFWeapon_Grapple (edict_t *ent); +/* GRAPPLE */ +void CTFWeapon_Grapple(edict_t *ent); void CTFPlayerResetGrapple(edict_t *ent); void CTFGrapplePull(edict_t *self); void CTFResetGrapple(edict_t *self); -//TECH +/* TECH */ gitem_t *CTFWhat_Tech(edict_t *ent); -qboolean CTFPickup_Tech (edict_t *ent, edict_t *other); +qboolean CTFPickup_Tech(edict_t *ent, edict_t *other); void CTFDrop_Tech(edict_t *ent, gitem_t *item); void CTFDeadDropTech(edict_t *ent); void CTFSetupTechSpawn(void); @@ -177,8 +186,8 @@ void CTFPlayerList(edict_t *ent); qboolean CTFCheckRules(void); -void SP_misc_ctf_banner (edict_t *ent); -void SP_misc_ctf_small_banner (edict_t *ent); +void SP_misc_ctf_banner(edict_t *ent); +void SP_misc_ctf_small_banner(edict_t *ent); extern char *ctf_statusbar; @@ -188,8 +197,8 @@ void ChasePrev(edict_t *ent); void CTFObserver(edict_t *ent); -void SP_trigger_teleport (edict_t *ent); -void SP_info_teleport_destination (edict_t *ent); +void SP_trigger_teleport(edict_t *ent); +void SP_info_teleport_destination(edict_t *ent); void CTFSetPowerUpEffect(edict_t *ent, int def); diff --git a/src/header/game.h b/src/header/game.h index 0a64f7a..01b8b70 100644 --- a/src/header/game.h +++ b/src/header/game.h @@ -1,248 +1,215 @@ /* -Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * Here are the client, server and game are tied together. + * + * ======================================================================= + */ -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * THIS FILE IS _VERY_ FRAGILE AND THERE'S NOTHING IN IT THAT CAN OR + * MUST BE CHANGED. IT'S MOST LIKELY A VERY GOOD IDEA TO CLOSE THE + * EDITOR NOW AND NEVER LOOK BACK. OTHERWISE YOU MAY SCREW UP EVERYTHING! + * + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ #ifndef CTF_GAME_H #define CTF_GAME_H -// game.h -- game dll information visible to server +#define GAME_API_VERSION 3 -#define GAME_API_VERSION 3 - -// edict->svflags - -#define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects -#define SVF_DEADMONSTER 0x00000002 // treat as CONTENTS_DEADMONSTER for collision -#define SVF_MONSTER 0x00000004 // treat as CONTENTS_MONSTER for collision -//ZOID -#define SVF_PROJECTILE 0x00000008 // entity is simple projectile, used for network optimization -// if an entity is projectile, the model index/x/y/z/pitch/yaw are sent, encoded into -// seven (or eight) bytes. This is to speed up projectiles. Currently, only the -// hyperblaster makes use of this. use for items that are moving with a constant -// velocity that don't change direction or model -//ZOID - -// edict->solid values +/* edict->svflags */ +#define SVF_NOCLIENT 0x00000001 /* don't send entity to clients, even if it has effects */ +#define SVF_DEADMONSTER 0x00000002 /* treat as CONTENTS_DEADMONSTER for collision */ +#define SVF_MONSTER 0x00000004 /* treat as CONTENTS_MONSTER for collision */ +#define SVF_PROJECTILE 0x00000008 /* entity is simple projectile, used for network optimization */ +/* edict->solid values */ typedef enum { -SOLID_NOT, // no interaction with other objects -SOLID_TRIGGER, // only touch when inside, after moving -SOLID_BBOX, // touch on edge -SOLID_BSP // bsp clip, touch on edge + SOLID_NOT, /* no interaction with other objects */ + SOLID_TRIGGER, /* only touch when inside, after moving */ + SOLID_BBOX, /* touch on edge */ + SOLID_BSP /* bsp clip, touch on edge */ } solid_t; -//=============================================================== +/* =============================================================== */ -// link_t is only used for entity area links now +/* link_t is only used for entity area links now */ typedef struct link_s { - struct link_s *prev, *next; + struct link_s *prev, *next; } link_t; -#define MAX_ENT_CLUSTERS 16 - +#define MAX_ENT_CLUSTERS 16 typedef struct edict_s edict_t; typedef struct gclient_s gclient_t; - #ifndef GAME_INCLUDE struct gclient_s { - player_state_t ps; // communicated by server to clients - int ping; - // the game dll can add anything it wants after - // this point in the structure + player_state_t ps; /* communicated by server to clients */ + int ping; + /* the game dll can add anything it wants after */ + /* this point in the structure */ }; - struct edict_s { - entity_state_t s; - struct gclient_s *client; - qboolean inuse; - int linkcount; + entity_state_t s; + struct gclient_s *client; + qboolean inuse; + int linkcount; - // FIXME: move these fields to a server private sv_entity_t - link_t area; // linked to a division node or leaf - - int num_clusters; // if -1, use headnode instead - int clusternums[MAX_ENT_CLUSTERS]; - int headnode; // unused if num_clusters != -1 - int areanum, areanum2; + link_t area; /* linked to a division node or leaf */ - //================================ + int num_clusters; /* if -1, use headnode instead */ + int clusternums[MAX_ENT_CLUSTERS]; + int headnode; /* unused if num_clusters != -1 */ + int areanum, areanum2; - int svflags; // SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc - vec3_t mins, maxs; - vec3_t absmin, absmax, size; - solid_t solid; - int clipmask; - edict_t *owner; + /* ================================ */ - // the game dll can add anything it wants after - // this point in the structure + int svflags; /* SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc */ + vec3_t mins, maxs; + vec3_t absmin, absmax, size; + solid_t solid; + int clipmask; + edict_t *owner; }; -#endif // GAME_INCLUDE +#endif /* GAME_INCLUDE */ -//=============================================================== +/* =============================================================== */ -// -// functions provided by the main engine -// +/* functions provided by the main engine */ typedef struct { - // special messages - void (*bprintf) (int printlevel, char *fmt, ...); - void (*dprintf) (char *fmt, ...); - void (*cprintf) (edict_t *ent, int printlevel, char *fmt, ...); - void (*centerprintf) (edict_t *ent, char *fmt, ...); - void (*sound) (edict_t *ent, int channel, int soundindex, float volume, float attenuation, float timeofs); - void (*positioned_sound) (vec3_t origin, edict_t *ent, int channel, int soundinedex, float volume, float attenuation, float timeofs); + /* special messages */ + void (*bprintf)(int printlevel, char *fmt, ...); + void (*dprintf)(char *fmt, ...); + void (*cprintf)(edict_t *ent, int printlevel, char *fmt, ...); + void (*centerprintf)(edict_t *ent, char *fmt, ...); + void (*sound)(edict_t *ent, int channel, int soundindex, float volume, + float attenuation, float timeofs); + void (*positioned_sound)(vec3_t origin, edict_t *ent, int channel, + int soundinedex, float volume, float attenuation, float timeofs); - // config strings hold all the index strings, the lightstyles, - // and misc data like the sky definition and cdtrack. - // All of the current configstrings are sent to clients when - // they connect, and changes are sent to all connected clients. - void (*configstring) (int num, char *string); + void (*configstring)(int num, char *string); - void (*error) (char *fmt, ...); + void (*error)(char *fmt, ...); - // the *index functions create configstrings and some internal server state - int (*modelindex) (char *name); - int (*soundindex) (char *name); - int (*imageindex) (char *name); + /* the *index functions create configstrings and some internal server state */ + int (*modelindex)(char *name); + int (*soundindex)(char *name); + int (*imageindex)(char *name); - void (*setmodel) (edict_t *ent, char *name); + void (*setmodel)(edict_t *ent, char *name); - // collision detection - trace_t (*trace) (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passent, int contentmask); - int (*pointcontents) (vec3_t point); - qboolean (*inPVS) (vec3_t p1, vec3_t p2); - qboolean (*inPHS) (vec3_t p1, vec3_t p2); - void (*SetAreaPortalState) (int portalnum, qboolean open); - qboolean (*AreasConnected) (int area1, int area2); + /* collision detection */ + trace_t (*trace)(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, + edict_t *passent, int contentmask); + int (*pointcontents)(vec3_t point); + qboolean (*inPVS)(vec3_t p1, vec3_t p2); + qboolean (*inPHS)(vec3_t p1, vec3_t p2); + void (*SetAreaPortalState)(int portalnum, qboolean open); + qboolean (*AreasConnected)(int area1, int area2); - // an entity will never be sent to a client or used for collision - // if it is not passed to linkentity. If the size, position, or - // solidity changes, it must be relinked. - void (*linkentity) (edict_t *ent); - void (*unlinkentity) (edict_t *ent); // call before removing an interactive edict - int (*BoxEdicts) (vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype); - void (*Pmove) (pmove_t *pmove); // player movement code common with client prediction + void (*linkentity)(edict_t *ent); + void (*unlinkentity)(edict_t *ent); /* call before removing an interactive edict */ + int (*BoxEdicts)(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, + int areatype); + void (*Pmove)(pmove_t *pmove); /* player movement code common with client prediction */ - // network messaging - void (*multicast) (vec3_t origin, multicast_t to); - void (*unicast) (edict_t *ent, qboolean reliable); - void (*WriteChar) (int c); - void (*WriteByte) (int c); - void (*WriteShort) (int c); - void (*WriteLong) (int c); - void (*WriteFloat) (float f); - void (*WriteString) (char *s); - void (*WritePosition) (vec3_t pos); // some fractional bits - void (*WriteDir) (vec3_t pos); // single byte encoded, very coarse - void (*WriteAngle) (float f); + /* network messaging */ + void (*multicast)(vec3_t origin, multicast_t to); + void (*unicast)(edict_t *ent, qboolean reliable); + void (*WriteChar)(int c); + void (*WriteByte)(int c); + void (*WriteShort)(int c); + void (*WriteLong)(int c); + void (*WriteFloat)(float f); + void (*WriteString)(char *s); + void (*WritePosition)(vec3_t pos); /* some fractional bits */ + void (*WriteDir)(vec3_t pos); /* single byte encoded, very coarse */ + void (*WriteAngle)(float f); - // managed memory allocation - void *(*TagMalloc) (int size, int tag); - void (*TagFree) (void *block); - void (*FreeTags) (int tag); + /* managed memory allocation */ + void *(*TagMalloc)(int size, int tag); + void (*TagFree)(void *block); + void (*FreeTags)(int tag); - // console variable interaction - cvar_t *(*cvar) (char *var_name, char *value, int flags); - cvar_t *(*cvar_set) (char *var_name, char *value); - cvar_t *(*cvar_forceset) (char *var_name, char *value); + /* console variable interaction */ + cvar_t *(*cvar)(char *var_name, char *value, int flags); + cvar_t *(*cvar_set)(char *var_name, char *value); + cvar_t *(*cvar_forceset)(char *var_name, char *value); - // ClientCommand and ServerCommand parameter access - int (*argc) (void); - char *(*argv) (int n); - char *(*args) (void); // concatenation of all argv >= 1 + /* ClientCommand and ServerCommand parameter access */ + int (*argc)(void); + char *(*argv)(int n); + char *(*args)(void); /* concatenation of all argv >= 1 */ - // add commands to the server console as if they were typed in - // for map changing, etc - void (*AddCommandString) (char *text); - - void (*DebugGraph) (float value, int color); + void (*AddCommandString)(char *text); + void (*DebugGraph)(float value, int color); } game_import_t; -// -// functions exported by the game subsystem -// +/* functions exported by the game subsystem */ typedef struct { - int apiversion; + int apiversion; - // the init function will only be called when a game starts, - // not each time a level is loaded. Persistant data for clients - // and the server can be allocated in init - void (*Init) (void); - void (*Shutdown) (void); + void (*Init)(void); + void (*Shutdown)(void); - // each new level entered will cause a call to SpawnEntities - void (*SpawnEntities) (char *mapname, char *entstring, char *spawnpoint); + /* each new level entered will cause a call to SpawnEntities */ + void (*SpawnEntities)(char *mapname, char *entstring, char *spawnpoint); - // Read/Write Game is for storing persistant cross level information - // about the world state and the clients. - // WriteGame is called every time a level is exited. - // ReadGame is called on a loadgame. - void (*WriteGame) (char *filename, qboolean autosave); - void (*ReadGame) (char *filename); + void (*WriteGame)(char *filename, qboolean autosave); + void (*ReadGame)(char *filename); + void (*WriteLevel)(char *filename); + void (*ReadLevel)(char *filename); - // ReadLevel is called after the default map information has been - // loaded with SpawnEntities - void (*WriteLevel) (char *filename); - void (*ReadLevel) (char *filename); + qboolean (*ClientConnect)(edict_t *ent, char *userinfo); + void (*ClientBegin)(edict_t *ent); + void (*ClientUserinfoChanged)(edict_t *ent, char *userinfo); + void (*ClientDisconnect)(edict_t *ent); + void (*ClientCommand)(edict_t *ent); + void (*ClientThink)(edict_t *ent, usercmd_t *cmd); - qboolean (*ClientConnect) (edict_t *ent, char *userinfo); - void (*ClientBegin) (edict_t *ent); - void (*ClientUserinfoChanged) (edict_t *ent, char *userinfo); - void (*ClientDisconnect) (edict_t *ent); - void (*ClientCommand) (edict_t *ent); - void (*ClientThink) (edict_t *ent, usercmd_t *cmd); + void (*RunFrame)(void); + void (*ServerCommand)(void); - void (*RunFrame) (void); - - // ServerCommand will be called when an "sv " command is issued on the - // server console. - // The game can issue gi.argc() / gi.argv() commands to get the rest - // of the parameters - void (*ServerCommand) (void); - - // - // global variables shared between game and server - // - - // The edict array is allocated in the game dll so it - // can vary in size from one game to another. - // - // The size will be fixed when ge->Init() is called - struct edict_s *edicts; - int edict_size; - int num_edicts; // current number, <= max_edicts - int max_edicts; + /* global variables shared between game and server */ + struct edict_s *edicts; + int edict_size; + int num_edicts; /* current number, <= max_edicts */ + int max_edicts; } game_export_t; -game_export_t *GetGameApi (game_import_t *import); +game_export_t *GetGameApi(game_import_t *import); #endif /* CTF_GAME_H */ diff --git a/src/header/local.h b/src/header/local.h index c5116dd..e34f77f 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -1,102 +1,100 @@ /* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -// g_local.h -- local definitions for game module + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * Main header file for the game module. + * + * ======================================================================= + */ #ifndef CTF_LOCAL_H #define CTF_LOCAL_H #include "shared.h" -// define GAME_INCLUDE so that game.h does not define the -// short, server-visible gclient_t and edict_t structures, -// because we define the full size ones in this file -#define GAME_INCLUDE +/* define GAME_INCLUDE so that game.h does not define the + short, server-visible gclient_t and edict_t structures, + because we define the full size ones in this file */ +#define GAME_INCLUDE #include "game.h" - -//ZOID #include "menu.h" -//ZOID -// the "gameversion" client command will print this plus compile date -#define GAMEVERSION "ctf" +/* the "gameversion" client command will print this plus compile date */ +#define GAMEVERSION "ctf" -// protocol bytes that can be directly added to messages -#define svc_muzzleflash 1 -#define svc_muzzleflash2 2 -#define svc_temp_entity 3 -#define svc_layout 4 -#define svc_inventory 5 +/* protocol bytes that can be directly added to messages */ +#define svc_muzzleflash 1 +#define svc_muzzleflash2 2 +#define svc_temp_entity 3 +#define svc_layout 4 +#define svc_inventory 5 -//================================================================== +/* ================================================================== */ -// view pitching times -#define DAMAGE_TIME 0.5 -#define FALL_TIME 0.3 +/* view pitching times */ +#define DAMAGE_TIME 0.5 +#define FALL_TIME 0.3 +/* edict->spawnflags */ +#define SPAWNFLAG_NOT_EASY 0x00000100 +#define SPAWNFLAG_NOT_MEDIUM 0x00000200 +#define SPAWNFLAG_NOT_HARD 0x00000400 +#define SPAWNFLAG_NOT_DEATHMATCH 0x00000800 +#define SPAWNFLAG_NOT_COOP 0x00001000 -// edict->spawnflags -// these are set with checkboxes on each entity in the map editor -#define SPAWNFLAG_NOT_EASY 0x00000100 -#define SPAWNFLAG_NOT_MEDIUM 0x00000200 -#define SPAWNFLAG_NOT_HARD 0x00000400 -#define SPAWNFLAG_NOT_DEATHMATCH 0x00000800 -#define SPAWNFLAG_NOT_COOP 0x00001000 +/* edict->flags */ +#define FL_FLY 0x00000001 +#define FL_SWIM 0x00000002 /* implied immunity to drowining */ +#define FL_IMMUNE_LASER 0x00000004 +#define FL_INWATER 0x00000008 +#define FL_GODMODE 0x00000010 +#define FL_NOTARGET 0x00000020 +#define FL_IMMUNE_SLIME 0x00000040 +#define FL_IMMUNE_LAVA 0x00000080 +#define FL_PARTIALGROUND 0x00000100 /* not all corners are valid */ +#define FL_WATERJUMP 0x00000200 /* player jumping out of water */ +#define FL_TEAMSLAVE 0x00000400 /* not the first on the team */ +#define FL_NO_KNOCKBACK 0x00000800 +#define FL_POWER_ARMOR 0x00001000 /* power armor (if any) is active */ +#define FL_RESPAWN 0x80000000 /* used for item respawning */ -// edict->flags -#define FL_FLY 0x00000001 -#define FL_SWIM 0x00000002 // implied immunity to drowining -#define FL_IMMUNE_LASER 0x00000004 -#define FL_INWATER 0x00000008 -#define FL_GODMODE 0x00000010 -#define FL_NOTARGET 0x00000020 -#define FL_IMMUNE_SLIME 0x00000040 -#define FL_IMMUNE_LAVA 0x00000080 -#define FL_PARTIALGROUND 0x00000100 // not all corners are valid -#define FL_WATERJUMP 0x00000200 // player jumping out of water -#define FL_TEAMSLAVE 0x00000400 // not the first on the team -#define FL_NO_KNOCKBACK 0x00000800 -#define FL_POWER_ARMOR 0x00001000 // power armor (if any) is active -#define FL_RESPAWN 0x80000000 // used for item respawning +#define FRAMETIME 0.1 +/* memory tags to allow dynamic memory to be cleaned up */ +#define TAG_GAME 765 /* clear when unloading the dll */ +#define TAG_LEVEL 766 /* clear when loading a new level */ -#define FRAMETIME 0.1 +#define MELEE_DISTANCE 80 -// memory tags to allow dynamic memory to be cleaned up -#define TAG_GAME 765 // clear when unloading the dll -#define TAG_LEVEL 766 // clear when loading a new level - - -#define MELEE_DISTANCE 80 - -#define BODY_QUEUE_SIZE 8 +#define BODY_QUEUE_SIZE 8 typedef enum { DAMAGE_NO, - DAMAGE_YES, // will take damage if hit - DAMAGE_AIM // auto targeting recognizes this + DAMAGE_YES, /* will take damage if hit */ + DAMAGE_AIM /* auto targeting recognizes this */ } damage_t; -typedef enum +typedef enum { - WEAPON_READY, + WEAPON_READY, WEAPON_ACTIVATING, WEAPON_DROPPING, WEAPON_FIRING @@ -112,1040 +110,982 @@ typedef enum AMMO_SLUGS } ammo_t; +/* deadflag */ +#define DEAD_NO 0 +#define DEAD_DYING 1 +#define DEAD_DEAD 2 +#define DEAD_RESPAWNABLE 3 -//deadflag -#define DEAD_NO 0 -#define DEAD_DYING 1 -#define DEAD_DEAD 2 -#define DEAD_RESPAWNABLE 3 +/* range */ +#define RANGE_MELEE 0 +#define RANGE_NEAR 1 +#define RANGE_MID 2 +#define RANGE_FAR 3 -//range -#define RANGE_MELEE 0 -#define RANGE_NEAR 1 -#define RANGE_MID 2 -#define RANGE_FAR 3 +/* gib types */ +#define GIB_ORGANIC 0 +#define GIB_METALLIC 1 -//gib types -#define GIB_ORGANIC 0 -#define GIB_METALLIC 1 +/* monster ai flags */ +#define AI_STAND_GROUND 0x00000001 +#define AI_TEMP_STAND_GROUND 0x00000002 +#define AI_SOUND_TARGET 0x00000004 +#define AI_LOST_SIGHT 0x00000008 +#define AI_PURSUIT_LAST_SEEN 0x00000010 +#define AI_PURSUE_NEXT 0x00000020 +#define AI_PURSUE_TEMP 0x00000040 +#define AI_HOLD_FRAME 0x00000080 +#define AI_GOOD_GUY 0x00000100 +#define AI_BRUTAL 0x00000200 +#define AI_NOSTEP 0x00000400 +#define AI_DUCKED 0x00000800 +#define AI_COMBAT_POINT 0x00001000 +#define AI_MEDIC 0x00002000 +#define AI_RESURRECTING 0x00004000 -//monster ai flags -#define AI_STAND_GROUND 0x00000001 -#define AI_TEMP_STAND_GROUND 0x00000002 -#define AI_SOUND_TARGET 0x00000004 -#define AI_LOST_SIGHT 0x00000008 -#define AI_PURSUIT_LAST_SEEN 0x00000010 -#define AI_PURSUE_NEXT 0x00000020 -#define AI_PURSUE_TEMP 0x00000040 -#define AI_HOLD_FRAME 0x00000080 -#define AI_GOOD_GUY 0x00000100 -#define AI_BRUTAL 0x00000200 -#define AI_NOSTEP 0x00000400 -#define AI_DUCKED 0x00000800 -#define AI_COMBAT_POINT 0x00001000 -#define AI_MEDIC 0x00002000 -#define AI_RESURRECTING 0x00004000 +/* monster attack state */ +#define AS_STRAIGHT 1 +#define AS_SLIDING 2 +#define AS_MELEE 3 +#define AS_MISSILE 4 -//monster attack state -#define AS_STRAIGHT 1 -#define AS_SLIDING 2 -#define AS_MELEE 3 -#define AS_MISSILE 4 +/* armor types */ +#define ARMOR_NONE 0 +#define ARMOR_JACKET 1 +#define ARMOR_COMBAT 2 +#define ARMOR_BODY 3 +#define ARMOR_SHARD 4 -// armor types -#define ARMOR_NONE 0 -#define ARMOR_JACKET 1 -#define ARMOR_COMBAT 2 -#define ARMOR_BODY 3 -#define ARMOR_SHARD 4 +/* power armor types */ +#define POWER_ARMOR_NONE 0 +#define POWER_ARMOR_SCREEN 1 +#define POWER_ARMOR_SHIELD 2 -// power armor types -#define POWER_ARMOR_NONE 0 -#define POWER_ARMOR_SCREEN 1 -#define POWER_ARMOR_SHIELD 2 +/* handedness values */ +#define RIGHT_HANDED 0 +#define LEFT_HANDED 1 +#define CENTER_HANDED 2 -// handedness values -#define RIGHT_HANDED 0 -#define LEFT_HANDED 1 -#define CENTER_HANDED 2 +/* game.serverflags values */ +#define SFL_CROSS_TRIGGER_1 0x00000001 +#define SFL_CROSS_TRIGGER_2 0x00000002 +#define SFL_CROSS_TRIGGER_3 0x00000004 +#define SFL_CROSS_TRIGGER_4 0x00000008 +#define SFL_CROSS_TRIGGER_5 0x00000010 +#define SFL_CROSS_TRIGGER_6 0x00000020 +#define SFL_CROSS_TRIGGER_7 0x00000040 +#define SFL_CROSS_TRIGGER_8 0x00000080 +#define SFL_CROSS_TRIGGER_MASK 0x000000ff +/* noise types for PlayerNoise */ +#define PNOISE_SELF 0 +#define PNOISE_WEAPON 1 +#define PNOISE_IMPACT 2 -// game.serverflags values -#define SFL_CROSS_TRIGGER_1 0x00000001 -#define SFL_CROSS_TRIGGER_2 0x00000002 -#define SFL_CROSS_TRIGGER_3 0x00000004 -#define SFL_CROSS_TRIGGER_4 0x00000008 -#define SFL_CROSS_TRIGGER_5 0x00000010 -#define SFL_CROSS_TRIGGER_6 0x00000020 -#define SFL_CROSS_TRIGGER_7 0x00000040 -#define SFL_CROSS_TRIGGER_8 0x00000080 -#define SFL_CROSS_TRIGGER_MASK 0x000000ff - - -// noise types for PlayerNoise -#define PNOISE_SELF 0 -#define PNOISE_WEAPON 1 -#define PNOISE_IMPACT 2 - - -// edict->movetype values +/* edict->movetype values */ typedef enum { -MOVETYPE_NONE, // never moves -MOVETYPE_NOCLIP, // origin and angles change with no interaction -MOVETYPE_PUSH, // no clip to world, push on box contact -MOVETYPE_STOP, // no clip to world, stops on box contact + MOVETYPE_NONE, /* never moves */ + MOVETYPE_NOCLIP, /* origin and angles change with no interaction */ + MOVETYPE_PUSH, /* no clip to world, push on box contact */ + MOVETYPE_STOP, /* no clip to world, stops on box contact */ -MOVETYPE_WALK, // gravity -MOVETYPE_STEP, // gravity, special edge handling -MOVETYPE_FLY, -MOVETYPE_TOSS, // gravity -MOVETYPE_FLYMISSILE, // extra size to monsters -MOVETYPE_BOUNCE + MOVETYPE_WALK, /* gravity */ + MOVETYPE_STEP, /* gravity, special edge handling */ + MOVETYPE_FLY, + MOVETYPE_TOSS, /* gravity */ + MOVETYPE_FLYMISSILE, /* extra size to monsters */ + MOVETYPE_BOUNCE } movetype_t; - - typedef struct { - int base_count; - int max_count; - float normal_protection; - float energy_protection; - int armor; + int base_count; + int max_count; + float normal_protection; + float energy_protection; + int armor; } gitem_armor_t; +/* gitem_t->flags */ +#define IT_WEAPON 1 /* use makes active weapon */ +#define IT_AMMO 2 +#define IT_ARMOR 4 +#define IT_STAY_COOP 8 +#define IT_KEY 16 +#define IT_POWERUP 32 +#define IT_TECH 64 -// gitem_t->flags -#define IT_WEAPON 1 // use makes active weapon -#define IT_AMMO 2 -#define IT_ARMOR 4 -#define IT_STAY_COOP 8 -#define IT_KEY 16 -#define IT_POWERUP 32 -//ZOID -#define IT_TECH 64 -//ZOID - -// gitem_t->weapmodel for weapons indicates model index -#define WEAP_BLASTER 1 -#define WEAP_SHOTGUN 2 -#define WEAP_SUPERSHOTGUN 3 -#define WEAP_MACHINEGUN 4 -#define WEAP_CHAINGUN 5 -#define WEAP_GRENADES 6 -#define WEAP_GRENADELAUNCHER 7 -#define WEAP_ROCKETLAUNCHER 8 -#define WEAP_HYPERBLASTER 9 -#define WEAP_RAILGUN 10 -#define WEAP_BFG 11 -#define WEAP_GRAPPLE 12 +/* gitem_t->weapmodel for weapons indicates model index */ +#define WEAP_BLASTER 1 +#define WEAP_SHOTGUN 2 +#define WEAP_SUPERSHOTGUN 3 +#define WEAP_MACHINEGUN 4 +#define WEAP_CHAINGUN 5 +#define WEAP_GRENADES 6 +#define WEAP_GRENADELAUNCHER 7 +#define WEAP_ROCKETLAUNCHER 8 +#define WEAP_HYPERBLASTER 9 +#define WEAP_RAILGUN 10 +#define WEAP_BFG 11 +#define WEAP_GRAPPLE 12 typedef struct gitem_s { - char *classname; // spawning name - qboolean (*pickup)(struct edict_s *ent, struct edict_s *other); - void (*use)(struct edict_s *ent, struct gitem_s *item); - void (*drop)(struct edict_s *ent, struct gitem_s *item); - void (*weaponthink)(struct edict_s *ent); - char *pickup_sound; - char *world_model; - int world_model_flags; - char *view_model; + char *classname; /* spawning name */ + qboolean (*pickup)(struct edict_s *ent, struct edict_s *other); + void (*use)(struct edict_s *ent, struct gitem_s *item); + void (*drop)(struct edict_s *ent, struct gitem_s *item); + void (*weaponthink)(struct edict_s *ent); + char *pickup_sound; + char *world_model; + int world_model_flags; + char *view_model; - // client side info - char *icon; - char *pickup_name; // for printing on pickup - int count_width; // number of digits to display by icon + /* client side info */ + char *icon; + char *pickup_name; /* for printing on pickup */ + int count_width; /* number of digits to display by icon */ - int quantity; // for ammo how much, for weapons how much is used per shot - char *ammo; // for weapons - int flags; // IT_* flags + int quantity; /* for ammo how much, for weapons how much is used per shot */ + char *ammo; /* for weapons */ + int flags; /* IT_* flags */ - int weapmodel; // weapon model index (for weapons) + int weapmodel; /* weapon model index (for weapons) */ - void *info; - int tag; + void *info; + int tag; - char *precaches; // string of all models, sounds, and images this item will use + char *precaches; /* string of all models, sounds, and images this item will use */ } gitem_t; - - -// -// this structure is left intact through an entire game -// it should be initialized at dll load time, and read/written to -// the server.ssv file for savegames -// +/* this structure is left intact through an entire game + it should be initialized at dll load time, and read/written to + the server.ssv file for savegames */ typedef struct { - char helpmessage1[512]; - char helpmessage2[512]; - int helpchanged; // flash F1 icon if non 0, play sound - // and increment only if 1, 2, or 3 + char helpmessage1[512]; + char helpmessage2[512]; + int helpchanged; /* flash F1 icon if non 0, play sound */ + /* and increment only if 1, 2, or 3 */ - gclient_t *clients; // [maxclients] + gclient_t *clients; /* [maxclients] */ - // can't store spawnpoint in level, because - // it would get overwritten by the savegame restore - char spawnpoint[512]; // needed for coop respawns + /* can't store spawnpoint in level, because + it would get overwritten by the savegame restore */ + char spawnpoint[512]; /* needed for coop respawns */ - // store latched cvars here that we want to get at often - int maxclients; - int maxentities; + /* store latched cvars here that we want to get at often */ + int maxclients; + int maxentities; - // cross level triggers - int serverflags; + /* cross level triggers */ + int serverflags; - // items - int num_items; + /* items */ + int num_items; - qboolean autosaved; + qboolean autosaved; } game_locals_t; - -// -// this structure is cleared as each map is entered -// it is read/written to the level.sav file for savegames -// +/* this structure is cleared as each map is entered + it is read/written to the level.sav file for savegames */ typedef struct { - int framenum; - float time; + int framenum; + float time; - char level_name[MAX_QPATH]; // the descriptive name (Outer Base, etc) - char mapname[MAX_QPATH]; // the server name (base1, etc) - char nextmap[MAX_QPATH]; // go here when fraglimit is hit - char forcemap[MAX_QPATH]; // go here + char level_name[MAX_QPATH]; /* the descriptive name (Outer Base, etc) */ + char mapname[MAX_QPATH]; /* the server name (base1, etc) */ + char nextmap[MAX_QPATH]; /* go here when fraglimit is hit */ + char forcemap[MAX_QPATH]; /* go here */ - // intermission state - float intermissiontime; // time the intermission was started - char *changemap; - int exitintermission; - vec3_t intermission_origin; - vec3_t intermission_angle; + /* intermission state */ + float intermissiontime; /* time the intermission was started */ + char *changemap; + int exitintermission; + vec3_t intermission_origin; + vec3_t intermission_angle; - edict_t *sight_client; // changed once each frame for coop games + edict_t *sight_client; /* changed once each frame for coop games */ - edict_t *sight_entity; - int sight_entity_framenum; - edict_t *sound_entity; - int sound_entity_framenum; - edict_t *sound2_entity; - int sound2_entity_framenum; + edict_t *sight_entity; + int sight_entity_framenum; + edict_t *sound_entity; + int sound_entity_framenum; + edict_t *sound2_entity; + int sound2_entity_framenum; - int pic_health; + int pic_health; - int total_secrets; - int found_secrets; + int total_secrets; + int found_secrets; - int total_goals; - int found_goals; + int total_goals; + int found_goals; - int total_monsters; - int killed_monsters; + int total_monsters; + int killed_monsters; - edict_t *current_entity; // entity running from G_RunFrame - int body_que; // dead bodies + edict_t *current_entity; /* entity running from G_RunFrame */ + int body_que; /* dead bodies */ - int power_cubes; // ugly necessity for coop + int power_cubes; /* ugly necessity for coop */ } level_locals_t; - -// spawn_temp_t is only used to hold entity field values that -// can be set from the editor, but aren't actualy present -// in edict_t during gameplay +/* spawn_temp_t is only used to hold entity field values that + can be set from the editor, but aren't actualy present + in edict_t during gameplay */ typedef struct { - // world vars - char *sky; - float skyrotate; - vec3_t skyaxis; - char *nextmap; + /* world vars */ + char *sky; + float skyrotate; + vec3_t skyaxis; + char *nextmap; - int lip; - int distance; - int height; - char *noise; - float pausetime; - char *item; - char *gravity; + int lip; + int distance; + int height; + char *noise; + float pausetime; + char *item; + char *gravity; - float minyaw; - float maxyaw; - float minpitch; - float maxpitch; + float minyaw; + float maxyaw; + float minpitch; + float maxpitch; } spawn_temp_t; - typedef struct { - // fixed data - vec3_t start_origin; - vec3_t start_angles; - vec3_t end_origin; - vec3_t end_angles; + /* fixed data */ + vec3_t start_origin; + vec3_t start_angles; + vec3_t end_origin; + vec3_t end_angles; - int sound_start; - int sound_middle; - int sound_end; + int sound_start; + int sound_middle; + int sound_end; - float accel; - float speed; - float decel; - float distance; + float accel; + float speed; + float decel; + float distance; - float wait; + float wait; - // state data - int state; - vec3_t dir; - float current_speed; - float move_speed; - float next_speed; - float remaining_distance; - float decel_distance; - void (*endfunc)(edict_t *); + /* state data */ + int state; + vec3_t dir; + float current_speed; + float move_speed; + float next_speed; + float remaining_distance; + float decel_distance; + void (*endfunc)(edict_t *); } moveinfo_t; - typedef struct { - void (*aifunc)(edict_t *self, float dist); - float dist; - void (*thinkfunc)(edict_t *self); + void (*aifunc)(edict_t *self, float dist); + float dist; + void (*thinkfunc)(edict_t *self); } mframe_t; typedef struct { - int firstframe; - int lastframe; - mframe_t *frame; - void (*endfunc)(edict_t *self); + int firstframe; + int lastframe; + mframe_t *frame; + void (*endfunc)(edict_t *self); } mmove_t; typedef struct { - mmove_t *currentmove; - int aiflags; - int nextframe; - float scale; + mmove_t *currentmove; + int aiflags; + int nextframe; + float scale; - void (*stand)(edict_t *self); - void (*idle)(edict_t *self); - void (*search)(edict_t *self); - void (*walk)(edict_t *self); - void (*run)(edict_t *self); - void (*dodge)(edict_t *self, edict_t *other, float eta); - void (*attack)(edict_t *self); - void (*melee)(edict_t *self); - void (*sight)(edict_t *self, edict_t *other); - qboolean (*checkattack)(edict_t *self); + void (*stand)(edict_t *self); + void (*idle)(edict_t *self); + void (*search)(edict_t *self); + void (*walk)(edict_t *self); + void (*run)(edict_t *self); + void (*dodge)(edict_t *self, edict_t *other, float eta); + void (*attack)(edict_t *self); + void (*melee)(edict_t *self); + void (*sight)(edict_t *self, edict_t *other); + qboolean (*checkattack)(edict_t *self); - float pausetime; - float attack_finished; + float pausetime; + float attack_finished; - vec3_t saved_goal; - float search_time; - float trail_time; - vec3_t last_sighting; - int attack_state; - int lefty; - float idle_time; - int linkcount; + vec3_t saved_goal; + float search_time; + float trail_time; + vec3_t last_sighting; + int attack_state; + int lefty; + float idle_time; + int linkcount; - int power_armor_type; - int power_armor_power; + int power_armor_type; + int power_armor_power; } monsterinfo_t; +extern game_locals_t game; +extern level_locals_t level; +extern game_import_t gi; +extern game_export_t globals; +extern spawn_temp_t st; +extern int sm_meat_index; +extern int snd_fry; -extern game_locals_t game; -extern level_locals_t level; -extern game_import_t gi; -extern game_export_t globals; -extern spawn_temp_t st; +/* means of death */ +#define MOD_UNKNOWN 0 +#define MOD_BLASTER 1 +#define MOD_SHOTGUN 2 +#define MOD_SSHOTGUN 3 +#define MOD_MACHINEGUN 4 +#define MOD_CHAINGUN 5 +#define MOD_GRENADE 6 +#define MOD_G_SPLASH 7 +#define MOD_ROCKET 8 +#define MOD_R_SPLASH 9 +#define MOD_HYPERBLASTER 10 +#define MOD_RAILGUN 11 +#define MOD_BFG_LASER 12 +#define MOD_BFG_BLAST 13 +#define MOD_BFG_EFFECT 14 +#define MOD_HANDGRENADE 15 +#define MOD_HG_SPLASH 16 +#define MOD_WATER 17 +#define MOD_SLIME 18 +#define MOD_LAVA 19 +#define MOD_CRUSH 20 +#define MOD_TELEFRAG 21 +#define MOD_FALLING 22 +#define MOD_SUICIDE 23 +#define MOD_HELD_GRENADE 24 +#define MOD_EXPLOSIVE 25 +#define MOD_BARREL 26 +#define MOD_BOMB 27 +#define MOD_EXIT 28 +#define MOD_SPLASH 29 +#define MOD_TARGET_LASER 30 +#define MOD_TRIGGER_HURT 31 +#define MOD_HIT 32 +#define MOD_TARGET_BLASTER 33 +#define MOD_GRAPPLE 34 +#define MOD_FRIENDLY_FIRE 0x8000000 -extern int sm_meat_index; -extern int snd_fry; +extern int meansOfDeath; +extern edict_t *g_edicts; -// means of death -#define MOD_UNKNOWN 0 -#define MOD_BLASTER 1 -#define MOD_SHOTGUN 2 -#define MOD_SSHOTGUN 3 -#define MOD_MACHINEGUN 4 -#define MOD_CHAINGUN 5 -#define MOD_GRENADE 6 -#define MOD_G_SPLASH 7 -#define MOD_ROCKET 8 -#define MOD_R_SPLASH 9 -#define MOD_HYPERBLASTER 10 -#define MOD_RAILGUN 11 -#define MOD_BFG_LASER 12 -#define MOD_BFG_BLAST 13 -#define MOD_BFG_EFFECT 14 -#define MOD_HANDGRENADE 15 -#define MOD_HG_SPLASH 16 -#define MOD_WATER 17 -#define MOD_SLIME 18 -#define MOD_LAVA 19 -#define MOD_CRUSH 20 -#define MOD_TELEFRAG 21 -#define MOD_FALLING 22 -#define MOD_SUICIDE 23 -#define MOD_HELD_GRENADE 24 -#define MOD_EXPLOSIVE 25 -#define MOD_BARREL 26 -#define MOD_BOMB 27 -#define MOD_EXIT 28 -#define MOD_SPLASH 29 -#define MOD_TARGET_LASER 30 -#define MOD_TRIGGER_HURT 31 -#define MOD_HIT 32 -#define MOD_TARGET_BLASTER 33 -#define MOD_GRAPPLE 34 -#define MOD_FRIENDLY_FIRE 0x8000000 +#define FOFS(x) (size_t)&(((edict_t *)0)->x) +#define STOFS(x) (size_t)&(((spawn_temp_t *)0)->x) +#define LLOFS(x) (size_t)&(((level_locals_t *)0)->x) +#define CLOFS(x) (size_t)&(((gclient_t *)0)->x) -extern int meansOfDeath; +#define random() ((rand() & 0x7fff) / ((float)0x7fff)) +#define crandom() (2.0 * (random() - 0.5)) +extern cvar_t *maxentities; +extern cvar_t *deathmatch; +extern cvar_t *coop; +extern cvar_t *dmflags; +extern cvar_t *skill; +extern cvar_t *fraglimit; +extern cvar_t *timelimit; +extern cvar_t *capturelimit; +extern cvar_t *instantweap; +extern cvar_t *password; +extern cvar_t *g_select_empty; +extern cvar_t *dedicated; -extern edict_t *g_edicts; +extern cvar_t *filterban; -#define FOFS(x) (size_t)&(((edict_t *)0)->x) -#define STOFS(x) (size_t)&(((spawn_temp_t *)0)->x) -#define LLOFS(x) (size_t)&(((level_locals_t *)0)->x) -#define CLOFS(x) (size_t)&(((gclient_t *)0)->x) +extern cvar_t *sv_gravity; +extern cvar_t *sv_maxvelocity; -#define random() ((rand () & 0x7fff) / ((float)0x7fff)) -#define crandom() (2.0 * (random() - 0.5)) +extern cvar_t *gun_x, *gun_y, *gun_z; +extern cvar_t *sv_rollspeed; +extern cvar_t *sv_rollangle; -extern cvar_t *maxentities; -extern cvar_t *deathmatch; -extern cvar_t *coop; -extern cvar_t *dmflags; -extern cvar_t *skill; -extern cvar_t *fraglimit; -extern cvar_t *timelimit; -//ZOID -extern cvar_t *capturelimit; -extern cvar_t *instantweap; -//ZOID -extern cvar_t *password; -extern cvar_t *g_select_empty; -extern cvar_t *dedicated; +extern cvar_t *run_pitch; +extern cvar_t *run_roll; +extern cvar_t *bob_up; +extern cvar_t *bob_pitch; +extern cvar_t *bob_roll; -extern cvar_t *filterban; +extern cvar_t *sv_cheats; +extern cvar_t *maxclients; -extern cvar_t *sv_gravity; -extern cvar_t *sv_maxvelocity; +extern cvar_t *flood_msgs; +extern cvar_t *flood_persecond; +extern cvar_t *flood_waitdelay; -extern cvar_t *gun_x, *gun_y, *gun_z; -extern cvar_t *sv_rollspeed; -extern cvar_t *sv_rollangle; +extern cvar_t *sv_maplist; -extern cvar_t *run_pitch; -extern cvar_t *run_roll; -extern cvar_t *bob_up; -extern cvar_t *bob_pitch; -extern cvar_t *bob_roll; +#define world (&g_edicts[0]) -extern cvar_t *sv_cheats; -extern cvar_t *maxclients; +/* item spawnflags */ +#define ITEM_TRIGGER_SPAWN 0x00000001 +#define ITEM_NO_TOUCH 0x00000002 +/* 6 bits reserved for editor flags */ +#define DROPPED_ITEM 0x00010000 +#define DROPPED_PLAYER_ITEM 0x00020000 +#define ITEM_TARGETS_USED 0x00040000 -extern cvar_t *flood_msgs; -extern cvar_t *flood_persecond; -extern cvar_t *flood_waitdelay; +/* fields are needed for spawning from the entity string + and saving / loading games */ +#define FFL_SPAWNTEMP 1 -extern cvar_t *sv_maplist; - - -#define world (&g_edicts[0]) - -// item spawnflags -#define ITEM_TRIGGER_SPAWN 0x00000001 -#define ITEM_NO_TOUCH 0x00000002 -// 6 bits reserved for editor flags -// 8 bits used as power cube id bits for coop games -#define DROPPED_ITEM 0x00010000 -#define DROPPED_PLAYER_ITEM 0x00020000 -#define ITEM_TARGETS_USED 0x00040000 - -// -// fields are needed for spawning from the entity string -// and saving / loading games -// -#define FFL_SPAWNTEMP 1 - -typedef enum { - F_INT, +typedef enum +{ + F_INT, F_FLOAT, - F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL - F_GSTRING, // string on disk, pointer in memory, TAG_GAME + F_LSTRING, /* string on disk, pointer in memory, TAG_LEVEL */ + F_GSTRING, /* string on disk, pointer in memory, TAG_GAME */ F_VECTOR, F_ANGLEHACK, - F_EDICT, // index on disk, pointer in memory - F_ITEM, // index on disk, pointer in memory - F_CLIENT, // index on disk, pointer in memory + F_EDICT, /* index on disk, pointer in memory */ + F_ITEM, /* index on disk, pointer in memory */ + F_CLIENT, /* index on disk, pointer in memory */ F_IGNORE } fieldtype_t; typedef struct { - char *name; - int ofs; - fieldtype_t type; - int flags; + char *name; + int ofs; + fieldtype_t type; + int flags; } field_t; +extern field_t fields[]; +extern gitem_t itemlist[]; -extern field_t fields[]; -extern gitem_t itemlist[]; - - -// -// g_cmds.c -// +/* g_cmds.c */ qboolean CheckFlood(edict_t *ent); -void Cmd_Help_f (edict_t *ent); -void Cmd_Score_f (edict_t *ent); +void Cmd_Help_f(edict_t *ent); +void Cmd_Score_f(edict_t *ent); -// -// g_items.c -// -void PrecacheItem (gitem_t *it); -void InitItems (void); -void SetItemNames (void); -gitem_t *FindItem (char *pickup_name); -gitem_t *FindItemByClassname (char *classname); -#define ITEM_INDEX(x) ((x)-itemlist) -edict_t *Drop_Item (edict_t *ent, gitem_t *item); -void SetRespawn (edict_t *ent, float delay); -void ChangeWeapon (edict_t *ent); -void SpawnItem (edict_t *ent, gitem_t *item); -void Think_Weapon (edict_t *ent); -int ArmorIndex (edict_t *ent); -int PowerArmorType (edict_t *ent); -gitem_t *GetItemByIndex (int index); -qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count); -void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf); +/* g_items.c */ +void PrecacheItem(gitem_t *it); +void InitItems(void); +void SetItemNames(void); +gitem_t *FindItem(char *pickup_name); +gitem_t *FindItemByClassname(char *classname); -// -// g_utils.c -// -qboolean KillBox (edict_t *ent); -void G_ProjectSource (vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result); -edict_t *G_Find (edict_t *from, int fieldofs, char *match); -edict_t *findradius (edict_t *from, vec3_t org, float rad); -edict_t *G_PickTarget (char *targetname); -void G_UseTargets (edict_t *ent, edict_t *activator); -void G_SetMovedir (vec3_t angles, vec3_t movedir); +#define ITEM_INDEX(x) ((x) - itemlist) +edict_t *Drop_Item(edict_t *ent, gitem_t *item); +void SetRespawn(edict_t *ent, float delay); +void ChangeWeapon(edict_t *ent); +void SpawnItem(edict_t *ent, gitem_t *item); +void Think_Weapon(edict_t *ent); +int ArmorIndex(edict_t *ent); +int PowerArmorType(edict_t *ent); +gitem_t *GetItemByIndex(int index); +qboolean Add_Ammo(edict_t *ent, gitem_t *item, int count); +void Touch_Item(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf); -void G_InitEdict (edict_t *e); -edict_t *G_Spawn (void); -void G_FreeEdict (edict_t *e); +/* g_utils.c */ +qboolean KillBox(edict_t *ent); +void G_ProjectSource(vec3_t point, vec3_t distance, vec3_t forward, + vec3_t right, vec3_t result); +edict_t *G_Find(edict_t *from, int fieldofs, char *match); +edict_t *findradius(edict_t *from, vec3_t org, float rad); +edict_t *G_PickTarget(char *targetname); +void G_UseTargets(edict_t *ent, edict_t *activator); +void G_SetMovedir(vec3_t angles, vec3_t movedir); -void G_TouchTriggers (edict_t *ent); -void G_TouchSolids (edict_t *ent); +void G_InitEdict(edict_t *e); +edict_t *G_Spawn(void); +void G_FreeEdict(edict_t *e); -char *G_CopyString (char *in); +void G_TouchTriggers(edict_t *ent); +void G_TouchSolids(edict_t *ent); -float *tv (float x, float y, float z); -char *vtos (vec3_t v); +char *G_CopyString(char *in); -float vectoyaw (vec3_t vec); -void vectoangles (vec3_t vec, vec3_t angles); +float *tv(float x, float y, float z); +char *vtos(vec3_t v); -// -// g_combat.c -// -qboolean OnSameTeam (edict_t *ent1, edict_t *ent2); -qboolean CanDamage (edict_t *targ, edict_t *inflictor); -qboolean CheckTeamDamage (edict_t *targ, edict_t *attacker); -void T_Damage (edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, vec3_t point, vec3_t normal, int damage, int knockback, int dflags, int mod); -void T_RadiusDamage (edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod); +float vectoyaw(vec3_t vec); +void vectoangles(vec3_t vec, vec3_t angles); -// damage flags -#define DAMAGE_RADIUS 0x00000001 // damage was indirect -#define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage -#define DAMAGE_ENERGY 0x00000004 // damage is from an energy based weapon -#define DAMAGE_NO_KNOCKBACK 0x00000008 // do not affect velocity, just view angles -#define DAMAGE_BULLET 0x00000010 // damage is from a bullet (used for ricochets) -#define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect +/* g_combat.c */ +qboolean OnSameTeam(edict_t *ent1, edict_t *ent2); +qboolean CanDamage(edict_t *targ, edict_t *inflictor); +qboolean CheckTeamDamage(edict_t *targ, edict_t *attacker); +void T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, + vec3_t dir, vec3_t point, vec3_t normal, int damage, int knockback, + int dflags, int mod); +void T_RadiusDamage(edict_t *inflictor, edict_t *attacker, float damage, + edict_t *ignore, float radius, int mod); -#define DEFAULT_BULLET_HSPREAD 300 -#define DEFAULT_BULLET_VSPREAD 500 -#define DEFAULT_SHOTGUN_HSPREAD 1000 -#define DEFAULT_SHOTGUN_VSPREAD 500 -#define DEFAULT_DEATHMATCH_SHOTGUN_COUNT 12 -#define DEFAULT_SHOTGUN_COUNT 12 -#define DEFAULT_SSHOTGUN_COUNT 20 +/* damage flags */ +#define DAMAGE_RADIUS 0x00000001 /* damage was indirect */ +#define DAMAGE_NO_ARMOR 0x00000002 /* armour does not protect from this damage */ +#define DAMAGE_ENERGY 0x00000004 /* damage is from an energy based weapon */ +#define DAMAGE_NO_KNOCKBACK 0x00000008 /* do not affect velocity, just view angles */ +#define DAMAGE_BULLET 0x00000010 /* damage is from a bullet (used for ricochets) */ +#define DAMAGE_NO_PROTECTION 0x00000020 /* armor, shields, invulnerability, and godmode have no effect */ -// -// g_monster.c -// -void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype); -void monster_fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype); -void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect); -void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype); -void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype); -void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype); -void monster_fire_bfg (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype); -void M_droptofloor (edict_t *ent); -void monster_think (edict_t *self); -void walkmonster_start (edict_t *self); -void swimmonster_start (edict_t *self); -void flymonster_start (edict_t *self); -void AttackFinished (edict_t *self, float time); -void monster_death_use (edict_t *self); -void M_CatagorizePosition (edict_t *ent); -qboolean M_CheckAttack (edict_t *self); -void M_FlyCheck (edict_t *self); -void M_CheckGround (edict_t *ent); +#define DEFAULT_BULLET_HSPREAD 300 +#define DEFAULT_BULLET_VSPREAD 500 +#define DEFAULT_SHOTGUN_HSPREAD 1000 +#define DEFAULT_SHOTGUN_VSPREAD 500 +#define DEFAULT_DEATHMATCH_SHOTGUN_COUNT 12 +#define DEFAULT_SHOTGUN_COUNT 12 +#define DEFAULT_SSHOTGUN_COUNT 20 -// -// g_misc.c -// -void ThrowHead (edict_t *self, char *gibname, int damage, int type); -void ThrowClientHead (edict_t *self, int damage); -void ThrowGib (edict_t *self, char *gibname, int damage, int type); +/* g_monster.c */ +void monster_fire_bullet(edict_t *self, vec3_t start, vec3_t dir, int damage, + int kick, int hspread, int vspread, int flashtype); +void monster_fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int kick, int hspread, int vspread, int count, int flashtype); +void monster_fire_blaster(edict_t *self, vec3_t start, vec3_t dir, int damage, + int speed, int flashtype, int effect); +void monster_fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, + int damage, int speed, int flashtype); +void monster_fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, + int speed, int flashtype); +void monster_fire_railgun(edict_t *self, vec3_t start, vec3_t aimdir, + int damage, int kick, int flashtype); +void monster_fire_bfg(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, int kick, float damage_radius, int flashtype); +void M_droptofloor(edict_t *ent); +void monster_think(edict_t *self); +void walkmonster_start(edict_t *self); +void swimmonster_start(edict_t *self); +void flymonster_start(edict_t *self); +void AttackFinished(edict_t *self, float time); +void monster_death_use(edict_t *self); +void M_CatagorizePosition(edict_t *ent); +qboolean M_CheckAttack(edict_t *self); +void M_FlyCheck(edict_t *self); +void M_CheckGround(edict_t *ent); + +/* g_misc.c */ +void ThrowHead(edict_t *self, char *gibname, int damage, int type); +void ThrowClientHead(edict_t *self, int damage); +void ThrowGib(edict_t *self, char *gibname, int damage, int type); void BecomeExplosion1(edict_t *self); -// -// g_ai.c -// -void AI_SetSightClient (void); +/* g_ai.c */ +void AI_SetSightClient(void); -void ai_stand (edict_t *self, float dist); -void ai_move (edict_t *self, float dist); -void ai_walk (edict_t *self, float dist); -void ai_turn (edict_t *self, float dist); -void ai_run (edict_t *self, float dist); -void ai_charge (edict_t *self, float dist); -int range (edict_t *self, edict_t *other); +void ai_stand(edict_t *self, float dist); +void ai_move(edict_t *self, float dist); +void ai_walk(edict_t *self, float dist); +void ai_turn(edict_t *self, float dist); +void ai_run(edict_t *self, float dist); +void ai_charge(edict_t *self, float dist); +int range(edict_t *self, edict_t *other); -void FoundTarget (edict_t *self); -qboolean infront (edict_t *self, edict_t *other); -qboolean visible (edict_t *self, edict_t *other); +void FoundTarget(edict_t *self); +qboolean infront(edict_t *self, edict_t *other); +qboolean visible(edict_t *self, edict_t *other); qboolean FacingIdeal(edict_t *self); -// -// g_weapon.c -// -void ThrowDebris (edict_t *self, char *modelname, float speed, vec3_t origin); -qboolean fire_hit (edict_t *self, vec3_t aim, int damage, int kick); -void fire_bullet (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int mod); -void fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int mod); -void fire_blaster (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int effect, qboolean hyper); -void fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius); -void fire_grenade2 (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held); -void fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage); -void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick); -void fire_bfg (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius); +/* g_weapon.c */ +void ThrowDebris(edict_t *self, char *modelname, float speed, vec3_t origin); +qboolean fire_hit(edict_t *self, vec3_t aim, int damage, int kick); +void fire_bullet(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int kick, int hspread, int vspread, int mod); +void fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int kick, int hspread, int vspread, int count, int mod); +void fire_blaster(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, int effect, qboolean hyper); +void fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, float timer, float damage_radius); +void fire_grenade2(edict_t *self, vec3_t start, vec3_t aimdir, int damage, + int speed, float timer, float damage_radius, qboolean held); +void fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, + int speed, float damage_radius, int radius_damage); +void fire_rail(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick); +void fire_bfg(edict_t *self, vec3_t start, vec3_t dir, int damage, + int speed, float damage_radius); -// -// g_ptrail.c -// -void PlayerTrail_Init (void); -void PlayerTrail_Add (vec3_t spot); -void PlayerTrail_New (vec3_t spot); -edict_t *PlayerTrail_PickFirst (edict_t *self); -edict_t *PlayerTrail_PickNext (edict_t *self); -edict_t *PlayerTrail_LastSpot (void); +/* g_ptrail.c */ +void PlayerTrail_Init(void); +void PlayerTrail_Add(vec3_t spot); +void PlayerTrail_New(vec3_t spot); +edict_t *PlayerTrail_PickFirst(edict_t *self); +edict_t *PlayerTrail_PickNext(edict_t *self); +edict_t *PlayerTrail_LastSpot(void); +/* g_client.c */ +void respawn(edict_t *ent); +void BeginIntermission(edict_t *targ); +void PutClientInServer(edict_t *ent); +void InitClientPersistant(gclient_t *client); +void InitClientResp(gclient_t *client); +void InitBodyQue(void); +void ClientBeginServerFrame(edict_t *ent); +void ClientUserinfoChanged(edict_t *ent, char *userinfo); -// -// g_client.c -// -void respawn (edict_t *ent); -void BeginIntermission (edict_t *targ); -void PutClientInServer (edict_t *ent); -void InitClientPersistant (gclient_t *client); -void InitClientResp (gclient_t *client); -void InitBodyQue (void); -void ClientBeginServerFrame (edict_t *ent); -void ClientUserinfoChanged (edict_t *ent, char *userinfo); +/* g_player.c */ +void player_pain(edict_t *self, edict_t *other, float kick, int damage); +void player_die(edict_t *self, edict_t *inflictor, edict_t *attacker, + int damage, vec3_t point); -// -// g_player.c -// -void player_pain (edict_t *self, edict_t *other, float kick, int damage); -void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); +/* g_svcmds.c */ +void ServerCommand(void); -// -// g_svcmds.c -// -void ServerCommand (void); +/* p_view.c */ +void ClientEndServerFrame(edict_t *ent); -// -// p_view.c -// -void ClientEndServerFrame (edict_t *ent); +/* p_hud.c */ +void MoveClientToIntermission(edict_t *client); +void G_SetStats(edict_t *ent); +void ValidateSelectedItem(edict_t *ent); +void DeathmatchScoreboardMessage(edict_t *client, edict_t *killer); -// -// p_hud.c -// -void MoveClientToIntermission (edict_t *client); -void G_SetStats (edict_t *ent); -void ValidateSelectedItem (edict_t *ent); -void DeathmatchScoreboardMessage (edict_t *client, edict_t *killer); - -// -// g_pweapon.c -// +/* g_pweapon.c */ void PlayerNoise(edict_t *who, vec3_t where, int type); -void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result); -void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent)); +void P_ProjectSource(gclient_t *client, vec3_t point, vec3_t distance, + vec3_t forward, vec3_t right, vec3_t result); +void Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, + int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, + int *fire_frames, void (*fire)(edict_t *ent)); -// -// m_move.c -// -qboolean M_CheckBottom (edict_t *ent); -qboolean M_walkmove (edict_t *ent, float yaw, float dist); -void M_MoveToGoal (edict_t *ent, float dist); -void M_ChangeYaw (edict_t *ent); +/* m_move.c */ +qboolean M_CheckBottom(edict_t *ent); +qboolean M_walkmove(edict_t *ent, float yaw, float dist); +void M_MoveToGoal(edict_t *ent, float dist); +void M_ChangeYaw(edict_t *ent); -// -// g_phys.c -// -void G_RunEntity (edict_t *ent); +/* g_phys.c */ +void G_RunEntity(edict_t *ent); -// -// g_main.c -// -void SaveClientData (void); -void FetchClientEntData (edict_t *ent); -void EndDMLevel (void); +/* g_main.c */ +void SaveClientData(void); +void FetchClientEntData(edict_t *ent); +void EndDMLevel(void); -// -// g_svcmds.c -// -qboolean SV_FilterPacket (char *from); +/* g_svcmds.c */ +qboolean SV_FilterPacket(char *from); -//============================================================================ +/* ============================================================================ */ -// client_t->anim_priority -#define ANIM_BASIC 0 // stand / run -#define ANIM_WAVE 1 -#define ANIM_JUMP 2 -#define ANIM_PAIN 3 -#define ANIM_ATTACK 4 -#define ANIM_DEATH 5 -#define ANIM_REVERSE 6 +/* client_t->anim_priority */ +#define ANIM_BASIC 0 /* stand / run */ +#define ANIM_WAVE 1 +#define ANIM_JUMP 2 +#define ANIM_PAIN 3 +#define ANIM_ATTACK 4 +#define ANIM_DEATH 5 +#define ANIM_REVERSE 6 - -// client data that stays across multiple level loads +/* client data that stays across multiple level loads */ typedef struct { - char userinfo[MAX_INFO_STRING]; - char netname[16]; - int hand; + char userinfo[MAX_INFO_STRING]; + char netname[16]; + int hand; - qboolean connected; // a loadgame will leave valid entities that - // just don't have a connection yet + qboolean connected; /* a loadgame will leave valid entities that + just don't have a connection yet */ - // values saved and restored from edicts when changing levels - int health; - int max_health; - int savedFlags; + /* values saved and restored from edicts when changing levels */ + int health; + int max_health; + int savedFlags; - int selected_item; - int inventory[MAX_ITEMS]; + int selected_item; + int inventory[MAX_ITEMS]; - // ammo capacities - int max_bullets; - int max_shells; - int max_rockets; - int max_grenades; - int max_cells; - int max_slugs; + /* ammo capacities */ + int max_bullets; + int max_shells; + int max_rockets; + int max_grenades; + int max_cells; + int max_slugs; - gitem_t *weapon; - gitem_t *lastweapon; + gitem_t *weapon; + gitem_t *lastweapon; - int power_cubes; // used for tracking the cubes in coop games - int score; // for calculating total unit score in coop games + int power_cubes; /* used for tracking the cubes in coop games */ + int score; /* for calculating total unit score in coop games */ } client_persistant_t; -// client data that stays across deathmatch respawns +/* client data that stays across deathmatch respawns */ typedef struct { - client_persistant_t coop_respawn; // what to set client->pers to on a respawn - int enterframe; // level.framenum the client entered the game - int score; // frags, etc - //ZOID - int ctf_team; // CTF team - int ctf_state; - float ctf_lasthurtcarrier; - float ctf_lastreturnedflag; - float ctf_flagsince; - float ctf_lastfraggedcarrier; - qboolean id_state; - float lastidtime; - qboolean voted; // for elections - qboolean ready; - qboolean admin; - struct ghost_s *ghost; // for ghost codes - //ZOID - vec3_t cmd_angles; // angles sent over in the last command - int game_helpchanged; - int helpchanged; + client_persistant_t coop_respawn; /* what to set client->pers to on a respawn */ + int enterframe; /* level.framenum the client entered the game */ + int score; /* frags, etc */ + int ctf_team; /* CTF team */ + int ctf_state; + float ctf_lasthurtcarrier; + float ctf_lastreturnedflag; + float ctf_flagsince; + float ctf_lastfraggedcarrier; + qboolean id_state; + float lastidtime; + qboolean voted; /* for elections */ + qboolean ready; + qboolean admin; + struct ghost_s *ghost; /* for ghost codes */ + vec3_t cmd_angles; /* angles sent over in the last command */ + int game_helpchanged; + int helpchanged; } client_respawn_t; -// this structure is cleared on each PutClientInServer(), -// except for 'client->pers' +/* this structure is cleared on each PutClientInServer(), + except for 'client->pers' */ struct gclient_s { - // known to server - player_state_t ps; // communicated by server to clients - int ping; + /* known to server */ + player_state_t ps; /* communicated by server to clients */ + int ping; - // private to game - client_persistant_t pers; - client_respawn_t resp; - pmove_state_t old_pmove; // for detecting out-of-pmove changes + /* private to game */ + client_persistant_t pers; + client_respawn_t resp; + pmove_state_t old_pmove; /* for detecting out-of-pmove changes */ - qboolean showscores; // set layout stat - //ZOID - qboolean inmenu; // in menu - pmenuhnd_t *menu; // current menu - //ZOID - qboolean showinventory; // set layout stat - qboolean showhelp; - qboolean showhelpicon; + qboolean showscores; /* set layout stat */ + qboolean inmenu; /* in menu */ + pmenuhnd_t *menu; /* current menu */ + qboolean showinventory; /* set layout stat */ + qboolean showhelp; + qboolean showhelpicon; - int ammo_index; + int ammo_index; - int buttons; - int oldbuttons; - int latched_buttons; + int buttons; + int oldbuttons; + int latched_buttons; - qboolean weapon_thunk; + qboolean weapon_thunk; - gitem_t *newweapon; + gitem_t *newweapon; - // sum up damage over an entire frame, so - // shotgun blasts give a single big kick - int damage_armor; // damage absorbed by armor - int damage_parmor; // damage absorbed by power armor - int damage_blood; // damage taken out of health - int damage_knockback; // impact damage - vec3_t damage_from; // origin for vector calculation + /* sum up damage over an entire frame, so + shotgun blasts give a single big kick */ + int damage_armor; /* damage absorbed by armor */ + int damage_parmor; /* damage absorbed by power armor */ + int damage_blood; /* damage taken out of health */ + int damage_knockback; /* impact damage */ + vec3_t damage_from; /* origin for vector calculation */ - float killer_yaw; // when dead, look at killer + float killer_yaw; /* when dead, look at killer */ - weaponstate_t weaponstate; - vec3_t kick_angles; // weapon kicks - vec3_t kick_origin; - float v_dmg_roll, v_dmg_pitch, v_dmg_time; // damage kicks - float fall_time, fall_value; // for view drop on fall - float damage_alpha; - float bonus_alpha; - vec3_t damage_blend; - vec3_t v_angle; // aiming direction - float bobtime; // so off-ground doesn't change it - vec3_t oldviewangles; - vec3_t oldvelocity; + weaponstate_t weaponstate; + vec3_t kick_angles; /* weapon kicks */ + vec3_t kick_origin; + float v_dmg_roll, v_dmg_pitch, v_dmg_time; /* damage kicks */ + float fall_time, fall_value; /* for view drop on fall */ + float damage_alpha; + float bonus_alpha; + vec3_t damage_blend; + vec3_t v_angle; /* aiming direction */ + float bobtime; /* so off-ground doesn't change it */ + vec3_t oldviewangles; + vec3_t oldvelocity; - float next_drown_time; - int old_waterlevel; - int breather_sound; + float next_drown_time; + int old_waterlevel; + int breather_sound; - int machinegun_shots; // for weapon raising + int machinegun_shots; /* for weapon raising */ - // animation vars - int anim_end; - int anim_priority; - qboolean anim_duck; - qboolean anim_run; + /* animation vars */ + int anim_end; + int anim_priority; + qboolean anim_duck; + qboolean anim_run; - // powerup timers - float quad_framenum; - float invincible_framenum; - float breather_framenum; - float enviro_framenum; + /* powerup timers */ + float quad_framenum; + float invincible_framenum; + float breather_framenum; + float enviro_framenum; - qboolean grenade_blew_up; - float grenade_time; - int silencer_shots; - int weapon_sound; + qboolean grenade_blew_up; + float grenade_time; + int silencer_shots; + int weapon_sound; - float pickup_msg_time; + float pickup_msg_time; - float flood_locktill; // locked from talking - float flood_when[10]; // when messages were said - int flood_whenhead; // head pointer for when said + float flood_locktill; /* locked from talking */ + float flood_when[10]; /* when messages were said */ + int flood_whenhead; /* head pointer for when said */ - float respawn_time; // can respawn when time > this + float respawn_time; /* can respawn when time > this */ - //ZOID - void *ctf_grapple; // entity of grapple - int ctf_grapplestate; // true if pulling - float ctf_grapplereleasetime; // time of grapple release - float ctf_regentime; // regen tech - float ctf_techsndtime; - float ctf_lasttechmsg; - edict_t *chase_target; - qboolean update_chase; - float menutime; // time to update menu - qboolean menudirty; - //ZOID + void *ctf_grapple; /* entity of grapple */ + int ctf_grapplestate; /* true if pulling */ + float ctf_grapplereleasetime; /* time of grapple release */ + float ctf_regentime; /* regen tech */ + float ctf_techsndtime; + float ctf_lasttechmsg; + edict_t *chase_target; + qboolean update_chase; + float menutime; /* time to update menu */ + qboolean menudirty; }; - struct edict_s { - entity_state_t s; - struct gclient_s *client; // NULL if not a player - // the server expects the first part - // of gclient_s to be a player_state_t - // but the rest of it is opaque + entity_state_t s; + struct gclient_s *client; /* NULL if not a player + the server expects the first part + of gclient_s to be a player_state_t + but the rest of it is opaque */ - qboolean inuse; - int linkcount; + qboolean inuse; + int linkcount; - // FIXME: move these fields to a server private sv_entity_t - link_t area; // linked to a division node or leaf - - int num_clusters; // if -1, use headnode instead - int clusternums[MAX_ENT_CLUSTERS]; - int headnode; // unused if num_clusters != -1 - int areanum, areanum2; + link_t area; /* linked to a division node or leaf */ - //================================ + int num_clusters; /* if -1, use headnode instead */ + int clusternums[MAX_ENT_CLUSTERS]; + int headnode; /* unused if num_clusters != -1 */ + int areanum, areanum2; - int svflags; - vec3_t mins, maxs; - vec3_t absmin, absmax, size; - solid_t solid; - int clipmask; - edict_t *owner; + /* ================================ */ + int svflags; + vec3_t mins, maxs; + vec3_t absmin, absmax, size; + solid_t solid; + int clipmask; + edict_t *owner; - // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER - // EXPECTS THE FIELDS IN THAT ORDER! + /* DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER */ + /* EXPECTS THE FIELDS IN THAT ORDER! */ - //================================ - int movetype; - int flags; + /* ================================ */ + int movetype; + int flags; - char *model; - float freetime; // sv.time when the object was freed - - // - // only used locally in game, not by server - // - char *message; - char *classname; - int spawnflags; + char *model; + float freetime; /* sv.time when the object was freed */ - float timestamp; + /* only used locally in game, not by server */ + char *message; + char *classname; + int spawnflags; - float angle; // set in qe3, -1 = up, -2 = down - char *target; - char *targetname; - char *killtarget; - char *team; - char *pathtarget; - char *deathtarget; - char *combattarget; - edict_t *target_ent; + float timestamp; - float speed, accel, decel; - vec3_t movedir; - vec3_t pos1, pos2; + float angle; /* set in qe3, -1 = up, -2 = down */ + char *target; + char *targetname; + char *killtarget; + char *team; + char *pathtarget; + char *deathtarget; + char *combattarget; + edict_t *target_ent; - vec3_t velocity; - vec3_t avelocity; - int mass; - float air_finished; - float gravity; // per entity gravity multiplier (1.0 is normal) - // use for lowgrav artifact, flares + float speed, accel, decel; + vec3_t movedir; + vec3_t pos1, pos2; - edict_t *goalentity; - edict_t *movetarget; - float yaw_speed; - float ideal_yaw; + vec3_t velocity; + vec3_t avelocity; + int mass; + float air_finished; + float gravity; /* per entity gravity multiplier (1.0 is normal) + use for lowgrav artifact, flares */ - float nextthink; - void (*prethink) (edict_t *ent); - void (*think)(edict_t *self); - void (*blocked)(edict_t *self, edict_t *other); //move to moveinfo? - void (*touch)(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf); - void (*use)(edict_t *self, edict_t *other, edict_t *activator); - void (*pain)(edict_t *self, edict_t *other, float kick, int damage); - void (*die)(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); + edict_t *goalentity; + edict_t *movetarget; + float yaw_speed; + float ideal_yaw; - float touch_debounce_time; // are all these legit? do we need more/less of them? - float pain_debounce_time; - float damage_debounce_time; - float fly_sound_debounce_time; //move to clientinfo - float last_move_time; + float nextthink; + void (*prethink)(edict_t *ent); + void (*think)(edict_t *self); + void (*blocked)(edict_t *self, edict_t *other); /* move to moveinfo? */ + void (*touch)(edict_t *self, edict_t *other, cplane_t *plane, + csurface_t *surf); + void (*use)(edict_t *self, edict_t *other, edict_t *activator); + void (*pain)(edict_t *self, edict_t *other, float kick, int damage); + void (*die)(edict_t *self, edict_t *inflictor, edict_t *attacker, + int damage, vec3_t point); - int health; - int max_health; - int gib_health; - int deadflag; - qboolean show_hostile; + float touch_debounce_time; /* are all these legit? do we need more/less of them? */ + float pain_debounce_time; + float damage_debounce_time; + float fly_sound_debounce_time; /* move to clientinfo */ + float last_move_time; - float powerarmor_time; + int health; + int max_health; + int gib_health; + int deadflag; + qboolean show_hostile; - char *map; // target_changelevel + float powerarmor_time; - int viewheight; // height above origin where eyesight is determined - int takedamage; - int dmg; - int radius_dmg; - float dmg_radius; - int sounds; //make this a spawntemp var? - int count; + char *map; /* target_changelevel */ - edict_t *chain; - edict_t *enemy; - edict_t *oldenemy; - edict_t *activator; - edict_t *groundentity; - int groundentity_linkcount; - edict_t *teamchain; - edict_t *teammaster; + int viewheight; /* height above origin where eyesight is determined */ + int takedamage; + int dmg; + int radius_dmg; + float dmg_radius; + int sounds; /* make this a spawntemp var? */ + int count; - edict_t *mynoise; // can go in client only - edict_t *mynoise2; + edict_t *chain; + edict_t *enemy; + edict_t *oldenemy; + edict_t *activator; + edict_t *groundentity; + int groundentity_linkcount; + edict_t *teamchain; + edict_t *teammaster; - int noise_index; - int noise_index2; - float volume; - float attenuation; + edict_t *mynoise; /* can go in client only */ + edict_t *mynoise2; - // timing variables - float wait; - float delay; // before firing targets - float random; + int noise_index; + int noise_index2; + float volume; + float attenuation; - float teleport_time; + /* timing variables */ + float wait; + float delay; /* before firing targets */ + float random; - int watertype; - int waterlevel; + float teleport_time; - vec3_t move_origin; - vec3_t move_angles; + int watertype; + int waterlevel; - // move this to clientinfo? - int light_level; + vec3_t move_origin; + vec3_t move_angles; - int style; // also used as areaportal number + /* move this to clientinfo? */ + int light_level; - gitem_t *item; // for bonus items + int style; /* also used as areaportal number */ - // common data blocks - moveinfo_t moveinfo; - monsterinfo_t monsterinfo; + gitem_t *item; /* for bonus items */ + + /* common data blocks */ + moveinfo_t moveinfo; + monsterinfo_t monsterinfo; }; -//ZOID #include "ctf.h" -//ZOID #endif /* CTF_LOCAL_H */ diff --git a/src/header/menu.h b/src/header/menu.h index 9aa4ad3..2e4c0b7 100644 --- a/src/header/menu.h +++ b/src/header/menu.h @@ -1,33 +1,41 @@ /* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * Header for the CTF ingame menu. + * + * ======================================================================= + */ #ifndef CTF_MENU_H #define CTF_MENU_H -enum { +enum +{ PMENU_ALIGN_LEFT, PMENU_ALIGN_CENTER, PMENU_ALIGN_RIGHT }; -typedef struct pmenuhnd_s { +typedef struct pmenuhnd_s +{ struct pmenu_s *entries; int cur; int num; @@ -36,15 +44,23 @@ typedef struct pmenuhnd_s { typedef void (*SelectFunc_t)(edict_t *ent, pmenuhnd_t *hnd); -typedef struct pmenu_s { +typedef struct pmenu_s +{ char *text; int align; SelectFunc_t SelectFunc; } pmenu_t; -pmenuhnd_t *PMenu_Open(edict_t *ent, pmenu_t *entries, int cur, int num, void *arg); +pmenuhnd_t *PMenu_Open(edict_t *ent, + pmenu_t *entries, + int cur, + int num, + void *arg); void PMenu_Close(edict_t *ent); -void PMenu_UpdateEntry(pmenu_t *entry, const char *text, int align, SelectFunc_t SelectFunc); +void PMenu_UpdateEntry(pmenu_t *entry, + const char *text, + int align, + SelectFunc_t SelectFunc); void PMenu_Do_Update(edict_t *ent); void PMenu_Update(edict_t *ent); void PMenu_Next(edict_t *ent);