Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
20 #include "shared/shared.h"
21 #include "shared/list.h"
22 #include "shared/game.h"
24 #include "common/bsp.h"
25 #include "common/cmd.h"
26 #include "common/cmodel.h"
27 #include "common/common.h"
28 #include "common/cvar.h"
29 #include "common/error.h"
30 #include "common/files.h"
31 #include "common/msg.h"
32 #include "common/net/net.h"
33 #include "common/net/chan.h"
34 #include "common/pmove.h"
35 #include "common/prompt.h"
36 #include "common/protocol.h"
37 #include "common/x86/fpu.h"
38 #include "common/zone.h"
42 #include "system/system.h"
54 #define SV_Malloc(size) Z_TagMalloc(size, TAG_SERVER)
55 #define SV_Mallocz(size) Z_TagMallocz(size, TAG_SERVER)
56 #define SV_CopyString(s) Z_TagCopyString(s, TAG_SERVER)
57 #define SV_LoadFile(path, buf) FS_LoadFileEx(path, buf, 0, TAG_SERVER)
58 #define SV_FreeFile(buf) Z_Free(buf)
61 #define SV_DPrintf(level,...) \
62 if (sv_debug && sv_debug->integer > level) \
63 Com_LPrintf(PRINT_DEVELOPER, __VA_ARGS__)
65 #define SV_DPrintf(...)
68 #define SV_BASELINES_SHIFT 6
69 #define SV_BASELINES_PER_CHUNK (1 << SV_BASELINES_SHIFT)
70 #define SV_BASELINES_MASK (SV_BASELINES_PER_CHUNK - 1)
71 #define SV_BASELINES_CHUNKS (MAX_EDICTS >> SV_BASELINES_SHIFT)
73 #define SV_InfoSet(var, val) \
74 Cvar_FullSet(var, val, CVAR_SERVERINFO|CVAR_ROM, FROM_CODE)
77 #define SV_PAUSED (sv_paused->integer != 0)
83 #define SV_GMF_VARIABLE_FPS GMF_VARIABLE_FPS
85 #define SV_GMF_VARIABLE_FPS 0
89 #define SV_FEATURES (GMF_CLIENTNUM | GMF_PROPERINUSE | GMF_MVDSPEC | \
90 GMF_WANT_ALL_DISCONNECTS | GMF_ENHANCED_SAVEGAMES | \
91 SV_GMF_VARIABLE_FPS | GMF_EXTRA_USERINFO)
94 #define MVD_SPAWN_DISABLED 0
95 #define MVD_SPAWN_ENABLED 0x40000000
96 #define MVD_SPAWN_INTERNAL 0x80000000
97 #define MVD_SPAWN_MASK 0xc0000000
106 byte areabits[MAX_MAP_AREA_BYTES];
117 #define ENT_HISTORY_SIZE 8
118 #define ENT_HISTORY_MASK (ENT_HISTORY_SIZE - 1)
123 } history[ENT_HISTORY_SIZE];
125 vec3_t create_origin;
132 #define SV_FRAMERATE sv.framerate
133 #define SV_FRAMETIME sv.frametime
134 #define SV_FRAMEDIV sv.framediv
135 #define SV_FRAMESYNC !(sv.framenum % sv.framediv)
136 #define SV_CLIENTSYNC(cl) !(sv.framenum % (cl)->framediv)
138 #define SV_FRAMERATE BASE_FRAMERATE
139 #define SV_FRAMETIME BASE_FRAMETIME
140 #define SV_FRAMEDIV 1
141 #define SV_FRAMESYNC 1
142 #define SV_CLIENTSYNC(cl) 1
158 char mapcmd[MAX_QPATH];
160 char name[MAX_QPATH];
164 char configstrings[MAX_CONFIGSTRINGS][MAX_QPATH];
171 #define EDICT_POOL(c, n) ((edict_t *)((byte *)(c)->pool->edicts + (c)->pool->edict_size*(n)))
173 #define EDICT_NUM(n) ((edict_t *)((byte *)ge->edicts + ge->edict_size*(n)))
174 #define NUM_FOR_EDICT(e) ((int)(((byte *)(e) - (byte *)ge->edicts) / ge->edict_size))
176 #define MAX_TOTAL_ENT_LEAFS 128
179 #define Q2PRO_SHORTANGLES(c, e) \
180 ((c)->protocol == PROTOCOL_VERSION_Q2PRO && \
181 (c)->version >= PROTOCOL_VERSION_Q2PRO_SHORT_ANGLES && \
182 sv.state == ss_game && \
183 EDICT_POOL(c, e)->solid == SOLID_BSP)
209 #endif // USE_AC_SERVER
211 #define MSG_POOLSIZE 1024
212 #define MSG_TRESHOLD (64 - 10) // keep pmsg_s 64 bytes aligned
214 #define MSG_RELIABLE 1
216 #define MSG_COMPRESS 4
218 #define MAX_SOUND_PACKET 14
237 #define RATE_MESSAGES 10
239 #define FOR_EACH_CLIENT(client) \
240 LIST_FOR_EACH(client_t, client, &sv_clientlist, entry)
242 #define PL_S2C(cl) (cl->frames_sent ? \
243 (1.0f - (float)cl->frames_acked / cl->frames_sent) * 100.0f : 0.0f)
244 #define PL_C2S(cl) (cl->netchan->total_received ? \
245 ((float)cl->netchan->total_dropped / cl->netchan->total_received) * 100.0f : 0.0f)
246 #define AVG_PING(cl) (cl->avg_ping_count ? \
247 cl->avg_ping_time / cl->avg_ping_count : cl->ping)
270 qboolean unreachable: 1;
366 ac_query_t ac_query_sent;
368 int ac_file_failures;
369 unsigned ac_query_time;
371 string_entry_t *ac_bad_files;
387 #define MAX_CHALLENGES 1024
426 #define MAX_MASTERS 8 // max recipients for heartbeat packets
427 #define HEARTBEAT_SECONDS 300
438 char buffer[MAX_QPATH];
447 #define FOR_EACH_MASTER(m) \
448 LIST_FOR_EACH(master_t, m, &sv_masterlist, entry)
449 #define FOR_EACH_MASTER_SAFE(m, n) \
450 LIST_FOR_EACH_SAFE(master_t, m, n, &sv_masterlist, entry)
488 extern pmoveParams_t
sv_pmp;
498 extern cvar_t *sv_fps;
504 extern cvar_t *sv_debug;
505 extern cvar_t *sv_pad_packets;
514 extern cvar_t *sv_packetdup_hack;
566 voidpf SV_zalloc(voidpf opaque, uInt items, uInt size);
567 void SV_zfree(voidpf opaque, voidpf address);
582 #define SV_OUTPUTBUF_LENGTH (MAX_PACKETLEN_DEFAULT - 16)
584 #define SV_ClientRedirect() \
585 Com_BeginRedirect(RD_CLIENT, sv_outputbuf, MAX_STRING_CHARS - 1, SV_FlushRedirect)
587 #define SV_PacketRedirect() \
588 Com_BeginRedirect(RD_PACKET, sv_outputbuf, SV_OUTPUTBUF_LENGTH, SV_FlushRedirect)
620 void SV_MvdUnicast(edict_t *ent,
int clientNum, qboolean reliable);
625 int soundindex,
int volume,
626 int attenuation,
int timeofs);
631 #define SV_MvdRegister() (void)0
632 #define SV_MvdInit() (void)0
633 #define SV_MvdShutdown(type) (void)0
634 #define SV_MvdBeginFrame() (void)0
635 #define SV_MvdEndFrame() (void)0
636 #define SV_MvdRunClients() (void)0
637 #define SV_MvdStatus_f() (void)0
638 #define SV_MvdMapChanged() (void)0
639 #define SV_MvdClientDropped(client) (void)0
641 #define SV_MvdUnicast(ent, clientNum, reliable) (void)0
642 #define SV_MvdMulticast(leafnum, to) (void)0
643 #define SV_MvdConfigstring(index, string, len) (void)0
644 #define SV_MvdBroadcastPrint(level, string) (void)0
645 #define SV_MvdStartSound(entnum, channel, flags, \
646 soundindex, volume, \
647 attenuation, timeofs) (void)0
649 #define SV_MvdRecord_f() (void)0
650 #define SV_MvdStop_f() (void)0
671 #define AC_ClientConnect(cl) ""
672 #define AC_ClientDisconnect(cl) (void)0
673 #define AC_ClientBegin(cl) qtrue
674 #define AC_ClientAnnounce(cl) (void)0
675 #define AC_ClientToken(cl, token) (void)0
677 #define AC_Register() (void)0
678 #define AC_Disconnect() (void)0
679 #define AC_Connect(mvd_spawn) (void)0
680 #define AC_Run() (void)0
682 #define AC_List_f() \
683 Com_Printf("This server does not support anticheat.\n")
684 #define AC_Info_f() \
685 Com_Printf("This server does not support anticheat.\n")
698 #define SV_AlignKeyFrames(client) (void)0
704 #if USE_MVD_CLIENT || USE_MVD_SERVER
705 extern const cmd_option_t
o_record[];
718 #define ES_INUSE(s) \
719 ((s)->modelindex || (s)->effects || (s)->sound || (s)->event)
729 extern game_export_t *
ge;
767 int SV_AreaEdicts(vec3_t mins, vec3_t maxs, edict_t **list,
int maxcount,
int areatype);
786 trace_t q_gameabi
SV_Trace(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
787 edict_t *passedict,
int contentmask);
qboolean sv_pending_autosave
void SV_AutoSaveBegin(mapcmd_t *cmd)
#define SV_MvdConfigstring(index, string, len)
void SV_AddMatch_f(list_t *list)
void SV_ListMatches_f(list_t *list)
static cvar_t * ac_required
#define SV_MvdBeginFrame()
#define SV_BASELINES_CHUNKS
void SV_SendAsyncPackets(void)
#define AC_Connect(mvd_spawn)
#define AC_ClientDisconnect(cl)
void SV_FlushRedirect(int redirected, char *outputbuf, size_t len)
entity_packed_t * entities
#define AC_ClientToken(cl, token)
void void void void SV_BroadcastCommand(const char *fmt,...) q_printf(1
void SV_InitEdict(edict_t *e)
void SV_WriteFrameToClient_Enhanced(client_t *client)
cvar_t * map_override_path
cvar_t * sv_lan_force_rate
#define SV_MvdShutdown(type)
ratelimit_t ratelimit_rcon
cvar_t * sv_allow_unconnected_cmds
void SV_InitGame(unsigned mvd_spawn)
void(* WriteDatagram)(struct client_s *)
#define SV_MvdBroadcastPrint(level, string)
#define SV_MvdClientDropped(client)
struct server_static_s server_static_t
void void void void void SV_ClientAddMessage(client_t *client, int flags)
#define AC_ClientBegin(cl)
ratelimit_t ratelimit_auth
int SV_CountClients(void)
void SV_InitClientSend(client_t *newcl)
void void void SV_ClientCommand(client_t *cl, const char *fmt,...) q_printf(2
ratelimit_t ratelimit_status
void PF_LinkEdict(edict_t *ent)
qboolean SV_ParseMapCmd(mapcmd_t *cmd)
char sv_outputbuf[SV_OUTPUTBUF_LENGTH]
void SV_RemoveClient(client_t *client)
#define SV_AlignKeyFrames(client)
client_t * SV_GetPlayer(const char *s, qboolean partial)
int SV_AreaEdicts(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype)
void SV_ShutdownClientSend(client_t *client)
void SV_BuildProxyClientFrame(client_t *client)
void SV_CheckForSavegame(mapcmd_t *cmd)
void SV_BuildClientFrame(client_t *client)
#define SV_MvdUnicast(ent, clientNum, reliable)
entity_packed_t * baselines[SV_BASELINES_CHUNKS]
void SV_InitGameProgs(void)
client_frame_t frames[UPDATE_BACKUP]
challenge_t challenges[MAX_CHALLENGES]
void SV_ExecuteClientMessage(client_t *cl)
cvar_t * sv_reserved_slots
void PF_UnlinkEdict(edict_t *ent)
#define AC_ClientAnnounce(cl)
void SV_CloseDownload(client_t *client)
void(APIENTRY *qwglDrawBuffer)(GLenum mode)
void SV_AutoSaveEnd(void)
void SV_LinkEdict(cm_t *cm, edict_t *ent)
size_t message_size[RATE_MESSAGES]
#define AC_ClientConnect(cl)
static const cmd_option_t o_record[]
void SV_Multicast(vec3_t origin, multicast_t to)
#define SV_OUTPUTBUF_LENGTH
void SV_SendClientMessages(void)
void SV_RegisterSavegames(void)
void SV_WriteFrameToClient_Default(client_t *client)
void SV_UserinfoChanged(client_t *cl)
cvar_t * sv_calcpings_method
void void SV_BroadcastPrintf(int level, const char *fmt,...) q_printf(2
void SV_DropClient(client_t *drop, const char *reason)
int SV_PointContents(vec3_t p)
#define SV_MvdMapChanged()
void SV_ShutdownGameProgs(void)
#define SV_MvdMulticast(leafnum, to)
static void q_printf(2, 3)
cvar_t * sv_strafejump_hack
void(* AddMessage)(struct client_s *, byte *, size_t, qboolean)
void SV_CleanClient(client_t *client)
addrmatch_t * SV_MatchAddress(list_t *list, netadr_t *address)
void SV_ClientPrintf(client_t *cl, int level, const char *fmt,...) q_printf(3
void(* WriteFrame)(struct client_s *)
qboolean SV_RateLimited(ratelimit_t *r)
#define SV_MvdStartSound(entnum, channel, flags, soundindex, volume, attenuation, timeofs)
#define SV_MvdRunClients()
void SV_SpawnServer(mapcmd_t *cmd)
size_t msg_unreliable_bytes
void PF_Pmove(pmove_t *pm)
list_t msg_unreliable_list
void SV_RateRecharge(ratelimit_t *r)
message_packet_t * msg_pool
void SV_InitOperatorCommands(void)
void SV_PrintMiscInfo(void)
qboolean SV_EdictIsVisible(cm_t *cm, edict_t *ent, byte *mask)
trace_t q_gameabi SV_Trace(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passedict, int contentmask)
void SV_RateInit(ratelimit_t *r, const char *s)
cvar_t * sv_force_reconnect
ratelimit_t ratelimit_namechange
char userinfo[MAX_INFO_STRING]
list_t sv_cmdlist_connect
void SV_DelMatch_f(list_t *list)
cvar_t * sv_airaccelerate
void SV_ClientReset(client_t *client)
char name[MAX_CLIENT_NAME]
cvar_t * sv_enhanced_setplayer