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/client/client.h

757 lines
23 KiB
C
Raw Normal View History

2009-11-23 22:00:00 +01:00
//=======================================================================
// Copyright XashXT Group 2009 <20>
// client.h -- primary header for client
//=======================================================================
2007-06-21 22:00:00 +02:00
2007-11-04 22:00:00 +01:00
#ifndef CLIENT_H
#define CLIENT_H
2007-06-21 22:00:00 +02:00
2008-01-12 22:00:00 +01:00
#include "mathlib.h"
2010-08-20 22:00:00 +02:00
#include "cdll_int.h"
2010-11-15 22:00:00 +01:00
#include "menu_int.h"
2010-08-07 22:00:00 +02:00
#include "cl_entity.h"
#include "com_model.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"
2010-10-31 22:00:00 +01:00
#include "screenfade.h"
2010-10-09 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-05 22:00:00 +01:00
2009-10-13 22:00:00 +02:00
#define MAX_DEMOS 32
2010-09-30 22:00:00 +02:00
#define MAX_MOVIES 8
2010-11-19 22:00:00 +01:00
#define MAX_CDTRACKS 32
2010-12-02 22:00:00 +01:00
#define MAX_IMAGES 256 // SpriteTextures
2010-12-06 22:00:00 +01:00
#define MAX_EFRAGS 640
2007-06-21 22:00:00 +02:00
2010-12-09 22:00:00 +01:00
// screenshot types
#define VID_SCREENSHOT 0
#define VID_LEVELSHOT 1
#define VID_MINISHOT 2
2010-10-20 22:00:00 +02:00
#define EDICT_FROM_AREA( l ) STRUCT_FROM_LINK( l, cl_entity_t, area )
2010-08-07 22:00:00 +02:00
#define NUM_FOR_EDICT(e) ((int)((cl_entity_t *)(e) - clgame.entities))
2010-03-28 22:00:00 +02:00
#define EDICT_NUM( num ) CL_EDICT_NUM( num, __FILE__, __LINE__ )
2010-10-09 22:00:00 +02:00
#define cl_time() ( cl.time )
#define sv_time() ( cl.mtime[0] )
2008-12-25 22:00:00 +01:00
2007-06-21 22:00:00 +02:00
//=============================================================================
2008-07-16 22:00:00 +02:00
typedef struct frame_s
2007-06-21 22:00:00 +02:00
{
2010-10-14 22:00:00 +02:00
// received from server
double receivedtime; // time message was received, or -1
double latency;
double time; // server timestamp
2010-11-15 22:00:00 +01:00
local_state_t local; // local client state
entity_state_t playerstate[MAX_CLIENTS];
2010-10-15 22:00:00 +02:00
int num_entities;
int first_entity; // into the circular cl_packet_entities[]
2010-10-14 22:00:00 +02:00
2010-10-15 22:00:00 +02:00
int delta_sequence; // last valid sequence
2010-10-26 22:00:00 +02:00
qboolean valid; // cleared if delta parsing was invalid
2007-06-21 22:00:00 +02:00
} frame_t;
2010-10-14 22:00:00 +02:00
#define CMD_BACKUP MULTIPLAYER_BACKUP // allow a lot of command backups for very fast systems
2010-02-18 22:00:00 +01:00
#define CMD_MASK (CMD_BACKUP - 1)
2007-06-21 22:00:00 +02:00
2010-04-02 22:00:00 +02:00
#define CL_UPDATE_MASK (CL_UPDATE_BACKUP - 1)
extern int CL_UPDATE_BACKUP;
2007-11-04 22:00:00 +01:00
// the client_t structure is wiped completely at every
2007-06-21 22:00:00 +02:00
// server map change
typedef struct
{
2008-05-20 22:00:00 +02:00
int timeoutcount;
2007-06-21 22:00:00 +02:00
2010-10-14 22:00:00 +02:00
int servercount; // server identification for prespawns
int validsequence; // this is the sequence number of the last good
// world snapshot/update we got. If this is 0, we can't
// render a frame yet
int parsecount; // server message counter
int parsecountmod; // modulo with network window
double parsecounttime; // timestamp of parse
2010-10-26 22:00:00 +02:00
qboolean video_prepped; // false if on new level or new ref dll
qboolean audio_prepped; // false if on new level or new snd dll
qboolean force_refdef; // vid has changed, so we can't use a paused refdef
2007-06-21 22:00:00 +02:00
2010-10-14 22:00:00 +02:00
int delta_sequence; // acknowledged sequence number
double mtime[2]; // the timestamp of the last two messages
int last_incoming_sequence;
2010-10-26 22:00:00 +02:00
qboolean force_send_usercmd;
2010-11-15 22:00:00 +01:00
qboolean thirdperson;
2009-09-16 22:00:00 +02:00
2010-10-31 22:00:00 +01:00
uint checksum; // for catching cheater maps
2010-11-15 22:00:00 +01:00
client_data_t data; // some clientdata holds
2008-12-26 22:00:00 +01:00
frame_t frame; // received from server
2009-09-16 22:00:00 +02:00
int surpressCount; // number of messages rate supressed
2010-10-14 22:00:00 +02:00
frame_t frames[MULTIPLAYER_BACKUP]; // alloced on svc_serverdata
usercmd_t cmds[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
2008-07-06 22:00:00 +02:00
2010-10-09 22:00:00 +02:00
double time; // this is the time value that the client
2010-07-23 22:00:00 +02:00
// is rendering at. always <= cls.realtime
2010-06-20 22:00:00 +02:00
// a lerp point for other data
2010-10-09 22:00:00 +02:00
double oldtime; // previous cl.time, time-oldtime is used
// to decay light values and smooth step ups
2010-06-20 22:00:00 +02:00
float lerpFrac; // interpolation value
ref_params_t refdef; // shared refdef
2007-06-21 22:00:00 +02:00
2010-03-30 22:00:00 +02:00
char serverinfo[MAX_INFO_STRING];
2009-12-04 22:00:00 +01:00
player_info_t players[MAX_CLIENTS];
2009-12-02 22:00:00 +01:00
event_state_t events;
2009-09-20 22:00:00 +02:00
// predicting stuff
2010-08-04 22:00:00 +02:00
uint random_seed; // for predictable random values
2010-07-23 22:00:00 +02:00
vec3_t predicted_origins[CMD_BACKUP]; // for debug comparing against server
vec3_t predicted_origin; // generated by CL_PredictMovement
2009-12-05 22:00:00 +01:00
vec3_t predicted_viewofs;
2009-09-20 22:00:00 +02:00
vec3_t predicted_angles;
2009-12-05 22:00:00 +01:00
vec3_t predicted_velocity;
2009-09-20 22:00:00 +02:00
vec3_t prediction_error;
2007-06-21 22:00:00 +02:00
// server state information
2007-11-06 22:00:00 +01:00
int playernum;
2010-08-20 22:00:00 +02:00
int maxclients;
2010-06-22 22:00:00 +02:00
int movemessages;
2010-11-10 22:00:00 +01:00
int num_custombeams; // server beams count
2009-09-28 22:00:00 +02:00
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 event_precache[MAX_EVENTS][CS_SIZE];
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
2010-10-26 22:00:00 +02:00
2010-12-02 22:00:00 +01:00
int sound_index[MAX_SOUNDS];
int decal_index[MAX_DECALS];
2010-08-30 22:00:00 +02:00
2010-10-26 22:00:00 +02:00
model_t *worldmodel; // pointer to world
2010-12-06 22:00:00 +01:00
efrag_t *free_efrags;
2007-11-04 22:00:00 +01:00
} client_t;
2007-06-21 22:00:00 +02:00
/*
==================================================================
the client_static_t structure is persistant through an arbitrary number
of server connections
==================================================================
*/
2007-11-17 22:00:00 +01:00
typedef enum
{
2008-07-12 22:00:00 +02:00
ca_uninitialized = 0,
2009-09-16 22:00:00 +02:00
ca_disconnected, // not talking to a server
ca_connecting, // sending request packets to the server
ca_connected, // netchan_t established, waiting for svc_serverdata
ca_active, // game views should be displayed
ca_cinematic, // playing a cinematic, not connected to a server
2007-06-21 22:00:00 +02:00
} connstate_t;
2010-07-20 22:00:00 +02:00
typedef enum
{
key_console = 0,
key_game,
key_menu
} keydest_t;
2008-08-03 22:00:00 +02:00
typedef enum
{
2007-06-21 22:00:00 +02:00
dl_none,
dl_model,
dl_sound,
2008-08-03 22:00:00 +02:00
dl_generic,
2009-09-16 22:00:00 +02:00
} dltype_t; // download type
2007-06-21 22:00:00 +02:00
2009-09-23 22:00:00 +02:00
typedef enum
{
scrshot_inactive,
scrshot_plaque, // levelshot
scrshot_savegame, // saveshot
2010-03-26 22:00:00 +01:00
scrshot_demoshot, // for demos preview
scrshot_envshot, // cubemap view
scrshot_skyshot // skybox view
2010-07-20 22:00:00 +02:00
} scrshot_t;
2009-09-23 22:00:00 +02:00
2010-08-15 22:00:00 +02:00
// client screen state
typedef enum
{
CL_LOADING = 1, // draw loading progress-bar
CL_ACTIVE, // draw normal hud
CL_PAUSED, // pause when active
CL_CHANGELEVEL, // draw 'loading' during changelevel
} scrstate_t;
2010-06-22 22:00:00 +02:00
typedef struct
{
char name[32];
2009-09-16 22:00:00 +02:00
int number; // svc_ number
int size; // if size == -1, size come from first byte after svcnum
pfnUserMsgHook func; // user-defined function
2010-06-22 22:00:00 +02:00
} cl_user_message_t;
2008-12-25 22:00:00 +01:00
2010-10-26 22:00:00 +02:00
typedef void (*pfnEventHook)( event_args_t *args );
2009-12-02 22:00:00 +01:00
typedef struct
{
char name[CS_SIZE];
word index; // event index
pfnEventHook func; // user-defined function
} user_event_t;
2010-07-17 22:00:00 +02:00
typedef struct
{
2010-12-02 22:00:00 +01:00
int hFontTexture; // handle to texture
2010-07-17 22:00:00 +02:00
wrect_t fontRc[256]; // rectangles
2010-10-26 22:00:00 +02:00
qboolean valid; // rectangles are valid
2010-07-17 22:00:00 +02:00
} cl_font_t;
2009-12-03 22:00:00 +01:00
typedef struct
{
// temp handle
2010-12-02 22:00:00 +01:00
const model_t *pSprite; // pointer to current SpriteTexture
2009-12-03 22:00:00 +01:00
// scissor test
int scissor_x;
int scissor_y;
int scissor_width;
int scissor_height;
2010-10-26 22:00:00 +02:00
qboolean scissor_test;
2009-12-03 22:00:00 +01:00
2010-07-20 22:00:00 +02:00
// holds text color
rgba_t textColor;
2009-12-03 22:00:00 +01:00
// crosshair members
2010-12-02 22:00:00 +01:00
const model_t *pCrosshair;
2009-12-03 22:00:00 +01:00
wrect_t rcCrosshair;
rgba_t rgbaCrosshair;
2010-09-30 22:00:00 +02:00
byte gammaTable[256];
2010-12-02 22:00:00 +01:00
} client_draw_t;
typedef struct
{
int gl_texturenum; // this is a real texnum
// scissor test
int scissor_x;
int scissor_y;
int scissor_width;
int scissor_height;
qboolean scissor_test;
// holds text color
rgba_t textColor;
} gameui_draw_t;
2009-12-03 22:00:00 +01:00
2010-07-19 22:00:00 +02:00
typedef struct
{
// centerprint stuff
int lines;
int y, time;
char message[2048];
int totalWidth;
int totalHeight;
} center_print_t;
2010-10-31 22:00:00 +01:00
typedef struct
{
float time;
float duration;
float amplitude;
float frequency;
float next_shake;
vec3_t offset;
float angle;
vec3_t applied_offset;
float applied_angle;
} screen_shake_t;
2010-11-03 22:00:00 +01:00
typedef struct
{
int (*pfnInitialize)( cl_enginefunc_t *pEnginefuncs, int iVersion );
int (*pfnVidInit)( void );
void (*pfnInit)( void );
void (*pfnShutdown)( void );
int (*pfnRedraw)( float flTime, int intermission );
int (*pfnUpdateClientData)( client_data_t *cdata, float flTime );
void (*pfnReset)( void );
void (*pfnPlayerMove)( struct playermove_s *ppmove, int server );
void (*pfnPlayerMoveInit)( struct playermove_s *ppmove );
char (*pfnPlayerMoveTexture)( char *name );
int (*pfnConnectionlessPacket)( const netadr_t *net_from, const char *args, char *buffer, int *size );
int (*pfnGetHullBounds)( int hullnumber, float *mins, float *maxs );
void (*pfnFrame)( double time );
void (*pfnVoiceStatus)( int entindex, qboolean bTalking );
void (*pfnDirectorMessage)( int iSize, void *pbuf );
void (*pfnPostRunCmd)( local_state_t *from, local_state_t *to, usercmd_t *cmd, int runfuncs, double time, uint random_seed );
int (*pfnKey_Event)( int eventcode, int keynum, const char *pszCurrentBinding );
void (*pfnDemo_ReadBuffer)( int size, byte *buffer );
int (*pfnAddEntity)( int type, cl_entity_t *ent, const char *modelname );
void (*pfnCreateEntities)( void );
void (*pfnStudioEvent)( const struct mstudioevent_s *event, const cl_entity_t *entity );
void (*pfnTxferLocalOverrides)( entity_state_t *state, const clientdata_t *client );
void (*pfnProcessPlayerState)( entity_state_t *dst, const entity_state_t *src );
void (*pfnTxferPredictionData)( entity_state_t *ps, const entity_state_t *pps, clientdata_t *pcd, const clientdata_t *ppcd, weapon_data_t *wd, const weapon_data_t *pwd );
void (*pfnTempEntUpdate)( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ));
2010-11-15 22:00:00 +01:00
int (*pfnGetStudioModelInterface)( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio );
2010-11-03 22:00:00 +01:00
void (*pfnDrawNormalTriangles)( void );
void (*pfnDrawTransparentTriangles)( void );
2010-11-15 22:00:00 +01:00
cl_entity_t *(*pfnGetUserEntity)( int index );
void *(*KB_Find)( const char *name );
void (*CAM_Think)( void ); // camera stuff
2010-11-03 22:00:00 +01:00
int (*CL_IsThirdPerson)( void );
void (*CL_CreateMove)( float frametime, usercmd_t *cmd, int active );
void (*IN_ActivateMouse)( void );
void (*IN_DeactivateMouse)( void );
void (*IN_MouseEvent)( int mstate );
void (*IN_Accumulate)( void );
void (*IN_ClearStates)( void );
2010-11-15 22:00:00 +01:00
void (*pfnCalcRefdef)( ref_params_t *pparams );
} HUD_FUNCTIONS;
2010-11-03 22:00:00 +01:00
2008-12-25 22:00:00 +01:00
typedef struct
{
2009-06-24 22:00:00 +02:00
void *hInstance; // pointer to client.dll
HUD_FUNCTIONS dllFuncs; // dll exported funcs
2009-11-27 22:00:00 +01:00
byte *mempool; // client edicts pool
2010-08-20 22:00:00 +02:00
string mapname; // map name
2009-10-11 22:00:00 +02:00
string maptitle; // display map title
2010-07-08 22:00:00 +02:00
string itemspath; // path to items description for auto-complete func
2009-06-24 22:00:00 +02:00
2010-08-07 22:00:00 +02:00
cl_entity_t *entities; // dynamically allocated entity array
2009-06-24 22:00:00 +02:00
2010-08-20 22:00:00 +02:00
int numEntities; // actual ents count
int maxEntities;
2009-11-26 22:00:00 +01:00
// movement values from server
movevars_t movevars;
movevars_t oldmovevars;
playermove_t *pmove; // pmove state
2010-08-19 22:00:00 +02:00
int trace_hull; // used by PM_SetTraceHull
int oldcount; // used by PM_Push\Pop state
2010-08-16 22:00:00 +02:00
vec3_t player_mins[4]; // 4 hulls allowed
vec3_t player_maxs[4]; // 4 hulls allowed
2010-06-22 22:00:00 +02:00
cl_user_message_t msg[MAX_USER_MESSAGES]; // keep static to avoid fragment memory
user_event_t *events[MAX_EVENTS];
2009-09-28 22:00:00 +02:00
2010-11-19 22:00:00 +01:00
string cdtracks[MAX_CDTRACKS]; // 32 cd-tracks read from cdaudio.txt
2010-12-02 22:00:00 +01:00
model_t sprites[MAX_IMAGES]; // client spritetextures
client_draw_t ds; // draw2d stuff (hud, weaponmenu etc)
2010-10-31 22:00:00 +01:00
screenfade_t fade; // screen fade
screen_shake_t shake; // screen shake
2010-07-19 22:00:00 +02:00
center_print_t centerPrint; // centerprint variables
2009-12-03 22:00:00 +01:00
SCREENINFO scrInfo; // actual screen info
2010-07-13 22:00:00 +02:00
rgb_t palette[256]; // Quake1 palette used for particle colors
2010-03-28 22:00:00 +02:00
client_textmessage_t *titles; // title messages, not network messages
2009-10-23 22:00:00 +02:00
int numTitles;
2010-08-07 22:00:00 +02:00
cl_entity_t viewent; // viewmodel
2008-12-25 22:00:00 +01:00
} clgame_static_t;
2007-06-21 22:00:00 +02:00
2010-07-18 22:00:00 +02:00
typedef struct
{
void *hInstance; // pointer to client.dll
UI_FUNCTIONS dllFuncs; // dll exported funcs
byte *mempool; // client edicts pool
2010-08-07 22:00:00 +02:00
cl_entity_t playermodel; // uiPlayerSetup drawing model
2010-12-02 22:00:00 +01:00
gameui_draw_t ds; // draw2d stuff (menu images)
2010-07-18 22:00:00 +02:00
GAMEINFO gameInfo; // current gameInfo
2010-11-15 22:00:00 +01:00
GAMEINFO *modsInfo[MAX_MODS]; // simplified gameInfo for MainUI
2010-07-18 22:00:00 +02:00
ui_globalvars_t *globals;
2010-10-09 22:00:00 +02:00
2010-10-26 22:00:00 +02:00
qboolean drawLogo; // set to TRUE if logo.avi missed or corrupted
2010-09-30 22:00:00 +02:00
long logo_xres;
long logo_yres;
2010-11-15 22:00:00 +01:00
} menu_static_t;
2010-07-18 22:00:00 +02:00
2007-06-21 22:00:00 +02:00
typedef struct
{
connstate_t state;
2010-10-26 22:00:00 +02:00
qboolean initialized;
qboolean changelevel; // during changelevel
2008-08-04 22:00:00 +02:00
2010-12-09 22:00:00 +01:00
// screen rendering information
float disable_screen; // showing loading plaque between levels
// or changing rendering dlls
// if time gets > 30 seconds ahead, break it
int disable_servercount; // when we receive a frame and cl.servercount
// > cls.disable_servercount, clear disable_screen
qboolean draw_changelevel; // draw changelevel image 'Loading...'
2008-07-09 22:00:00 +02:00
keydest_t key_dest;
2008-12-25 22:00:00 +01:00
2009-06-24 22:00:00 +02:00
byte *mempool; // client premamnent pool: edicts etc
2008-12-26 22:00:00 +01:00
2008-06-22 22:00:00 +02:00
int framecount;
2009-06-24 22:00:00 +02:00
int quakePort; // a 16 bit value that allows quake servers
// to work around address translating routers
2007-11-14 22:00:00 +01:00
// connection information
2008-05-20 22:00:00 +02:00
string servername; // name of server from original connect
2010-07-23 22:00:00 +02:00
int connect_time; // for connection retransmits
2008-07-11 22:00:00 +02:00
netchan_t netchan;
int serverProtocol; // in case we are doing some kind of version hack
2008-06-30 22:00:00 +02:00
int challenge; // from the server to use for connecting
2010-07-08 22:00:00 +02:00
2010-10-14 22:00:00 +02:00
float packet_loss;
double packet_loss_recalc_time;
float nextcmdtime; // when can we send the next command packet?
int lastoutgoingcommand; // sequence number of last outgoing command
2010-12-02 22:00:00 +01:00
// internal images
int fillImage; // used for emulate FillRGBA to avoid wrong draw-sort
int particleImage; // built-in particle and sparks image
int pauseIcon; // draw 'paused' when game in-pause
int loadingBar; // 'loading' progress bar
int glowShell; // for renderFxGlowShell
HSPRITE hChromeSprite; // this is a really HudSprite handle, not texnum!
2010-07-20 22:00:00 +02:00
cl_font_t creditsFont; // shared creditsfont
2010-10-15 22:00:00 +02:00
int num_client_entities; // cl.maxclients * CL_UPDATE_BACKUP * MAX_PACKET_ENTITIES
int next_client_entities; // next client_entity to use
entity_state_t *packet_entities; // [num_client_entities]
2008-11-09 22:00:00 +01:00
2008-06-30 22:00:00 +02:00
file_t *download; // file transfer from server
2008-07-23 22:00:00 +02:00
string downloadname;
2008-08-03 22:00:00 +02:00
string downloadtempname;
2008-05-20 22:00:00 +02:00
int downloadnumber;
dltype_t downloadtype;
2007-06-21 22:00:00 +02:00
2010-07-20 22:00:00 +02:00
scrshot_t scrshot_request; // request for screen shot
scrshot_t scrshot_action; // in-action
2010-03-26 22:00:00 +01:00
const float *envshot_vieworg; // envshot position
2009-09-23 22:00:00 +02:00
string shotname;
2009-10-13 22:00:00 +02:00
// demo loop control
int demonum; // -1 = don't play demos
string demos[MAX_DEMOS]; // when not playing
2010-09-30 22:00:00 +02:00
// movie playlist
int movienum;
string movies[MAX_MOVIES];
2008-08-02 22:00:00 +02:00
// demo recording info must be here, so it isn't clearing on level change
2010-10-26 22:00:00 +02:00
qboolean demorecording;
qboolean demoplayback;
qboolean demowaiting; // don't record until a non-delta message is received
2010-11-03 22:00:00 +01:00
qboolean timedemo;
2008-08-02 22:00:00 +02:00
string demoname; // for demo looping
2008-05-20 22:00:00 +02:00
2007-06-21 22:00:00 +02:00
file_t *demofile;
} client_static_t;
2010-11-16 22:00:00 +01:00
#ifdef __cplusplus
extern "C" {
#endif
2010-07-20 22:00:00 +02:00
extern client_t cl;
2007-06-21 22:00:00 +02:00
extern client_static_t cls;
2008-12-26 22:00:00 +01:00
extern clgame_static_t clgame;
2010-11-15 22:00:00 +01:00
extern menu_static_t menu;
2009-12-20 22:00:00 +01:00
2010-11-16 22:00:00 +01:00
#ifdef __cplusplus
}
#endif
2007-06-21 22:00:00 +02:00
//
// cvars
//
2010-10-22 22:00:00 +02:00
extern convar_t *cl_predict;
extern convar_t *cl_smooth;
extern convar_t *cl_showfps;
extern convar_t *cl_envshot_size;
extern convar_t *cl_nodelta;
extern convar_t *cl_crosshair;
extern convar_t *cl_showmiss;
extern convar_t *cl_testlights;
extern convar_t *cl_solid_players;
extern convar_t *cl_idealpitchscale;
extern convar_t *cl_allow_levelshots;
2010-12-11 22:00:00 +01:00
extern convar_t *cl_lightstyle_lerping;
2010-11-03 22:00:00 +01:00
extern convar_t *cl_draw_particles;
2010-10-22 22:00:00 +02:00
extern convar_t *cl_levelshot_name;
2010-11-10 22:00:00 +01:00
extern convar_t *cl_draw_beams;
2010-10-22 22:00:00 +02:00
extern convar_t *scr_centertime;
extern convar_t *scr_download;
extern convar_t *scr_loading;
2010-10-31 22:00:00 +01:00
extern convar_t *scr_dark; // start from dark
2010-10-22 22:00:00 +02:00
extern convar_t *userinfo;
2007-06-21 22:00:00 +02:00
//=============================================================================
2008-07-11 22:00:00 +02:00
2010-10-26 22:00:00 +02:00
qboolean CL_CheckOrDownloadFile( const char *filename );
2010-10-28 22:00:00 +02:00
void CL_SetLightstyle( int style, const char* s );
2010-03-15 22:00:00 +01:00
void CL_RunLightStyles( void );
2007-06-21 22:00:00 +02:00
2010-03-15 22:00:00 +01:00
void CL_AddEntities( void );
2010-12-03 22:00:00 +01:00
void CL_DecayLights( void );
2007-06-21 22:00:00 +02:00
//=================================================
2008-08-03 22:00:00 +02:00
void CL_PrepVideo( void );
void CL_PrepSound( void );
2007-06-21 22:00:00 +02:00
2008-08-04 22:00:00 +02:00
//
// cl_cmds.c
//
2010-03-28 22:00:00 +02:00
void CL_Quit_f( void );
2007-11-06 22:00:00 +01:00
void CL_ScreenShot_f( void );
2010-11-19 22:00:00 +01:00
void CL_PlayCDTrack_f( void );
2008-11-09 22:00:00 +01:00
void CL_EnvShot_f( void );
void CL_SkyShot_f( void );
2009-09-10 22:00:00 +02:00
void CL_SaveShot_f( void );
2010-01-07 22:00:00 +01:00
void CL_DemoShot_f( void );
2007-11-06 22:00:00 +01:00
void CL_LevelShot_f( void );
2007-11-13 22:00:00 +01:00
void CL_SetSky_f( void );
2008-08-04 22:00:00 +02:00
void SCR_Viewpos_f( void );
2010-07-20 22:00:00 +02:00
void SCR_TimeRefresh_f( void );
2007-06-21 22:00:00 +02:00
//
// cl_main
//
2008-06-29 22:00:00 +02:00
void CL_Init( void );
2009-02-03 22:00:00 +01:00
void CL_SendCommand( void );
2009-11-03 22:00:00 +01:00
void CL_Disconnect_f( void );
void CL_GetChallengePacket( void );
void CL_PingServers_f( void );
void CL_RequestNextDownload( void );
2009-12-05 22:00:00 +01:00
void CL_ClearState( void );
2007-06-21 22:00:00 +02:00
//
// cl_demo.c
//
2008-07-12 22:00:00 +02:00
void CL_DrawDemoRecording( void );
2010-08-06 22:00:00 +02:00
void CL_WriteDemoMessage( sizebuf_t *msg, int head_size );
2008-05-20 22:00:00 +02:00
void CL_ReadDemoMessage( void );
void CL_StopPlayback( void );
void CL_StopRecord( void );
void CL_PlayDemo_f( void );
2009-10-13 22:00:00 +02:00
void CL_StartDemos_f( void );
void CL_Demos_f( void );
2010-01-07 22:00:00 +01:00
void CL_DeleteDemo_f( void );
2008-05-20 22:00:00 +02:00
void CL_Record_f( void );
void CL_Stop_f( void );
2007-06-21 22:00:00 +02:00
2008-12-25 22:00:00 +01:00
//
// cl_game.c
//
void CL_UnloadProgs( void );
2010-10-26 22:00:00 +02:00
qboolean CL_LoadProgs( const char *name );
2010-08-06 22:00:00 +02:00
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
2010-06-22 22:00:00 +02:00
void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize );
2010-11-15 22:00:00 +01:00
void CL_ParseTextMessage( sizebuf_t *msg );
2010-07-20 22:00:00 +02:00
void CL_DrawHUD( int state );
void CL_InitEdicts( void );
void CL_FreeEdicts( void );
2010-12-06 22:00:00 +01:00
void CL_ClearWorld( void );
2010-08-07 22:00:00 +02:00
void CL_InitEntity( cl_entity_t *pEdict );
void CL_FreeEntity( cl_entity_t *pEdict );
2010-07-19 22:00:00 +02:00
void CL_CenterPrint( const char *text, float y );
2009-12-02 22:00:00 +01:00
void CL_SetEventIndex( const char *szEvName, int ev_index );
2010-03-28 22:00:00 +02:00
void CL_TextMessageParse( byte *pMemFile, int fileSize );
2010-07-01 22:00:00 +02:00
int pfnDecalIndexFromName( const char *szDecalName );
2010-11-06 22:00:00 +01:00
int CL_FindModelIndex( const char *m );
2010-11-15 22:00:00 +01:00
HSPRITE pfnSPR_Load( const char *szPicName );
2010-03-06 22:00:00 +01:00
2010-08-07 22:00:00 +02:00
_inline cl_entity_t *CL_EDICT_NUM( int n, const char *file, const int line )
2008-12-25 22:00:00 +01:00
{
2010-08-20 22:00:00 +02:00
if(( n >= 0 ) && ( n < clgame.maxEntities ))
2010-08-07 22:00:00 +02:00
return clgame.entities + n;
2008-12-26 22:00:00 +01:00
Host_Error( "CL_EDICT_NUM: bad number %i (called at %s:%i)\n", n, file, line );
2008-12-25 22:00:00 +01:00
return NULL;
}
2008-07-01 22:00:00 +02:00
2007-06-21 22:00:00 +02:00
//
// cl_parse.c
//
2010-08-16 22:00:00 +02:00
extern const char *svc_strings[256];
2010-08-06 22:00:00 +02:00
void CL_ParseServerMessage( sizebuf_t *msg );
2010-11-06 22:00:00 +01:00
void CL_ParseTempEntity( sizebuf_t *msg );
2010-11-15 22:00:00 +01:00
qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf );
2008-08-02 22:00:00 +02:00
void CL_Download_f( void );
2007-06-21 22:00:00 +02:00
2008-07-04 22:00:00 +02:00
//
// cl_scrn.c
//
2010-11-22 22:00:00 +01:00
void SCR_VidInit( void );
2010-12-09 22:00:00 +01:00
void SCR_EndLoadingPlaque( void );
2008-11-15 22:00:00 +01:00
void SCR_RegisterShaders( void );
2009-09-23 22:00:00 +02:00
void SCR_MakeScreenShot( void );
2009-10-18 22:00:00 +02:00
void SCR_MakeLevelShot( void );
2010-07-26 22:00:00 +02:00
void SCR_NetSpeeds( void );
2009-09-01 22:00:00 +02:00
void SCR_RSpeeds( void );
2008-07-04 22:00:00 +02:00
void SCR_DrawFPS( void );
2007-06-21 22:00:00 +02:00
//
// cl_view.c
//
void V_Init (void);
2008-07-17 22:00:00 +02:00
void V_Shutdown( void );
2009-01-22 22:00:00 +01:00
void V_ClearScene( void );
2010-10-26 22:00:00 +02:00
qboolean V_PreRender( void );
2007-11-06 22:00:00 +01:00
void V_PostRender( void );
2007-11-05 22:00:00 +01:00
void V_RenderView( void );
2007-06-21 22:00:00 +02:00
//
2010-08-19 22:00:00 +02:00
// cl_pmove.c
2007-06-21 22:00:00 +02:00
//
2010-08-19 22:00:00 +02:00
void CL_SetSolidEntities( void );
void CL_SetSolidPlayers( int playernum );
2009-12-05 22:00:00 +01:00
void CL_InitClientMove( void );
2010-07-20 22:00:00 +02:00
void CL_PredictMovement( void );
2009-01-11 22:00:00 +01:00
void CL_CheckPredictionError( void );
2010-10-26 22:00:00 +02:00
qboolean CL_IsPredicted( void );
2010-11-15 22:00:00 +01:00
int CL_TruePointContents( const vec3_t p );
int CL_PointContents( const vec3_t p );
//
// cl_studio.c
//
qboolean CL_InitStudioAPI( void );
2009-12-05 22:00:00 +01:00
2008-06-12 22:00:00 +02:00
//
2009-10-15 22:00:00 +02:00
// cl_frame.c
2008-06-12 22:00:00 +02:00
//
2010-10-26 22:00:00 +02:00
void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta );
2010-11-15 22:00:00 +01:00
qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
2010-08-22 22:00:00 +02:00
void CL_UpdateStudioVars( cl_entity_t *ent, entity_state_t *newstate );
2010-10-26 22:00:00 +02:00
qboolean CL_GetEntitySpatialization( int ent, vec3_t origin, vec3_t velocity );
qboolean CL_IsPlayerIndex( int idx );
2008-06-12 22:00:00 +02:00
2007-06-21 22:00:00 +02:00
//
2010-07-20 22:00:00 +02:00
// cl_tent.c
2007-06-21 22:00:00 +02:00
//
2010-10-31 22:00:00 +01:00
int CL_AddEntity( int entityType, cl_entity_t *pEnt );
2010-08-12 22:00:00 +02:00
void CL_WeaponAnim( int iAnim, int body );
2008-06-30 22:00:00 +02:00
void CL_ClearEffects( void );
2009-01-22 22:00:00 +01:00
void CL_TestLights( void );
2010-06-30 22:00:00 +02:00
void CL_DecalShoot( HSPRITE hDecal, int entityIndex, int modelIndex, float *pos, int flags );
void CL_PlayerDecal( HSPRITE hDecal, int entityIndex, float *pos, byte *color );
2009-12-02 22:00:00 +01:00
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
2010-10-26 22:00:00 +02:00
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
2010-08-16 22:00:00 +02:00
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
2010-10-28 22:00:00 +02:00
word CL_EventIndex( const char *name );
2009-12-02 22:00:00 +01:00
void CL_ResetEvent( event_info_t *ei );
void CL_FireEvents( void );
2010-11-03 22:00:00 +01:00
void CL_InitParticles( void );
void CL_ClearParticles( void );
void CL_FreeParticles( void );
void CL_DrawParticles( void );
2010-11-10 22:00:00 +01:00
void CL_InitTempEnts( void );
void CL_ClearTempEnts( void );
void CL_FreeTempEnts( void );
void CL_AddTempEnts( void );
void CL_InitViewBeams( void );
void CL_ClearViewBeams( void );
void CL_FreeViewBeams( void );
void CL_DrawBeams( int fTrans );
void CL_AddCustomBeam( cl_entity_t *pEnvBeam );
void CL_KillDeadBeams( cl_entity_t *pDeadEntity );
void CL_ParseViewBeam( sizebuf_t *msg, int beamType );
2010-02-23 22:00:00 +01:00
2007-11-04 22:00:00 +01:00
//
2010-07-19 22:00:00 +02:00
// console.c
2007-11-04 22:00:00 +01:00
//
2010-10-26 22:00:00 +02:00
qboolean Con_Visible( void );
2007-11-04 22:00:00 +01:00
void Con_Init( void );
2010-07-19 22:00:00 +02:00
void Con_VidInit( void );
2007-11-04 22:00:00 +01:00
void Con_ToggleConsole_f( void );
void Con_ClearNotify( void );
void Con_RunConsole( void );
void Con_DrawConsole( void );
2010-07-20 22:00:00 +02:00
void Con_DrawStringLen( const char *pText, int *length, int *height );
int Con_DrawString( int x, int y, const char *string, rgba_t setColor );
void Con_DefaultColor( int r, int g, int b );
2010-07-19 22:00:00 +02:00
void Con_CharEvent( int key );
void Key_Console( int key );
2010-07-20 22:00:00 +02:00
void Con_Close( void );
2007-11-05 22:00:00 +01:00
2010-11-20 22:00:00 +01:00
//
// sound.c
//
void S_StreamRawSamples( int samples, int rate, int width, int channels, const byte *data );
void S_StartBackgroundTrack( const char *intro, const char *loop );
void S_StopBackgroundTrack( void );
void S_StreamSetPause( int pause );
void S_StartStreaming( void );
void S_StopStreaming( void );
void S_BeginRegistration( void );
sound_t S_RegisterSound( const char *sample );
void S_EndRegistration( void );
void S_StartSound( const vec3_t pos, int ent, int chan, sound_t sfx, float vol, float attn, int pitch, int flags );
void S_AmbientSound( const vec3_t pos, int ent, int chan, sound_t handle, float fvol, float attn, int pitch, int flags );
void S_FadeClientVolume( float fadePercent, float fadeOutSeconds, float holdTime, float fadeInSeconds );
void S_StartLocalSound( const char *name );
void S_RenderFrame( struct ref_params_s *fd );
void S_ExtraUpdate( void );
2008-06-28 22:00:00 +02:00
//
2008-08-05 22:00:00 +02:00
// cl_menu.c
2008-06-28 22:00:00 +02:00
//
2010-07-18 22:00:00 +02:00
void UI_UnloadProgs( void );
2010-10-26 22:00:00 +02:00
qboolean UI_LoadProgs( const char *name );
2010-07-18 22:00:00 +02:00
void UI_UpdateMenu( float realtime );
2010-10-26 22:00:00 +02:00
void UI_KeyEvent( int key, qboolean down );
2009-09-10 22:00:00 +02:00
void UI_MouseMove( int x, int y );
2010-10-26 22:00:00 +02:00
void UI_SetActiveMenu( qboolean fActive );
2009-09-10 22:00:00 +02:00
void UI_AddServerToList( netadr_t adr, const char *info );
2010-07-18 22:00:00 +02:00
void UI_GetCursorPos( int *pos_x, int *pos_y );
2010-01-02 22:00:00 +01:00
void UI_SetCursorPos( int pos_x, int pos_y );
2010-10-26 22:00:00 +02:00
void UI_ShowCursor( qboolean show );
qboolean UI_CreditsActive( void );
2010-02-16 22:00:00 +01:00
void UI_CharEvent( int key );
2010-10-26 22:00:00 +02:00
qboolean UI_MouseInRect( void );
qboolean UI_IsVisible( void );
2010-12-02 22:00:00 +01:00
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a );
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc );
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc );
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc );
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc );
2008-06-28 22:00:00 +02:00
2007-11-06 22:00:00 +01:00
//
2009-11-23 22:00:00 +01:00
// cl_video.c
2007-11-06 22:00:00 +01:00
//
2009-11-23 22:00:00 +01:00
void SCR_InitCinematic( void );
2010-09-30 22:00:00 +02:00
void SCR_FreeCinematic( void );
2010-10-26 22:00:00 +02:00
qboolean SCR_PlayCinematic( const char *name );
qboolean SCR_DrawCinematic( void );
2007-11-06 22:00:00 +01:00
void SCR_RunCinematic( void );
void SCR_StopCinematic( void );
2008-08-02 22:00:00 +02:00
void CL_PlayVideo_f( void );
2007-11-06 22:00:00 +01:00
2010-11-16 22:00:00 +01:00
//
// vgui_int.cpp
//
#ifdef __cplusplus
extern "C" {
#endif
void VGui_Startup( void );
2010-11-17 22:00:00 +01:00
void VGui_Shutdown( void );
2010-11-16 22:00:00 +01:00
void *VGui_GetPanel( void );
void VGui_Paint( void );
void VGui_ViewportPaintBackground( int extents[4] );
#ifdef __cplusplus
}
#endif
2007-11-04 22:00:00 +01:00
#endif//CLIENT_H