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