icculus quake2 doxygen  1.0 dev
server.h File Reference
#include "../qcommon/qcommon.h"
#include "../game/game.h"

Go to the source code of this file.

Classes

struct  server_t
 
struct  client_frame_t
 
struct  client_s
 
struct  challenge_t
 
struct  server_static_t
 

Macros

#define MAX_MASTERS   8
 
#define EDICT_NUM(n)   ((edict_t *)((byte *)ge->edicts + ge->edict_size*(n)))
 
#define NUM_FOR_EDICT(e)   ( ((byte *)(e)-(byte *)ge->edicts ) / ge->edict_size)
 
#define LATENCY_COUNTS   16
 
#define RATE_MESSAGES   10
 
#define MAX_CHALLENGES   1024
 
#define SV_OUTPUTBUF_LENGTH   (MAX_MSGLEN - 16)
 

Typedefs

typedef struct client_s client_t
 

Enumerations

enum  server_state_t {
  ss_dead, ss_loading, ss_game, ss_cinematic,
  ss_demo, ss_pic
}
 
enum  client_state_t { cs_free, cs_zombie, cs_connected, cs_spawned }
 
enum  redirect_t { RD_NONE, RD_CLIENT, RD_PACKET }
 

Functions

void SV_FinalMessage (char *message, qboolean reconnect)
 
void SV_DropClient (client_t *drop)
 
int SV_ModelIndex (char *name)
 
int SV_SoundIndex (char *name)
 
int SV_ImageIndex (char *name)
 
void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg)
 
void SV_ExecuteUserCommand (char *s)
 
void SV_InitOperatorCommands (void)
 
void SV_SendServerinfo (client_t *client)
 
void SV_UserinfoChanged (client_t *cl)
 
void Master_Heartbeat (void)
 
void Master_Packet (void)
 
void SV_InitGame (void)
 
void SV_Map (qboolean attractloop, char *levelstring, qboolean loadgame)
 
void SV_PrepWorldFrame (void)
 
void SV_FlushRedirect (int sv_redirected, char *outputbuf)
 
void SV_DemoCompleted (void)
 
void SV_SendClientMessages (void)
 
void SV_Multicast (vec3_t origin, multicast_t to)
 
void SV_StartSound (vec3_t origin, edict_t *entity, int channel, int soundindex, float volume, float attenuation, float timeofs)
 
void SV_ClientPrintf (client_t *cl, int level, char *fmt,...)
 
void SV_BroadcastPrintf (int level, char *fmt,...)
 
void SV_BroadcastCommand (char *fmt,...)
 
void SV_Nextserver (void)
 
void SV_ExecuteClientMessage (client_t *cl)
 
void SV_ReadLevelFile (void)
 
void SV_Status_f (void)
 
void SV_WriteFrameToClient (client_t *client, sizebuf_t *msg)
 
void SV_RecordDemoMessage (void)
 
void SV_BuildClientFrame (client_t *client)
 
void SV_Error (char *error,...)
 
void SV_InitGameProgs (void)
 
void SV_ShutdownGameProgs (void)
 
void SV_InitEdict (edict_t *e)
 
void SV_ClearWorld (void)
 
void SV_UnlinkEdict (edict_t *ent)
 
void SV_LinkEdict (edict_t *ent)
 
int SV_AreaEdicts (vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype)
 
int SV_PointContents (vec3_t p)
 
trace_t SV_Trace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passedict, int contentmask)
 

Variables

netadr_t net_from
 
sizebuf_t net_message
 
netadr_t master_adr [MAX_MASTERS]
 
server_static_t svs
 
server_t sv
 
cvar_tsv_paused
 
cvar_tmaxclients
 
cvar_tsv_noreload
 
cvar_tsv_airaccelerate
 
cvar_tsv_enforcetime
 
client_tsv_client
 
edict_tsv_player
 
char sv_outputbuf [SV_OUTPUTBUF_LENGTH]
 
game_export_tge
 

Macro Definition Documentation

◆ EDICT_NUM

#define EDICT_NUM (   n)    ((edict_t *)((byte *)ge->edicts + ge->edict_size*(n)))

Definition at line 69 of file server.h.

◆ LATENCY_COUNTS

#define LATENCY_COUNTS   16

Definition at line 92 of file server.h.

◆ MAX_CHALLENGES

#define MAX_CHALLENGES   1024

Definition at line 148 of file server.h.

◆ MAX_MASTERS

#define MAX_MASTERS   8

Definition at line 30 of file server.h.

◆ NUM_FOR_EDICT

#define NUM_FOR_EDICT (   e)    ( ((byte *)(e)-(byte *)ge->edicts ) / ge->edict_size)

Definition at line 70 of file server.h.

◆ RATE_MESSAGES

#define RATE_MESSAGES   10

Definition at line 93 of file server.h.

◆ SV_OUTPUTBUF_LENGTH

#define SV_OUTPUTBUF_LENGTH   (MAX_MSGLEN - 16)

Definition at line 243 of file server.h.

Typedef Documentation

◆ client_t

typedef struct client_s client_t

Enumeration Type Documentation

◆ client_state_t

Enumerator
cs_free 
cs_zombie 
cs_connected 
cs_spawned 

Definition at line 73 of file server.h.

74 {
75  cs_free, // can be reused for a new connection
76  cs_zombie, // client has been disconnected, but don't reuse
77  // connection for a couple seconds
78  cs_connected, // has been assigned to a client_t, but not in game yet
79  cs_spawned // client is fully in game

◆ redirect_t

enum redirect_t
Enumerator
RD_NONE 
RD_CLIENT 
RD_PACKET 

Definition at line 242 of file server.h.

◆ server_state_t

Enumerator
ss_dead 
ss_loading 
ss_game 
ss_cinematic 
ss_demo 
ss_pic 

Definition at line 32 of file server.h.

32  {
33  ss_dead, // no map loaded
34  ss_loading, // spawning level edicts
35  ss_game, // actively running
37  ss_demo,
38  ss_pic

Function Documentation

◆ Master_Heartbeat()

void Master_Heartbeat ( void  )

Definition at line 827 of file sv_main.c.

828 {
829  char *string;
830  int i;
831 
832  // pgm post3.19 change, cvar pointer not validated before dereferencing
833  if (!dedicated || !dedicated->value)
834  return; // only dedicated servers send heartbeats
835 
836  // pgm post3.19 change, cvar pointer not validated before dereferencing
838  return; // a private dedicated game
839 
840  // check for time wraparound
843 
845  return; // not time to send yet
846 
848 
849  // send the same string that we would give for a status OOB command
850  string = SV_StatusString();
851 
852  // send to group master
853  for (i=0 ; i<MAX_MASTERS ; i++)
854  if (master_adr[i].port)
855  {
856  Com_Printf ("Sending heartbeat to %s\n", NET_AdrToString (master_adr[i]));
857  Netchan_OutOfBandPrint (NS_SERVER, master_adr[i], "heartbeat\n%s", string);
858  }
859 }

Referenced by SV_Frame().

◆ Master_Packet()

void Master_Packet ( void  )

◆ SV_AreaEdicts()

int SV_AreaEdicts ( vec3_t  mins,
vec3_t  maxs,
edict_t **  list,
int  maxcount,
int  areatype 
)

Definition at line 408 of file sv_world.c.

410 {
411  area_mins = mins;
412  area_maxs = maxs;
413  area_list = list;
414  area_count = 0;
415  area_maxcount = maxcount;
416  area_type = areatype;
417 
419 
420  return area_count;
421 }

Referenced by SV_ClipMoveToEntities(), SV_InitGameProgs(), and SV_PointContents().

◆ SV_BroadcastCommand()

void SV_BroadcastCommand ( char *  fmt,
  ... 
)

Definition at line 132 of file sv_send.c.

133 {
134  va_list argptr;
135  char string[1024];
136 
137  if (!sv.state)
138  return;
139  va_start (argptr,fmt);
140  vsprintf (string, fmt,argptr);
141  va_end (argptr);
142 
144  MSG_WriteString (&sv.multicast, string);
146 }

Referenced by SV_Map().

◆ SV_BroadcastPrintf()

void SV_BroadcastPrintf ( int  level,
char *  fmt,
  ... 
)

Definition at line 89 of file sv_send.c.

90 {
91  va_list argptr;
92  char string[2048];
93  client_t *cl;
94  int i;
95 
96  va_start (argptr,fmt);
97  vsprintf (string, fmt,argptr);
98  va_end (argptr);
99 
100  // echo to console
101  if (dedicated->value)
102  {
103  char copy[1024];
104  int i;
105 
106  // mask off high bits
107  for (i=0 ; i<1023 && string[i] ; i++)
108  copy[i] = string[i]&127;
109  copy[i] = 0;
110  Com_Printf ("%s", copy);
111  }
112 
113  for (i=0, cl = svs.clients ; i<maxclients->value; i++, cl++)
114  {
115  if (level < cl->messagelevel)
116  continue;
117  if (cl->state != cs_spawned)
118  continue;
119  MSG_WriteByte (&cl->netchan.message, svc_print);
120  MSG_WriteByte (&cl->netchan.message, level);
121  MSG_WriteString (&cl->netchan.message, string);
122  }
123 }

Referenced by SV_CheckTimeouts(), SV_InitGameProgs(), SV_Kick_f(), and SV_SendClientMessages().

◆ SV_BuildClientFrame()

void SV_BuildClientFrame ( client_t client)

Definition at line 524 of file sv_ents.c.

525 {
526  int e, i;
527  vec3_t org;
528  edict_t *ent;
529  edict_t *clent;
530  client_frame_t *frame;
531  entity_state_t *state;
532  int l;
533  int clientarea, clientcluster;
534  int leafnum;
535  int c_fullsend;
536  byte *clientphs;
537  byte *bitvector;
538 
539  clent = client->edict;
540  if (!clent->client)
541  return; // not in game yet
542 
543 #if 0
544  numprojs = 0; // no projectiles yet
545 #endif
546 
547  // this is the frame we are creating
548  frame = &client->frames[sv.framenum & UPDATE_MASK];
549 
550  frame->senttime = svs.realtime; // save it for ping calc later
551 
552  // find the client's PVS
553  for (i=0 ; i<3 ; i++)
554  org[i] = clent->client->ps.pmove.origin[i]*0.125 + clent->client->ps.viewoffset[i];
555 
556  leafnum = CM_PointLeafnum (org);
557  clientarea = CM_LeafArea (leafnum);
558  clientcluster = CM_LeafCluster (leafnum);
559 
560  // calculate the visible areas
561  frame->areabytes = CM_WriteAreaBits (frame->areabits, clientarea);
562 
563  // grab the current player_state_t
564  frame->ps = clent->client->ps;
565 
566 
567  SV_FatPVS (org);
568  clientphs = CM_ClusterPHS (clientcluster);
569 
570  // build up the list of visible entities
571  frame->num_entities = 0;
573 
574  c_fullsend = 0;
575 
576  for (e=1 ; e<ge->num_edicts ; e++)
577  {
578  ent = EDICT_NUM(e);
579 
580  // ignore ents without visible models
581  if (ent->svflags & SVF_NOCLIENT)
582  continue;
583 
584  // ignore ents without visible models unless they have an effect
585  if (!ent->s.modelindex && !ent->s.effects && !ent->s.sound
586  && !ent->s.event)
587  continue;
588 
589  // ignore if not touching a PV leaf
590  if (ent != clent)
591  {
592  // check area
593  if (!CM_AreasConnected (clientarea, ent->areanum))
594  { // doors can legally straddle two areas, so
595  // we may need to check another one
596  if (!ent->areanum2
597  || !CM_AreasConnected (clientarea, ent->areanum2))
598  continue; // blocked by a door
599  }
600 
601  // beams just check one point for PHS
602  if (ent->s.renderfx & RF_BEAM)
603  {
604  l = ent->clusternums[0];
605  if ( !(clientphs[l >> 3] & (1 << (l&7) )) )
606  continue;
607  }
608  else
609  {
610  // FIXME: if an ent has a model and a sound, but isn't
611  // in the PVS, only the PHS, clear the model
612  if (ent->s.sound)
613  {
614  bitvector = fatpvs; //clientphs;
615  }
616  else
617  bitvector = fatpvs;
618 
619  if (ent->num_clusters == -1)
620  { // too many leafs for individual check, go by headnode
621  if (!CM_HeadnodeVisible (ent->headnode, bitvector))
622  continue;
623  c_fullsend++;
624  }
625  else
626  { // check individual leafs
627  for (i=0 ; i < ent->num_clusters ; i++)
628  {
629  l = ent->clusternums[i];
630  if (bitvector[l >> 3] & (1 << (l&7) ))
631  break;
632  }
633  if (i == ent->num_clusters)
634  continue; // not visible
635  }
636 
637  if (!ent->s.modelindex)
638  { // don't send sounds if they will be attenuated away
639  vec3_t delta;
640  float len;
641 
642  VectorSubtract (org, ent->s.origin, delta);
643  len = VectorLength (delta);
644  if (len > 400)
645  continue;
646  }
647  }
648  }
649 
650 #if 0
651  if (SV_AddProjectileUpdate(ent))
652  continue; // added as a special projectile
653 #endif
654 
655  // add it to the circular client_entities array
657  if (ent->s.number != e)
658  {
659  Com_DPrintf ("FIXING ENT->S.NUMBER!!!\n");
660  ent->s.number = e;
661  }
662  *state = ent->s;
663 
664  // don't mark players missiles as solid
665  if (ent->owner == client->edict)
666  state->solid = 0;
667 
669  frame->num_entities++;
670  }
671 }

Referenced by SV_SendClientDatagram().

◆ SV_ClearWorld()

void SV_ClearWorld ( void  )

Definition at line 135 of file sv_world.c.

136 {
137  memset (sv_areanodes, 0, sizeof(sv_areanodes));
138  sv_numareanodes = 0;
139  SV_CreateAreaNode (0, sv.models[1]->mins, sv.models[1]->maxs);
140 }

Referenced by SV_CheckForSavegame(), and SV_SpawnServer().

◆ SV_ClientPrintf()

void SV_ClientPrintf ( client_t cl,
int  level,
char *  fmt,
  ... 
)

Definition at line 65 of file sv_send.c.

66 {
67  va_list argptr;
68  char string[1024];
69 
70  if (level < cl->messagelevel)
71  return;
72 
73  va_start (argptr,fmt);
74  vsprintf (string, fmt,argptr);
75  va_end (argptr);
76 
77  MSG_WriteByte (&cl->netchan.message, svc_print);
78  MSG_WriteByte (&cl->netchan.message, level);
79  MSG_WriteString (&cl->netchan.message, string);
80 }

Referenced by PF_cprintf(), SV_ConSay_f(), and SV_Kick_f().

◆ SV_DemoCompleted()

void SV_DemoCompleted ( void  )

Definition at line 440 of file sv_send.c.

441 {
442  if (sv.demofile)
443  {
444  fclose (sv.demofile);
445  sv.demofile = NULL;
446  }
447  SV_Nextserver ();
448 }

Referenced by SV_SendClientMessages().

◆ SV_DropClient()

void SV_DropClient ( client_t drop)

Definition at line 70 of file sv_main.c.

71 {
72  // add the disconnect
74 
75  if (drop->state == cs_spawned)
76  {
77  // call the prog function for removing a client
78  // this will remove the body, among other things
79  ge->ClientDisconnect (drop->edict);
80  }
81 
82  if (drop->download)
83  {
84  FS_FreeFile (drop->download);
85  drop->download = NULL;
86  }
87 
88  drop->state = cs_zombie; // become free in a few seconds
89  drop->name[0] = 0;
90 }

Referenced by SV_CheckTimeouts(), SV_Disconnect_f(), SV_ExecuteClientMessage(), SV_Kick_f(), and SV_SendClientMessages().

◆ SV_Error()

void SV_Error ( char *  error,
  ... 
)

◆ SV_ExecuteClientMessage()

void SV_ExecuteClientMessage ( client_t cl)

Definition at line 539 of file sv_user.c.

540 {
541  int c;
542  char *s;
543 
544  usercmd_t nullcmd;
545  usercmd_t oldest, oldcmd, newcmd;
546  int net_drop;
547  int stringCmdCount;
548  int checksum, calculatedChecksum;
549  int checksumIndex;
550  qboolean move_issued;
551  int lastframe;
552 
553  sv_client = cl;
555 
556  // only allow one move command
557  move_issued = false;
558  stringCmdCount = 0;
559 
560  while (1)
561  {
563  {
564  Com_Printf ("SV_ReadClientMessage: badread\n");
565  SV_DropClient (cl);
566  return;
567  }
568 
569  c = MSG_ReadByte (&net_message);
570  if (c == -1)
571  break;
572 
573  switch (c)
574  {
575  default:
576  Com_Printf ("SV_ReadClientMessage: unknown command char\n");
577  SV_DropClient (cl);
578  return;
579 
580  case clc_nop:
581  break;
582 
583  case clc_userinfo:
584  strncpy (cl->userinfo, MSG_ReadString (&net_message), sizeof(cl->userinfo)-1);
586  break;
587 
588  case clc_move:
589  if (move_issued)
590  return; // someone is trying to cheat...
591 
592  move_issued = true;
593  checksumIndex = net_message.readcount;
594  checksum = MSG_ReadByte (&net_message);
595  lastframe = MSG_ReadLong (&net_message);
596  if (lastframe != cl->lastframe) {
597  cl->lastframe = lastframe;
598  if (cl->lastframe > 0) {
599  cl->frame_latency[cl->lastframe&(LATENCY_COUNTS-1)] =
600  svs.realtime - cl->frames[cl->lastframe & UPDATE_MASK].senttime;
601  }
602  }
603 
604  memset (&nullcmd, 0, sizeof(nullcmd));
605  MSG_ReadDeltaUsercmd (&net_message, &nullcmd, &oldest);
606  MSG_ReadDeltaUsercmd (&net_message, &oldest, &oldcmd);
607  MSG_ReadDeltaUsercmd (&net_message, &oldcmd, &newcmd);
608 
609  if ( cl->state != cs_spawned )
610  {
611  cl->lastframe = -1;
612  break;
613  }
614 
615  // if the checksum fails, ignore the rest of the packet
616  calculatedChecksum = COM_BlockSequenceCRCByte (
617  net_message.data + checksumIndex + 1,
618  net_message.readcount - checksumIndex - 1,
619  cl->netchan.incoming_sequence);
620 
621  if (calculatedChecksum != checksum)
622  {
623  Com_DPrintf ("Failed command checksum for %s (%d != %d)/%d\n",
624  cl->name, calculatedChecksum, checksum,
625  cl->netchan.incoming_sequence);
626  return;
627  }
628 
629  if (!sv_paused->value)
630  {
631  net_drop = cl->netchan.dropped;
632  if (net_drop < 20)
633  {
634 
635 //if (net_drop > 2)
636 
637 // Com_Printf ("drop %i\n", net_drop);
638  while (net_drop > 2)
639  {
640  SV_ClientThink (cl, &cl->lastcmd);
641 
642  net_drop--;
643  }
644  if (net_drop > 1)
645  SV_ClientThink (cl, &oldest);
646 
647  if (net_drop > 0)
648  SV_ClientThink (cl, &oldcmd);
649 
650  }
651  SV_ClientThink (cl, &newcmd);
652  }
653 
654  cl->lastcmd = newcmd;
655  break;
656 
657  case clc_stringcmd:
659 
660  // malicious users may try using too many string commands
661  if (++stringCmdCount < MAX_STRINGCMDS)
663 
664  if (cl->state == cs_zombie)
665  return; // disconnect command
666  break;
667  }
668  }
669 }

Referenced by SV_ReadPackets().

◆ SV_ExecuteUserCommand()

void SV_ExecuteUserCommand ( char *  s)

Definition at line 477 of file sv_user.c.

478 {
479  ucmd_t *u;
480 
481  /*******
482  * Security Fix... This is being set to false so that client's can't
483  * macro expand variables on the server. It seems unlikely that a
484  * client ever ought to need to be able to do this...
485  * old line = Cmd_TokenizeString (s, true);
486  *******/
487  Cmd_TokenizeString(s, false);
489 
490 // SV_BeginRedirect (RD_CLIENT);
491 
492  for (u=ucmds ; u->name ; u++)
493  if (!strcmp (Cmd_Argv(0), u->name) )
494  {
495  u->func ();
496  break;
497  }
498 
499  if (!u->name && sv.state == ss_game)
501 
502 // SV_EndRedirect ();
503 }

Referenced by SV_ExecuteClientMessage().

◆ SV_FinalMessage()

void SV_FinalMessage ( char *  message,
qboolean  reconnect 
)

Definition at line 996 of file sv_main.c.

997 {
998  int i;
999  client_t *cl;
1000 
1001  SZ_Clear (&net_message);
1004  MSG_WriteString (&net_message, message);
1005 
1006  if (reconnect)
1008  else
1010 
1011  // send it twice
1012  // stagger the packets to crutch operating system limited buffers
1013 
1014  for (i=0, cl = svs.clients ; i<maxclients->value ; i++, cl++)
1015  if (cl->state >= cs_connected)
1017  , net_message.data);
1018 
1019  for (i=0, cl = svs.clients ; i<maxclients->value ; i++, cl++)
1020  if (cl->state >= cs_connected)
1022  , net_message.data);
1023 }

Referenced by SV_Shutdown().

◆ SV_FlushRedirect()

void SV_FlushRedirect ( int  sv_redirected,
char *  outputbuf 
)

Definition at line 34 of file sv_send.c.

35 {
36  if (sv_redirected == RD_PACKET)
37  {
38  Netchan_OutOfBandPrint (NS_SERVER, net_from, "print\n%s", outputbuf);
39  }
40  else if (sv_redirected == RD_CLIENT)
41  {
45  }
46 }

Referenced by SVC_RemoteCommand(), and SVC_Status().

◆ SV_ImageIndex()

int SV_ImageIndex ( char *  name)

Definition at line 74 of file sv_init.c.

75 {
76  return SV_FindIndex (name, CS_IMAGES, MAX_IMAGES, true);
77 }

Referenced by SV_InitGameProgs().

◆ SV_InitEdict()

void SV_InitEdict ( edict_t e)

◆ SV_InitGame()

void SV_InitGame ( void  )

Definition at line 289 of file sv_init.c.

290 {
291  int i;
292  edict_t *ent;
293  char idmaster[32];
294 
295  if (svs.initialized)
296  {
297  // cause any connected clients to reconnect
298  SV_Shutdown ("Server restarted\n", true);
299  }
300  else
301  {
302  // make sure the client is down
303  CL_Drop ();
305  }
306 
307  // get any latched variable changes (maxclients, etc)
309 
310  svs.initialized = true;
311 
312  if (Cvar_VariableValue ("coop") && Cvar_VariableValue ("deathmatch"))
313  {
314  Com_Printf("Deathmatch and Coop both set, disabling Coop\n");
315  Cvar_FullSet ("coop", "0", CVAR_SERVERINFO | CVAR_LATCH);
316  }
317 
318  // dedicated servers are can't be single player and are usually DM
319  // so unless they explicity set coop, force it to deathmatch
320  if (dedicated->value)
321  {
322  if (!Cvar_VariableValue ("coop"))
323  Cvar_FullSet ("deathmatch", "1", CVAR_SERVERINFO | CVAR_LATCH);
324  }
325 
326  // init clients
327  if (Cvar_VariableValue ("deathmatch"))
328  {
329  if (maxclients->value <= 1)
330  Cvar_FullSet ("maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH);
331  else if (maxclients->value > MAX_CLIENTS)
332  Cvar_FullSet ("maxclients", va("%i", MAX_CLIENTS), CVAR_SERVERINFO | CVAR_LATCH);
333  }
334  else if (Cvar_VariableValue ("coop"))
335  {
336  if (maxclients->value <= 1 || maxclients->value > 4)
337  Cvar_FullSet ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH);
338 #ifdef COPYPROTECT
339  if (!sv.attractloop && !dedicated->value)
340  Sys_CopyProtect ();
341 #endif
342  }
343  else // non-deathmatch, non-coop is one player
344  {
345  Cvar_FullSet ("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH);
346 #ifdef COPYPROTECT
347  if (!sv.attractloop)
348  Sys_CopyProtect ();
349 #endif
350  }
351 
352  svs.spawncount = rand();
356 
357  // init network stuff
358  NET_Config ( (maxclients->value > 1) );
359 
360  // heartbeats will always be sent to the id master
361  svs.last_heartbeat = -99999; // send immediately
362  Com_sprintf(idmaster, sizeof(idmaster), "192.246.40.37:%i", PORT_MASTER);
363  NET_StringToAdr (idmaster, &master_adr[0]);
364 
365  // init game
366  SV_InitGameProgs ();
367  for (i=0 ; i<maxclients->value ; i++)
368  {
369  ent = EDICT_NUM(i+1);
370  ent->s.number = i+1;
371  svs.clients[i].edict = ent;
372  memset (&svs.clients[i].lastcmd, 0, sizeof(svs.clients[i].lastcmd));
373  }
374 }

Referenced by SV_Map(), and SV_ReadServerFile().

◆ SV_InitGameProgs()

void SV_InitGameProgs ( void  )

Definition at line 325 of file sv_game.c.

326 {
327  game_import_t import;
328 
329  // unload anything we have now
330  if (ge)
332 
333 
334  // load a new game dll
335  import.multicast = SV_Multicast;
336  import.unicast = PF_Unicast;
337  import.bprintf = SV_BroadcastPrintf;
338  import.dprintf = PF_dprintf;
339  import.cprintf = PF_cprintf;
340  import.centerprintf = PF_centerprintf;
341  import.error = PF_error;
342 
343  import.linkentity = SV_LinkEdict;
344  import.unlinkentity = SV_UnlinkEdict;
345  import.BoxEdicts = SV_AreaEdicts;
346  import.trace = SV_Trace;
347  import.pointcontents = SV_PointContents;
348  import.setmodel = PF_setmodel;
349  import.inPVS = PF_inPVS;
350  import.inPHS = PF_inPHS;
351  import.Pmove = Pmove;
352 
353  import.modelindex = SV_ModelIndex;
354  import.soundindex = SV_SoundIndex;
355  import.imageindex = SV_ImageIndex;
356 
357  import.configstring = PF_Configstring;
358  import.sound = PF_StartSound;
359  import.positioned_sound = SV_StartSound;
360 
361  import.WriteChar = PF_WriteChar;
362  import.WriteByte = PF_WriteByte;
363  import.WriteShort = PF_WriteShort;
364  import.WriteLong = PF_WriteLong;
365  import.WriteFloat = PF_WriteFloat;
366  import.WriteString = PF_WriteString;
367  import.WritePosition = PF_WritePos;
368  import.WriteDir = PF_WriteDir;
369  import.WriteAngle = PF_WriteAngle;
370 
371  import.TagMalloc = Z_TagMalloc;
372  import.TagFree = Z_Free;
373  import.FreeTags = Z_FreeTags;
374 
375  import.cvar = Cvar_Get;
376  import.cvar_set = Cvar_Set;
377  import.cvar_forceset = Cvar_ForceSet;
378 
379  import.argc = Cmd_Argc;
380  import.argv = Cmd_Argv;
381  import.args = Cmd_Args;
382  import.AddCommandString = Cbuf_AddText;
383 
384  import.DebugGraph = SCR_DebugGraph;
385  import.SetAreaPortalState = CM_SetAreaPortalState;
386  import.AreasConnected = CM_AreasConnected;
387 
388  ge = (game_export_t *)Sys_GetGameAPI (&import);
389 
390  if (!ge)
391  Com_Error (ERR_DROP, "failed to load game DLL");
393  Com_Error (ERR_DROP, "game is version %i, not %i", ge->apiversion,
395 
396  ge->Init ();
397 }

Referenced by SV_InitGame().

◆ SV_InitOperatorCommands()

void SV_InitOperatorCommands ( void  )

Definition at line 1024 of file sv_ccmds.c.

1025 {
1026  Cmd_AddCommand ("heartbeat", SV_Heartbeat_f);
1027  Cmd_AddCommand ("kick", SV_Kick_f);
1028  Cmd_AddCommand ("status", SV_Status_f);
1029  Cmd_AddCommand ("serverinfo", SV_Serverinfo_f);
1030  Cmd_AddCommand ("dumpuser", SV_DumpUser_f);
1031 
1032  Cmd_AddCommand ("map", SV_Map_f);
1033  Cmd_AddCommand ("demomap", SV_DemoMap_f);
1034  Cmd_AddCommand ("gamemap", SV_GameMap_f);
1035  Cmd_AddCommand ("setmaster", SV_SetMaster_f);
1036 
1037  if ( dedicated->value )
1038  Cmd_AddCommand ("say", SV_ConSay_f);
1039 
1040  Cmd_AddCommand ("serverrecord", SV_ServerRecord_f);
1041  Cmd_AddCommand ("serverstop", SV_ServerStop_f);
1042 
1043  Cmd_AddCommand ("save", SV_Savegame_f);
1044  Cmd_AddCommand ("load", SV_Loadgame_f);
1045 
1046  Cmd_AddCommand ("killserver", SV_KillServer_f);
1047 
1049 }

Referenced by SV_Init().

◆ SV_LinkEdict()

void SV_LinkEdict ( edict_t ent)

Definition at line 165 of file sv_world.c.

166 {
167  areanode_t *node;
168  int leafs[MAX_TOTAL_ENT_LEAFS];
169  int clusters[MAX_TOTAL_ENT_LEAFS];
170  int num_leafs;
171  int i, j, k;
172  int area;
173  int topnode;
174 
175  if (ent->area.prev)
176  SV_UnlinkEdict (ent); // unlink from old position
177 
178  if (ent == ge->edicts)
179  return; // don't add the world
180 
181  if (!ent->inuse)
182  return;
183 
184  // set the size
185  VectorSubtract (ent->maxs, ent->mins, ent->size);
186 
187  // encode the size into the entity_state for client prediction
188  if (ent->solid == SOLID_BBOX && !(ent->svflags & SVF_DEADMONSTER))
189  { // assume that x/y are equal and symetric
190  i = ent->maxs[0]/8;
191  if (i<1)
192  i = 1;
193  if (i>31)
194  i = 31;
195 
196  // z is not symetric
197  j = (-ent->mins[2])/8;
198  if (j<1)
199  j = 1;
200  if (j>31)
201  j = 31;
202 
203  // and z maxs can be negative...
204  k = (ent->maxs[2]+32)/8;
205  if (k<1)
206  k = 1;
207  if (k>63)
208  k = 63;
209 
210  ent->s.solid = (k<<10) | (j<<5) | i;
211  }
212  else if (ent->solid == SOLID_BSP)
213  {
214  ent->s.solid = 31; // a solid_bbox will never create this value
215  }
216  else
217  ent->s.solid = 0;
218 
219  // set the abs box
220  if (ent->solid == SOLID_BSP &&
221  (ent->s.angles[0] || ent->s.angles[1] || ent->s.angles[2]) )
222  { // expand for rotation
223  float max, v;
224  int i;
225 
226  max = 0;
227  for (i=0 ; i<3 ; i++)
228  {
229  v =fabs( ent->mins[i]);
230  if (v > max)
231  max = v;
232  v =fabs( ent->maxs[i]);
233  if (v > max)
234  max = v;
235  }
236  for (i=0 ; i<3 ; i++)
237  {
238  ent->absmin[i] = ent->s.origin[i] - max;
239  ent->absmax[i] = ent->s.origin[i] + max;
240  }
241  }
242  else
243  { // normal
244  VectorAdd (ent->s.origin, ent->mins, ent->absmin);
245  VectorAdd (ent->s.origin, ent->maxs, ent->absmax);
246  }
247 
248  // because movement is clipped an epsilon away from an actual edge,
249  // we must fully check even when bounding boxes don't quite touch
250  ent->absmin[0] -= 1;
251  ent->absmin[1] -= 1;
252  ent->absmin[2] -= 1;
253  ent->absmax[0] += 1;
254  ent->absmax[1] += 1;
255  ent->absmax[2] += 1;
256 
257 // link to PVS leafs
258  ent->num_clusters = 0;
259  ent->areanum = 0;
260  ent->areanum2 = 0;
261 
262  //get all leafs, including solids
263  num_leafs = CM_BoxLeafnums (ent->absmin, ent->absmax,
264  leafs, MAX_TOTAL_ENT_LEAFS, &topnode);
265 
266  // set areas
267  for (i=0 ; i<num_leafs ; i++)
268  {
269  clusters[i] = CM_LeafCluster (leafs[i]);
270  area = CM_LeafArea (leafs[i]);
271  if (area)
272  { // doors may legally straggle two areas,
273  // but nothing should evern need more than that
274  if (ent->areanum && ent->areanum != area)
275  {
276  if (ent->areanum2 && ent->areanum2 != area && sv.state == ss_loading)
277  Com_DPrintf ("Object touching 3 areas at %f %f %f\n",
278  ent->absmin[0], ent->absmin[1], ent->absmin[2]);
279  ent->areanum2 = area;
280  }
281  else
282  ent->areanum = area;
283  }
284  }
285 
286  if (num_leafs >= MAX_TOTAL_ENT_LEAFS)
287  { // assume we missed some leafs, and mark by headnode
288  ent->num_clusters = -1;
289  ent->headnode = topnode;
290  }
291  else
292  {
293  ent->num_clusters = 0;
294  for (i=0 ; i<num_leafs ; i++)
295  {
296  if (clusters[i] == -1)
297  continue; // not a visible leaf
298  for (j=0 ; j<i ; j++)
299  if (clusters[j] == clusters[i])
300  break;
301  if (j == i)
302  {
303  if (ent->num_clusters == MAX_ENT_CLUSTERS)
304  { // assume we missed some leafs, and mark by headnode
305  ent->num_clusters = -1;
306  ent->headnode = topnode;
307  break;
308  }
309 
310  ent->clusternums[ent->num_clusters++] = clusters[i];
311  }
312  }
313  }
314 
315  // if first time, make sure old_origin is valid
316  if (!ent->linkcount)
317  {
318  VectorCopy (ent->s.origin, ent->s.old_origin);
319  }
320  ent->linkcount++;
321 
322  if (ent->solid == SOLID_NOT)
323  return;
324 
325 // find the first node that the ent's box crosses
326  node = sv_areanodes;
327  while (1)
328  {
329  if (node->axis == -1)
330  break;
331  if (ent->absmin[node->axis] > node->dist)
332  node = node->children[0];
333  else if (ent->absmax[node->axis] < node->dist)
334  node = node->children[1];
335  else
336  break; // crosses the node
337  }
338 
339  // link it in
340  if (ent->solid == SOLID_TRIGGER)
341  InsertLinkBefore (&ent->area, &node->trigger_edicts);
342  else
343  InsertLinkBefore (&ent->area, &node->solid_edicts);
344 
345 }

Referenced by PF_setmodel(), and SV_InitGameProgs().

◆ SV_Map()

void SV_Map ( qboolean  attractloop,
char *  levelstring,
qboolean  loadgame 
)

Definition at line 393 of file sv_init.c.

394 {
395  char level[MAX_QPATH];
396  char *ch;
397  int l;
398  char spawnpoint[MAX_QPATH];
399 
400  sv.loadgame = loadgame;
401  sv.attractloop = attractloop;
402 
403  if (sv.state == ss_dead && !sv.loadgame)
404  SV_InitGame (); // the game is just starting
405 
406  strcpy (level, levelstring);
407 
408  // if there is a + in the map, set nextserver to the remainder
409  ch = strstr(level, "+");
410  if (ch)
411  {
412  *ch = 0;
413  Cvar_Set ("nextserver", va("gamemap \"%s\"", ch+1));
414  }
415  else
416  Cvar_Set ("nextserver", "");
417 
418  //ZOID special hack for end game screen in coop mode
419  if (Cvar_VariableValue ("coop") && !Q_stricmp(level, "victory.pcx"))
420  Cvar_Set ("nextserver", "gamemap \"*base1\"");
421 
422  // if there is a $, use the remainder as a spawnpoint
423  ch = strstr(level, "$");
424  if (ch)
425  {
426  *ch = 0;
427  strcpy (spawnpoint, ch+1);
428  }
429  else
430  spawnpoint[0] = 0;
431 
432  // skip the end-of-unit flag if necessary
433  if (level[0] == '*')
434  strcpy (level, level+1);
435 
436  l = strlen(level);
437  if (l > 4 && !strcmp (level+l-4, ".cin") )
438  {
439  SCR_BeginLoadingPlaque (); // for local system
440  SV_BroadcastCommand ("changing\n");
441  SV_SpawnServer (level, spawnpoint, ss_cinematic, attractloop, loadgame);
442  }
443  else if (l > 4 && !strcmp (level+l-4, ".dm2") )
444  {
445  SCR_BeginLoadingPlaque (); // for local system
446  SV_BroadcastCommand ("changing\n");
447  SV_SpawnServer (level, spawnpoint, ss_demo, attractloop, loadgame);
448  }
449  else if (l > 4 && !strcmp (level+l-4, ".pcx") )
450  {
451  SCR_BeginLoadingPlaque (); // for local system
452  SV_BroadcastCommand ("changing\n");
453  SV_SpawnServer (level, spawnpoint, ss_pic, attractloop, loadgame);
454  }
455  else
456  {
457  SCR_BeginLoadingPlaque (); // for local system
458  SV_BroadcastCommand ("changing\n");
460  SV_SpawnServer (level, spawnpoint, ss_game, attractloop, loadgame);
461  Cbuf_CopyToDefer ();
462  }
463 
464  SV_BroadcastCommand ("reconnect\n");
465 }

Referenced by SV_DemoMap_f(), SV_GameMap_f(), and SV_Loadgame_f().

◆ SV_ModelIndex()

int SV_ModelIndex ( char *  name)

Definition at line 64 of file sv_init.c.

65 {
66  return SV_FindIndex (name, CS_MODELS, MAX_MODELS, true);
67 }

Referenced by PF_setmodel(), and SV_InitGameProgs().

◆ SV_Multicast()

void SV_Multicast ( vec3_t  origin,
multicast_t  to 
)

Definition at line 161 of file sv_send.c.

162 {
163  client_t *client;
164  byte *mask;
165  int leafnum, cluster;
166  int j;
167  qboolean reliable;
168  int area1, area2;
169 
170  reliable = false;
171 
172  if (to != MULTICAST_ALL_R && to != MULTICAST_ALL)
173  {
174  leafnum = CM_PointLeafnum (origin);
175  area1 = CM_LeafArea (leafnum);
176  }
177  else
178  {
179  leafnum = 0; // just to avoid compiler warnings
180  area1 = 0;
181  }
182 
183  // if doing a serverrecord, store everything
184  if (svs.demofile)
186 
187  switch (to)
188  {
189  case MULTICAST_ALL_R:
190  reliable = true; // intentional fallthrough
191  case MULTICAST_ALL:
192  leafnum = 0;
193  mask = NULL;
194  break;
195 
196  case MULTICAST_PHS_R:
197  reliable = true; // intentional fallthrough
198  case MULTICAST_PHS:
199  leafnum = CM_PointLeafnum (origin);
200  cluster = CM_LeafCluster (leafnum);
201  mask = CM_ClusterPHS (cluster);
202  break;
203 
204  case MULTICAST_PVS_R:
205  reliable = true; // intentional fallthrough
206  case MULTICAST_PVS:
207  leafnum = CM_PointLeafnum (origin);
208  cluster = CM_LeafCluster (leafnum);
209  mask = CM_ClusterPVS (cluster);
210  break;
211 
212  default:
213  mask = NULL;
214  Com_Error (ERR_FATAL, "SV_Multicast: bad to:%i", to);
215  }
216 
217  // send the data to all relevent clients
218  for (j = 0, client = svs.clients; j < maxclients->value; j++, client++)
219  {
220  if (client->state == cs_free || client->state == cs_zombie)
221  continue;
222  if (client->state != cs_spawned && !reliable)
223  continue;
224 
225  if (mask)
226  {
227  leafnum = CM_PointLeafnum (client->edict->s.origin);
228  cluster = CM_LeafCluster (leafnum);
229  area2 = CM_LeafArea (leafnum);
230  if (!CM_AreasConnected (area1, area2))
231  continue;
232  if ( mask && (!(mask[cluster>>3] & (1<<(cluster&7)) ) ) )
233  continue;
234  }
235 
236  if (reliable)
238  else
240  }
241 
242  SZ_Clear (&sv.multicast);
243 }

Referenced by PF_Configstring(), SV_BroadcastCommand(), SV_FindIndex(), SV_InitGameProgs(), and SV_StartSound().

◆ SV_Nextserver()

void SV_Nextserver ( void  )

Definition at line 405 of file sv_user.c.

406 {
407  char *v;
408 
409  //ZOID, ss_pic can be nextserver'd in coop mode
410  if (sv.state == ss_game || (sv.state == ss_pic && !Cvar_VariableValue("coop")))
411  return; // can't nextserver while playing a normal game
412 
413  svs.spawncount++; // make sure another doesn't sneak in
414  v = Cvar_VariableString ("nextserver");
415  if (!v[0])
416  Cbuf_AddText ("killserver\n");
417  else
418  {
419  Cbuf_AddText (v);
420  Cbuf_AddText ("\n");
421  }
422  Cvar_Set ("nextserver","");
423 }

Referenced by SV_DemoCompleted(), and SV_Nextserver_f().

◆ SV_PointContents()

int SV_PointContents ( vec3_t  p)

Definition at line 431 of file sv_world.c.

432 {
433  edict_t *touch[MAX_EDICTS], *hit;
434  int i, num;
435  int contents, c2;
436  int headnode;
437  float *angles;
438 
439  // get base contents from world
440  contents = CM_PointContents (p, sv.models[1]->headnode);
441 
442  // or in contents from all the other entities
443  num = SV_AreaEdicts (p, p, touch, MAX_EDICTS, AREA_SOLID);
444 
445  for (i=0 ; i<num ; i++)
446  {
447  hit = touch[i];
448 
449  // might intersect, so do an exact clip
450  headnode = SV_HullForEntity (hit);
451  angles = hit->s.angles;
452  if (hit->solid != SOLID_BSP)
453  angles = vec3_origin; // boxes don't rotate
454 
455  c2 = CM_TransformedPointContents (p, headnode, hit->s.origin, hit->s.angles);
456 
457  contents |= c2;
458  }
459 
460  return contents;
461 }

Referenced by SV_InitGameProgs().

◆ SV_PrepWorldFrame()

void SV_PrepWorldFrame ( void  )

Definition at line 703 of file sv_main.c.

704 {
705  edict_t *ent;
706  int i;
707 
708  for (i=0 ; i<ge->num_edicts ; i++, ent++)
709  {
710  ent = EDICT_NUM(i);
711  // events only last for a single message
712  ent->s.event = 0;
713  }
714 
715 }

Referenced by SV_Frame().

◆ SV_ReadLevelFile()

void SV_ReadLevelFile ( void  )

Definition at line 306 of file sv_ccmds.c.

307 {
308  char name[MAX_OSPATH];
309  FILE *f;
310 
311  Com_DPrintf("SV_ReadLevelFile()\n");
312 
313  Com_sprintf (name, sizeof(name), "%s/save/current/%s.sv2", FS_Gamedir(), sv.name);
314  f = fopen(name, "rb");
315  if (!f)
316  {
317  Com_Printf ("Failed to open %s\n", name);
318  return;
319  }
320  FS_Read (sv.configstrings, sizeof(sv.configstrings), f);
321  CM_ReadPortalState (f);
322  fclose (f);
323 
324  Com_sprintf (name, sizeof(name), "%s/save/current/%s.sav", FS_Gamedir(), sv.name);
325  ge->ReadLevel (name);
326 }

Referenced by SV_CheckForSavegame().

◆ SV_RecordDemoMessage()

void SV_RecordDemoMessage ( void  )

Definition at line 682 of file sv_ents.c.

683 {
684  int e;
685  edict_t *ent;
686  entity_state_t nostate;
687  sizebuf_t buf;
688  byte buf_data[32768];
689  int len;
690 
691  if (!svs.demofile)
692  return;
693 
694  memset (&nostate, 0, sizeof(nostate));
695  SZ_Init (&buf, buf_data, sizeof(buf_data));
696 
697  // write a frame message that doesn't contain a player_state_t
698  MSG_WriteByte (&buf, svc_frame);
699  MSG_WriteLong (&buf, sv.framenum);
700 
702 
703  e = 1;
704  ent = EDICT_NUM(e);
705  while (e < ge->num_edicts)
706  {
707  // ignore ents without visible models unless they have an effect
708  if (ent->inuse &&
709  ent->s.number &&
710  (ent->s.modelindex || ent->s.effects || ent->s.sound || ent->s.event) &&
711  !(ent->svflags & SVF_NOCLIENT))
712  MSG_WriteDeltaEntity (&nostate, &ent->s, &buf, false, true);
713 
714  e++;
715  ent = EDICT_NUM(e);
716  }
717 
718  MSG_WriteShort (&buf, 0); // end of packetentities
719 
720  // now add the accumulated multicast information
723 
724  // now write the entire message to the file, prefixed by the length
725  len = LittleLong (buf.cursize);
726  fwrite (&len, 4, 1, svs.demofile);
727  fwrite (buf.data, buf.cursize, 1, svs.demofile);
728 }

Referenced by SV_Frame().

◆ SV_SendClientMessages()

void SV_SendClientMessages ( void  )

Definition at line 490 of file sv_send.c.

491 {
492  int i;
493  client_t *c;
494  int msglen;
495  byte msgbuf[MAX_MSGLEN];
496  int r;
497 
498  msglen = 0;
499 
500  // read the next demo message if needed
501  if (sv.state == ss_demo && sv.demofile)
502  {
503  if (sv_paused->value)
504  msglen = 0;
505  else
506  {
507  // get the next message
508  r = fread (&msglen, 4, 1, sv.demofile);
509  if (r != 1)
510  {
511  SV_DemoCompleted ();
512  return;
513  }
514  msglen = LittleLong (msglen);
515  if (msglen == -1)
516  {
517  SV_DemoCompleted ();
518  return;
519  }
520  if (msglen > MAX_MSGLEN)
521  Com_Error (ERR_DROP, "SV_SendClientMessages: msglen > MAX_MSGLEN");
522  r = fread (msgbuf, msglen, 1, sv.demofile);
523  if (r != 1)
524  {
525  SV_DemoCompleted ();
526  return;
527  }
528  }
529  }
530 
531  // send a message to each connected client
532  for (i=0, c = svs.clients ; i<maxclients->value; i++, c++)
533  {
534  if (!c->state)
535  continue;
536  // if the reliable message overflowed,
537  // drop the client
538  if (c->netchan.message.overflowed)
539  {
540  SZ_Clear (&c->netchan.message);
541  SZ_Clear (&c->datagram);
542  SV_BroadcastPrintf (PRINT_HIGH, "%s overflowed\n", c->name);
543  SV_DropClient (c);
544  }
545 
546  if (sv.state == ss_cinematic
547  || sv.state == ss_demo
548  || sv.state == ss_pic
549  )
550  Netchan_Transmit (&c->netchan, msglen, msgbuf);
551  else if (c->state == cs_spawned)
552  {
553  // don't overrun bandwidth
554  if (SV_RateDrop (c))
555  continue;
556 
558  }
559  else
560  {
561  // just update reliable if needed
562  if (c->netchan.message.cursize || curtime - c->netchan.last_sent > 1000 )
563  Netchan_Transmit (&c->netchan, 0, NULL);
564  }
565  }
566 }

Referenced by SV_Frame(), and SV_Map().

◆ SV_SendServerinfo()

void SV_SendServerinfo ( client_t client)

◆ SV_ShutdownGameProgs()

void SV_ShutdownGameProgs ( void  )

Definition at line 307 of file sv_game.c.

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

Referenced by SV_InitGameProgs(), and SV_Shutdown().

◆ SV_SoundIndex()

int SV_SoundIndex ( char *  name)

Definition at line 69 of file sv_init.c.

70 {
71  return SV_FindIndex (name, CS_SOUNDS, MAX_SOUNDS, true);
72 }

Referenced by SV_InitGameProgs().

◆ SV_StartSound()

void SV_StartSound ( vec3_t  origin,
edict_t entity,
int  channel,
int  soundindex,
float  volume,
float  attenuation,
float  timeofs 
)

Definition at line 272 of file sv_send.c.

275 {
276  int sendchan;
277  int flags;
278  int i;
279  int ent;
280  vec3_t origin_v;
281  qboolean use_phs;
282 
283  if (volume < 0 || volume > 1.0)
284  Com_Error (ERR_FATAL, "SV_StartSound: volume = %f", volume);
285 
286  if (attenuation < 0 || attenuation > 4)
287  Com_Error (ERR_FATAL, "SV_StartSound: attenuation = %f", attenuation);
288 
289 // if (channel < 0 || channel > 15)
290 // Com_Error (ERR_FATAL, "SV_StartSound: channel = %i", channel);
291 
292  if (timeofs < 0 || timeofs > 0.255)
293  Com_Error (ERR_FATAL, "SV_StartSound: timeofs = %f", timeofs);
294 
295  ent = NUM_FOR_EDICT(entity);
296 
297  if (channel & 8) // no PHS flag
298  {
299  use_phs = false;
300  channel &= 7;
301  }
302  else
303  use_phs = true;
304 
305  sendchan = (ent<<3) | (channel&7);
306 
307  flags = 0;
308  if (volume != DEFAULT_SOUND_PACKET_VOLUME)
309  flags |= SND_VOLUME;
310  if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
311  flags |= SND_ATTENUATION;
312 
313  // the client doesn't know that bmodels have weird origins
314  // the origin can also be explicitly set
315  if ( (entity->svflags & SVF_NOCLIENT)
316  || (entity->solid == SOLID_BSP)
317  || origin )
318  flags |= SND_POS;
319 
320  // always send the entity number for channel overrides
321  flags |= SND_ENT;
322 
323  if (timeofs)
324  flags |= SND_OFFSET;
325 
326  // use the entity origin unless it is a bmodel or explicitly specified
327  if (!origin)
328  {
329  origin = origin_v;
330  if (entity->solid == SOLID_BSP)
331  {
332  for (i=0 ; i<3 ; i++)
333  origin_v[i] = entity->s.origin[i]+0.5*(entity->mins[i]+entity->maxs[i]);
334  }
335  else
336  {
337  VectorCopy (entity->s.origin, origin_v);
338  }
339  }
340 
342  MSG_WriteByte (&sv.multicast, flags);
343  MSG_WriteByte (&sv.multicast, soundindex);
344 
345  if (flags & SND_VOLUME)
346  MSG_WriteByte (&sv.multicast, volume*255);
347  if (flags & SND_ATTENUATION)
348  MSG_WriteByte (&sv.multicast, attenuation*64);
349  if (flags & SND_OFFSET)
350  MSG_WriteByte (&sv.multicast, timeofs*1000);
351 
352  if (flags & SND_ENT)
353  MSG_WriteShort (&sv.multicast, sendchan);
354 
355  if (flags & SND_POS)
356  MSG_WritePos (&sv.multicast, origin);
357 
358  // if the sound doesn't attenuate,send it to everyone
359  // (global radio chatter, voiceovers, etc)
360  if (attenuation == ATTN_NONE)
361  use_phs = false;
362 
363  if (channel & CHAN_RELIABLE)
364  {
365  if (use_phs)
366  SV_Multicast (origin, MULTICAST_PHS_R);
367  else
368  SV_Multicast (origin, MULTICAST_ALL_R);
369  }
370  else
371  {
372  if (use_phs)
373  SV_Multicast (origin, MULTICAST_PHS);
374  else
375  SV_Multicast (origin, MULTICAST_ALL);
376  }
377 }

Referenced by PF_StartSound(), and SV_InitGameProgs().

◆ SV_Status_f()

void SV_Status_f ( void  )

Definition at line 737 of file sv_ccmds.c.

738 {
739  int i, j, l;
740  client_t *cl;
741  char *s;
742  int ping;
743  if (!svs.clients)
744  {
745  Com_Printf ("No server running.\n");
746  return;
747  }
748  Com_Printf ("map : %s\n", sv.name);
749 
750  Com_Printf ("num score ping name lastmsg address qport \n");
751  Com_Printf ("--- ----- ---- --------------- ------- --------------------- ------\n");
752  for (i=0,cl=svs.clients ; i<maxclients->value; i++,cl++)
753  {
754  if (!cl->state)
755  continue;
756  Com_Printf ("%3i ", i);
757  Com_Printf ("%5i ", cl->edict->client->ps.stats[STAT_FRAGS]);
758 
759  if (cl->state == cs_connected)
760  Com_Printf ("CNCT ");
761  else if (cl->state == cs_zombie)
762  Com_Printf ("ZMBI ");
763  else
764  {
765  ping = cl->ping < 9999 ? cl->ping : 9999;
766  Com_Printf ("%4i ", ping);
767  }
768 
769  Com_Printf ("%s", cl->name);
770  l = 16 - strlen(cl->name);
771  for (j=0 ; j<l ; j++)
772  Com_Printf (" ");
773 
774  Com_Printf ("%7i ", svs.realtime - cl->lastmessage );
775 
776  s = NET_AdrToString ( cl->netchan.remote_address);
777  Com_Printf ("%s", s);
778  l = 22 - strlen(s);
779  for (j=0 ; j<l ; j++)
780  Com_Printf (" ");
781 
782  Com_Printf ("%5i", cl->netchan.qport);
783 
784  Com_Printf ("\n");
785  }
786  Com_Printf ("\n");
787 }

Referenced by SV_InitOperatorCommands().

◆ SV_Trace()

trace_t SV_Trace ( vec3_t  start,
vec3_t  mins,
vec3_t  maxs,
vec3_t  end,
edict_t passedict,
int  contentmask 
)

Definition at line 624 of file sv_world.c.

625 {
626  moveclip_t clip;
627 
628  if (!mins)
629  mins = vec3_origin;
630  if (!maxs)
631  maxs = vec3_origin;
632 
633  memset ( &clip, 0, sizeof ( moveclip_t ) );
634 
635  // clip to world
636  clip.trace = CM_BoxTrace (start, end, mins, maxs, 0, contentmask);
637  clip.trace.ent = ge->edicts;
638  if (clip.trace.fraction == 0)
639  return clip.trace; // blocked by the world
640 
641  clip.contentmask = contentmask;
642  clip.start = start;
643  clip.end = end;
644  clip.mins = mins;
645  clip.maxs = maxs;
646  clip.passedict = passedict;
647 
648  VectorCopy (mins, clip.mins2);
649  VectorCopy (maxs, clip.maxs2);
650 
651  // create the bounding box of the entire move
652  SV_TraceBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs );
653 
654  // clip to other solid entities
655  SV_ClipMoveToEntities ( &clip );
656 
657  return clip.trace;
658 }

Referenced by SV_InitGameProgs().

◆ SV_UnlinkEdict()

void SV_UnlinkEdict ( edict_t ent)

Definition at line 149 of file sv_world.c.

150 {
151  if (!ent->area.prev)
152  return; // not linked in anywhere
153  RemoveLink (&ent->area);
154  ent->area.prev = ent->area.next = NULL;
155 }

Referenced by SV_InitGameProgs(), and SV_LinkEdict().

◆ SV_UserinfoChanged()

void SV_UserinfoChanged ( client_t cl)

Definition at line 901 of file sv_main.c.

902 {
903  char *val;
904  int i;
905 
906  // call prog code to allow overrides
907  ge->ClientUserinfoChanged (cl->edict, cl->userinfo);
908 
909  // name for C code
910  strncpy (cl->name, Info_ValueForKey (cl->userinfo, "name"), sizeof(cl->name)-1);
911  // mask off high bit
912  for (i=0 ; i<sizeof(cl->name) ; i++)
913  cl->name[i] &= 127;
914 
915  // rate command
916  val = Info_ValueForKey (cl->userinfo, "rate");
917  if (strlen(val))
918  {
919  i = atoi(val);
920  cl->rate = i;
921  if (cl->rate < 100)
922  cl->rate = 100;
923  if (cl->rate > 15000)
924  cl->rate = 15000;
925  }
926  else
927  cl->rate = 5000;
928 
929  // msg command
930  val = Info_ValueForKey (cl->userinfo, "msg");
931  if (strlen(val))
932  {
933  cl->messagelevel = atoi(val);
934  }
935 
936 }

Referenced by SV_ExecuteClientMessage(), and SVC_DirectConnect().

◆ SV_WriteClientdataToMessage()

void SV_WriteClientdataToMessage ( client_t client,
sizebuf_t msg 
)

◆ SV_WriteFrameToClient()

void SV_WriteFrameToClient ( client_t client,
sizebuf_t msg 
)

Definition at line 415 of file sv_ents.c.

416 {
417  client_frame_t *frame, *oldframe;
418  int lastframe;
419 
420 //Com_Printf ("%i -> %i\n", client->lastframe, sv.framenum);
421  // this is the frame we are creating
422  frame = &client->frames[sv.framenum & UPDATE_MASK];
423 
424  if (client->lastframe <= 0)
425  { // client is asking for a retransmit
426  oldframe = NULL;
427  lastframe = -1;
428  }
429  else if (sv.framenum - client->lastframe >= (UPDATE_BACKUP - 3) )
430  { // client hasn't gotten a good message through in a long time
431 // Com_Printf ("%s: Delta request from out-of-date packet.\n", client->name);
432  oldframe = NULL;
433  lastframe = -1;
434  }
435  else
436  { // we have a valid message to delta from
437  oldframe = &client->frames[client->lastframe & UPDATE_MASK];
438  lastframe = client->lastframe;
439  }
440 
443  MSG_WriteLong (msg, lastframe); // what we are delta'ing from
444  MSG_WriteByte (msg, client->surpressCount); // rate dropped packets
445  client->surpressCount = 0;
446 
447  // send over the areabits
448  MSG_WriteByte (msg, frame->areabytes);
449  SZ_Write (msg, frame->areabits, frame->areabytes);
450 
451  // delta encode the playerstate
452  SV_WritePlayerstateToClient (oldframe, frame, msg);
453 
454  // delta encode the entities
455  SV_EmitPacketEntities (oldframe, frame, msg);
456 }

Referenced by SV_SendClientDatagram().

Variable Documentation

◆ ge

◆ master_adr

netadr_t master_adr[MAX_MASTERS]

Definition at line 23 of file sv_main.c.

Referenced by Master_Heartbeat(), Master_Shutdown(), SV_InitGame(), and SV_SetMaster_f().

◆ maxclients

◆ net_from

◆ net_message

◆ sv

◆ sv_airaccelerate

cvar_t* sv_airaccelerate

Definition at line 43 of file sv_main.c.

Referenced by SV_Init(), and SV_SpawnServer().

◆ sv_client

◆ sv_enforcetime

cvar_t* sv_enforcetime

Definition at line 30 of file sv_main.c.

Referenced by SV_ClientThink(), and SV_Init().

◆ sv_noreload

cvar_t* sv_noreload

Definition at line 45 of file sv_main.c.

Referenced by SV_CheckForSavegame(), and SV_Init().

◆ sv_outputbuf

char sv_outputbuf[SV_OUTPUTBUF_LENGTH]

Definition at line 32 of file sv_send.c.

Referenced by SVC_RemoteCommand(), and SVC_Status().

◆ sv_paused

cvar_t* sv_paused

Definition at line 27 of file sv_main.c.

Referenced by SV_ExecuteClientMessage(), SV_Init(), SV_RunGameFrame(), and SV_SendClientMessages().

◆ sv_player

edict_t* sv_player

Definition at line 24 of file sv_user.c.

Referenced by SV_Begin_f(), SV_ExecuteClientMessage(), SV_ExecuteUserCommand(), and SV_SetPlayer().

◆ svs

client_s::lastframe
int lastframe
Definition: server.h:101
entity_state_s::old_origin
vec3_t old_origin
Definition: q_shared.h:1175
game_import_t
Definition: game.h:102
server_t::framenum
int framenum
Definition: server.h:51
SV_TraceBounds
void SV_TraceBounds(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, vec3_t boxmins, vec3_t boxmaxs)
Definition: sv_world.c:589
areanode_s::solid_edicts
link_t solid_edicts
Definition: sv_world.c:46
CL_Drop
void CL_Drop(void)
Definition: cl_main.c:412
cs_zombie
@ cs_zombie
Definition: server.h:76
MAX_CLIENTS
#define MAX_CLIENTS
Definition: q_shared.h:79
sv
server_t sv
Definition: sv_init.c:24
SV_DemoCompleted
void SV_DemoCompleted(void)
Definition: sv_send.c:440
edict_s::s
entity_state_t s
Definition: g_local.h:964
sv_player
edict_t * sv_player
Definition: sv_user.c:24
CM_BoxTrace
trace_t CM_BoxTrace(vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, int headnode, int brushmask)
Definition: cmodel.c:1350
FS_Read
void FS_Read(void *buffer, int len, FILE *f)
Definition: files.c:346
SV_ExecuteUserCommand
void SV_ExecuteUserCommand(char *s)
Definition: sv_user.c:477
area_maxcount
int area_maxcount
Definition: sv_world.c:57
dedicated
cvar_t * dedicated
Definition: common.c:47
curtime
int curtime
Definition: q_shwin.c:119
client_frame_t::num_entities
int num_entities
Definition: server.h:87
sizebuf_s
Definition: qcommon.h:75
value
GLfloat value
Definition: qgl_win.c:63
client_frame_t::areabits
byte areabits[MAX_MAP_AREAS/8]
Definition: server.h:85
client_s::datagram
sizebuf_t datagram
Definition: server.h:120
SV_Serverinfo_f
void SV_Serverinfo_f(void)
Definition: sv_ccmds.c:842
GAME_API_VERSION
#define GAME_API_VERSION
Definition: game.h:23
Sys_CopyProtect
void Sys_CopyProtect(void)
Definition: sys_win.c:186
SND_POS
#define SND_POS
Definition: qcommon.h:286
MAX_QPATH
#define MAX_QPATH
Definition: q_shared.h:73
entity_state_s::solid
int solid
Definition: q_shared.h:1182
MAX_MODELS
#define MAX_MODELS
Definition: q_shared.h:82
server_static_t::spawncount
int spawncount
Definition: server.h:165
SND_OFFSET
#define SND_OFFSET
Definition: qcommon.h:288
Z_TagMalloc
void * Z_TagMalloc(int size, int tag)
Definition: common.c:1194
client_state_t::frames
frame_t frames[UPDATE_BACKUP]
Definition: client.h:138
CS_SOUNDS
#define CS_SOUNDS
Definition: q_shared.h:1137
trace_t::fraction
float fraction
Definition: q_shared.h:453
client_frame_t::ps
player_state_t ps
Definition: server.h:86
PF_WritePos
void PF_WritePos(vec3_t pos)
Definition: sv_game.c:224
area_count
int area_count
Definition: sv_world.c:57
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:156
NS_SERVER
@ NS_SERVER
Definition: qcommon.h:536
cmodel_s::maxs
vec3_t maxs
Definition: q_shared.h:430
RD_CLIENT
@ RD_CLIENT
Definition: server.h:242
edict_s::absmax
vec3_t absmax
Definition: g_local.h:985
svc_frame
@ svc_frame
Definition: qcommon.h:229
maxclients
cvar_t * maxclients
Definition: g_main.c:44
moveclip_t::maxs
float * maxs
Definition: sv_world.c:468
SOLID_BBOX
@ SOLID_BBOX
Definition: game.h:37
SV_FatPVS
void SV_FatPVS(vec3_t org)
Definition: sv_ents.c:477
PF_setmodel
void PF_setmodel(edict_t *ent, char *name)
Definition: sv_game.c:163
entity_state_s::renderfx
int renderfx
Definition: q_shared.h:1181
SV_WritePlayerstateToClient
void SV_WritePlayerstateToClient(client_frame_t *from, client_frame_t *to, sizebuf_t *msg)
Definition: sv_ents.c:222
net_message
sizebuf_t net_message
Definition: net_chan.c:82
v
GLdouble v
Definition: qgl_win.c:143
InsertLinkBefore
void InsertLinkBefore(link_t *l, link_t *before)
Definition: sv_world.c:75
PF_WriteByte
void PF_WriteByte(int c)
Definition: sv_game.c:219
entity_state_s
Definition: q_shared.h:1169
PORT_MASTER
#define PORT_MASTER
Definition: qcommon.h:184
game_export_t::edicts
struct edict_s * edicts
Definition: game.h:229
SV_LinkEdict
void SV_LinkEdict(edict_t *ent)
Definition: sv_world.c:165
SV_SpawnServer
void SV_SpawnServer(char *server, char *spawnpoint, server_state_t serverstate, qboolean attractloop, qboolean loadgame)
Definition: sv_init.c:169
netchan_t::message
sizebuf_t message
Definition: qcommon.h:600
game_export_t::Shutdown
void(* Shutdown)(void)
Definition: game.h:189
PF_WriteDir
void PF_WriteDir(vec3_t dir)
Definition: sv_game.c:225
entity_state_s::origin
vec3_t origin
Definition: q_shared.h:1173
game_export_t::apiversion
int apiversion
Definition: game.h:183
edict_s::linkcount
int linkcount
Definition: g_local.h:971
SVF_NOCLIENT
#define SVF_NOCLIENT
Definition: game.h:27
net_from
netadr_t net_from
Definition: net_chan.c:81
moveclip_t::passedict
edict_t * passedict
Definition: sv_world.c:472
sizebuf_s::overflowed
qboolean overflowed
Definition: qcommon.h:78
SV_DemoMap_f
void SV_DemoMap_f(void)
Definition: sv_ccmds.c:465
UPDATE_BACKUP
#define UPDATE_BACKUP
Definition: qcommon.h:190
DEFAULT_SOUND_PACKET_VOLUME
#define DEFAULT_SOUND_PACKET_VOLUME
Definition: qcommon.h:290
server_static_t::realtime
int realtime
Definition: server.h:161
sizebuf_s::readcount
int readcount
Definition: qcommon.h:82
moveclip_t::contentmask
int contentmask
Definition: sv_world.c:473
CS_MODELS
#define CS_MODELS
Definition: q_shared.h:1136
qboolean
qboolean
Definition: q_shared.h:56
edict_s::inuse
qboolean inuse
Definition: g_local.h:970
SV_ServerRecord_f
void SV_ServerRecord_f(void)
Definition: sv_ccmds.c:882
edict_s::areanum2
int areanum2
Definition: g_local.h:979
MAX_TOTAL_ENT_LEAFS
#define MAX_TOTAL_ENT_LEAFS
Definition: sv_world.c:164
MAX_MASTERS
#define MAX_MASTERS
Definition: server.h:30
i
int i
Definition: q_shared.c:305
sv
server_t sv
Definition: sv_init.c:24
server_t::multicast
sizebuf_t multicast
Definition: server.h:61
cs_connected
@ cs_connected
Definition: server.h:78
moveclip_t::boxmins
vec3_t boxmins
Definition: sv_world.c:467
SV_HullForEntity
int SV_HullForEntity(edict_t *ent)
Definition: sv_world.c:488
CM_WriteAreaBits
int CM_WriteAreaBits(byte *buffer, int area)
Definition: cmodel.c:1686
CM_TransformedPointContents
int CM_TransformedPointContents(vec3_t p, int headnode, vec3_t origin, vec3_t angles)
Definition: cmodel.c:937
SV_AreaEdicts_r
void SV_AreaEdicts_r(areanode_t *node)
Definition: sv_world.c:354
SOLID_TRIGGER
@ SOLID_TRIGGER
Definition: game.h:36
game_export_t::Init
void(* Init)(void)
Definition: game.h:188
edict_s::client
struct gclient_s * client
Definition: g_local.h:965
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
SV_BroadcastPrintf
void SV_BroadcastPrintf(int level, char *fmt,...)
Definition: sv_send.c:89
area_mins
float * area_mins
Definition: sv_world.c:55
SV_GameMap_f
void SV_GameMap_f(void)
Definition: sv_ccmds.c:488
sv_numareanodes
int sv_numareanodes
Definition: sv_world.c:53
NET_AdrToString
char * NET_AdrToString(netadr_t a)
Definition: net_wins.c:156
server_static_t::next_client_entities
int next_client_entities
Definition: server.h:170
client_s::name
char name[32]
Definition: server.h:115
PF_WriteChar
void PF_WriteChar(int c)
Definition: sv_game.c:218
client_frame_t::first_entity
int first_entity
Definition: server.h:88
SZ_Init
void SZ_Init(sizebuf_t *buf, byte *data, int length)
Definition: common.c:904
SV_ShutdownGameProgs
void SV_ShutdownGameProgs(void)
Definition: sv_game.c:307
client_s::state
client_state_t state
Definition: server.h:97
edict_s::mins
vec3_t mins
Definition: g_local.h:984
Sys_UnloadGame
void Sys_UnloadGame(void)
Definition: sys_win.c:458
Cmd_Args
char * Cmd_Args(void)
Definition: cmd.c:531
PF_inPVS
qboolean PF_inPVS(vec3_t p1, vec3_t p2)
Definition: sv_game.c:236
sizebuf_s::data
byte * data
Definition: qcommon.h:79
edict_s::clusternums
int clusternums[MAX_ENT_CLUSTERS]
Definition: g_local.h:977
server_t::demofile
FILE * demofile
Definition: server.h:65
SCR_BeginLoadingPlaque
void SCR_BeginLoadingPlaque(void)
Definition: cl_scrn.c:571
MAX_STRINGCMDS
#define MAX_STRINGCMDS
Definition: sv_user.c:531
Cvar_Get
cvar_t * Cvar_Get(char *var_name, char *var_value, int flags)
Definition: cvar.c:127
CHAN_RELIABLE
#define CHAN_RELIABLE
Definition: q_shared.h:1014
SZ_Write
void SZ_Write(sizebuf_t *buf, void *data, int length)
Definition: common.c:940
SV_BroadcastCommand
void SV_BroadcastCommand(char *fmt,...)
Definition: sv_send.c:132
areanode_s::trigger_edicts
link_t trigger_edicts
Definition: sv_world.c:45
SZ_Clear
void SZ_Clear(sizebuf_t *buf)
Definition: common.c:911
PF_WriteLong
void PF_WriteLong(int c)
Definition: sv_game.c:221
game_export_t::ClientDisconnect
void(* ClientDisconnect)(edict_t *ent)
Definition: game.h:209
area_maxs
float * area_maxs
Definition: sv_world.c:55
edict_s::areanum
int areanum
Definition: g_local.h:979
moveclip_t::mins
float * mins
Definition: sv_world.c:468
STAT_FRAGS
#define STAT_FRAGS
Definition: q_shared.h:1039
SV_EmitPacketEntities
void SV_EmitPacketEntities(client_frame_t *from, client_frame_t *to, sizebuf_t *msg)
Definition: sv_ents.c:125
CM_LeafArea
int CM_LeafArea(int leafnum)
Definition: cmodel.c:681
entity_state_s::effects
unsigned int effects
Definition: q_shared.h:1180
SV_Map_f
void SV_Map_f(void)
Definition: sv_ccmds.c:557
CVAR_SERVERINFO
#define CVAR_SERVERINFO
Definition: q_shared.h:311
game_export_t::ClientUserinfoChanged
void(* ClientUserinfoChanged)(edict_t *ent, char *userinfo)
Definition: game.h:208
SV_AreaEdicts
int SV_AreaEdicts(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype)
Definition: sv_world.c:408
cmodel_s::headnode
int headnode
Definition: q_shared.h:432
server_state_t
server_state_t
Definition: server.h:32
PF_dprintf
void PF_dprintf(char *fmt,...)
Definition: sv_game.c:64
Cmd_TokenizeString
void Cmd_TokenizeString(char *text, qboolean macroExpand)
Definition: cmd.c:620
j
GLint j
Definition: qgl_win.c:150
entity_state_s::sound
int sound
Definition: q_shared.h:1185
NET_StringToAdr
qboolean NET_StringToAdr(char *s, netadr_t *a)
Definition: net_wins.c:257
CM_PointContents
int CM_PointContents(vec3_t p, int headnode)
Definition: cmodel.c:917
Cmd_Argv
char * Cmd_Argv(int arg)
Definition: cmd.c:517
va
char * va(char *format,...)
Definition: q_shared.c:1050
SV_Status_f
void SV_Status_f(void)
Definition: sv_ccmds.c:737
msg
cvar_t * msg
Definition: cl_main.c:98
server_static_t::client_entities
entity_state_t * client_entities
Definition: server.h:171
RemoveLink
void RemoveLink(link_t *l)
Definition: sv_world.c:69
Cmd_Argc
int Cmd_Argc(void)
Definition: cmd.c:507
game_export_t::ClientCommand
void(* ClientCommand)(edict_t *ent)
Definition: game.h:210
SVF_DEADMONSTER
#define SVF_DEADMONSTER
Definition: game.h:28
ATTN_NONE
#define ATTN_NONE
Definition: q_shared.h:1018
Cvar_ForceSet
cvar_t * Cvar_ForceSet(char *var_name, char *value)
Definition: cvar.c:268
CS_IMAGES
#define CS_IMAGES
Definition: q_shared.h:1138
server_static_t::clients
client_t * clients
Definition: server.h:168
SV_DumpUser_f
void SV_DumpUser_f(void)
Definition: sv_ccmds.c:856
MULTICAST_PHS
@ MULTICAST_PHS
Definition: q_shared.h:110
RF_BEAM
#define RF_BEAM
Definition: q_shared.h:620
HEARTBEAT_SECONDS
#define HEARTBEAT_SECONDS
Definition: sv_main.c:826
client_s::netchan
netchan_t netchan
Definition: server.h:134
ss_cinematic
@ ss_cinematic
Definition: server.h:36
edict_s::svflags
int svflags
Definition: g_local.h:983
SND_ATTENUATION
#define SND_ATTENUATION
Definition: qcommon.h:285
SV_AreaEdicts
int SV_AreaEdicts(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype)
Definition: sv_world.c:408
client_frame_t::areabytes
int areabytes
Definition: server.h:84
moveclip_t::trace
trace_t trace
Definition: sv_world.c:471
edict_s
Definition: g_local.h:962
SV_FindIndex
int SV_FindIndex(char *name, int start, int max, qboolean create)
Definition: sv_init.c:32
CM_ClusterPVS
byte * CM_ClusterPVS(int cluster)
Definition: cmodel.c:1575
server_static_t::num_client_entities
int num_client_entities
Definition: server.h:169
ucmd_t
Definition: sv_user.c:445
r
GLdouble GLdouble r
Definition: qgl_win.c:336
CM_AreasConnected
qboolean CM_AreasConnected(int area1, int area2)
Definition: cmodel.c:1662
LittleLong
int LittleLong(int l)
Definition: q_shared.c:948
SV_UnlinkEdict
void SV_UnlinkEdict(edict_t *ent)
Definition: sv_world.c:149
moveclip_t::boxmaxs
vec3_t boxmaxs
Definition: sv_world.c:467
Cvar_FullSet
cvar_t * Cvar_FullSet(char *var_name, char *value, int flags)
Definition: cvar.c:288
client_s::download
byte * download
Definition: server.h:125
COM_BlockSequenceCRCByte
byte COM_BlockSequenceCRCByte(byte *base, int length, int sequence)
Definition: common.c:1361
public_server
cvar_t * public_server
Definition: sv_main.c:51
PF_Unicast
void PF_Unicast(edict_t *ent, qboolean reliable)
Definition: sv_game.c:34
SV_KillServer_f
void SV_KillServer_f(void)
Definition: sv_ccmds.c:991
netchan_t::last_sent
int last_sent
Definition: qcommon.h:583
NUM_FOR_EDICT
#define NUM_FOR_EDICT(e)
Definition: server.h:70
ge
game_export_t * ge
Definition: sv_game.c:24
VectorLength
vec_t VectorLength(vec3_t v)
Definition: q_shared.c:762
svs
server_static_t svs
Definition: sv_init.c:23
player_state_t::pmove
pmove_state_t pmove
Definition: q_shared.h:1200
ss_demo
@ ss_demo
Definition: server.h:37
SV_InitGameProgs
void SV_InitGameProgs(void)
Definition: sv_game.c:325
client_s::frames
client_frame_t frames[UPDATE_BACKUP]
Definition: server.h:123
SV_Kick_f
void SV_Kick_f(void)
Definition: sv_ccmds.c:706
SV_Heartbeat_f
void SV_Heartbeat_f(void)
Definition: sv_ccmds.c:829
area_list
edict_t ** area_list
Definition: sv_world.c:56
edict_s::owner
edict_t * owner
Definition: g_local.h:988
fatpvs
byte fatpvs[65536/8]
Definition: sv_ents.c:467
Info_ValueForKey
char * Info_ValueForKey(char *s, char *key)
Definition: q_shared.c:1266
player_state_t::viewoffset
vec3_t viewoffset
Definition: q_shared.h:1205
Cmd_AddCommand
void Cmd_AddCommand(char *cmd_name, xcommand_t function)
Definition: cmd.c:691
SV_StartSound
void SV_StartSound(vec3_t origin, edict_t *entity, int channel, int soundindex, float volume, float attenuation, float timeofs)
Definition: sv_send.c:272
PF_centerprintf
void PF_centerprintf(edict_t *ent, char *fmt,...)
Definition: sv_game.c:116
client_s::lastcmd
usercmd_t lastcmd
Definition: server.h:102
sv_client
client_t * sv_client
Definition: sv_main.c:25
SV_Trace
trace_t SV_Trace(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passedict, int contentmask)
Definition: sv_world.c:624
cs_free
@ cs_free
Definition: server.h:75
SV_DropClient
void SV_DropClient(client_t *drop)
Definition: sv_main.c:70
MULTICAST_ALL_R
@ MULTICAST_ALL_R
Definition: q_shared.h:112
SV_Multicast
void SV_Multicast(vec3_t origin, multicast_t to)
Definition: sv_send.c:161
DEFAULT_SOUND_PACKET_ATTENUATION
#define DEFAULT_SOUND_PACKET_ATTENUATION
Definition: qcommon.h:291
Cbuf_AddText
void Cbuf_AddText(char *text)
Definition: cmd.c:90
cvar_s::value
float value
Definition: q_shared.h:324
MSG_ReadByte
int MSG_ReadByte(sizebuf_t *msg_read)
Definition: common.c:722
server_t::models
struct cmodel_s * models[MAX_MODELS]
Definition: server.h:54
MAX_OSPATH
#define MAX_OSPATH
Definition: q_shared.h:74
cmodel_s::mins
vec3_t mins
Definition: q_shared.h:430
MSG_WritePos
void MSG_WritePos(sizebuf_t *sb, vec3_t pos)
Definition: common.c:388
PRINT_HIGH
#define PRINT_HIGH
Definition: q_shared.h:92
ucmds
ucmd_t ucmds[]
Definition: sv_user.c:451
master_adr
netadr_t master_adr[MAX_MASTERS]
Definition: sv_main.c:23
sv_areanodes
areanode_t sv_areanodes[AREA_NODES]
Definition: sv_world.c:52
moveclip_t::start
float * start
Definition: sv_world.c:470
SV_Nextserver
void SV_Nextserver(void)
Definition: sv_user.c:405
gclient_s::ps
player_state_t ps
Definition: g_local.h:880
MSG_WriteString
void MSG_WriteString(sizebuf_t *sb, char *s)
Definition: common.c:375
entity_state_s::number
int number
Definition: q_shared.h:1171
NULL
#define NULL
Definition: q_shared.h:60
edict_s::solid
solid_t solid
Definition: g_local.h:986
CVAR_LATCH
#define CVAR_LATCH
Definition: q_shared.h:314
MSG_WriteShort
void MSG_WriteShort(sizebuf_t *sb, int c)
Definition: common.c:335
server_t::attractloop
qboolean attractloop
Definition: server.h:47
game_export_t::ReadLevel
void(* ReadLevel)(char *filename)
Definition: game.h:204
MSG_WriteByte
void MSG_WriteByte(sizebuf_t *sb, int c)
Definition: common.c:322
client_state_t
client_state_t
Definition: server.h:73
SV_SetMaster_f
void SV_SetMaster_f(void)
Definition: sv_ccmds.c:39
ucmd_t::func
void(* func)(void)
Definition: sv_user.c:448
Com_Error
void Com_Error(int code, char *fmt,...)
Definition: common.c:203
areanode_s
Definition: sv_world.c:40
client_frame_t
Definition: server.h:82
clc_userinfo
@ clc_userinfo
Definition: qcommon.h:242
Z_Malloc
void * Z_Malloc(int size)
Definition: common.c:1223
server_t::loadgame
qboolean loadgame
Definition: server.h:48
PF_error
void PF_error(char *fmt,...)
Definition: sv_game.c:143
SV_StatusString
char * SV_StatusString(void)
Definition: sv_main.c:109
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:736
areanode_s::dist
float dist
Definition: sv_world.c:43
Q_stricmp
int Q_stricmp(char *s1, char *s2)
Definition: q_shared.c:1192
moveclip_t::maxs2
vec3_t maxs2
Definition: sv_world.c:469
svs
server_static_t svs
Definition: sv_init.c:23
CM_ReadPortalState
void CM_ReadPortalState(FILE *f)
Definition: cmodel.c:1734
SOLID_NOT
@ SOLID_NOT
Definition: game.h:35
svc_disconnect
@ svc_disconnect
Definition: qcommon.h:216
SV_Multicast
void SV_Multicast(vec3_t origin, multicast_t to)
Definition: sv_send.c:161
name
cvar_t * name
Definition: cl_main.c:94
MAX_EDICTS
#define MAX_EDICTS
Definition: q_shared.h:80
SND_VOLUME
#define SND_VOLUME
Definition: qcommon.h:284
CM_BoxLeafnums
int CM_BoxLeafnums(vec3_t mins, vec3_t maxs, int *list, int listsize, int *topnode)
Definition: cmodel.c:903
SV_Savegame_f
void SV_Savegame_f(void)
Definition: sv_ccmds.c:641
NET_Config
void NET_Config(qboolean multiplayer)
Definition: net_wins.c:690
ERR_FATAL
#define ERR_FATAL
Definition: qcommon.h:735
SV_SendClientMessages
void SV_SendClientMessages(void)
Definition: sv_send.c:490
server_static_t::last_heartbeat
int last_heartbeat
Definition: server.h:173
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:157
SV_ClipMoveToEntities
void SV_ClipMoveToEntities(moveclip_t *clip)
Definition: sv_world.c:517
MAX_MSGLEN
#define MAX_MSGLEN
Definition: qcommon.h:527
PF_WriteFloat
void PF_WriteFloat(float f)
Definition: sv_game.c:222
moveclip_t::end
float * end
Definition: sv_world.c:470
SV_Shutdown
void SV_Shutdown(char *finalmsg, qboolean reconnect)
Definition: sv_main.c:1035
server_static_t::initialized
qboolean initialized
Definition: server.h:160
client_frame_t::senttime
int senttime
Definition: server.h:89
client_s::surpressCount
int surpressCount
Definition: server.h:112
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:158
game_export_t
Definition: game.h:181
ucmd_t::name
char * name
Definition: sv_user.c:447
SV_UserinfoChanged
void SV_UserinfoChanged(client_t *cl)
Definition: sv_main.c:901
SV_RateDrop
qboolean SV_RateDrop(client_t *c)
Definition: sv_send.c:459
CM_ClusterPHS
byte * CM_ClusterPHS(int cluster)
Definition: cmodel.c:1584
areanode_s::axis
int axis
Definition: sv_world.c:42
cs_spawned
@ cs_spawned
Definition: server.h:79
ge
game_export_t * ge
Definition: sv_game.c:24
redirect_t
redirect_t
Definition: server.h:242
vec3_origin
vec3_t vec3_origin
Definition: q_shared.c:24
MSG_ReadLong
int MSG_ReadLong(sizebuf_t *msg_read)
Definition: common.c:750
Z_Free
void Z_Free(void *ptr)
Definition: common.c:1141
usercmd_s
Definition: q_shared.h:513
Cbuf_CopyToDefer
void Cbuf_CopyToDefer(void)
Definition: cmd.c:147
AREA_SOLID
#define AREA_SOLID
Definition: q_shared.h:403
MULTICAST_PHS_R
@ MULTICAST_PHS_R
Definition: q_shared.h:113
SV_PointContents
int SV_PointContents(vec3_t p)
Definition: sv_world.c:431
SV_ServerCommand_f
void SV_ServerCommand_f(void)
Definition: sv_ccmds.c:1006
MSG_ReadString
char * MSG_ReadString(sizebuf_t *msg_read)
Definition: common.c:792
level
GLint level
Definition: qgl_win.c:116
FS_Gamedir
char * FS_Gamedir(void)
Definition: files.c:590
PF_inPHS
qboolean PF_inPHS(vec3_t p1, vec3_t p2)
Definition: sv_game.c:266
CM_LeafCluster
int CM_LeafCluster(int leafnum)
Definition: cmodel.c:674
SV_SoundIndex
int SV_SoundIndex(char *name)
Definition: sv_init.c:69
MSG_ReadDeltaUsercmd
void MSG_ReadDeltaUsercmd(sizebuf_t *msg_read, usercmd_t *from, usercmd_t *move)
Definition: common.c:854
MAX_SOUNDS
#define MAX_SOUNDS
Definition: q_shared.h:83
Cvar_GetLatchedVars
void Cvar_GetLatchedVars(void)
Definition: cvar.c:336
SV_ConSay_f
void SV_ConSay_f(void)
Definition: sv_ccmds.c:794
SV_UnlinkEdict
void SV_UnlinkEdict(edict_t *ent)
Definition: sv_world.c:149
MULTICAST_PVS_R
@ MULTICAST_PVS_R
Definition: q_shared.h:114
SOLID_BSP
@ SOLID_BSP
Definition: game.h:38
ss_game
@ ss_game
Definition: server.h:35
edict_s::maxs
vec3_t maxs
Definition: g_local.h:984
SV_InitGame
void SV_InitGame(void)
Definition: sv_init.c:289
SV_CreateAreaNode
areanode_t * SV_CreateAreaNode(int depth, vec3_t mins, vec3_t maxs)
Definition: sv_world.c:90
moveclip_t::mins2
vec3_t mins2
Definition: sv_world.c:469
entity_state_s::modelindex
int modelindex
Definition: q_shared.h:1176
SV_SendClientDatagram
qboolean SV_SendClientDatagram(client_t *client)
Definition: sv_send.c:395
Netchan_Transmit
void Netchan_Transmit(netchan_t *chan, int length, byte *data)
Definition: net_chan.c:213
server_t::state
server_state_t state
Definition: server.h:45
trace_t::ent
struct edict_s * ent
Definition: q_shared.h:458
sizebuf_s::cursize
int cursize
Definition: qcommon.h:81
SV_ImageIndex
int SV_ImageIndex(char *name)
Definition: sv_init.c:74
edict_s::num_clusters
int num_clusters
Definition: g_local.h:976
Netchan_OutOfBandPrint
void Netchan_OutOfBandPrint(int net_socket, netadr_t adr, char *format,...)
Definition: net_chan.c:132
Cvar_Set
cvar_t * Cvar_Set(char *var_name, char *value)
Definition: cvar.c:278
sv_paused
cvar_t * sv_paused
Definition: sv_main.c:27
RD_NONE
@ RD_NONE
Definition: server.h:242
Com_DPrintf
void Com_DPrintf(char *fmt,...)
Definition: common.c:155
Pmove
void Pmove(pmove_t *pmove)
Definition: pmove.c:1240
client_s
Definition: server.h:95
svc_packetentities
@ svc_packetentities
Definition: qcommon.h:227
FS_FreeFile
void FS_FreeFile(void *buffer)
Definition: files.c:433
moveclip_t
Definition: sv_world.c:465
edict_s::headnode
int headnode
Definition: g_local.h:978
pmove_state_t::origin
short origin[3]
Definition: q_shared.h:494
SCR_DebugGraph
void SCR_DebugGraph(float value, int color)
Definition: cl_scrn.c:139
Com_Printf
void Com_Printf(char *fmt,...)
Definition: common.c:102
MULTICAST_ALL
@ MULTICAST_ALL
Definition: q_shared.h:109
EDICT_NUM
#define EDICT_NUM(n)
Definition: server.h:69
svc_reconnect
@ svc_reconnect
Definition: qcommon.h:217
SND_ENT
#define SND_ENT
Definition: qcommon.h:287
edict_s::area
link_t area
Definition: g_local.h:974
clc_stringcmd
@ clc_stringcmd
Definition: qcommon.h:243
areanode_s::children
struct areanode_s * children[2]
Definition: sv_world.c:44
server_t::configstrings
char configstrings[MAX_CONFIGSTRINGS][MAX_QPATH]
Definition: server.h:56
clc_move
@ clc_move
Definition: qcommon.h:241
Cvar_VariableString
char * Cvar_VariableString(char *var_name)
Definition: cvar.c:79
MSG_WriteDeltaEntity
void MSG_WriteDeltaEntity(entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, qboolean newentity)
Definition: common.c:502
mask
GLint GLuint mask
Definition: qgl_win.c:317
svc_sound
@ svc_sound
Definition: qcommon.h:218
CM_SetAreaPortalState
void CM_SetAreaPortalState(int portalnum, qboolean open)
Definition: cmodel.c:1653
SV_ServerStop_f
void SV_ServerStop_f(void)
Definition: sv_ccmds.c:970
ss_pic
@ ss_pic
Definition: server.h:38
PF_cprintf
void PF_cprintf(edict_t *ent, int level, char *fmt,...)
Definition: sv_game.c:84
SV_Loadgame_f
void SV_Loadgame_f(void)
Definition: sv_ccmds.c:594
edict_s::size
vec3_t size
Definition: g_local.h:985
server_static_t::demo_multicast
sizebuf_t demo_multicast
Definition: server.h:179
ss_loading
@ ss_loading
Definition: server.h:34
SV_ClientThink
void SV_ClientThink(client_t *cl, usercmd_t *cmd)
Definition: sv_user.c:515
master_adr
netadr_t master_adr[MAX_MASTERS]
Definition: sv_main.c:23
area_type
int area_type
Definition: sv_world.c:58
svc_stufftext
@ svc_stufftext
Definition: qcommon.h:220
PF_WriteAngle
void PF_WriteAngle(float f)
Definition: sv_game.c:226
UPDATE_MASK
#define UPDATE_MASK
Definition: qcommon.h:192
entity_state_s::angles
vec3_t angles
Definition: q_shared.h:1174
RD_PACKET
@ RD_PACKET
Definition: server.h:242
cl
client_state_t cl
Definition: cl_main.c:106
CM_HeadnodeVisible
qboolean CM_HeadnodeVisible(int nodenum, byte *visbits)
Definition: cmodel.c:1748
MAX_ENT_CLUSTERS
#define MAX_ENT_CLUSTERS
Definition: game.h:49
SV_ModelIndex
int SV_ModelIndex(char *name)
Definition: sv_init.c:64
MAX_IMAGES
#define MAX_IMAGES
Definition: q_shared.h:84
MULTICAST_PVS
@ MULTICAST_PVS
Definition: q_shared.h:111
clc_nop
@ clc_nop
Definition: qcommon.h:240
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:127
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1236
edict_s::absmin
vec3_t absmin
Definition: g_local.h:985
server_t::name
char name[MAX_QPATH]
Definition: server.h:53
ss_dead
@ ss_dead
Definition: server.h:33
Sys_GetGameAPI
void * Sys_GetGameAPI(void *parms)
Definition: sys_win.c:472
CM_PointLeafnum
int CM_PointLeafnum(vec3_t p)
Definition: cmodel.c:826
svc_print
@ svc_print
Definition: qcommon.h:219
LATENCY_COUNTS
#define LATENCY_COUNTS
Definition: server.h:92
PF_WriteShort
void PF_WriteShort(int c)
Definition: sv_game.c:220
game_export_t::num_edicts
int num_edicts
Definition: game.h:231
server_static_t::demofile
FILE * demofile
Definition: server.h:178
PF_StartSound
void PF_StartSound(edict_t *entity, int channel, int sound_num, float volume, float attenuation, float timeofs)
Definition: sv_game.c:289
PF_Configstring
void PF_Configstring(int index, char *val)
Definition: sv_game.c:193
PF_WriteString
void PF_WriteString(char *s)
Definition: sv_game.c:223
Z_FreeTags
void Z_FreeTags(int tag)
Definition: common.c:1177
SV_BroadcastPrintf
void SV_BroadcastPrintf(int level, char *fmt,...)
Definition: sv_send.c:89
client_s::edict
edict_t * edict
Definition: server.h:114
Cvar_VariableValue
float Cvar_VariableValue(char *var_name)
Definition: cvar.c:63