Annotation of quake2/qcommon/qcommon.h, revision 1.1.1.3

1.1       root        1: 
                      2: // qcommon.h -- definitions common between client and server, but not game.dll
                      3: 
                      4: #include "../game/q_shared.h"
                      5: 
                      6: 
1.1.1.3 ! root        7: #define        VERSION         3.19
1.1       root        8: 
1.1.1.2   root        9: #define        BASEDIRNAME     "baseq2"
1.1       root       10: 
                     11: #ifdef WIN32
                     12: 
                     13: #ifdef NDEBUG
1.1.1.2   root       14: #define BUILDSTRING "Win32 RELEASE"
1.1       root       15: #else
1.1.1.2   root       16: #define BUILDSTRING "Win32 DEBUG"
1.1       root       17: #endif
                     18: 
                     19: #ifdef _M_IX86
                     20: #define        CPUSTRING       "x86"
                     21: #elif defined _M_ALPHA
                     22: #define        CPUSTRING       "AXP"
                     23: #endif
                     24: 
1.1.1.2   root       25: #elif defined __linux__
                     26: 
                     27: #define BUILDSTRING "Linux"
                     28: 
                     29: #ifdef __i386__
                     30: #define CPUSTRING "i386"
                     31: #elif defined __alpha__
                     32: #define CPUSTRING "axp"
                     33: #else
                     34: #define CPUSTRING "Unknown"
                     35: #endif
                     36: 
                     37: #elif defined __sun__
1.1       root       38: 
1.1.1.2   root       39: #define BUILDSTRING "Solaris"
                     40: 
                     41: #ifdef __i386__
                     42: #define CPUSTRING "i386"
                     43: #else
                     44: #define CPUSTRING "sparc"
                     45: #endif
                     46: 
                     47: #else  // !WIN32
1.1       root       48: 
                     49: #define BUILDSTRING "NON-WIN32"
                     50: #define        CPUSTRING       "NON-WIN32"
                     51: 
                     52: #endif
                     53: 
                     54: //============================================================================
                     55: 
                     56: typedef struct sizebuf_s
                     57: {
                     58:        qboolean        allowoverflow;  // if false, do a Com_Error
                     59:        qboolean        overflowed;             // set to true if the buffer size failed
                     60:        byte    *data;
                     61:        int             maxsize;
                     62:        int             cursize;
                     63:        int             readcount;
                     64: } sizebuf_t;
                     65: 
                     66: void SZ_Init (sizebuf_t *buf, byte *data, int length);
                     67: void SZ_Clear (sizebuf_t *buf);
                     68: void *SZ_GetSpace (sizebuf_t *buf, int length);
                     69: void SZ_Write (sizebuf_t *buf, void *data, int length);
                     70: void SZ_Print (sizebuf_t *buf, char *data);    // strcats onto the sizebuf
                     71: 
                     72: //============================================================================
                     73: 
                     74: struct usercmd_s;
                     75: struct entity_state_s;
                     76: 
                     77: void MSG_WriteChar (sizebuf_t *sb, int c);
                     78: void MSG_WriteByte (sizebuf_t *sb, int c);
                     79: void MSG_WriteShort (sizebuf_t *sb, int c);
                     80: void MSG_WriteLong (sizebuf_t *sb, int c);
                     81: void MSG_WriteFloat (sizebuf_t *sb, float f);
                     82: void MSG_WriteString (sizebuf_t *sb, char *s);
                     83: void MSG_WriteCoord (sizebuf_t *sb, float f);
                     84: void MSG_WritePos (sizebuf_t *sb, vec3_t pos);
                     85: void MSG_WriteAngle (sizebuf_t *sb, float f);
                     86: void MSG_WriteAngle16 (sizebuf_t *sb, float f);
                     87: void MSG_WriteDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd);
1.1.1.2   root       88: void MSG_WriteDeltaEntity (struct entity_state_s *from, struct entity_state_s *to, sizebuf_t *msg, qboolean force, qboolean newentity);
1.1       root       89: void MSG_WriteDir (sizebuf_t *sb, vec3_t vector);
                     90: 
                     91: 
                     92: void   MSG_BeginReading (sizebuf_t *sb);
                     93: 
                     94: int            MSG_ReadChar (sizebuf_t *sb);
                     95: int            MSG_ReadByte (sizebuf_t *sb);
                     96: int            MSG_ReadShort (sizebuf_t *sb);
                     97: int            MSG_ReadLong (sizebuf_t *sb);
                     98: float  MSG_ReadFloat (sizebuf_t *sb);
                     99: char   *MSG_ReadString (sizebuf_t *sb);
                    100: char   *MSG_ReadStringLine (sizebuf_t *sb);
                    101: 
                    102: float  MSG_ReadCoord (sizebuf_t *sb);
                    103: void   MSG_ReadPos (sizebuf_t *sb, vec3_t pos);
                    104: float  MSG_ReadAngle (sizebuf_t *sb);
                    105: float  MSG_ReadAngle16 (sizebuf_t *sb);
                    106: void   MSG_ReadDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd);
                    107: 
                    108: void   MSG_ReadDir (sizebuf_t *sb, vec3_t vector);
                    109: 
                    110: void   MSG_ReadData (sizebuf_t *sb, void *buffer, int size);
                    111: 
                    112: //============================================================================
                    113: 
                    114: extern qboolean                bigendien;
                    115: 
                    116: extern short   BigShort (short l);
                    117: extern short   LittleShort (short l);
                    118: extern int             BigLong (int l);
                    119: extern int             LittleLong (int l);
                    120: extern float   BigFloat (float l);
                    121: extern float   LittleFloat (float l);
                    122: 
                    123: //============================================================================
                    124: 
                    125: 
                    126: int    COM_Argc (void);
                    127: char *COM_Argv (int arg);      // range and null checked
                    128: void COM_ClearArgv (int arg);
                    129: int COM_CheckParm (char *parm);
                    130: void COM_AddParm (char *parm);
                    131: 
                    132: void COM_Init (void);
                    133: void COM_InitArgv (int argc, char **argv);
                    134: 
                    135: char *CopyString (char *in);
                    136: 
                    137: //============================================================================
                    138: 
                    139: void Info_Print (char *s);
                    140: 
                    141: 
                    142: /* crc.h */
                    143: 
                    144: void CRC_Init(unsigned short *crcvalue);
                    145: void CRC_ProcessByte(unsigned short *crcvalue, byte data);
                    146: unsigned short CRC_Value(unsigned short crcvalue);
1.1.1.2   root      147: unsigned short CRC_Block (byte *start, int count);
1.1       root      148: 
                    149: 
                    150: 
                    151: /*
                    152: ==============================================================
                    153: 
                    154: PROTOCOL
                    155: 
                    156: ==============================================================
                    157: */
                    158: 
                    159: // protocol.h -- communications protocols
                    160: 
1.1.1.3 ! root      161: #define        PROTOCOL_VERSION        34
1.1       root      162: 
                    163: //=========================================
                    164: 
                    165: #define        PORT_MASTER     27900
                    166: #define        PORT_CLIENT     27901
                    167: #define        PORT_SERVER     27910
                    168: 
                    169: //=========================================
                    170: 
                    171: #define        UPDATE_BACKUP   16      // copies of entity_state_t to keep buffered
                    172:                                                        // must be power of two
                    173: #define        UPDATE_MASK             (UPDATE_BACKUP-1)
                    174: 
                    175: 
                    176: 
                    177: //==================
                    178: // the svc_strings[] array in cl_parse.c should mirror this
                    179: //==================
                    180: 
                    181: //
                    182: // server to client
                    183: //
                    184: enum svc_ops_e
                    185: {
                    186:        svc_bad,
                    187: 
                    188:        // these ops are known to the game dll
                    189:        svc_muzzleflash,
                    190:        svc_muzzleflash2,
                    191:        svc_temp_entity,
                    192:        svc_layout,
                    193:        svc_inventory,
                    194: 
                    195:        // the rest are private to the client and server
                    196:        svc_nop,
                    197:        svc_disconnect,
                    198:        svc_reconnect,
                    199:        svc_sound,                                      // <see code>
                    200:        svc_print,                                      // [byte] id [string] null terminated string
                    201:        svc_stufftext,                          // [string] stuffed into client's console buffer, should be \n terminated
                    202:        svc_serverdata,                         // [long] protocol ...
                    203:        svc_configstring,                       // [short] [string]
                    204:        svc_spawnbaseline,              
                    205:        svc_centerprint,                        // [string] to put in center of the screen
                    206:        svc_download,                           // [short] size [size bytes]
                    207:        svc_playerinfo,                         // variable
                    208:        svc_packetentities,                     // [...]
                    209:        svc_deltapacketentities,        // [...]
                    210:        svc_frame
                    211: };
                    212: 
                    213: //==============================================
                    214: 
                    215: //
                    216: // client to server
                    217: //
                    218: enum clc_ops_e
                    219: {
                    220:        clc_bad,
                    221:        clc_nop,                
                    222:        clc_move,                               // [[usercmd_t]
                    223:        clc_userinfo,                   // [[userinfo string]
                    224:        clc_stringcmd                   // [string] message
                    225: };
                    226: 
                    227: //==============================================
                    228: 
                    229: // plyer_state_t communication
                    230: 
                    231: #define        PS_M_TYPE                       (1<<0)
                    232: #define        PS_M_ORIGIN                     (1<<1)
                    233: #define        PS_M_VELOCITY           (1<<2)
                    234: #define        PS_M_TIME                       (1<<3)
                    235: #define        PS_M_FLAGS                      (1<<4)
                    236: #define        PS_M_GRAVITY            (1<<5)
                    237: #define        PS_M_DELTA_ANGLES       (1<<6)
                    238: 
                    239: #define        PS_VIEWOFFSET           (1<<7)
                    240: #define        PS_VIEWANGLES           (1<<8)
                    241: #define        PS_KICKANGLES           (1<<9)
                    242: #define        PS_BLEND                        (1<<10)
                    243: #define        PS_FOV                          (1<<11)
                    244: #define        PS_WEAPONINDEX          (1<<12)
                    245: #define        PS_WEAPONFRAME          (1<<13)
                    246: #define        PS_RDFLAGS                      (1<<14)
                    247: 
                    248: //==============================================
                    249: 
                    250: // user_cmd_t communication
                    251: 
1.1.1.2   root      252: // ms and light always sent, the others are optional
1.1       root      253: #define        CM_ANGLE1       (1<<0)
                    254: #define        CM_ANGLE2       (1<<1)
                    255: #define        CM_ANGLE3       (1<<2)
                    256: #define        CM_FORWARD      (1<<3)
                    257: #define        CM_SIDE         (1<<4)
                    258: #define        CM_UP           (1<<5)
                    259: #define        CM_BUTTONS      (1<<6)
                    260: #define        CM_IMPULSE      (1<<7)
                    261: 
                    262: //==============================================
                    263: 
                    264: // a sound without an ent or pos will be a local only sound
                    265: #define        SND_VOLUME              (1<<0)          // a byte
                    266: #define        SND_ATTENUATION (1<<1)          // a byte
                    267: #define        SND_POS                 (1<<2)          // three coordinates
                    268: #define        SND_ENT                 (1<<3)          // a short 0-2: channel, 3-12: entity
                    269: #define        SND_OFFSET              (1<<4)          // a byte, msec offset from frame start
                    270: 
                    271: #define DEFAULT_SOUND_PACKET_VOLUME    1.0
                    272: #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
                    273: 
                    274: //==============================================
                    275: 
                    276: // entity_state_t communication
                    277: 
                    278: // try to pack the common update flags into the first byte
                    279: #define        U_ORIGIN1       (1<<0)
                    280: #define        U_ORIGIN2       (1<<1)
                    281: #define        U_ANGLE2        (1<<2)
                    282: #define        U_ANGLE3        (1<<3)
                    283: #define        U_FRAME8        (1<<4)          // frame is a byte
                    284: #define        U_EVENT         (1<<5)
                    285: #define        U_REMOVE        (1<<6)          // REMOVE this entity, don't add it
                    286: #define        U_MOREBITS1     (1<<7)          // read one additional byte
                    287: 
                    288: // second byte
                    289: #define        U_NUMBER16      (1<<8)          // NUMBER8 is implicit if not set
                    290: #define        U_ORIGIN3       (1<<9)
                    291: #define        U_ANGLE1        (1<<10)
                    292: #define        U_MODEL         (1<<11)
                    293: #define U_RENDERFX8    (1<<12)         // fullbright, etc
                    294: #define        U_EFFECTS8      (1<<14)         // autorotate, trails, etc
                    295: #define        U_MOREBITS2     (1<<15)         // read one additional byte
                    296: 
                    297: // third byte
                    298: #define        U_SKIN8         (1<<16)
                    299: #define        U_FRAME16       (1<<17)         // frame is a short
                    300: #define        U_RENDERFX16 (1<<18)    // 8 + 16 = 32
                    301: #define        U_EFFECTS16     (1<<19)         // 8 + 16 = 32
                    302: #define        U_MODEL2        (1<<20)         // weapons, flags, etc
                    303: #define        U_MODEL3        (1<<21)
                    304: #define        U_MODEL4        (1<<22)
                    305: #define        U_MOREBITS3     (1<<23)         // read one additional byte
                    306: 
                    307: // fourth byte
                    308: #define        U_OLDORIGIN     (1<<24)         // FIXME: get rid of this
                    309: #define        U_SKIN16        (1<<25)
                    310: #define        U_SOUND         (1<<26)
                    311: #define        U_SOLID         (1<<27)
                    312: 
                    313: 
                    314: /*
                    315: ==============================================================
                    316: 
                    317: CMD
                    318: 
                    319: Command text buffering and command execution
                    320: 
                    321: ==============================================================
                    322: */
                    323: 
                    324: /*
                    325: 
                    326: Any number of commands can be added in a frame, from several different sources.
                    327: Most commands come from either keybindings or console line input, but remote
                    328: servers can also send across commands and entire text files can be execed.
                    329: 
                    330: The + command line options are also added to the command buffer.
                    331: 
                    332: The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute ();
                    333: 
                    334: */
                    335: 
                    336: #define        EXEC_NOW        0               // don't return until completed
                    337: #define        EXEC_INSERT     1               // insert at current position, but don't run yet
                    338: #define        EXEC_APPEND     2               // add to end of the command buffer
                    339: 
                    340: void Cbuf_Init (void);
                    341: // allocates an initial text buffer that will grow as needed
                    342: 
                    343: void Cbuf_AddText (char *text);
                    344: // as new commands are generated from the console or keybindings,
                    345: // the text is added to the end of the command buffer.
                    346: 
                    347: void Cbuf_InsertText (char *text);
                    348: // when a command wants to issue other commands immediately, the text is
                    349: // inserted at the beginning of the buffer, before any remaining unexecuted
                    350: // commands.
                    351: 
                    352: void Cbuf_ExecuteText (int exec_when, char *text);
                    353: // this can be used in place of either Cbuf_AddText or Cbuf_InsertText
                    354: 
                    355: void Cbuf_AddEarlyCommands (qboolean clear);
                    356: // adds all the +set commands from the command line
                    357: 
                    358: qboolean Cbuf_AddLateCommands (void);
                    359: // adds all the remaining + commands from the command line
                    360: // Returns true if any late commands were added, which
                    361: // will keep the demoloop from immediately starting
                    362: 
                    363: void Cbuf_Execute (void);
                    364: // Pulls off \n terminated lines of text from the command buffer and sends
                    365: // them through Cmd_ExecuteString.  Stops when the buffer is empty.
                    366: // Normally called once per frame, but may be explicitly invoked.
                    367: // Do not call inside a command function!
                    368: 
                    369: void Cbuf_CopyToDefer (void);
                    370: void Cbuf_InsertFromDefer (void);
                    371: // These two functions are used to defer any pending commands while a map
                    372: // is being loaded
                    373: 
                    374: //===========================================================================
                    375: 
                    376: /*
                    377: 
                    378: Command execution takes a null terminated string, breaks it into tokens,
                    379: then searches for a command or variable that matches the first token.
                    380: 
                    381: */
                    382: 
                    383: typedef void (*xcommand_t) (void);
                    384: 
                    385: void   Cmd_Init (void);
                    386: 
                    387: void   Cmd_AddCommand (char *cmd_name, xcommand_t function);
                    388: // called by the init functions of other parts of the program to
                    389: // register commands and functions to call for them.
                    390: // The cmd_name is referenced later, so it should not be in temp memory
                    391: // if function is NULL, the command will be forwarded to the server
                    392: // as a clc_stringcmd instead of executed locally
                    393: void   Cmd_RemoveCommand (char *cmd_name);
                    394: 
                    395: qboolean Cmd_Exists (char *cmd_name);
                    396: // used by the cvar code to check for cvar / command name overlap
                    397: 
                    398: char   *Cmd_CompleteCommand (char *partial);
                    399: // attempts to match a partial command for automatic command line completion
                    400: // returns NULL if nothing fits
                    401: 
                    402: int            Cmd_Argc (void);
                    403: char   *Cmd_Argv (int arg);
                    404: char   *Cmd_Args (void);
                    405: // The functions that execute commands get their parameters with these
                    406: // functions. Cmd_Argv () will return an empty string, not a NULL
1.1.1.2   root      407: // if arg > argc, so string operations are always safe.
1.1       root      408: 
                    409: void   Cmd_TokenizeString (char *text, qboolean macroExpand);
                    410: // Takes a null terminated string.  Does not need to be /n terminated.
                    411: // breaks the string up into arg tokens.
                    412: 
                    413: void   Cmd_ExecuteString (char *text);
                    414: // Parses a single line of text into arguments and tries to execute it
                    415: // as if it was typed at the console
                    416: 
                    417: void   Cmd_ForwardToServer (void);
                    418: // adds the current command line as a clc_stringcmd to the client message.
                    419: // things like godmode, noclip, etc, are commands directed to the server,
                    420: // so when they are typed in at the console, they will need to be forwarded.
                    421: 
                    422: 
                    423: /*
                    424: ==============================================================
                    425: 
                    426: CVAR
                    427: 
                    428: ==============================================================
                    429: */
                    430: 
                    431: /*
                    432: 
                    433: cvar_t variables are used to hold scalar or string variables that can be changed or displayed at the console or prog code as well as accessed directly
                    434: in C code.
                    435: 
                    436: The user can access cvars from the console in three ways:
                    437: r_draworder                    prints the current value
                    438: r_draworder 0          sets the current value to 0
                    439: set r_draworder 0      as above, but creates the cvar if not present
                    440: Cvars are restricted from having the same names as commands to keep this
                    441: interface from being ambiguous.
                    442: */
                    443: 
                    444: extern cvar_t  *cvar_vars;
                    445: 
                    446: cvar_t *Cvar_Get (char *var_name, char *value, int flags);
                    447: // creates the variable if it doesn't exist, or returns the existing one
                    448: // if it exists, the value will not be changed, but flags will be ORed in
                    449: // that allows variables to be unarchived without needing bitflags
                    450: 
                    451: cvar_t         *Cvar_Set (char *var_name, char *value);
                    452: // will create the variable if it doesn't exist
                    453: 
                    454: cvar_t *Cvar_ForceSet (char *var_name, char *value);
                    455: // will set the variable even if NOSET or LATCH
                    456: 
                    457: cvar_t         *Cvar_FullSet (char *var_name, char *value, int flags);
                    458: 
                    459: void   Cvar_SetValue (char *var_name, float value);
                    460: // expands value to a string and calls Cvar_Set
                    461: 
                    462: float  Cvar_VariableValue (char *var_name);
                    463: // returns 0 if not defined or non numeric
                    464: 
                    465: char   *Cvar_VariableString (char *var_name);
                    466: // returns an empty string if not defined
                    467: 
                    468: char   *Cvar_CompleteVariable (char *partial);
                    469: // attempts to match a partial variable name for command line completion
                    470: // returns NULL if nothing fits
                    471: 
                    472: void   Cvar_GetLatchedVars (void);
                    473: // any CVAR_LATCHED variables that have been set will now take effect
                    474: 
                    475: qboolean Cvar_Command (void);
                    476: // called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known
                    477: // command.  Returns true if the command was a variable reference that
                    478: // was handled. (print or change)
                    479: 
                    480: void   Cvar_WriteVariables (char *path);
                    481: // appends lines containing "set variable value" for all variables
                    482: // with the archive flag set to true.
                    483: 
                    484: void   Cvar_Init (void);
                    485: 
                    486: char   *Cvar_Userinfo (void);
                    487: // returns an info string containing all the CVAR_USERINFO cvars
                    488: 
                    489: char   *Cvar_Serverinfo (void);
                    490: // returns an info string containing all the CVAR_SERVERINFO cvars
                    491: 
                    492: extern qboolean        userinfo_modified;
                    493: // this is set each time a CVAR_USERINFO variable is changed
                    494: // so that the client knows to send it to the server
                    495: 
                    496: /*
                    497: ==============================================================
                    498: 
                    499: NET
                    500: 
                    501: ==============================================================
                    502: */
                    503: 
                    504: // net.h -- quake's interface to the networking layer
                    505: 
                    506: #define        PORT_ANY        -1
                    507: 
                    508: #define        MAX_MSGLEN              1400            // max length of a message
                    509: #define        PACKET_HEADER   10                      // two ints and a short
                    510: 
                    511: typedef enum {NA_LOOPBACK, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX} netadrtype_t;
                    512: 
                    513: typedef enum {NS_CLIENT, NS_SERVER} netsrc_t;
                    514: 
                    515: typedef struct
                    516: {
                    517:        netadrtype_t    type;
                    518: 
                    519:        byte    ip[4];
                    520:        byte    ipx[10];
                    521: 
                    522:        unsigned short  port;
                    523: } netadr_t;
                    524: 
                    525: void           NET_Init (void);
                    526: void           NET_Shutdown (void);
                    527: 
                    528: void           NET_Config (qboolean multiplayer);
                    529: 
                    530: qboolean       NET_GetPacket (netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message);
                    531: void           NET_SendPacket (netsrc_t sock, int length, void *data, netadr_t to);
                    532: 
                    533: qboolean       NET_CompareAdr (netadr_t a, netadr_t b);
                    534: qboolean       NET_CompareBaseAdr (netadr_t a, netadr_t b);
                    535: qboolean       NET_IsLocalAddress (netadr_t adr);
                    536: char           *NET_AdrToString (netadr_t a);
                    537: qboolean       NET_StringToAdr (char *s, netadr_t *a);
1.1.1.2   root      538: void           NET_Sleep(int msec);
1.1       root      539: 
                    540: //============================================================================
                    541: 
                    542: #define        OLD_AVG         0.99            // total = oldtotal*OLD_AVG + new*(1-OLD_AVG)
                    543: 
                    544: #define        MAX_LATENT      32
                    545: 
                    546: typedef struct
                    547: {
                    548:        qboolean        fatal_error;
                    549: 
                    550:        netsrc_t        sock;
                    551: 
                    552:        int                     dropped;                        // between last packet and previous
                    553: 
                    554:        int                     last_received;          // for timeouts
                    555:        int                     last_sent;                      // for retransmits
                    556: 
                    557:        netadr_t        remote_address;
                    558:        int                     qport;                          // qport value to write when transmitting
                    559: 
                    560: // sequencing variables
                    561:        int                     incoming_sequence;
                    562:        int                     incoming_acknowledged;
                    563:        int                     incoming_reliable_acknowledged; // single bit
                    564: 
                    565:        int                     incoming_reliable_sequence;             // single bit, maintained local
                    566: 
                    567:        int                     outgoing_sequence;
                    568:        int                     reliable_sequence;                      // single bit
                    569:        int                     last_reliable_sequence;         // sequence number of last send
                    570: 
                    571: // reliable staging and holding areas
                    572:        sizebuf_t       message;                // writing buffer to send to server
                    573:        byte            message_buf[MAX_MSGLEN-16];             // leave space for header
                    574: 
                    575: // message is copied to this buffer when it is first transfered
                    576:        int                     reliable_length;
                    577:        byte            reliable_buf[MAX_MSGLEN-16];    // unacked reliable message
                    578: } netchan_t;
                    579: 
                    580: extern netadr_t        net_from;
                    581: extern sizebuf_t       net_message;
                    582: extern byte            net_message_buffer[MAX_MSGLEN];
                    583: 
                    584: 
                    585: void Netchan_Init (void);
                    586: void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport);
                    587: 
                    588: qboolean Netchan_NeedReliable (netchan_t *chan);
                    589: void Netchan_Transmit (netchan_t *chan, int length, byte *data);
                    590: void Netchan_OutOfBand (int net_socket, netadr_t adr, int length, byte *data);
                    591: void Netchan_OutOfBandPrint (int net_socket, netadr_t adr, char *format, ...);
                    592: qboolean Netchan_Process (netchan_t *chan, sizebuf_t *msg);
                    593: 
                    594: qboolean Netchan_CanReliable (netchan_t *chan);
                    595: 
                    596: 
                    597: /*
                    598: ==============================================================
                    599: 
                    600: CMODEL
                    601: 
                    602: ==============================================================
                    603: */
                    604: 
                    605: 
                    606: #include "../qcommon/qfiles.h"
                    607: 
                    608: cmodel_t       *CM_LoadMap (char *name, qboolean clientload, unsigned *checksum);
                    609: cmodel_t       *CM_InlineModel (char *name);   // *1, *2, etc
                    610: 
                    611: int                    CM_NumClusters (void);
                    612: int                    CM_NumInlineModels (void);
                    613: char           *CM_EntityString (void);
                    614: 
                    615: // creates a clipping hull for an arbitrary box
                    616: int                    CM_HeadnodeForBox (vec3_t mins, vec3_t maxs);
                    617: 
                    618: 
                    619: // returns an ORed contents mask
                    620: int                    CM_PointContents (vec3_t p, int headnode);
                    621: int                    CM_TransformedPointContents (vec3_t p, int headnode, vec3_t origin, vec3_t angles);
                    622: 
                    623: trace_t                CM_BoxTrace (vec3_t start, vec3_t end,
                    624:                                                  vec3_t mins, vec3_t maxs,
                    625:                                                  int headnode, int brushmask);
                    626: trace_t                CM_TransformedBoxTrace (vec3_t start, vec3_t end,
                    627:                                                  vec3_t mins, vec3_t maxs,
                    628:                                                  int headnode, int brushmask,
                    629:                                                  vec3_t origin, vec3_t angles);
                    630: 
                    631: byte           *CM_ClusterPVS (int cluster);
                    632: byte           *CM_ClusterPHS (int cluster);
                    633: 
                    634: int                    CM_PointLeafnum (vec3_t p);
                    635: 
                    636: // call with topnode set to the headnode, returns with topnode
                    637: // set to the first node that splits the box
                    638: int                    CM_BoxLeafnums (vec3_t mins, vec3_t maxs, int *list,
                    639:                                                        int listsize, int *topnode);
                    640: 
                    641: int                    CM_LeafContents (int leafnum);
                    642: int                    CM_LeafCluster (int leafnum);
                    643: int                    CM_LeafArea (int leafnum);
                    644: 
                    645: void           CM_SetAreaPortalState (int portalnum, qboolean open);
                    646: qboolean       CM_AreasConnected (int area1, int area2);
                    647: 
                    648: int                    CM_WriteAreaBits (byte *buffer, int area);
                    649: qboolean       CM_HeadnodeVisible (int headnode, byte *visbits);
                    650: 
                    651: void           CM_WritePortalState (FILE *f);
                    652: void           CM_ReadPortalState (FILE *f);
                    653: 
                    654: /*
                    655: ==============================================================
                    656: 
                    657: PLAYER MOVEMENT CODE
                    658: 
                    659: Common between server and client so prediction matches
                    660: 
                    661: ==============================================================
                    662: */
                    663: 
1.1.1.3 ! root      664: extern float pm_airaccelerate;
        !           665: 
1.1       root      666: void Pmove (pmove_t *pmove);
                    667: 
                    668: /*
                    669: ==============================================================
                    670: 
                    671: FILESYSTEM
                    672: 
                    673: ==============================================================
                    674: */
                    675: 
                    676: void   FS_InitFilesystem (void);
                    677: void   FS_SetGamedir (char *dir);
                    678: char   *FS_Gamedir (void);
                    679: char   *FS_NextPath (char *prevpath);
                    680: void   FS_ExecAutoexec (void);
                    681: 
                    682: int            FS_FOpenFile (char *filename, FILE **file);
                    683: void   FS_FCloseFile (FILE *f);
                    684: // note: this can't be called from another DLL, due to MS libc issues
                    685: 
                    686: int            FS_LoadFile (char *path, void **buffer);
                    687: // a null buffer will just return the file length without loading
                    688: // a -1 length is not present
                    689: 
                    690: void   FS_Read (void *buffer, int len, FILE *f);
                    691: // properly handles partial reads
                    692: 
                    693: void   FS_FreeFile (void *buffer);
                    694: 
                    695: void   FS_CreatePath (char *path);
                    696: 
                    697: 
                    698: /*
                    699: ==============================================================
                    700: 
                    701: MISC
                    702: 
                    703: ==============================================================
                    704: */
                    705: 
                    706: 
                    707: #define        ERR_FATAL       0               // exit the entire game with a popup window
                    708: #define        ERR_DROP        1               // print to console and disconnect from game
                    709: #define        ERR_QUIT        2               // not an error, just a normal exit
                    710: 
                    711: #define        EXEC_NOW        0               // don't return until completed
                    712: #define        EXEC_INSERT     1               // insert at current position, but don't run yet
                    713: #define        EXEC_APPEND     2               // add to end of the command buffer
                    714: 
                    715: #define        PRINT_ALL               0
                    716: #define PRINT_DEVELOPER        1       // only print when "developer 1"
                    717: 
                    718: void           Com_BeginRedirect (int target, char *buffer, int buffersize, void (*flush));
                    719: void           Com_EndRedirect (void);
                    720: void           Com_Printf (char *fmt, ...);
                    721: void           Com_DPrintf (char *fmt, ...);
                    722: void           Com_Error (int code, char *fmt, ...);
                    723: void           Com_Quit (void);
                    724: 
                    725: int                    Com_ServerState (void);         // this should have just been a cvar...
                    726: void           Com_SetServerState (int state);
                    727: 
                    728: unsigned       Com_BlockChecksum (void *buffer, int length);
1.1.1.2   root      729: byte           COM_BlockSequenceCRCByte (byte *base, int length, int sequence);
1.1       root      730: 
                    731: float  frand(void);    // 0 ti 1
                    732: float  crand(void);    // -1 to 1
                    733: 
                    734: extern cvar_t  *developer;
                    735: extern cvar_t  *dedicated;
                    736: extern cvar_t  *host_speeds;
                    737: extern cvar_t  *log_stats;
                    738: 
                    739: extern FILE *log_stats_file;
                    740: 
                    741: // host_speeds times
                    742: extern int             time_before_game;
                    743: extern int             time_after_game;
                    744: extern int             time_before_ref;
                    745: extern int             time_after_ref;
                    746: 
                    747: void Z_Free (void *ptr);
                    748: void *Z_Malloc (int size);                     // returns 0 filled memory
                    749: void *Z_TagMalloc (int size, int tag);
                    750: void Z_FreeTags (int tag);
                    751: 
                    752: void Qcommon_Init (int argc, char **argv);
                    753: void Qcommon_Frame (int msec);
                    754: void Qcommon_Shutdown (void);
                    755: 
                    756: #define NUMVERTEXNORMALS       162
                    757: extern vec3_t  bytedirs[NUMVERTEXNORMALS];
                    758: 
                    759: // this is in the client code, but can be used for debugging from server
                    760: void SCR_DebugGraph (float value, int color);
                    761: 
                    762: 
                    763: /*
                    764: ==============================================================
                    765: 
                    766: NON-PORTABLE SYSTEM SERVICES
                    767: 
                    768: ==============================================================
                    769: */
                    770: 
                    771: void   Sys_Init (void);
                    772: 
                    773: void   Sys_AppActivate (void);
                    774: 
                    775: void   Sys_UnloadGame (void);
                    776: void   *Sys_GetGameAPI (void *parms);
                    777: // loads the game dll and calls the api init function
                    778: 
                    779: char   *Sys_ConsoleInput (void);
                    780: void   Sys_ConsoleOutput (char *string);
                    781: void   Sys_SendKeyEvents (void);
                    782: void   Sys_Error (char *error, ...);
                    783: void   Sys_Quit (void);
                    784: char   *Sys_GetClipboardData( void );
                    785: void   Sys_CopyProtect (void);
                    786: 
                    787: /*
                    788: ==============================================================
                    789: 
                    790: CLIENT / SERVER SYSTEMS
                    791: 
                    792: ==============================================================
                    793: */
                    794: 
                    795: void CL_Init (void);
                    796: void CL_Drop (void);
                    797: void CL_Shutdown (void);
                    798: void CL_Frame (int msec);
                    799: void Con_Print (char *text);
                    800: void SCR_BeginLoadingPlaque (void);
                    801: 
                    802: void SV_Init (void);
                    803: void SV_Shutdown (char *finalmsg, qboolean reconnect);
                    804: void SV_Frame (int msec);
                    805: 
                    806: 
                    807: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.