|
|
1.1 ! root 1: /* ! 2: Copyright (C) 1996-1997 Id Software, Inc. ! 3: ! 4: This program is free software; you can redistribute it and/or ! 5: modify it under the terms of the GNU General Public License ! 6: as published by the Free Software Foundation; either version 2 ! 7: of the License, or (at your option) any later version. ! 8: ! 9: This program is distributed in the hope that it will be useful, ! 10: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! 12: ! 13: See the GNU General Public License for more details. ! 14: ! 15: You should have received a copy of the GNU General Public License ! 16: along with this program; if not, write to the Free Software ! 17: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! 18: ! 19: */ ! 20: // comndef.h -- general definitions ! 21: ! 22: typedef unsigned char byte; ! 23: #define _DEF_BYTE_ ! 24: ! 25: // KJB Undefined true and false defined in SciTech's DEBUG.H header ! 26: #undef true ! 27: #undef false ! 28: ! 29: typedef enum {false, true} qboolean; ! 30: ! 31: #define MAX_INFO_STRING 196 ! 32: #define MAX_SERVERINFO_STRING 512 ! 33: #define MAX_LOCALINFO_STRING 32768 ! 34: ! 35: //============================================================================ ! 36: ! 37: typedef struct sizebuf_s ! 38: { ! 39: qboolean allowoverflow; // if false, do a Sys_Error ! 40: qboolean overflowed; // set to true if the buffer size failed ! 41: byte *data; ! 42: int maxsize; ! 43: int cursize; ! 44: } sizebuf_t; ! 45: ! 46: void SZ_Clear (sizebuf_t *buf); ! 47: void *SZ_GetSpace (sizebuf_t *buf, int length); ! 48: void SZ_Write (sizebuf_t *buf, void *data, int length); ! 49: void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf ! 50: ! 51: //============================================================================ ! 52: ! 53: typedef struct link_s ! 54: { ! 55: struct link_s *prev, *next; ! 56: } link_t; ! 57: ! 58: ! 59: void ClearLink (link_t *l); ! 60: void RemoveLink (link_t *l); ! 61: void InsertLinkBefore (link_t *l, link_t *before); ! 62: void InsertLinkAfter (link_t *l, link_t *after); ! 63: ! 64: // (type *)STRUCT_FROM_LINK(link_t *link, type, member) ! 65: // ent = STRUCT_FROM_LINK(link,entity_t,order) ! 66: // FIXME: remove this mess! ! 67: #define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m))) ! 68: ! 69: //============================================================================ ! 70: ! 71: #ifndef NULL ! 72: #define NULL ((void *)0) ! 73: #endif ! 74: ! 75: #define Q_MAXCHAR ((char)0x7f) ! 76: #define Q_MAXSHORT ((short)0x7fff) ! 77: #define Q_MAXINT ((int)0x7fffffff) ! 78: #define Q_MAXLONG ((int)0x7fffffff) ! 79: #define Q_MAXFLOAT ((int)0x7fffffff) ! 80: ! 81: #define Q_MINCHAR ((char)0x80) ! 82: #define Q_MINSHORT ((short)0x8000) ! 83: #define Q_MININT ((int)0x80000000) ! 84: #define Q_MINLONG ((int)0x80000000) ! 85: #define Q_MINFLOAT ((int)0x7fffffff) ! 86: ! 87: //============================================================================ ! 88: ! 89: extern qboolean bigendien; ! 90: ! 91: extern short (*BigShort) (short l); ! 92: extern short (*LittleShort) (short l); ! 93: extern int (*BigLong) (int l); ! 94: extern int (*LittleLong) (int l); ! 95: extern float (*BigFloat) (float l); ! 96: extern float (*LittleFloat) (float l); ! 97: ! 98: //============================================================================ ! 99: ! 100: struct usercmd_s; ! 101: ! 102: extern struct usercmd_s nullcmd; ! 103: ! 104: void MSG_WriteChar (sizebuf_t *sb, int c); ! 105: void MSG_WriteByte (sizebuf_t *sb, int c); ! 106: void MSG_WriteShort (sizebuf_t *sb, int c); ! 107: void MSG_WriteLong (sizebuf_t *sb, int c); ! 108: void MSG_WriteFloat (sizebuf_t *sb, float f); ! 109: void MSG_WriteString (sizebuf_t *sb, char *s); ! 110: void MSG_WriteCoord (sizebuf_t *sb, float f); ! 111: void MSG_WriteAngle (sizebuf_t *sb, float f); ! 112: void MSG_WriteAngle16 (sizebuf_t *sb, float f); ! 113: void MSG_WriteDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd); ! 114: ! 115: extern int msg_readcount; ! 116: extern qboolean msg_badread; // set if a read goes beyond end of message ! 117: ! 118: void MSG_BeginReading (void); ! 119: int MSG_GetReadCount(void); ! 120: int MSG_ReadChar (void); ! 121: int MSG_ReadByte (void); ! 122: int MSG_ReadShort (void); ! 123: int MSG_ReadLong (void); ! 124: float MSG_ReadFloat (void); ! 125: char *MSG_ReadString (void); ! 126: char *MSG_ReadStringLine (void); ! 127: ! 128: float MSG_ReadCoord (void); ! 129: float MSG_ReadAngle (void); ! 130: float MSG_ReadAngle16 (void); ! 131: void MSG_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *cmd); ! 132: ! 133: //============================================================================ ! 134: ! 135: #define Q_memset(d, f, c) memset((d), (f), (c)) ! 136: #define Q_memcpy(d, s, c) memcpy((d), (s), (c)) ! 137: #define Q_memcmp(m1, m2, c) memcmp((m1), (m2), (c)) ! 138: #define Q_strcpy(d, s) strcpy((d), (s)) ! 139: #define Q_strncpy(d, s, n) strncpy((d), (s), (n)) ! 140: #define Q_strlen(s) ((int)strlen(s)) ! 141: #define Q_strrchr(s, c) strrchr((s), (c)) ! 142: #define Q_strcat(d, s) strcat((d), (s)) ! 143: #define Q_strcmp(s1, s2) strcmp((s1), (s2)) ! 144: #define Q_strncmp(s1, s2, n) strncmp((s1), (s2), (n)) ! 145: ! 146: #ifdef _WIN32 ! 147: ! 148: #define Q_strcasecmp(s1, s2) _stricmp((s1), (s2)) ! 149: #define Q_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n)) ! 150: ! 151: #else ! 152: ! 153: #define Q_strcasecmp(s1, s2) strcasecmp((s1), (s2)) ! 154: #define Q_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n)) ! 155: ! 156: #endif ! 157: ! 158: int Q_atoi (char *str); ! 159: float Q_atof (char *str); ! 160: ! 161: ! 162: ! 163: //============================================================================ ! 164: ! 165: extern char com_token[1024]; ! 166: extern qboolean com_eof; ! 167: ! 168: char *COM_Parse (char *data); ! 169: ! 170: ! 171: extern int com_argc; ! 172: extern char **com_argv; ! 173: ! 174: int COM_CheckParm (char *parm); ! 175: void COM_AddParm (char *parm); ! 176: ! 177: void COM_Init (void); ! 178: void COM_InitArgv (int argc, char **argv); ! 179: ! 180: char *COM_SkipPath (char *pathname); ! 181: void COM_StripExtension (char *in, char *out); ! 182: void COM_FileBase (char *in, char *out); ! 183: void COM_DefaultExtension (char *path, char *extension); ! 184: ! 185: char *va(char *format, ...); ! 186: // does a varargs printf into a temp buffer ! 187: ! 188: ! 189: //============================================================================ ! 190: ! 191: extern int com_filesize; ! 192: struct cache_user_s; ! 193: ! 194: extern char com_gamedir[MAX_OSPATH]; ! 195: ! 196: void COM_WriteFile (char *filename, void *data, int len); ! 197: int COM_FOpenFile (char *filename, FILE **file); ! 198: void COM_CloseFile (FILE *h); ! 199: ! 200: byte *COM_LoadStackFile (char *path, void *buffer, int bufsize); ! 201: byte *COM_LoadTempFile (char *path); ! 202: byte *COM_LoadHunkFile (char *path); ! 203: void COM_LoadCacheFile (char *path, struct cache_user_s *cu); ! 204: void COM_CreatePath (char *path); ! 205: void COM_Gamedir (char *dir); ! 206: ! 207: extern struct cvar_s registered; ! 208: extern qboolean standard_quake, rogue, hipnotic; ! 209: ! 210: char *Info_ValueForKey (char *s, char *key); ! 211: void Info_RemoveKey (char *s, char *key); ! 212: void Info_RemovePrefixedKeys (char *start, char prefix); ! 213: void Info_SetValueForKey (char *s, char *key, char *value, int maxsize); ! 214: void Info_SetValueForStarKey (char *s, char *key, char *value, int maxsize); ! 215: void Info_Print (char *s); ! 216: ! 217: unsigned Com_BlockChecksum (void *buffer, int length); ! 218: void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf); ! 219: byte COM_BlockSequenceCheckByte (byte *base, int length, int sequence, unsigned mapchecksum); ! 220: byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence); ! 221: ! 222: int build_number( void );
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.