diff --git a/include/bothdefs.h b/include/bothdefs.h index db219a8..b593146 100644 --- a/include/bothdefs.h +++ b/include/bothdefs.h @@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // defs common to client and server +#ifndef _BOTHDEFS_H +#define _BOTHDEFS_H + #ifdef USE_INTEL_ASM #define UNALIGNED_OK 1 // set to 0 if unaligned accesses are not supported #else @@ -91,7 +94,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define STAT_VIEWHEIGHT 16 #define STAT_FLYMODE 17 - // // item flags // @@ -141,3 +143,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PRINT_HIGH 2 // critical messages #define PRINT_CHAT 3 // chat messages +#endif // _BOTHDEFS_H \ No newline at end of file diff --git a/include/bspfile.h b/include/bspfile.h index 082b868..7f999ff 100644 --- a/include/bspfile.h +++ b/include/bspfile.h @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _BSPFILE_H #define _BSPFILE_H +#include "common.h" + // upper design bounds #define MAX_MAP_HULLS 4 @@ -265,7 +267,6 @@ extern int numsurfedges; extern int dsurfedges[MAX_MAP_SURFEDGES]; - void LoadBSPFile (char *filename); void WriteBSPFile (char *filename); void PrintBSPFileSizes (void); diff --git a/include/cdaudio.h b/include/cdaudio.h index 80e975b..f85962f 100644 --- a/include/cdaudio.h +++ b/include/cdaudio.h @@ -18,6 +18,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _CDAUDIO_H +#define _CDAUDIO_H + +#include "common.h" + int CDAudio_Init(void); void CDAudio_Play(byte track, qboolean looping); void CDAudio_Stop(void); @@ -25,3 +30,5 @@ void CDAudio_Pause(void); void CDAudio_Resume(void); void CDAudio_Shutdown(void); void CDAudio_Update(void); + +#endif // _CDAUDIO_H \ No newline at end of file diff --git a/include/client.h b/include/client.h index 7968fb2..2adf72c 100644 --- a/include/client.h +++ b/include/client.h @@ -22,6 +22,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _CLIENT_H #define _CLIENT_H +// since all headers are circular-protected with #ifdef _xxx_H +// try to get them self-sufficient by including whatever other +// headers they might need + +#include + +#include "common.h" +#include "mathlib.h" +#include "protocol.h" +#include "zone.h" +#include "net.h" +#include "model.h" +#include "sound.h" +#include "render.h" +#include "cvar.h" + typedef struct { char name[16]; diff --git a/include/commdef.h b/include/commdef.h index 9beb12f..46979d3 100644 --- a/include/commdef.h +++ b/include/commdef.h @@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # include "config.h" #endif +#include "common.h" +//#include "var.h" /* The host system specifies the base of the directory tree, the command line parms passed to the program, and the amount of memory diff --git a/include/common.h b/include/common.h index 4a07761..292e6b3 100644 --- a/include/common.h +++ b/include/common.h @@ -17,10 +17,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// comndef.h -- general definitions +// common.h -- general definitions + #ifndef _COMMON_H #define _COMMON_H +//#include "protocol.h" // for struct usercmd_s + typedef unsigned char byte; #define _DEF_BYTE_ @@ -30,7 +33,7 @@ typedef unsigned char byte; typedef enum {false, true} qboolean; -#define MAX_INFO_STRING 196 +#define MAX_INFO_STRING 196 #define MAX_SERVERINFO_STRING 512 #define MAX_LOCALINFO_STRING 32768 @@ -57,7 +60,6 @@ typedef struct link_s struct link_s *prev, *next; } link_t; - void ClearLink (link_t *l); void RemoveLink (link_t *l); void InsertLinkBefore (link_t *l, link_t *before); @@ -99,8 +101,6 @@ extern float (*LittleFloat) (float l); //============================================================================ -struct usercmd_s; - extern struct usercmd_s nullcmd; void MSG_WriteChar (sizebuf_t *sb, int c); @@ -166,8 +166,6 @@ void MSG_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *cmd); int Q_atoi (char *str); float Q_atof (char *str); - - //============================================================================ extern char com_token[1024]; @@ -193,7 +191,6 @@ void COM_DefaultExtension (char *path, char *extension); char *va(char *format, ...); // does a varargs printf into a temp buffer - //============================================================================ extern int com_filesize; @@ -228,4 +225,5 @@ byte COM_BlockSequenceCheckByte (byte *base, int length, int sequence, unsigned byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence); int build_number( void ); + #endif // _COMMON_H diff --git a/include/crc.h b/include/crc.h index d01fa3c..4cab51e 100644 --- a/include/crc.h +++ b/include/crc.h @@ -17,9 +17,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* crc.h */ +// crc.h + +#ifndef _CRC_H +#define _CRC_H void CRC_Init(unsigned short *crcvalue); void CRC_ProcessByte(unsigned short *crcvalue, byte data); unsigned short CRC_Value(unsigned short crcvalue); unsigned short CRC_Block (byte *start, int count); + +#endif // _CRC_H \ No newline at end of file diff --git a/include/cvar.h b/include/cvar.h index cef579b..9630d43 100644 --- a/include/cvar.h +++ b/include/cvar.h @@ -31,7 +31,6 @@ #ifndef _CVAR_H #define _CVAR_H - typedef struct cvar_s { char *name; @@ -49,26 +48,25 @@ typedef struct cvar_alias_s struct cvar_alias_s *next; } cvar_alias_t; -#define CVAR_NONE 0 -#define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc - // used for system variables, not for player - // specific configurations -#define CVAR_USERINFO 2 // sent to server on connect or change -#define CVAR_SERVERINFO 4 // sent in response to front end requests -#define CVAR_SYSTEMINFO 8 // these cvars will be duplicated on all clients -#define CVAR_INIT 16 // don't allow change from console at all, - // but can be set from the command line -#define CVAR_NOTIFY 32 // Will notify players when changed. - -#define CVAR_ROM 64 // display only, cannot be set by user at all -#define CVAR_USER_CREATED 128 // created by a set command -#define CVAR_HEAP 256 // allocated off the heap, safe to free -#define CVAR_CHEAT 512 // can not be changed if cheats are disabled +#define CVAR_NONE 0 +#define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc + // used for system variables, not for player + // specific configurations +#define CVAR_USERINFO 2 // sent to server on connect or change +#define CVAR_SERVERINFO 4 // sent in response to front end requests +#define CVAR_SYSTEMINFO 8 // these cvars will be duplicated on all clients +#define CVAR_INIT 16 // don't allow change from console at all, + // but can be set from the command line +#define CVAR_NOTIFY 32 // Will notify players when changed. +#define CVAR_ROM 64 // display only, cannot be set by user at all +#define CVAR_USER_CREATED 128 // created by a set command +#define CVAR_HEAP 256 // allocated off the heap, safe to free +#define CVAR_CHEAT 512 // can not be changed if cheats are disabled #define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued -#define CVAR_LATCH 2048 // will only change when C code next does - // a Cvar_Get(), so it can't be changed -#define CVAR_TEMP 4906 // can be set even when cheats are - // disabled, but is not archived +#define CVAR_LATCH 2048 // will only change when C code next does + // a Cvar_Get(), so it can't be changed +#define CVAR_TEMP 4906 // can be set even when cheats are + // disabled, but is not archived // Zoid| A good CVAR_ROM example is basepath. The code should read "cvar_t // *fs_basepath = CvarGet("fs_basepath", ".", CVAR_ROM); The user can @@ -109,5 +107,7 @@ cvar_t *Cvar_FindVar (char *var_name); void Cvar_Init(); void Cvar_Shutdown(); + extern cvar_t *cvar_vars; + #endif // _CVAR_H diff --git a/include/d_iface.h b/include/d_iface.h index 1d8f51a..6dc6b92 100644 --- a/include/d_iface.h +++ b/include/d_iface.h @@ -19,6 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // d_iface.h: interface header file for rasterization driver modules +#ifndef _D_IFACE_H +#define _D_IFACE_H + +#include "common.h" +#include "mathlib.h" +#include "model.h" +#include "cvar.h" + #define WARP_WIDTH 320 #define WARP_HEIGHT 200 @@ -231,3 +239,4 @@ extern vrect_t scr_vrect; extern byte *r_warpbuffer; +#endif // _D_IFACE_H diff --git a/include/d_ifacea.h b/include/d_ifacea.h index 241952a..e75493f 100644 --- a/include/d_ifacea.h +++ b/include/d_ifacea.h @@ -23,6 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Include file for asm driver interface. // +#ifndef _D_IFACEA_H +#define _D_IFACEA_H + // // !!! note that this file must match the corresponding C structures in // d_iface.h at all times !!! @@ -96,3 +99,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define atd_seamfixupX16 32 #define atd_size 36 +#endif // _D_IFACE_H + diff --git a/include/draw.h b/include/draw.h index 48433eb..41119c3 100644 --- a/include/draw.h +++ b/include/draw.h @@ -18,12 +18,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _DRAW_H -#define _DRAW_H // draw.h -- these are the only functions outside the refresh allowed // to touch the vid buffer -extern qpic_t *draw_disc; // also used on sbar +#ifndef _DRAW_H +#define _DRAW_H + +#include "wad.h" + +extern qpic_t *draw_disc; // also used on sbar void Draw_Init (void); void Draw_Character (int x, int y, int num); diff --git a/include/glquake.h b/include/glquake.h index 4a54643..9dde6e0 100644 --- a/include/glquake.h +++ b/include/glquake.h @@ -17,9 +17,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// disable data conversion warnings + +#ifndef _GLQUAKE_H +#define _GLQUAKE_H #ifdef _WIN32 +// disable data conversion warnings +// FIXME: move that somewhere else -- yan #pragma warning(disable : 4244) // MIPS #pragma warning(disable : 4136) // X86 #pragma warning(disable : 4051) // ALPHA @@ -31,6 +35,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include +#include "common.h" +#include "model.h" +#include "render.h" +#include "cvar.h" + // Ender: HackHackHack #ifndef GLAPIENTRY # ifdef APIENTRY @@ -343,3 +352,4 @@ void GL_BuildLightmaps (void); // void R_NetGraph (void); +#endif // _GLQUAKE_H \ No newline at end of file diff --git a/include/in_win.h b/include/in_win.h index 4924bd5..c3fd944 100644 --- a/include/in_win.h +++ b/include/in_win.h @@ -25,10 +25,11 @@ */ -#ifndef IN_WIN_H -#define IN_WIN_H +#ifndef _IN_WIN_H +#define _IN_WIN_H -#include "winquake.h" // for usercmd_t in client.h +#include "common.h" +#include "protocol.h" extern qboolean mouseactive; extern float mouse_x, mouse_y; @@ -50,6 +51,6 @@ extern void IN_Accumulate (void); extern void IN_ClearStates (void); extern void IN_Commands (void); -#endif // IN_WIN_H +#endif // _IN_WIN_H diff --git a/include/input.h b/include/input.h index 4a5a129..bd48119 100644 --- a/include/input.h +++ b/include/input.h @@ -19,6 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // input.h -- external (non-keyboard) input devices +#ifndef _INPUT_H +#define _INPUT_H + +#include "protocol.h" + void IN_Init (void); void IN_Shutdown (void); @@ -32,3 +37,4 @@ void IN_Move (usercmd_t *cmd); void IN_ModeChanged (void); // called whenever screen dimensions change +#endif // _INPUT_H diff --git a/include/keys.h b/include/keys.h index 9cbf61f..5a22050 100644 --- a/include/keys.h +++ b/include/keys.h @@ -20,9 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _KEYS_H #define _KEYS_H -// + +#include +#include "common.h" + // these are the key numbers that should be passed to Key_Event -// typedef enum { K_TAB = 9, diff --git a/include/mathlib.h b/include/mathlib.h index ff5cb40..df5bb2d 100644 --- a/include/mathlib.h +++ b/include/mathlib.h @@ -8,7 +8,7 @@ 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. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -22,24 +22,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _MATHLIB_H #define _MATHLIB_H +//#include "model.h" + typedef float vec_t; typedef vec_t vec3_t[3]; typedef vec_t vec5_t[5]; -typedef int fixed4_t; -typedef int fixed8_t; -typedef int fixed16_t; +typedef int fixed4_t; +typedef int fixed8_t; +typedef int fixed16_t; #ifndef M_PI -#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h +#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif struct mplane_s; extern vec3_t vec3_origin; -extern int nanmask; +extern int nanmask; -#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) +#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) #define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) #define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];} @@ -56,7 +58,7 @@ void _VectorCopy (vec3_t in, vec3_t out); int VectorCompare (vec3_t v1, vec3_t v2); vec_t Length (vec3_t v); void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross); -float VectorNormalize (vec3_t v); // returns vector length +float VectorNormalize (vec3_t v); // returns vector length void VectorInverse (vec3_t v); void VectorScale (vec3_t in, vec_t scale, vec3_t out); int Q_log2(int val); @@ -65,32 +67,32 @@ void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); void FloorDivMod (double numer, double denom, int *quotient, - int *rem); + int *rem); fixed16_t Invert24To16(fixed16_t val); fixed16_t Mul16_30(fixed16_t multiplier, fixed16_t multiplicand); int GreatestCommonDivisor (int i1, int i2); void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); -float anglemod(float a); +float anglemod(float a); void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ); -#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ - (((p)->type < 3)? \ - ( \ - ((p)->dist <= (emins)[(p)->type])? \ - 1 \ - : \ - ( \ - ((p)->dist >= (emaxs)[(p)->type])?\ - 2 \ - : \ - 3 \ - ) \ - ) \ - : \ - BoxOnPlaneSide( (emins), (emaxs), (p))) +#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ + (((p)->type < 3)? \ + ( \ + ((p)->dist <= (emins)[(p)->type])? \ + 1 \ + : \ + ( \ + ((p)->dist >= (emaxs)[(p)->type])?\ + 2 \ + : \ + 3 \ + ) \ + ) \ + : \ + BoxOnPlaneSide( (emins), (emaxs), (p))) #endif // _MATHLIB_H diff --git a/include/mdfour.h b/include/mdfour.h index a39c74b..b1b228b 100644 --- a/include/mdfour.h +++ b/include/mdfour.h @@ -27,13 +27,13 @@ $Id$ */ +#ifndef _MDFOUR_H +#define _MDFOUR_H + #ifndef _UINT32_H #include #endif -#ifndef _MDFOUR_H -#define _MDFOUR_H - struct mdfour { uint32 A, B, C, D; uint32 totalN; diff --git a/include/menu.h b/include/menu.h index 8a30d09..ea43dc4 100644 --- a/include/menu.h +++ b/include/menu.h @@ -18,18 +18,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// +#ifndef _MENU_H +#define _MENU_H + +#include "wad.h" + // the net drivers should just set the apropriate bits in m_activenet, // instead of having the menu code look through their internal tables -// + #define MNET_IPX 1 #define MNET_TCP 2 extern int m_activenet; -// // menus -// + void M_Init (void); void M_Keydown (int key); void M_Draw (void); @@ -38,4 +41,4 @@ qpic_t *M_CachePic (char *path); void M_DrawTextBox (int x, int y, int width, int lines); void M_Menu_Quit_f (void); - +#endif // _MENU_H diff --git a/include/model.h b/include/model.h index aa72824..33b031e 100644 --- a/include/model.h +++ b/include/model.h @@ -20,9 +20,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __MODEL__ -#define __MODEL__ +#ifndef _MODEL_H +#define _MODEL_H +#include "common.h" +#include "mathlib.h" +#include "render.h" +#include "bspfile.h" #include "modelgen.h" #include "spritegn.h" @@ -178,8 +182,6 @@ typedef struct mnode_s unsigned short numsurfaces; } mnode_t; - - typedef struct mleaf_s { // common with node @@ -219,7 +221,6 @@ SPRITE MODELS ============================================================================== */ - // FIXME: shorten these? typedef struct mspriteframe_s { @@ -457,4 +458,4 @@ void Mod_TouchModel (char *name); mleaf_t *Mod_PointInLeaf (float *p, model_t *model); byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model); -#endif // __MODEL__ +#endif // _MODEL_H diff --git a/include/modelgen.h b/include/modelgen.h index be9ad92..d6bed6c 100644 --- a/include/modelgen.h +++ b/include/modelgen.h @@ -27,6 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // * pass data from one to the other via model files. * // ********************************************************* +#ifndef _MODELGEN_H +#define _MODELGEN_H + +#include "mathlib.h" + #ifdef INCLUDELIBS #include @@ -131,4 +136,4 @@ typedef struct { #define IDPOLYHEADER (('O'<<24)+('P'<<16)+('D'<<8)+'I') // little-endian "IDPO" - +#endif // _MODELGEN_H diff --git a/include/net.h b/include/net.h index b22190c..ef5a948 100644 --- a/include/net.h +++ b/include/net.h @@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _NET_H #define _NET_H +#include "common.h" +#include "cvar.h" + #define PORT_ANY -1 typedef struct diff --git a/include/pmove.h b/include/pmove.h index 4b18782..98400fb 100644 --- a/include/pmove.h +++ b/include/pmove.h @@ -18,6 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _PMOVE_H +#define _PMOVE_H + +#include "common.h" +#include "protocol.h" +#include "mathlib.h" +#include "model.h" + typedef struct { vec3_t normal; @@ -100,3 +108,5 @@ int PM_HullPointContents (hull_t *hull, int num, vec3_t p); int PM_PointContents (vec3_t point); qboolean PM_TestPlayerPosition (vec3_t point); pmtrace_t PM_PlayerMove (vec3_t start, vec3_t stop); + +#endif // _PMOVE_H diff --git a/include/pr_comp.h b/include/pr_comp.h index b237ed5..8c5b5c8 100644 --- a/include/pr_comp.h +++ b/include/pr_comp.h @@ -20,12 +20,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // this file is shared by quake and qcc +#ifndef _PR_COMP_H +#define _PR_COMP_H + typedef int func_t; typedef int string_t; typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t; - #define OFS_NULL 0 #define OFS_RETURN 1 #define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors @@ -38,7 +40,6 @@ typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_f #define OFS_PARM7 25 #define RESERVED_OFS 28 - enum { OP_DONE, OP_MUL_F, @@ -117,7 +118,6 @@ enum { OP_BITOR }; - typedef struct statement_s { unsigned short op; @@ -131,6 +131,7 @@ typedef struct unsigned short ofs; int s_name; } ddef_t; + #define DEF_SAVEGLOBAL (1<<15) #define MAX_PARMS 8 @@ -150,8 +151,8 @@ typedef struct byte parm_size[MAX_PARMS]; } dfunction_t; - #define PROG_VERSION 6 + typedef struct { int version; @@ -178,3 +179,4 @@ typedef struct int entityfields; } dprograms_t; +#endif // _PR_COMP_H diff --git a/include/progs.h b/include/progs.h index dd23433..6bcc726 100644 --- a/include/progs.h +++ b/include/progs.h @@ -18,6 +18,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _PROGS_H +#define _PROGS_H + +#include "common.h" +#include "protocol.h" #include "pr_comp.h" // defs shared with qcc #include "progdefs.h" // generated by program cdefs @@ -145,3 +150,4 @@ extern int num_prstr; char *PR_GetString(int num); int PR_SetString(char *s); +#endif // _PROGS_H diff --git a/include/protocol.h b/include/protocol.h index f8abbcc..6cb128c 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _PROTOCOL_H #define _PROTOCOL_H +#include "common.h" +#include "mathlib.h" + #define PROTOCOL_VERSION 28 #define QW_CHECK_HASH 0x5157 diff --git a/include/quakedef.h b/include/quakedef.h index d0de549..a9c1800 100644 --- a/include/quakedef.h +++ b/include/quakedef.h @@ -19,15 +19,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // quakedef.h -- primary header for client +#ifndef _QUAKEDEF_H +#define _QUAKEDEF_H + #define QUAKE_GAME // as opposed to utilities //define PARANOID // speed sapping error checking - #ifdef _WIN32 #pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018) #endif +// FIXME: clean those includes -- yan #include #include @@ -72,24 +75,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "compat.h" #include "commdef.h" - #define MAX_NUM_ARGVS 50 - extern qboolean noclip_anglehack; +extern cvar_t *sys_ticrate; +extern cvar_t *password; -/* extern cvar_t sys_ticrate; - CVAR_FIXME */ -extern cvar_t *sys_ticrate; +extern byte *host_basepal; +extern byte *host_colormap; +extern int host_framecount; // incremented every frame, never reset -/* extern cvar_t password; - CVAR_FIXME */ -extern cvar_t *password; - -extern byte *host_basepal; -extern byte *host_colormap; -extern int host_framecount; // incremented every frame, never reset +extern qboolean msg_suppress_1; // Suppresses resolution and cache size console + // output and fullscreen DIB focus gain/loss void Host_ServerFrame (void); void Host_InitCommands (void); @@ -103,6 +101,4 @@ void Host_Quit_f (void); void Host_ClientCommands (char *fmt, ...); void Host_ShutdownServer (qboolean crash); -extern qboolean msg_suppress_1; /* Suppresses resolution and cache - size console output and - fullscreen DIB focus gain/loss */ +#endif // _QUAKEDEH_H diff --git a/include/qwsvdef.h b/include/qwsvdef.h index 0d0cb7b..f758d3e 100644 --- a/include/qwsvdef.h +++ b/include/qwsvdef.h @@ -17,7 +17,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// quakedef.h -- primary header for server +// qwsvdef.h -- primary header for server + +#ifndef _QWSVDEF_H +#define _QWSVDEF_H #define QUAKE_GAME // as opposed to utilities @@ -27,6 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018) #endif +// FIXME: clean those includes -- yan + #include #include #include @@ -60,9 +65,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "compat.h" #include "commdef.h" - void SV_Error (char *error, ...); void SV_Init (quakeparms_t *parms); void Con_Printf (char *fmt, ...); void Con_DPrintf (char *fmt, ...); + +#endif \ No newline at end of file diff --git a/include/r_local.h b/include/r_local.h index 9fe4ac1..d193172 100644 --- a/include/r_local.h +++ b/include/r_local.h @@ -19,7 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // r_local.h -- private refresh defs +#ifndef _R_LOCAL_H +#define _R_LOCAL_H +#include "common.h" +#include "mathlib.h" +#include "cvar.h" +#include "vid.h" +#include "client.h" +#include "model.h" +#include "pmove.h" #include "r_shared.h" #define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0) @@ -352,3 +361,4 @@ void R_MarkLights (dlight_t *light, int bit, mnode_t *node); void R_LoadSkys (char *); +#endif // _R_LOCAL_H diff --git a/include/r_shared.h b/include/r_shared.h index 10adb1a..b0dfbeb 100644 --- a/include/r_shared.h +++ b/include/r_shared.h @@ -23,8 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // FIXME: clean up and move into d_iface.h -#ifndef _R_SHARED_H_ -#define _R_SHARED_H_ +#ifndef _R_SHARED_H +#define _R_SHARED_H + +#include "common.h" +#include "mathlib.h" +#include "cvar.h" +#include "model.h" #define MAXVERTS 16 // max points in a surface polygon #define MAXWORKINGVERTS (MAXVERTS+4) // max points in an intermediate @@ -151,4 +156,4 @@ typedef struct edge_s medge_t *owner; } edge_t; -#endif // _R_SHARED_H_ +#endif // _R_SHARED_H diff --git a/include/render.h b/include/render.h index 1b7c05a..6093a10 100644 --- a/include/render.h +++ b/include/render.h @@ -18,11 +18,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// refresh.h -- public interface to refresh functions +// render.h -- public interface to refresh functions #ifndef _RENDER_H #define _RENDER_H +#include "common.h" +#include "mathlib.h" +#include "cvar.h" +#include "vid.h" +//#include "model.h" +//now we know why (struct model_s *) is used here instead of model_t +//damn circular reference ! same with player_info_s -- yan + #define TOP_RANGE 16 // soldier uniform colors #define BOTTOM_RANGE 96 @@ -36,7 +44,6 @@ typedef struct efrag_s struct efrag_s *entnext; } efrag_t; - typedef struct entity_s { int keynum; // for matching entities in different frames @@ -97,13 +104,11 @@ typedef struct int ambientlight; } refdef_t; - // // refresh // extern int reinit_surfcache; - extern refdef_t r_refdef; extern vec3_t r_origin, vpn, vright, vup; @@ -140,7 +145,6 @@ void R_ClearParticles (void); void R_DrawParticles (void); void R_DrawWaterSurfaces (void); - // // surface cache related // diff --git a/include/sbar.h b/include/sbar.h index 286b3b6..c6a40d7 100644 --- a/include/sbar.h +++ b/include/sbar.h @@ -21,9 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // the status bar is only redrawn if something has changed, but if anything // does, the entire thing will be redrawn for the next vid.numpages frames. +#ifndef _SBAR_H +#define _SBAR_H + #define SBAR_HEIGHT 24 -extern int sb_lines; // scan lines to draw +extern int sb_lines; // scan lines to draw void Sbar_Init (void); @@ -37,3 +40,5 @@ void Sbar_IntermissionOverlay (void); // called each frame after the level has been completed void Sbar_FinaleOverlay (void); + +#endif \ No newline at end of file diff --git a/include/screen.h b/include/screen.h index 041ab29..1d115a9 100644 --- a/include/screen.h +++ b/include/screen.h @@ -19,6 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // screen.h +#ifndef _SCREEN_H +#define _SCREEN_H + +#include "common.h" +#include "cvar.h" + void SCR_InitCvars (void); void SCR_Init (void); @@ -56,3 +62,5 @@ extern int scr_copyeverything; extern qboolean scr_skipupdate; extern qboolean block_drawing; + +#endif // _SCREEN_H diff --git a/include/server.h b/include/server.h index 5ba4173..67f9f60 100644 --- a/include/server.h +++ b/include/server.h @@ -19,6 +19,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // server.h +#ifndef _SERVER_H +#define _SERVER_H + +#include "common.h" +#include "cvar.h" +#include "protocol.h" +#include "model.h" +#include "progs.h" + #define QW_SERVER #define MAX_MASTERS 8 // max recipients for heartbeat packets @@ -90,7 +99,6 @@ typedef struct byte signon_buffers[MAX_SIGNON_BUFFERS][MAX_DATAGRAM]; } server_t; - #define NUM_SPAWN_PARMS 16 typedef enum @@ -149,10 +157,10 @@ typedef struct client_s byte datagram_buf[MAX_DATAGRAM]; // back buffers for client reliable data - sizebuf_t backbuf; - int num_backbuf; - int backbuf_size[MAX_BACK_BUFFERS]; - byte backbuf_data[MAX_BACK_BUFFERS][MAX_MSGLEN]; + sizebuf_t backbuf; + int num_backbuf; + int backbuf_size[MAX_BACK_BUFFERS]; + byte backbuf_data[MAX_BACK_BUFFERS][MAX_MSGLEN]; double connection_started; // or time of disconnect for zombies qboolean send_message; // set on frames a datagram arived on @@ -165,7 +173,6 @@ typedef struct client_s int stats[MAX_CL_STATS]; - client_frame_t frames[UPDATE_BACKUP]; // updates can be deltad from here FILE *download; // file being downloaded @@ -175,7 +182,7 @@ typedef struct client_s int spec_track; // entnum of player tracking double whensaid[10]; // JACK: For floodprots - int whensaidhead; // Head value for floodprots + int whensaidhead; // Head value for floodprots double lockedtill; qboolean upgradewarn; // did we warn him? @@ -189,14 +196,12 @@ typedef struct client_s int chokecount; int delta_sequence; // -1 = no compression netchan_t netchan; - int msecs, msec_cheating; - double last_check; + int msecs, msec_cheating; + double last_check; } client_t; // a client can leave the server in one of four ways: // dropping properly by quiting or disconnecting -/* // timing out if no valid messages are received for timeout.value seconds - CVAR_FIXME */ // timing out if no valid messages are received for timeout->value seconds // getting kicked off by the server operator // a program error, like an overflowed reliable buffer @@ -320,30 +325,17 @@ extern client_state_t cls; #define MULTICAST_PVS_R 5 //============================================================================ +// FIXME: declare exported variables in their own relevant .h -/* extern cvar_t sv_mintic, sv_maxtic; - CVAR_FIXME */ extern cvar_t *sv_mintic, *sv_maxtic; -/* extern cvar_t sv_maxspeed; - CVAR_FIXME */ extern cvar_t *sv_maxspeed; extern netadr_t master_adr[MAX_MASTERS]; // address of the master server -/* extern cvar_t spawn; - CVAR_FIXME */ extern cvar_t *spawn; -/* extern cvar_t teamplay; - CVAR_FIXME */ extern cvar_t *teamplay; -/* extern cvar_t deathmatch; - CVAR_FIXME */ extern cvar_t *deathmatch; -/* extern cvar_t fraglimit; - CVAR_FIXME */ extern cvar_t *fraglimit; -/* extern cvar_t timelimit; - CVAR_FIXME */ extern cvar_t *timelimit; extern server_static_t svs; // persistant server info @@ -362,6 +354,7 @@ extern FILE *sv_logfile; extern FILE *sv_fraglogfile; //=========================================================== +// FIXME: declare exported functions in their own relevant .h // // sv_main.c @@ -438,7 +431,6 @@ void SV_ExecuteClientMessage (client_t *cl); void SV_UserInit (void); void SV_TogglePause (const char *msg); - // // svonly.c // @@ -459,7 +451,6 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg); // // sv_nchan.c // - void ClientReliableCheckBlock(client_t *cl, int maxsize); void ClientReliable_FinishWrite(client_t *cl); void ClientReliableWrite_Begin(client_t *cl, int c, int maxsize); @@ -474,3 +465,4 @@ void ClientReliableWrite_Short(client_t *cl, int c); void ClientReliableWrite_String(client_t *cl, char *s); void ClientReliableWrite_SZ(client_t *cl, void *data, int len); +#endif // _SERVER_H diff --git a/include/sound.h b/include/sound.h index da9df70..daa4f4b 100644 --- a/include/sound.h +++ b/include/sound.h @@ -19,8 +19,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // sound.h -- client sound i/o functions -#ifndef __SOUND__ -#define __SOUND__ +#ifndef _SOUND_H +#define _SOUND_H + +#include "common.h" +#include "mathlib.h" +#include "zone.h" +#include "cvar.h" // !!! if this is changed, it much be changed in asm_i386.h too !!! typedef struct @@ -127,7 +132,6 @@ void SNDDMA_Shutdown(void); #define MAX_CHANNELS 128 #define MAX_DYNAMIC_CHANNELS 8 - extern channel_t channels[MAX_CHANNELS]; // 0 to MAX_DYNAMIC_CHANNELS-1 = normal entity sounds // MAX_DYNAMIC_CHANNELS to MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS -1 = water, etc @@ -152,14 +156,8 @@ extern volatile dma_t *shm; extern volatile dma_t sn; extern vec_t sound_nominal_clip_dist; -/* extern cvar_t loadas8bit; - CVAR_FIXME */ extern cvar_t *loadas8bit; -/* extern cvar_t bgmvolume; - CVAR_FIXME */ extern cvar_t *bgmvolume; -/* extern cvar_t volume; - CVAR_FIXME */ extern cvar_t *volume; extern qboolean snd_initialized; @@ -177,4 +175,4 @@ void SNDDMA_Submit(void); void S_AmbientOff (void); void S_AmbientOn (void); -#endif +#endif // _SOUND_H diff --git a/include/spritegn.h b/include/spritegn.h index b192b54..8d85d7d 100644 --- a/include/spritegn.h +++ b/include/spritegn.h @@ -42,6 +42,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //------------------------------------------------------- +#ifndef _SPRITEGN_H +#define _SPRITEGN_H + #ifdef INCLUDELIBS #include @@ -107,4 +110,4 @@ typedef struct { #define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDSP" - +#endif // _SPRITEGN_H diff --git a/include/sys.h b/include/sys.h index 3eba678..1212595 100644 --- a/include/sys.h +++ b/include/sys.h @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // sys.h -- non-portable functions -#ifndef __SYS_H -#define __SYS_H +#ifndef _SYS_H +#define _SYS_H // // file IO @@ -77,5 +77,5 @@ void Sys_Printf (char *fmt, ...); void Sys_Init (void); -#endif // __SYS_H +#endif // _SYS_H diff --git a/include/vid.h b/include/vid.h index 3e1d571..3fcb4b4 100644 --- a/include/vid.h +++ b/include/vid.h @@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _VID_H #define _VID_H +#include "common.h" + #define VID_CBITS 6 #define VID_GRADES (1 << VID_CBITS) diff --git a/include/view.h b/include/view.h index f2098ed..0b9f14d 100644 --- a/include/view.h +++ b/include/view.h @@ -19,11 +19,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // view.h -/* extern cvar_t v_gamma; - CVAR_FIXME */ +#ifndef _VIEW_H +#define _VIEW_H + +#include "mathlib.h" +#include "cvar.h" + extern cvar_t *v_gamma; -/* extern cvar_t lcd_x; - CVAR_FIXME */ extern cvar_t *lcd_x; void V_Init (void); @@ -31,3 +33,4 @@ void V_RenderView (void); float V_CalcRoll (vec3_t angles, vec3_t velocity); void V_UpdatePalette (void); +#endif // _VIEW_H diff --git a/include/wad.h b/include/wad.h index 22ebf10..52fa31d 100644 --- a/include/wad.h +++ b/include/wad.h @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // wad.h + #ifndef _WAD_H #define _WAD_H @@ -44,8 +45,6 @@ typedef struct byte data[4]; // variably sized } qpic_t; - - typedef struct { char identification[4]; // should be WAD2 or 2DAW diff --git a/include/winquake.h b/include/winquake.h index 07c237b..4fea1b8 100644 --- a/include/winquake.h +++ b/include/winquake.h @@ -19,10 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // winquake.h: Win32-specific Quake header file -#ifndef WINQUAKE_H -#define WINQUAKE_H +#ifndef _WINQUAKE_H +#define _WINQUAKE_H #ifdef _WIN32 + #pragma warning( disable : 4229 ) // mgraph gets this #include @@ -30,6 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include // Was #ifdef GLQUAKE +#include "common.h" + #define WM_MOUSEWHEEL 0x020A extern HINSTANCE global_hInstance; @@ -106,4 +109,4 @@ int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name, int FAR * namelen); #endif // _WIN32 -#endif // WINQUAKE_H \ No newline at end of file +#endif // _WINQUAKE_H \ No newline at end of file diff --git a/include/world.h b/include/world.h index 3dd9e81..ec85ec7 100644 --- a/include/world.h +++ b/include/world.h @@ -19,6 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // world.h +#ifndef _WORLD_H +#define _WORLD_H + +#include "common.h" +#include "mathlib.h" +#include "model.h" +#include "progs.h" + typedef struct { vec3_t normal; @@ -27,16 +35,15 @@ typedef struct typedef struct { - qboolean allsolid; // if true, plane is not valid - qboolean startsolid; // if true, the initial point was in a solid area + qboolean allsolid; // if true, plane is not valid + qboolean startsolid; // if true, the initial point was in a solid area qboolean inopen, inwater; - float fraction; // time completed, 1.0 = didn't hit anything - vec3_t endpos; // final position - plane_t plane; // surface normal at impact - edict_t *ent; // entity the surface is on + float fraction; // time completed, 1.0 = didn't hit anything + vec3_t endpos; // final position + plane_t plane; // surface normal at impact + edict_t *ent; // entity the surface is on } trace_t; - #define MOVE_NORMAL 0 #define MOVE_NOMONSTERS 1 #define MOVE_MISSILE 2 @@ -55,7 +62,6 @@ typedef struct areanode_s extern areanode_t sv_areanodes[AREA_NODES]; - void SV_ClearWorld (void); // called after the world model has been loaded, before linking any entities @@ -89,5 +95,6 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e // passedict is explicitly excluded from clipping checks (normally NULL) - edict_t *SV_TestPlayerPosition (edict_t *ent, vec3_t origin); + +#endif // _WORLD_H