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

652 lines
22 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 )
2010-04-12 22:00:00 +02:00
#define SVF_PLAYERSONLY BIT( 1 )
2016-11-21 22:00:00 +01:00
#define SVF_MERGE_VISIBILITY BIT( 2 ) // 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
2011-04-05 22:00:00 +02:00
#define SV_IsValidEdict( e ) ( e && !e->free )
2008-12-26 22:00:00 +01:00
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - svgame.edicts))
#define EDICT_NUM( num ) SV_EDICT_NUM( num, __FILE__, __LINE__ )
#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)
2008-12-26 22:00:00 +01:00
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
2010-10-19 22:00:00 +02:00
// instanced baselines container
typedef struct
{
int count;
string_t classnames[64];
entity_state_t baselines[64];
} sv_baselines_t;
typedef struct
{
const char *name;
FORCE_TYPE force_state;
vec3_t mins, maxs;
} sv_consistency_t;
2012-05-12 22:00:00 +02:00
// like as entity_state_t in Quake
typedef struct
{
char model[64]; // name of static-entity model for right precache
vec3_t origin;
vec3_t angles;
byte sequence;
byte frame;
short colormap;
byte skin; // can't set contents! only real skin!
2018-02-02 22:00:00 +01:00
byte body;
float scale;
2012-05-12 22:00:00 +02:00
byte rendermode;
byte renderamt;
color24 rendercolor;
byte renderfx;
} sv_static_entity_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
2012-08-29 22:00:00 +02:00
qboolean changelevel; // set if changelevel in-action (smooth or classic)
2010-10-28 22:00:00 +02:00
int viewentity; // applied on client restore. this is temporare place
// until client connected
2007-09-06 22:00:00 +02:00
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
2010-06-20 22:00:00 +02:00
int net_framenum; // to avoid send edicts twice through portals
2007-06-21 22:00:00 +02:00
2009-11-25 22:00:00 +01:00
int hostflags; // misc server flags: predicting etc
2009-06-24 22:00:00 +02:00
2010-10-02 22:00:00 +02:00
string name; // map name
2009-09-28 22:00:00 +02:00
string startspot; // player_start name on nextmap
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
2010-10-26 22:00:00 +02:00
char model_precache[MAX_MODELS][CS_SIZE];
char sound_precache[MAX_SOUNDS][CS_SIZE];
2010-10-28 22:00:00 +02:00
char files_precache[MAX_CUSTOM][CS_SIZE];
char event_precache[MAX_EVENTS][CS_SIZE];
2012-05-12 22:00:00 +02:00
sv_static_entity_t static_entities[MAX_STATIC_ENTITIES];
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
2010-10-19 22:00:00 +02:00
sv_consistency_t consistency_files[MAX_MODELS];
2012-05-20 22:00:00 +02:00
resource_t resources[MAX_MODELS];
int num_consistency_resources; // typically check model bounds on this
int num_resources;
2010-10-19 22:00:00 +02:00
sv_baselines_t instanced; // instanced baselines
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;
2017-02-05 22:00:00 +01:00
byte signon_buf[NET_MAX_PAYLOAD]; // 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
2010-10-31 22:00:00 +01:00
uint checksum; // for catching cheater maps
2010-08-25 22:00:00 +02:00
2017-02-21 22:00:00 +01:00
qboolean simulating;
2010-10-26 22:00:00 +02:00
qboolean write_bad_message; // just for debug
qboolean paused;
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;
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
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
2017-02-26 22:00:00 +01:00
double lastservertime; // check if server time was not changed so no resaon to send update
2010-10-09 22:00:00 +02:00
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)
2010-12-23 22:00:00 +01:00
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
2010-01-31 22:00:00 +01:00
int modelindex; // custom playermodel index
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
2010-10-17 22:00:00 +02:00
int listeners; // 32 bits == MAX_CLIENTS (voice listeners)
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
2009-06-24 22:00:00 +02:00
int messagelevel; // for filtering printed messages
2007-06-21 22:00:00 +02:00
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
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
2009-12-02 22:00:00 +01:00
event_state_t events;
2007-06-21 22:00:00 +02:00
2010-10-09 22:00:00 +02:00
double lastmessage; // time when packet was last received
2017-02-05 22:00:00 +01:00
double connection_started;
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
2010-10-19 22:00:00 +02:00
int authentication_method;
uint WonID; // WonID
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-07-19 22:00:00 +02:00
// catched user messages (nasty hack)
2012-12-16 21:00:00 +01:00
int gmsgHudText; // -1 if not catched (e.g. mod not registered this message)
2010-07-19 22:00:00 +02: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
union
{
edict_t *edicts; // acess by edict number
void *vp; // acess by offset in bytes
};
2010-08-15 22:00:00 +02:00
int numEntities; // actual entities count
2008-12-15 22:00:00 +01:00
2009-11-10 22:00:00 +01:00
movevars_t movevars; // curstate
movevars_t oldmovevars; // oldstate
playermove_t *pmove; // pmove state
2012-03-24 21:00:00 +01:00
sv_interp_t interp[MAX_CLIENTS]; // interpolate clients
2009-11-10 22:00:00 +01:00
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
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)
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-26 22:00:00 +01:00
2009-01-09 22:00:00 +01:00
SAVERESTOREDATA SaveData; // shared struct, used for save data
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;
2017-02-12 22:00:00 +01:00
char serverinfo[MAX_SERVERINFO_STRING];
char localinfo[MAX_LOCALINFO_STRING];
2010-10-09 22:00:00 +02:00
double changelevel_next_time; // don't execute multiple changelevels at once time
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]
2010-06-23 22:00:00 +02:00
sv_client_t *currentPlayer; // current client who network message sending on
2012-12-16 21:00:00 +01:00
int currentPlayerNum; // for easy acess to some global arrays
2017-02-12 22:00:00 +01:00
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]
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
2017-02-12 22:00:00 +01:00
extern convar_t sv_lan;
extern convar_t sv_lan_rate;
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;
extern convar_t sv_minupdaterate;
extern convar_t sv_maxupdaterate;
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;
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;
extern convar_t sv_skyspeed;
extern convar_t sv_skyangle;
extern convar_t sv_consistency;
2017-08-23 23:00:00 +02:00
extern convar_t sv_spawntime;
extern convar_t sv_changetime;
2017-02-12 22:00:00 +01:00
extern convar_t deathmatch;
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;
extern convar_t *hostname;
extern convar_t *sv_maxclients;
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;
2010-12-27 22:00:00 +01:00
extern convar_t *sv_sendvelocity;
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
//
2010-10-26 22:00:00 +02:00
void SV_FinalMessage( char *message, qboolean reconnect );
2009-11-23 22:00:00 +01:00
void SV_DropClient( sv_client_t *drop );
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 );
2009-11-23 22:00:00 +01:00
void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo );
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 );
2011-07-07 22:00:00 +02:00
void SV_ProcessFile( sv_client_t *cl, char *filename );
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 );
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
//
2009-09-28 22:00:00 +02:00
void SV_InitGame( void );
void SV_ActivateServer( void );
void SV_DeactivateServer( void );
2010-10-26 22:00:00 +02:00
void SV_LevelInit( const char *pMapName, char const *pOldLevel, char const *pLandmarkName, qboolean loadGame );
qboolean SV_SpawnServer( const char *server, const char *startspot );
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 );
2011-02-26 22:00:00 +01:00
qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker ); // for EntityInSolid checks
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 );
2009-06-24 22:00:00 +02:00
void SV_ClientPrintf( sv_client_t *cl, int level, char *fmt, ... );
2016-11-21 22:00:00 +01:00
void SV_BroadcastPrintf( sv_client_t *ignore, int level, 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 );
2010-10-26 22:00:00 +02:00
qboolean SV_ClientConnect( edict_t *ent, char *userinfo );
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 );
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
//
void SV_SendResources( sizebuf_t *msg );
int SV_TransferConsistencyInfo( void );
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
//
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-03-24 22:00:00 +01:00
void SV_InactivateClients( void );
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 );
2009-06-24 22:00:00 +02:00
void SV_SetModel( edict_t *ent, const char *name );
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 );
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 );
2016-11-29 22:00:00 +01:00
qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax );
2010-06-28 22:00:00 +02:00
void SV_BaselineForEntity( edict_t *pEdict );
2010-04-07 22:00:00 +02:00
void SV_WriteEntityPatch( const char *filename );
2011-03-02 22:00:00 +01:00
char *SV_ReadEntityScript( const char *filename, int *flags );
2008-07-30 22:00:00 +02:00
float SV_AngleMod( float ideal, float current, float speed );
2011-03-02 22:00:00 +01:00
void SV_SpawnEntities( const char *mapname, char *entities );
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 );
2009-11-23 22:00:00 +01:00
void SV_SetClientMaxspeed( sv_client_t *cl, float fNewMaxspeed );
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 );
2013-10-23 22:00:00 +02:00
void SV_CreateStaticEntity( struct sizebuf_s *msg, sv_static_entity_t *ent );
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 );
2017-03-11 22:00:00 +01:00
void pfnRemoveEntity( edict_t* e );
2013-10-23 22:00:00 +02:00
void SV_RestartStaticEnts( void );
2017-02-12 22:00:00 +01:00
char *SV_Localinfo( void );
2008-12-15 22:00:00 +01:00
2008-12-26 22:00:00 +01:00
_inline edict_t *SV_EDICT_NUM( int n, const char * file, const int line )
2008-12-15 22:00:00 +01:00
{
2008-12-26 22:00:00 +01:00
if((n >= 0) && (n < svgame.globals->maxEntities))
return svgame.edicts + n;
Host_Error( "SV_EDICT_NUM: bad number %i (called at %s:%i)\n", n, file, line );
2008-12-15 22:00:00 +01:00
return NULL;
}
2007-06-25 22:00:00 +02:00
//
// sv_save.c
//
2010-03-25 22:00:00 +01:00
void SV_ClearSaveDir( void );
void SV_SaveGame( const char *pName );
2010-10-26 22:00:00 +02:00
qboolean SV_LoadGame( const char *pName );
void SV_ChangeLevel( qboolean loadfromsavedgame, const char *mapname, const char *start );
int SV_LoadGameState( char const *level, qboolean createPlayers );
2010-03-24 22:00:00 +01:00
void SV_LoadAdjacentEnts( const char *pOldLevel, const char *pLandmarkName );
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 );
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