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

567 lines
18 KiB
C
Raw Normal View History

2009-11-23 22:00:00 +01:00
//=======================================================================
// Copyright XashXT Group 2009 <20>
// server.h - primary header for server
//=======================================================================
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"
2010-08-12 22:00:00 +02:00
#include "cm_local.h"
#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-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
//=============================================================================
2010-03-28 22:00:00 +02:00
#define MAX_MASTERS 8 // max recipients for heartbeat packets
2010-07-02 22:00:00 +02:00
#define RATE_MESSAGES 10
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 )
2010-08-15 22:00:00 +02:00
#define SVF_PORTALPASS 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 )
2010-10-20 22:00:00 +02:00
#define EDICT_FROM_AREA( l ) STRUCT_FROM_LINK( l, edict_t, area )
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 )
#define MAKE_STRING(str) SV_AllocString( str )
2010-10-09 22:00:00 +02:00
#define MAX_MULTICAST 2500
2008-12-26 22:00:00 +01:00
2010-05-22 22:00:00 +02:00
#define DVIS_PVS 0
#define DVIS_PHS 1
2010-07-23 22:00:00 +02:00
// convert msecs to float time properly
2010-10-09 22:00:00 +02:00
#define sv_time() ( sv.time )
#define sv_frametime() ( sv.frametime )
2010-08-25 22:00:00 +02:00
#define SV_IsValidEdict( e ) ( e && !e->free )
2010-07-23 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
// server lightstyles (used for GetEntityIllum)
typedef struct
{
int length;
float map[MAX_STRING];
vec3_t rgb; // 0.0 - 2.0
} sv_lightstyle_t;
// 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;
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
2007-09-16 22:00:00 +02:00
bool loadgame; // client begins should reuse existing entity
2007-09-06 22:00:00 +02:00
2010-10-09 22:00:00 +02:00
double time; // sv.time += sv.frametime
float frametime;
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
2008-10-27 22:00:00 +01:00
char configstrings[MAX_CONFIGSTRINGS][CS_SIZE];
2007-06-21 22:00:00 +02:00
2010-10-19 22:00:00 +02:00
sv_consistency_t consistency_files[MAX_MODELS];
int num_consistency_files;
sv_baselines_t instanced; // instanced baselines
2010-10-09 22:00:00 +02:00
// unreliable data to send to clients.
sizebuf_t datagram;
byte datagram_buf[NET_MAX_PAYLOAD];
// reliable data to send to clients.
sizebuf_t reliable_datagram; // copied to all clients at end of frame
byte reliable_datagram_buf[NET_MAX_PAYLOAD];
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;
2007-06-21 22:00:00 +02:00
byte multicast_buf[MAX_MSGLEN];
2010-08-06 22:00:00 +02:00
sizebuf_t signon;
2009-11-25 22:00:00 +01:00
byte signon_buf[MAX_MSGLEN];
2010-08-25 22:00:00 +02:00
model_t *worldmodel; // pointer to world
2010-10-19 22:00:00 +02:00
// run local lightstyles to let SV_LightPoint grab the actual information
sv_lightstyle_t lightstyle[MAX_LIGHTSTYLES];
2010-03-27 22:00:00 +01:00
bool write_bad_message; // just for debug
2009-11-10 22:00:00 +01:00
bool 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;
2010-10-14 22:00:00 +02:00
float raw_ping;
float latency;
2010-10-10 22:00:00 +02:00
clientdata_t clientdata;
weapon_data_t weapondata[32];
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;
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-04-03 22:00:00 +02:00
bool send_message;
2010-10-09 22:00:00 +02:00
bool skip_message;
2010-10-14 22:00:00 +02:00
bool local_weapons; // enable weapon predicting
bool lag_compensation; // enable lag compensation
bool hltv_proxy; // this is spectator proxy (hltv)
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 cl_updaterate; // default time to wait for next message
double next_checkpingtime; // time to send all players pings to client
double timebase; // client timebase
2010-10-09 22:00:00 +02:00
2010-02-07 22:00:00 +01:00
bool sendmovevars;
2009-12-04 22:00:00 +01:00
bool sendinfo;
2009-11-23 22:00:00 +01:00
2010-10-09 22:00:00 +02:00
bool fakeclient; // This client is a fake player controlled by the game DLL
2010-08-04 22:00:00 +02:00
int random_seed; // fpr predictable random values
2009-06-24 22:00:00 +02:00
usercmd_t lastcmd; // for filling in big drops
2010-10-14 22:00:00 +02:00
double last_cmdtime;
double last_movetime;
double next_movetime;
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;
float ping;
2009-06-24 22:00:00 +02:00
2010-10-17 22:00:00 +02:00
int listeners; // 32 bits == MAX_CLIENTS (voice listeners)
2010-06-20 22:00:00 +02:00
float addangle; // add angles to client position
2010-04-12 22:00:00 +02:00
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-02-03 22:00:00 +01:00
char name[32]; // extracted from userinfo, color string allowed
2009-06-24 22:00:00 +02:00
int messagelevel; // for filtering printed messages
2007-06-21 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;
2008-07-11 22:00:00 +02:00
byte datagram_buf[MAX_MSGLEN];
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
2009-09-16 22:00:00 +02:00
byte *download; // file being downloaded
int downloadsize; // total bytes (can't use EOF because of paks)
int downloadcount; // bytes sent
2007-06-21 22:00:00 +02:00
2010-10-09 22:00:00 +02:00
double lastmessage; // time when packet was last received
double lastconnect;
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;
int challenge;
2010-10-09 22:00:00 +02:00
double time;
2008-07-12 22:00:00 +02:00
bool 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
{
char name[32];
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;
} sv_pushed_t;
2010-10-14 22:00:00 +02:00
typedef struct
{
bool active;
bool moving;
bool firstframe;
bool nointerp;
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 )
2009-09-29 22:00:00 +02:00
bool msg_started; // to avoid include messages
2010-08-16 22:00:00 +02:00
bool msg_system; // this is message with engine index
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)
int gmsgHudText; // -1 if not catched
2010-10-21 22:00:00 +02:00
void *hInstance; // pointer to game.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
2010-10-14 22:00:00 +02:00
sv_interp_t interp[32]; // interpolate clients
2009-11-10 22:00:00 +01:00
2010-08-18 22:00:00 +02:00
sv_pushed_t pushed[256]; // no reason to keep array for all edicts
// 256 it should be enough for any game situation
2010-08-15 22:00:00 +02:00
vec3_t player_mins[4]; // 4 hulls allowed
vec3_t player_maxs[4]; // 4 hulls allowed
2008-12-26 22:00:00 +01:00
globalvars_t *globals; // server globals
DLL_FUNCTIONS dllFuncs; // dll exported funcs
2010-08-15 22:00:00 +02:00
NEW_DLL_FUNCTIONS dllFuncs2; // new dll exported funcs (can be NULL)
2009-11-03 22:00:00 +01:00
byte *mempool; // server premamnent pool: edicts etc
2010-03-30 22:00:00 +02:00
byte *stringspool; // for shared strings
2008-12-26 22:00:00 +01:00
2008-12-17 22:00:00 +01:00
int hStringTable; // stringtable handle
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
{
2007-09-16 22:00:00 +02:00
bool 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
2009-11-25 22:00:00 +01:00
int groupmask;
int groupop;
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
2009-09-25 22:00:00 +02:00
sv_client_t *clients; // [sv_maxclients->integer]
2010-06-23 22:00:00 +02:00
sv_client_t *currentPlayer; // current client who network message sending on
2009-09-25 22:00:00 +02:00
int num_client_entities; // sv_maxclients->integer*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;
//=============================================================================
2009-11-26 22:00:00 +01:00
extern netadr_t master_adr[MAX_MASTERS]; // address of the master server
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
2007-06-21 22:00:00 +02:00
2009-11-10 22:00:00 +01:00
extern cvar_t *sv_pausable; // allows pause in multiplayer
2010-03-24 22:00:00 +01:00
extern cvar_t *sv_newunit;
2009-11-10 22:00:00 +01:00
extern cvar_t *sv_airaccelerate;
2008-07-30 22:00:00 +02:00
extern cvar_t *sv_accelerate;
extern cvar_t *sv_friction;
2009-11-02 22:00:00 +01:00
extern cvar_t *sv_edgefriction;
2007-09-06 22:00:00 +02:00
extern cvar_t *sv_maxvelocity;
extern cvar_t *sv_gravity;
2009-11-02 22:00:00 +01:00
extern cvar_t *sv_stopspeed;
2009-11-29 22:00:00 +01:00
extern cvar_t *sv_check_errors;
2008-07-12 22:00:00 +02:00
extern cvar_t *sv_reconnect_limit;
2010-10-19 22:00:00 +02:00
extern cvar_t *sv_lighting_modulate;
2008-07-12 22:00:00 +02:00
extern cvar_t *rcon_password;
extern cvar_t *hostname;
2008-07-30 22:00:00 +02:00
extern cvar_t *sv_stepheight;
extern cvar_t *sv_rollangle;
extern cvar_t *sv_rollspeed;
extern cvar_t *sv_maxspeed;
2009-09-25 22:00:00 +02:00
extern cvar_t *sv_maxclients;
2010-06-23 22:00:00 +02:00
extern cvar_t *sv_skyname;
2010-03-30 22:00:00 +02:00
extern cvar_t *serverinfo;
2010-10-14 22:00:00 +02:00
extern cvar_t *sv_failuretime;
extern cvar_t *sv_unlag;
extern cvar_t *sv_maxunlag;
extern cvar_t *sv_unlagpush;
extern cvar_t *sv_unlagsamples;
2010-02-09 22:00:00 +01:00
extern cvar_t *physinfo;
2008-07-09 22:00:00 +02:00
extern sv_client_t *sv_client;
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
//
2009-11-23 22:00:00 +01:00
void SV_FinalMessage( char *message, bool reconnect );
void SV_DropClient( sv_client_t *drop );
2007-06-21 22:00:00 +02:00
2009-11-23 22:00:00 +01:00
int SV_ModelIndex( const char *name );
int SV_SoundIndex( const char *name );
int SV_DecalIndex( 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 );
2010-04-12 22:00:00 +02:00
void SV_PrepWorldFrame( void );
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-03-24 22:00:00 +01:00
void SV_LevelInit( const char *pMapName, char const *pOldLevel, char const *pLandmarkName, bool loadGame );
bool SV_SpawnServer( const char *server, const char *startspot );
2009-09-28 22:00:00 +02:00
int SV_FindIndex( const char *name, int start, int end, bool create );
2007-06-21 22:00:00 +02:00
//
// sv_phys.c
//
2008-07-30 22:00:00 +02:00
void SV_Physics( void );
2009-11-02 22:00:00 +01:00
void SV_CheckVelocity( edict_t *ent );
bool SV_CheckWater( edict_t *ent );
2009-11-10 22:00:00 +01:00
bool SV_RunThink( edict_t *ent );
2010-03-24 22:00:00 +01:00
void SV_FreeOldEntities( void );
2010-06-16 22:00:00 +02:00
bool SV_TestEntityPosition( edict_t *ent ); // for EntityInSolid checks
2010-09-02 22:00:00 +02:00
bool SV_TestPlayerPosition( edict_t *ent ); // for PlayerInSolid checks
2007-09-29 22:00:00 +02:00
2008-07-30 22:00:00 +02:00
//
// sv_move.c
//
2010-10-17 22:00:00 +02:00
bool SV_MoveStep( edict_t *ent, vec3_t move, bool relink );
bool SV_MoveTest( edict_t *ent, vec3_t move, bool 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-17 22:00:00 +02:00
bool SV_CheckBottom( edict_t *ent, int iMode );
2009-11-23 22:00:00 +01:00
float SV_VecToYaw( const vec3_t src );
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, ... );
void SV_BroadcastPrintf( int level, char *fmt, ... );
2008-12-26 22:00:00 +01:00
void SV_BroadcastCommand( 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 );
2008-07-12 22:00:00 +02:00
void SV_PutClientInServer( edict_t *ent );
2010-10-14 22:00:00 +02:00
bool 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 );
2009-11-02 22:00:00 +01:00
bool 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 );
2010-10-14 22:00:00 +02:00
void SV_PreRunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed );
void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed );
2009-11-23 22:00:00 +01:00
void SV_PostRunCmd( sv_client_t *cl );
2010-10-20 22:00:00 +02:00
bool SV_IsPlayerIndex( int idx );
2009-11-10 22:00:00 +01:00
void SV_InitClientMove( void );
2010-03-30 22:00:00 +02:00
void SV_UpdateServerInfo( 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 );
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-10-10 22:00:00 +02:00
void SV_ClearFrames( client_frame_t **frames );
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-03-25 22:00:00 +01:00
bool 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_ConfigString( int index, const char *val );
void SV_SetModel( edict_t *ent, const char *name );
2009-11-02 22:00:00 +01:00
void SV_CopyTraceToGlobal( trace_t *trace );
2010-04-07 22:00:00 +02:00
void SV_SetMinMaxSize( edict_t *e, const float *min, const float *max );
2010-07-01 22:00:00 +02:00
void SV_CreateDecal( const float *origin, int decalIndex, int entityIndex, int modelIndex, int flags );
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 );
2010-08-06 22:00:00 +02:00
void SV_PlaybackEvent( sizebuf_t *msg, event_info_t *info );
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 );
2009-11-03 22:00:00 +01:00
script_t *SV_GetEntityScript( const char *filename );
2008-07-30 22:00:00 +02:00
float SV_AngleMod( float ideal, float current, float speed );
2008-12-15 22:00:00 +01:00
void SV_SpawnEntities( const char *mapname, script_t *entities );
2009-01-10 22:00:00 +01:00
edict_t* SV_AllocPrivateData( edict_t *ent, string_t className );
2008-12-26 22:00:00 +01:00
string_t SV_AllocString( const char *szValue );
2009-11-30 22:00:00 +01:00
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, bool spawned_only );
2008-12-26 22:00:00 +01:00
const char *SV_GetString( string_t iString );
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 );
2010-07-01 22:00:00 +02:00
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
int pfnIndexOfEdict( const edict_t *pEdict );
2009-12-01 22:00:00 +01:00
void SV_UpdateBaseVelocity( edict_t *ent );
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 );
bool SV_LoadGame( const char *pName );
2010-03-24 22:00:00 +01:00
void SV_ChangeLevel( bool loadfromsavedgame, const char *mapname, const char *start );
2009-09-28 22:00:00 +02:00
const char *SV_GetLatestSave( void );
2010-03-24 22:00:00 +01:00
int SV_LoadGameState( char const *level, bool createPlayers );
void SV_LoadAdjacentEnts( const char *pOldLevel, const char *pLandmarkName );
2010-08-25 22:00:00 +02:00
//
// sv_studio.c
//
void SV_InitStudioHull( void );
bool SV_StudioExtractBbox( model_t *mod, int sequence, float *mins, float *maxs );
void SV_StudioGetAttachment( edict_t *e, int iAttachment, float *org, float *ang );
2010-08-26 22:00:00 +02:00
trace_t SV_TraceHitbox( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end );
2010-08-25 22:00:00 +02:00
void SV_GetBonePosition( edict_t *e, int iBone, float *org, float *ang );
2010-08-22 22:00:00 +02:00
//
// sv_pmove.c
//
2010-08-23 22:00:00 +02:00
bool SV_CopyEdictToPhysEnt( physent_t *pe, edict_t *ed, bool player_trace );
2010-08-22 22:00:00 +02: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
extern areanode_t sv_areanodes[];
void SV_ClearWorld( void );
2010-10-09 22:00:00 +02:00
void SV_UnlinkEdict( edict_t *ent );
2010-08-25 22:00:00 +02:00
bool SV_HeadnodeVisible( mnode_t *node, byte *visbits );
int SV_HullPointContents( hull_t *hull, int num, const vec3_t p );
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 );
2009-11-02 22:00:00 +01:00
trace_t SV_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e );
2010-08-26 22:00:00 +02:00
trace_t SV_MoveHull( const vec3_t start, int hullNumber, 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 );
2009-11-02 22:00:00 +01:00
trace_t SV_MoveToss( edict_t *tossent, edict_t *ignore );
void SV_LinkEdict( edict_t *ent, bool touch_triggers );
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 );
void SV_SetLightStyle( int style, const char* s );
int SV_LightForEntity( edict_t *pEdict );
2007-06-21 22:00:00 +02:00
2007-09-16 22:00:00 +02:00
#endif//SERVER_H