icculus quake2 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   4096
 
#define MAX_NUM_ARGVS   50
 
#define Z_MAGIC   0x1d1d
 

Typedefs

typedef struct zhead_s zhead_t
 

Functions

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_MDPrintf (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
 
FILE * log_stats_file
 
cvar_thost_speeds
 
cvar_tlog_stats
 
cvar_tdeveloper
 
cvar_tmodder
 
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 26 of file common.c.

◆ MAXPRINTMSG

#define MAXPRINTMSG   4096

Definition at line 24 of file common.c.

◆ Z_MAGIC

#define Z_MAGIC   0x1d1d

Definition at line 1122 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 1035 of file common.c.

1036 {
1037  if (com_argc == MAX_NUM_ARGVS)
1038  Com_Error (ERR_FATAL, "COM_AddParm: MAX_NUM)ARGS");
1039  com_argv[com_argc++] = parm;
1040 }

◆ COM_Argc()

int COM_Argc ( void  )

Definition at line 987 of file common.c.

988 {
989  return com_argc;
990 }

Referenced by Cbuf_AddEarlyCommands(), and Cbuf_AddLateCommands().

◆ COM_Argv()

char* COM_Argv ( int  arg)

Definition at line 992 of file common.c.

993 {
994  if (arg < 0 || arg >= com_argc || !com_argv[arg])
995  return "";
996  return com_argv[arg];
997 }

Referenced by Cbuf_AddEarlyCommands(), and Cbuf_AddLateCommands().

◆ Com_BeginRedirect()

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

Definition at line 72 of file common.c.

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

Referenced by SVC_RemoteCommand(), and SVC_Status().

◆ COM_BlockSequenceCheckByte()

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

Definition at line 1243 of file common.c.

1244 {
1245  Sys_Error("COM_BlockSequenceCheckByte called\n");
1246 
1247 #if 0
1248  int checksum;
1249  byte buf[68];
1250  byte *p;
1251  float temp;
1252  byte c;
1253 
1254  temp = bytedirs[(sequence/3) % NUMVERTEXNORMALS][sequence % 3];
1255  temp = LittleFloat(temp);
1256  p = ((byte *)&temp);
1257 
1258  if (length > 60)
1259  length = 60;
1260  memcpy (buf, base, length);
1261 
1262  buf[length] = (sequence & 0xff) ^ p[0];
1263  buf[length+1] = p[1];
1264  buf[length+2] = ((sequence>>8) & 0xff) ^ p[2];
1265  buf[length+3] = p[3];
1266 
1267  temp = bytedirs[((sequence+challenge)/3) % NUMVERTEXNORMALS][(sequence+challenge) % 3];
1268  temp = LittleFloat(temp);
1269  p = ((byte *)&temp);
1270 
1271  buf[length+4] = (sequence & 0xff) ^ p[3];
1272  buf[length+5] = (challenge & 0xff) ^ p[2];
1273  buf[length+6] = ((sequence>>8) & 0xff) ^ p[1];
1274  buf[length+7] = ((challenge >> 7) & 0xff) ^ p[0];
1275 
1276  length += 8;
1277 
1278  checksum = LittleLong(Com_BlockChecksum (buf, length));
1279 
1280  checksum &= 0xff;
1281 
1282  return checksum;
1283 #endif
1284  return 0;
1285 }

◆ COM_BlockSequenceCRCByte()

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

Definition at line 1361 of file common.c.

1362 {
1363  int n;
1364  byte *p;
1365  int x;
1366  byte chkb[60 + 4];
1367  unsigned short crc;
1368 
1369 
1370  if (sequence < 0)
1371  Sys_Error("sequence < 0, this shouldn't happen\n");
1372 
1373  p = chktbl + (sequence % (sizeof(chktbl) - 4));
1374 
1375  if (length > 60)
1376  length = 60;
1377  memcpy (chkb, base, length);
1378 
1379  chkb[length] = p[0];
1380  chkb[length+1] = p[1];
1381  chkb[length+2] = p[2];
1382  chkb[length+3] = p[3];
1383 
1384  length += 4;
1385 
1386  crc = CRC_Block(chkb, length);
1387 
1388  for (x=0, n=0; n<length; n++)
1389  x += chkb[n];
1390 
1391  crc = (crc ^ x) & 0xff;
1392 
1393  return crc;
1394 }

Referenced by CL_SendCmd(), and SV_ExecuteClientMessage().

◆ COM_CheckParm()

int COM_CheckParm ( char *  parm)

Definition at line 974 of file common.c.

975 {
976  int i;
977 
978  for (i=1 ; i<com_argc ; i++)
979  {
980  if (!strcmp (parm,com_argv[i]))
981  return i;
982  }
983 
984  return 0;
985 }

◆ COM_ClearArgv()

void COM_ClearArgv ( int  arg)

Definition at line 999 of file common.c.

1000 {
1001  if (arg < 0 || arg >= com_argc || !com_argv[arg])
1002  return;
1003  com_argv[arg] = "";
1004 }

Referenced by Cbuf_AddEarlyCommands().

◆ Com_DPrintf()

◆ Com_EndRedirect()

void Com_EndRedirect ( void  )

Definition at line 84 of file common.c.

85 {
87 
88  rd_target = 0;
89  rd_buffer = NULL;
90  rd_buffersize = 0;
91  rd_flush = NULL;
92 }

Referenced by SVC_RemoteCommand(), and SVC_Status().

◆ Com_Error()

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

Definition at line 203 of file common.c.

204 {
205  va_list argptr;
206  static char msg[MAXPRINTMSG];
207  static qboolean recursive;
208 
209  if (recursive)
210  Sys_Error ("recursive error after: %s", msg);
211  recursive = true;
212 
213  va_start (argptr,fmt);
214  vsnprintf (msg,MAXPRINTMSG,fmt,argptr);
215  va_end (argptr);
216 
217  if (code == ERR_DISCONNECT)
218  {
219  CL_Drop ();
220  recursive = false;
221  longjmp (abortframe, -1);
222  }
223  else if (code == ERR_DROP)
224  {
225  Com_Printf ("********************\nERROR: %s\n********************\n", msg);
226  SV_Shutdown (va("Server crashed: %s\n", msg), false);
227  CL_Drop ();
228  recursive = false;
229  longjmp (abortframe, -1);
230  }
231  else
232  {
233  SV_Shutdown (va("Server fatal crashed: %s\n", msg), false);
234  CL_Shutdown ();
235  }
236 
237  if (logfile)
238  {
239  fclose (logfile);
240  logfile = NULL;
241  }
242 
243  Sys_Error ("%s", msg);
244 }

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 1419 of file common.c.

1420 {
1421  Com_Error (ERR_FATAL, "%s", Cmd_Argv(1));
1422 }

Referenced by Qcommon_Init().

◆ COM_InitArgv()

void COM_InitArgv ( int  argc,
char **  argv 
)

Definition at line 1012 of file common.c.

1013 {
1014  int i;
1015 
1016  if (argc > MAX_NUM_ARGVS)
1017  Com_Error (ERR_FATAL, "argc > MAX_NUM_ARGVS");
1018  com_argc = argc;
1019  for (i=0 ; i<argc ; i++)
1020  {
1021  if (!argv[i] || strlen(argv[i]) >= MAX_TOKEN_CHARS )
1022  com_argv[i] = "";
1023  else
1024  com_argv[i] = argv[i];
1025  }
1026 }

Referenced by Qcommon_Init().

◆ Com_MDPrintf()

void Com_MDPrintf ( char *  fmt,
  ... 
)

Definition at line 179 of file common.c.

180 {
181  va_list argptr;
182  char msg[MAXPRINTMSG];
183 
184  if((!modder || !modder->value) && (!developer || !developer->value))
185  return;
186 
187  va_start (argptr,fmt);
188  vsnprintf (msg,MAXPRINTMSG,fmt,argptr);
189  va_end (argptr);
190 
191  Com_Printf("%s", msg);
192 }

◆ Com_Printf()

void Com_Printf ( char *  fmt,
  ... 
)

Definition at line 102 of file common.c.

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

Referenced by Cbuf_AddText(), CDAudio_Play2(), CDAudio_RandomPlay(), 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_MDPrintf(), Com_sprintf(), Con_Dump_f(), Con_Init(), Cvar_Command(), Cvar_Get(), Cvar_List_f(), Cvar_Set2(), Cvar_Set_f(), DS_CreateBuffers(), DumpChunks(), FS_AddHomeAsGameDirectory(), 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(), 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 255 of file common.c.

256 {
257  SV_Shutdown ("Server quit\n", false);
258  CL_Shutdown ();
259 
260  if (logfile)
261  {
262  fclose (logfile);
263  logfile = NULL;
264  }
265 
266  Sys_Quit ();
267 }

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

◆ Com_ServerState()

◆ Com_SetServerState()

void Com_SetServerState ( int  state)

Definition at line 285 of file common.c.

286 {
287  server_state = state;
288 }

Referenced by SV_Shutdown(), and SV_SpawnServer().

◆ CopyString()

char* CopyString ( char *  in)

Definition at line 1057 of file common.c.

1058 {
1059  char *out;
1060 
1061  out = Z_Malloc (strlen(in)+1);
1062  strcpy (out, in);
1063  return out;
1064 }

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 1068 of file common.c.

1069 {
1070  char key[512];
1071  char value[512];
1072  char *o;
1073  int l;
1074 
1075  if (*s == '\\')
1076  s++;
1077  while (*s)
1078  {
1079  o = key;
1080  while (*s && *s != '\\')
1081  *o++ = *s++;
1082 
1083  l = o - key;
1084  if (l < 20)
1085  {
1086  memset (o, ' ', 20-l);
1087  key[20] = 0;
1088  }
1089  else
1090  *o = 0;
1091  Com_Printf ("%s", key);
1092 
1093  if (!*s)
1094  {
1095  Com_Printf ("MISSING VALUE\n");
1096  return;
1097  }
1098 
1099  o = value;
1100  s++;
1101  while (*s && *s != '\\')
1102  *o++ = *s++;
1103  *o = 0;
1104 
1105  if (*s)
1106  s++;
1107  Com_Printf ("%s\n", value);
1108  }
1109 }

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

◆ Key_Init()

void Key_Init ( void  )

Definition at line 650 of file keys.c.

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

Referenced by Qcommon_Init().

◆ memsearch()

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

just for debugging

Definition at line 1046 of file common.c.

1047 {
1048  int i;
1049 
1050  for (i=0 ; i<count ; i++)
1051  if (start[i] == search)
1052  return i;
1053  return -1;
1054 }

◆ MSG_BeginReading()

void MSG_BeginReading ( sizebuf_t msg)

Definition at line 703 of file common.c.

704 {
705  msg->readcount = 0;
706 }

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

◆ MSG_ReadAngle()

float MSG_ReadAngle ( sizebuf_t msg_read)

Definition at line 844 of file common.c.

845 {
846  return MSG_ReadChar(msg_read) * (360.0/256);
847 }

Referenced by CL_ParseDelta().

◆ MSG_ReadAngle16()

float MSG_ReadAngle16 ( sizebuf_t msg_read)

Definition at line 849 of file common.c.

850 {
851  return SHORT2ANGLE(MSG_ReadShort(msg_read));
852 }

Referenced by CL_ParsePlayerstate().

◆ MSG_ReadByte()

int MSG_ReadByte ( sizebuf_t msg_read)

Definition at line 722 of file common.c.

723 {
724  int c;
725 
726  if (msg_read->readcount+1 > msg_read->cursize)
727  c = -1;
728  else
729  c = (unsigned char)msg_read->data[msg_read->readcount];
730  msg_read->readcount++;
731 
732  return c;
733 }

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 709 of file common.c.

710 {
711  int c;
712 
713  if (msg_read->readcount+1 > msg_read->cursize)
714  c = -1;
715  else
716  c = (signed char)msg_read->data[msg_read->readcount];
717  msg_read->readcount++;
718 
719  return c;
720 }

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

◆ MSG_ReadCoord()

float MSG_ReadCoord ( sizebuf_t msg_read)

Definition at line 832 of file common.c.

833 {
834  return MSG_ReadShort(msg_read) * (1.0/8);
835 }

Referenced by CL_ParseDelta().

◆ MSG_ReadData()

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

Definition at line 893 of file common.c.

894 {
895  int i;
896 
897  for (i=0 ; i<len ; i++)
898  ((byte *)data)[i] = MSG_ReadByte (msg_read);
899 }

Referenced by CL_ParseFrame().

◆ MSG_ReadDeltaUsercmd()

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

Definition at line 854 of file common.c.

855 {
856  int bits;
857 
858  memcpy (move, from, sizeof(*move));
859 
860  bits = MSG_ReadByte (msg_read);
861 
862 // read current angles
863  if (bits & CM_ANGLE1)
864  move->angles[0] = MSG_ReadShort (msg_read);
865  if (bits & CM_ANGLE2)
866  move->angles[1] = MSG_ReadShort (msg_read);
867  if (bits & CM_ANGLE3)
868  move->angles[2] = MSG_ReadShort (msg_read);
869 
870 // read movement
871  if (bits & CM_FORWARD)
872  move->forwardmove = MSG_ReadShort (msg_read);
873  if (bits & CM_SIDE)
874  move->sidemove = MSG_ReadShort (msg_read);
875  if (bits & CM_UP)
876  move->upmove = MSG_ReadShort (msg_read);
877 
878 // read buttons
879  if (bits & CM_BUTTONS)
880  move->buttons = MSG_ReadByte (msg_read);
881 
882  if (bits & CM_IMPULSE)
883  move->impulse = MSG_ReadByte (msg_read);
884 
885 // read time to run command
886  move->msec = MSG_ReadByte (msg_read);
887 
888 // read the light level
889  move->lightlevel = MSG_ReadByte (msg_read);
890 }

Referenced by SV_ExecuteClientMessage().

◆ MSG_ReadDir()

void MSG_ReadDir ( sizebuf_t sb,
vec3_t  dir 
)

Definition at line 483 of file common.c.

484 {
485  int b;
486 
487  b = MSG_ReadByte (sb);
488  if (b >= NUMVERTEXNORMALS)
489  Com_Error (ERR_DROP, "MSF_ReadDir: out of range");
490  VectorCopy (bytedirs[b], dir);
491 }

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

◆ MSG_ReadFloat()

float MSG_ReadFloat ( sizebuf_t msg_read)

Definition at line 767 of file common.c.

768 {
769  union
770  {
771  byte b[4];
772  float f;
773  int l;
774  } dat;
775 
776  if (msg_read->readcount+4 > msg_read->cursize)
777  dat.f = -1;
778  else
779  {
780  dat.b[0] = msg_read->data[msg_read->readcount];
781  dat.b[1] = msg_read->data[msg_read->readcount+1];
782  dat.b[2] = msg_read->data[msg_read->readcount+2];
783  dat.b[3] = msg_read->data[msg_read->readcount+3];
784  }
785  msg_read->readcount += 4;
786 
787  dat.l = LittleLong (dat.l);
788 
789  return dat.f;
790 }

Referenced by CL_ParseTEnt().

◆ MSG_ReadLong()

int MSG_ReadLong ( sizebuf_t msg_read)

Definition at line 750 of file common.c.

751 {
752  int c;
753 
754  if (msg_read->readcount+4 > msg_read->cursize)
755  c = -1;
756  else
757  c = msg_read->data[msg_read->readcount]
758  + (msg_read->data[msg_read->readcount+1]<<8)
759  + (msg_read->data[msg_read->readcount+2]<<16)
760  + (msg_read->data[msg_read->readcount+3]<<24);
761 
762  msg_read->readcount += 4;
763 
764  return c;
765 }

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 837 of file common.c.

838 {
839  pos[0] = MSG_ReadShort(msg_read) * (1.0/8);
840  pos[1] = MSG_ReadShort(msg_read) * (1.0/8);
841  pos[2] = MSG_ReadShort(msg_read) * (1.0/8);
842 }

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 735 of file common.c.

736 {
737  int c;
738 
739  if (msg_read->readcount+2 > msg_read->cursize)
740  c = -1;
741  else
742  c = (short)(msg_read->data[msg_read->readcount]
743  + (msg_read->data[msg_read->readcount+1]<<8));
744 
745  msg_read->readcount += 2;
746 
747  return c;
748 }

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 792 of file common.c.

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

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 812 of file common.c.

813 {
814  static char string[2048];
815  int l,c;
816 
817  l = 0;
818  do
819  {
820  c = MSG_ReadChar (msg_read);
821  if (c == -1 || c == 0 || c == '\n')
822  break;
823  string[l] = c;
824  l++;
825  } while (l < sizeof(string)-1);
826 
827  string[l] = 0;
828 
829  return string;
830 }

Referenced by CL_ConnectionlessPacket(), and SV_ConnectionlessPacket().

◆ MSG_WriteAngle()

void MSG_WriteAngle ( sizebuf_t sb,
float  f 
)

Definition at line 395 of file common.c.

396 {
397  MSG_WriteByte (sb, (int)(f*256/360) & 255);
398 }

Referenced by MSG_WriteDeltaEntity(), and PF_WriteAngle().

◆ MSG_WriteAngle16()

void MSG_WriteAngle16 ( sizebuf_t sb,
float  f 
)

Definition at line 400 of file common.c.

401 {
402  MSG_WriteShort (sb, ANGLE2SHORT(f));
403 }

Referenced by SV_WritePlayerstateToClient().

◆ MSG_WriteByte()

◆ MSG_WriteChar()

void MSG_WriteChar ( sizebuf_t sb,
int  c 
)

Definition at line 309 of file common.c.

310 {
311  byte *buf;
312 
313 #ifdef PARANOID
314  if (c < -128 || c > 127)
315  Com_Error (ERR_FATAL, "MSG_WriteChar: range error");
316 #endif
317 
318  buf = SZ_GetSpace (sb, 1);
319  buf[0] = c;
320 }

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 383 of file common.c.

384 {
385  MSG_WriteShort (sb, (int)(f*8));
386 }

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 502 of file common.c.

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

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 406 of file common.c.

407 {
408  int bits;
409 
410 //
411 // send the movement message
412 //
413  bits = 0;
414  if (cmd->angles[0] != from->angles[0])
415  bits |= CM_ANGLE1;
416  if (cmd->angles[1] != from->angles[1])
417  bits |= CM_ANGLE2;
418  if (cmd->angles[2] != from->angles[2])
419  bits |= CM_ANGLE3;
420  if (cmd->forwardmove != from->forwardmove)
421  bits |= CM_FORWARD;
422  if (cmd->sidemove != from->sidemove)
423  bits |= CM_SIDE;
424  if (cmd->upmove != from->upmove)
425  bits |= CM_UP;
426  if (cmd->buttons != from->buttons)
427  bits |= CM_BUTTONS;
428  if (cmd->impulse != from->impulse)
429  bits |= CM_IMPULSE;
430 
431  MSG_WriteByte (buf, bits);
432 
433  if (bits & CM_ANGLE1)
434  MSG_WriteShort (buf, cmd->angles[0]);
435  if (bits & CM_ANGLE2)
436  MSG_WriteShort (buf, cmd->angles[1]);
437  if (bits & CM_ANGLE3)
438  MSG_WriteShort (buf, cmd->angles[2]);
439 
440  if (bits & CM_FORWARD)
441  MSG_WriteShort (buf, cmd->forwardmove);
442  if (bits & CM_SIDE)
443  MSG_WriteShort (buf, cmd->sidemove);
444  if (bits & CM_UP)
445  MSG_WriteShort (buf, cmd->upmove);
446 
447  if (bits & CM_BUTTONS)
448  MSG_WriteByte (buf, cmd->buttons);
449  if (bits & CM_IMPULSE)
450  MSG_WriteByte (buf, cmd->impulse);
451 
452  MSG_WriteByte (buf, cmd->msec);
453  MSG_WriteByte (buf, cmd->lightlevel);
454 }

Referenced by CL_SendCmd().

◆ MSG_WriteDir()

void MSG_WriteDir ( sizebuf_t sb,
vec3_t  dir 
)

Definition at line 457 of file common.c.

458 {
459  int i, best;
460  float d, bestd;
461 
462  if (!dir)
463  {
464  MSG_WriteByte (sb, 0);
465  return;
466  }
467 
468  bestd = 0;
469  best = 0;
470  for (i=0 ; i<NUMVERTEXNORMALS ; i++)
471  {
472  d = DotProduct (dir, bytedirs[i]);
473  if (d > bestd)
474  {
475  bestd = d;
476  best = i;
477  }
478  }
479  MSG_WriteByte (sb, best);
480 }

Referenced by PF_WriteDir().

◆ MSG_WriteFloat()

void MSG_WriteFloat ( sizebuf_t sb,
float  f 
)

Definition at line 360 of file common.c.

361 {
362  union
363  {
364  float f;
365  int l;
366  } dat;
367 
368 
369  dat.f = f;
370  dat.l = LittleLong (dat.l);
371 
372  SZ_Write (sb, &dat.l, 4);
373 }

Referenced by PF_WriteFloat().

◆ MSG_WriteLong()

void MSG_WriteLong ( sizebuf_t sb,
int  c 
)

Definition at line 349 of file common.c.

350 {
351  byte *buf;
352 
353  buf = SZ_GetSpace (sb, 4);
354  buf[0] = c&0xff;
355  buf[1] = (c>>8)&0xff;
356  buf[2] = (c>>16)&0xff;
357  buf[3] = c>>24;
358 }

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 388 of file common.c.

389 {
390  MSG_WriteShort (sb, (int)(pos[0]*8));
391  MSG_WriteShort (sb, (int)(pos[1]*8));
392  MSG_WriteShort (sb, (int)(pos[2]*8));
393 }

Referenced by PF_WritePos(), and SV_StartSound().

◆ MSG_WriteShort()

void MSG_WriteShort ( sizebuf_t sb,
int  c 
)

Definition at line 335 of file common.c.

336 {
337  byte *buf;
338 
339 #ifdef PARANOID
340  if (c < ((short)0x8000) || c > (short)0x7fff)
341  Com_Error (ERR_FATAL, "MSG_WriteShort: range error");
342 #endif
343 
344  buf = SZ_GetSpace (sb, 2);
345  buf[0] = c&0xff;
346  buf[1] = c>>8;
347 }

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 1524 of file common.c.

1525 {
1526  char *s;
1527  int time_before, time_between, time_after;
1528 
1529  if (setjmp (abortframe) )
1530  return; // an ERR_DROP was thrown
1531 
1532  if ( log_stats->modified )
1533  {
1534  log_stats->modified = false;
1535  if ( log_stats->value )
1536  {
1537  if ( log_stats_file )
1538  {
1539  fclose( log_stats_file );
1540  log_stats_file = 0;
1541  }
1542  log_stats_file = fopen( "stats.log", "w" );
1543  if ( log_stats_file )
1544  fprintf( log_stats_file, "entities,dlights,parts,frame time\n" );
1545  }
1546  else
1547  {
1548  if ( log_stats_file )
1549  {
1550  fclose( log_stats_file );
1551  log_stats_file = 0;
1552  }
1553  }
1554  }
1555 
1556  if (fixedtime->value)
1557  msec = fixedtime->value;
1558  else if (timescale->value)
1559  {
1560  msec *= timescale->value;
1561  if (msec < 1)
1562  msec = 1;
1563  }
1564 
1565  if (showtrace->value)
1566  {
1567  extern int c_traces, c_brush_traces;
1568  extern int c_pointcontents;
1569 
1570  Com_Printf ("%4i traces %4i points\n", c_traces, c_pointcontents);
1571  c_traces = 0;
1572  c_brush_traces = 0;
1573  c_pointcontents = 0;
1574  }
1575 
1576  do
1577  {
1578  s = Sys_ConsoleInput ();
1579  if (s)
1580  Cbuf_AddText (va("%s\n",s));
1581  } while (s);
1582  Cbuf_Execute ();
1583 
1584  if (host_speeds->value)
1585  time_before = Sys_Milliseconds ();
1586 
1587  SV_Frame (msec);
1588 
1589  if (host_speeds->value)
1590  time_between = Sys_Milliseconds ();
1591 
1592  CL_Frame (msec);
1593 
1594  if (host_speeds->value)
1595  time_after = Sys_Milliseconds ();
1596 
1597 
1598  if (host_speeds->value)
1599  {
1600  int all, sv, gm, cl, rf;
1601 
1602  all = time_after - time_before;
1603  sv = time_between - time_before;
1604  cl = time_after - time_between;
1607  sv -= gm;
1608  cl -= rf;
1609  Com_Printf ("all:%3i sv:%3i gm:%3i cl:%3i rf:%3i\n",
1610  all, sv, gm, cl, rf);
1611  }
1612 }

Referenced by WinMain().

◆ Qcommon_Init()

void Qcommon_Init ( int  argc,
char **  argv 
)

Definition at line 1430 of file common.c.

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

Referenced by WinMain().

◆ Qcommon_Shutdown()

void Qcommon_Shutdown ( void  )

Definition at line 1619 of file common.c.

1620 {
1621 }

Referenced by Sys_Error(), and Sys_Quit().

◆ SCR_EndLoadingPlaque()

void SCR_EndLoadingPlaque ( void  )

Definition at line 598 of file cl_scrn.c.

599 {
600  cls.disable_screen = 0;
601  Con_ClearNotify ();
602 }

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

◆ SZ_Clear()

◆ SZ_GetSpace()

void* SZ_GetSpace ( sizebuf_t buf,
int  length 
)

Definition at line 917 of file common.c.

918 {
919  void *data;
920 
921  if (buf->cursize + length > buf->maxsize)
922  {
923  if (!buf->allowoverflow)
924  Com_Error (ERR_FATAL, "SZ_GetSpace: overflow without allowoverflow set");
925 
926  if (length > buf->maxsize)
927  Com_Error (ERR_FATAL, "SZ_GetSpace: %i is > full buffer size", length);
928 
929  Com_Printf ("SZ_GetSpace: overflow\n");
930  SZ_Clear (buf);
931  buf->overflowed = true;
932  }
933 
934  data = buf->data + buf->cursize;
935  buf->cursize += length;
936 
937  return data;
938 }

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 904 of file common.c.

905 {
906  memset (buf, 0, sizeof(*buf));
907  buf->data = data;
908  buf->maxsize = length;
909 }

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 945 of file common.c.

946 {
947  int len;
948 
949  len = strlen(data)+1;
950 
951  if (buf->cursize)
952  {
953  if (buf->data[buf->cursize-1])
954  memcpy ((byte *)SZ_GetSpace(buf, len),data,len); // no trailing 0
955  else
956  memcpy ((byte *)SZ_GetSpace(buf, len-1)-1,data,len); // write over trailing 0
957  }
958  else
959  memcpy ((byte *)SZ_GetSpace(buf, len),data,len);
960 }

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 1141 of file common.c.

1142 {
1143  zhead_t *z;
1144 
1145  z = ((zhead_t *)ptr) - 1;
1146 
1147  if (z->magic != Z_MAGIC) {
1148  printf( "free: %p failed\n", ptr );
1149  abort();
1150  Com_Error (ERR_FATAL, "Z_Free: bad magic");
1151  }
1152 
1153  z->prev->next = z->next;
1154  z->next->prev = z->prev;
1155 
1156  z_count--;
1157  z_bytes -= z->size;
1158  free (z);
1159 }

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 1177 of file common.c.

1178 {
1179  zhead_t *z, *next;
1180 
1181  for (z=z_chain.next ; z != &z_chain ; z=next)
1182  {
1183  next = z->next;
1184  if (z->tag == tag)
1185  Z_Free ((void *)(z+1));
1186  }
1187 }

Referenced by SV_InitGameProgs().

◆ Z_Malloc()

◆ Z_Stats_f()

void Z_Stats_f ( void  )

Definition at line 1167 of file common.c.

1168 {
1169  Com_Printf ("%i bytes in %i blocks\n", z_bytes, z_count);
1170 }

Referenced by Qcommon_Init().

◆ Z_TagMalloc()

void* Z_TagMalloc ( int  size,
int  tag 
)

Definition at line 1194 of file common.c.

1195 {
1196  zhead_t *z;
1197 
1198  size = size + sizeof(zhead_t);
1199  z = malloc(size);
1200  if (!z)
1201  Com_Error (ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes",size);
1202  memset (z, 0, size);
1203  z_count++;
1204  z_bytes += size;
1205  z->magic = Z_MAGIC;
1206  z->tag = tag;
1207  z->size = size;
1208 
1209  z->next = z_chain.next;
1210  z->prev = &z_chain;
1211  z_chain.next->prev = z;
1212  z_chain.next = z;
1213 
1214  /* printf( "returning pointer: %p\n", (z+1) );*/
1215  return (void *)(z+1);
1216 }

Referenced by SV_InitGameProgs(), and Z_Malloc().

Variable Documentation

◆ abortframe

jmp_buf abortframe

Definition at line 34 of file common.c.

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

◆ bytedirs

Initial value:
=
{
}

Definition at line 300 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 1287 of file common.c.

Referenced by COM_BlockSequenceCRCByte().

◆ com_argc

int com_argc

Definition at line 29 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 30 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 41 of file common.c.

Referenced by Com_DPrintf(), Com_MDPrintf(), 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 39 of file common.c.

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

◆ log_stats

cvar_t* log_stats

Definition at line 40 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 37 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().

◆ modder

cvar_t* modder

Definition at line 42 of file common.c.

Referenced by Com_MDPrintf(), 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 32 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().

◆ 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 1134 of file common.c.

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

◆ z_chain

zhead_t z_chain

Definition at line 1133 of file common.c.

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

◆ z_count

int z_count

Definition at line 1134 of file common.c.

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

K_KP_PLUS
@ K_KP_PLUS
Definition: keys.h:74
entity_state_s::old_origin
vec3_t old_origin
Definition: q_shared.h:1175
CL_Drop
void CL_Drop(void)
Definition: cl_main.c:412
sv
server_t sv
Definition: sv_init.c:24
usercmd_s::lightlevel
byte lightlevel
Definition: q_shared.h:520
K_END
@ K_END
Definition: keys.h:58
SCR_EndLoadingPlaque
void SCR_EndLoadingPlaque(void)
Definition: cl_scrn.c:598
Z_MAGIC
#define Z_MAGIC
Definition: common.c:1122
usercmd_s::impulse
byte impulse
Definition: q_shared.h:519
dedicated
cvar_t * dedicated
Definition: common.c:47
value
GLfloat value
Definition: qgl_win.c:63
K_DOWNARROW
@ K_DOWNARROW
Definition: keys.h:34
MAX_QPATH
#define MAX_QPATH
Definition: q_shared.h:73
entity_state_s::modelindex4
int modelindex4
Definition: q_shared.h:1177
entity_state_s::solid
int solid
Definition: q_shared.h:1182
Z_TagMalloc
void * Z_TagMalloc(int size, int tag)
Definition: common.c:1194
U_ANGLE2
#define U_ANGLE2
Definition: qcommon.h:300
U_MOREBITS3
#define U_MOREBITS3
Definition: qcommon.h:324
z_chain
zhead_t z_chain
Definition: common.c:1133
U_ANGLE1
#define U_ANGLE1
Definition: qcommon.h:310
K_KP_UPARROW
@ K_KP_UPARROW
Definition: keys.h:61
Swap_Init
void Swap_Init(void)
Definition: q_shared.c:1011
entity_state_s::frame
int frame
Definition: q_shared.h:1178
log_stats
cvar_t * log_stats
Definition: common.c:40
CVAR_NOSET
#define CVAR_NOSET
Definition: q_shared.h:312
CM_SIDE
#define CM_SIDE
Definition: qcommon.h:276
chktbl
static byte chktbl[1024]
Definition: common.c:1287
client_static_t::disable_screen
float disable_screen
Definition: client.h:232
showtrace
cvar_t * showtrace
Definition: common.c:46
K_KP_PGDN
@ K_KP_PGDN
Definition: keys.h:68
entity_state_s::renderfx
int renderfx
Definition: q_shared.h:1181
MSG_ReadShort
int MSG_ReadShort(sizebuf_t *msg_read)
Definition: common.c:735
cvar_s::modified
qboolean modified
Definition: q_shared.h:323
U_ORIGIN1
#define U_ORIGIN1
Definition: qcommon.h:298
entity_state_s::origin
vec3_t origin
Definition: q_shared.h:1173
Cbuf_Init
void Cbuf_Init(void)
Definition: cmd.c:78
sizebuf_s::overflowed
qboolean overflowed
Definition: qcommon.h:78
keyshift
int keyshift[K_LAST]
Definition: keys.c:42
U_RENDERFX8
#define U_RENDERFX8
Definition: qcommon.h:312
Sys_Error
void Sys_Error(char *error,...)
Definition: sys_win.c:67
sizebuf_s::readcount
int readcount
Definition: qcommon.h:82
U_OLDORIGIN
#define U_OLDORIGIN
Definition: qcommon.h:327
qboolean
qboolean
Definition: q_shared.h:56
x
GLint GLenum GLint x
Definition: qgl_win.c:116
z
GLdouble GLdouble z
Definition: qgl_win.c:283
z_count
int z_count
Definition: common.c:1134
i
int i
Definition: q_shared.c:305
MSG_WriteCoord
void MSG_WriteCoord(sizebuf_t *sb, float f)
Definition: common.c:383
host_speeds
cvar_t * host_speeds
Definition: common.c:39
K_KP_LEFTARROW
@ K_KP_LEFTARROW
Definition: keys.h:63
MAX_NUM_ARGVS
#define MAX_NUM_ARGVS
Definition: common.c:26
U_MODEL
#define U_MODEL
Definition: qcommon.h:311
COM_InitArgv
void COM_InitArgv(int argc, char **argv)
Definition: common.c:1012
buffer
GLenum GLfloat * buffer
Definition: qgl_win.c:151
entity_state_s::event
int event
Definition: q_shared.h:1186
MSG_WriteLong
void MSG_WriteLong(sizebuf_t *sb, int c)
Definition: common.c:349
MAX_TOKEN_CHARS
#define MAX_TOKEN_CHARS
Definition: q_shared.h:71
VERSION
#define VERSION
Definition: qcommon.h:26
argv
char * argv[MAX_NUM_ARGVS]
Definition: sys_win.c:55
time_before_game
int time_before_game
Definition: common.c:54
zhead_s::prev
struct zhead_s * prev
Definition: common.c:1127
argc
int argc
Definition: sys_win.c:54
Sys_Init
void Sys_Init(void)
Definition: sys_win.c:206
usercmd_s::forwardmove
short forwardmove
Definition: q_shared.h:518
sizebuf_s::data
byte * data
Definition: qcommon.h:79
Cvar_Get
cvar_t * Cvar_Get(char *var_name, char *var_value, int flags)
Definition: cvar.c:127
U_MODEL2
#define U_MODEL2
Definition: qcommon.h:321
entity_state_s::modelindex3
int modelindex3
Definition: q_shared.h:1177
K_HOME
@ K_HOME
Definition: keys.h:57
SZ_Write
void SZ_Write(sizebuf_t *buf, void *data, int length)
Definition: common.c:940
K_KP_HOME
@ K_KP_HOME
Definition: keys.h:60
SZ_Clear
void SZ_Clear(sizebuf_t *buf)
Definition: common.c:911
K_ENTER
@ K_ENTER
Definition: keys.h:26
entity_state_s::effects
unsigned int effects
Definition: q_shared.h:1180
CVAR_SERVERINFO
#define CVAR_SERVERINFO
Definition: q_shared.h:311
Com_Error_f
void Com_Error_f(void)
Definition: common.c:1419
CL_Init
void CL_Init(void)
Definition: cl_main.c:1823
Netchan_Init
void Netchan_Init(void)
Definition: net_chan.c:91
K_KP_INS
@ K_KP_INS
Definition: keys.h:70
entity_state_s::sound
int sound
Definition: q_shared.h:1185
Sys_ConsoleInput
char * Sys_ConsoleInput(void)
Definition: sys_win.c:265
Cmd_Argv
char * Cmd_Argv(int arg)
Definition: cmd.c:517
U_ANGLE3
#define U_ANGLE3
Definition: qcommon.h:301
va
char * va(char *format,...)
Definition: q_shared.c:1050
msg
cvar_t * msg
Definition: cl_main.c:98
sizebuf_s::maxsize
int maxsize
Definition: qcommon.h:80
K_LEFTARROW
@ K_LEFTARROW
Definition: keys.h:35
K_KP_MINUS
@ K_KP_MINUS
Definition: keys.h:73
U_SOUND
#define U_SOUND
Definition: qcommon.h:329
RF_BEAM
#define RF_BEAM
Definition: q_shared.h:620
modder
cvar_t * modder
Definition: common.c:42
K_ESCAPE
@ K_ESCAPE
Definition: keys.h:27
Key_Init
void Key_Init(void)
Definition: keys.c:650
CM_ANGLE1
#define CM_ANGLE1
Definition: qcommon.h:272
bytedirs
vec3_t bytedirs[NUMVERTEXNORMALS]
Definition: common.c:300
usercmd_s::sidemove
short sidemove
Definition: q_shared.h:518
LittleFloat
float LittleFloat(float l)
Definition: q_shared.c:950
U_EVENT
#define U_EVENT
Definition: qcommon.h:303
z_bytes
int z_bytes
Definition: common.c:1134
LittleLong
int LittleLong(int l)
Definition: q_shared.c:948
K_PGUP
@ K_PGUP
Definition: keys.h:56
consolekeys
qboolean consolekeys[K_LAST]
Definition: keys.c:40
U_EFFECTS16
#define U_EFFECTS16
Definition: qcommon.h:320
CRC_Block
unsigned short CRC_Block(byte *start, int count)
Definition: crc.c:82
U_ORIGIN2
#define U_ORIGIN2
Definition: qcommon.h:299
com_argc
int com_argc
Definition: common.c:29
CL_Shutdown
void CL_Shutdown(void)
Definition: cl_main.c:1868
U_EFFECTS8
#define U_EFFECTS8
Definition: qcommon.h:313
U_MOREBITS1
#define U_MOREBITS1
Definition: qcommon.h:305
Sys_ConsoleOutput
void Sys_ConsoleOutput(char *string)
Definition: sys_win.c:345
U_MODEL4
#define U_MODEL4
Definition: qcommon.h:323
zhead_s::next
struct zhead_s * next
Definition: common.c:1127
K_KP_RIGHTARROW
@ K_KP_RIGHTARROW
Definition: keys.h:65
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:635
K_PGDN
@ K_PGDN
Definition: keys.h:55
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:155
Sys_Quit
void Sys_Quit(void)
Definition: sys_win.c:90
U_FRAME16
#define U_FRAME16
Definition: qcommon.h:318
vsnprintf
#define vsnprintf
Definition: q_shared.h:32
Cbuf_AddText
void Cbuf_AddText(char *text)
Definition: cmd.c:90
K_INS
@ K_INS
Definition: keys.h:53
cvar_s::value
float value
Definition: q_shared.h:324
MSG_ReadByte
int MSG_ReadByte(sizebuf_t *msg_read)
Definition: common.c:722
time_before_ref
int time_before_ref
Definition: common.c:56
Con_Print
void Con_Print(char *text)
Definition: console.c:359
U_SKIN8
#define U_SKIN8
Definition: qcommon.h:317
Key_Unbind_f
void Key_Unbind_f(void)
Definition: keys.c:537
U_RENDERFX16
#define U_RENDERFX16
Definition: qcommon.h:319
CM_FORWARD
#define CM_FORWARD
Definition: qcommon.h:275
timescale
cvar_t * timescale
Definition: common.c:43
U_MOREBITS2
#define U_MOREBITS2
Definition: qcommon.h:314
entity_state_s::number
int number
Definition: q_shared.h:1171
NULL
#define NULL
Definition: q_shared.h:60
FS_InitFilesystem
void FS_InitFilesystem(void)
Definition: files.c:891
zhead_t
struct zhead_s zhead_t
MSG_WriteShort
void MSG_WriteShort(sizebuf_t *sb, int c)
Definition: common.c:335
MSG_WriteByte
void MSG_WriteByte(sizebuf_t *sb, int c)
Definition: common.c:322
CM_BUTTONS
#define CM_BUTTONS
Definition: qcommon.h:278
K_KP_END
@ K_KP_END
Definition: keys.h:66
Com_Error
void Com_Error(int code, char *fmt,...)
Definition: common.c:203
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:215
Z_Malloc
void * Z_Malloc(int size)
Definition: common.c:1223
SZ_GetSpace
void * SZ_GetSpace(sizebuf_t *buf, int length)
Definition: common.c:917
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:736
menubound
qboolean menubound[K_LAST]
Definition: keys.c:41
K_KP_ENTER
@ K_KP_ENTER
Definition: keys.h:69
usercmd_s::upmove
short upmove
Definition: q_shared.h:518
c_brush_traces
int c_brush_traces
Definition: cmodel.c:119
name
cvar_t * name
Definition: cl_main.c:94
MAX_EDICTS
#define MAX_EDICTS
Definition: q_shared.h:80
rd_buffersize
static int rd_buffersize
Definition: common.c:69
ERR_FATAL
#define ERR_FATAL
Definition: qcommon.h:735
key_linepos
int key_linepos
Definition: keys.c:31
Cmd_Init
void Cmd_Init(void)
Definition: cmd.c:881
K_KP_DEL
@ K_KP_DEL
Definition: keys.h:71
Z_Stats_f
void Z_Stats_f(void)
Definition: common.c:1167
SV_Shutdown
void SV_Shutdown(char *finalmsg, qboolean reconnect)
Definition: sv_main.c:1035
NET_Init
void NET_Init(void)
Definition: net_wins.c:762
entity_state_s::skinnum
int skinnum
Definition: q_shared.h:1179
logfile
FILE * logfile
Definition: common.c:49
U_SKIN16
#define U_SKIN16
Definition: qcommon.h:328
CM_ANGLE2
#define CM_ANGLE2
Definition: qcommon.h:273
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:158
logfile_active
cvar_t * logfile_active
Definition: common.c:45
Com_BlockChecksum
unsigned Com_BlockChecksum(void *buffer, int length)
Definition: md4.c:165
Cvar_Init
void Cvar_Init(void)
Definition: cvar.c:522
abortframe
jmp_buf abortframe
Definition: common.c:34
Key_Unbindall_f
void Key_Unbindall_f(void)
Definition: keys.c:557
Z_Free
void Z_Free(void *ptr)
Definition: common.c:1141
MSG_WriteAngle
void MSG_WriteAngle(sizebuf_t *sb, float f)
Definition: common.c:395
CM_UP
#define CM_UP
Definition: qcommon.h:277
BUILDSTRING
#define BUILDSTRING
Definition: qcommon.h:68
SV_Frame
void SV_Frame(int msec)
Definition: sv_main.c:760
FS_Gamedir
char * FS_Gamedir(void)
Definition: files.c:590
SHORT2ANGLE
#define SHORT2ANGLE(x)
Definition: q_shared.h:1117
time_after_game
int time_after_game
Definition: common.c:55
K_KP_SLASH
@ K_KP_SLASH
Definition: keys.h:72
rd_buffer
static char * rd_buffer
Definition: common.c:68
K_TAB
@ K_TAB
Definition: keys.h:25
usercmd_s::angles
short angles[3]
Definition: q_shared.h:517
K_UPARROW
@ K_UPARROW
Definition: keys.h:33
Cbuf_Execute
void Cbuf_Execute(void)
Definition: cmd.c:194
log_stats_file
FILE * log_stats_file
Definition: common.c:37
sizebuf_s::allowoverflow
qboolean allowoverflow
Definition: qcommon.h:77
K_SHIFT
@ K_SHIFT
Definition: keys.h:40
Com_Quit
void Com_Quit(void)
Definition: common.c:255
Key_Bind_f
void Key_Bind_f(void)
Definition: keys.c:572
entity_state_s::modelindex
int modelindex
Definition: q_shared.h:1176
entity_state_s::modelindex2
int modelindex2
Definition: q_shared.h:1177
time_after_ref
int time_after_ref
Definition: common.c:57
K_KP_5
@ K_KP_5
Definition: keys.h:64
sizebuf_s::cursize
int cursize
Definition: qcommon.h:81
K_KP_PGUP
@ K_KP_PGUP
Definition: keys.h:62
CM_ANGLE3
#define CM_ANGLE3
Definition: qcommon.h:274
U_FRAME8
#define U_FRAME8
Definition: qcommon.h:302
usercmd_s::msec
byte msec
Definition: q_shared.h:515
K_LAST
@ K_LAST
Definition: keys.h:135
key_lines
char key_lines[32][MAXCMDLINE]
Definition: keys.c:30
Cbuf_AddLateCommands
qboolean Cbuf_AddLateCommands(void)
Definition: cmd.c:296
usercmd_s::buttons
byte buttons
Definition: q_shared.h:516
rd_flush
static void(* rd_flush)(int target, char *buffer)
Definition: common.c:70
U_NUMBER16
#define U_NUMBER16
Definition: qcommon.h:308
c_pointcontents
int c_pointcontents
Definition: cmodel.c:118
Cbuf_AddEarlyCommands
void Cbuf_AddEarlyCommands(qboolean clear)
Definition: cmd.c:263
Com_Printf
void Com_Printf(char *fmt,...)
Definition: common.c:102
ANGLE2SHORT
#define ANGLE2SHORT(x)
Definition: q_shared.h:1116
developer
cvar_t * developer
Definition: common.c:41
Sys_Milliseconds
int Sys_Milliseconds(void)
Definition: q_shwin.c:120
K_RIGHTARROW
@ K_RIGHTARROW
Definition: keys.h:36
fixedtime
cvar_t * fixedtime
Definition: common.c:44
cls
client_static_t cls
Definition: cl_main.c:105
NUMVERTEXNORMALS
#define NUMVERTEXNORMALS
Definition: qcommon.h:786
server_state
int server_state
Definition: common.c:51
MAXPRINTMSG
#define MAXPRINTMSG
Definition: common.c:24
entity_state_s::angles
vec3_t angles
Definition: q_shared.h:1174
cl
client_state_t cl
Definition: cl_main.c:106
MSG_ReadChar
int MSG_ReadChar(sizebuf_t *msg_read)
Definition: common.c:709
U_ORIGIN3
#define U_ORIGIN3
Definition: qcommon.h:309
CPUSTRING
#define CPUSTRING
Definition: qcommon.h:69
CM_IMPULSE
#define CM_IMPULSE
Definition: qcommon.h:279
U_SOLID
#define U_SOLID
Definition: qcommon.h:330
ERR_DISCONNECT
#define ERR_DISCONNECT
Definition: q_shared.h:99
U_MODEL3
#define U_MODEL3
Definition: qcommon.h:322
K_BACKSPACE
@ K_BACKSPACE
Definition: keys.h:32
K_KP_DOWNARROW
@ K_KP_DOWNARROW
Definition: keys.h:67
K_F1
@ K_F1
Definition: keys.h:41
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1236
zhead_s
Definition: common.c:1125
CL_Frame
void CL_Frame(int msec)
Definition: cl_main.c:1720
c_traces
int c_traces
Definition: cmodel.c:119
com_argv
char * com_argv[MAX_NUM_ARGVS+1]
Definition: common.c:30
count
GLint GLsizei count
Definition: qgl_win.c:128