vkQuake2 doxygen  1.0 dev
common.c File Reference
#include "qcommon.h"
#include <setjmp.h>
#include "../client/anorms.h"

Go to the source code of this file.

Classes

struct  zhead_s
 

Macros

#define MAXPRINTMSG   8192
 
#define MAX_NUM_ARGVS   50
 
#define Z_MAGIC   0x1d1d
 

Typedefs

typedef struct zhead_s zhead_t
 

Functions

void SV_ShutdownGameProgs (void)
 
void Com_BeginRedirect (int target, char *buffer, int buffersize, void(*flush))
 
void Com_EndRedirect (void)
 
void Com_Printf (char *fmt,...)
 
void Com_DPrintf (char *fmt,...)
 
void Com_Error (int code, char *fmt,...)
 
void Com_Quit (void)
 
int Com_ServerState (void)
 
void Com_SetServerState (int state)
 
void MSG_WriteChar (sizebuf_t *sb, int c)
 
void MSG_WriteByte (sizebuf_t *sb, int c)
 
void MSG_WriteShort (sizebuf_t *sb, int c)
 
void MSG_WriteLong (sizebuf_t *sb, int c)
 
void MSG_WriteFloat (sizebuf_t *sb, float f)
 
void MSG_WriteString (sizebuf_t *sb, char *s)
 
void MSG_WriteCoord (sizebuf_t *sb, float f)
 
void MSG_WritePos (sizebuf_t *sb, vec3_t pos)
 
void MSG_WriteAngle (sizebuf_t *sb, float f)
 
void MSG_WriteAngle16 (sizebuf_t *sb, float f)
 
void MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd)
 
void MSG_WriteDir (sizebuf_t *sb, vec3_t dir)
 
void MSG_ReadDir (sizebuf_t *sb, vec3_t dir)
 
void MSG_WriteDeltaEntity (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, qboolean newentity)
 
void MSG_BeginReading (sizebuf_t *msg)
 
int MSG_ReadChar (sizebuf_t *msg_read)
 
int MSG_ReadByte (sizebuf_t *msg_read)
 
int MSG_ReadShort (sizebuf_t *msg_read)
 
int MSG_ReadLong (sizebuf_t *msg_read)
 
float MSG_ReadFloat (sizebuf_t *msg_read)
 
char * MSG_ReadString (sizebuf_t *msg_read)
 
char * MSG_ReadStringLine (sizebuf_t *msg_read)
 
float MSG_ReadCoord (sizebuf_t *msg_read)
 
void MSG_ReadPos (sizebuf_t *msg_read, vec3_t pos)
 
float MSG_ReadAngle (sizebuf_t *msg_read)
 
float MSG_ReadAngle16 (sizebuf_t *msg_read)
 
void MSG_ReadDeltaUsercmd (sizebuf_t *msg_read, usercmd_t *from, usercmd_t *move)
 
void MSG_ReadData (sizebuf_t *msg_read, void *data, int len)
 
void SZ_Init (sizebuf_t *buf, byte *data, int length)
 
void SZ_Clear (sizebuf_t *buf)
 
voidSZ_GetSpace (sizebuf_t *buf, int length)
 
void SZ_Write (sizebuf_t *buf, void *data, int length)
 
void SZ_Print (sizebuf_t *buf, char *data)
 
int COM_CheckParm (char *parm)
 
int COM_Argc (void)
 
char * COM_Argv (int arg)
 
void COM_ClearArgv (int arg)
 
void COM_InitArgv (int argc, char **argv)
 
void COM_AddParm (char *parm)
 
int memsearch (byte *start, int count, int search)
 just for debugging More...
 
char * CopyString (char *in)
 
void Info_Print (char *s)
 
void Z_Free (void *ptr)
 
void Z_Stats_f (void)
 
void Z_FreeTags (int tag)
 
voidZ_TagMalloc (int size, int tag)
 
voidZ_Malloc (int size)
 
byte COM_BlockSequenceCheckByte (byte *base, int length, int sequence, int challenge)
 
byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence)
 
float frand (void)
 
float crand (void)
 
void Key_Init (void)
 
void SCR_EndLoadingPlaque (void)
 
void Com_Error_f (void)
 
void Qcommon_Init (int argc, char **argv)
 
void Qcommon_Frame (int msec)
 
void Qcommon_Shutdown (void)
 

Variables

int com_argc
 
char * com_argv [MAX_NUM_ARGVS+1]
 
int realtime
 
jmp_buf abortframe
 
static qboolean shutdown_game = false
 
FILE * log_stats_file
 
cvar_thost_speeds
 
cvar_tlog_stats
 
cvar_tdeveloper
 
cvar_ttimescale
 
cvar_tfixedtime
 
cvar_tlogfile_active
 
cvar_tshowtrace
 
cvar_tdedicated
 
FILE * logfile
 
int server_state
 
int time_before_game
 
int time_after_game
 
int time_before_ref
 
int time_after_ref
 
static int rd_target
 
static char * rd_buffer
 
static int rd_buffersize
 
static void(* rd_flush )(int target, char *buffer)
 
vec3_t bytedirs [NUMVERTEXNORMALS]
 
zhead_t z_chain
 
int z_count
 
int z_bytes
 
static byte chktbl [1024]
 

Macro Definition Documentation

◆ MAX_NUM_ARGVS

#define MAX_NUM_ARGVS   50

Definition at line 27 of file common.c.

◆ MAXPRINTMSG

#define MAXPRINTMSG   8192

Definition at line 25 of file common.c.

◆ Z_MAGIC

#define Z_MAGIC   0x1d1d

Definition at line 1103 of file common.c.

Typedef Documentation

◆ zhead_t

typedef struct zhead_s zhead_t

Function Documentation

◆ COM_AddParm()

void COM_AddParm ( char *  parm)

Definition at line 1016 of file common.c.

1017 {
1018  if (com_argc == MAX_NUM_ARGVS)
1019  Com_Error (ERR_FATAL, "COM_AddParm: MAX_NUM)ARGS");
1020  com_argv[com_argc++] = parm;
1021 }

◆ COM_Argc()

int COM_Argc ( void  )

Definition at line 968 of file common.c.

969 {
970  return com_argc;
971 }

Referenced by Cbuf_AddEarlyCommands(), and Cbuf_AddLateCommands().

◆ COM_Argv()

char* COM_Argv ( int  arg)

Definition at line 973 of file common.c.

974 {
975  if (arg < 0 || arg >= com_argc || !com_argv[arg])
976  return "";
977  return com_argv[arg];
978 }

Referenced by Cbuf_AddEarlyCommands(), and Cbuf_AddLateCommands().

◆ Com_BeginRedirect()

void Com_BeginRedirect ( int  target,
char *  buffer,
int  buffersize,
void flush 
)

Definition at line 74 of file common.c.

75 {
76  if (!target || !buffer || !buffersize || !flush)
77  return;
78  rd_target = target;
79  rd_buffer = buffer;
80  rd_buffersize = buffersize;
81  rd_flush = flush;
82 
83  *rd_buffer = 0;
84 }

Referenced by SVC_RemoteCommand(), and SVC_Status().

◆ COM_BlockSequenceCheckByte()

byte COM_BlockSequenceCheckByte ( byte base,
int  length,
int  sequence,
int  challenge 
)

Definition at line 1220 of file common.c.

1221 {
1222  Sys_Error("COM_BlockSequenceCheckByte called\n");
1223 
1224 #if 0
1225  int checksum;
1226  byte buf[68];
1227  byte *p;
1228  float temp;
1229  byte c;
1230 
1231  temp = bytedirs[(sequence/3) % NUMVERTEXNORMALS][sequence % 3];
1232  temp = LittleFloat(temp);
1233  p = ((byte *)&temp);
1234 
1235  if (length > 60)
1236  length = 60;
1237  memcpy (buf, base, length);
1238 
1239  buf[length] = (sequence & 0xff) ^ p[0];
1240  buf[length+1] = p[1];
1241  buf[length+2] = ((sequence>>8) & 0xff) ^ p[2];
1242  buf[length+3] = p[3];
1243 
1244  temp = bytedirs[((sequence+challenge)/3) % NUMVERTEXNORMALS][(sequence+challenge) % 3];
1245  temp = LittleFloat(temp);
1246  p = ((byte *)&temp);
1247 
1248  buf[length+4] = (sequence & 0xff) ^ p[3];
1249  buf[length+5] = (challenge & 0xff) ^ p[2];
1250  buf[length+6] = ((sequence>>8) & 0xff) ^ p[1];
1251  buf[length+7] = ((challenge >> 7) & 0xff) ^ p[0];
1252 
1253  length += 8;
1254 
1255  checksum = LittleLong(Com_BlockChecksum (buf, length));
1256 
1257  checksum &= 0xff;
1258 
1259  return checksum;
1260 #endif
1261  return 0;
1262 }

◆ COM_BlockSequenceCRCByte()

byte COM_BlockSequenceCRCByte ( byte base,
int  length,
int  sequence 
)

Definition at line 1338 of file common.c.

1339 {
1340  int n;
1341  byte *p;
1342  int x;
1343  byte chkb[60 + 4];
1344  unsigned short crc;
1345 
1346 
1347  if (sequence < 0)
1348  Sys_Error("sequence < 0, this shouldn't happen\n");
1349 
1350  p = chktbl + (sequence % (sizeof(chktbl) - 4));
1351 
1352  if (length > 60)
1353  length = 60;
1354  memcpy (chkb, base, length);
1355 
1356  chkb[length] = p[0];
1357  chkb[length+1] = p[1];
1358  chkb[length+2] = p[2];
1359  chkb[length+3] = p[3];
1360 
1361  length += 4;
1362 
1363  crc = CRC_Block(chkb, length);
1364 
1365  for (x=0, n=0; n<length; n++)
1366  x += chkb[n];
1367 
1368  crc = (crc ^ x) & 0xff;
1369 
1370  return crc;
1371 }

Referenced by CL_SendCmd(), and SV_ExecuteClientMessage().

◆ COM_CheckParm()

int COM_CheckParm ( char *  parm)

Definition at line 955 of file common.c.

956 {
957  int i;
958 
959  for (i=1 ; i<com_argc ; i++)
960  {
961  if (!strcmp (parm,com_argv[i]))
962  return i;
963  }
964 
965  return 0;
966 }

◆ COM_ClearArgv()

void COM_ClearArgv ( int  arg)

Definition at line 980 of file common.c.

981 {
982  if (arg < 0 || arg >= com_argc || !com_argv[arg])
983  return;
984  com_argv[arg] = "";
985 }

Referenced by Cbuf_AddEarlyCommands().

◆ Com_DPrintf()

◆ Com_EndRedirect()

void Com_EndRedirect ( void  )

Definition at line 86 of file common.c.

87 {
89 
90  rd_target = 0;
91  rd_buffer = NULL;
92  rd_buffersize = 0;
93  rd_flush = NULL;
94 }

Referenced by SVC_RemoteCommand(), and SVC_Status().

◆ Com_Error()

void Com_Error ( int  code,
char *  fmt,
  ... 
)

Definition at line 181 of file common.c.

182 {
183  va_list argptr;
184  static char msg[MAXPRINTMSG];
185  static qboolean recursive;
186 
187  if (recursive)
188  Sys_Error ("recursive error after: %s", msg);
189  recursive = true;
190 
191  va_start (argptr,fmt);
192  vsnprintf (msg,MAXPRINTMSG,fmt,argptr);
193  va_end (argptr);
194 
195  if (code == ERR_DISCONNECT)
196  {
197  CL_Drop ();
198  recursive = false;
199  longjmp (abortframe, -1);
200  }
201  else if (code == ERR_DROP)
202  {
203  Com_Printf ("********************\nERROR: %s\n********************\n", msg);
204  SV_Shutdown (va("Server crashed: %s\n", msg), false);
205  CL_Drop ();
206  recursive = false;
207  shutdown_game = true;
208  longjmp (abortframe, -1);
209  }
210  else
211  {
212  SV_Shutdown (va("Server fatal crashed: %s\n", msg), false);
214  CL_Shutdown ();
215  }
216 
217  if (logfile)
218  {
219  fclose (logfile);
220  logfile = NULL;
221  }
222 
223  Sys_Error ("%s", msg);
224 }

Referenced by CalcFov(), Cbuf_ExecuteText(), CL_Disconnect_f(), CL_GetEntitySoundOrigin(), CL_ParseConfigString(), CL_ParseFrame(), CL_ParseMuzzleFlash(), CL_ParseMuzzleFlash2(), CL_ParsePacketEntities(), CL_ParseServerData(), CL_ParseServerMessage(), CL_ParseStartSoundPacket(), CL_ParseTEnt(), CL_RequestNextDownload(), CL_SetLightstyle(), CM_AreasConnected(), CM_InitBoxHull(), CM_InlineModel(), CM_LeafArea(), CM_LeafCluster(), CM_LeafContents(), CM_LoadMap(), CM_SetAreaPortalState(), CMod_LoadAreaPortals(), CMod_LoadAreas(), CMod_LoadBrushes(), CMod_LoadBrushSides(), CMod_LoadEntityString(), CMod_LoadLeafBrushes(), CMod_LoadLeafs(), CMod_LoadNodes(), CMod_LoadPlanes(), CMod_LoadSubmodels(), CMod_LoadSurfaces(), CMod_LoadVisibility(), COM_AddParm(), Com_Error_f(), COM_InitArgv(), FloodArea_r(), FS_FOpenFile(), FS_LoadPackFile(), FS_Read(), GetWavinfo(), Key_Event(), M_PopMenu(), M_PushMenu(), MSG_ReadDir(), MSG_WriteByte(), MSG_WriteChar(), MSG_WriteDeltaEntity(), MSG_WriteShort(), NET_GetPacket(), NET_Init(), NET_OpenIP(), NET_SendPacket(), PF_Configstring(), PF_cprintf(), PF_error(), PF_setmodel(), S_AliasName(), S_FindName(), S_PickChannel(), SCR_ExecuteLayoutString(), SCR_ReadNextFrame(), StartServer_MenuInit(), SV_BeginDemoserver(), SV_FatPVS(), SV_FindIndex(), SV_HullForEntity(), SV_InitGameProgs(), SV_Multicast(), SV_SendClientMessages(), SV_StartSound(), Sys_CopyProtect(), Sys_GetGameAPI(), Sys_UnloadGame(), SZ_GetSpace(), V_AddLightStyle(), VID_CheckChanges(), VID_Error(), VID_FreeReflib(), VID_LoadRefresh(), Z_Free(), and Z_TagMalloc().

◆ Com_Error_f()

void Com_Error_f ( void  )

Definition at line 1396 of file common.c.

1397 {
1398  Com_Error (ERR_FATAL, "%s", Cmd_Argv(1));
1399 }

Referenced by Qcommon_Init().

◆ COM_InitArgv()

void COM_InitArgv ( int  argc,
char **  argv 
)

Definition at line 993 of file common.c.

994 {
995  int i;
996 
997  if (argc > MAX_NUM_ARGVS)
998  Com_Error (ERR_FATAL, "argc > MAX_NUM_ARGVS");
999  com_argc = argc;
1000  for (i=0 ; i<argc ; i++)
1001  {
1002  if (!argv[i] || strlen(argv[i]) >= MAX_TOKEN_CHARS )
1003  com_argv[i] = "";
1004  else
1005  com_argv[i] = argv[i];
1006  }
1007 }

Referenced by Qcommon_Init().

◆ Com_Printf()

void Com_Printf ( char *  fmt,
  ... 
)

Definition at line 104 of file common.c.

105 {
106  va_list argptr;
107  char msg[MAXPRINTMSG];
108 
109  va_start (argptr,fmt);
110  vsnprintf (msg,MAXPRINTMSG,fmt,argptr);
111  va_end (argptr);
112 
113  if (rd_target)
114  {
115  if ((strlen (msg) + strlen(rd_buffer)) > (rd_buffersize - 1))
116  {
118  *rd_buffer = 0;
119  }
120  strcat (rd_buffer, msg);
121  return;
122  }
123 
124  Con_Print (msg);
125 
126  // also echo to debugging console
128 
129  // logfile
131  {
132  char name[MAX_QPATH];
133 
134  if (!logfile)
135  {
136  Com_sprintf (name, sizeof(name), "%s/qconsole.log", FS_Gamedir ());
137  if (logfile_active->value > 2)
138  logfile = fopen (name, "a");
139  else
140  logfile = fopen (name, "w");
141  }
142  if (logfile)
143  fprintf (logfile, "%s", msg);
144  if (logfile_active->value > 1)
145  fflush (logfile); // force it to save every time
146  }
147 }

Referenced by Cbuf_AddText(), CD_f(), CDAudio_Init(), CDAudio_Play2(), CL_AddEntities(), CL_Changing_f(), CL_CheckForResend(), CL_CheckOrDownloadFile(), CL_CheckPredictionError(), CL_Connect_f(), CL_ConnectionlessPacket(), CL_Disconnect(), CL_Download_f(), CL_DumpPackets(), CL_ForwardToServer_f(), CL_KeyState(), CL_Packet_f(), CL_ParseBeam(), CL_ParseBeam2(), CL_ParseDownload(), CL_ParseFrame(), CL_ParseLightning(), CL_ParsePacketEntities(), CL_ParsePlayerBeam(), CL_ParseServerData(), CL_ParseServerMessage(), CL_ParseStatusMessage(), CL_PingServers_f(), CL_PredictMovement(), CL_PrepRefresh(), CL_Rcon_f(), CL_ReadPackets(), CL_Reconnect_f(), CL_Record_f(), CL_SendConnectPacket(), CL_Setenv_f(), CL_Skins_f(), CL_Stop_f(), CL_Userinfo_f(), CL_WriteConfiguration(), Cmd_AddCommand(), Cmd_Alias_f(), Cmd_Echo_f(), Cmd_Exec_f(), Cmd_ExecuteString(), Cmd_ForwardToServer(), Cmd_List_f(), Cmd_MacroExpandString(), Cmd_RemoveCommand(), Com_DPrintf(), Com_Error(), Com_sprintf(), Con_Dump_f(), Con_Init(), Cvar_Command(), Cvar_Get(), Cvar_List_f(), Cvar_Set2(), Cvar_Set_f(), DS_CreateBuffers(), DumpChunks(), FS_Dir_f(), FS_Link_f(), FS_LoadPackFile(), FS_Path_f(), FS_SetGamedir(), GetWavinfo(), Huff1Decompress(), IN_StartupJoystick(), Info_Print(), Info_SetValueForKey(), Joy_AdvancedUpdate_f(), Key_Bind_f(), Key_Bindlist_f(), Key_Console(), Key_Event(), Key_Unbind_f(), KeyDown(), Master_Heartbeat(), Master_Shutdown(), Miniaudio_f(), Miniaudio_Play(), NET_GetPacket(), NET_Init(), NET_IPSocket(), NET_IPXSocket(), NET_SendPacket(), Netchan_Process(), Netchan_Transmit(), PF_cprintf(), PF_dprintf(), PrintPmove(), Qcommon_Frame(), Qcommon_Init(), S_Init(), S_IssuePlaysound(), S_LoadSound(), S_SoundInfo_f(), S_SoundList(), S_StartLocalSound(), S_Update(), SCR_CenterPrint(), SCR_LoadPCX(), SCR_PlayCinematic(), SCR_RunCinematic(), SCR_Sky_f(), SCR_TimeRefresh_f(), SCR_UpdateScreen(), SHOWNET(), SNDDMA_BeginPainting(), SNDDMA_Init(), SNDDMA_InitDirect(), SNDDMA_InitWav(), SNDDMA_Submit(), SV_AreaEdicts_r(), SV_Baselines_f(), SV_Begin_f(), SV_BroadcastPrintf(), SV_Configstrings_f(), SV_ConnectionlessPacket(), SV_DumpUser_f(), SV_ExecuteClientMessage(), SV_Frame(), SV_GameMap_f(), SV_InitGame(), SV_Kick_f(), SV_Loadgame_f(), SV_Map_f(), SV_New_f(), SV_ReadLevelFile(), SV_ReadPackets(), SV_ReadServerFile(), SV_RunGameFrame(), SV_Savegame_f(), SV_SendClientDatagram(), SV_ServerCommand_f(), SV_Serverinfo_f(), SV_ServerRecord_f(), SV_ServerStop_f(), SV_SetMaster_f(), SV_SetPlayer(), SV_SpawnServer(), SV_Status_f(), SV_WriteLevelFile(), SV_WriteServerFile(), SVC_Ack(), SVC_DirectConnect(), SVC_RemoteCommand(), SVC_Status(), SZ_GetSpace(), V_Gun_Next_f(), V_Gun_Prev_f(), V_RenderView(), V_Viewpos_f(), VID_LoadRefresh(), VID_Printf(), and Z_Stats_f().

◆ Com_Quit()

void Com_Quit ( void  )

Definition at line 235 of file common.c.

236 {
237  SV_Shutdown ("Server quit\n", false);
239  CL_Shutdown ();
240 
241  if (logfile)
242  {
243  fclose (logfile);
244  logfile = NULL;
245  }
246 
247  Sys_Quit ();
248 }

Referenced by CL_Quit_f(), MainWndProc(), Qcommon_Init(), and WinMain().

◆ Com_ServerState()

◆ Com_SetServerState()

void Com_SetServerState ( int  state)

Definition at line 266 of file common.c.

267 {
268  server_state = state;
269 }

Referenced by SV_Shutdown(), and SV_SpawnServer().

◆ CopyString()

char* CopyString ( char *  in)

Definition at line 1038 of file common.c.

1039 {
1040  char *out;
1041 
1042  out = Z_Malloc ((int)strlen(in)+1);
1043  strcpy (out, in);
1044  return out;
1045 }

Referenced by Cmd_Alias_f(), Cvar_FullSet(), Cvar_Get(), Cvar_Set2(), and FS_Link_f().

◆ crand()

◆ frand()

◆ Info_Print()

void Info_Print ( char *  s)

Definition at line 1049 of file common.c.

1050 {
1051  char key[512];
1052  char value[512];
1053  char *o;
1054  int l;
1055 
1056  if (*s == '\\')
1057  s++;
1058  while (*s)
1059  {
1060  o = key;
1061  while (*s && *s != '\\')
1062  *o++ = *s++;
1063 
1064  l = o - key;
1065  if (l < 20)
1066  {
1067  memset (o, ' ', 20-l);
1068  key[20] = 0;
1069  }
1070  else
1071  *o = 0;
1072  Com_Printf ("%s", key);
1073 
1074  if (!*s)
1075  {
1076  Com_Printf ("MISSING VALUE\n");
1077  return;
1078  }
1079 
1080  o = value;
1081  s++;
1082  while (*s && *s != '\\')
1083  *o++ = *s++;
1084  *o = 0;
1085 
1086  if (*s)
1087  s++;
1088  Com_Printf ("%s\n", value);
1089  }
1090 }

Referenced by CL_Userinfo_f(), SV_DumpUser_f(), SV_Serverinfo_f(), and SV_ShowServerinfo_f().

◆ Key_Init()

void Key_Init ( void  )

Definition at line 647 of file keys.c.

648 {
649  int i;
650 
651  for (i=0 ; i<128 ; i++)
652  {
653  key_lines[i][0] = ']';
654  key_lines[i][1] = 0;
655  }
656  key_linepos = 1;
657 
658 //
659 // init ascii characters in console mode
660 //
661  for (i=32 ; i<128 ; i++)
662  consolekeys[i] = true;
663  consolekeys[K_ENTER] = true;
664  consolekeys[K_KP_ENTER] = true;
665  consolekeys[K_TAB] = true;
666  consolekeys[K_LEFTARROW] = true;
667  consolekeys[K_KP_LEFTARROW] = true;
668  consolekeys[K_RIGHTARROW] = true;
670  consolekeys[K_UPARROW] = true;
671  consolekeys[K_KP_UPARROW] = true;
672  consolekeys[K_DOWNARROW] = true;
673  consolekeys[K_KP_DOWNARROW] = true;
674  consolekeys[K_BACKSPACE] = true;
675  consolekeys[K_HOME] = true;
676  consolekeys[K_KP_HOME] = true;
677  consolekeys[K_END] = true;
678  consolekeys[K_KP_END] = true;
679  consolekeys[K_PGUP] = true;
680  consolekeys[K_KP_PGUP] = true;
681  consolekeys[K_PGDN] = true;
682  consolekeys[K_KP_PGDN] = true;
683  consolekeys[K_MWHEELUP] = true;
684  consolekeys[K_MWHEELDOWN] = true;
685  consolekeys[K_SHIFT] = true;
686  consolekeys[K_INS] = true;
687  consolekeys[K_KP_INS] = true;
688  consolekeys[K_KP_DEL] = true;
689  consolekeys[K_KP_SLASH] = true;
690  consolekeys[K_KP_PLUS] = true;
691  consolekeys[K_KP_MINUS] = true;
692  consolekeys[K_KP_5] = true;
693 
694  consolekeys['`'] = false;
695  consolekeys['~'] = false;
696 
697  for (i=0 ; i<256 ; i++)
698  keyshift[i] = i;
699  for (i='a' ; i<='z' ; i++)
700  keyshift[i] = i - 'a' + 'A';
701  keyshift['1'] = '!';
702  keyshift['2'] = '@';
703  keyshift['3'] = '#';
704  keyshift['4'] = '$';
705  keyshift['5'] = '%';
706  keyshift['6'] = '^';
707  keyshift['7'] = '&';
708  keyshift['8'] = '*';
709  keyshift['9'] = '(';
710  keyshift['0'] = ')';
711  keyshift['-'] = '_';
712  keyshift['='] = '+';
713  keyshift[','] = '<';
714  keyshift['.'] = '>';
715  keyshift['/'] = '?';
716  keyshift[';'] = ':';
717  keyshift['\''] = '"';
718  keyshift['['] = '{';
719  keyshift[']'] = '}';
720  keyshift['`'] = '~';
721  keyshift['\\'] = '|';
722 
723  menubound[K_ESCAPE] = true;
724  for (i=0 ; i<12 ; i++)
725  menubound[K_F1+i] = true;
726 
727 //
728 // register our functions
729 //
730  Cmd_AddCommand ("bind",Key_Bind_f);
731  Cmd_AddCommand ("unbind",Key_Unbind_f);
732  Cmd_AddCommand ("unbindall",Key_Unbindall_f);
733  Cmd_AddCommand ("bindlist",Key_Bindlist_f);
734 }

Referenced by Qcommon_Init().

◆ memsearch()

int memsearch ( byte start,
int  count,
int  search 
)

just for debugging

Definition at line 1027 of file common.c.

1028 {
1029  int i;
1030 
1031  for (i=0 ; i<count ; i++)
1032  if (start[i] == search)
1033  return i;
1034  return -1;
1035 }

◆ MSG_BeginReading()

void MSG_BeginReading ( sizebuf_t msg)

Definition at line 684 of file common.c.

685 {
686  msg->readcount = 0;
687 }

Referenced by CL_ConnectionlessPacket(), Netchan_Process(), SV_ConnectionlessPacket(), and SV_ReadPackets().

◆ MSG_ReadAngle()

float MSG_ReadAngle ( sizebuf_t msg_read)

Definition at line 825 of file common.c.

826 {
827  return MSG_ReadChar(msg_read) * (360.0/256);
828 }

Referenced by CL_ParseDelta().

◆ MSG_ReadAngle16()

float MSG_ReadAngle16 ( sizebuf_t msg_read)

Definition at line 830 of file common.c.

831 {
832  return SHORT2ANGLE(MSG_ReadShort(msg_read));
833 }

Referenced by CL_ParsePlayerstate().

◆ MSG_ReadByte()

int MSG_ReadByte ( sizebuf_t msg_read)

Definition at line 703 of file common.c.

704 {
705  int c;
706 
707  if (msg_read->readcount+1 > msg_read->cursize)
708  c = -1;
709  else
710  c = (unsigned char)msg_read->data[msg_read->readcount];
711  msg_read->readcount++;
712 
713  return c;
714 }

Referenced by CL_ParseDelta(), CL_ParseDownload(), CL_ParseEntityBits(), CL_ParseFrame(), CL_ParseMuzzleFlash(), CL_ParseMuzzleFlash2(), CL_ParseParticles(), CL_ParsePlayerstate(), CL_ParseServerData(), CL_ParseServerMessage(), CL_ParseStartSoundPacket(), CL_ParseSteam(), CL_ParseTEnt(), MSG_ReadData(), MSG_ReadDeltaUsercmd(), MSG_ReadDir(), and SV_ExecuteClientMessage().

◆ MSG_ReadChar()

int MSG_ReadChar ( sizebuf_t msg_read)

Definition at line 690 of file common.c.

691 {
692  int c;
693 
694  if (msg_read->readcount+1 > msg_read->cursize)
695  c = -1;
696  else
697  c = (signed char)msg_read->data[msg_read->readcount];
698  msg_read->readcount++;
699 
700  return c;
701 }

Referenced by CL_ParsePlayerstate(), MSG_ReadAngle(), MSG_ReadString(), and MSG_ReadStringLine().

◆ MSG_ReadCoord()

float MSG_ReadCoord ( sizebuf_t msg_read)

Definition at line 813 of file common.c.

814 {
815  return MSG_ReadShort(msg_read) * (1.0/8);
816 }

Referenced by CL_ParseDelta().

◆ MSG_ReadData()

void MSG_ReadData ( sizebuf_t msg_read,
void data,
int  len 
)

Definition at line 874 of file common.c.

875 {
876  int i;
877 
878  for (i=0 ; i<len ; i++)
879  ((byte *)data)[i] = MSG_ReadByte (msg_read);
880 }

Referenced by CL_ParseFrame().

◆ MSG_ReadDeltaUsercmd()

void MSG_ReadDeltaUsercmd ( sizebuf_t msg_read,
usercmd_t from,
usercmd_t move 
)

Definition at line 835 of file common.c.

836 {
837  int bits;
838 
839  memcpy (move, from, sizeof(*move));
840 
841  bits = MSG_ReadByte (msg_read);
842 
843 // read current angles
844  if (bits & CM_ANGLE1)
845  move->angles[0] = MSG_ReadShort (msg_read);
846  if (bits & CM_ANGLE2)
847  move->angles[1] = MSG_ReadShort (msg_read);
848  if (bits & CM_ANGLE3)
849  move->angles[2] = MSG_ReadShort (msg_read);
850 
851 // read movement
852  if (bits & CM_FORWARD)
853  move->forwardmove = MSG_ReadShort (msg_read);
854  if (bits & CM_SIDE)
855  move->sidemove = MSG_ReadShort (msg_read);
856  if (bits & CM_UP)
857  move->upmove = MSG_ReadShort (msg_read);
858 
859 // read buttons
860  if (bits & CM_BUTTONS)
861  move->buttons = MSG_ReadByte (msg_read);
862 
863  if (bits & CM_IMPULSE)
864  move->impulse = MSG_ReadByte (msg_read);
865 
866 // read time to run command
867  move->msec = MSG_ReadByte (msg_read);
868 
869 // read the light level
870  move->lightlevel = MSG_ReadByte (msg_read);
871 }

Referenced by SV_ExecuteClientMessage().

◆ MSG_ReadDir()

void MSG_ReadDir ( sizebuf_t sb,
vec3_t  dir 
)

Definition at line 464 of file common.c.

465 {
466  int b;
467 
468  b = MSG_ReadByte (sb);
469  if (b >= NUMVERTEXNORMALS)
470  Com_Error (ERR_DROP, "MSF_ReadDir: out of range");
471  VectorCopy (bytedirs[b], dir);
472 }

Referenced by CL_ParseParticles(), CL_ParseSteam(), and CL_ParseTEnt().

◆ MSG_ReadFloat()

float MSG_ReadFloat ( sizebuf_t msg_read)

Definition at line 748 of file common.c.

749 {
750  union
751  {
752  byte b[4];
753  float f;
754  int l;
755  } dat;
756 
757  if (msg_read->readcount+4 > msg_read->cursize)
758  dat.f = -1;
759  else
760  {
761  dat.b[0] = msg_read->data[msg_read->readcount];
762  dat.b[1] = msg_read->data[msg_read->readcount+1];
763  dat.b[2] = msg_read->data[msg_read->readcount+2];
764  dat.b[3] = msg_read->data[msg_read->readcount+3];
765  }
766  msg_read->readcount += 4;
767 
768  dat.l = LittleLong (dat.l);
769 
770  return dat.f;
771 }

◆ MSG_ReadLong()

int MSG_ReadLong ( sizebuf_t msg_read)

Definition at line 731 of file common.c.

732 {
733  int c;
734 
735  if (msg_read->readcount+4 > msg_read->cursize)
736  c = -1;
737  else
738  c = msg_read->data[msg_read->readcount]
739  + (msg_read->data[msg_read->readcount+1]<<8)
740  + (msg_read->data[msg_read->readcount+2]<<16)
741  + (msg_read->data[msg_read->readcount+3]<<24);
742 
743  msg_read->readcount += 4;
744 
745  return c;
746 }

Referenced by CL_ConnectionlessPacket(), CL_ParseDelta(), CL_ParseFrame(), CL_ParsePlayerstate(), CL_ParseServerData(), CL_ParseSteam(), Netchan_Process(), SV_ConnectionlessPacket(), SV_ExecuteClientMessage(), and SV_ReadPackets().

◆ MSG_ReadPos()

void MSG_ReadPos ( sizebuf_t msg_read,
vec3_t  pos 
)

Definition at line 818 of file common.c.

819 {
820  pos[0] = MSG_ReadShort(msg_read) * (1.0/8);
821  pos[1] = MSG_ReadShort(msg_read) * (1.0/8);
822  pos[2] = MSG_ReadShort(msg_read) * (1.0/8);
823 }

Referenced by CL_ParseBeam(), CL_ParseBeam2(), CL_ParseDelta(), CL_ParseLaser(), CL_ParseLightning(), CL_ParseNuke(), CL_ParseParticles(), CL_ParsePlayerBeam(), CL_ParseStartSoundPacket(), CL_ParseSteam(), CL_ParseTEnt(), and CL_ParseWidow().

◆ MSG_ReadShort()

int MSG_ReadShort ( sizebuf_t msg_read)

Definition at line 716 of file common.c.

717 {
718  int c;
719 
720  if (msg_read->readcount+2 > msg_read->cursize)
721  c = -1;
722  else
723  c = (short)(msg_read->data[msg_read->readcount]
724  + (msg_read->data[msg_read->readcount+1]<<8));
725 
726  msg_read->readcount += 2;
727 
728  return c;
729 }

Referenced by CL_ParseBeam(), CL_ParseBeam2(), CL_ParseConfigString(), CL_ParseDelta(), CL_ParseDownload(), CL_ParseEntityBits(), CL_ParseInventory(), CL_ParseLightning(), CL_ParseMuzzleFlash(), CL_ParseMuzzleFlash2(), CL_ParsePlayerBeam(), CL_ParsePlayerstate(), CL_ParseServerData(), CL_ParseStartSoundPacket(), CL_ParseSteam(), CL_ParseTEnt(), CL_ParseWidow(), MSG_ReadAngle16(), MSG_ReadCoord(), MSG_ReadDeltaUsercmd(), MSG_ReadPos(), Netchan_Process(), and SV_ReadPackets().

◆ MSG_ReadString()

char* MSG_ReadString ( sizebuf_t msg_read)

Definition at line 773 of file common.c.

774 {
775  static char string[2048];
776  int l,c;
777 
778  l = 0;
779  do
780  {
781  c = MSG_ReadChar (msg_read);
782  if (c == -1 || c == 0)
783  break;
784  string[l] = c;
785  l++;
786  } while (l < sizeof(string)-1);
787 
788  string[l] = 0;
789 
790  return string;
791 }

Referenced by CL_ConnectionlessPacket(), CL_ParseConfigString(), CL_ParseServerData(), CL_ParseServerMessage(), CL_ParseStatusMessage(), and SV_ExecuteClientMessage().

◆ MSG_ReadStringLine()

char* MSG_ReadStringLine ( sizebuf_t msg_read)

Definition at line 793 of file common.c.

794 {
795  static char string[2048];
796  int l,c;
797 
798  l = 0;
799  do
800  {
801  c = MSG_ReadChar (msg_read);
802  if (c == -1 || c == 0 || c == '\n')
803  break;
804  string[l] = c;
805  l++;
806  } while (l < sizeof(string)-1);
807 
808  string[l] = 0;
809 
810  return string;
811 }

Referenced by CL_ConnectionlessPacket(), and SV_ConnectionlessPacket().

◆ MSG_WriteAngle()

void MSG_WriteAngle ( sizebuf_t sb,
float  f 
)

Definition at line 376 of file common.c.

377 {
378  MSG_WriteByte (sb, (int)(f*256/360) & 255);
379 }

Referenced by MSG_WriteDeltaEntity(), and PF_WriteAngle().

◆ MSG_WriteAngle16()

void MSG_WriteAngle16 ( sizebuf_t sb,
float  f 
)

Definition at line 381 of file common.c.

382 {
383  MSG_WriteShort (sb, ANGLE2SHORT(f));
384 }

Referenced by SV_WritePlayerstateToClient().

◆ MSG_WriteByte()

◆ MSG_WriteChar()

void MSG_WriteChar ( sizebuf_t sb,
int  c 
)

Definition at line 290 of file common.c.

291 {
292  byte *buf;
293 
294 #ifdef PARANOID
295  if (c < -128 || c > 127)
296  Com_Error (ERR_FATAL, "MSG_WriteChar: range error");
297 #endif
298 
299  buf = SZ_GetSpace (sb, 1);
300  buf[0] = c;
301 }

Referenced by CL_ConnectionlessPacket(), CL_Reconnect_f(), PF_Configstring(), PF_WriteChar(), SV_FindIndex(), and SV_WritePlayerstateToClient().

◆ MSG_WriteCoord()

void MSG_WriteCoord ( sizebuf_t sb,
float  f 
)

Definition at line 364 of file common.c.

365 {
366  MSG_WriteShort (sb, (int)(f*8));
367 }

Referenced by MSG_WriteDeltaEntity().

◆ MSG_WriteDeltaEntity()

void MSG_WriteDeltaEntity ( entity_state_t from,
entity_state_t to,
sizebuf_t msg,
qboolean  force,
qboolean  newentity 
)

Definition at line 483 of file common.c.

484 {
485  int bits;
486 
487  if (!to->number)
488  Com_Error (ERR_FATAL, "Unset entity number");
489  if (to->number >= MAX_EDICTS)
490  Com_Error (ERR_FATAL, "Entity number >= MAX_EDICTS");
491 
492 // send an update
493  bits = 0;
494 
495  if (to->number >= 256)
496  bits |= U_NUMBER16; // number8 is implicit otherwise
497 
498  if (to->origin[0] != from->origin[0])
499  bits |= U_ORIGIN1;
500  if (to->origin[1] != from->origin[1])
501  bits |= U_ORIGIN2;
502  if (to->origin[2] != from->origin[2])
503  bits |= U_ORIGIN3;
504 
505  if ( to->angles[0] != from->angles[0] )
506  bits |= U_ANGLE1;
507  if ( to->angles[1] != from->angles[1] )
508  bits |= U_ANGLE2;
509  if ( to->angles[2] != from->angles[2] )
510  bits |= U_ANGLE3;
511 
512  if ( to->skinnum != from->skinnum )
513  {
514  if ((unsigned)to->skinnum < 256)
515  bits |= U_SKIN8;
516  else if ((unsigned)to->skinnum < 0x10000)
517  bits |= U_SKIN16;
518  else
519  bits |= (U_SKIN8|U_SKIN16);
520  }
521 
522  if ( to->frame != from->frame )
523  {
524  if (to->frame < 256)
525  bits |= U_FRAME8;
526  else
527  bits |= U_FRAME16;
528  }
529 
530  if ( to->effects != from->effects )
531  {
532  if (to->effects < 256)
533  bits |= U_EFFECTS8;
534  else if (to->effects < 0x8000)
535  bits |= U_EFFECTS16;
536  else
537  bits |= U_EFFECTS8|U_EFFECTS16;
538  }
539 
540  if ( to->renderfx != from->renderfx )
541  {
542  if (to->renderfx < 256)
543  bits |= U_RENDERFX8;
544  else if (to->renderfx < 0x8000)
545  bits |= U_RENDERFX16;
546  else
547  bits |= U_RENDERFX8|U_RENDERFX16;
548  }
549 
550  if ( to->solid != from->solid )
551  bits |= U_SOLID;
552 
553  // event is not delta compressed, just 0 compressed
554  if ( to->event )
555  bits |= U_EVENT;
556 
557  if ( to->modelindex != from->modelindex )
558  bits |= U_MODEL;
559  if ( to->modelindex2 != from->modelindex2 )
560  bits |= U_MODEL2;
561  if ( to->modelindex3 != from->modelindex3 )
562  bits |= U_MODEL3;
563  if ( to->modelindex4 != from->modelindex4 )
564  bits |= U_MODEL4;
565 
566  if ( to->sound != from->sound )
567  bits |= U_SOUND;
568 
569  if (newentity || (to->renderfx & RF_BEAM))
570  bits |= U_OLDORIGIN;
571 
572  //
573  // write the message
574  //
575  if (!bits && !force)
576  return; // nothing to send!
577 
578  //----------
579 
580  if (bits & 0xff000000)
581  bits |= U_MOREBITS3 | U_MOREBITS2 | U_MOREBITS1;
582  else if (bits & 0x00ff0000)
583  bits |= U_MOREBITS2 | U_MOREBITS1;
584  else if (bits & 0x0000ff00)
585  bits |= U_MOREBITS1;
586 
587  MSG_WriteByte (msg, bits&255 );
588 
589  if (bits & 0xff000000)
590  {
591  MSG_WriteByte (msg, (bits>>8)&255 );
592  MSG_WriteByte (msg, (bits>>16)&255 );
593  MSG_WriteByte (msg, (bits>>24)&255 );
594  }
595  else if (bits & 0x00ff0000)
596  {
597  MSG_WriteByte (msg, (bits>>8)&255 );
598  MSG_WriteByte (msg, (bits>>16)&255 );
599  }
600  else if (bits & 0x0000ff00)
601  {
602  MSG_WriteByte (msg, (bits>>8)&255 );
603  }
604 
605  //----------
606 
607  if (bits & U_NUMBER16)
608  MSG_WriteShort (msg, to->number);
609  else
610  MSG_WriteByte (msg, to->number);
611 
612  if (bits & U_MODEL)
614  if (bits & U_MODEL2)
616  if (bits & U_MODEL3)
618  if (bits & U_MODEL4)
620 
621  if (bits & U_FRAME8)
622  MSG_WriteByte (msg, to->frame);
623  if (bits & U_FRAME16)
624  MSG_WriteShort (msg, to->frame);
625 
626  if ((bits & U_SKIN8) && (bits & U_SKIN16)) //used for laser colors
627  MSG_WriteLong (msg, to->skinnum);
628  else if (bits & U_SKIN8)
629  MSG_WriteByte (msg, to->skinnum);
630  else if (bits & U_SKIN16)
631  MSG_WriteShort (msg, to->skinnum);
632 
633 
634  if ( (bits & (U_EFFECTS8|U_EFFECTS16)) == (U_EFFECTS8|U_EFFECTS16) )
635  MSG_WriteLong (msg, to->effects);
636  else if (bits & U_EFFECTS8)
637  MSG_WriteByte (msg, to->effects);
638  else if (bits & U_EFFECTS16)
639  MSG_WriteShort (msg, to->effects);
640 
641  if ( (bits & (U_RENDERFX8|U_RENDERFX16)) == (U_RENDERFX8|U_RENDERFX16) )
642  MSG_WriteLong (msg, to->renderfx);
643  else if (bits & U_RENDERFX8)
644  MSG_WriteByte (msg, to->renderfx);
645  else if (bits & U_RENDERFX16)
646  MSG_WriteShort (msg, to->renderfx);
647 
648  if (bits & U_ORIGIN1)
649  MSG_WriteCoord (msg, to->origin[0]);
650  if (bits & U_ORIGIN2)
651  MSG_WriteCoord (msg, to->origin[1]);
652  if (bits & U_ORIGIN3)
653  MSG_WriteCoord (msg, to->origin[2]);
654 
655  if (bits & U_ANGLE1)
656  MSG_WriteAngle(msg, to->angles[0]);
657  if (bits & U_ANGLE2)
658  MSG_WriteAngle(msg, to->angles[1]);
659  if (bits & U_ANGLE3)
660  MSG_WriteAngle(msg, to->angles[2]);
661 
662  if (bits & U_OLDORIGIN)
663  {
664  MSG_WriteCoord (msg, to->old_origin[0]);
665  MSG_WriteCoord (msg, to->old_origin[1]);
666  MSG_WriteCoord (msg, to->old_origin[2]);
667  }
668 
669  if (bits & U_SOUND)
670  MSG_WriteByte (msg, to->sound);
671  if (bits & U_EVENT)
672  MSG_WriteByte (msg, to->event);
673  if (bits & U_SOLID)
674  MSG_WriteShort (msg, to->solid);
675 }

Referenced by CL_Record_f(), SV_Baselines_f(), SV_EmitPacketEntities(), and SV_RecordDemoMessage().

◆ MSG_WriteDeltaUsercmd()

void MSG_WriteDeltaUsercmd ( sizebuf_t buf,
usercmd_t from,
usercmd_t cmd 
)

Definition at line 387 of file common.c.

388 {
389  int bits;
390 
391 //
392 // send the movement message
393 //
394  bits = 0;
395  if (cmd->angles[0] != from->angles[0])
396  bits |= CM_ANGLE1;
397  if (cmd->angles[1] != from->angles[1])
398  bits |= CM_ANGLE2;
399  if (cmd->angles[2] != from->angles[2])
400  bits |= CM_ANGLE3;
401  if (cmd->forwardmove != from->forwardmove)
402  bits |= CM_FORWARD;
403  if (cmd->sidemove != from->sidemove)
404  bits |= CM_SIDE;
405  if (cmd->upmove != from->upmove)
406  bits |= CM_UP;
407  if (cmd->buttons != from->buttons)
408  bits |= CM_BUTTONS;
409  if (cmd->impulse != from->impulse)
410  bits |= CM_IMPULSE;
411 
412  MSG_WriteByte (buf, bits);
413 
414  if (bits & CM_ANGLE1)
415  MSG_WriteShort (buf, cmd->angles[0]);
416  if (bits & CM_ANGLE2)
417  MSG_WriteShort (buf, cmd->angles[1]);
418  if (bits & CM_ANGLE3)
419  MSG_WriteShort (buf, cmd->angles[2]);
420 
421  if (bits & CM_FORWARD)
422  MSG_WriteShort (buf, cmd->forwardmove);
423  if (bits & CM_SIDE)
424  MSG_WriteShort (buf, cmd->sidemove);
425  if (bits & CM_UP)
426  MSG_WriteShort (buf, cmd->upmove);
427 
428  if (bits & CM_BUTTONS)
429  MSG_WriteByte (buf, cmd->buttons);
430  if (bits & CM_IMPULSE)
431  MSG_WriteByte (buf, cmd->impulse);
432 
433  MSG_WriteByte (buf, cmd->msec);
434  MSG_WriteByte (buf, cmd->lightlevel);
435 }

Referenced by CL_SendCmd().

◆ MSG_WriteDir()

void MSG_WriteDir ( sizebuf_t sb,
vec3_t  dir 
)

Definition at line 438 of file common.c.

439 {
440  int i, best;
441  float d, bestd;
442 
443  if (!dir)
444  {
445  MSG_WriteByte (sb, 0);
446  return;
447  }
448 
449  bestd = 0;
450  best = 0;
451  for (i=0 ; i<NUMVERTEXNORMALS ; i++)
452  {
453  d = DotProduct (dir, bytedirs[i]);
454  if (d > bestd)
455  {
456  bestd = d;
457  best = i;
458  }
459  }
460  MSG_WriteByte (sb, best);
461 }

Referenced by PF_WriteDir().

◆ MSG_WriteFloat()

void MSG_WriteFloat ( sizebuf_t sb,
float  f 
)

Definition at line 341 of file common.c.

342 {
343  union
344  {
345  float f;
346  int l;
347  } dat;
348 
349 
350  dat.f = f;
351  dat.l = LittleLong (dat.l);
352 
353  SZ_Write (sb, &dat.l, 4);
354 }

Referenced by PF_WriteFloat().

◆ MSG_WriteLong()

void MSG_WriteLong ( sizebuf_t sb,
int  c 
)

Definition at line 330 of file common.c.

331 {
332  byte *buf;
333 
334  buf = SZ_GetSpace (sb, 4);
335  buf[0] = c&0xff;
336  buf[1] = (c>>8)&0xff;
337  buf[2] = (c>>16)&0xff;
338  buf[3] = c>>24;
339 }

Referenced by CL_Record_f(), CL_SendCmd(), MSG_WriteDeltaEntity(), Netchan_OutOfBand(), Netchan_Transmit(), PF_WriteLong(), SV_New_f(), SV_RecordDemoMessage(), SV_ServerRecord_f(), SV_WriteFrameToClient(), and SV_WritePlayerstateToClient().

◆ MSG_WritePos()

void MSG_WritePos ( sizebuf_t sb,
vec3_t  pos 
)

Definition at line 369 of file common.c.

370 {
371  MSG_WriteShort (sb, (int)(pos[0]*8));
372  MSG_WriteShort (sb, (int)(pos[1]*8));
373  MSG_WriteShort (sb, (int)(pos[2]*8));
374 }

Referenced by PF_WritePos(), and SV_StartSound().

◆ MSG_WriteShort()

void MSG_WriteShort ( sizebuf_t sb,
int  c 
)

Definition at line 316 of file common.c.

317 {
318  byte *buf;
319 
320 #ifdef PARANOID
321  if (c < ((short)0x8000) || c > (short)0x7fff)
322  Com_Error (ERR_FATAL, "MSG_WriteShort: range error");
323 #endif
324 
325  buf = SZ_GetSpace (sb, 2);
326  buf[0] = c&0xff;
327  buf[1] = c>>8;
328 }

Referenced by CL_Record_f(), MSG_WriteAngle16(), MSG_WriteCoord(), MSG_WriteDeltaEntity(), MSG_WriteDeltaUsercmd(), MSG_WritePos(), Netchan_Transmit(), PF_Configstring(), PF_WriteShort(), SV_BeginDownload_f(), SV_Configstrings_f(), SV_EmitPacketEntities(), SV_FindIndex(), SV_New_f(), SV_NextDownload_f(), SV_RecordDemoMessage(), SV_ServerRecord_f(), SV_StartSound(), and SV_WritePlayerstateToClient().

◆ MSG_WriteString()

◆ Qcommon_Frame()

void Qcommon_Frame ( int  msec)

Definition at line 1500 of file common.c.

1501 {
1502  char *s;
1503  int time_before, time_between, time_after;
1504 
1505  if (setjmp (abortframe) )
1506  {
1507  if (shutdown_game)
1509  shutdown_game = false;
1510  return; // an ERR_DROP was thrown
1511  }
1512 
1513  if ( log_stats->modified )
1514  {
1515  log_stats->modified = false;
1516  if ( log_stats->value )
1517  {
1518  if ( log_stats_file )
1519  {
1520  fclose( log_stats_file );
1521  log_stats_file = 0;
1522  }
1523  log_stats_file = fopen( "stats.log", "w" );
1524  if ( log_stats_file )
1525  fprintf( log_stats_file, "entities,dlights,parts,frame time\n" );
1526  }
1527  else
1528  {
1529  if ( log_stats_file )
1530  {
1531  fclose( log_stats_file );
1532  log_stats_file = 0;
1533  }
1534  }
1535  }
1536 
1537  if (fixedtime->value)
1538  msec = fixedtime->value;
1539  else if (timescale->value)
1540  {
1541  msec *= timescale->value;
1542  if (msec < 1)
1543  msec = 1;
1544  }
1545 
1546  if (showtrace->value)
1547  {
1548  extern int c_traces, c_brush_traces;
1549  extern int c_pointcontents;
1550 
1551  Com_Printf ("%4i traces %4i points\n", c_traces, c_pointcontents);
1552  c_traces = 0;
1553  c_brush_traces = 0;
1554  c_pointcontents = 0;
1555  }
1556 
1557  do
1558  {
1559  s = Sys_ConsoleInput ();
1560  if (s)
1561  Cbuf_AddText (va("%s\n",s));
1562  } while (s);
1563  Cbuf_Execute ();
1564 
1565  if (host_speeds->value)
1566  time_before = Sys_Milliseconds ();
1567 
1568  SV_Frame (msec);
1569 
1570  if (host_speeds->value)
1571  time_between = Sys_Milliseconds ();
1572 
1573  CL_Frame (msec);
1574 
1575  if (host_speeds->value)
1576  time_after = Sys_Milliseconds ();
1577 
1578 
1579  if (host_speeds->value)
1580  {
1581  int all, sv, gm, cl, rf;
1582 
1583  all = time_after - time_before;
1584  sv = time_between - time_before;
1585  cl = time_after - time_between;
1588  sv -= gm;
1589  cl -= rf;
1590  Com_Printf ("all:%3i sv:%3i gm:%3i cl:%3i rf:%3i\n",
1591  all, sv, gm, cl, rf);
1592  }
1593 }

Referenced by WinMain().

◆ Qcommon_Init()

void Qcommon_Init ( int  argc,
char **  argv 
)

Definition at line 1407 of file common.c.

1408 {
1409  char *s;
1410 
1411  if (setjmp (abortframe) )
1412  Sys_Error ("Error during initialization");
1413 
1415 
1416  // prepare enough of the subsystems to handle
1417  // cvar and command buffer management
1418  COM_InitArgv (argc, argv);
1419 
1420  Swap_Init ();
1421  Cbuf_Init ();
1422 
1423  Cmd_Init ();
1424  Cvar_Init ();
1425 
1426  Key_Init ();
1427 
1428  // we need to add the early commands twice, because
1429  // a basedir or cddir needs to be set before execing
1430  // config files, but we want other parms to override
1431  // the settings of the config files
1432  Cbuf_AddEarlyCommands (false);
1433  Cbuf_Execute ();
1434 
1435  FS_InitFilesystem ();
1436 
1437  Cbuf_AddText ("exec default.cfg\n");
1438  Cbuf_AddText ("exec config.cfg\n");
1439 
1440  Cbuf_AddEarlyCommands (true);
1441  Cbuf_Execute ();
1442 
1443  //
1444  // init commands and vars
1445  //
1446  Cmd_AddCommand ("z_stats", Z_Stats_f);
1447  Cmd_AddCommand ("error", Com_Error_f);
1448 
1449  host_speeds = Cvar_Get ("host_speeds", "0", 0);
1450  log_stats = Cvar_Get ("log_stats", "0", 0);
1451  developer = Cvar_Get ("developer", "0", 0);
1452  timescale = Cvar_Get ("timescale", "1", 0);
1453  fixedtime = Cvar_Get ("fixedtime", "0", 0);
1454  logfile_active = Cvar_Get ("logfile", "0", 0);
1455  showtrace = Cvar_Get ("showtrace", "0", 0);
1456 #ifdef DEDICATED_ONLY
1457  dedicated = Cvar_Get ("dedicated", "1", CVAR_NOSET);
1458 #else
1459  dedicated = Cvar_Get ("dedicated", "0", CVAR_NOSET);
1460 #endif
1461 
1462  s = va("%4.2f %s %s %s", VERSION, CPUSTRING, __DATE__, BUILDSTRING);
1463  Cvar_Get ("version", s, CVAR_SERVERINFO|CVAR_NOSET);
1464 
1465 
1466  if (dedicated->value)
1467  Cmd_AddCommand ("quit", Com_Quit);
1468 
1469  Sys_Init ();
1470 
1471  NET_Init ();
1472  Netchan_Init ();
1473 
1474  SV_Init ();
1475  CL_Init ();
1476 
1477  // add + commands from command line
1478  if (!Cbuf_AddLateCommands ())
1479  { // if the user didn't give any commands, run default action
1480  if (!dedicated->value)
1481  Cbuf_AddText ("d1\n");
1482  else
1483  Cbuf_AddText ("dedicated_start\n");
1484  Cbuf_Execute ();
1485  }
1486  else
1487  { // the user asked for something explicit
1488  // so drop the loading plaque
1490  }
1491 
1492  Com_Printf ("====== Quake2 Initialized ======\n\n");
1493 }

Referenced by WinMain().

◆ Qcommon_Shutdown()

void Qcommon_Shutdown ( void  )

Definition at line 1600 of file common.c.

1601 {
1602 }

Referenced by Sys_Error(), and Sys_Quit().

◆ SCR_EndLoadingPlaque()

void SCR_EndLoadingPlaque ( void  )

Definition at line 590 of file cl_scrn.c.

591 {
592  cls.disable_screen = 0;
593  Con_ClearNotify ();
594 }

Referenced by CL_Drop(), CL_ParseFrame(), Con_ToggleConsole_f(), Qcommon_Init(), and SCR_PlayCinematic().

◆ SV_ShutdownGameProgs()

void SV_ShutdownGameProgs ( void  )

Definition at line 305 of file sv_game.c.

306 {
307  if (!ge)
308  return;
309  ge->Shutdown ();
310  Sys_UnloadGame ();
311  ge = NULL;
312 }

Referenced by Com_Error(), Com_Quit(), Qcommon_Frame(), SV_InitGame(), and SV_KillServer_f().

◆ SZ_Clear()

◆ SZ_GetSpace()

void* SZ_GetSpace ( sizebuf_t buf,
int  length 
)

Definition at line 898 of file common.c.

899 {
900  void *data;
901 
902  if (buf->cursize + length > buf->maxsize)
903  {
904  if (!buf->allowoverflow)
905  Com_Error (ERR_FATAL, "SZ_GetSpace: overflow without allowoverflow set");
906 
907  if (length > buf->maxsize)
908  Com_Error (ERR_FATAL, "SZ_GetSpace: %i is > full buffer size", length);
909 
910  Com_Printf ("SZ_GetSpace: overflow\n");
911  SZ_Clear (buf);
912  buf->overflowed = true;
913  }
914 
915  data = buf->data + buf->cursize;
916  buf->cursize += length;
917 
918  return data;
919 }

Referenced by MSG_WriteByte(), MSG_WriteChar(), MSG_WriteLong(), MSG_WriteShort(), SZ_Print(), and SZ_Write().

◆ SZ_Init()

void SZ_Init ( sizebuf_t buf,
byte data,
int  length 
)

Definition at line 885 of file common.c.

886 {
887  memset (buf, 0, sizeof(*buf));
888  buf->data = data;
889  buf->maxsize = length;
890 }

Referenced by Cbuf_Init(), CL_Record_f(), CL_SendCmd(), Netchan_OutOfBand(), Netchan_Setup(), Netchan_Transmit(), SV_Init(), SV_RecordDemoMessage(), SV_SendClientDatagram(), SV_ServerRecord_f(), SV_SpawnServer(), and SVC_DirectConnect().

◆ SZ_Print()

void SZ_Print ( sizebuf_t buf,
char *  data 
)

Definition at line 926 of file common.c.

927 {
928  int len;
929 
930  len = (int)strlen(data)+1;
931 
932  if (buf->cursize)
933  {
934  if (buf->data[buf->cursize-1])
935  memcpy ((byte *)SZ_GetSpace(buf, len),data,len); // no trailing 0
936  else
937  memcpy ((byte *)SZ_GetSpace(buf, len-1)-1,data,len); // write over trailing 0
938  }
939  else
940  memcpy ((byte *)SZ_GetSpace(buf, len),data,len);
941 }

Referenced by CL_ForwardToServer_f(), CL_ParseDownload(), Cmd_ForwardToServer(), and SCR_FinishCinematic().

◆ SZ_Write()

void SZ_Write ( sizebuf_t buf,
void data,
int  length 
)

◆ Z_Free()

void Z_Free ( void ptr)

Definition at line 1122 of file common.c.

1123 {
1124  zhead_t *z;
1125 
1126  z = ((zhead_t *)ptr) - 1;
1127 
1128  if (z->magic != Z_MAGIC)
1129  Com_Error (ERR_FATAL, "Z_Free: bad magic");
1130 
1131  z->prev->next = z->next;
1132  z->next->prev = z->prev;
1133 
1134  z_count--;
1135  z_bytes -= z->size;
1136  free (z);
1137 }

Referenced by Cbuf_AddLateCommands(), Cbuf_InsertText(), Cmd_Alias_f(), Cmd_Exec_f(), Cmd_RemoveCommand(), Cmd_TokenizeString(), Cvar_FullSet(), Cvar_GetLatchedVars(), Cvar_Set2(), FS_FreeFile(), FS_Link_f(), FS_SetGamedir(), Key_SetBinding(), S_EndRegistration(), S_Shutdown(), SCR_LoadPCX(), SCR_PlayCinematic(), SCR_RunCinematic(), SCR_StopCinematic(), SV_InitGameProgs(), SV_Shutdown(), and Z_FreeTags().

◆ Z_FreeTags()

void Z_FreeTags ( int  tag)

Definition at line 1155 of file common.c.

1156 {
1157  zhead_t *z, *next;
1158 
1159  for (z=z_chain.next ; z != &z_chain ; z=next)
1160  {
1161  next = z->next;
1162  if (z->tag == tag)
1163  Z_Free ((void *)(z+1));
1164  }
1165 }

Referenced by SV_InitGameProgs().

◆ Z_Malloc()

◆ Z_Stats_f()

void Z_Stats_f ( void  )

Definition at line 1145 of file common.c.

1146 {
1147  Com_Printf ("%i bytes in %i blocks\n", z_bytes, z_count);
1148 }

Referenced by Qcommon_Init().

◆ Z_TagMalloc()

void* Z_TagMalloc ( int  size,
int  tag 
)

Definition at line 1172 of file common.c.

1173 {
1174  zhead_t *z;
1175 
1176  size = size + sizeof(zhead_t);
1177  z = malloc(size);
1178  if (!z)
1179  Com_Error (ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes",size);
1180  memset (z, 0, size);
1181  z_count++;
1182  z_bytes += size;
1183  z->magic = Z_MAGIC;
1184  z->tag = tag;
1185  z->size = size;
1186 
1187  z->next = z_chain.next;
1188  z->prev = &z_chain;
1189  z_chain.next->prev = z;
1190  z_chain.next = z;
1191 
1192  return (void *)(z+1);
1193 }

Referenced by SV_InitGameProgs(), and Z_Malloc().

Variable Documentation

◆ abortframe

jmp_buf abortframe

Definition at line 35 of file common.c.

Referenced by Com_Error(), Qcommon_Frame(), and Qcommon_Init().

◆ bytedirs

Initial value:
=
{
}

Definition at line 281 of file common.c.

Referenced by CL_BfgParticles(), CL_FlyParticles(), COM_BlockSequenceCheckByte(), MSG_ReadDir(), and MSG_WriteDir().

◆ chktbl

byte chktbl[1024]
static

Definition at line 1264 of file common.c.

Referenced by COM_BlockSequenceCRCByte().

◆ com_argc

int com_argc

Definition at line 30 of file common.c.

Referenced by COM_AddParm(), COM_Argc(), COM_Argv(), COM_CheckParm(), COM_ClearArgv(), and COM_InitArgv().

◆ com_argv

char* com_argv[MAX_NUM_ARGVS+1]

Definition at line 31 of file common.c.

Referenced by COM_AddParm(), COM_Argv(), COM_CheckParm(), COM_ClearArgv(), and COM_InitArgv().

◆ dedicated

◆ developer

cvar_t* developer

Definition at line 42 of file common.c.

Referenced by Com_DPrintf(), Qcommon_Init(), and SCR_BeginLoadingPlaque().

◆ fixedtime

cvar_t* fixedtime

Definition at line 44 of file common.c.

Referenced by Qcommon_Frame(), and Qcommon_Init().

◆ host_speeds

cvar_t* host_speeds

Definition at line 40 of file common.c.

Referenced by CL_Frame(), Qcommon_Frame(), Qcommon_Init(), and SV_RunGameFrame().

◆ log_stats

cvar_t* log_stats

Definition at line 41 of file common.c.

Referenced by CL_Frame(), Qcommon_Frame(), Qcommon_Init(), and V_RenderView().

◆ log_stats_file

FILE* log_stats_file

Definition at line 38 of file common.c.

Referenced by CL_Frame(), Qcommon_Frame(), and V_RenderView().

◆ logfile

FILE* logfile

Definition at line 49 of file common.c.

Referenced by Com_Error(), Com_Printf(), and Com_Quit().

◆ logfile_active

cvar_t* logfile_active

Definition at line 45 of file common.c.

Referenced by Com_Printf(), and Qcommon_Init().

◆ rd_buffer

char* rd_buffer
static

Definition at line 68 of file common.c.

Referenced by Com_BeginRedirect(), Com_EndRedirect(), and Com_Printf().

◆ rd_buffersize

int rd_buffersize
static

Definition at line 69 of file common.c.

Referenced by Com_BeginRedirect(), Com_EndRedirect(), and Com_Printf().

◆ rd_flush

void(* rd_flush) (int target, char *buffer)
static

Definition at line 70 of file common.c.

Referenced by Com_BeginRedirect(), Com_EndRedirect(), and Com_Printf().

◆ rd_target

int rd_target
static

Definition at line 67 of file common.c.

Referenced by Com_BeginRedirect(), Com_EndRedirect(), and Com_Printf().

◆ realtime

int realtime

Definition at line 33 of file common.c.

◆ server_state

int server_state

Definition at line 51 of file common.c.

Referenced by Com_ServerState(), and Com_SetServerState().

◆ showtrace

cvar_t* showtrace

Definition at line 46 of file common.c.

Referenced by Qcommon_Frame(), and Qcommon_Init().

◆ shutdown_game

qboolean shutdown_game = false
static

Definition at line 36 of file common.c.

Referenced by Com_Error(), and Qcommon_Frame().

◆ time_after_game

int time_after_game

Definition at line 55 of file common.c.

Referenced by Qcommon_Frame(), SV_Frame(), and SV_RunGameFrame().

◆ time_after_ref

int time_after_ref

Definition at line 57 of file common.c.

Referenced by CL_Frame(), and Qcommon_Frame().

◆ time_before_game

int time_before_game

Definition at line 54 of file common.c.

Referenced by Qcommon_Frame(), SV_Frame(), and SV_RunGameFrame().

◆ time_before_ref

int time_before_ref

Definition at line 56 of file common.c.

Referenced by CL_Frame(), and Qcommon_Frame().

◆ timescale

cvar_t* timescale

Definition at line 43 of file common.c.

Referenced by Qcommon_Frame(), and Qcommon_Init().

◆ z_bytes

int z_bytes

Definition at line 1115 of file common.c.

Referenced by Z_Free(), Z_Stats_f(), and Z_TagMalloc().

◆ z_chain

zhead_t z_chain

Definition at line 1114 of file common.c.

Referenced by Qcommon_Init(), Z_FreeTags(), and Z_TagMalloc().

◆ z_count

int z_count

Definition at line 1115 of file common.c.

Referenced by Z_Free(), Z_Stats_f(), and Z_TagMalloc().

K_KP_ENTER
#define K_KP_ENTER
Definition: keys.h:70
shutdown_game
static qboolean shutdown_game
Definition: common.c:36
entity_state_s::old_origin
vec3_t old_origin
Definition: q_shared.h:1151
CL_Drop
void CL_Drop(void)
Definition: cl_main.c:399
sv
server_t sv
Definition: sv_init.c:24
usercmd_s::lightlevel
byte lightlevel
Definition: q_shared.h:524
K_INS
#define K_INS
Definition: keys.h:53
SCR_EndLoadingPlaque
void SCR_EndLoadingPlaque(void)
Definition: cl_scrn.c:590
Z_MAGIC
#define Z_MAGIC
Definition: common.c:1103
usercmd_s::impulse
byte impulse
Definition: q_shared.h:523
dedicated
cvar_t * dedicated
Definition: common.c:47
value
GLfloat value
Definition: qgl_win.c:63
MAX_QPATH
#define MAX_QPATH
Definition: q_shared.h:80
entity_state_s::modelindex4
int modelindex4
Definition: q_shared.h:1153
entity_state_s::solid
int solid
Definition: q_shared.h:1158
K_KP_RIGHTARROW
#define K_KP_RIGHTARROW
Definition: keys.h:66
Z_TagMalloc
void * Z_TagMalloc(int size, int tag)
Definition: common.c:1172
U_ANGLE2
#define U_ANGLE2
Definition: qcommon.h:317
U_MOREBITS3
#define U_MOREBITS3
Definition: qcommon.h:341
z_chain
zhead_t z_chain
Definition: common.c:1114
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
U_ANGLE1
#define U_ANGLE1
Definition: qcommon.h:327
Swap_Init
void Swap_Init(void)
Definition: q_shared.c:1011
menubound
qboolean menubound[256]
Definition: keys.c:42
entity_state_s::frame
int frame
Definition: q_shared.h:1154
K_PGUP
#define K_PGUP
Definition: keys.h:56
log_stats
cvar_t * log_stats
Definition: common.c:41
CVAR_NOSET
#define CVAR_NOSET
Definition: q_shared.h:319
CM_SIDE
#define CM_SIDE
Definition: qcommon.h:293
chktbl
static byte chktbl[1024]
Definition: common.c:1264
client_static_t::disable_screen
float disable_screen
Definition: client.h:212
showtrace
cvar_t * showtrace
Definition: common.c:46
entity_state_s::renderfx
int renderfx
Definition: q_shared.h:1157
MSG_ReadShort
int MSG_ReadShort(sizebuf_t *msg_read)
Definition: common.c:716
cvar_s::modified
qboolean modified
Definition: q_shared.h:330
U_ORIGIN1
#define U_ORIGIN1
Definition: qcommon.h:315
game_export_t::Shutdown
void(* Shutdown)(void)
Definition: game.h:189
entity_state_s::origin
vec3_t origin
Definition: q_shared.h:1149
K_BACKSPACE
#define K_BACKSPACE
Definition: keys.h:32
Cbuf_Init
void Cbuf_Init(void)
Definition: cmd.c:78
sizebuf_s::overflowed
qboolean overflowed
Definition: qcommon.h:95
K_KP_END
#define K_KP_END
Definition: keys.h:67
U_RENDERFX8
#define U_RENDERFX8
Definition: qcommon.h:329
Sys_Error
void Sys_Error(char *error,...)
Definition: sys_win.c:68
sizebuf_s::readcount
int readcount
Definition: qcommon.h:99
U_OLDORIGIN
#define U_OLDORIGIN
Definition: qcommon.h:344
qboolean
qboolean
Definition: q_shared.h:63
x
GLint GLenum GLint x
Definition: qgl_win.c:116
K_ENTER
#define K_ENTER
Definition: keys.h:26
z
GLdouble GLdouble z
Definition: qgl_win.c:283
K_KP_MINUS
#define K_KP_MINUS
Definition: keys.h:74
z_count
int z_count
Definition: common.c:1115
i
int i
Definition: q_shared.c:305
MSG_WriteCoord
void MSG_WriteCoord(sizebuf_t *sb, float f)
Definition: common.c:364
host_speeds
cvar_t * host_speeds
Definition: common.c:40
MAX_NUM_ARGVS
#define MAX_NUM_ARGVS
Definition: common.c:27
U_MODEL
#define U_MODEL
Definition: qcommon.h:328
COM_InitArgv
void COM_InitArgv(int argc, char **argv)
Definition: common.c:993
buffer
GLenum GLfloat * buffer
Definition: qgl_win.c:151
entity_state_s::event
int event
Definition: q_shared.h:1162
MSG_WriteLong
void MSG_WriteLong(sizebuf_t *sb, int c)
Definition: common.c:330
MAX_TOKEN_CHARS
#define MAX_TOKEN_CHARS
Definition: q_shared.h:78
VERSION
#define VERSION
Definition: qcommon.h:26
argv
char * argv[MAX_NUM_ARGVS]
Definition: sys_win.c:56
time_before_game
int time_before_game
Definition: common.c:54
zhead_s::prev
struct zhead_s * prev
Definition: common.c:1108
argc
int argc
Definition: sys_win.c:55
Sys_Init
void Sys_Init(void)
Definition: sys_win.c:238
Sys_UnloadGame
void Sys_UnloadGame(void)
Definition: sys_win.c:488
usercmd_s::forwardmove
short forwardmove
Definition: q_shared.h:522
sizebuf_s::data
byte * data
Definition: qcommon.h:96
Cvar_Get
cvar_t * Cvar_Get(char *var_name, char *var_value, int flags)
Definition: cvar.c:127
K_KP_PLUS
#define K_KP_PLUS
Definition: keys.h:75
consolekeys
qboolean consolekeys[256]
Definition: keys.c:41
U_MODEL2
#define U_MODEL2
Definition: qcommon.h:338
entity_state_s::modelindex3
int modelindex3
Definition: q_shared.h:1153
SZ_Write
void SZ_Write(sizebuf_t *buf, void *data, int length)
Definition: common.c:921
K_HOME
#define K_HOME
Definition: keys.h:57
SZ_Clear
void SZ_Clear(sizebuf_t *buf)
Definition: common.c:892
entity_state_s::effects
unsigned int effects
Definition: q_shared.h:1156
CVAR_SERVERINFO
#define CVAR_SERVERINFO
Definition: q_shared.h:318
K_MWHEELDOWN
#define K_MWHEELDOWN
Definition: keys.h:131
Com_Error_f
void Com_Error_f(void)
Definition: common.c:1396
CL_Init
void CL_Init(void)
Definition: cl_main.c:1785
Netchan_Init
void Netchan_Init(void)
Definition: net_chan.c:91
entity_state_s::sound
int sound
Definition: q_shared.h:1161
Sys_ConsoleInput
char * Sys_ConsoleInput(void)
Definition: sys_win.c:289
Cmd_Argv
char * Cmd_Argv(int arg)
Definition: cmd.c:517
U_ANGLE3
#define U_ANGLE3
Definition: qcommon.h:318
va
char * va(char *format,...)
Definition: q_shared.c:1050
msg
cvar_t * msg
Definition: cl_main.c:83
sizebuf_s::maxsize
int maxsize
Definition: qcommon.h:97
U_SOUND
#define U_SOUND
Definition: qcommon.h:346
RF_BEAM
#define RF_BEAM
Definition: q_shared.h:606
K_KP_5
#define K_KP_5
Definition: keys.h:65
Key_Init
void Key_Init(void)
Definition: keys.c:647
CM_ANGLE1
#define CM_ANGLE1
Definition: qcommon.h:289
bytedirs
vec3_t bytedirs[NUMVERTEXNORMALS]
Definition: common.c:281
keyshift
int keyshift[256]
Definition: keys.c:43
K_KP_SLASH
#define K_KP_SLASH
Definition: keys.h:73
usercmd_s::sidemove
short sidemove
Definition: q_shared.h:522
LittleFloat
float LittleFloat(float l)
Definition: q_shared.c:950
U_EVENT
#define U_EVENT
Definition: qcommon.h:320
z_bytes
int z_bytes
Definition: common.c:1115
K_KP_INS
#define K_KP_INS
Definition: keys.h:71
LittleLong
int LittleLong(int l)
Definition: q_shared.c:948
K_END
#define K_END
Definition: keys.h:58
U_EFFECTS16
#define U_EFFECTS16
Definition: qcommon.h:337
CRC_Block
unsigned short CRC_Block(byte *start, int count)
Definition: crc.c:82
U_ORIGIN2
#define U_ORIGIN2
Definition: qcommon.h:316
com_argc
int com_argc
Definition: common.c:30
CL_Shutdown
void CL_Shutdown(void)
Definition: cl_main.c:1831
U_EFFECTS8
#define U_EFFECTS8
Definition: qcommon.h:330
U_MOREBITS1
#define U_MOREBITS1
Definition: qcommon.h:322
Sys_ConsoleOutput
void Sys_ConsoleOutput(char *string)
Definition: sys_win.c:369
U_MODEL4
#define U_MODEL4
Definition: qcommon.h:340
zhead_s::next
struct zhead_s * next
Definition: common.c:1108
Cmd_AddCommand
void Cmd_AddCommand(char *cmd_name, xcommand_t function)
Definition: cmd.c:691
Key_Bindlist_f
void Key_Bindlist_f(void)
Definition: keys.c:632
K_LEFTARROW
#define K_LEFTARROW
Definition: keys.h:35
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:162
Sys_Quit
void Sys_Quit(void)
Definition: sys_win.c:91
U_FRAME16
#define U_FRAME16
Definition: qcommon.h:335
Cbuf_AddText
void Cbuf_AddText(char *text)
Definition: cmd.c:90
cvar_s::value
float value
Definition: q_shared.h:331
MSG_ReadByte
int MSG_ReadByte(sizebuf_t *msg_read)
Definition: common.c:703
time_before_ref
int time_before_ref
Definition: common.c:56
Con_Print
void Con_Print(char *text)
Definition: console.c:352
U_SKIN8
#define U_SKIN8
Definition: qcommon.h:334
Key_Unbind_f
void Key_Unbind_f(void)
Definition: keys.c:534
K_DOWNARROW
#define K_DOWNARROW
Definition: keys.h:34
K_KP_DEL
#define K_KP_DEL
Definition: keys.h:72
K_KP_UPARROW
#define K_KP_UPARROW
Definition: keys.h:62
K_KP_HOME
#define K_KP_HOME
Definition: keys.h:61
U_RENDERFX16
#define U_RENDERFX16
Definition: qcommon.h:336
CM_FORWARD
#define CM_FORWARD
Definition: qcommon.h:292
timescale
cvar_t * timescale
Definition: common.c:43
U_MOREBITS2
#define U_MOREBITS2
Definition: qcommon.h:331
entity_state_s::number
int number
Definition: q_shared.h:1147
NULL
#define NULL
Definition: q_shared.h:67
FS_InitFilesystem
void FS_InitFilesystem(void)
Definition: files.c:848
zhead_t
struct zhead_s zhead_t
MSG_WriteShort
void MSG_WriteShort(sizebuf_t *sb, int c)
Definition: common.c:316
MSG_WriteByte
void MSG_WriteByte(sizebuf_t *sb, int c)
Definition: common.c:303
CM_BUTTONS
#define CM_BUTTONS
Definition: qcommon.h:295
Com_Error
void Com_Error(int code, char *fmt,...)
Definition: common.c:181
SV_Init
void SV_Init(void)
Definition: sv_main.c:948
rd_target
static int rd_target
Definition: common.c:67
Con_ClearNotify
void Con_ClearNotify(void)
Definition: console.c:208
Z_Malloc
void * Z_Malloc(int size)
Definition: common.c:1200
SZ_GetSpace
void * SZ_GetSpace(sizebuf_t *buf, int length)
Definition: common.c:898
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:744
usercmd_s::upmove
short upmove
Definition: q_shared.h:522
c_brush_traces
int c_brush_traces
Definition: cmodel.c:119
name
cvar_t * name
Definition: cl_main.c:79
MAX_EDICTS
#define MAX_EDICTS
Definition: q_shared.h:87
K_RIGHTARROW
#define K_RIGHTARROW
Definition: keys.h:36
rd_buffersize
static int rd_buffersize
Definition: common.c:69
ERR_FATAL
#define ERR_FATAL
Definition: qcommon.h:743
key_linepos
int key_linepos
Definition: keys.c:32
Cmd_Init
void Cmd_Init(void)
Definition: cmd.c:881
Z_Stats_f
void Z_Stats_f(void)
Definition: common.c:1145
s
static fixed16_t s
Definition: r_scan.c:30
SV_Shutdown
void SV_Shutdown(char *finalmsg, qboolean reconnect)
Definition: sv_main.c:1035
NET_Init
void NET_Init(void)
Definition: net_wins.c:767
entity_state_s::skinnum
int skinnum
Definition: q_shared.h:1155
logfile
FILE * logfile
Definition: common.c:49
U_SKIN16
#define U_SKIN16
Definition: qcommon.h:345
CM_ANGLE2
#define CM_ANGLE2
Definition: qcommon.h:290
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
logfile_active
cvar_t * logfile_active
Definition: common.c:45
Com_BlockChecksum
unsigned Com_BlockChecksum(void *buffer, int length)
Definition: md4.c:213
Cvar_Init
void Cvar_Init(void)
Definition: cvar.c:522
abortframe
jmp_buf abortframe
Definition: common.c:35
Key_Unbindall_f
void Key_Unbindall_f(void)
Definition: keys.c:554
ge
game_export_t * ge
Definition: sv_game.c:24
Z_Free
void Z_Free(void *ptr)
Definition: common.c:1122
MSG_WriteAngle
void MSG_WriteAngle(sizebuf_t *sb, float f)
Definition: common.c:376
CM_UP
#define CM_UP
Definition: qcommon.h:294
BUILDSTRING
#define BUILDSTRING
Definition: qcommon.h:85
SV_Frame
void SV_Frame(int msec)
Definition: sv_main.c:760
FS_Gamedir
char * FS_Gamedir(void)
Definition: files.c:559
SHORT2ANGLE
#define SHORT2ANGLE(x)
Definition: q_shared.h:1093
time_after_game
int time_after_game
Definition: common.c:55
rd_buffer
static char * rd_buffer
Definition: common.c:68
usercmd_s::angles
short angles[3]
Definition: q_shared.h:521
Cbuf_Execute
void Cbuf_Execute(void)
Definition: cmd.c:194
log_stats_file
FILE * log_stats_file
Definition: common.c:38
sizebuf_s::allowoverflow
qboolean allowoverflow
Definition: qcommon.h:94
Com_Quit
void Com_Quit(void)
Definition: common.c:235
Key_Bind_f
void Key_Bind_f(void)
Definition: keys.c:569
entity_state_s::modelindex
int modelindex
Definition: q_shared.h:1152
entity_state_s::modelindex2
int modelindex2
Definition: q_shared.h:1153
time_after_ref
int time_after_ref
Definition: common.c:57
sizebuf_s::cursize
int cursize
Definition: qcommon.h:98
key_lines
char key_lines[128][MAXCMDLINE]
Definition: keys.c:31
CM_ANGLE3
#define CM_ANGLE3
Definition: qcommon.h:291
U_FRAME8
#define U_FRAME8
Definition: qcommon.h:319
usercmd_s::msec
byte msec
Definition: q_shared.h:519
Cbuf_AddLateCommands
qboolean Cbuf_AddLateCommands(void)
Definition: cmd.c:296
usercmd_s::buttons
byte buttons
Definition: q_shared.h:520
K_KP_PGUP
#define K_KP_PGUP
Definition: keys.h:63
K_KP_DOWNARROW
#define K_KP_DOWNARROW
Definition: keys.h:68
rd_flush
static void(* rd_flush)(int target, char *buffer)
Definition: common.c:70
K_ESCAPE
#define K_ESCAPE
Definition: keys.h:27
K_PGDN
#define K_PGDN
Definition: keys.h:55
U_NUMBER16
#define U_NUMBER16
Definition: qcommon.h:325
K_TAB
#define K_TAB
Definition: keys.h:25
c_pointcontents
int c_pointcontents
Definition: cmodel.c:118
K_MWHEELUP
#define K_MWHEELUP
Definition: keys.h:132
Cbuf_AddEarlyCommands
void Cbuf_AddEarlyCommands(qboolean clear)
Definition: cmd.c:263
Com_Printf
void Com_Printf(char *fmt,...)
Definition: common.c:104
ANGLE2SHORT
#define ANGLE2SHORT(x)
Definition: q_shared.h:1092
K_SHIFT
#define K_SHIFT
Definition: keys.h:40
developer
cvar_t * developer
Definition: common.c:42
Sys_Milliseconds
int Sys_Milliseconds(void)
Definition: q_shwin.c:120
SV_ShutdownGameProgs
void SV_ShutdownGameProgs(void)
Definition: sv_game.c:305
fixedtime
cvar_t * fixedtime
Definition: common.c:44
cls
client_static_t cls
Definition: cl_main.c:90
NUMVERTEXNORMALS
#define NUMVERTEXNORMALS
Definition: qcommon.h:792
K_KP_PGDN
#define K_KP_PGDN
Definition: keys.h:69
server_state
int server_state
Definition: common.c:51
MAXPRINTMSG
#define MAXPRINTMSG
Definition: common.c:25
K_UPARROW
#define K_UPARROW
Definition: keys.h:33
entity_state_s::angles
vec3_t angles
Definition: q_shared.h:1150
cl
client_state_t cl
Definition: cl_main.c:91
MSG_ReadChar
int MSG_ReadChar(sizebuf_t *msg_read)
Definition: common.c:690
U_ORIGIN3
#define U_ORIGIN3
Definition: qcommon.h:326
CPUSTRING
#define CPUSTRING
Definition: qcommon.h:86
CM_IMPULSE
#define CM_IMPULSE
Definition: qcommon.h:296
U_SOLID
#define U_SOLID
Definition: qcommon.h:347
ERR_DISCONNECT
#define ERR_DISCONNECT
Definition: q_shared.h:106
U_MODEL3
#define U_MODEL3
Definition: qcommon.h:339
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1223
K_KP_LEFTARROW
#define K_KP_LEFTARROW
Definition: keys.h:64
K_F1
#define K_F1
Definition: keys.h:41
zhead_s
Definition: common.c:1106
CL_Frame
void CL_Frame(int msec)
Definition: cl_main.c:1681
c_traces
int c_traces
Definition: cmodel.c:119
com_argv
char * com_argv[MAX_NUM_ARGVS+1]
Definition: common.c:31
count
GLint GLsizei count
Definition: qgl_win.c:128