Quake II RTX doxygen  1.0 dev
server.h File Reference
#include "shared/shared.h"
#include "shared/list.h"
#include "shared/game.h"
#include "common/bsp.h"
#include "common/cmd.h"
#include "common/cmodel.h"
#include "common/common.h"
#include "common/cvar.h"
#include "common/error.h"
#include "common/files.h"
#include "common/msg.h"
#include "common/net/net.h"
#include "common/net/chan.h"
#include "common/pmove.h"
#include "common/prompt.h"
#include "common/protocol.h"
#include "common/x86/fpu.h"
#include "common/zone.h"
#include "client/client.h"
#include "server/server.h"
#include "system/system.h"

Go to the source code of this file.

Classes

struct  client_frame_t
 
struct  server_entity_t
 
struct  server_t
 
struct  message_packet_t
 
struct  ratelimit_t
 
struct  client_s
 
struct  challenge_t
 
struct  addrmatch_t
 
struct  stuffcmd_t
 
struct  filtercmd_t
 
struct  master_t
 
struct  mapcmd_t
 
struct  server_static_s
 

Macros

#define SV_Malloc(size)   Z_TagMalloc(size, TAG_SERVER)
 
#define SV_Mallocz(size)   Z_TagMallocz(size, TAG_SERVER)
 
#define SV_CopyString(s)   Z_TagCopyString(s, TAG_SERVER)
 
#define SV_LoadFile(path, buf)   FS_LoadFileEx(path, buf, 0, TAG_SERVER)
 
#define SV_FreeFile(buf)   Z_Free(buf)
 
#define SV_DPrintf(...)
 
#define SV_BASELINES_SHIFT   6
 
#define SV_BASELINES_PER_CHUNK   (1 << SV_BASELINES_SHIFT)
 
#define SV_BASELINES_MASK   (SV_BASELINES_PER_CHUNK - 1)
 
#define SV_BASELINES_CHUNKS   (MAX_EDICTS >> SV_BASELINES_SHIFT)
 
#define SV_InfoSet(var, val)   Cvar_FullSet(var, val, CVAR_SERVERINFO|CVAR_ROM, FROM_CODE)
 
#define SV_PAUSED   0
 
#define SV_GMF_VARIABLE_FPS   0
 
#define SV_FEATURES
 
#define MVD_SPAWN_DISABLED   0
 
#define MVD_SPAWN_ENABLED   0x40000000
 
#define MVD_SPAWN_INTERNAL   0x80000000
 
#define MVD_SPAWN_MASK   0xc0000000
 
#define SV_FRAMERATE   BASE_FRAMERATE
 
#define SV_FRAMETIME   BASE_FRAMETIME
 
#define SV_FRAMEDIV   1
 
#define SV_FRAMESYNC   1
 
#define SV_CLIENTSYNC(cl)   1
 
#define EDICT_POOL(c, n)   ((edict_t *)((byte *)(c)->pool->edicts + (c)->pool->edict_size*(n)))
 
#define EDICT_NUM(n)   ((edict_t *)((byte *)ge->edicts + ge->edict_size*(n)))
 
#define NUM_FOR_EDICT(e)   ((int)(((byte *)(e) - (byte *)ge->edicts) / ge->edict_size))
 
#define MAX_TOTAL_ENT_LEAFS   128
 
#define Q2PRO_SHORTANGLES(c, e)
 
#define MSG_POOLSIZE   1024
 
#define MSG_TRESHOLD   (64 - 10)
 
#define MSG_RELIABLE   1
 
#define MSG_CLEAR   2
 
#define MSG_COMPRESS   4
 
#define MAX_SOUND_PACKET   14
 
#define RATE_MESSAGES   10
 
#define FOR_EACH_CLIENT(client)   LIST_FOR_EACH(client_t, client, &sv_clientlist, entry)
 
#define PL_S2C(cl)
 
#define PL_C2S(cl)
 
#define AVG_PING(cl)
 
#define MAX_CHALLENGES   1024
 
#define MAX_MASTERS   8
 
#define HEARTBEAT_SECONDS   300
 
#define FOR_EACH_MASTER(m)   LIST_FOR_EACH(master_t, m, &sv_masterlist, entry)
 
#define FOR_EACH_MASTER_SAFE(m, n)   LIST_FOR_EACH_SAFE(master_t, m, n, &sv_masterlist, entry)
 
#define SV_OUTPUTBUF_LENGTH   (MAX_PACKETLEN_DEFAULT - 16)
 
#define SV_ClientRedirect()   Com_BeginRedirect(RD_CLIENT, sv_outputbuf, MAX_STRING_CHARS - 1, SV_FlushRedirect)
 
#define SV_PacketRedirect()   Com_BeginRedirect(RD_PACKET, sv_outputbuf, SV_OUTPUTBUF_LENGTH, SV_FlushRedirect)
 
#define SV_MvdRegister()   (void)0
 
#define SV_MvdInit()   (void)0
 
#define SV_MvdShutdown(type)   (void)0
 
#define SV_MvdBeginFrame()   (void)0
 
#define SV_MvdEndFrame()   (void)0
 
#define SV_MvdRunClients()   (void)0
 
#define SV_MvdStatus_f()   (void)0
 
#define SV_MvdMapChanged()   (void)0
 
#define SV_MvdClientDropped(client)   (void)0
 
#define SV_MvdUnicast(ent, clientNum, reliable)   (void)0
 
#define SV_MvdMulticast(leafnum, to)   (void)0
 
#define SV_MvdConfigstring(index, string, len)   (void)0
 
#define SV_MvdBroadcastPrint(level, string)   (void)0
 
#define SV_MvdStartSound(entnum, channel, flags, soundindex, volume, attenuation, timeofs)   (void)0
 
#define SV_MvdRecord_f()   (void)0
 
#define SV_MvdStop_f()   (void)0
 
#define AC_ClientConnect(cl)   ""
 
#define AC_ClientDisconnect(cl)   (void)0
 
#define AC_ClientBegin(cl)   qtrue
 
#define AC_ClientAnnounce(cl)   (void)0
 
#define AC_ClientToken(cl, token)   (void)0
 
#define AC_Register()   (void)0
 
#define AC_Disconnect()   (void)0
 
#define AC_Connect(mvd_spawn)   (void)0
 
#define AC_Run()   (void)0
 
#define AC_List_f()   Com_Printf("This server does not support anticheat.\n")
 
#define AC_Info_f()   Com_Printf("This server does not support anticheat.\n")
 
#define SV_AlignKeyFrames(client)   (void)0
 
#define ES_INUSE(s)   ((s)->modelindex || (s)->effects || (s)->sound || (s)->event)
 

Typedefs

typedef struct client_s client_t
 
typedef struct server_static_s server_static_t
 

Enumerations

enum  clstate_t {
  cs_free, cs_zombie, cs_assigned, cs_connected,
  cs_primed, cs_spawned
}
 
enum  filteraction_t {
  FA_IGNORE, FA_PRINT, FA_STUFF, FA_KICK,
  FA_MAX
}
 
enum  redirect_t { RD_NONE, RD_CLIENT, RD_PACKET }
 

Functions

void SV_DropClient (client_t *drop, const char *reason)
 
void SV_RemoveClient (client_t *client)
 
void SV_CleanClient (client_t *client)
 
void SV_InitOperatorCommands (void)
 
void SV_UserinfoChanged (client_t *cl)
 
qboolean SV_RateLimited (ratelimit_t *r)
 
void SV_RateRecharge (ratelimit_t *r)
 
void SV_RateInit (ratelimit_t *r, const char *s)
 
addrmatch_tSV_MatchAddress (list_t *list, netadr_t *address)
 
int SV_CountClients (void)
 
void SV_ClientReset (client_t *client)
 
void SV_SpawnServer (mapcmd_t *cmd)
 
qboolean SV_ParseMapCmd (mapcmd_t *cmd)
 
void SV_InitGame (unsigned mvd_spawn)
 
void SV_FlushRedirect (int redirected, char *outputbuf, size_t len)
 
void SV_SendClientMessages (void)
 
void SV_SendAsyncPackets (void)
 
void SV_Multicast (vec3_t origin, multicast_t to)
 
void SV_ClientPrintf (client_t *cl, int level, const char *fmt,...) q_printf(3
 
void void SV_BroadcastPrintf (int level, const char *fmt,...) q_printf(2
 
void void void SV_ClientCommand (client_t *cl, const char *fmt,...) q_printf(2
 
void void void void SV_BroadcastCommand (const char *fmt,...) q_printf(1
 
void void void void void SV_ClientAddMessage (client_t *client, int flags)
 
void SV_ShutdownClientSend (client_t *client)
 
void SV_InitClientSend (client_t *newcl)
 
void SV_New_f (void)
 
void SV_Begin_f (void)
 
void SV_ExecuteClientMessage (client_t *cl)
 
void SV_CloseDownload (client_t *client)
 
void SV_AddMatch_f (list_t *list)
 
void SV_DelMatch_f (list_t *list)
 
void SV_ListMatches_f (list_t *list)
 
client_tSV_GetPlayer (const char *s, qboolean partial)
 
void SV_PrintMiscInfo (void)
 
void SV_BuildProxyClientFrame (client_t *client)
 
void SV_BuildClientFrame (client_t *client)
 
void SV_WriteFrameToClient_Default (client_t *client)
 
void SV_WriteFrameToClient_Enhanced (client_t *client)
 
void SV_InitGameProgs (void)
 
void SV_ShutdownGameProgs (void)
 
void SV_InitEdict (edict_t *e)
 
void PF_Pmove (pmove_t *pm)
 
void SV_AutoSaveBegin (mapcmd_t *cmd)
 
void SV_AutoSaveEnd (void)
 
void SV_CheckForSavegame (mapcmd_t *cmd)
 
void SV_RegisterSavegames (void)
 
int SV_NoSaveGames (void)
 
void SV_ClearWorld (void)
 
void PF_UnlinkEdict (edict_t *ent)
 
void SV_LinkEdict (cm_t *cm, edict_t *ent)
 
void PF_LinkEdict (edict_t *ent)
 
int SV_AreaEdicts (vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype)
 
qboolean SV_EdictIsVisible (cm_t *cm, edict_t *ent, byte *mask)
 
int SV_PointContents (vec3_t p)
 
trace_t q_gameabi SV_Trace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passedict, int contentmask)
 

Variables

list_t sv_masterlist
 
list_t sv_banlist
 
list_t sv_blacklist
 
list_t sv_cmdlist_connect
 
list_t sv_cmdlist_begin
 
list_t sv_filterlist
 
list_t sv_clientlist
 
server_static_t svs
 
server_t sv
 
pmoveParams_t sv_pmp
 
cvar_t * sv_hostname
 
cvar_t * sv_maxclients
 
cvar_t * sv_password
 
cvar_t * sv_reserved_slots
 
cvar_t * sv_airaccelerate
 
cvar_t * sv_qwmod
 
cvar_t * sv_enforcetime
 
cvar_t * sv_force_reconnect
 
cvar_t * sv_iplimit
 
cvar_t * sv_novis
 
cvar_t * sv_lan_force_rate
 
cvar_t * sv_calcpings_method
 
cvar_t * sv_changemapcmd
 
cvar_t * sv_strafejump_hack
 
cvar_t * sv_allow_map
 
cvar_t * sv_recycle
 
cvar_t * sv_enhanced_setplayer
 
cvar_t * sv_status_limit
 
cvar_t * sv_status_show
 
cvar_t * sv_auth_limit
 
cvar_t * sv_rcon_limit
 
cvar_t * sv_uptime
 
cvar_t * sv_allow_unconnected_cmds
 
cvar_t * g_features
 
cvar_t * map_override_path
 
cvar_t * sv_timeout
 
cvar_t * sv_zombietime
 
cvar_t * sv_ghostime
 
client_tsv_client
 
edict_t * sv_player
 
qboolean sv_pending_autosave
 
char sv_outputbuf [SV_OUTPUTBUF_LENGTH]
 
game_export_t * ge
 

Macro Definition Documentation

◆ AC_ClientAnnounce

#define AC_ClientAnnounce (   cl)    (void)0

Definition at line 674 of file server.h.

◆ AC_ClientBegin

#define AC_ClientBegin (   cl)    qtrue

Definition at line 673 of file server.h.

◆ AC_ClientConnect

#define AC_ClientConnect (   cl)    ""

Definition at line 671 of file server.h.

◆ AC_ClientDisconnect

#define AC_ClientDisconnect (   cl)    (void)0

Definition at line 672 of file server.h.

◆ AC_ClientToken

#define AC_ClientToken (   cl,
  token 
)    (void)0

Definition at line 675 of file server.h.

◆ AC_Connect

#define AC_Connect (   mvd_spawn)    (void)0

Definition at line 679 of file server.h.

◆ AC_Disconnect

#define AC_Disconnect ( )    (void)0

Definition at line 678 of file server.h.

◆ AC_Info_f

#define AC_Info_f ( )    Com_Printf("This server does not support anticheat.\n")

Definition at line 684 of file server.h.

◆ AC_List_f

#define AC_List_f ( )    Com_Printf("This server does not support anticheat.\n")

Definition at line 682 of file server.h.

◆ AC_Register

#define AC_Register ( )    (void)0

Definition at line 677 of file server.h.

◆ AC_Run

#define AC_Run ( )    (void)0

Definition at line 680 of file server.h.

◆ AVG_PING

#define AVG_PING (   cl)
Value:
(cl->avg_ping_count ? \
cl->avg_ping_time / cl->avg_ping_count : cl->ping)

Definition at line 246 of file server.h.

◆ EDICT_NUM

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

Definition at line 173 of file server.h.

◆ EDICT_POOL

#define EDICT_POOL (   c,
 
)    ((edict_t *)((byte *)(c)->pool->edicts + (c)->pool->edict_size*(n)))

Definition at line 171 of file server.h.

◆ ES_INUSE

#define ES_INUSE (   s)    ((s)->modelindex || (s)->effects || (s)->sound || (s)->event)

Definition at line 718 of file server.h.

◆ FOR_EACH_CLIENT

#define FOR_EACH_CLIENT (   client)    LIST_FOR_EACH(client_t, client, &sv_clientlist, entry)

Definition at line 239 of file server.h.

◆ FOR_EACH_MASTER

#define FOR_EACH_MASTER (   m)    LIST_FOR_EACH(master_t, m, &sv_masterlist, entry)

Definition at line 447 of file server.h.

◆ FOR_EACH_MASTER_SAFE

#define FOR_EACH_MASTER_SAFE (   m,
 
)    LIST_FOR_EACH_SAFE(master_t, m, n, &sv_masterlist, entry)

Definition at line 449 of file server.h.

◆ HEARTBEAT_SECONDS

#define HEARTBEAT_SECONDS   300

Definition at line 427 of file server.h.

◆ MAX_CHALLENGES

#define MAX_CHALLENGES   1024

Definition at line 387 of file server.h.

◆ MAX_MASTERS

#define MAX_MASTERS   8

Definition at line 426 of file server.h.

◆ MAX_SOUND_PACKET

#define MAX_SOUND_PACKET   14

Definition at line 218 of file server.h.

◆ MAX_TOTAL_ENT_LEAFS

#define MAX_TOTAL_ENT_LEAFS   128

Definition at line 176 of file server.h.

◆ MSG_CLEAR

#define MSG_CLEAR   2

Definition at line 215 of file server.h.

◆ MSG_COMPRESS

#define MSG_COMPRESS   4

Definition at line 216 of file server.h.

◆ MSG_POOLSIZE

#define MSG_POOLSIZE   1024

Definition at line 211 of file server.h.

◆ MSG_RELIABLE

#define MSG_RELIABLE   1

Definition at line 214 of file server.h.

◆ MSG_TRESHOLD

#define MSG_TRESHOLD   (64 - 10)

Definition at line 212 of file server.h.

◆ MVD_SPAWN_DISABLED

#define MVD_SPAWN_DISABLED   0

Definition at line 94 of file server.h.

◆ MVD_SPAWN_ENABLED

#define MVD_SPAWN_ENABLED   0x40000000

Definition at line 95 of file server.h.

◆ MVD_SPAWN_INTERNAL

#define MVD_SPAWN_INTERNAL   0x80000000

Definition at line 96 of file server.h.

◆ MVD_SPAWN_MASK

#define MVD_SPAWN_MASK   0xc0000000

Definition at line 97 of file server.h.

◆ NUM_FOR_EDICT

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

Definition at line 174 of file server.h.

◆ PL_C2S

#define PL_C2S (   cl)
Value:
(cl->netchan->total_received ? \
((float)cl->netchan->total_dropped / cl->netchan->total_received) * 100.0f : 0.0f)

Definition at line 244 of file server.h.

◆ PL_S2C

#define PL_S2C (   cl)
Value:
(cl->frames_sent ? \
(1.0f - (float)cl->frames_acked / cl->frames_sent) * 100.0f : 0.0f)

Definition at line 242 of file server.h.

◆ Q2PRO_SHORTANGLES

#define Q2PRO_SHORTANGLES (   c,
 
)
Value:
((c)->protocol == PROTOCOL_VERSION_Q2PRO && \
(c)->version >= PROTOCOL_VERSION_Q2PRO_SHORT_ANGLES && \
sv.state == ss_game && \
EDICT_POOL(c, e)->solid == SOLID_BSP)

Definition at line 179 of file server.h.

◆ RATE_MESSAGES

#define RATE_MESSAGES   10

Definition at line 237 of file server.h.

◆ SV_AlignKeyFrames

#define SV_AlignKeyFrames (   client)    (void)0

Definition at line 698 of file server.h.

◆ SV_BASELINES_CHUNKS

#define SV_BASELINES_CHUNKS   (MAX_EDICTS >> SV_BASELINES_SHIFT)

Definition at line 71 of file server.h.

◆ SV_BASELINES_MASK

#define SV_BASELINES_MASK   (SV_BASELINES_PER_CHUNK - 1)

Definition at line 70 of file server.h.

◆ SV_BASELINES_PER_CHUNK

#define SV_BASELINES_PER_CHUNK   (1 << SV_BASELINES_SHIFT)

Definition at line 69 of file server.h.

◆ SV_BASELINES_SHIFT

#define SV_BASELINES_SHIFT   6

Definition at line 68 of file server.h.

◆ SV_ClientRedirect

#define SV_ClientRedirect ( )    Com_BeginRedirect(RD_CLIENT, sv_outputbuf, MAX_STRING_CHARS - 1, SV_FlushRedirect)

Definition at line 584 of file server.h.

◆ SV_CLIENTSYNC

#define SV_CLIENTSYNC (   cl)    1

Definition at line 142 of file server.h.

◆ SV_CopyString

#define SV_CopyString (   s)    Z_TagCopyString(s, TAG_SERVER)

Definition at line 56 of file server.h.

◆ SV_DPrintf

#define SV_DPrintf (   ...)

Definition at line 65 of file server.h.

◆ SV_FEATURES

#define SV_FEATURES
Value:
(GMF_CLIENTNUM | GMF_PROPERINUSE | GMF_MVDSPEC | \
GMF_WANT_ALL_DISCONNECTS | GMF_ENHANCED_SAVEGAMES | \
SV_GMF_VARIABLE_FPS | GMF_EXTRA_USERINFO)

Definition at line 89 of file server.h.

◆ SV_FRAMEDIV

#define SV_FRAMEDIV   1

Definition at line 140 of file server.h.

◆ SV_FRAMERATE

#define SV_FRAMERATE   BASE_FRAMERATE

Definition at line 138 of file server.h.

◆ SV_FRAMESYNC

#define SV_FRAMESYNC   1

Definition at line 141 of file server.h.

◆ SV_FRAMETIME

#define SV_FRAMETIME   BASE_FRAMETIME

Definition at line 139 of file server.h.

◆ SV_FreeFile

#define SV_FreeFile (   buf)    Z_Free(buf)

Definition at line 58 of file server.h.

◆ SV_GMF_VARIABLE_FPS

#define SV_GMF_VARIABLE_FPS   0

Definition at line 85 of file server.h.

◆ SV_InfoSet

#define SV_InfoSet (   var,
  val 
)    Cvar_FullSet(var, val, CVAR_SERVERINFO|CVAR_ROM, FROM_CODE)

Definition at line 73 of file server.h.

◆ SV_LoadFile

#define SV_LoadFile (   path,
  buf 
)    FS_LoadFileEx(path, buf, 0, TAG_SERVER)

Definition at line 57 of file server.h.

◆ SV_Malloc

#define SV_Malloc (   size)    Z_TagMalloc(size, TAG_SERVER)

Definition at line 54 of file server.h.

◆ SV_Mallocz

#define SV_Mallocz (   size)    Z_TagMallocz(size, TAG_SERVER)

Definition at line 55 of file server.h.

◆ SV_MvdBeginFrame

#define SV_MvdBeginFrame ( )    (void)0

Definition at line 634 of file server.h.

◆ SV_MvdBroadcastPrint

#define SV_MvdBroadcastPrint (   level,
  string 
)    (void)0

Definition at line 644 of file server.h.

◆ SV_MvdClientDropped

#define SV_MvdClientDropped (   client)    (void)0

Definition at line 639 of file server.h.

◆ SV_MvdConfigstring

#define SV_MvdConfigstring (   index,
  string,
  len 
)    (void)0

Definition at line 643 of file server.h.

◆ SV_MvdEndFrame

#define SV_MvdEndFrame ( )    (void)0

Definition at line 635 of file server.h.

◆ SV_MvdInit

#define SV_MvdInit ( )    (void)0

Definition at line 632 of file server.h.

◆ SV_MvdMapChanged

#define SV_MvdMapChanged ( )    (void)0

Definition at line 638 of file server.h.

◆ SV_MvdMulticast

#define SV_MvdMulticast (   leafnum,
  to 
)    (void)0

Definition at line 642 of file server.h.

◆ SV_MvdRecord_f

#define SV_MvdRecord_f ( )    (void)0

Definition at line 649 of file server.h.

◆ SV_MvdRegister

#define SV_MvdRegister ( )    (void)0

Definition at line 631 of file server.h.

◆ SV_MvdRunClients

#define SV_MvdRunClients ( )    (void)0

Definition at line 636 of file server.h.

◆ SV_MvdShutdown

#define SV_MvdShutdown (   type)    (void)0

Definition at line 633 of file server.h.

◆ SV_MvdStartSound

#define SV_MvdStartSound (   entnum,
  channel,
  flags,
  soundindex,
  volume,
  attenuation,
  timeofs 
)    (void)0

Definition at line 645 of file server.h.

◆ SV_MvdStatus_f

#define SV_MvdStatus_f ( )    (void)0

Definition at line 637 of file server.h.

◆ SV_MvdStop_f

#define SV_MvdStop_f ( )    (void)0

Definition at line 650 of file server.h.

◆ SV_MvdUnicast

#define SV_MvdUnicast (   ent,
  clientNum,
  reliable 
)    (void)0

Definition at line 641 of file server.h.

◆ SV_OUTPUTBUF_LENGTH

#define SV_OUTPUTBUF_LENGTH   (MAX_PACKETLEN_DEFAULT - 16)

Definition at line 582 of file server.h.

◆ SV_PacketRedirect

Definition at line 587 of file server.h.

◆ SV_PAUSED

#define SV_PAUSED   0

Definition at line 79 of file server.h.

Typedef Documentation

◆ client_t

typedef struct client_s client_t

◆ server_static_t

Enumeration Type Documentation

◆ clstate_t

enum clstate_t
Enumerator
cs_free 
cs_zombie 
cs_assigned 
cs_connected 
cs_primed 
cs_spawned 

Definition at line 185 of file server.h.

185  {
186  cs_free, // can be reused for a new connection
187  cs_zombie, // client has been disconnected, but don't reuse
188  // connection for a couple seconds
189  cs_assigned, // client_t assigned, but no data received from client yet
190  cs_connected, // netchan fully established, but not in game yet
191  cs_primed, // sent serverdata, client is precaching
192  cs_spawned // client is fully in game
193 } clstate_t;

◆ filteraction_t

Enumerator
FA_IGNORE 
FA_PRINT 
FA_STUFF 
FA_KICK 
FA_MAX 

Definition at line 410 of file server.h.

410  {
411  FA_IGNORE,
412  FA_PRINT,
413  FA_STUFF,
414  FA_KICK,
415 
416  FA_MAX

◆ redirect_t

enum redirect_t
Enumerator
RD_NONE 
RD_CLIENT 
RD_PACKET 

Definition at line 581 of file server.h.

Function Documentation

◆ PF_LinkEdict()

void PF_LinkEdict ( edict_t *  ent)

Definition at line 264 of file world.c.

265 {
266  areanode_t *node;
267  server_entity_t *sent;
268  int entnum;
269 #if USE_FPS
270  int i;
271 #endif
272 
273  if (ent->area.prev)
274  PF_UnlinkEdict(ent); // unlink from old position
275 
276  if (ent == ge->edicts)
277  return; // don't add the world
278 
279  if (!ent->inuse) {
280  Com_DPrintf("%s: entity %d is not in use\n", __func__, NUM_FOR_EDICT(ent));
281  return;
282  }
283 
284  if (!sv.cm.cache) {
285  return;
286  }
287 
288  entnum = NUM_FOR_EDICT(ent);
289  sent = &sv.entities[entnum];
290 
291  // encode the size into the entity_state for client prediction
292  switch (ent->solid) {
293  case SOLID_BBOX:
294  if ((ent->svflags & SVF_DEADMONSTER) || VectorCompare(ent->mins, ent->maxs)) {
295  ent->s.solid = 0;
296  sent->solid32 = 0;
297  } else {
298  ent->s.solid = MSG_PackSolid16(ent->mins, ent->maxs);
299  sent->solid32 = MSG_PackSolid32(ent->mins, ent->maxs);
300  }
301  break;
302  case SOLID_BSP:
303  ent->s.solid = PACKED_BSP; // a SOLID_BBOX will never create this value
304  sent->solid32 = PACKED_BSP; // FIXME: use 255?
305  break;
306  default:
307  ent->s.solid = 0;
308  sent->solid32 = 0;
309  break;
310  }
311 
312  SV_LinkEdict(&sv.cm, ent);
313 
314  // if first time, make sure old_origin is valid
315  if (!ent->linkcount) {
316  VectorCopy(ent->s.origin, ent->s.old_origin);
317 #if USE_FPS
318  VectorCopy(ent->s.origin, sent->create_origin);
319  sent->create_framenum = sv.framenum;
320 #endif
321  }
322  ent->linkcount++;
323 
324 #if USE_FPS
325  // save origin for later recovery
326  i = sv.framenum & ENT_HISTORY_MASK;
327  VectorCopy(ent->s.origin, sent->history[i].origin);
328  sent->history[i].framenum = sv.framenum;
329 #endif
330 
331  if (ent->solid == SOLID_NOT)
332  return;
333 
334 // find the first node that the ent's box crosses
335  node = sv_areanodes;
336  while (1) {
337  if (node->axis == -1)
338  break;
339  if (ent->absmin[node->axis] > node->dist)
340  node = node->children[0];
341  else if (ent->absmax[node->axis] < node->dist)
342  node = node->children[1];
343  else
344  break; // crosses the node
345  }
346 
347  // link it in
348  if (ent->solid == SOLID_TRIGGER)
349  List_Append(&node->trigger_edicts, &ent->area);
350  else
351  List_Append(&node->solid_edicts, &ent->area);
352 }

Referenced by PF_setmodel(), and SV_InitGameProgs().

◆ PF_Pmove()

void PF_Pmove ( pmove_t *  pm)

Definition at line 708 of file game.c.

709 {
710  if (sv_client) {
711  Pmove(pm, &sv_client->pmp);
712  } else {
713  Pmove(pm, &sv_pmp);
714  }
715 }

Referenced by MVD_GameClientThink(), and SV_InitGameProgs().

◆ PF_UnlinkEdict()

void PF_UnlinkEdict ( edict_t *  ent)

Definition at line 256 of file world.c.

257 {
258  if (!ent->area.prev)
259  return; // not linked in anywhere
260  List_Remove(&ent->area);
261  ent->area.prev = ent->area.next = NULL;
262 }

Referenced by PF_LinkEdict(), and SV_InitGameProgs().

◆ SV_AddMatch_f()

void SV_AddMatch_f ( list_t *  list)

Definition at line 1082 of file commands.c.

1083 {
1084  char *s, buf[MAX_QPATH];
1085  addrmatch_t *match;
1086  netadr_t addr, mask;
1087  size_t len;
1088 
1089  if (Cmd_Argc() < 2) {
1090  Com_Printf("Usage: %s <address[/mask]> [comment]\n", Cmd_Argv(0));
1091  return;
1092  }
1093 
1094  s = Cmd_Argv(1);
1095  if (!parse_mask(s, &addr, &mask)) {
1096  return;
1097  }
1098 
1099  LIST_FOR_EACH(addrmatch_t, match, list, entry) {
1100  if (NET_IsEqualBaseAdr(&match->addr, &addr) &&
1101  NET_IsEqualBaseAdr(&match->mask, &mask)) {
1102  format_mask(match, buf, sizeof(buf));
1103  Com_Printf("Entry %s already exists.\n", buf);
1104  return;
1105  }
1106  }
1107 
1108  s = Cmd_ArgsFrom(2);
1109  len = strlen(s);
1110  match = Z_Malloc(sizeof(*match) + len);
1111  match->addr = addr;
1112  match->mask = mask;
1113  match->hits = 0;
1114  match->time = 0;
1115  memcpy(match->comment, s, len + 1);
1116  List_Append(list, &match->entry);
1117 }

Referenced by AC_AddException_f(), AC_AddRequirement_f(), SV_AddBan_f(), SV_AddBlackHole_f(), SV_AddGtvBan_f(), and SV_AddGtvHost_f().

◆ SV_AreaEdicts()

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

Definition at line 407 of file world.c.

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

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

◆ SV_AutoSaveBegin()

void SV_AutoSaveBegin ( mapcmd_t cmd)

Definition at line 474 of file save.c.

475 {
476  byte bitmap[MAX_CLIENTS / CHAR_BIT];
477  edict_t *ent;
478  int i;
479 
480  // check for clearing the current savegame
481  if (cmd->endofunit) {
483  return;
484  }
485 
486  if (sv.state != ss_game)
487  return;
488 
489  if (SV_NoSaveGames())
490  return;
491 
492  memset(bitmap, 0, sizeof(bitmap));
493 
494  // clear all the client inuse flags before saving so that
495  // when the level is re-entered, the clients will spawn
496  // at spawn points instead of occupying body shells
497  for (i = 0; i < sv_maxclients->integer; i++) {
498  ent = EDICT_NUM(i + 1);
499  if (ent->inuse) {
500  Q_SetBit(bitmap, i);
501  ent->inuse = qfalse;
502  }
503  }
504 
505  // save the map just exited
506  if (write_level_file())
507  Com_EPrintf("Couldn't write level file.\n");
508 
509  // we must restore these for clients to transfer over correctly
510  for (i = 0; i < sv_maxclients->integer; i++) {
511  ent = EDICT_NUM(i + 1);
512  ent->inuse = Q_IsBitSet(bitmap, i);
513  }
514 }

Referenced by SV_Map().

◆ SV_AutoSaveEnd()

void SV_AutoSaveEnd ( void  )

Definition at line 516 of file save.c.

517 {
518  if (sv.state != ss_game)
519  return;
520 
521  if (SV_NoSaveGames())
522  return;
523 
524  // save the map just entered to include the player position (client edict shell)
525  if (write_level_file())
526  {
527  Com_EPrintf("Couldn't write level file.\n");
528  return;
529  }
530 
531  // save server state
532  if (write_server_file(qtrue)) {
533  Com_EPrintf("Couldn't write server file.\n");
534  return;
535  }
536 
537  // clear whatever savegames are there
538  if (wipe_save_dir(SAVE_AUTO)) {
539  Com_EPrintf("Couldn't wipe '%s' directory.\n", SAVE_AUTO);
540  return;
541  }
542 
543  // copy off the level to the autosave slot
545  Com_EPrintf("Couldn't write '%s' directory.\n", SAVE_AUTO);
546  return;
547  }
548 }

Referenced by SV_Begin_f(), and SV_Map().

◆ SV_Begin_f()

void SV_Begin_f ( void  )

Definition at line 488 of file user.c.

489 {
490  Com_DPrintf("Begin() from %s\n", sv_client->name);
491 
492  // handle the case of a level changing while a client was connecting
493  if (sv_client->state < cs_primed) {
494  Com_DPrintf("Begin not valid -- not yet primed\n");
495  SV_New_f();
496  return;
497  }
498  if (sv_client->state > cs_primed) {
499  Com_DPrintf("Begin not valid -- already spawned\n");
500  return;
501  }
502 
503  if (!sv_client->version_string) {
504  SV_DropClient(sv_client, "!failed version probe");
505  return;
506  }
507 
508  if (sv_force_reconnect->string[0] && !sv_client->reconnected) {
509  SV_DropClient(sv_client, "!failed to reconnect");
510  return;
511  }
512 
513  if (!AC_ClientBegin(sv_client)) {
514  return;
515  }
516 
517  Com_DPrintf("Going from cs_primed to cs_spawned for %s\n",
518  sv_client->name);
520  sv_client->send_delta = 0;
521  sv_client->command_msec = 1800;
523  sv_client->http_download = qfalse;
524 
526 
528 
529  // call the game begin function
530  ge->ClientBegin(sv_player);
531 
533 
534  // The server needs to complete the autosave after the client has connected.
535  // See SV_Map (commands.c) for more information.
537  {
538  SV_AutoSaveEnd();
539  sv_pending_autosave = qfalse;
540  }
541 }

Referenced by AC_CheckTimeouts(), and AC_ParseQueryReply().

◆ SV_BroadcastCommand()

void void void void SV_BroadcastCommand ( const char *  fmt,
  ... 
)

◆ SV_BroadcastPrintf()

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

◆ SV_BuildClientFrame()

void SV_BuildClientFrame ( client_t client)

Definition at line 382 of file entities.c.

383 {
384  int e;
385  vec3_t org;
386  edict_t *ent;
387  edict_t *clent;
388  client_frame_t *frame;
389  entity_packed_t *state;
390  player_state_t *ps;
391  entity_state_t es;
392  int l;
393  int clientarea, clientcluster;
394  mleaf_t *leaf;
395  byte clientphs[VIS_MAX_BYTES];
396  byte clientpvs[VIS_MAX_BYTES];
397  qboolean ent_visible;
398  int cull_nonvisible_entities = Cvar_Get("sv_cull_nonvisible_entities", "1", CVAR_CHEAT)->integer;
399 
400  clent = client->edict;
401  if (!clent->client)
402  return; // not in game yet
403 
404  // this is the frame we are creating
405  frame = &client->frames[client->framenum & UPDATE_MASK];
406  frame->number = client->framenum;
407  frame->sentTime = com_eventTime; // save it for ping calc later
408  frame->latency = -1; // not yet acked
409 
410  client->frames_sent++;
411 
412  // find the client's PVS
413  ps = &clent->client->ps;
414  VectorMA(ps->viewoffset, 0.125f, ps->pmove.origin, org);
415 
416  leaf = CM_PointLeaf(client->cm, org);
417  clientarea = CM_LeafArea(leaf);
418  clientcluster = CM_LeafCluster(leaf);
419 
420  // calculate the visible areas
421  frame->areabytes = CM_WriteAreaBits(client->cm, frame->areabits, clientarea);
422  if (!frame->areabytes && client->protocol != PROTOCOL_VERSION_Q2PRO) {
423  frame->areabits[0] = 255;
424  frame->areabytes = 1;
425  }
426 
427  // grab the current player_state_t
428  MSG_PackPlayer(&frame->ps, ps);
429 
430  // grab the current clientNum
431  if (g_features->integer & GMF_CLIENTNUM) {
432  frame->clientNum = clent->client->clientNum;
433  } else {
434  frame->clientNum = client->number;
435  }
436 
437  if (clientcluster >= 0)
438  {
439  CM_FatPVS(client->cm, clientpvs, org, DVIS_PVS2);
440  client->last_valid_cluster = clientcluster;
441  }
442  else
443  {
444  BSP_ClusterVis(client->cm->cache, clientpvs, client->last_valid_cluster, DVIS_PVS2);
445  }
446 
447  BSP_ClusterVis(client->cm->cache, clientphs, clientcluster, DVIS_PHS);
448 
449  // build up the list of visible entities
450  frame->num_entities = 0;
451  frame->first_entity = svs.next_entity;
452 
453  for (e = 1; e < client->pool->num_edicts; e++) {
454  ent = EDICT_POOL(client, e);
455 
456  // ignore entities not in use
457  if (!ent->inuse && (g_features->integer & GMF_PROPERINUSE)) {
458  continue;
459  }
460 
461  // ignore ents without visible models
462  if (ent->svflags & SVF_NOCLIENT)
463  continue;
464 
465  // ignore ents without visible models unless they have an effect
466  if (!ent->s.modelindex && !ent->s.effects && !ent->s.sound) {
467  if (!ent->s.event) {
468  continue;
469  }
470  if (ent->s.event == EV_FOOTSTEP && client->settings[CLS_NOFOOTSTEPS]) {
471  continue;
472  }
473  }
474 
475  if ((ent->s.effects & EF_GIB) && client->settings[CLS_NOGIBS]) {
476  continue;
477  }
478 
479  ent_visible = qtrue;
480 
481  // ignore if not touching a PV leaf
482  if (ent != clent) {
483  // check area
484  if (clientcluster >= 0 && !CM_AreasConnected(client->cm, clientarea, ent->areanum)) {
485  // doors can legally straddle two areas, so
486  // we may need to check another one
487  if (!CM_AreasConnected(client->cm, clientarea, ent->areanum2)) {
488  ent_visible = qfalse; // blocked by a door
489  }
490  }
491 
492  if (ent_visible)
493  {
494  // beams just check one point for PHS
495  if (ent->s.renderfx & RF_BEAM) {
496  l = ent->clusternums[0];
497  if (!Q_IsBitSet(clientphs, l))
498  ent_visible = qfalse;
499  }
500  else {
501  if (cull_nonvisible_entities && !SV_EdictIsVisible(client->cm, ent, clientpvs)) {
502  ent_visible = qfalse;
503  }
504 
505  if (!ent->s.modelindex) {
506  // don't send sounds if they will be attenuated away
507  vec3_t delta;
508  float len;
509 
510  VectorSubtract(org, ent->s.origin, delta);
511  len = VectorLength(delta);
512  if (len > 400)
513  ent_visible = qfalse;
514  }
515  }
516  }
517  }
518 
519  if(!ent_visible && (!sv_novis->integer || !ent->s.modelindex))
520  continue;
521 
522  if (ent->s.number != e) {
523  Com_WPrintf("%s: fixing ent->s.number: %d to %d\n",
524  __func__, ent->s.number, e);
525  ent->s.number = e;
526  }
527 
528  memcpy(&es, &ent->s, sizeof(entity_state_t));
529 
530  if (!ent_visible) {
531  // if the entity is invisible, kill its sound
532  es.sound = 0;
533  }
534 
535  // add it to the circular client_entities array
537  MSG_PackEntity(state, &es, Q2PRO_SHORTANGLES(client, e));
538 
539 #if USE_FPS
540  // fix old entity origins for clients not running at
541  // full server frame rate
542  if (client->framediv != 1)
543  fix_old_origin(client, state, ent, e);
544 #endif
545 
546  // clear footsteps
547  if (state->event == EV_FOOTSTEP && client->settings[CLS_NOFOOTSTEPS]) {
548  state->event = 0;
549  }
550 
551  // hide POV entity from renderer, unless this is player's own entity
552  if (e == frame->clientNum + 1 && ent != clent &&
553  (g_features->integer & GMF_CLIENTNUM) && !Q2PRO_OPTIMIZE(client)) {
554  state->modelindex = 0;
555  }
556 
557 #if USE_MVD_CLIENT
558  if (sv.state == ss_broadcast) {
559  // spectators only need to know about inline BSP models
560  if (state->solid != PACKED_BSP)
561  state->solid = 0;
562  } else
563 #endif
564  if (ent->owner == clent) {
565  // don't mark players missiles as solid
566  state->solid = 0;
567  } else if (client->esFlags & MSG_ES_LONGSOLID) {
568  state->solid = sv.entities[e].solid32;
569  }
570 
571  svs.next_entity++;
572 
573  if (++frame->num_entities == MAX_PACKET_ENTITIES) {
574  break;
575  }
576  }
577 }

Referenced by SV_SendClientMessages().

◆ SV_BuildProxyClientFrame()

void SV_BuildProxyClientFrame ( client_t client)

◆ SV_CheckForSavegame()

void SV_CheckForSavegame ( mapcmd_t cmd)

Definition at line 550 of file save.c.

551 {
552  if (SV_NoSaveGames())
553  return;
554 
555  if (read_level_file()) {
556  // only warn when loading a regular savegame. autosave without level
557  // file is ok and simply starts the map from the beginning.
558  if (cmd->loadgame == 1)
559  Com_EPrintf("Couldn't read level file.\n");
560  return;
561  }
562 
563  if (cmd->loadgame) {
564  // called from SV_Loadgame_f
565  ge->RunFrame();
566  ge->RunFrame();
567  } else {
568  int i;
569 
570  // coming back to a level after being in a different
571  // level, so run it for ten seconds
572  for (i = 0; i < 100; i++)
573  ge->RunFrame();
574  }
575 }

Referenced by SV_SpawnServer().

◆ SV_CleanClient()

void SV_CleanClient ( client_t client)

Definition at line 135 of file main.c.

136 {
137  int i;
138 #if USE_AC_SERVER
139  string_entry_t *bad, *next;
140 
141  for (bad = client->ac_bad_files; bad; bad = next) {
142  next = bad->next;
143  Z_Free(bad);
144  }
145  client->ac_bad_files = NULL;
146 #endif
147 
148  // close any existing donwload
149  SV_CloseDownload(client);
150 
151  if (client->version_string) {
152  Z_Free(client->version_string);
153  client->version_string = NULL;
154  }
155 
156  // free baselines allocated for this client
157  for (i = 0; i < SV_BASELINES_CHUNKS; i++) {
158  if (client->baselines[i]) {
159  Z_Free(client->baselines[i]);
160  client->baselines[i] = NULL;
161  }
162  }
163 }

Referenced by SV_DropClient(), and SV_FinalMessage().

◆ SV_ClearWorld()

void SV_ClearWorld ( void  )

Definition at line 101 of file world.c.

102 {
103  mmodel_t *cm;
104  edict_t *ent;
105  int i;
106 
107  memset(sv_areanodes, 0, sizeof(sv_areanodes));
108  sv_numareanodes = 0;
109 
110  if (sv.cm.cache) {
111  cm = &sv.cm.cache->models[0];
112  SV_CreateAreaNode(0, cm->mins, cm->maxs);
113  }
114 
115  // make sure all entities are unlinked
116  for (i = 0; i < ge->max_edicts; i++) {
117  ent = EDICT_NUM(i);
118  ent->area.prev = ent->area.next = NULL;
119  }
120 }

Referenced by read_level_file(), and SV_SpawnServer().

◆ SV_ClientAddMessage()

void void void void void SV_ClientAddMessage ( client_t client,
int  flags 
)

Definition at line 399 of file send.c.

400 {
401  SV_DPrintf(1, "Added %sreliable message to %s: %"PRIz" bytes\n",
402  (flags & MSG_RELIABLE) ? "" : "un", client->name, msg_write.cursize);
403 
404  if (!msg_write.cursize) {
405  return;
406  }
407 
408  if (compress_message(client, flags)) {
409  goto clear;
410  }
411 
412  client->AddMessage(client, msg_write.data, msg_write.cursize,
413  (flags & MSG_RELIABLE) ? qtrue : qfalse);
414 
415 clear:
416  if (flags & MSG_CLEAR) {
418  }
419 }

Referenced by AC_Announce(), handle_filtercmd(), MVD_BroadcastPrintf(), MVD_ChangeLevel(), MVD_LayoutChannels(), MVD_LayoutClients(), MVD_LayoutFollow(), MVD_LayoutMenu(), MVD_LayoutScores(), MVD_ParseSound(), MVD_SwitchChannel(), MVD_UpdateConfigstring(), PF_bprintf(), PF_configstring(), PF_cprintf(), PF_StartSound(), PF_Unicast(), stuff_cmds(), SV_BeginDownload_f(), SV_BroadcastCommand(), SV_BroadcastPrintf(), SV_ClientCommand(), SV_ClientPrintf(), SV_DropClient(), SV_FlushRedirect(), SV_Multicast(), SV_New_f(), SV_StopDownload_f(), SV_Stuff_f(), SV_StuffAll_f(), write_cs_list(), write_plain_baselines(), and write_plain_configstrings().

◆ SV_ClientCommand()

void void void SV_ClientCommand ( client_t cl,
const char *  fmt,
  ... 
)

◆ SV_ClientPrintf()

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

◆ SV_ClientReset()

void SV_ClientReset ( client_t client)

Definition at line 24 of file init.c.

25 {
26  if (client->state < cs_connected) {
27  return;
28  }
29 
30  // any partially connected client will be restarted
31  client->state = cs_connected;
32  client->framenum = 1; // frame 0 can't be used
33  client->lastframe = -1;
34  client->frames_nodelta = 0;
35  client->send_delta = 0;
36  client->suppress_count = 0;
37  memset(&client->lastcmd, 0, sizeof(client->lastcmd));
38 }

Referenced by MVD_ChangeLevel(), MVD_SwitchChannel(), and SV_SpawnServer().

◆ SV_CloseDownload()

void SV_CloseDownload ( client_t client)

Definition at line 545 of file user.c.

546 {
547  if (client->download) {
548  Z_Free(client->download);
549  client->download = NULL;
550  }
551  if (client->downloadname) {
552  Z_Free(client->downloadname);
553  client->downloadname = NULL;
554  }
555  client->downloadsize = 0;
556  client->downloadcount = 0;
557  client->downloadcmd = 0;
558  client->downloadpending = qfalse;
559 }

Referenced by SV_BeginDownload_f(), SV_CleanClient(), SV_StopDownload_f(), and write_pending_download().

◆ SV_CountClients()

int SV_CountClients ( void  )

Definition at line 1296 of file main.c.

1297 {
1298  client_t *cl;
1299  int count = 0;
1300 
1301  FOR_EACH_CLIENT(cl) {
1302  if (cl->state > cs_zombie) {
1303  count++;
1304  }
1305  }
1306 
1307  return count;
1308 }

Referenced by SVC_Info().

◆ SV_DelMatch_f()

void SV_DelMatch_f ( list_t *  list)

Definition at line 1119 of file commands.c.

1120 {
1121  char *s;
1122  addrmatch_t *match, *next;
1123  netadr_t addr, mask;
1124  int i;
1125 
1126  if (Cmd_Argc() < 2) {
1127  Com_Printf("Usage: %s <address[/mask]|id|all>\n", Cmd_Argv(0));
1128  return;
1129  }
1130 
1131  if (LIST_EMPTY(list)) {
1132  Com_Printf("Address list is empty.\n");
1133  return;
1134  }
1135 
1136  s = Cmd_Argv(1);
1137  if (!strcmp(s, "all")) {
1138  LIST_FOR_EACH_SAFE(addrmatch_t, match, next, list, entry) {
1139  Z_Free(match);
1140  }
1141  List_Init(list);
1142  return;
1143  }
1144 
1145  // numeric values are just slot numbers
1146  if (COM_IsUint(s)) {
1147  i = atoi(s);
1148  if (i < 1) {
1149  Com_Printf("Bad index: %d\n", i);
1150  return;
1151  }
1152  match = LIST_INDEX(addrmatch_t, i - 1, list, entry);
1153  if (match) {
1154  goto remove;
1155  }
1156  Com_Printf("No such index: %d\n", i);
1157  return;
1158  }
1159 
1160  if (!parse_mask(s, &addr, &mask)) {
1161  return;
1162  }
1163 
1164  LIST_FOR_EACH(addrmatch_t, match, list, entry) {
1165  if (NET_IsEqualBaseAdr(&match->addr, &addr) &&
1166  NET_IsEqualBaseAdr(&match->mask, &mask)) {
1167 remove:
1168  List_Remove(&match->entry);
1169  Z_Free(match);
1170  return;
1171  }
1172  }
1173  Com_Printf("No such entry: %s\n", s);
1174 }

Referenced by AC_DelException_f(), AC_DelRequirement_f(), SV_DelBan_f(), SV_DelBlackHole_f(), SV_DelGtvBan_f(), and SV_DelGtvHost_f().

◆ SV_DropClient()

void SV_DropClient ( client_t drop,
const char *  reason 
)

Definition at line 212 of file main.c.

213 {
214  clstate_t oldstate;
215 
216  if (client->state <= cs_zombie)
217  return; // called recursively?
218 
219  oldstate = client->state;
220  client->state = cs_zombie; // become free in a few seconds
221  client->lastmessage = svs.realtime;
222 
223  // print the reason
224  if (reason)
225  print_drop_reason(client, reason, oldstate);
226 
227  // add the disconnect
228  MSG_WriteByte(svc_disconnect);
230 
231  if (oldstate == cs_spawned || (g_features->integer & GMF_WANT_ALL_DISCONNECTS)) {
232  // call the prog function for removing a client
233  // this will remove the body, among other things
234  ge->ClientDisconnect(client->edict);
235  }
236 
237  AC_ClientDisconnect(client);
238 
239  SV_CleanClient(client);
240 
241  Com_DPrintf("Going to cs_zombie for %s\n", client->name);
242 
243  // give MVD server a chance to detect if its dummy client was dropped
244  SV_MvdClientDropped(client);
245 }

Referenced by AC_ClientBegin(), AC_ClientToken(), AC_ParseDisconnect(), AC_ParseFileViolation(), AC_ParseQueryReply(), AC_ParseViolation(), add_message_old(), add_msg_packet(), find_client_slot(), handle_filtercmd(), mvd_disable(), SV_Begin_f(), SV_CheckTimeouts(), SV_Disconnect_f(), SV_ExecuteClientMessage(), SV_Kick_f(), SV_New_f(), SV_NewClientExecuteMove(), SV_OldClientExecuteMove(), SV_ParseClientCommand(), SV_ParseDeltaUserinfo(), SV_ParseFullUserinfo(), SV_SendClientMessages(), and SV_UpdateUserinfo().

◆ SV_EdictIsVisible()

qboolean SV_EdictIsVisible ( cm_t *  cm,
edict_t *  ent,
byte *  mask 
)

Definition at line 129 of file world.c.

130 {
131  int i;
132 
133  if (ent->num_clusters == -1) {
134  // too many leafs for individual check, go by headnode
135  return CM_HeadnodeVisible(CM_NodeNum(cm, ent->headnode), mask);
136  }
137 
138  // check individual leafs
139  for (i = 0; i < ent->num_clusters; i++) {
140  if (Q_IsBitSet(mask, ent->clusternums[i])) {
141  return qtrue;
142  }
143  }
144 
145  return qfalse; // not visible
146 }

Referenced by MVD_ParseSound(), PF_StartSound(), and SV_BuildClientFrame().

◆ SV_ExecuteClientMessage()

void SV_ExecuteClientMessage ( client_t cl)

Definition at line 1482 of file user.c.

1483 {
1484  int c;
1485 
1486  X86_PUSH_FPCW;
1487  X86_SINGLE_FPCW;
1488 
1489  sv_client = client;
1491 
1492  // only allow one move command
1493  moveIssued = qfalse;
1494  stringCmdCount = 0;
1495  userinfoUpdateCount = 0;
1496 
1497  while (1) {
1498  if (msg_read.readcount > msg_read.cursize) {
1499  SV_DropClient(client, "read past end of message");
1500  break;
1501  }
1502 
1503  c = MSG_ReadByte();
1504  if (c == -1)
1505  break;
1506 
1507  switch (c & SVCMD_MASK) {
1508  default:
1509 badbyte:
1510  SV_DropClient(client, "unknown command byte");
1511  break;
1512 
1513  case clc_nop:
1514  break;
1515 
1516  case clc_userinfo:
1518  break;
1519 
1520  case clc_move:
1522  break;
1523 
1524  case clc_stringcmd:
1526  break;
1527 
1528  case clc_setting:
1529  if (client->protocol < PROTOCOL_VERSION_R1Q2)
1530  goto badbyte;
1531 
1533  break;
1534 
1535  case clc_move_nodelta:
1536  case clc_move_batched:
1537  if (client->protocol != PROTOCOL_VERSION_Q2PRO)
1538  goto badbyte;
1539 
1541  break;
1542 
1543  case clc_userinfo_delta:
1544  if (client->protocol != PROTOCOL_VERSION_Q2PRO)
1545  goto badbyte;
1546 
1548  break;
1549  }
1550 
1551  if (client->state <= cs_zombie)
1552  break; // disconnect command
1553  }
1554 
1555  sv_client = NULL;
1556  sv_player = NULL;
1557 
1558  X86_POP_FPCW;
1559 }

Referenced by SV_PacketEvent().

◆ SV_FlushRedirect()

void SV_FlushRedirect ( int  redirected,
char *  outputbuf,
size_t  len 
)

Definition at line 32 of file send.c.

33 {
34  byte buffer[MAX_PACKETLEN_DEFAULT];
35 
36  if (redirected == RD_PACKET) {
37  memcpy(buffer, "\xff\xff\xff\xffprint\n", 10);
38  memcpy(buffer + 10, outputbuf, len);
39  NET_SendPacket(NS_SERVER, buffer, len + 10, &net_from);
40  } else if (redirected == RD_CLIENT) {
41  MSG_WriteByte(svc_print);
42  MSG_WriteByte(PRINT_HIGH);
43  MSG_WriteData(outputbuf, len);
44  MSG_WriteByte(0);
46  }
47 }

◆ SV_GetPlayer()

client_t* SV_GetPlayer ( const char *  s,
qboolean  partial 
)

Definition at line 127 of file commands.c.

128 {
129  client_t *other, *match;
130  int i, count;
131 
132  if (!s[0]) {
133  return NULL;
134  }
135 
136  // numeric values are just slot numbers
137  if (COM_IsUint(s)) {
138  i = atoi(s);
139  if (i < 0 || i >= sv_maxclients->integer) {
140  Com_Printf("Bad client slot number: %d\n", i);
141  return NULL;
142  }
143 
144  other = &svs.client_pool[i];
145  if (other->state <= cs_zombie) {
146  Com_Printf("Client slot %d is not active.\n", i);
147  return NULL;
148  }
149  return other;
150  }
151 
152  // check for exact name match
154  if (other->state <= cs_zombie) {
155  continue;
156  }
157  if (!strcmp(other->name, s)) {
158  return other;
159  }
160  }
161 
162  if (!partial) {
163  Com_Printf("Userid '%s' is not on the server.\n", s);
164  return NULL;
165  }
166 
167  // check for partial, case insensitive name match
168  match = NULL;
169  count = 0;
171  if (other->state <= cs_zombie) {
172  continue;
173  }
174  if (!Q_stricmp(other->name, s)) {
175  return other; // exact match
176  }
177  if (Q_stristr(other->name, s)) {
178  match = other; // partial match
179  count++;
180  }
181  }
182 
183  if (!match) {
184  Com_Printf("No clients matching '%s' found.\n", s);
185  return NULL;
186  }
187 
188  if (count > 1) {
189  Com_Printf("'%s' matches multiple clients.\n", s);
190  return NULL;
191  }
192 
193  return match;
194 }

Referenced by SV_Lag_f(), and SV_SetPlayer().

◆ SV_InitClientSend()

void SV_InitClientSend ( client_t newcl)

Definition at line 1040 of file send.c.

1041 {
1042  int i;
1043 
1044  List_Init(&newcl->msg_free_list);
1045  List_Init(&newcl->msg_unreliable_list);
1046  List_Init(&newcl->msg_reliable_list);
1047 
1048  newcl->msg_pool = SV_Malloc(sizeof(message_packet_t) * MSG_POOLSIZE);
1049  for (i = 0; i < MSG_POOLSIZE; i++) {
1050  List_Append(&newcl->msg_free_list, &newcl->msg_pool[i].entry);
1051  }
1052 
1053  // setup protocol
1054  if (newcl->netchan->type == NETCHAN_NEW) {
1055  newcl->AddMessage = add_message_new;
1057  } else {
1058  newcl->AddMessage = add_message_old;
1060  }
1061 }

Referenced by SVC_DirectConnect().

◆ SV_InitEdict()

void SV_InitEdict ( edict_t *  e)

◆ SV_InitGame()

void SV_InitGame ( unsigned  mvd_spawn)

Definition at line 361 of file init.c.

362 {
363  int i, entnum;
364  edict_t *ent;
365  client_t *client;
366 
367  if (svs.initialized) {
368  // cause any connected clients to reconnect
369  SV_Shutdown("Server restarted\n", ERR_RECONNECT | mvd_spawn);
370  } else {
371  // make sure the client is down
372  CL_Disconnect(ERR_RECONNECT);
374 
375  CM_FreeMap(&sv.cm);
377  memset(&sv, 0, sizeof(sv));
378 
379 #if USE_FPS
380  // set up default frametime for main loop
381  sv.frametime = BASE_FRAMETIME;
382 #endif
383  }
384 
385  // get any latched variable changes (maxclients, etc)
387 
388 #if !USE_CLIENT
389  Cvar_Reset(sv_recycle);
390 #endif
391 
392  if (mvd_spawn) {
393  Cvar_Set("deathmatch", "1");
394  Cvar_Set("coop", "0");
395  } else {
396  if (Cvar_VariableInteger("coop") &&
397  Cvar_VariableInteger("deathmatch")) {
398  Com_Printf("Deathmatch and Coop both set, disabling Coop\n");
399  Cvar_Set("coop", "0");
400  }
401 
402  // dedicated servers can't be single player and are usually DM
403  // so unless they explicity set coop, force it to deathmatch
404  if (COM_DEDICATED) {
405  if (!Cvar_VariableInteger("coop"))
406  Cvar_Set("deathmatch", "1");
407  }
408  }
409 
410  // init clients
411  if (Cvar_VariableInteger("deathmatch")) {
412  if (sv_maxclients->integer <= 1) {
413  Cvar_SetInteger(sv_maxclients, 8, FROM_CODE);
414  } else if (sv_maxclients->integer > CLIENTNUM_RESERVED) {
415  Cvar_SetInteger(sv_maxclients, CLIENTNUM_RESERVED, FROM_CODE);
416  }
417  } else if (Cvar_VariableInteger("coop")) {
418  if (sv_maxclients->integer <= 1 || sv_maxclients->integer > 4)
419  Cvar_Set("maxclients", "4");
420  } else { // non-deathmatch, non-coop is one player
421  Cvar_FullSet("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH, FROM_CODE);
422  }
423 
424  // enable networking
425  if (sv_maxclients->integer > 1) {
426  NET_Config(NET_SERVER);
427  }
428 
429  svs.client_pool = SV_Mallocz(sizeof(client_t) * sv_maxclients->integer);
430 
431  svs.num_entities = sv_maxclients->integer * UPDATE_BACKUP * MAX_PACKET_ENTITIES;
432  svs.entities = SV_Mallocz(sizeof(entity_packed_t) * svs.num_entities);
433 
434  // initialize MVD server
435  if (!mvd_spawn) {
436  SV_MvdInit();
437  }
438 
440 
441 #if USE_ZLIB
442  svs.z.zalloc = SV_zalloc;
443  svs.z.zfree = SV_zfree;
444  if (deflateInit2(&svs.z, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
445  -MAX_WBITS, 9, Z_DEFAULT_STRATEGY) != Z_OK) {
446  Com_Error(ERR_FATAL, "%s: deflateInit2() failed", __func__);
447  }
448 #endif
449 
450  // init game
451 #if USE_MVD_CLIENT
452  if (mvd_spawn) {
453  if (ge) {
455  }
456  ge = &mvd_ge;
457  ge->Init();
458  } else
459 #endif
461 
462  // send heartbeat very soon
463  svs.last_heartbeat = -(HEARTBEAT_SECONDS - 5) * 1000;
464 
465  for (i = 0; i < sv_maxclients->integer; i++) {
466  client = svs.client_pool + i;
467  entnum = i + 1;
468  ent = EDICT_NUM(entnum);
469  ent->s.number = entnum;
470  client->edict = ent;
471  client->number = i;
472  }
473 
474  AC_Connect(mvd_spawn);
475 
476  svs.initialized = qtrue;
477 }

Referenced by MVD_ChangeLevel(), MVD_Spawn_f(), parse_hello(), read_server_file(), and SV_Map().

◆ SV_InitGameProgs()

void SV_InitGameProgs ( void  )

Definition at line 841 of file game.c.

842 {
843  game_import_t import;
844  game_export_t *(*entry)(game_import_t *) = NULL;
845 
846  // unload anything we have now
848 
849  // for debugging or `proxy' mods
850  if (sys_forcegamelib->string[0])
851  entry = _SV_LoadGameLibrary(sys_forcegamelib->string);
852 
853  // try game first
854  if (!entry && fs_game->string[0]) {
855  entry = SV_LoadGameLibrary(fs_game->string, "q2pro_");
856  if (!entry)
857  entry = SV_LoadGameLibrary(fs_game->string, "");
858  }
859 
860  // then try baseq2
861  if (!entry) {
862  entry = SV_LoadGameLibrary(BASEGAME, "q2pro_");
863  if (!entry)
864  entry = SV_LoadGameLibrary(BASEGAME, "");
865  }
866 
867  // all paths failed
868  if (!entry)
869  Com_Error(ERR_DROP, "Failed to load game library");
870 
871  // load a new game dll
872  import.multicast = SV_Multicast;
873  import.unicast = PF_Unicast;
874  import.bprintf = PF_bprintf;
875  import.dprintf = PF_dprintf;
876  import.cprintf = PF_cprintf;
877  import.centerprintf = PF_centerprintf;
878  import.error = PF_error;
879 
880  import.linkentity = PF_LinkEdict;
881  import.unlinkentity = PF_UnlinkEdict;
882  import.BoxEdicts = SV_AreaEdicts;
883  import.trace = SV_Trace;
884  import.pointcontents = SV_PointContents;
885  import.setmodel = PF_setmodel;
886  import.inPVS = PF_inPVS;
887  import.inPHS = PF_inPHS;
888  import.Pmove = PF_Pmove;
889 
890  import.modelindex = PF_ModelIndex;
891  import.soundindex = PF_SoundIndex;
892  import.imageindex = PF_ImageIndex;
893 
894  import.configstring = PF_configstring;
895  import.sound = PF_StartSound;
896  import.positioned_sound = PF_PositionedSound;
897 
898  import.WriteChar = MSG_WriteChar;
899  import.WriteByte = MSG_WriteByte;
900  import.WriteShort = MSG_WriteShort;
901  import.WriteLong = MSG_WriteLong;
902  import.WriteFloat = PF_WriteFloat;
903  import.WriteString = MSG_WriteString;
904  import.WritePosition = MSG_WritePos;
905  import.WriteDir = MSG_WriteDir;
906  import.WriteAngle = MSG_WriteAngle;
907 
908  import.TagMalloc = PF_TagMalloc;
909  import.TagFree = Z_Free;
910  import.FreeTags = PF_FreeTags;
911 
912  import.cvar = PF_cvar;
913  import.cvar_set = Cvar_UserSet;
914  import.cvar_forceset = Cvar_Set;
915 
916  import.argc = Cmd_Argc;
917  import.argv = Cmd_Argv;
918  // original Cmd_Args() did actually return raw arguments
919  import.args = Cmd_RawArgs;
920  import.AddCommandString = PF_AddCommandString;
921 
922  import.DebugGraph = PF_DebugGraph;
923  import.SetAreaPortalState = PF_SetAreaPortalState;
924  import.AreasConnected = PF_AreasConnected;
925 
926  ge = entry(&import);
927  if (!ge) {
928  Com_Error(ERR_DROP, "Game DLL returned NULL exports");
929  }
930 
931  if (ge->apiversion != GAME_API_VERSION) {
932  Com_Error(ERR_DROP, "Game DLL is version %d, expected %d",
933  ge->apiversion, GAME_API_VERSION);
934  }
935 
936  // initialize
937  ge->Init();
938 
939  // sanitize edict_size
940  if (ge->edict_size < sizeof(edict_t) || ge->edict_size > SIZE_MAX / MAX_EDICTS) {
941  Com_Error(ERR_DROP, "Game DLL returned bad size of edict_t");
942  }
943 
944  // sanitize max_edicts
945  if (ge->max_edicts <= sv_maxclients->integer || ge->max_edicts > MAX_EDICTS) {
946  Com_Error(ERR_DROP, "Game DLL returned bad number of max_edicts");
947  }
948 }

Referenced by SV_InitGame().

◆ SV_InitOperatorCommands()

void SV_InitOperatorCommands ( void  )

Definition at line 1593 of file commands.c.

1594 {
1596 
1597  if (COM_DEDICATED)
1598  Cmd_AddCommand("say", SV_ConSay_f);
1599 }

Referenced by SV_Init().

◆ SV_LinkEdict()

void SV_LinkEdict ( cm_t *  cm,
edict_t *  ent 
)

Definition at line 156 of file world.c.

157 {
158  mleaf_t *leafs[MAX_TOTAL_ENT_LEAFS];
159  int clusters[MAX_TOTAL_ENT_LEAFS];
160  int num_leafs;
161  int i, j;
162  int area;
163  mnode_t *topnode;
164 
165  // set the size
166  VectorSubtract(ent->maxs, ent->mins, ent->size);
167 
168  // set the abs box
169  if (ent->solid == SOLID_BSP &&
170  (ent->s.angles[0] || ent->s.angles[1] || ent->s.angles[2])) {
171  // expand for rotation
172  float max, v;
173  int i;
174 
175  max = 0;
176  for (i = 0; i < 3; i++) {
177  v = Q_fabs(ent->mins[i]);
178  if (v > max)
179  max = v;
180  v = Q_fabs(ent->maxs[i]);
181  if (v > max)
182  max = v;
183  }
184  for (i = 0; i < 3; i++) {
185  ent->absmin[i] = ent->s.origin[i] - max;
186  ent->absmax[i] = ent->s.origin[i] + max;
187  }
188  } else {
189  // normal
190  VectorAdd(ent->s.origin, ent->mins, ent->absmin);
191  VectorAdd(ent->s.origin, ent->maxs, ent->absmax);
192  }
193 
194  // because movement is clipped an epsilon away from an actual edge,
195  // we must fully check even when bounding boxes don't quite touch
196  ent->absmin[0] -= 1;
197  ent->absmin[1] -= 1;
198  ent->absmin[2] -= 1;
199  ent->absmax[0] += 1;
200  ent->absmax[1] += 1;
201  ent->absmax[2] += 1;
202 
203 // link to PVS leafs
204  ent->num_clusters = 0;
205  ent->areanum = 0;
206  ent->areanum2 = 0;
207 
208  //get all leafs, including solids
209  num_leafs = CM_BoxLeafs(cm, ent->absmin, ent->absmax,
210  leafs, MAX_TOTAL_ENT_LEAFS, &topnode);
211 
212  // set areas
213  for (i = 0; i < num_leafs; i++) {
214  clusters[i] = CM_LeafCluster(leafs[i]);
215  area = CM_LeafArea(leafs[i]);
216  if (area) {
217  // doors may legally straggle two areas,
218  // but nothing should evern need more than that
219  if (ent->areanum && ent->areanum != area) {
220  if (ent->areanum2 && ent->areanum2 != area && sv.state == ss_loading) {
221  Com_DPrintf("Object touching 3 areas at %f %f %f\n",
222  ent->absmin[0], ent->absmin[1], ent->absmin[2]);
223  }
224  ent->areanum2 = area;
225  } else
226  ent->areanum = area;
227  }
228  }
229 
230  if (num_leafs >= MAX_TOTAL_ENT_LEAFS) {
231  // assume we missed some leafs, and mark by headnode
232  ent->num_clusters = -1;
233  ent->headnode = CM_NumNode(cm, topnode);
234  } else {
235  ent->num_clusters = 0;
236  for (i = 0; i < num_leafs; i++) {
237  if (clusters[i] == -1)
238  continue; // not a visible leaf
239  for (j = 0; j < i; j++)
240  if (clusters[j] == clusters[i])
241  break;
242  if (j == i) {
243  if (ent->num_clusters == MAX_ENT_CLUSTERS) {
244  // assume we missed some leafs, and mark by headnode
245  ent->num_clusters = -1;
246  ent->headnode = CM_NumNode(cm, topnode);
247  break;
248  }
249 
250  ent->clusternums[ent->num_clusters++] = clusters[i];
251  }
252  }
253  }
254 }

Referenced by MVD_LinkEdict(), and PF_LinkEdict().

◆ SV_ListMatches_f()

void SV_ListMatches_f ( list_t *  list)

Definition at line 1176 of file commands.c.

1177 {
1178  addrmatch_t *match;
1179  char last[MAX_QPATH];
1180  char addr[MAX_QPATH];
1181  int count;
1182 
1183  if (LIST_EMPTY(list)) {
1184  Com_Printf("Address list is empty.\n");
1185  return;
1186  }
1187 
1188  Com_Printf("id address/mask hits last hit comment\n"
1189  "-- ------------------ ---- ------------ -------\n");
1190  count = 1;
1191  LIST_FOR_EACH(addrmatch_t, match, list, entry) {
1192  format_mask(match, addr, sizeof(addr));
1193  if (!match->time) {
1194  strcpy(last, "never");
1195  } else {
1196  struct tm *tm = localtime(&match->time);
1197  if (!tm || !strftime(last, sizeof(last), "%d %b %H:%M", tm))
1198  strcpy(last, "???");
1199  }
1200  Com_Printf("%-2d %-18s %-4u %-12s %s\n", count, addr,
1201  match->hits, last, match->comment);
1202  count++;
1203  }
1204 }

Referenced by AC_ListExceptions_f(), AC_ListRequirements_f(), SV_ListBans_f(), SV_ListBlackHoles_f(), SV_ListGtvBans_f(), and SV_ListGtvHosts_f().

◆ SV_MatchAddress()

addrmatch_t* SV_MatchAddress ( list_t *  list,
netadr_t *  address 
)

Definition at line 370 of file main.c.

371 {
372  addrmatch_t *match;
373 
374  LIST_FOR_EACH(addrmatch_t, match, list, entry) {
375  if (NET_IsEqualBaseAdrMask(addr, &match->addr, &match->mask)) {
376  match->hits++;
377  match->time = time(NULL);
378  return match;
379  }
380  }
381 
382  return NULL;
383 }

Referenced by AC_ClientConnect(), auth_client(), permit_connection(), and SV_ConnectionlessPacket().

◆ SV_Multicast()

void SV_Multicast ( vec3_t  origin,
multicast_t  to 
)

Definition at line 255 of file send.c.

256 {
257  client_t *client;
258  byte mask[VIS_MAX_BYTES];
259  mleaf_t *leaf1, *leaf2;
260  int leafnum q_unused;
261  int flags;
262  vec3_t org;
263 
264  if (!sv.cm.cache) {
265  Com_Error(ERR_DROP, "%s: no map loaded", __func__);
266  }
267 
268  flags = 0;
269 
270  switch (to) {
271  case MULTICAST_ALL_R:
272  flags |= MSG_RELIABLE;
273  // intentional fallthrough
274  case MULTICAST_ALL:
275  leaf1 = NULL;
276  leafnum = 0;
277  break;
278  case MULTICAST_PHS_R:
279  flags |= MSG_RELIABLE;
280  // intentional fallthrough
281  case MULTICAST_PHS:
282  leaf1 = CM_PointLeaf(&sv.cm, origin);
283  leafnum = leaf1 - sv.cm.cache->leafs;
284  BSP_ClusterVis(sv.cm.cache, mask, leaf1->cluster, DVIS_PHS);
285  break;
286  case MULTICAST_PVS_R:
287  flags |= MSG_RELIABLE;
288  // intentional fallthrough
289  case MULTICAST_PVS:
290  leaf1 = CM_PointLeaf(&sv.cm, origin);
291  leafnum = leaf1 - sv.cm.cache->leafs;
292  BSP_ClusterVis(sv.cm.cache, mask, leaf1->cluster, DVIS_PVS2);
293  break;
294  default:
295  Com_Error(ERR_DROP, "SV_Multicast: bad to: %i", to);
296  }
297 
298  // send the data to all relevent clients
299  FOR_EACH_CLIENT(client) {
300  if (client->state < cs_primed) {
301  continue;
302  }
303  // do not send unreliables to connecting clients
304  if (!(flags & MSG_RELIABLE) && (client->state != cs_spawned ||
305  client->download || client->nodata)) {
306  continue;
307  }
308 
309  if (leaf1) {
310  // find the client's PVS
311 #if 0
312  player_state_t *ps = &client->edict->client->ps;
313  VectorMA(ps->viewoffset, 0.125f, ps->pmove.origin, org);
314 #else
315  // FIXME: for some strange reason, game code assumes the server
316  // uses entity origin for PVS/PHS culling, not the view origin
317  VectorCopy(client->edict->s.origin, org);
318 #endif
319  leaf2 = CM_PointLeaf(&sv.cm, org);
320  if (!CM_AreasConnected(&sv.cm, leaf1->area, leaf2->area))
321  continue;
322  if (leaf2->cluster == -1)
323  continue;
324  if (!Q_IsBitSet(mask, leaf2->cluster))
325  continue;
326  }
327 
328  SV_ClientAddMessage(client, flags);
329  }
330 
331  // add to MVD datagram
332  SV_MvdMulticast(leafnum, to);
333 
334  // clear the buffer
336 }

Referenced by PF_PositionedSound(), and SV_InitGameProgs().

◆ SV_New_f()

void SV_New_f ( void  )

Definition at line 365 of file user.c.

366 {
367  clstate_t oldstate;
368 
369  Com_DPrintf("New() from %s\n", sv_client->name);
370 
371  oldstate = sv_client->state;
372  if (sv_client->state < cs_connected) {
373  Com_DPrintf("Going from cs_assigned to cs_connected for %s\n",
374  sv_client->name);
376  sv_client->lastmessage = svs.realtime; // don't timeout
377  time(&sv_client->connect_time);
378  } else if (sv_client->state > cs_connected) {
379  Com_DPrintf("New not valid -- already primed\n");
380  return;
381  }
382 
383  // stuff some junk, drop them and expect them to be back soon
384  if (sv_force_reconnect->string[0] && !sv_client->reconnect_var[0] &&
385  !NET_IsLocalAddress(&sv_client->netchan->remote_address)) {
386  stuff_junk();
387  SV_DropClient(sv_client, NULL);
388  return;
389  }
390 
392 
393  //
394  // serverdata needs to go over for all types of servers
395  // to make sure the protocol is right, and to set the gamedir
396  //
397 
398  // create baselines for this client
400 
401  // send the serverdata
402  MSG_WriteByte(svc_serverdata);
405  MSG_WriteByte(0); // no attract loop
407  if (sv.state == ss_pic || sv.state == ss_cinematic)
408  MSG_WriteShort(-1);
409  else
411  MSG_WriteString(&sv_client->configstrings[CS_NAME * MAX_QPATH]);
412 
413  // send protocol specific stuff
414  switch (sv_client->protocol) {
415  case PROTOCOL_VERSION_R1Q2:
416  MSG_WriteByte(0); // not enhanced
418  MSG_WriteByte(0); // no advanced deltas
419  MSG_WriteByte(sv_client->pmp.strafehack);
420  break;
421  case PROTOCOL_VERSION_Q2PRO:
424  MSG_WriteByte(sv_client->pmp.strafehack);
425  MSG_WriteByte(sv_client->pmp.qwmode);
426  if (sv_client->version >= PROTOCOL_VERSION_Q2PRO_WATERJUMP_HACK) {
427  MSG_WriteByte(sv_client->pmp.waterhack);
428  }
429  break;
430  default:
431  break;
432  }
433 
435 
437 
438  // send version string request
439  if (oldstate == cs_assigned) {
440  SV_ClientCommand(sv_client, "cmd \177c version $version\n"
441 #if USE_AC_SERVER
442  "cmd \177c actoken $actoken\n"
443 #endif
444  );
446  }
447 
448  // send reconnect var request
449  if (sv_force_reconnect->string[0] && !sv_client->reconnected) {
450  SV_ClientCommand(sv_client, "cmd \177c connect $%s\n",
452  }
453 
454  Com_DPrintf("Going from cs_connected to cs_primed for %s\n",
455  sv_client->name);
457 
458  memset(&sv_client->lastcmd, 0, sizeof(sv_client->lastcmd));
459 
460  if (sv.state == ss_pic || sv.state == ss_cinematic)
461  return;
462 
463 #if USE_ZLIB
464  if (sv_client->has_zlib) {
465  if (sv_client->netchan->type == NETCHAN_NEW) {
466  write_compressed_gamestate();
467  } else {
468  // FIXME: Z_SYNC_FLUSH is not efficient for baselines
469  write_compressed_configstrings();
471  }
472  } else
473 #endif // USE_ZLIB
474  {
477  }
478 
479  // send next command
480  SV_ClientCommand(sv_client, "precache %i\n", sv_client->spawncount);
481 }

Referenced by SV_Begin_f().

◆ SV_NoSaveGames()

int SV_NoSaveGames ( void  )

Definition at line 460 of file save.c.

461 {
462  if (dedicated->integer && !Cvar_VariableInteger("coop"))
463  return 1;
464 
465  if (!(g_features->integer & GMF_ENHANCED_SAVEGAMES))
466  return 1;
467 
468  if (Cvar_VariableInteger("deathmatch"))
469  return 1;
470 
471  return 0;
472 }

Referenced by SV_AutoSaveBegin(), SV_AutoSaveEnd(), SV_CheckForSavegame(), SV_Map(), and SV_SpawnServer().

◆ SV_ParseMapCmd()

qboolean SV_ParseMapCmd ( mapcmd_t cmd)

Definition at line 285 of file init.c.

286 {
287  char expanded[MAX_QPATH];
288  char *s, *ch;
289  qerror_t ret;
290  size_t len;
291 
292  s = cmd->buffer;
293 
294  // skip the end-of-unit flag if necessary
295  if (*s == '*') {
296  s++;
297  cmd->endofunit = qtrue;
298  }
299 
300  // if there is a + in the map, set nextserver to the remainder.
301  ch = strchr(s, '+');
302  if (ch)
303  {
304  *ch = 0;
305  Cvar_Set("nextserver", va("gamemap \"%s\"", ch + 1));
306  }
307  else
308  Cvar_Set("nextserver", "");
309 
310  cmd->server = s;
311 
312  // if there is a $, use the remainder as a spawnpoint
313  ch = strchr(s, '$');
314  if (ch) {
315  *ch = 0;
316  cmd->spawnpoint = ch + 1;
317  } else {
318  cmd->spawnpoint = cmd->buffer + strlen(cmd->buffer);
319  }
320 
321  // now expand and try to load the map
322  if (!COM_CompareExtension(s, ".pcx")) {
323  len = Q_concat(expanded, sizeof(expanded), "pics/", s, NULL);
324  if (len >= sizeof(expanded)) {
325  ret = Q_ERR_NAMETOOLONG;
326  } else {
327  ret = FS_LoadFile(expanded, NULL);
328  }
329  cmd->state = ss_pic;
330  }
331  else if (!COM_CompareExtension(s, ".cin")) {
332  ret = Q_ERR_SUCCESS;
333  cmd->state = ss_cinematic;
334  }
335  else {
336  len = Q_concat(expanded, sizeof(expanded), "maps/", s, ".bsp", NULL);
337  if (len >= sizeof(expanded)) {
338  ret = Q_ERR_NAMETOOLONG;
339  } else {
340  ret = CM_LoadMap(&cmd->cm, expanded);
341  }
342  cmd->state = ss_game;
343  }
344 
345  if (ret < 0) {
346  Com_Printf("Couldn't load %s: %s\n", expanded, Q_ErrorString(ret));
347  return qfalse;
348  }
349 
350  return qtrue;
351 }

Referenced by read_server_file(), and SV_Map().

◆ SV_PointContents()

int SV_PointContents ( vec3_t  p)

Definition at line 454 of file world.c.

455 {
456  edict_t *touch[MAX_EDICTS], *hit;
457  int i, num;
458  int contents;
459 
460  if (!sv.cm.cache) {
461  Com_Error(ERR_DROP, "%s: no map loaded", __func__);
462  }
463 
464  // get base contents from world
465  contents = CM_PointContents(p, sv.cm.cache->nodes);
466 
467  // or in contents from all the other entities
468  num = SV_AreaEdicts(p, p, touch, MAX_EDICTS, AREA_SOLID);
469 
470  for (i = 0; i < num; i++) {
471  hit = touch[i];
472 
473  // might intersect, so do an exact clip
474  contents |= CM_TransformedPointContents(p, SV_HullForEntity(hit),
475  hit->s.origin, hit->s.angles);
476  }
477 
478  return contents;
479 }

Referenced by SV_InitGameProgs().

◆ SV_PrintMiscInfo()

void SV_PrintMiscInfo ( void  )

Definition at line 777 of file commands.c.

778 {
779  char buffer[MAX_QPATH];
780 
781  Com_Printf("version %s\n",
783  Com_Printf("protocol (maj/min) %d/%d\n",
785  Com_Printf("maxmsglen %"PRIz"\n", sv_client->netchan->maxpacketlen);
786  Com_Printf("zlib support %s\n", sv_client->has_zlib ? "yes" : "no");
787  Com_Printf("netchan type %s\n", sv_client->netchan->type ? "new" : "old");
788  Com_Printf("ping %d\n", sv_client->ping);
789  Com_Printf("movement fps %d\n", sv_client->moves_per_sec);
790 #if USE_FPS
791  Com_Printf("update rate %d\n", sv_client->settings[CLS_FPS]);
792 #endif
793  Com_Printf("RTT (min/avg/max) %d/%d/%d ms\n",
795  Com_Printf("PL server to client %.2f%% (approx)\n", PL_S2C(sv_client));
796  Com_Printf("PL client to server %.2f%%\n", PL_C2S(sv_client));
797 #ifdef USE_PACKETDUP
798  Com_Printf("packetdup %d\n", sv_client->numpackets - 1);
799 #endif
800  Com_TimeDiff(buffer, sizeof(buffer),
801  &sv_client->connect_time, time(NULL));
802  Com_Printf("connection time %s\n", buffer);
803 }

Referenced by SV_DumpUser_f(), and SV_ShowMiscInfo_f().

◆ SV_RateInit()

void SV_RateInit ( ratelimit_t r,
const char *  s 
)

Definition at line 309 of file main.c.

310 {
311  unsigned limit, period, mult, burst, rate;
312  char *p;
313 
314  limit = strtoul(s, &p, 10);
315  if (*p == '/') {
316  period = strtoul(p + 1, &p, 10);
317  if (*p == 's' || *p == 'S') {
318  mult = 1;
319  p++;
320  } else if (*p == 'm' || *p == 'M') {
321  mult = 60;
322  p++;
323  } else if (*p == 'h' || *p == 'H') {
324  mult = 60 * 60;
325  p++;
326  } else {
327  // everything else are seconds
328  mult = 1;
329  }
330  if (!period)
331  period = 1;
332  } else {
333  // default period is one second
334  period = 1;
335  mult = 1;
336  }
337 
338  if (!limit) {
339  // unlimited
340  memset(r, 0, sizeof(*r));
341  return;
342  }
343 
344  if (period > UINT_MAX / (RATE_LIMIT_SCALE * mult)) {
345  Com_Printf("Period too large: %u\n", period);
346  return;
347  }
348 
349  rate = (RATE_LIMIT_SCALE * period * mult) / limit;
350 
351  p = strchr(p, '*');
352  if (p) {
353  burst = strtoul(p + 1, NULL, 10);
354  } else {
355  // default burst is 5 hits
356  burst = 5;
357  }
358 
359  if (burst > UINT_MAX / rate) {
360  Com_Printf("Burst too large: %u\n", burst);
361  return;
362  }
363 
364  r->time = svs.realtime;
365  r->credit = rate2credits(rate * burst);
366  r->credit_cap = rate2credits(rate * burst);
367  r->cost = rate2credits(rate);
368 }

Referenced by init_rate_limits(), sv_auth_limit_changed(), sv_namechange_limit_changed(), sv_rcon_limit_changed(), sv_status_limit_changed(), and SVC_DirectConnect().

◆ SV_RateLimited()

qboolean SV_RateLimited ( ratelimit_t r)

Definition at line 265 of file main.c.

266 {
267  r->credit += (svs.realtime - r->time) * CREDITS_PER_MSEC;
268  r->time = svs.realtime;
269  if (r->credit > r->credit_cap)
270  r->credit = r->credit_cap;
271 
272  if (r->credit >= r->cost) {
273  r->credit -= r->cost;
274  return qfalse;
275  }
276 
277  return qtrue;
278 }

Referenced by parse_userinfo(), SV_UpdateUserinfo(), SVC_RemoteCommand(), and SVC_Status().

◆ SV_RateRecharge()

void SV_RateRecharge ( ratelimit_t r)

Definition at line 287 of file main.c.

288 {
289  r->credit += r->cost;
290  if (r->credit > r->credit_cap)
291  r->credit = r->credit_cap;
292 }

Referenced by parse_userinfo(), and SVC_RemoteCommand().

◆ SV_RegisterSavegames()

void SV_RegisterSavegames ( void  )

Definition at line 706 of file save.c.

707 {
709  sv_savedir = Cvar_Get("sv_savedir", "save", 0);
710 }

Referenced by SV_Init().

◆ SV_RemoveClient()

void SV_RemoveClient ( client_t client)

Definition at line 107 of file main.c.

108 {
109  if (client->msg_pool) {
110  SV_ShutdownClientSend(client);
111  }
112 
113  if (client->netchan) {
114  Netchan_Close(client->netchan);
115  client->netchan = NULL;
116  }
117 
118  // unlink them from active client list, but don't clear the list entry
119  // itself to make code that traverses client list in a loop happy!
120  List_Remove(&client->entry);
121 
122 #if USE_MVD_CLIENT
123  // unlink them from MVD client list
124  if (sv.state == ss_broadcast) {
125  MVD_RemoveClient(client);
126  }
127 #endif
128 
129  Com_DPrintf("Going from cs_zombie to cs_free for %s\n", client->name);
130 
131  client->state = cs_free; // can now be reused
132  client->name[0] = 0;
133 }

Referenced by find_client_slot(), mvd_disable(), SV_CheckTimeouts(), SV_Disconnect_f(), SV_FinalMessage(), and SV_MvdShutdown().

◆ SV_SendAsyncPackets()

void SV_SendAsyncPackets ( void  )

Definition at line 987 of file send.c.

988 {
989  qboolean retransmit;
990  client_t *client;
991  netchan_t *netchan;
992  size_t cursize;
993 
994  FOR_EACH_CLIENT(client) {
995  // don't overrun bandwidth
996  if (svs.realtime - client->send_time < client->send_delta) {
997  continue;
998  }
999 
1000  netchan = client->netchan;
1001 
1002  // make sure all fragments are transmitted first
1003  if (netchan->fragment_pending) {
1004  cursize = netchan->TransmitNextFragment(netchan);
1005  SV_DPrintf(0, "%s: frag: %"PRIz"\n", client->name, cursize);
1006  goto calctime;
1007  }
1008 
1009  // spawned clients are handled elsewhere
1010  if (client->state == cs_spawned && !client->download && !client->nodata && !SV_PAUSED) {
1011  continue;
1012  }
1013 
1014  // see if it's time to resend a (possibly dropped) packet
1015  retransmit = (com_localTime - netchan->last_sent > 1000);
1016 
1017  // don't write new reliables if not yet acknowledged
1018  if (netchan->reliable_length && !retransmit && client->state != cs_zombie) {
1019  continue;
1020  }
1021 
1022  // just update reliable if needed
1023  if (netchan->type == NETCHAN_OLD) {
1024  write_reliables_old(client, netchan->maxpacketlen);
1025  }
1026 
1027  // now fill up remaining buffer space with download
1028  write_pending_download(client);
1029 
1030  if (netchan->message.cursize || netchan->reliable_ack_pending ||
1031  netchan->reliable_length || retransmit) {
1032  cursize = netchan->Transmit(netchan, 0, NULL, 1);
1033  SV_DPrintf(0, "%s: send: %"PRIz"\n", client->name, cursize);
1034 calctime:
1035  SV_CalcSendTime(client, cursize);
1036  }
1037  }
1038 }

Referenced by MVD_ChangeLevel(), SV_Frame(), and SV_SpawnServer().

◆ SV_SendClientMessages()

void SV_SendClientMessages ( void  )

Definition at line 880 of file send.c.

881 {
882  client_t *client;
883  size_t cursize;
884 
885  // send a message to each connected client
886  FOR_EACH_CLIENT(client) {
887  if (client->state != cs_spawned || client->download || client->nodata)
888  goto finish;
889 
890  if (!SV_CLIENTSYNC(client))
891  continue;
892 
893 #if (defined _DEBUG) && USE_FPS
894  if (developer->integer)
895  check_key_sync(client);
896 #endif
897 
898  // if the reliable message overflowed,
899  // drop the client (should never happen)
900  if (client->netchan->message.overflowed) {
901  SZ_Clear(&client->netchan->message);
902  SV_DropClient(client, "reliable message overflowed");
903  goto finish;
904  }
905 
906  // don't overrun bandwidth
907  if (SV_RateDrop(client))
908  goto advance;
909 
910  // don't write any frame data until all fragments are sent
911  if (client->netchan->fragment_pending) {
912  client->frameflags |= FF_SUPPRESSED;
913  cursize = client->netchan->TransmitNextFragment(client->netchan);
914  SV_CalcSendTime(client, cursize);
915  goto advance;
916  }
917 
918  // build the new frame and write it
919  SV_BuildClientFrame(client);
920  client->WriteDatagram(client);
921 
922 advance:
923  // advance for next frame
924  client->framenum++;
925 
926 finish:
927  // clear all unreliable messages still left
928  finish_frame(client);
929  }
930 }

Referenced by SV_Frame(), and SV_SpawnServer().

◆ SV_ShutdownClientSend()

void SV_ShutdownClientSend ( client_t client)

Definition at line 1063 of file send.c.

1064 {
1065  free_all_messages(client);
1066 
1067  Z_Free(client->msg_pool);
1068  client->msg_pool = NULL;
1069 
1070  List_Init(&client->msg_free_list);
1071 }

Referenced by SV_RemoveClient().

◆ SV_ShutdownGameProgs()

void SV_ShutdownGameProgs ( void  )

Definition at line 786 of file game.c.

787 {
788  if (ge) {
789  ge->Shutdown();
790  ge = NULL;
791  }
792  if (game_library) {
794  game_library = NULL;
795  }
796  Cvar_Set("g_features", "0");
797 }

Referenced by SV_InitGame(), SV_InitGameProgs(), and SV_Shutdown().

◆ SV_SpawnServer()

void SV_SpawnServer ( mapcmd_t cmd)

Definition at line 139 of file init.c.

140 {
141  int i;
142  client_t *client;
143  char *entitystring;
144 
145  SCR_BeginLoadingPlaque(); // for local system
146 
147  Com_Printf("------- Server Initialization -------\n");
148  Com_Printf("SpawnServer: %s\n", cmd->server);
149 
150  static qboolean warning_printed = qfalse;
151  if (dedicated->integer && !SV_NoSaveGames() && !warning_printed)
152  {
153  Com_Printf("\nWARNING: Dedicated coop servers save game state into the same place as single player game by default (currently '%s/%s'). "
154  "To override that, set the 'sv_savedir' console variable. To host multiple dedicated coop servers on one machine, set that cvar "
155  "to different values on different instances of the server.\n\n", fs_gamedir, Cvar_WeakGet("sv_savedir")->string);
156 
157  warning_printed = qtrue;
158  }
159 
160  // everyone needs to reconnect
161  FOR_EACH_CLIENT(client) {
162  SV_ClientReset(client);
163  }
164 
165  SV_BroadcastCommand("changing map=%s\n", cmd->server);
168 
169  // free current level
170  CM_FreeMap(&sv.cm);
172 
173  // wipe the entire per-level structure
174  memset(&sv, 0, sizeof(sv));
175  sv.spawncount = (rand() | (rand() << 16)) ^ Sys_Milliseconds();
176  sv.spawncount &= 0x7FFFFFFF;
177 
178  // set legacy spawncounts
179  FOR_EACH_CLIENT(client) {
180  client->spawncount = sv.spawncount;
181  }
182 
183  // reset entity counter
184  svs.next_entity = 0;
185 
186  // set framerate parameters
187  set_frame_time();
188 
189  // save name for levels that don't set message
190  Q_strlcpy(sv.configstrings[CS_NAME], cmd->server, MAX_QPATH);
191  Q_strlcpy(sv.name, cmd->server, sizeof(sv.name));
192  Q_strlcpy(sv.mapcmd, cmd->buffer, sizeof(sv.mapcmd));
193 
194  if (Cvar_VariableInteger("deathmatch")) {
195  sprintf(sv.configstrings[CS_AIRACCEL], "%d", sv_airaccelerate->integer);
196  } else {
197  strcpy(sv.configstrings[CS_AIRACCEL], "0");
198  }
199 
200  resolve_masters();
201 
202  if (cmd->state == ss_game) {
204 
205  sv.cm = cmd->cm;
206  sprintf(sv.configstrings[CS_MAPCHECKSUM], "%d", (int)sv.cm.cache->checksum);
207 
208  // set inline model names
209  Q_concat(sv.configstrings[CS_MODELS + 1], MAX_QPATH, "maps/", cmd->server, ".bsp", NULL);
210  for (i = 1; i < sv.cm.cache->nummodels; i++) {
211  sprintf(sv.configstrings[CS_MODELS + 1 + i], "*%d", i);
212  }
213 
214  entitystring = sv.entitystring ? sv.entitystring : sv.cm.cache->entitystring;
215  } else {
216  // no real map
217  strcpy(sv.configstrings[CS_MAPCHECKSUM], "0");
218  entitystring = "";
219  }
220 
221  //
222  // clear physics interaction links
223  //
224  SV_ClearWorld();
225 
226  //
227  // spawn the rest of the entities on the map
228  //
229 
230  // precache and static commands can be issued during
231  // map initialization
232  sv.state = ss_loading;
233 
234  X86_PUSH_FPCW;
235  X86_SINGLE_FPCW;
236 
237  // load and spawn all other entities
238  ge->SpawnEntities(sv.name, entitystring, cmd->spawnpoint);
239 
240  // run two frames to allow everything to settle
241  ge->RunFrame(); sv.framenum++;
242  ge->RunFrame(); sv.framenum++;
243 
244  X86_POP_FPCW;
245 
246  // make sure maxclients string is correct
247  sprintf(sv.configstrings[CS_MAXCLIENTS], "%d", sv_maxclients->integer);
248 
249  // check for a savegame
250  SV_CheckForSavegame(cmd);
251 
252  // all precaches are complete
253  sv.state = cmd->state;
254 
255  // respawn dummy MVD client, set base states, etc
257 
258  // set serverinfo variable
259  SV_InfoSet("mapname", sv.name);
260  SV_InfoSet("port", net_port->string);
261 
262  Cvar_SetInteger(sv_running, sv.state, FROM_CODE);
263  Cvar_Set("sv_paused", "0");
264  Cvar_Set("timedemo", "0");
265 
266  EXEC_TRIGGER(sv_changemapcmd);
267 
268 #if USE_SYSCON
269  SV_SetConsoleTitle();
270 #endif
271 
272  SV_BroadcastCommand("reconnect\n");
273 
274  Com_Printf("-------------------------------------\n");
275 }

Referenced by read_server_file(), and SV_Map().

◆ SV_Trace()

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

Definition at line 546 of file world.c.

548 {
549  trace_t trace;
550 
551  if (!sv.cm.cache) {
552  Com_Error(ERR_DROP, "%s: no map loaded", __func__);
553  }
554 
555  // work around game bugs
556  if (++sv.tracecount > 10000) {
557  Com_EPrintf("%s: runaway loop avoided\n", __func__);
558  memset(&trace, 0, sizeof(trace));
559  trace.fraction = 1;
560  trace.ent = ge->edicts;
561  VectorCopy(end, trace.endpos);
562  sv.tracecount = 0;
563  return trace;
564  }
565 
566  if (!mins)
567  mins = vec3_origin;
568  if (!maxs)
569  maxs = vec3_origin;
570 
571  // clip to world
572  CM_BoxTrace(&trace, start, end, mins, maxs, sv.cm.cache->nodes, contentmask);
573  trace.ent = ge->edicts;
574  if (trace.fraction == 0) {
575  return trace; // blocked by the world
576  }
577 
578  // clip to other solid entities
579  SV_ClipMoveToEntities(start, mins, maxs, end, passedict, contentmask, &trace);
580  return trace;
581 }

Referenced by SV_InitGameProgs().

◆ SV_UserinfoChanged()

void SV_UserinfoChanged ( client_t cl)

Definition at line 1927 of file main.c.

1928 {
1929  char name[MAX_CLIENT_NAME];
1930  char *val;
1931  size_t len;
1932  int i;
1933 
1934  // call prog code to allow overrides
1935  ge->ClientUserinfoChanged(cl->edict, cl->userinfo);
1936 
1937  // name for C code
1938  val = Info_ValueForKey(cl->userinfo, "name");
1939  len = Q_strlcpy(name, val, sizeof(name));
1940  if (len >= sizeof(name)) {
1941  len = sizeof(name) - 1;
1942  }
1943  // mask off high bit
1944  for (i = 0; i < len; i++)
1945  name[i] &= 127;
1946  if (cl->name[0] && strcmp(cl->name, name)) {
1947  if (COM_DEDICATED) {
1948  Com_Printf("%s[%s] changed name to %s\n", cl->name,
1949  NET_AdrToString(&cl->netchan->remote_address), name);
1950  }
1951 #if USE_MVD_CLIENT
1952  if (sv.state == ss_broadcast) {
1953  MVD_GameClientNameChanged(cl->edict, name);
1954  } else
1955 #endif
1956  if (sv_show_name_changes->integer) {
1957  SV_BroadcastPrintf(PRINT_HIGH, "%s changed name to %s\n",
1958  cl->name, name);
1959  }
1960  }
1961  memcpy(cl->name, name, len + 1);
1962 
1963  // rate command
1964  val = Info_ValueForKey(cl->userinfo, "rate");
1965  if (*val) {
1966  cl->rate = atoi(val);
1967  clamp(cl->rate, 100, 15000);
1968  } else {
1969  cl->rate = 5000;
1970  }
1971 
1972  // never drop over the loopback
1973  if (NET_IsLocalAddress(&cl->netchan->remote_address)) {
1974  cl->rate = 0;
1975  }
1976 
1977  // don't drop over LAN connections
1978  if (sv_lan_force_rate->integer &&
1979  NET_IsLanAddress(&cl->netchan->remote_address)) {
1980  cl->rate = 0;
1981  }
1982 
1983  // msg command
1984  val = Info_ValueForKey(cl->userinfo, "msg");
1985  if (*val) {
1986  cl->messagelevel = atoi(val);
1987  clamp(cl->messagelevel, PRINT_LOW, PRINT_CHAT + 1);
1988  }
1989 }

Referenced by dummy_create(), SV_UpdateUserinfo(), and SVC_DirectConnect().

◆ SV_WriteFrameToClient_Default()

void SV_WriteFrameToClient_Default ( client_t client)

Definition at line 174 of file entities.c.

175 {
176  client_frame_t *frame, *oldframe;
177  player_packed_t *oldstate;
178  int lastframe;
179 
180  // this is the frame we are creating
181  frame = &client->frames[client->framenum & UPDATE_MASK];
182 
183  // this is the frame we are delta'ing from
184  oldframe = get_last_frame(client);
185  if (oldframe) {
186  oldstate = &oldframe->ps;
187  lastframe = client->lastframe;
188  } else {
189  oldstate = NULL;
190  lastframe = -1;
191  }
192 
193  MSG_WriteByte(svc_frame);
194  MSG_WriteLong(client->framenum);
195  MSG_WriteLong(lastframe); // what we are delta'ing from
196  MSG_WriteByte(client->suppress_count); // rate dropped packets
197  client->suppress_count = 0;
198  client->frameflags = 0;
199 
200  // send over the areabits
201  MSG_WriteByte(frame->areabytes);
202  MSG_WriteData(frame->areabits, frame->areabytes);
203 
204  // delta encode the playerstate
205  MSG_WriteByte(svc_playerinfo);
206  MSG_WriteDeltaPlayerstate_Default(oldstate, &frame->ps);
207 
208  // delta encode the entities
209  MSG_WriteByte(svc_packetentities);
210  SV_EmitPacketEntities(client, oldframe, frame, 0);
211 }

Referenced by SVC_DirectConnect().

◆ SV_WriteFrameToClient_Enhanced()

void SV_WriteFrameToClient_Enhanced ( client_t client)

Definition at line 218 of file entities.c.

219 {
220  client_frame_t *frame, *oldframe;
221  player_packed_t *oldstate;
222  uint32_t extraflags;
223  int delta, suppressed;
224  byte *b1, *b2;
225  msgPsFlags_t psFlags;
226  int clientEntityNum;
227 
228  // this is the frame we are creating
229  frame = &client->frames[client->framenum & UPDATE_MASK];
230 
231  // this is the frame we are delta'ing from
232  oldframe = get_last_frame(client);
233  if (oldframe) {
234  oldstate = &oldframe->ps;
235  delta = client->framenum - client->lastframe;
236  } else {
237  oldstate = NULL;
238  delta = 31;
239  }
240 
241  // first byte to be patched
242  b1 = SZ_GetSpace(&msg_write, 1);
243 
244  MSG_WriteLong((client->framenum & FRAMENUM_MASK) | (delta << FRAMENUM_BITS));
245 
246  // second byte to be patched
247  b2 = SZ_GetSpace(&msg_write, 1);
248 
249  // send over the areabits
250  MSG_WriteByte(frame->areabytes);
251  MSG_WriteData(frame->areabits, frame->areabytes);
252 
253  // ignore some parts of playerstate if not recording demo
254  psFlags = 0;
255  if (!client->settings[CLS_RECORDING]) {
256  if (client->settings[CLS_NOGUN]) {
257  psFlags |= MSG_PS_IGNORE_GUNFRAMES;
258  if (client->settings[CLS_NOGUN] != 2) {
259  psFlags |= MSG_PS_IGNORE_GUNINDEX;
260  }
261  }
262  if (client->settings[CLS_NOBLEND]) {
263  psFlags |= MSG_PS_IGNORE_BLEND;
264  }
265  if (frame->ps.pmove.pm_type < PM_DEAD) {
266  if (!(frame->ps.pmove.pm_flags & PMF_NO_PREDICTION)) {
267  psFlags |= MSG_PS_IGNORE_VIEWANGLES;
268  }
269  } else {
270  // lying dead on a rotating platform?
271  psFlags |= MSG_PS_IGNORE_DELTAANGLES;
272  }
273  }
274 
275  clientEntityNum = 0;
276  if (client->protocol == PROTOCOL_VERSION_Q2PRO) {
277  if (frame->ps.pmove.pm_type < PM_DEAD && !client->settings[CLS_RECORDING]) {
278  clientEntityNum = frame->clientNum + 1;
279  }
280  if (client->settings[CLS_NOPREDICT]) {
281  psFlags |= MSG_PS_IGNORE_PREDICTION;
282  }
283  suppressed = client->frameflags;
284  } else {
285  suppressed = client->suppress_count;
286  }
287 
288  // delta encode the playerstate
289  extraflags = MSG_WriteDeltaPlayerstate_Enhanced(oldstate, &frame->ps, psFlags);
290 
291  if (client->protocol == PROTOCOL_VERSION_Q2PRO) {
292  // delta encode the clientNum
293  if (client->version < PROTOCOL_VERSION_Q2PRO_CLIENTNUM_FIX) {
294  if (!oldframe || frame->clientNum != oldframe->clientNum) {
295  extraflags |= EPS_CLIENTNUM;
296  MSG_WriteByte(frame->clientNum);
297  }
298  } else {
299  int clientNum = oldframe ? oldframe->clientNum : 0;
300  if (clientNum != frame->clientNum) {
301  extraflags |= EPS_CLIENTNUM;
302  MSG_WriteByte(frame->clientNum);
303  }
304  }
305  }
306 
307  // save 3 high bits of extraflags
308  *b1 = svc_frame | (((extraflags & 0x70) << 1));
309 
310  // save 4 low bits of extraflags
311  *b2 = (suppressed & SUPPRESSCOUNT_MASK) |
312  ((extraflags & 0x0F) << SUPPRESSCOUNT_BITS);
313 
314  client->suppress_count = 0;
315  client->frameflags = 0;
316 
317  // delta encode the entities
318  SV_EmitPacketEntities(client, oldframe, frame, clientEntityNum);
319 }

Referenced by SVC_DirectConnect().

Variable Documentation

◆ g_features

◆ ge

◆ map_override_path

cvar_t* map_override_path

Definition at line 101 of file main.c.

Referenced by override_entity_string(), and SV_Init().

◆ sv

◆ sv_airaccelerate

cvar_t* sv_airaccelerate

Definition at line 54 of file main.c.

Referenced by init_pmove_and_es_flags(), SV_Init(), and SV_SpawnServer().

◆ sv_allow_map

cvar_t* sv_allow_map

Definition at line 81 of file main.c.

Referenced by should_really_restart(), and SV_Init().

◆ sv_allow_unconnected_cmds

cvar_t* sv_allow_unconnected_cmds

Definition at line 97 of file main.c.

Referenced by SV_ExecuteUserCommand(), and SV_Init().

◆ sv_auth_limit

cvar_t* sv_auth_limit

Definition at line 91 of file main.c.

Referenced by init_rate_limits(), and SV_Init().

◆ sv_banlist

◆ sv_blacklist

◆ sv_calcpings_method

cvar_t* sv_calcpings_method

Definition at line 73 of file main.c.

Referenced by SV_CalcPings(), and SV_Init().

◆ sv_changemapcmd

cvar_t* sv_changemapcmd

Definition at line 74 of file main.c.

Referenced by SV_Init(), and SV_SpawnServer().

◆ sv_client

◆ sv_clientlist

list_t sv_clientlist

◆ sv_cmdlist_begin

list_t sv_cmdlist_begin

Referenced by SV_Begin_f(), and SV_FindStuffList().

◆ sv_cmdlist_connect

list_t sv_cmdlist_connect

Referenced by SV_FindStuffList(), and SV_New_f().

◆ sv_enforcetime

cvar_t* sv_enforcetime

Definition at line 37 of file main.c.

Referenced by SV_ClientThink(), and SV_Init().

◆ sv_enhanced_setplayer

cvar_t* sv_enhanced_setplayer

Definition at line 85 of file main.c.

Referenced by SV_Init(), and SV_SetPlayer().

◆ sv_filterlist

◆ sv_force_reconnect

cvar_t* sv_force_reconnect

Definition at line 51 of file main.c.

Referenced by send_connect_packet(), stuff_junk(), SV_Begin_f(), SV_Init(), and SV_New_f().

◆ sv_ghostime

cvar_t* sv_ghostime

Definition at line 45 of file main.c.

Referenced by SV_CheckTimeouts(), SV_Init(), and SV_MvdRunClients().

◆ sv_hostname

cvar_t* sv_hostname

Definition at line 65 of file main.c.

Referenced by AC_SendHello(), SV_Init(), and SVC_Info().

◆ sv_iplimit

cvar_t* sv_iplimit

Definition at line 87 of file main.c.

Referenced by accept_client(), permit_connection(), and SV_Init().

◆ sv_lan_force_rate

cvar_t* sv_lan_force_rate

Definition at line 72 of file main.c.

Referenced by SV_Init(), and SV_UserinfoChanged().

◆ sv_masterlist

list_t sv_masterlist

Referenced by SV_ListMasters_f(), and SV_SetMaster_f().

◆ sv_maxclients

◆ sv_novis

cvar_t* sv_novis

Definition at line 56 of file main.c.

Referenced by SV_BuildClientFrame(), and SV_Init().

◆ sv_outputbuf

char sv_outputbuf[SV_OUTPUTBUF_LENGTH]

Definition at line 30 of file send.c.

◆ sv_password

cvar_t* sv_password

Definition at line 48 of file main.c.

Referenced by parse_userinfo(), and SV_Init().

◆ sv_pending_autosave

qboolean sv_pending_autosave

Definition at line 35 of file main.c.

Referenced by SV_Begin_f(), and SV_Map().

◆ sv_player

◆ sv_pmp

pmoveParams_t sv_pmp

Definition at line 22 of file main.c.

Referenced by init_pmove_and_es_flags(), PF_Pmove(), and SV_Init().

◆ sv_qwmod

cvar_t* sv_qwmod

Definition at line 55 of file main.c.

Referenced by init_pmove_and_es_flags(), and SV_Init().

◆ sv_rcon_limit

cvar_t* sv_rcon_limit

Definition at line 92 of file main.c.

Referenced by init_rate_limits(), and SV_Init().

◆ sv_recycle

cvar_t* sv_recycle

Definition at line 83 of file main.c.

Referenced by should_really_restart(), SV_GameMap_f(), SV_Init(), and SV_InitGame().

◆ sv_reserved_slots

cvar_t* sv_reserved_slots

◆ sv_status_limit

cvar_t* sv_status_limit

Definition at line 88 of file main.c.

Referenced by init_rate_limits(), and SV_Init().

◆ sv_status_show

cvar_t* sv_status_show

Definition at line 89 of file main.c.

Referenced by SV_Init(), SV_StatusString(), and SVC_Status().

◆ sv_strafejump_hack

cvar_t* sv_strafejump_hack

Definition at line 76 of file main.c.

Referenced by init_pmove_and_es_flags(), and SV_Init().

◆ sv_timeout

cvar_t* sv_timeout

Definition at line 43 of file main.c.

Referenced by SV_CheckTimeouts(), SV_Init(), and SV_MvdRunClients().

◆ sv_uptime

cvar_t* sv_uptime

Definition at line 90 of file main.c.

Referenced by SV_Init(), and SV_StatusString().

◆ sv_zombietime

cvar_t* sv_zombietime

Definition at line 44 of file main.c.

Referenced by SV_CheckTimeouts(), SV_Init(), and SV_MvdRunClients().

◆ svs

Definition at line 21 of file init.c.

Referenced by AC_CheckTimeouts(), AC_ClientQuery(), AC_Info_f(), AC_Invalidate_f(), AC_List_f(), AC_ParseClient(), AC_ParseMessage(), AC_ParseReady(), AC_ParseViolation(), AC_SendPing(), AC_Update_f(), accept_client(), check_clients_activity(), check_entity(), check_players_activity(), check_reconnect(), check_timeouts(), compress_message(), drop_client(), dummy_create(), dummy_find_slot(), dummy_run(), dummy_spawn(), dump_clients(), dump_time(), filter_unicast_data(), find_client_slot(), get_last_frame(), gtv_drop(), init_rate_limits(), MVD_Connect_f(), mvd_enable(), MVD_GameClientBegin(), MVD_GameClientCommand(), MVD_GameClientConnect(), MVD_GameClientThink(), MVD_GameInit(), MVD_LayoutChannels(), MVD_LayoutClients(), MVD_LayoutFollow(), MVD_LayoutMenu(), MVD_LayoutScores(), MVD_ListServers_f(), MVD_NotifyClient(), MVD_PartFilter(), MVD_RemoveClient(), MVD_Say_f(), MVD_TrySwitchChannel(), MVD_UpdateClient(), MVD_UpdateLayouts(), parse_message(), parse_userinfo(), permit_connection(), PF_cprintf(), PF_Unicast(), player_is_active(), rec_start(), run_connect(), set_mvd_active(), sv_auth_limit_changed(), SV_BuildClientFrame(), SV_CalcSendTime(), SV_CheckTimeouts(), SV_ClientThink(), SV_ConnectionlessPacket(), SV_ConSay_f(), SV_DropClient(), SV_DumpUser_f(), SV_EmitPacketEntities(), SV_ExecuteUserCommand(), SV_Frame(), SV_GetPlayer(), SV_Heartbeat_f(), SV_InitGame(), SV_Kick_f(), SV_KillServer_f(), SV_ListMasters_f(), SV_MasterHeartbeat(), SV_MvdRunClients(), SV_New_f(), SV_PacketEvent(), SV_PickClient_f(), SV_Player_g(), SV_RateInit(), SV_RateLimited(), sv_rcon_limit_changed(), SV_Savegame_f(), SV_SendAsyncPackets(), SV_SetMaster_f(), SV_Shutdown(), SV_SpawnServer(), SV_Status_f(), sv_status_limit_changed(), SV_Stuff_f(), SV_StuffAll_f(), SV_StuffCvar_f(), SVC_Ack(), SVC_DirectConnect(), SVC_GetChallenge(), SVC_RemoteCommand(), SVC_Status(), and write_stream().

client_s::lastframe
int lastframe
Definition: server.h:290
server_static_s::next_entity
unsigned next_entity
Definition: server.h:459
server_t::framenum
int framenum
Definition: server.h:155
SV_OldClientExecuteMove
static void SV_OldClientExecuteMove(void)
Definition: user.c:1100
sv_pending_autosave
qboolean sv_pending_autosave
Definition: main.c:35
client_s::version_string
char * version_string
Definition: server.h:282
moveIssued
static qboolean moveIssued
Definition: user.c:1034
server_t::entitystring
char * entitystring
Definition: server.h:162
SV_Shutdown
void SV_Shutdown(const char *finalmsg, error_type_t type)
Definition: main.c:2252
SV_ClipMoveToEntities
static void SV_ClipMoveToEntities(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passedict, int contentmask, trace_t *tr)
Definition: world.c:487
PF_inPVS
static qboolean PF_inPVS(vec3_t p1, vec3_t p2)
Definition: game.c:457
SV_BuildClientFrame
void SV_BuildClientFrame(client_t *client)
Definition: entities.c:382
get_last_frame
static client_frame_t * get_last_frame(client_t *client)
Definition: entities.c:134
client_frame_t::first_entity
unsigned first_entity
Definition: server.h:102
Cvar_Set
cvar_t * Cvar_Set(const char *var_name, const char *value)
Definition: cvar.c:466
CM_BoxTrace
void CM_BoxTrace(trace_t *trace, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, mnode_t *headnode, int brushmask)
Definition: cmodel.c:683
area_mins
static float * area_mins
Definition: world.c:45
CM_FreeMap
void CM_FreeMap(cm_t *cm)
Definition: cmodel.c:47
set_frame_time
static void set_frame_time(void)
Definition: init.c:40
sv_numareanodes
static int sv_numareanodes
Definition: world.c:43
cs_spawned
@ cs_spawned
Definition: server.h:192
Com_TimeDiff
size_t Com_TimeDiff(char *buffer, size_t size, time_t *p, time_t now)
Definition: utils.c:443
SV_LinkEdict
void SV_LinkEdict(cm_t *cm, edict_t *ent)
Definition: world.c:156
msg_read
sizebuf_t msg_read
Definition: msg.c:37
pm
static pmove_t * pm
Definition: pmove.c:44
SV_BroadcastCommand
void SV_BroadcastCommand(const char *fmt,...)
Definition: send.c:214
addrmatch_t::entry
list_t entry
Definition: server.h:396
SV_ParseClientSetting
static void SV_ParseClientSetting(void)
Definition: user.c:1432
sv_novis
cvar_t * sv_novis
Definition: main.c:56
svs
server_static_t svs
Definition: init.c:21
NET_AdrToString
char * NET_AdrToString(const netadr_t *a)
Definition: net.c:257
CM_HeadnodeVisible
qboolean CM_HeadnodeVisible(mnode_t *node, byte *visbits)
Definition: cmodel.c:1016
RD_CLIENT
@ RD_CLIENT
Definition: server.h:581
SV_BASELINES_CHUNKS
#define SV_BASELINES_CHUNKS
Definition: server.h:71
MVD_GameClientNameChanged
void MVD_GameClientNameChanged(edict_t *ent, const char *name)
Definition: game.c:1922
c_server
static const cmdreg_t c_server[]
Definition: commands.c:1548
compress_message
static qboolean compress_message(client_t *client, int flags)
Definition: send.c:338
client_s::send_delta
unsigned send_delta
Definition: server.h:312
SV_ShutdownClientSend
void SV_ShutdownClientSend(client_t *client)
Definition: send.c:1063
mapcmd_t::state
server_state_t state
Definition: server.h:441
SV_CreateAreaNode
static areanode_t * SV_CreateAreaNode(int depth, vec3_t mins, vec3_t maxs)
Definition: world.c:57
client_s::moves_per_sec
int moves_per_sec
Definition: server.h:295
CM_LoadMap
qerror_t CM_LoadMap(cm_t *cm, const char *name)
Definition: cmodel.c:64
client_s::protocol
int protocol
Definition: server.h:324
server_t::tracecount
unsigned tracecount
Definition: server.h:168
PL_C2S
#define PL_C2S(cl)
Definition: server.h:244
message_packet_t
Definition: server.h:220
ratelimit_t::time
unsigned time
Definition: server.h:250
write_reliables_old
static void write_reliables_old(client_t *client, size_t maxsize)
Definition: send.c:624
PF_AddCommandString
static void PF_AddCommandString(const char *string)
Definition: game.c:727
client_s::downloadname
char * downloadname
Definition: server.h:318
Cmd_AddCommand
void Cmd_AddCommand(const char *name, xcommand_t function)
Definition: cmd.c:1562
client_s::has_zlib
qboolean has_zlib
Definition: server.h:267
server_static_s::entities
entity_packed_t * entities
Definition: server.h:460
area_list
static edict_t ** area_list
Definition: world.c:46
SV_CheckForSavegame
void SV_CheckForSavegame(mapcmd_t *cmd)
Definition: save.c:550
c_savegames
static const cmdreg_t c_savegames[]
Definition: save.c:700
copy_save_dir
static int copy_save_dir(const char *src, const char *dst)
Definition: save.c:219
client_s::msg_free_list
list_t msg_free_list
Definition: server.h:332
Cvar_Get
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
Definition: cvar.c:257
CREDITS_PER_MSEC
#define CREDITS_PER_MSEC
Definition: main.c:251
Q_ErrorString
const char * Q_ErrorString(qerror_t error)
Definition: error.c:51
BSP_ClusterVis
byte * BSP_ClusterVis(bsp_t *bsp, byte *mask, int cluster, int vis)
Definition: bsp.c:1339
client_s::state
clstate_t state
Definition: server.h:260
SV_SendClientMessages
void SV_SendClientMessages(void)
Definition: send.c:880
PL_S2C
#define PL_S2C(cl)
Definition: server.h:242
MSG_CLEAR
#define MSG_CLEAR
Definition: server.h:215
add_message_new
static void add_message_new(client_t *client, byte *data, size_t len, qboolean reliable)
Definition: send.c:776
PF_bprintf
static void PF_bprintf(int level, const char *fmt,...)
Definition: game.c:140
client_s::number
int number
Definition: server.h:262
PF_cvar
static cvar_t * PF_cvar(const char *name, const char *value, int flags)
Definition: game.c:717
MSG_RELIABLE
#define MSG_RELIABLE
Definition: server.h:214
client_s::gamedir
char * gamedir
Definition: server.h:344
sv_force_reconnect
cvar_t * sv_force_reconnect
Definition: main.c:51
SV_CalcSendTime
static void SV_CalcSendTime(client_t *client, size_t size)
Definition: send.c:88
client_s::frames_sent
unsigned frames_sent
Definition: server.h:302
client_s::spawncount
int spawncount
Definition: server.h:348
SV_ClearWorld
void SV_ClearWorld(void)
Definition: world.c:101
client_s::slot
int slot
Definition: server.h:347
userinfoUpdateCount
static int userinfoUpdateCount
Definition: user.c:1036
addrmatch_t::time
time_t time
Definition: server.h:400
addrmatch_t::hits
unsigned hits
Definition: server.h:399
filteraction_t
filteraction_t
Definition: server.h:410
addrmatch_t::comment
char comment[1]
Definition: server.h:401
client_s::WriteDatagram
void(* WriteDatagram)(struct client_s *)
Definition: server.h:354
_SV_LoadGameLibrary
static void * _SV_LoadGameLibrary(const char *path)
Definition: game.c:799
client_s::downloadcount
int downloadcount
Definition: server.h:317
area_type
static int area_type
Definition: world.c:48
addrmatch_t::mask
netadr_t mask
Definition: server.h:398
PF_PositionedSound
static void PF_PositionedSound(vec3_t origin, edict_t *entity, int channel, int soundindex, float volume, float attenuation, float timeofs)
Definition: game.c:651
override_entity_string
static void override_entity_string(const char *server)
Definition: init.c:90
PF_UnlinkEdict
void PF_UnlinkEdict(edict_t *ent)
Definition: world.c:256
server_t::mapcmd
char mapcmd[MAX_QPATH]
Definition: server.h:158
read_level_file
static int read_level_file(void)
Definition: save.c:403
SV_InfoSet
#define SV_InfoSet(var, val)
Definition: server.h:73
clstate_t
clstate_t
Definition: server.h:185
CM_BoxLeafs
int CM_BoxLeafs(cm_t *cm, vec3_t mins, vec3_t maxs, mleaf_t **list, int listsize, mnode_t **topnode)
Definition: cmodel.c:273
mapcmd_t::spawnpoint
char * spawnpoint
Definition: server.h:440
area_maxcount
static int area_maxcount
Definition: world.c:47
SV_ConSay_f
static void SV_ConSay_f(void)
Definition: commands.c:721
other
@ other
Definition: ogg.c:63
SV_NewClientExecuteMove
static void SV_NewClientExecuteMove(int c)
Definition: user.c:1168
server_entity_t::solid32
int solid32
Definition: server.h:112
SV_MvdInit
void SV_MvdInit(void)
Definition: mvd.c:2068
sv_client
client_t * sv_client
Definition: main.c:32
PF_ImageIndex
static int PF_ImageIndex(const char *name)
Definition: game.c:68
finish_frame
static void finish_frame(client_t *client)
Definition: send.c:847
client_s::suppress_count
int suppress_count
Definition: server.h:311
client_s::msg_reliable_list
list_t msg_reliable_list
Definition: server.h:334
sv_changemapcmd
cvar_t * sv_changemapcmd
Definition: main.c:74
MSG_WriteByte
void MSG_WriteByte(int c)
Definition: msg.c:107
areanode_s::solid_edicts
list_t solid_edicts
Definition: world.c:36
Cmd_Argv
char * Cmd_Argv(int arg)
Definition: cmd.c:899
rate2credits
static unsigned rate2credits(unsigned rate)
Definition: main.c:294
sv_airaccelerate
cvar_t * sv_airaccelerate
Definition: main.c:54
Sys_Milliseconds
unsigned Sys_Milliseconds(void)
Definition: system.c:644
SV_EmitPacketEntities
static void SV_EmitPacketEntities(client_t *client, client_frame_t *from, client_frame_t *to, int clientEntityNum)
Definition: entities.c:41
SV_Multicast
void SV_Multicast(vec3_t origin, multicast_t to)
Definition: send.c:255
PF_setmodel
static void PF_setmodel(edict_t *ent, const char *name)
Definition: game.c:326
PF_LinkEdict
void PF_LinkEdict(edict_t *ent)
Definition: world.c:264
client_s::last_valid_cluster
int last_valid_cluster
Definition: server.h:362
print_drop_reason
static void print_drop_reason(client_t *client, const char *reason, clstate_t oldstate)
Definition: main.c:165
SAVE_AUTO
#define SAVE_AUTO
Definition: save.c:26
CL_Disconnect
void CL_Disconnect(error_type_t type)
Definition: main.c:740
sv_savedir
cvar_t * sv_savedir
Definition: save.c:28
Cmd_Argc
int Cmd_Argc(void)
Definition: cmd.c:889
SV_ClientAddMessage
void SV_ClientAddMessage(client_t *client, int flags)
Definition: send.c:399
client_frame_t::clientNum
int clientNum
Definition: server.h:104
stuff_junk
static void stuff_junk(void)
Definition: user.c:321
net_from
netadr_t net_from
Definition: net.c:90
SV_CleanClient
void SV_CleanClient(client_t *client)
Definition: main.c:135
mapcmd_t::loadgame
int loadgame
Definition: server.h:442
SV_AlignKeyFrames
#define SV_AlignKeyFrames(client)
Definition: server.h:698
vec3_origin
vec3_t vec3_origin
Definition: shared.c:21
SV_MvdMapChanged
void SV_MvdMapChanged(void)
Definition: mvd.c:1990
FOR_EACH_CLIENT
#define FOR_EACH_CLIENT(client)
Definition: server.h:239
wipe_save_dir
static int wipe_save_dir(const char *dir)
Definition: save.c:204
SV_AreaEdicts
int SV_AreaEdicts(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype)
Definition: world.c:407
SV_Malloc
#define SV_Malloc(size)
Definition: server.h:54
client_frame_t::areabytes
int areabytes
Definition: server.h:105
FA_IGNORE
@ FA_IGNORE
Definition: server.h:411
sv_reserved_slots
cvar_t * sv_reserved_slots
Definition: main.c:59
CM_AreasConnected
qboolean CM_AreasConnected(cm_t *cm, int area1, int area2)
Definition: cmodel.c:890
PF_SetAreaPortalState
static void PF_SetAreaPortalState(int portalnum, qboolean open)
Definition: game.c:732
addrmatch_t::addr
netadr_t addr
Definition: server.h:397
MSG_WritePos
void MSG_WritePos(const vec3_t pos)
Definition: msg.c:198
SV_HullForEntity
static mnode_t * SV_HullForEntity(edict_t *ent)
Definition: world.c:433
areanode_s::trigger_edicts
list_t trigger_edicts
Definition: world.c:35
client_s::nodata
qboolean nodata
Definition: server.h:266
sv_pmp
pmoveParams_t sv_pmp
Definition: main.c:22
client_frame_t::num_entities
unsigned num_entities
Definition: server.h:101
resolve_masters
static void resolve_masters(void)
Definition: init.c:60
mapcmd_t::server
char * server
Definition: server.h:439
Cmd_ArgsFrom
char * Cmd_ArgsFrom(int from)
Definition: cmd.c:981
SZ_GetSpace
void * SZ_GetSpace(sizebuf_t *buf, size_t len)
Definition: sizebuf.c:48
server_static_s::last_heartbeat
unsigned last_heartbeat
Definition: server.h:466
Com_Error
void Com_Error(error_type_t type, const char *fmt,...)
Definition: g_main.c:258
MSG_PackEntity
void MSG_PackEntity(entity_packed_t *out, const entity_state_t *in, qboolean short_angles)
Definition: msg.c:468
EDICT_POOL
#define EDICT_POOL(c, n)
Definition: server.h:171
HEARTBEAT_SECONDS
#define HEARTBEAT_SECONDS
Definition: server.h:427
dedicated
cvar_t * dedicated
Definition: g_main.c:46
CM_FatPVS
byte * CM_FatPVS(cm_t *cm, byte *mask, const vec3_t org, int vis)
Definition: cmodel.c:1045
AC_ClientAnnounce
void AC_ClientAnnounce(client_t *cl)
Definition: ac.c:1070
sv_lan_force_rate
cvar_t * sv_lan_force_rate
Definition: main.c:72
write_plain_configstrings
static void write_plain_configstrings(void)
Definition: user.c:89
PF_error
static q_noreturn void PF_error(const char *fmt,...)
Definition: game.c:306
client_s::download
byte * download
Definition: server.h:315
MSG_WriteDeltaPlayerstate_Enhanced
int MSG_WriteDeltaPlayerstate_Enhanced(const player_packed_t *from, player_packed_t *to, msgPsFlags_t flags)
Definition: msg.c:975
SV_SendAsyncPackets
void SV_SendAsyncPackets(void)
Definition: send.c:987
MSG_PackPlayer
void MSG_PackPlayer(player_packed_t *out, const player_state_t *in)
Definition: msg.c:763
format_mask
static size_t format_mask(addrmatch_t *match, char *buf, size_t buf_size)
Definition: commands.c:1050
client_s::downloadpending
qboolean downloadpending
Definition: server.h:320
ratelimit_t::cost
unsigned cost
Definition: server.h:253
NUM_FOR_EDICT
#define NUM_FOR_EDICT(e)
Definition: server.h:174
sv
server_t sv
Definition: init.c:22
client_s::baselines
entity_packed_t * baselines[SV_BASELINES_CHUNKS]
Definition: server.h:340
PF_Pmove
void PF_Pmove(pmove_t *pm)
Definition: game.c:708
AC_Connect
void AC_Connect(unsigned mvd_spawn)
Definition: ac.c:1437
client_s::downloadcmd
int downloadcmd
Definition: server.h:319
msg_write
sizebuf_t msg_write
Definition: msg.c:34
SV_ParseDeltaUserinfo
static void SV_ParseDeltaUserinfo(void)
Definition: user.c:1334
client_s::frames
client_frame_t frames[UPDATE_BACKUP]
Definition: server.h:301
SV_MvdMulticast
void SV_MvdMulticast(int leafnum, multicast_t to)
Definition: mvd.c:1122
ratelimit_t::credit_cap
unsigned credit_cap
Definition: server.h:252
net_port
cvar_t * net_port
Definition: net.c:88
CM_WriteAreaBits
int CM_WriteAreaBits(cm_t *cm, byte *buffer, int area)
Definition: cmodel.c:925
ratelimit_t::credit
unsigned credit
Definition: server.h:251
client_s::entry
list_t entry
Definition: server.h:257
Info_ValueForKey
char * Info_ValueForKey(const char *s, const char *key)
Definition: shared.c:945
va
char * va(const char *format,...)
Definition: shared.c:429
Z_Free
void Z_Free(void *ptr)
Definition: zone.c:147
Pmove
void Pmove(pmove_t *pmove, pmoveParams_t *params)
Definition: pmove.c:1127
server_static_s::client_pool
client_t * client_pool
Definition: server.h:456
client_s::lastcmd
usercmd_t lastcmd
Definition: server.h:291
AC_ClientBegin
qboolean AC_ClientBegin(client_t *cl)
Definition: ac.c:1020
area_maxs
static float * area_maxs
Definition: world.c:45
server_static_s::initialized
qboolean initialized
Definition: server.h:453
FA_MAX
@ FA_MAX
Definition: server.h:416
Cmd_Register
void Cmd_Register(const cmdreg_t *reg)
Definition: cmd.c:1572
cs_free
@ cs_free
Definition: server.h:186
cs_zombie
@ cs_zombie
Definition: server.h:187
PF_UnlinkEdict
void PF_UnlinkEdict(edict_t *ent)
Definition: world.c:256
origin
static vec3_t origin
Definition: mesh.c:27
SV_FreeFile
#define SV_FreeFile(buf)
Definition: server.h:58
write_server_file
static int write_server_file(qboolean autosave)
Definition: save.c:31
SV_ClientCommand
void SV_ClientCommand(client_t *client, const char *fmt,...)
Definition: send.c:185
SV_MvdClientDropped
void SV_MvdClientDropped(client_t *client)
Definition: mvd.c:2054
PF_ModelIndex
static int PF_ModelIndex(const char *name)
Definition: game.c:58
PF_centerprintf
static void PF_centerprintf(edict_t *ent, const char *fmt,...)
Definition: game.c:266
SV_CloseDownload
void SV_CloseDownload(client_t *client)
Definition: user.c:545
SV_PAUSED
#define SV_PAUSED
Definition: server.h:79
fs_game
cvar_t * fs_game
Definition: files.c:202
Cvar_VariableInteger
int Cvar_VariableInteger(const char *var_name)
Definition: cvar.c:105
PF_DebugGraph
static void PF_DebugGraph(float value, int color)
Definition: game.c:767
NET_Config
void NET_Config(netflag_t flag)
Definition: net.c:1312
SV_AutoSaveEnd
void SV_AutoSaveEnd(void)
Definition: save.c:516
client_frame_t::sentTime
unsigned sentTime
Definition: server.h:107
Q_strlcpy
size_t Q_strlcpy(char *dst, const char *src, size_t size)
Definition: shared.c:715
SV_InitGameProgs
void SV_InitGameProgs(void)
Definition: game.c:841
FA_STUFF
@ FA_STUFF
Definition: server.h:413
MSG_POOLSIZE
#define MSG_POOLSIZE
Definition: server.h:211
client_s::lastmessage
unsigned lastmessage
Definition: server.h:288
SV_New_f
void SV_New_f(void)
Definition: user.c:365
write_pending_download
static void write_pending_download(client_t *client)
Definition: send.c:932
client_s::version
int version
Definition: server.h:325
client_frame_t::latency
int latency
Definition: server.h:108
areanode_s
Definition: world.c:31
client_frame_t
Definition: server.h:99
MSG_WriteShort
void MSG_WriteShort(int c)
Definition: msg.c:125
ge
game_export_t * ge
Definition: game.c:22
client_s::connect_time
time_t connect_time
Definition: server.h:361
Cvar_SetInteger
void Cvar_SetInteger(cvar_t *var, int value, from_t from)
Definition: cvar.c:509
SV_DropClient
void SV_DropClient(client_t *client, const char *reason)
Definition: main.c:212
areanode_s::dist
float dist
Definition: world.c:33
client_frame_t::ps
player_packed_t ps
Definition: server.h:103
Cvar_FullSet
cvar_t * Cvar_FullSet(const char *var_name, const char *value, int flags, from_t from)
Definition: cvar.c:437
client_s::command_msec
int command_msec
Definition: server.h:292
Cvar_UserSet
cvar_t * Cvar_UserSet(const char *var_name, const char *value)
Definition: cvar.c:476
MAX_TOTAL_ENT_LEAFS
#define MAX_TOTAL_ENT_LEAFS
Definition: server.h:176
Cvar_WeakGet
cvar_t * Cvar_WeakGet(const char *var_name)
Definition: cvar.c:324
com_localTime
unsigned com_localTime
Definition: common.c:123
CM_PointContents
int CM_PointContents(vec3_t p, mnode_t *headnode)
Definition: cmodel.c:289
server_static_s::num_entities
unsigned num_entities
Definition: server.h:458
PF_dprintf
static void PF_dprintf(const char *fmt,...)
Definition: game.c:190
cl
client_state_t cl
Definition: main.c:99
PF_WriteFloat
static void PF_WriteFloat(float f)
Definition: game.c:422
client_frame_t::number
int number
Definition: server.h:100
client_s::http_download
qboolean http_download
Definition: server.h:272
Q2PRO_OPTIMIZE
#define Q2PRO_OPTIMIZE(c)
Definition: entities.c:31
server_entity_t
Definition: server.h:111
server_t::cm
cm_t cm
Definition: server.h:161
COM_IsUint
qboolean COM_IsUint(const char *s)
Definition: shared.c:330
client_s::reconnect_var
char reconnect_var[16]
Definition: server.h:283
SV_ParseClientCommand
static void SV_ParseClientCommand(void)
Definition: user.c:1452
MSG_WriteString
void MSG_WriteString(const char *string)
Definition: msg.c:160
c
statCounters_t c
Definition: main.c:30
SV_BroadcastPrintf
void SV_BroadcastPrintf(int level, const char *fmt,...)
Definition: send.c:154
mapcmd_t::cm
cm_t cm
Definition: server.h:444
mapcmd_t::endofunit
qboolean endofunit
Definition: server.h:443
SV_CLIENTSYNC
#define SV_CLIENTSYNC(cl)
Definition: server.h:142
areanode_s::axis
int axis
Definition: world.c:32
parse_mask
static qboolean parse_mask(char *s, netadr_t *addr, netadr_t *mask)
Definition: commands.c:1013
MSG_WriteLong
void MSG_WriteLong(int c)
Definition: msg.c:144
redirect_t
redirect_t
Definition: server.h:581
PF_inPHS
static qboolean PF_inPHS(vec3_t p1, vec3_t p2)
Definition: game.c:469
cs_assigned
@ cs_assigned
Definition: server.h:189
sys_forcegamelib
cvar_t * sys_forcegamelib
Definition: system.c:53
NET_SendPacket
qboolean NET_SendPacket(netsrc_t sock, const void *data, size_t len, const netadr_t *to)
Definition: net.c:918
SV_AreaEdicts_r
static void SV_AreaEdicts_r(areanode_t *node)
Definition: world.c:361
write_plain_baselines
static void write_plain_baselines(void)
Definition: user.c:130
Q2PRO_SHORTANGLES
#define Q2PRO_SHORTANGLES(c, e)
Definition: server.h:179
SAVE_CURRENT
#define SAVE_CURRENT
Definition: save.c:25
CM_PointLeaf
mleaf_t * CM_PointLeaf(cm_t *cm, vec3_t p)
Definition: cmodel.c:209
SV_PointContents
int SV_PointContents(vec3_t p)
Definition: world.c:454
Cvar_ClampInteger
int Cvar_ClampInteger(cvar_t *var, int min, int max)
Definition: cvar.c:549
client_s::settings
int settings[CLS_MAX]
Definition: server.h:326
g_features
cvar_t * g_features
Definition: main.c:99
PF_SoundIndex
static int PF_SoundIndex(const char *name)
Definition: game.c:63
sv_recycle
cvar_t * sv_recycle
Definition: main.c:83
write_datagram_new
static void write_datagram_new(client_t *client)
Definition: send.c:788
server_static_s::realtime
unsigned realtime
Definition: server.h:454
client_s::AddMessage
void(* AddMessage)(struct client_s *, byte *, size_t, qboolean)
Definition: server.h:352
Cvar_GetLatchedVars
void Cvar_GetLatchedVars(void)
Definition: cvar.c:626
RATE_LIMIT_SCALE
#define RATE_LIMIT_SCALE
Definition: main.c:255
client_s::pool
edict_pool_t * pool
Definition: server.h:345
area_count
static int area_count
Definition: world.c:47
SV_ShutdownGameProgs
void SV_ShutdownGameProgs(void)
Definition: game.c:786
cs_primed
@ cs_primed
Definition: server.h:191
add_message_old
static void add_message_old(client_t *client, byte *data, size_t len, qboolean reliable)
Definition: send.c:608
PF_Unicast
static void PF_Unicast(edict_t *ent, qboolean reliable)
Definition: game.c:81
server_t::state
server_state_t state
Definition: server.h:146
mapcmd_t::buffer
char buffer[MAX_QPATH]
Definition: server.h:438
sv_player
edict_t * sv_player
Definition: main.c:33
client_s::ping
int ping
Definition: server.h:297
RD_NONE
@ RD_NONE
Definition: server.h:581
MSG_WriteChar
void MSG_WriteChar(int c)
Definition: msg.c:89
client_s::msg_unreliable_list
list_t msg_unreliable_list
Definition: server.h:333
client_s::frameflags
unsigned frameflags
Definition: server.h:307
client_s::max_ping
int max_ping
Definition: server.h:297
client_s::netchan
netchan_t * netchan
Definition: server.h:357
client_s
Definition: server.h:256
SV_Mallocz
#define SV_Mallocz(size)
Definition: server.h:55
SCR_BeginLoadingPlaque
void SCR_BeginLoadingPlaque(void)
Definition: screen.c:1424
SV_NoSaveGames
int SV_NoSaveGames(void)
Definition: save.c:460
mvd_ge
game_export_t mvd_ge
Definition: game.c:2285
client_s::send_time
unsigned send_time
Definition: server.h:312
sv_running
cvar_t * sv_running
Definition: common.c:95
SV_AreaEdicts
int SV_AreaEdicts(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype)
Definition: world.c:407
client_s::downloadsize
int downloadsize
Definition: server.h:316
sv_areanodes
static areanode_t sv_areanodes[AREA_NODES]
Definition: world.c:42
client_s::numpackets
int numpackets
Definition: server.h:358
client_s::msg_pool
message_packet_t * msg_pool
Definition: server.h:335
cl
client_state_t cl
Definition: main.c:99
PF_TagMalloc
static void * PF_TagMalloc(size_t size, unsigned tag)
Definition: game.c:748
Netchan_Close
void Netchan_Close(netchan_t *netchan)
Definition: chan.c:866
Q_concat
size_t Q_concat(char *dest, size_t size,...)
Definition: shared.c:758
sv_show_name_changes
cvar_t * sv_show_name_changes
Definition: main.c:52
client_s::reconnected
qboolean reconnected
Definition: server.h:265
SV_DPrintf
#define SV_DPrintf(...)
Definition: server.h:65
MSG_ReadByte
int MSG_ReadByte(void)
Definition: msg.c:1475
EDICT_NUM
#define EDICT_NUM(n)
Definition: server.h:173
MVD_RemoveClient
void MVD_RemoveClient(client_t *client)
Definition: game.c:1685
free_all_messages
static void free_all_messages(client_t *client)
Definition: send.c:449
SV_LoadGameLibrary
static void * SV_LoadGameLibrary(const char *game, const char *prefix)
Definition: game.c:812
Sys_FreeLibrary
void Sys_FreeLibrary(void *handle)
Definition: system.c:787
server_t::spawncount
int spawncount
Definition: server.h:147
PF_cprintf
static void PF_cprintf(edict_t *ent, int level, const char *fmt,...)
Definition: game.c:211
client_s::min_ping
int min_ping
Definition: server.h:297
FA_PRINT
@ FA_PRINT
Definition: server.h:412
sv_cmdlist_begin
list_t sv_cmdlist_begin
areanode_s::children
struct areanode_s * children[2]
Definition: world.c:34
AC_ClientDisconnect
void AC_ClientDisconnect(client_t *cl)
Definition: ac.c:1128
server_t::entities
server_entity_t entities[MAX_EDICTS]
Definition: server.h:166
server_t::configstrings
char configstrings[MAX_CONFIGSTRINGS][MAX_QPATH]
Definition: server.h:164
client_frame_t::areabits
byte areabits[MAX_MAP_AREA_BYTES]
Definition: server.h:106
write_level_file
static int write_level_file(void)
Definition: save.c:85
message_packet_t::entry
list_t entry
Definition: server.h:221
SV_EdictIsVisible
qboolean SV_EdictIsVisible(cm_t *cm, edict_t *ent, byte *mask)
Definition: world.c:129
addrmatch_t
Definition: server.h:395
SV_Trace
trace_t q_gameabi SV_Trace(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passedict, int contentmask)
Definition: world.c:546
PF_StartSound
static void PF_StartSound(edict_t *edict, int channel, int soundindex, float volume, float attenuation, float timeofs)
Definition: game.c:511
AVG_PING
#define AVG_PING(cl)
Definition: server.h:246
SV_RateDrop
static qboolean SV_RateDrop(client_t *client)
Definition: send.c:57
RD_PACKET
@ RD_PACKET
Definition: server.h:581
MSG_WriteDir
void MSG_WriteDir(const vec3_t dir)
Definition: msg.c:460
fs_gamedir
char fs_gamedir[MAX_OSPATH]
Definition: files.c:171
MSG_WriteAngle
void MSG_WriteAngle(float f)
Definition: msg.c:214
client_s::configstrings
char * configstrings
Definition: server.h:343
sv_cmdlist_connect
list_t sv_cmdlist_connect
client_s::framenum
int framenum
Definition: server.h:303
cs_connected
@ cs_connected
Definition: server.h:190
PF_configstring
static void PF_configstring(int index, const char *val)
Definition: game.c:356
CM_NodeNum
mnode_t * CM_NodeNum(cm_t *cm, int number)
Definition: cmodel.c:83
CM_TransformedPointContents
int CM_TransformedPointContents(vec3_t p, mnode_t *headnode, vec3_t origin, vec3_t angles)
Definition: cmodel.c:310
stringCmdCount
static int stringCmdCount
Definition: user.c:1035
server_t::name
char name[MAX_QPATH]
Definition: server.h:160
write_datagram_old
static void write_datagram_old(client_t *client)
Definition: send.c:713
stuff_cmds
static void stuff_cmds(list_t *list)
Definition: user.c:308
client_s::pmp
pmoveParams_t pmp
Definition: server.h:328
create_baselines
static void create_baselines(void)
Definition: user.c:40
client_s::cm
cm_t * cm
Definition: server.h:346
client_s::esFlags
msgEsFlags_t esFlags
Definition: server.h:329
SZ_Clear
void SZ_Clear(sizebuf_t *buf)
Definition: sizebuf.c:40
com_eventTime
unsigned com_eventTime
Definition: common.c:122
SV_ClientReset
void SV_ClientReset(client_t *client)
Definition: init.c:24
PF_AreasConnected
static qboolean PF_AreasConnected(int area1, int area2)
Definition: game.c:740
client_s::frames_nodelta
unsigned frames_nodelta
Definition: server.h:302
game_library
static void * game_library
Definition: game.c:776
MSG_WriteDeltaPlayerstate_Default
void MSG_WriteDeltaPlayerstate_Default(const player_packed_t *from, const player_packed_t *to)
Definition: msg.c:795
PF_FreeTags
static void PF_FreeTags(unsigned tag)
Definition: game.c:759
FA_KICK
@ FA_KICK
Definition: server.h:414
client_s::name
char name[MAX_CLIENT_NAME]
Definition: server.h:276
client_s::edict
edict_t * edict
Definition: server.h:261
sv_maxclients
cvar_t * sv_maxclients
Definition: main.c:58
Cmd_RawArgs
char * Cmd_RawArgs(void)
Definition: cmd.c:951
SV_ParseFullUserinfo
static void SV_ParseFullUserinfo(void)
Definition: user.c:1310