123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068 |
- #ifndef _QCOMMON_H_
- #define _QCOMMON_H_
- #include "../qcommon/cm_public.h"
- typedef struct {
- qboolean allowoverflow;
- qboolean overflowed;
- qboolean oob;
- byte *data;
- int maxsize;
- int cursize;
- int readcount;
- int bit;
- } msg_t;
- void MSG_Init (msg_t *buf, byte *data, int length);
- void MSG_InitOOB( msg_t *buf, byte *data, int length );
- void MSG_Clear (msg_t *buf);
- void MSG_WriteData (msg_t *buf, const void *data, int length);
- void MSG_Bitstream( msg_t *buf );
- void MSG_Copy(msg_t *buf, byte *data, int length, msg_t *src);
- struct usercmd_s;
- struct entityState_s;
- struct playerState_s;
- void MSG_WriteBits( msg_t *msg, int value, int bits );
- void MSG_WriteChar (msg_t *sb, int c);
- void MSG_WriteByte (msg_t *sb, int c);
- void MSG_WriteShort (msg_t *sb, int c);
- void MSG_WriteLong (msg_t *sb, int c);
- void MSG_WriteFloat (msg_t *sb, float f);
- void MSG_WriteString (msg_t *sb, const char *s);
- void MSG_WriteBigString (msg_t *sb, const char *s);
- void MSG_WriteAngle16 (msg_t *sb, float f);
- void MSG_BeginReading (msg_t *sb);
- void MSG_BeginReadingOOB(msg_t *sb);
- int MSG_ReadBits( msg_t *msg, int bits );
- int MSG_ReadChar (msg_t *sb);
- int MSG_ReadByte (msg_t *sb);
- int MSG_ReadShort (msg_t *sb);
- int MSG_ReadLong (msg_t *sb);
- float MSG_ReadFloat (msg_t *sb);
- char *MSG_ReadString (msg_t *sb);
- char *MSG_ReadBigString (msg_t *sb);
- char *MSG_ReadStringLine (msg_t *sb);
- float MSG_ReadAngle16 (msg_t *sb);
- void MSG_ReadData (msg_t *sb, void *buffer, int size);
- void MSG_WriteDeltaUsercmd( msg_t *msg, struct usercmd_s *from, struct usercmd_s *to );
- void MSG_ReadDeltaUsercmd( msg_t *msg, struct usercmd_s *from, struct usercmd_s *to );
- void MSG_WriteDeltaUsercmdKey( msg_t *msg, int key, usercmd_t *from, usercmd_t *to );
- void MSG_ReadDeltaUsercmdKey( msg_t *msg, int key, usercmd_t *from, usercmd_t *to );
- void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entityState_s *to
- , qboolean force );
- void MSG_ReadDeltaEntity( msg_t *msg, entityState_t *from, entityState_t *to,
- int number );
- void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct playerState_s *to );
- void MSG_ReadDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct playerState_s *to );
- void MSG_ReportChangeVectors_f( void );
- #define PACKET_BACKUP 32 // number of old messages that must be kept on client and
-
- #define PACKET_MASK (PACKET_BACKUP-1)
- #define MAX_PACKET_USERCMDS 32 // max number of usercmd_t in a packet
- #define PORT_ANY -1
- #define MAX_RELIABLE_COMMANDS 64 // max string commands buffered for restransmit
- typedef enum {
- NA_BOT,
- NA_BAD,
- NA_LOOPBACK,
- NA_BROADCAST,
- NA_IP,
- NA_IPX,
- NA_BROADCAST_IPX
- } netadrtype_t;
- typedef enum {
- NS_CLIENT,
- NS_SERVER
- } netsrc_t;
- typedef struct {
- netadrtype_t type;
- byte ip[4];
- byte ipx[10];
- unsigned short port;
- } netadr_t;
- void NET_Init( void );
- void NET_Shutdown( void );
- void NET_Restart( void );
- void NET_Config( qboolean enableNetworking );
- void NET_SendPacket (netsrc_t sock, int length, const void *data, netadr_t to);
- void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ...);
- void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len );
- qboolean NET_CompareAdr (netadr_t a, netadr_t b);
- qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);
- qboolean NET_IsLocalAddress (netadr_t adr);
- const char *NET_AdrToString (netadr_t a);
- qboolean NET_StringToAdr ( const char *s, netadr_t *a);
- qboolean NET_GetLoopPacket (netsrc_t sock, netadr_t *net_from, msg_t *net_message);
- void NET_Sleep(int msec);
- #define MAX_MSGLEN 16384 // max length of a message, which may
-
- #define MAX_DOWNLOAD_WINDOW 8 // max of eight download frames
- #define MAX_DOWNLOAD_BLKSIZE 2048 // 2048 byte block chunks
-
- typedef struct {
- netsrc_t sock;
- int dropped;
- netadr_t remoteAddress;
- int qport;
-
- int incomingSequence;
- int outgoingSequence;
-
- int fragmentSequence;
- int fragmentLength;
- byte fragmentBuffer[MAX_MSGLEN];
-
-
- qboolean unsentFragments;
- int unsentFragmentStart;
- int unsentLength;
- byte unsentBuffer[MAX_MSGLEN];
- } netchan_t;
- void Netchan_Init( int qport );
- void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport );
- void Netchan_Transmit( netchan_t *chan, int length, const byte *data );
- void Netchan_TransmitNextFragment( netchan_t *chan );
- qboolean Netchan_Process( netchan_t *chan, msg_t *msg );
- #define PROTOCOL_VERSION 68
- extern int demo_protocols[];
- #define UPDATE_SERVER_NAME "update.quake3arena.com"
- #ifndef MASTER_SERVER_NAME
- #define MASTER_SERVER_NAME "master.quake3arena.com"
- #endif
- #ifndef AUTHORIZE_SERVER_NAME
- #define AUTHORIZE_SERVER_NAME "authorize.quake3arena.com"
- #endif
- #define PORT_MASTER 27950
- #define PORT_UPDATE 27951
- #ifndef PORT_AUTHORIZE
- #define PORT_AUTHORIZE 27952
- #endif
- #define PORT_SERVER 27960
- #define NUM_SERVER_PORTS 4 // broadcast scan this many ports after
-
-
- enum svc_ops_e {
- svc_bad,
- svc_nop,
- svc_gamestate,
- svc_configstring,
- svc_baseline,
- svc_serverCommand,
- svc_download,
- svc_snapshot,
- svc_EOF
- };
- enum clc_ops_e {
- clc_bad,
- clc_nop,
- clc_move,
- clc_moveNoDelta,
- clc_clientCommand,
- clc_EOF
- };
- typedef struct vm_s vm_t;
- typedef enum {
- VMI_NATIVE,
- VMI_BYTECODE,
- VMI_COMPILED
- } vmInterpret_t;
- typedef enum {
- TRAP_MEMSET = 100,
- TRAP_MEMCPY,
- TRAP_STRNCPY,
- TRAP_SIN,
- TRAP_COS,
- TRAP_ATAN2,
- TRAP_SQRT,
- TRAP_MATRIXMULTIPLY,
- TRAP_ANGLEVECTORS,
- TRAP_PERPENDICULARVECTOR,
- TRAP_FLOOR,
- TRAP_CEIL,
- TRAP_TESTPRINTINT,
- TRAP_TESTPRINTFLOAT
- } sharedTraps_t;
- void VM_Init( void );
- vm_t *VM_Create( const char *module, int (*systemCalls)(int *),
- vmInterpret_t interpret );
- void VM_Free( vm_t *vm );
- void VM_Clear(void);
- vm_t *VM_Restart( vm_t *vm );
- int QDECL VM_Call( vm_t *vm, int callNum, ... );
- void VM_Debug( int level );
- void *VM_ArgPtr( int intValue );
- void *VM_ExplicitArgPtr( vm_t *vm, int intValue );
- void Cbuf_Init (void);
- void Cbuf_AddText( const char *text );
- void Cbuf_ExecuteText( int exec_when, const char *text );
- void Cbuf_Execute (void);
- typedef void (*xcommand_t) (void);
- void Cmd_Init (void);
- void Cmd_AddCommand( const char *cmd_name, xcommand_t function );
- void Cmd_RemoveCommand( const char *cmd_name );
- void Cmd_CommandCompletion( void(*callback)(const char *s) );
- int Cmd_Argc (void);
- char *Cmd_Argv (int arg);
- void Cmd_ArgvBuffer( int arg, char *buffer, int bufferLength );
- char *Cmd_Args (void);
- char *Cmd_ArgsFrom( int arg );
- void Cmd_ArgsBuffer( char *buffer, int bufferLength );
- char *Cmd_Cmd (void);
- void Cmd_TokenizeString( const char *text );
- void Cmd_ExecuteString( const char *text );
- cvar_t *Cvar_Get( const char *var_name, const char *value, int flags );
- void Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
- void Cvar_Update( vmCvar_t *vmCvar );
- void Cvar_Set( const char *var_name, const char *value );
- void Cvar_SetLatched( const char *var_name, const char *value);
- void Cvar_SetValue( const char *var_name, float value );
- float Cvar_VariableValue( const char *var_name );
- int Cvar_VariableIntegerValue( const char *var_name );
- char *Cvar_VariableString( const char *var_name );
- void Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
- void Cvar_CommandCompletion( void(*callback)(const char *s) );
- void Cvar_Reset( const char *var_name );
- void Cvar_SetCheatState( void );
- qboolean Cvar_Command( void );
- void Cvar_WriteVariables( fileHandle_t f );
- void Cvar_Init( void );
- char *Cvar_InfoString( int bit );
- char *Cvar_InfoString_Big( int bit );
- void Cvar_InfoStringBuffer( int bit, char *buff, int buffsize );
- void Cvar_Restart_f( void );
- extern int cvar_modifiedFlags;
- #define FS_GENERAL_REF 0x01
- #define FS_UI_REF 0x02
- #define FS_CGAME_REF 0x04
- #define FS_QAGAME_REF 0x08
- #define NUM_ID_PAKS 9
- #define MAX_FILE_HANDLES 64
- #define BASEGAME "baseq3"
- qboolean FS_Initialized();
- void FS_InitFilesystem (void);
- void FS_Shutdown( qboolean closemfp );
- qboolean FS_ConditionalRestart( int checksumFeed );
- void FS_Restart( int checksumFeed );
- char **FS_ListFiles( const char *directory, const char *extension, int *numfiles );
- void FS_FreeFileList( char **list );
- qboolean FS_FileExists( const char *file );
- int FS_LoadStack();
- int FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
- int FS_GetModList( char *listbuf, int bufsize );
- fileHandle_t FS_FOpenFileWrite( const char *qpath );
- int FS_filelength( fileHandle_t f );
- fileHandle_t FS_SV_FOpenFileWrite( const char *filename );
- int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp );
- void FS_SV_Rename( const char *from, const char *to );
- int FS_FOpenFileRead( const char *qpath, fileHandle_t *file, qboolean uniqueFILE );
- int FS_FileIsInPAK(const char *filename, int *pChecksum );
- int FS_Write( const void *buffer, int len, fileHandle_t f );
- int FS_Read2( void *buffer, int len, fileHandle_t f );
- int FS_Read( void *buffer, int len, fileHandle_t f );
- void FS_FCloseFile( fileHandle_t f );
- int FS_ReadFile( const char *qpath, void **buffer );
- void FS_ForceFlush( fileHandle_t f );
- void FS_FreeFile( void *buffer );
- void FS_WriteFile( const char *qpath, const void *buffer, int size );
- int FS_filelength( fileHandle_t f );
- int FS_FTell( fileHandle_t f );
- void FS_Flush( fileHandle_t f );
- void QDECL FS_Printf( fileHandle_t f, const char *fmt, ... );
- int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode );
- int FS_Seek( fileHandle_t f, long offset, int origin );
- qboolean FS_FilenameCompare( const char *s1, const char *s2 );
- const char *FS_GamePureChecksum( void );
- const char *FS_LoadedPakNames( void );
- const char *FS_LoadedPakChecksums( void );
- const char *FS_LoadedPakPureChecksums( void );
- const char *FS_ReferencedPakNames( void );
- const char *FS_ReferencedPakChecksums( void );
- const char *FS_ReferencedPakPureChecksums( void );
- void FS_ClearPakReferences( int flags );
- void FS_PureServerSetReferencedPaks( const char *pakSums, const char *pakNames );
- void FS_PureServerSetLoadedPaks( const char *pakSums, const char *pakNames );
- qboolean FS_idPak( char *pak, char *base );
- qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring );
- void FS_Rename( const char *from, const char *to );
- #define MAX_EDIT_LINE 256
- typedef struct {
- int cursor;
- int scroll;
- int widthInChars;
- char buffer[MAX_EDIT_LINE];
- } field_t;
- void Field_Clear( field_t *edit );
- void Field_CompleteCommand( field_t *edit );
- #ifdef WIN32
- #define Q_vsnprintf _vsnprintf
- #else
- #define Q_vsnprintf vsnprintf
- #endif
- extern char cl_cdkey[34];
- #define CPUID_GENERIC 0 // any unrecognized processor
- #define CPUID_AXP 0x10
- #define CPUID_INTEL_UNSUPPORTED 0x20 // Intel 386/486
- #define CPUID_INTEL_PENTIUM 0x21 // Intel Pentium or PPro
- #define CPUID_INTEL_MMX 0x22 // Intel Pentium/MMX or P2/MMX
- #define CPUID_INTEL_KATMAI 0x23 // Intel Katmai
- #define CPUID_AMD_3DNOW 0x30 // AMD K6 3DNOW!
- #define MAXPRINTMSG 4096
- char *CopyString( const char *in );
- void Info_Print( const char *s );
- void Com_BeginRedirect (char *buffer, int buffersize, void (*flush)(char *));
- void Com_EndRedirect( void );
- void QDECL Com_Printf( const char *fmt, ... );
- void QDECL Com_DPrintf( const char *fmt, ... );
- void QDECL Com_Error( int code, const char *fmt, ... );
- void Com_Quit_f( void );
- int Com_EventLoop( void );
- int Com_Milliseconds( void );
- unsigned Com_BlockChecksum( const void *buffer, int length );
- unsigned Com_BlockChecksumKey (void *buffer, int length, int key);
- int Com_HashKey(char *string, int maxlen);
- int Com_Filter(char *filter, char *name, int casesensitive);
- int Com_FilterPath(char *filter, char *name, int casesensitive);
- int Com_RealTime(qtime_t *qtime);
- qboolean Com_SafeMode( void );
- void Com_StartupVariable( const char *match );
- extern cvar_t *com_developer;
- extern cvar_t *com_dedicated;
- extern cvar_t *com_speeds;
- extern cvar_t *com_timescale;
- extern cvar_t *com_sv_running;
- extern cvar_t *com_cl_running;
- extern cvar_t *com_viewlog;
- extern cvar_t *com_version;
- extern cvar_t *com_blood;
- extern cvar_t *com_buildScript;
- extern cvar_t *com_journal;
- extern cvar_t *com_cameraMode;
- extern cvar_t *cl_paused;
- extern cvar_t *sv_paused;
- extern int time_game;
- extern int time_frontend;
- extern int time_backend;
- extern int com_frameTime;
- extern int com_frameMsec;
- extern qboolean com_errorEntered;
- extern fileHandle_t com_journalFile;
- extern fileHandle_t com_journalDataFile;
- typedef enum {
- TAG_FREE,
- TAG_GENERAL,
- TAG_BOTLIB,
- TAG_RENDERER,
- TAG_SMALL,
- TAG_STATIC
- } memtag_t;
- #if defined(_DEBUG) && !defined(BSPC)
- #define ZONE_DEBUG
- #endif
- #ifdef ZONE_DEBUG
- #define Z_TagMalloc(size, tag) Z_TagMallocDebug(size, tag, #size, __FILE__, __LINE__)
- #define Z_Malloc(size) Z_MallocDebug(size, #size, __FILE__, __LINE__)
- #define S_Malloc(size) S_MallocDebug(size, #size, __FILE__, __LINE__)
- void *Z_TagMallocDebug( int size, int tag, char *label, char *file, int line );
- void *Z_MallocDebug( int size, char *label, char *file, int line );
- void *S_MallocDebug( int size, char *label, char *file, int line );
- #else
- void *Z_TagMalloc( int size, int tag );
- void *Z_Malloc( int size );
- void *S_Malloc( int size );
- #endif
- void Z_Free( void *ptr );
- void Z_FreeTags( int tag );
- int Z_AvailableMemory( void );
- void Z_LogHeap( void );
- void Hunk_Clear( void );
- void Hunk_ClearToMark( void );
- void Hunk_SetMark( void );
- qboolean Hunk_CheckMark( void );
- void Hunk_ClearTempMemory( void );
- void *Hunk_AllocateTempMemory( int size );
- void Hunk_FreeTempMemory( void *buf );
- int Hunk_MemoryRemaining( void );
- void Hunk_Log( void);
- void Hunk_Trash( void );
- void Com_TouchMemory( void );
- void Com_Init( char *commandLine );
- void Com_Frame( void );
- void Com_Shutdown( void );
- void CL_InitKeyCommands( void );
- void CL_Init( void );
- void CL_Disconnect( qboolean showMainMenu );
- void CL_Shutdown( void );
- void CL_Frame( int msec );
- qboolean CL_GameCommand( void );
- void CL_KeyEvent (int key, qboolean down, unsigned time);
- void CL_CharEvent( int key );
- void CL_MouseEvent( int dx, int dy, int time );
- void CL_JoystickEvent( int axis, int value, int time );
- void CL_PacketEvent( netadr_t from, msg_t *msg );
- void CL_ConsolePrint( char *text );
- void CL_MapLoading( void );
- void CL_ForwardCommandToServer( const char *string );
- void CL_CDDialog( void );
- void CL_ShutdownAll( void );
- void CL_FlushMemory( void );
- void CL_StartHunkUsers( void );
- void Key_WriteBindings( fileHandle_t f );
- void S_ClearSoundBuffer( void );
- void SCR_DebugGraph (float value, int color);
- void SV_Init( void );
- void SV_Shutdown( char *finalmsg );
- void SV_Frame( int msec );
- void SV_PacketEvent( netadr_t from, msg_t *msg );
- qboolean SV_GameCommand( void );
- qboolean UI_GameCommand( void );
- qboolean UI_usesUniqueCDKey();
- typedef enum {
- AXIS_SIDE,
- AXIS_FORWARD,
- AXIS_UP,
- AXIS_ROLL,
- AXIS_YAW,
- AXIS_PITCH,
- MAX_JOYSTICK_AXIS
- } joystickAxis_t;
- typedef enum {
-
- SE_NONE = 0,
- SE_KEY,
- SE_CHAR,
- SE_MOUSE,
- SE_JOYSTICK_AXIS,
- SE_CONSOLE,
- SE_PACKET
- } sysEventType_t;
- typedef struct {
- int evTime;
- sysEventType_t evType;
- int evValue, evValue2;
- int evPtrLength;
- void *evPtr;
- } sysEvent_t;
- sysEvent_t Sys_GetEvent( void );
- void Sys_Init (void);
- void * QDECL Sys_LoadDll( const char *name, char *fqpath , int (QDECL **entryPoint)(int, ...),
- int (QDECL *systemcalls)(int, ...) );
- void Sys_UnloadDll( void *dllHandle );
- void Sys_UnloadGame( void );
- void *Sys_GetGameAPI( void *parms );
- void Sys_UnloadCGame( void );
- void *Sys_GetCGameAPI( void );
- void Sys_UnloadUI( void );
- void *Sys_GetUIAPI( void );
- void Sys_UnloadBotLib( void );
- void *Sys_GetBotLibAPI( void *parms );
- char *Sys_GetCurrentUser( void );
- void QDECL Sys_Error( const char *error, ...);
- void Sys_Quit (void);
- char *Sys_GetClipboardData( void );
- void Sys_Print( const char *msg );
- int Sys_Milliseconds (void);
- void Sys_SnapVector( float *v );
- void Sys_DisplaySystemConsole( qboolean show );
- int Sys_GetProcessorId( void );
- void Sys_BeginStreamedFile( fileHandle_t f, int readahead );
- void Sys_EndStreamedFile( fileHandle_t f );
- int Sys_StreamedRead( void *buffer, int size, int count, fileHandle_t f );
- void Sys_StreamSeek( fileHandle_t f, int offset, int origin );
- void Sys_ShowConsole( int level, qboolean quitOnClose );
- void Sys_SetErrorText( const char *text );
- void Sys_SendPacket( int length, const void *data, netadr_t to );
- qboolean Sys_StringToAdr( const char *s, netadr_t *a );
- qboolean Sys_IsLANAddress (netadr_t adr);
- void Sys_ShowIP(void);
- qboolean Sys_CheckCD( void );
- void Sys_Mkdir( const char *path );
- char *Sys_Cwd( void );
- void Sys_SetDefaultCDPath(const char *path);
- char *Sys_DefaultCDPath(void);
- void Sys_SetDefaultInstallPath(const char *path);
- char *Sys_DefaultInstallPath(void);
- void Sys_SetDefaultHomePath(const char *path);
- char *Sys_DefaultHomePath(void);
- char **Sys_ListFiles( const char *directory, const char *extension, char *filter, int *numfiles, qboolean wantsubs );
- void Sys_FreeFileList( char **list );
- void Sys_BeginProfiling( void );
- void Sys_EndProfiling( void );
- qboolean Sys_LowPhysicalMemory();
- unsigned int Sys_ProcessorCount();
- int Sys_MonkeyShouldBeSpanked( void );
- #define NYT HMAX /* NYT = Not Yet Transmitted */
- #define INTERNAL_NODE (HMAX+1)
- typedef struct nodetype {
- struct nodetype *left, *right, *parent;
- struct nodetype *next, *prev;
- struct nodetype **head;
- int weight;
- int symbol;
- } node_t;
- #define HMAX 256 /* Maximum symbol */
- typedef struct {
- int blocNode;
- int blocPtrs;
- node_t* tree;
- node_t* lhead;
- node_t* ltail;
- node_t* loc[HMAX+1];
- node_t** freelist;
- node_t nodeList[768];
- node_t* nodePtrs[768];
- } huff_t;
- typedef struct {
- huff_t compressor;
- huff_t decompressor;
- } huffman_t;
- void Huff_Compress(msg_t *buf, int offset);
- void Huff_Decompress(msg_t *buf, int offset);
- void Huff_Init(huffman_t *huff);
- void Huff_addRef(huff_t* huff, byte ch);
- int Huff_Receive (node_t *node, int *ch, byte *fin);
- void Huff_transmit (huff_t *huff, int ch, byte *fout);
- void Huff_offsetReceive (node_t *node, int *ch, byte *fin, int *offset);
- void Huff_offsetTransmit (huff_t *huff, int ch, byte *fout, int *offset);
- void Huff_putBit( int bit, byte *fout, int *offset);
- int Huff_getBit( byte *fout, int *offset);
- extern huffman_t clientHuffTables;
- #define SV_ENCODE_START 4
- #define SV_DECODE_START 12
- #define CL_ENCODE_START 12
- #define CL_DECODE_START 4
- #endif // _QCOMMON_H_
|