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

477 lines
16 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"
2008-12-15 22:00:00 +01:00
#include "svgame_api.h"
2009-11-02 22:00:00 +01:00
#include "com_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
#define LATENCY_COUNTS 16
#define MAX_ENT_CLUSTERS 16
#define RATE_MESSAGES 10
2007-11-14 22:00:00 +01:00
2010-03-14 22:00:00 +01:00
// hostflags
2010-03-28 22:00:00 +02:00
#define SVF_SKIPLOCALHOST BIT( 0 )
2010-03-14 22:00:00 +01:00
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 )
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
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
2009-09-28 22:00:00 +02:00
int time; // sv.time += sv.frametime
2009-09-20 22:00:00 +02:00
int frametime;
2008-07-03 22:00:00 +02:00
int framenum;
2008-09-09 22:00:00 +02:00
int net_framenum;
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
2008-08-02 22:00:00 +02:00
string name; // map name, or cinematic 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
// the multicast buffer is used to send a message to a set of clients
2007-08-19 22:00:00 +02:00
// it is only used to marshall data until SV_Message is called
2007-09-16 22:00:00 +02:00
sizebuf_t multicast;
2007-06-21 22:00:00 +02:00
byte multicast_buf[MAX_MSGLEN];
2009-11-25 22:00:00 +01:00
sizebuf_t signon;
byte signon_buf[MAX_MSGLEN];
2010-03-27 22:00:00 +01:00
bool write_bad_message; // just for debug
2009-11-03 22:00:00 +01:00
bool cphys_prepped;
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
{
2009-06-24 22:00:00 +02:00
entity_state_t ps; // player state
2008-09-09 22:00:00 +02:00
byte areabits[MAX_MAP_AREA_BYTES]; // portalarea visibility bits
2008-08-02 22:00:00 +02:00
int areabits_size;
2007-09-16 22:00:00 +02:00
int num_entities;
int first_entity; // into the circular sv_packet_entities[]
2009-09-20 22:00:00 +02:00
int senttime; // time the message was transmitted
2009-11-25 22:00:00 +01:00
int latency;
2009-06-24 22:00:00 +02:00
2009-09-16 22:00:00 +02:00
int index; // client edict index
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)
bool physinfo_modified; // transmit at next opportunity
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
2009-09-16 22:00:00 +02:00
int lastframe; // for delta compression
2009-06-24 22:00:00 +02:00
usercmd_t lastcmd; // for filling in big drops
2009-11-16 22:00:00 +01:00
int usehull; // current hull that client used
2010-01-31 22:00:00 +01:00
int modelindex; // custom playermodel index
2008-07-09 22:00:00 +02:00
2009-06-24 22:00:00 +02:00
int commandMsec; // every seconds this is reset, if user
// commands exhaust it, assume time cheating
2009-09-16 22:00:00 +02:00
2009-11-25 22:00:00 +01:00
int packet_loss;
2007-09-09 22:00:00 +02:00
int ping;
2009-09-16 22:00:00 +02:00
int message_size[RATE_MESSAGES]; // used to rate drop packets
2009-09-17 22:00:00 +02:00
int rate;
2009-09-16 22:00:00 +02:00
int surpressCount; // number of messages rate supressed
2009-06-24 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 reliable buf contain reliable user messages that must be followed
// after pvs frame
sizebuf_t reliable;
byte reliable_buf[MAX_MSGLEN];
// the datagram is written to by sound calls, prints, temp ents, etc.
// it can be harmlessly overflowed.
2008-07-11 22:00:00 +02:00
sizebuf_t datagram;
byte datagram_buf[MAX_MSGLEN];
2007-09-06 22:00:00 +02:00
client_frame_t frames[UPDATE_BACKUP]; // 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
2009-09-20 22:00:00 +02:00
int lastmessage; // sv.framenum when packet was last received
int 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
2008-07-10 22:00:00 +02:00
2008-07-11 22:00:00 +02:00
netchan_t netchan;
2008-07-09 22:00:00 +02:00
} sv_client_t;
2007-06-21 22:00:00 +02:00
2008-12-15 22:00:00 +01:00
// sv_private_edict_t
2008-12-26 22:00:00 +01:00
struct sv_priv_s
2008-07-24 22:00:00 +02:00
{
2009-11-02 22:00:00 +01:00
link_t area; // linked to a division node or leaf
sv_client_t *client; // filled for player ents
int lastcluster; // unused if num_clusters != -1
int linkcount;
int num_clusters; // if -1, use headnode instead
int clusternums[MAX_ENT_CLUSTERS];
int framenum; // update framenumber
int areanum, areanum2;
bool linked; // passed through SV_LinkEdict
2009-11-30 22:00:00 +01:00
2009-11-02 22:00:00 +01:00
bool stuck; // entity stucked in brush
2009-11-30 22:00:00 +01:00
// cached position to avoid redundant SV_CheckWaterTransition calls on monsters
bool forceupdate; // force an update on this entity
// (set by SV_PushMove code for moving water entities)
vec3_t water_origin; // updates whenever this changes
vec3_t moved_origin; // used by PushMove to keep track of where objects were before
vec3_t moved_angles; // they were moved, in case they need to be moved back
2009-11-02 22:00:00 +01:00
size_t pvdata_size; // member size of alloceed pvPrivateData
// (used by SV_CopyEdict)
entity_state_t s; // baseline (this is a player_state too)
2008-07-24 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;
2009-09-20 22:00:00 +02:00
int 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
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
2008-12-15 22:00:00 +01:00
int msg_sizes[MAX_USER_MESSAGES]; // user messages bounds checker
2008-12-26 22:00:00 +01:00
int msg_size_index; // write message size at this pos in sizebuf
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
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
void *hInstance; // pointer to server.dll
2008-12-17 22:00:00 +01:00
union
{
edict_t *edicts; // acess by edict number
void *vp; // acess by offset in bytes
};
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
2008-12-26 22:00:00 +01:00
globalvars_t *globals; // server globals
DLL_FUNCTIONS dllFuncs; // dll exported funcs
byte *private; // server.dll private pool
2009-11-03 22:00:00 +01:00
byte *mempool; // server premamnent pool: edicts etc
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
2009-09-20 22:00:00 +02:00
int realtime; // always increasing, no clamping, etc
int timestart; // just for profiling
2007-06-21 22:00:00 +02:00
2009-11-25 22:00:00 +01:00
int groupmask;
int groupop;
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]
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
2007-06-21 22:00:00 +02:00
entity_state_t *client_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
2009-09-20 22:00:00 +02:00
int 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
2007-09-16 22:00:00 +02:00
extern cvar_t *sv_noreload; // don't reload level state when reentering
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;
2009-09-13 22:00:00 +02:00
extern cvar_t *sv_idealpitchscale;
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;
2008-07-03 22:00:00 +02:00
extern cvar_t *sv_fps; // running server at
2009-11-29 22:00:00 +01:00
extern cvar_t *sv_check_errors;
2009-11-30 22:00:00 +01:00
extern cvar_t *sv_synchthink;
2007-06-21 22:00:00 +02:00
extern cvar_t *sv_enforcetime;
2008-07-12 22:00:00 +02:00
extern cvar_t *sv_reconnect_limit;
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_playersonly;
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-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_ClassIndex( const char *name );
int SV_DecalIndex( const char *name );
int SV_EventIndex( const char *name );
int SV_GenericIndex( const char *name );
int SV_UserMessageIndex( const char *name );
2007-06-21 22:00:00 +02:00
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 );
2007-06-21 22:00:00 +02:00
void Master_Heartbeat (void);
void Master_Packet (void);
//
// sv_init.c
//
2009-09-28 22:00:00 +02:00
void SV_InitGame( void );
2009-11-03 22:00:00 +01:00
void SV_PrepModels( void );
2009-09-28 22:00:00 +02:00
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 );
2009-11-28 22:00:00 +01:00
void SV_ClassifyEdict( edict_t *ent, int m_iNewClass );
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 );
2009-11-30 22:00:00 +01:00
bool SV_UnstickEntity( edict_t *ent );
2010-03-24 22:00:00 +01:00
void SV_FreeOldEntities( void );
2007-09-29 22:00:00 +02:00
2008-07-30 22:00:00 +02:00
//
// sv_move.c
//
2009-11-23 22:00:00 +01:00
bool SV_WalkMove( edict_t *ent, vec3_t move, int iMode );
void SV_MoveToOrigin( edict_t *ed, const vec3_t goal, float dist, int iMode );
bool SV_CheckBottom( edict_t *ent, int iMode );
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 );
2008-05-18 22:00:00 +02:00
void SV_AmbientSound( edict_t *entity, int soundindex, float volume, float attenuation );
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 );
2009-12-04 22:00:00 +01:00
void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg );
2010-02-07 22:00:00 +01:00
void SV_UpdatePhysinfo( sv_client_t *cl, sizebuf_t *msg );
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 );
2008-07-12 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 );
void SV_PreRunCmd( sv_client_t *cl, usercmd_t *ucmd );
void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd );
void SV_PostRunCmd( sv_client_t *cl );
2009-09-13 22:00:00 +02:00
void SV_SetIdealPitch( sv_client_t *cl );
2009-11-10 22:00:00 +01:00
void SV_InitClientMove( 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
//
2009-06-24 22:00:00 +02:00
void SV_WriteFrameToClient( sv_client_t *client, sizebuf_t *msg );
void SV_BuildClientFrame( sv_client_t *client );
2009-11-28 22:00:00 +01:00
void SV_UpdateEntityState( const edict_t *ent, bool baseline );
2010-03-24 22:00:00 +01:00
void SV_InactivateClients( 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 );
2009-12-02 22:00:00 +01:00
void SV_PlaybackEvent( sizebuf_t *msg, event_info_t *info );
2009-11-28 22:00:00 +01:00
void SV_BaselineForEntity( const edict_t *pEdict );
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 );
2009-09-28 22:00:00 +02:00
bool SV_MapIsValid( const char *filename, const char *spawn_entity );
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 );
2009-12-01 22:00:00 +01:00
void SV_UpdateBaseVelocity( edict_t *ent );
bool SV_IsValidEdict( const edict_t *e );
2009-11-03 22:00:00 +01:00
script_t *CM_GetEntityScript( 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 );
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 );
2007-06-21 22:00:00 +02:00
//============================================================
// high level object sorting to reduce interaction tests
2009-11-02 22:00:00 +01:00
2007-06-21 22:00:00 +02:00
// called after the world model has been loaded, before linking any entities
2007-09-06 22:00:00 +02:00
void SV_UnlinkEdict (edict_t *ent);
2007-06-21 22:00:00 +02:00
// call before removing an entity, and before trying to move one,
// so it doesn't clip against itself
2009-11-02 22:00:00 +01:00
2007-06-21 22:00:00 +02:00
// Needs to be called any time an entity changes origin, mins, maxs,
// or solid. Automatically unlinks if needed.
// sets ent->v.absmin and ent->v.absmax
// sets ent->leafnums[] for pvs determination even if the entity
// is not solid
2008-11-14 22:00:00 +01:00
int SV_AreaEdicts( const vec3_t mins, const vec3_t maxs, edict_t **list, int maxcount, int areatype );
2007-06-21 22:00:00 +02:00
// fills in a table of edict pointers with edicts that have bounding boxes
// that intersect the given area. It is possible for a non-axial bmodel
// to be returned that doesn't actually intersect the area on an exact
// test.
// returns the number of pointers filled in
// ??? does this always return the world?
//
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 );
trace_t SV_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e );
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 );
2009-11-15 22:00:00 +01:00
edict_t *SV_TestPlayerPosition( const vec3_t origin, edict_t *pass, TraceResult *trace );
2008-07-30 22:00:00 +02:00
int SV_PointContents( const vec3_t p );
2009-11-23 22:00:00 +01:00
trace_t SV_ClipMoveToEntity( edict_t *e, const vec3_t p0, vec3_t b0, vec3_t b1, const vec3_t p1, uint mask, int flags );
int SV_BaseContents( const vec3_t p, edict_t *e );
2007-06-21 22:00:00 +02:00
// mins and maxs are relative
// if the entire move stays in a solid volume, trace.allsolid will be set,
// trace.startsolid will be set, and trace.fraction will be 0
// if the starting point is in a solid, it will be allowed to move out
// to an open area
2007-09-16 22:00:00 +02:00
// passedict is explicitly excluded from clipping checks (normally NULL)
#endif//SERVER_H