This repository has been archived on 2022-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Xash3DArchive/engine/server/server.h

668 lines
23 KiB
C
Raw Normal View History

2011-05-09 22:00:00 +02:00
/*
server.h - primary header for server
Copyright (C) 2009 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
2007-06-21 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
#ifndef SERVER_H
#define SERVER_H
2007-09-06 22:00:00 +02:00
2008-01-12 22:00:00 +01:00
#include "mathlib.h"
2010-08-15 22:00:00 +02:00
#include "edict.h"
#include "eiface.h"
2011-07-07 22:00:00 +02:00
#include "physint.h" // physics interface
2011-04-06 22:00:00 +02:00
#include "mod_local.h"
2010-08-12 22:00:00 +02:00
#include "pm_defs.h"
2010-10-07 22:00:00 +02:00
#include "pm_movevars.h"
#include "entity_state.h"
2010-10-10 22:00:00 +02:00
#include "protocol.h"
2010-10-07 22:00:00 +02:00
#include "netchan.h"
2010-10-28 22:00:00 +02:00
#include "custom.h"
2010-07-19 22:00:00 +02:00
#include "world.h"
2007-11-14 22:00:00 +01:00
2007-06-21 22:00:00 +02:00
//=============================================================================
2007-11-14 22:00:00 +01:00
2010-04-02 22:00:00 +02:00
#define SV_UPDATE_MASK (SV_UPDATE_BACKUP - 1)
extern int SV_UPDATE_BACKUP;
2010-03-14 22:00:00 +01:00
// hostflags
2010-03-28 22:00:00 +02:00
#define SVF_SKIPLOCALHOST BIT( 0 )
2018-03-23 22:00:00 +01:00
#define SVF_MERGE_VISIBILITY BIT( 1 ) // we are do portal pass
2010-03-14 22:00:00 +01:00
2010-04-02 22:00:00 +02:00
// mapvalid flags
#define MAP_IS_EXIST BIT( 0 )
#define MAP_HAS_SPAWNPOINT BIT( 1 )
#define MAP_HAS_LANDMARK BIT( 2 )
2011-01-06 22:00:00 +01:00
#define MAP_INVALID_VERSION BIT( 3 )
2010-04-02 22:00:00 +02:00
2018-03-13 22:00:00 +01:00
#define SV_SPAWN_TIME 0.1
2018-03-05 22:00:00 +01:00
// group flags
#define GROUP_OP_AND 0
#define GROUP_OP_NAND 1
#ifdef NDEBUG
2011-04-05 22:00:00 +02:00
#define SV_IsValidEdict( e ) ( e && !e->free )
2018-03-05 22:00:00 +01:00
#else
#define SV_IsValidEdict( e ) SV_CheckEdict( e, __FILE__, __LINE__ )
#endif
2008-12-26 22:00:00 +01:00
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - svgame.edicts))
2018-03-05 22:00:00 +01:00
#define EDICT_NUM( num ) SV_EdictNum( num )
2008-12-26 22:00:00 +01:00
#define STRING( offset ) SV_GetString( offset )
2011-04-05 22:00:00 +02:00
#define ALLOC_STRING(str) SV_AllocString( str )
2012-12-16 21:00:00 +01:00
#define MAKE_STRING(str) SV_MakeString( str )
2011-04-05 22:00:00 +02:00
#define MAX_PUSHED_ENTS 256
2016-11-21 22:00:00 +01:00
#define MAX_VIEWENTS 128
#define FCL_RESEND_USERINFO BIT( 0 )
#define FCL_RESEND_MOVEVARS BIT( 1 )
#define FCL_SKIP_NET_MESSAGE BIT( 2 )
#define FCL_SEND_NET_MESSAGE BIT( 3 )
#define FCL_PREDICT_MOVEMENT BIT( 4 ) // movement prediction is enabled
#define FCL_LOCAL_WEAPONS BIT( 5 ) // weapon prediction is enabled
#define FCL_LAG_COMPENSATION BIT( 6 ) // lag compensation is enabled
#define FCL_FAKECLIENT BIT( 7 ) // this client is a fake player controlled by the game DLL
#define FCL_HLTV_PROXY BIT( 8 ) // this is a proxy for a HLTV client (spectator)
2018-02-20 22:00:00 +01:00
#define FCL_SEND_RESOURCES BIT( 9 )
#define FCL_FORCE_UNMODIFIED BIT( 10 )
2010-05-22 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
typedef enum
{
ss_dead, // no map loaded
ss_loading, // spawning level edicts
2008-08-02 22:00:00 +02:00
ss_active // actively running
2007-11-04 22:00:00 +01:00
} sv_state_t;
2007-09-16 22:00:00 +02:00
typedef enum
{
2008-09-09 22:00:00 +02:00
cs_free = 0, // can be reused for a new connection
2007-09-16 22:00:00 +02:00
cs_zombie, // client has been disconnected, but don't reuse connection for a couple seconds
2008-07-09 22:00:00 +02:00
cs_connected, // has been assigned to a sv_client_t, but not in game yet
2007-09-16 22:00:00 +02:00
cs_spawned // client is fully in game
2007-11-04 22:00:00 +01:00
} cl_state_t;
2007-06-21 22:00:00 +02:00
2018-02-20 22:00:00 +01:00
typedef enum
{
us_inactive = 0,
us_processing,
us_complete,
} cl_upload_t;
2010-10-19 22:00:00 +02:00
// instanced baselines container
typedef struct
{
2018-03-13 22:00:00 +01:00
const char *classname;
entity_state_t baseline;
} sv_baseline_t;
2010-10-19 22:00:00 +02:00
2018-02-15 22:00:00 +01:00
typedef struct
{
qboolean active;
qboolean net_log;
netadr_t net_address;
file_t *file;
} server_log_t;
2008-07-03 22:00:00 +02:00
typedef struct server_s
2007-06-21 22:00:00 +02:00
{
2007-11-04 22:00:00 +01:00
sv_state_t state; // precache commands are only valid during load
2007-06-21 22:00:00 +02:00
2011-02-22 22:00:00 +01:00
qboolean background; // this is background map
2010-10-26 22:00:00 +02:00
qboolean loadgame; // client begins should reuse existing entity
2016-11-21 22:00:00 +01:00
double time; // sv.time += sv.frametime
double time_residual; // unclamped
float frametime; // 1.0 / sv_fps->value
2018-02-28 22:00:00 +01:00
int framecount; // count physic frames
2018-03-05 22:00:00 +01:00
struct sv_client_s *current_client; // current client who network message sending on
2007-06-21 22:00:00 +02:00
2009-11-25 22:00:00 +01:00
int hostflags; // misc server flags: predicting etc
2018-03-13 22:00:00 +01:00
CRC32_t worldmapCRC; // check crc for catch cheater maps
int progsCRC; // this is used with feature ENGINE_QUAKE_COMPATIBLE
2009-06-24 22:00:00 +02:00
2018-03-13 22:00:00 +01:00
char name[MAX_QPATH]; // map name
char startspot[MAX_QPATH];
2007-06-21 22:00:00 +02:00
2011-07-07 22:00:00 +02:00
double lastchecktime;
int lastcheck; // number of last checked client
2018-02-05 22:00:00 +01:00
char model_precache[MAX_MODELS][MAX_QPATH];
char sound_precache[MAX_SOUNDS][MAX_QPATH];
char files_precache[MAX_CUSTOM][MAX_QPATH];
char event_precache[MAX_EVENTS][MAX_QPATH];
2018-02-20 22:00:00 +01:00
byte model_precache_flags[MAX_MODELS];
2018-02-25 22:00:00 +01:00
model_t *models[MAX_MODELS];
2012-05-12 22:00:00 +02:00
int num_static_entities;
2010-10-28 22:00:00 +02:00
// run local lightstyles to let SV_LightPoint grab the actual information
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
2010-10-26 22:00:00 +02:00
2018-02-20 22:00:00 +01:00
consistency_t consistency_list[MAX_MODELS];
resource_t resources[MAX_RESOURCES];
int num_consistency; // typically check model bounds on this
2012-05-20 22:00:00 +02:00
int num_resources;
2010-10-19 22:00:00 +02:00
2018-03-13 22:00:00 +01:00
sv_baseline_t instanced[MAX_CUSTOM_BASELINES]; // instanced baselines
2018-02-20 22:00:00 +01:00
int last_valid_baseline;// all the entities with number more than that was created in-game and doesn't have the baseline
2018-03-13 22:00:00 +01:00
int num_instanced;
2010-10-19 22:00:00 +02:00
2017-02-05 22:00:00 +01:00
// unreliable data to send to clients.
sizebuf_t datagram;
byte datagram_buf[MAX_DATAGRAM];
2010-10-09 22:00:00 +02:00
// reliable data to send to clients.
sizebuf_t reliable_datagram; // copied to all clients at end of frame
2017-02-05 22:00:00 +01:00
byte reliable_datagram_buf[MAX_DATAGRAM];
2010-10-09 22:00:00 +02:00
2007-06-21 22:00:00 +02:00
// the multicast buffer is used to send a message to a set of clients
2010-08-06 22:00:00 +02:00
sizebuf_t multicast;
2017-02-05 22:00:00 +01:00
byte multicast_buf[MAX_MULTICAST];
2007-06-21 22:00:00 +02:00
2010-08-06 22:00:00 +02:00
sizebuf_t signon;
2018-03-07 22:00:00 +01:00
byte signon_buf[MAX_INIT_MSG]; // need a get to maximum size
2011-04-05 22:00:00 +02:00
2017-02-05 22:00:00 +01:00
sizebuf_t spec_datagram;
byte spectator_buf[MAX_MULTICAST];
2009-11-25 22:00:00 +01:00
2010-08-25 22:00:00 +02:00
model_t *worldmodel; // pointer to world
2018-03-23 22:00:00 +01:00
qboolean playersonly;
2018-04-19 23:00:00 +02:00
qboolean simulating; // physics is running
2010-10-26 22:00:00 +02:00
qboolean paused;
2018-03-05 22:00:00 +01:00
// statistics
int ignored_static_ents;
int ignored_world_decals;
int static_ents_overflow;
2007-09-16 22:00:00 +02:00
} server_t;
2007-06-21 22:00:00 +02:00
typedef struct
{
2010-10-10 22:00:00 +02:00
double senttime;
2015-12-26 22:00:00 +01:00
float ping_time;
2010-10-14 22:00:00 +02:00
2010-10-10 22:00:00 +02:00
clientdata_t clientdata;
2016-11-21 22:00:00 +01:00
weapon_data_t weapondata[MAX_LOCAL_WEAPONS];
2012-05-21 22:00:00 +02:00
2010-10-15 22:00:00 +02:00
int num_entities;
int first_entity; // into the circular sv_packet_entities[]
2007-09-16 22:00:00 +02:00
} client_frame_t;
2007-06-21 22:00:00 +02:00
2008-07-09 22:00:00 +02:00
typedef struct sv_client_s
2007-06-21 22:00:00 +02:00
{
2007-11-04 22:00:00 +01:00
cl_state_t state;
2018-03-06 22:00:00 +01:00
cl_upload_t upstate; // uploading state
2012-12-16 21:00:00 +01:00
char name[32]; // extracted from userinfo, color string allowed
2016-11-21 22:00:00 +01:00
int flags; // client flags, some info
2018-02-20 22:00:00 +01:00
CRC32_t crcValue;
2007-06-21 22:00:00 +02:00
2009-11-23 22:00:00 +01:00
char userinfo[MAX_INFO_STRING]; // name, etc (received from client)
char physinfo[MAX_INFO_STRING]; // set on server (transmit to client)
2010-10-14 22:00:00 +02:00
2010-10-10 22:00:00 +02:00
netchan_t netchan;
int chokecount; // number of messages rate supressed
int delta_sequence; // -1 = no compression.
2010-10-09 22:00:00 +02:00
double next_messagetime; // time when we should send next world state update
2010-10-14 22:00:00 +02:00
double next_checkpingtime; // time to send all players pings to client
2017-02-05 22:00:00 +01:00
double next_sendinfotime; // time to send info about all players
2016-11-21 22:00:00 +01:00
double cl_updaterate; // client requested updaterate
2010-10-14 22:00:00 +02:00
double timebase; // client timebase
2018-03-13 22:00:00 +01:00
double connection_started;
2010-10-09 22:00:00 +02:00
2018-02-15 22:00:00 +01:00
char hashedcdkey[34]; // MD5 hash is 32 hex #'s, plus trailing 0
2017-02-07 22:00:00 +01:00
customization_t customdata; // player customization linked list
resource_t resourcesonhand;
resource_t resourcesneeded; // <mapname.res> from client (server downloading)
2009-06-24 22:00:00 +02:00
usercmd_t lastcmd; // for filling in big drops
2017-02-05 22:00:00 +01:00
double connecttime;
double cmdtime;
double ignorecmdtime;
2010-10-14 22:00:00 +02:00
2009-11-25 22:00:00 +01:00
int packet_loss;
2010-10-14 22:00:00 +02:00
float latency;
2009-06-24 22:00:00 +02:00
2017-02-05 22:00:00 +01:00
int ignored_ents; // if visibility list is full we should know how many entities will be ignored
2007-09-16 22:00:00 +02:00
edict_t *edict; // EDICT_NUM(clientnum+1)
2009-11-25 22:00:00 +01:00
edict_t *pViewEntity; // svc_setview member
2016-11-21 22:00:00 +01:00
edict_t *viewentity[MAX_VIEWENTS]; // list of portal cameras in player PVS
int num_viewents; // num of portal cameras that can merge PVS
2012-05-17 22:00:00 +02:00
2018-03-05 22:00:00 +01:00
qboolean m_bLoopback; // Does this client want to hear his own voice?
uint listeners; // which other clients does this guy's voice stream go to?
2009-09-19 22:00:00 +02:00
// the datagram is written to by sound calls, prints, temp ents, etc.
// it can be harmlessly overflowed.
2010-08-06 22:00:00 +02:00
sizebuf_t datagram;
2017-02-05 22:00:00 +01:00
byte datagram_buf[MAX_DATAGRAM];
2008-07-11 22:00:00 +02:00
2010-04-02 22:00:00 +02:00
client_frame_t *frames; // updates can be delta'd from here
2018-03-13 22:00:00 +01:00
event_state_t events; // delta-updated events cycle
2007-06-21 22:00:00 +02:00
2009-09-16 22:00:00 +02:00
int challenge; // challenge of this user, randomly generated
2010-06-23 22:00:00 +02:00
int userid; // identifying number on server
2008-07-09 22:00:00 +02:00
} sv_client_t;
2007-06-21 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
/*
=============================================================================
a client can leave the server in one of four ways:
dropping properly by quiting or disconnecting
timing out if no valid messages are received for timeout.value seconds
getting kicked off by the server operator
a program error, like an overflowed reliable buffer
=============================================================================
*/
2007-06-21 22:00:00 +02:00
// MAX_CHALLENGES is made large to prevent a denial
// of service attack that could cycle all of them
// out before legitimate users connected
2010-03-28 22:00:00 +02:00
#define MAX_CHALLENGES 1024
2007-06-21 22:00:00 +02:00
typedef struct
{
2007-09-09 22:00:00 +02:00
netadr_t adr;
2010-10-09 22:00:00 +02:00
double time;
2016-11-21 22:00:00 +01:00
int challenge;
2010-10-26 22:00:00 +02:00
qboolean connected;
2007-09-16 22:00:00 +02:00
} challenge_t;
2007-06-21 22:00:00 +02:00
2010-06-22 22:00:00 +02:00
typedef struct
{
2011-04-05 22:00:00 +02:00
char name[32]; // in GoldSrc max name length is 12
2010-06-22 22:00:00 +02:00
int number; // svc_ number
int size; // if size == -1, size come from first byte after svcnum
} sv_user_message_t;
2010-08-18 22:00:00 +02:00
typedef struct
{
edict_t *ent;
vec3_t origin;
vec3_t angles;
2011-08-14 22:00:00 +02:00
int fixangle;
2010-08-18 22:00:00 +02:00
} sv_pushed_t;
2010-10-14 22:00:00 +02:00
typedef struct
{
2010-10-26 22:00:00 +02:00
qboolean active;
qboolean moving;
qboolean firstframe;
qboolean nointerp;
2010-10-14 22:00:00 +02:00
vec3_t mins;
vec3_t maxs;
vec3_t curpos;
vec3_t oldpos;
vec3_t newpos;
vec3_t finalpos;
} sv_interp_t;
2008-12-15 22:00:00 +01:00
typedef struct
{
2008-12-26 22:00:00 +01:00
// user messages stuff
2009-01-02 22:00:00 +01:00
const char *msg_name; // just for debug
2010-06-22 22:00:00 +02:00
sv_user_message_t msg[MAX_USER_MESSAGES]; // user messages array
2010-08-04 22:00:00 +02:00
int msg_size_index; // write message size at this pos in bitbuf
2008-12-26 22:00:00 +01:00
int msg_realsize; // left in bytes
2008-12-15 22:00:00 +01:00
int msg_index; // for debug messages
2008-12-26 22:00:00 +01:00
int msg_dest; // msg destination ( MSG_ONE, MSG_ALL etc )
2012-12-16 21:00:00 +01:00
qboolean msg_started; // to avoid recursive included messages
2009-06-24 22:00:00 +02:00
edict_t *msg_ent; // user message member entity
vec3_t msg_org; // user message member origin
2008-12-26 22:00:00 +01:00
2010-10-21 22:00:00 +02:00
void *hInstance; // pointer to game.dll
2017-03-14 22:00:00 +01:00
qboolean config_executed; // should to execute config.cfg once time to restore FCVAR_ARCHIVE that specified in hl.dll
2008-12-17 22:00:00 +01:00
2018-03-13 22:00:00 +01:00
edict_t *edicts; // solid array of server entities
2010-08-15 22:00:00 +02:00
int numEntities; // actual entities count
2008-12-15 22:00:00 +01:00
2018-03-13 22:00:00 +01:00
movevars_t movevars; // movement variables curstate
movevars_t oldmovevars; // movement variables oldstate
2009-11-10 22:00:00 +01:00
playermove_t *pmove; // pmove state
2012-03-24 21:00:00 +01:00
sv_interp_t interp[MAX_CLIENTS]; // interpolate clients
2011-04-05 22:00:00 +02:00
sv_pushed_t pushed[MAX_PUSHED_ENTS]; // no reason to keep array for all edicts
2010-08-18 22:00:00 +02:00
// 256 it should be enough for any game situation
2010-08-15 22:00:00 +02:00
2008-12-26 22:00:00 +01:00
globalvars_t *globals; // server globals
2018-03-13 22:00:00 +01:00
2008-12-26 22:00:00 +01:00
DLL_FUNCTIONS dllFuncs; // dll exported funcs
2012-12-16 21:00:00 +01:00
NEW_DLL_FUNCTIONS dllFuncs2; // new dll exported funcs (may be NULL)
2011-07-07 22:00:00 +02:00
physics_interface_t physFuncs; // physics interface functions (Xash3D extension)
2018-03-13 22:00:00 +01:00
2009-11-03 22:00:00 +01:00
byte *mempool; // server premamnent pool: edicts etc
2012-12-16 21:00:00 +01:00
byte *stringspool; // for engine strings
2008-12-25 22:00:00 +01:00
} svgame_static_t;
2008-12-15 22:00:00 +01:00
2007-06-21 22:00:00 +02:00
typedef struct
{
2010-10-26 22:00:00 +02:00
qboolean initialized; // sv_init has completed
2010-06-17 22:00:00 +02:00
double timestart; // just for profiling
2007-06-21 22:00:00 +02:00
2017-02-12 22:00:00 +01:00
int maxclients; // server max clients
2009-11-25 22:00:00 +01:00
int groupmask;
int groupop;
2018-02-15 22:00:00 +01:00
server_log_t log;
2017-02-12 22:00:00 +01:00
char serverinfo[MAX_SERVERINFO_STRING];
char localinfo[MAX_LOCALINFO_STRING];
2007-09-16 22:00:00 +02:00
int spawncount; // incremented each server start
// used to check late spawns
2017-02-12 22:00:00 +01:00
sv_client_t *clients; // [svs.maxclients]
int num_client_entities; // svs.maxclients*UPDATE_BACKUP*MAX_PACKET_ENTITIES
2007-07-22 22:00:00 +02:00
int next_client_entities; // next client_entity to use
2010-10-15 22:00:00 +02:00
entity_state_t *packet_entities; // [num_client_entities]
2009-09-24 22:00:00 +02:00
entity_state_t *baselines; // [GI->max_edicts]
2018-06-17 23:00:00 +02:00
entity_state_t *static_entities; // [MAX_STATIC_ENTITIES];
2007-06-21 22:00:00 +02:00
2010-10-09 22:00:00 +02:00
double last_heartbeat;
2007-06-21 22:00:00 +02:00
challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting
} server_static_t;
//=============================================================================
2007-09-16 22:00:00 +02:00
extern server_static_t svs; // persistant server info
extern server_t sv; // local server
2008-12-26 22:00:00 +01:00
extern svgame_static_t svgame; // persistant game info
2012-12-16 21:00:00 +01:00
extern areanode_t sv_areanodes[]; // AABB dynamic tree
2007-06-21 22:00:00 +02:00
2018-02-15 22:00:00 +01:00
extern convar_t mp_logecho;
extern convar_t mp_logfile;
2017-02-12 22:00:00 +01:00
extern convar_t sv_unlag;
extern convar_t sv_maxunlag;
extern convar_t sv_unlagpush;
extern convar_t sv_unlagsamples;
extern convar_t rcon_password;
extern convar_t sv_instancedbaseline;
2018-08-31 23:00:00 +02:00
extern convar_t sv_background_freeze;
2017-02-12 22:00:00 +01:00
extern convar_t sv_minupdaterate;
extern convar_t sv_maxupdaterate;
2018-02-20 22:00:00 +01:00
extern convar_t sv_downloadurl;
2017-02-12 22:00:00 +01:00
extern convar_t sv_newunit;
extern convar_t sv_clienttrace;
extern convar_t sv_failuretime;
extern convar_t sv_send_resources;
extern convar_t sv_send_logos;
extern convar_t sv_allow_upload;
extern convar_t sv_allow_download;
extern convar_t sv_airaccelerate;
extern convar_t sv_accelerate;
extern convar_t sv_friction;
extern convar_t sv_edgefriction;
extern convar_t sv_gravity;
extern convar_t sv_stopspeed;
extern convar_t sv_maxspeed;
2018-03-23 22:00:00 +01:00
extern convar_t sv_wateralpha;
extern convar_t sv_wateramp;
2017-02-12 22:00:00 +01:00
extern convar_t sv_stepsize;
extern convar_t sv_maxvelocity;
extern convar_t sv_rollangle;
extern convar_t sv_rollspeed;
extern convar_t sv_skyname;
2018-03-23 22:00:00 +01:00
extern convar_t sv_skycolor_r;
extern convar_t sv_skycolor_g;
extern convar_t sv_skycolor_b;
extern convar_t sv_skyvec_x;
extern convar_t sv_skyvec_y;
extern convar_t sv_skyvec_z;
2017-02-12 22:00:00 +01:00
extern convar_t sv_consistency;
2018-02-15 22:00:00 +01:00
extern convar_t sv_password;
2018-02-20 22:00:00 +01:00
extern convar_t sv_uploadmax;
2017-02-12 22:00:00 +01:00
extern convar_t deathmatch;
2018-03-05 22:00:00 +01:00
extern convar_t hostname;
2017-02-12 22:00:00 +01:00
extern convar_t skill;
extern convar_t coop;
2010-10-22 22:00:00 +02:00
extern convar_t *sv_pausable; // allows pause in multiplayer
extern convar_t *sv_check_errors;
extern convar_t *sv_reconnect_limit;
extern convar_t *sv_lighting_modulate;
2011-03-20 22:00:00 +01:00
extern convar_t *sv_novis;
2017-08-18 23:00:00 +02:00
extern convar_t *sv_hostmap;
2012-05-23 22:00:00 +02:00
extern convar_t *sv_validate_changelevel;
2011-07-07 22:00:00 +02:00
extern convar_t *public_server;
2007-06-21 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
//===========================================================
2007-06-21 22:00:00 +02:00
//
// sv_main.c
//
2018-02-28 22:00:00 +01:00
void SV_FinalMessage( const char *message, qboolean reconnect );
2018-03-14 22:00:00 +01:00
void SV_DropClient( sv_client_t *cl, qboolean crash );
2012-04-25 22:00:00 +02:00
void SV_UpdateMovevars( qboolean initialize );
2009-11-23 22:00:00 +01:00
int SV_ModelIndex( const char *name );
int SV_SoundIndex( const char *name );
int SV_EventIndex( const char *name );
int SV_GenericIndex( const char *name );
2009-11-25 22:00:00 +01:00
int SV_CalcPacketLoss( sv_client_t *cl );
2008-07-11 22:00:00 +02:00
void SV_ExecuteUserCommand (char *s);
2007-11-17 22:00:00 +01:00
void SV_InitOperatorCommands( void );
void SV_KillOperatorCommands( void );
2018-03-14 22:00:00 +01:00
void SV_UserinfoChanged( sv_client_t *cl );
2016-08-12 23:00:00 +02:00
void SV_RemoteCommand( netadr_t from, sizebuf_t *msg );
2010-04-12 22:00:00 +02:00
void SV_PrepWorldFrame( void );
2018-03-06 22:00:00 +01:00
void SV_ProcessFile( sv_client_t *cl, const char *filename );
2018-03-14 22:00:00 +01:00
void SV_SendResource( resource_t *pResource, sizebuf_t *msg );
2011-07-07 22:00:00 +02:00
void SV_SendResourceList( sv_client_t *cl );
2016-08-13 23:00:00 +02:00
void SV_AddToMaster( netadr_t from, sizebuf_t *msg );
2016-11-21 22:00:00 +01:00
qboolean SV_IsSimulating( void );
2018-03-04 22:00:00 +01:00
qboolean SV_InitGame( void );
void SV_FreeClients( void );
2011-07-07 22:00:00 +02:00
void Master_Add( void );
2010-04-12 22:00:00 +02:00
void Master_Heartbeat( void );
void Master_Packet( void );
2007-06-21 22:00:00 +02:00
//
// sv_init.c
//
2018-02-27 22:00:00 +01:00
void SV_ActivateServer( int runPhysics );
2018-02-25 22:00:00 +01:00
qboolean SV_SpawnServer( const char *server, const char *startspot, qboolean background );
model_t *SV_ModelHandle( int modelindex );
2018-02-27 22:00:00 +01:00
void SV_DeactivateServer( void );
2007-06-21 22:00:00 +02:00
//
// sv_phys.c
//
2008-07-30 22:00:00 +02:00
void SV_Physics( void );
2011-07-07 22:00:00 +02:00
qboolean SV_InitPhysicsAPI( void );
2009-11-02 22:00:00 +01:00
void SV_CheckVelocity( edict_t *ent );
2010-10-26 22:00:00 +02:00
qboolean SV_CheckWater( edict_t *ent );
qboolean SV_RunThink( edict_t *ent );
2012-03-24 21:00:00 +01:00
qboolean SV_PlayerRunThink( edict_t *ent, float frametime, double time );
2018-03-23 22:00:00 +01:00
qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker );
2012-03-24 21:00:00 +01:00
void SV_Impact( edict_t *e1, edict_t *e2, trace_t *trace );
2011-04-05 22:00:00 +02:00
qboolean SV_CanPushed( edict_t *ent );
2012-03-24 21:00:00 +01:00
void SV_FreeOldEntities( void );
2011-03-22 22:00:00 +01:00
void SV_CheckAllEnts( void );
2007-09-29 22:00:00 +02:00
2008-07-30 22:00:00 +02:00
//
// sv_move.c
//
2010-10-26 22:00:00 +02:00
qboolean SV_MoveStep( edict_t *ent, vec3_t move, qboolean relink );
qboolean SV_MoveTest( edict_t *ent, vec3_t move, qboolean relink );
2009-11-23 22:00:00 +01:00
void SV_MoveToOrigin( edict_t *ed, const vec3_t goal, float dist, int iMode );
2010-10-26 22:00:00 +02:00
qboolean SV_CheckBottom( edict_t *ent, int iMode );
2009-11-23 22:00:00 +01:00
float SV_VecToYaw( const vec3_t src );
2012-05-26 22:00:00 +02:00
void SV_WaterMove( edict_t *ent );
2008-07-30 22:00:00 +02:00
2007-06-21 22:00:00 +02:00
//
// sv_send.c
//
2008-12-26 22:00:00 +01:00
void SV_SendClientMessages( void );
2018-02-27 22:00:00 +01:00
void SV_ClientPrintf( sv_client_t *cl, char *fmt, ... );
void SV_BroadcastPrintf( sv_client_t *ignore, char *fmt, ... );
2017-02-12 22:00:00 +01:00
void SV_BroadcastCommand( const char *fmt, ... );
2007-06-21 22:00:00 +02:00
//
2008-07-12 22:00:00 +02:00
// sv_client.c
2007-06-21 22:00:00 +02:00
//
2008-07-12 22:00:00 +02:00
char *SV_StatusString( void );
2010-02-02 22:00:00 +01:00
void SV_RefreshUserinfo( void );
2008-07-12 22:00:00 +02:00
void SV_GetChallenge( netadr_t from );
void SV_DirectConnect( netadr_t from );
2009-11-10 22:00:00 +01:00
void SV_TogglePause( const char *msg );
2010-10-26 22:00:00 +02:00
qboolean SV_ShouldUpdatePing( sv_client_t *cl );
2010-10-19 22:00:00 +02:00
const char *SV_GetClientIDString( sv_client_t *cl );
2010-08-06 22:00:00 +02:00
void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg );
2010-10-09 22:00:00 +02:00
void SV_FullUpdateMovevars( sv_client_t *cl, sizebuf_t *msg );
2010-10-14 22:00:00 +02:00
void SV_GetPlayerStats( sv_client_t *cl, int *ping, int *packet_loss );
2018-02-27 22:00:00 +01:00
void SV_SendServerdata( sizebuf_t *msg, sv_client_t *cl );
2008-07-30 22:00:00 +02:00
void SV_ClientThink( sv_client_t *cl, usercmd_t *cmd );
2010-08-06 22:00:00 +02:00
void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg );
void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg );
2009-11-23 22:00:00 +01:00
edict_t *SV_FakeConnect( const char *netname );
2017-02-05 22:00:00 +01:00
void SV_ExecuteClientCommand( sv_client_t *cl, char *s );
2010-10-14 22:00:00 +02:00
void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed );
2018-02-27 22:00:00 +01:00
void SV_BuildReconnect( sizebuf_t *msg );
2010-10-26 22:00:00 +02:00
qboolean SV_IsPlayerIndex( int idx );
2017-02-05 22:00:00 +01:00
int SV_CalcPing( sv_client_t *cl );
2009-11-10 22:00:00 +01:00
void SV_InitClientMove( void );
2010-03-30 22:00:00 +02:00
void SV_UpdateServerInfo( void );
2015-12-04 22:00:00 +01:00
void SV_EndRedirect( void );
2007-06-21 22:00:00 +02:00
//
2009-09-28 22:00:00 +02:00
// sv_cmds.c
2007-06-21 22:00:00 +02:00
//
2008-01-17 22:00:00 +01:00
void SV_Status_f( void );
2008-01-20 22:00:00 +01:00
void SV_Newgame_f( void );
2017-02-05 22:00:00 +01:00
void SV_InitHostCommands( void );
2007-06-21 22:00:00 +02:00
2012-05-20 22:00:00 +02:00
//
// sv_custom.c
//
2018-02-20 22:00:00 +01:00
void SV_AddToResourceList( resource_t *pResource, resource_t *pList );
void SV_MoveToOnHandList( sv_client_t *cl, resource_t *pResource );
void SV_RemoveFromResourceList( resource_t *pResource );
void SV_ParseConsistencyResponse( sv_client_t *cl, sizebuf_t *msg );
int SV_EstimateNeededResources( sv_client_t *cl );
void SV_ClearResourceList( resource_t *pList );
void SV_BatchUploadRequest( sv_client_t *cl );
void SV_SendResources( sv_client_t *cl, sizebuf_t *msg );
2018-03-04 22:00:00 +01:00
void SV_ClearResourceLists( sv_client_t *cl );
2018-03-06 22:00:00 +01:00
void SV_TransferConsistencyInfo( void );
void SV_RequestMissingResources( void );
2012-05-20 22:00:00 +02:00
2007-06-21 22:00:00 +02:00
//
2009-11-02 22:00:00 +01:00
// sv_frame.c
2007-06-21 22:00:00 +02:00
//
2018-02-27 22:00:00 +01:00
void SV_InactivateClients( void );
2018-06-17 23:00:00 +02:00
int SV_FindBestBaselineForStatic( int index, entity_state_t **baseline, entity_state_t *to );
2010-08-06 22:00:00 +02:00
void SV_WriteFrameToClient( sv_client_t *client, sizebuf_t *msg );
2009-06-24 22:00:00 +02:00
void SV_BuildClientFrame( sv_client_t *client );
2010-04-03 22:00:00 +02:00
void SV_SendMessagesToAll( void );
2010-10-17 22:00:00 +02:00
void SV_SkipUpdates( void );
2007-09-06 22:00:00 +02:00
//
// sv_game.c
//
2010-10-26 22:00:00 +02:00
qboolean SV_LoadProgs( const char *name );
2008-12-15 22:00:00 +01:00
void SV_UnloadProgs( void );
2008-12-26 22:00:00 +01:00
void SV_FreeEdicts( void );
2009-11-02 22:00:00 +01:00
edict_t *SV_AllocEdict( void );
void SV_FreeEdict( edict_t *pEdict );
2009-09-24 22:00:00 +02:00
void SV_InitEdict( edict_t *pEdict );
2009-11-27 22:00:00 +01:00
const char *SV_ClassName( const edict_t *e );
2016-11-21 22:00:00 +01:00
void SV_FreePrivateData( edict_t *pEdict );
2009-11-02 22:00:00 +01:00
void SV_CopyTraceToGlobal( trace_t *trace );
2018-03-05 22:00:00 +01:00
qboolean SV_CheckEdict( const edict_t *e, const char *file, const int line );
2017-07-14 23:00:00 +02:00
void SV_SetMinMaxSize( edict_t *e, const float *min, const float *max, qboolean relink );
2011-12-25 21:00:00 +01:00
edict_t* SV_FindEntityByString( edict_t *pStartEdict, const char *pszField, const char *pszValue );
2010-08-12 22:00:00 +02:00
void SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
2011-10-09 22:00:00 +02:00
void SV_PlaybackReliableEvent( sizebuf_t *msg, word eventindex, float delay, event_args_t *args );
2018-03-23 22:00:00 +01:00
int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample, int vol, float attn, int flags, int pitch, const vec3_t pos );
2016-11-29 22:00:00 +01:00
qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax );
2018-10-16 23:00:00 +02:00
void SV_QueueChangeLevel( const char *level, const char *landname );
2010-04-07 22:00:00 +02:00
void SV_WriteEntityPatch( const char *filename );
2008-07-30 22:00:00 +02:00
float SV_AngleMod( float ideal, float current, float speed );
2018-03-01 22:00:00 +01:00
void SV_SpawnEntities( const char *mapname );
2009-01-10 22:00:00 +01:00
edict_t* SV_AllocPrivateData( edict_t *ent, string_t className );
2017-03-13 22:00:00 +01:00
edict_t* SV_CreateNamedEntity( edict_t *ent, string_t className );
2008-12-26 22:00:00 +01:00
string_t SV_AllocString( const char *szValue );
2012-12-16 21:00:00 +01:00
string_t SV_MakeString( const char *szValue );
2008-12-26 22:00:00 +01:00
const char *SV_GetString( string_t iString );
2012-12-16 21:00:00 +01:00
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, qboolean spawned_only );
2010-04-02 22:00:00 +02:00
int SV_MapIsValid( const char *filename, const char *spawn_entity, const char *landmark_name );
2009-01-25 22:00:00 +01:00
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
2018-03-23 22:00:00 +01:00
edict_t *SV_FindGlobalEntity( string_t classname, string_t globalname );
2018-06-17 23:00:00 +02:00
qboolean SV_CreateStaticEntity( struct sizebuf_s *msg, int index );
2018-02-20 22:00:00 +01:00
void SV_SendUserReg( sizebuf_t *msg, sv_user_message_t *user );
2010-07-01 22:00:00 +02:00
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
int pfnIndexOfEdict( const edict_t *pEdict );
2016-11-29 22:00:00 +01:00
void pfnWriteBytes( const byte *bytes, int count );
2009-12-01 22:00:00 +01:00
void SV_UpdateBaseVelocity( edict_t *ent );
2011-03-20 22:00:00 +01:00
byte *pfnSetFatPVS( const float *org );
byte *pfnSetFatPAS( const float *org );
2010-10-26 22:00:00 +02:00
int pfnPrecacheModel( const char *s );
2018-06-17 23:00:00 +02:00
int pfnModelIndex( const char *m );
2017-03-11 22:00:00 +01:00
void pfnRemoveEntity( edict_t* e );
2018-03-14 22:00:00 +01:00
void SV_RestartAmbientSounds( void );
void SV_RestartDecals( void );
2013-10-23 22:00:00 +02:00
void SV_RestartStaticEnts( void );
2018-03-05 22:00:00 +01:00
int pfnGetCurrentPlayer( void );
edict_t *SV_EdictNum( int n );
2017-02-12 22:00:00 +01:00
char *SV_Localinfo( void );
2008-12-15 22:00:00 +01:00
2018-02-15 22:00:00 +01:00
//
// sv_log.c
//
void Log_Close( void );
void Log_Open( void );
void Log_PrintServerVars( void );
2018-02-28 22:00:00 +01:00
qboolean SV_ServerLog_f( sv_client_t *cl );
2018-02-15 22:00:00 +01:00
2007-06-25 22:00:00 +02:00
//
// sv_save.c
//
2010-03-25 22:00:00 +01:00
void SV_SaveGame( const char *pName );
2010-10-26 22:00:00 +02:00
qboolean SV_LoadGame( const char *pName );
2018-03-23 22:00:00 +01:00
int SV_LoadGameState( char const *level );
2018-03-08 22:00:00 +01:00
void SV_ChangeLevel( qboolean loadfromsavedgame, const char *mapname, const char *start, qboolean background );
2012-12-16 21:00:00 +01:00
const char *SV_GetLatestSave( void );
2011-04-05 22:00:00 +02:00
void SV_InitSaveRestore( void );
2018-02-27 22:00:00 +01:00
void SV_ClearGameState( void );
2010-08-25 22:00:00 +02:00
2012-03-24 21:00:00 +01:00
//
// sv_pmove.c
//
void SV_GetTrueOrigin( sv_client_t *cl, int edictnum, vec3_t origin );
void SV_GetTrueMinMax( sv_client_t *cl, int edictnum, vec3_t mins, vec3_t maxs );
2017-07-12 23:00:00 +02:00
qboolean SV_PlayerIsFrozen( edict_t *pClient );
2012-03-24 21:00:00 +01:00
2007-06-21 22:00:00 +02:00
//
2009-11-02 22:00:00 +01:00
// sv_world.c
2007-06-21 22:00:00 +02:00
//
2009-11-02 22:00:00 +01:00
void SV_ClearWorld( void );
2010-10-09 22:00:00 +02:00
void SV_UnlinkEdict( edict_t *ent );
2012-02-12 21:00:00 +01:00
void SV_ClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, trace_t *trace );
2012-06-25 22:00:00 +02:00
void SV_CustomClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, trace_t *trace );
2010-08-26 22:00:00 +02:00
trace_t SV_TraceHull( edict_t *ent, int hullNum, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end );
2017-08-14 23:00:00 +02:00
trace_t SV_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e, qboolean monsterclip );
2012-02-12 21:00:00 +01:00
trace_t SV_MoveNoEnts( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e );
2017-08-14 23:00:00 +02:00
trace_t SV_MoveNormal( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e );
2010-10-18 22:00:00 +02:00
const char *SV_TraceTexture( edict_t *ent, const vec3_t start, const vec3_t end );
2015-01-24 22:00:00 +01:00
msurface_t *SV_TraceSurface( edict_t *ent, const vec3_t start, const vec3_t end );
2009-11-02 22:00:00 +01:00
trace_t SV_MoveToss( edict_t *tossent, edict_t *ignore );
2010-10-26 22:00:00 +02:00
void SV_LinkEdict( edict_t *ent, qboolean touch_triggers );
2009-11-02 22:00:00 +01:00
void SV_TouchLinks( edict_t *ent, areanode_t *node );
2010-05-22 22:00:00 +02:00
int SV_TruePointContents( const vec3_t p );
2008-07-30 22:00:00 +02:00
int SV_PointContents( const vec3_t p );
2010-10-19 22:00:00 +02:00
void SV_RunLightStyles( void );
2013-09-14 22:00:00 +02:00
void SV_SetLightStyle( int style, const char* s, float f );
2012-07-29 22:00:00 +02:00
const char *SV_GetLightStyle( int style );
2010-10-19 22:00:00 +02:00
int SV_LightForEntity( edict_t *pEdict );
2011-04-18 22:00:00 +02:00
void SV_ClearPhysEnts( void );
2007-06-21 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
#endif//SERVER_H