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

852 lines
27 KiB
C
Raw Normal View History

2011-05-09 22:00:00 +02:00
/*
client.h - primary header for client
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-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"
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"
2011-12-04 21:00:00 +01:00
#include "render_api.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"
2011-09-28 22:00:00 +02:00
#include "net_api.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
2012-05-12 22:00:00 +02:00
#define MAX_EFRAGS 1024
2011-09-28 22:00:00 +02:00
#define MAX_REQUESTS 32
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
2011-08-21 22:00:00 +02:00
#define VID_MAPSHOT 3 // special case for overview layer
2011-09-03 22:00:00 +02:00
#define VID_SNAPSHOT 4 // save screenshot into root dir and no gamma correction
2010-12-09 22:00:00 +01:00
2011-02-28 22:00:00 +01:00
typedef int sound_t;
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-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
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;
2011-02-22 22:00:00 +01:00
qboolean background; // not real game, just a background
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
2011-04-17 22:00:00 +02:00
int predictcount; // advances with next clientdata
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
2011-03-30 22:00:00 +02:00
local_state_t predict[MULTIPLAYER_BACKUP]; // local client state
2011-03-31 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
2011-04-09 22:00:00 +02:00
vec3_t predicted_origin; // generated by CL_PredictMovement
2009-12-05 22:00:00 +01:00
vec3_t predicted_viewofs;
vec3_t predicted_velocity;
2009-09-20 22:00:00 +02:00
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
2011-04-17 22:00:00 +02:00
cl_entity_t *world;
2010-10-26 22:00:00 +02:00
model_t *worldmodel; // pointer to world
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;
2009-09-23 22:00:00 +02:00
typedef enum
{
scrshot_inactive,
2011-03-31 22:00:00 +02:00
scrshot_normal, // in-game screenshot
2011-09-03 22:00:00 +02:00
scrshot_snapshot, // in-game snapshot
2009-09-23 22:00:00 +02:00
scrshot_plaque, // levelshot
scrshot_savegame, // saveshot
2010-03-26 22:00:00 +01:00
scrshot_demoshot, // for demos preview
scrshot_envshot, // cubemap view
2011-08-21 22:00:00 +02:00
scrshot_skyshot, // skybox view
scrshot_mapshot // overview layer
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
2011-10-09 22:00:00 +02:00
} cl_user_event_t;
2009-12-02 22:00:00 +01:00
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
2011-09-28 22:00:00 +02:00
byte charWidths[256];
int charHeight;
qboolean valid; // all 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;
2011-09-28 22:00:00 +02:00
qboolean adjust_size; // allow to adjust scale for fonts
2009-12-03 22:00:00 +01:00
2011-04-25 22:00:00 +02:00
int cullMode; // override CULL FACE from TriAPI
2010-07-20 22:00:00 +02:00
// holds text color
rgba_t textColor;
2010-12-14 22:00:00 +01:00
rgba_t spriteColor;
2011-04-18 22:00:00 +02:00
rgba_t triColor;
2010-07-20 22:00:00 +02:00
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
{
2011-10-09 22:00:00 +02:00
int gl_texturenum; // this is a real texnum
2010-12-02 22:00:00 +01:00
// 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
2011-09-03 22:00:00 +02:00
float time;
int y, lines;
2010-07-19 22:00:00 +02:00
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;
2011-07-22 22:00:00 +02:00
typedef struct
{
struct mstudiotex_s *ptexture; // array of textures with local copy of remapped textures
short numtextures; // textures count
short topcolor; // cached value
short bottomcolor; // cached value
model_t *model; // for catch model changes
} remap_info_t;
2011-08-21 22:00:00 +02:00
// same as ref_params but for overview mode
typedef struct
{
vec3_t origin;
qboolean rotated;
float xLeft;
float xRight;
float xTop;
float xBottom;
float zFar;
float zNear;
float flZoom;
} ref_overview_t;
2011-09-28 22:00:00 +02:00
typedef struct
{
net_response_t resp;
net_api_response_func_t pfnFunc;
double timeout;
double timesend; // time when request was sended
int flags; // FNETAPI_MULTIPLE_RESPONSE etc
} net_request_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 );
2011-07-22 22:00:00 +02:00
void (*pfnChatInputPosition)( int *x, int *y );
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 );
2011-12-04 21:00:00 +01:00
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback );
2012-04-11 22:00:00 +02:00
int (*pfnGetPlayerTeam)( int playerIndex );
2010-11-15 22:00:00 +01:00
} 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
2011-12-04 21:00:00 +01:00
render_interface_t drawFuncs; // custom renderer support
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
2011-10-06 22:00:00 +02:00
cl_entity_t *static_entities; // dynamically allocated static entity array
2011-07-22 22:00:00 +02:00
remap_info_t **remap_info; // store local copy of all remap textures for each entity
2009-06-24 22:00:00 +02:00
2010-08-20 22:00:00 +02:00
int maxEntities;
2011-07-22 22:00:00 +02:00
int maxRemapInfos; // maxEntities + cl.viewEnt; also used for catch entcount
2011-10-06 22:00:00 +02:00
int numStatics; // actual static entity count
2010-08-20 22:00:00 +02:00
2009-11-26 22:00:00 +01:00
// movement values from server
movevars_t movevars;
movevars_t oldmovevars;
playermove_t *pmove; // pmove state
2012-02-11 21:00:00 +01:00
int old_trace_hull; // used by PM_Push\Pop state
2010-08-19 22:00:00 +02:00
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
2011-10-09 22:00:00 +02:00
cl_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
2010-12-13 22:00:00 +01:00
int load_sequence; // for unloading unneeded sprites
2010-12-02 22:00:00 +01:00
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
2011-08-21 22:00:00 +02:00
ref_overview_t overView; // overView params
2011-04-08 22:00:00 +02:00
rgb_t palette[256]; // palette used for particle colors
2010-07-13 22:00:00 +02:00
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;
2011-09-28 22:00:00 +02:00
net_request_t net_requests[MAX_REQUESTS]; // no reason to keep more
2011-10-06 22:00:00 +02:00
efrag_t *free_efrags; // efrags
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
2011-01-03 22:00:00 +01:00
player_info_t playerinfo; // local playerinfo
2010-08-07 22:00:00 +02:00
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;
2011-02-05 22:00:00 +01:00
float logo_length;
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
2011-04-08 22:00:00 +02:00
// g-cont. this port allow many copies of engine in multiplayer game
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
2011-04-08 22:00:00 +02:00
double connect_time; // for connection retransmits
sizebuf_t datagram; // unreliable stuff. gets sent in CL_Move about cl_cmdrate times per second.
byte datagram_buf[NET_MAX_PAYLOAD];
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
2011-09-19 22:00:00 +02:00
int tileImage; // for draw any areas not covered by the refresh
2010-12-02 22:00:00 +01:00
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]
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;
2011-07-07 22:00:00 +02:00
// download info
int downloadcount;
int downloadfileid;
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;
2012-03-01 21:00:00 +01:00
file_t *demoheader; // contain demo startup info in case we record a demo on this level
2007-06-21 22:00:00 +02:00
} 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;
2011-04-09 22:00:00 +02:00
extern convar_t *cl_timeout;
2010-10-22 22:00:00 +02:00
extern convar_t *cl_nodelta;
2012-03-24 21:00:00 +01:00
extern convar_t *cl_interp;
2010-10-22 22:00:00 +02:00
extern convar_t *cl_crosshair;
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;
2011-04-10 22:00:00 +02:00
extern convar_t *scr_viewsize;
2010-10-22 22:00:00 +02:00
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;
2012-03-24 21:00:00 +01:00
extern convar_t *hltv;
2007-06-21 22:00:00 +02:00
//=============================================================================
2008-07-11 22:00:00 +02:00
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 );
2011-09-03 22:00:00 +02:00
void CL_SnapShot_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
//
2012-03-01 21:00:00 +01:00
// cl_main.c
2007-06-21 22:00:00 +02:00
//
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 );
2011-07-07 22:00:00 +02:00
void CL_ProcessFile( qboolean successfully_received, const char *filename );
2012-03-01 21:00:00 +01:00
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
2009-11-03 22:00:00 +01:00
void CL_GetChallengePacket( void );
void CL_PingServers_f( void );
2009-12-05 22:00:00 +01:00
void CL_ClearState( void );
2007-06-21 22:00:00 +02:00
//
// cl_demo.c
//
2012-03-01 21:00:00 +01:00
void CL_StartupDemoHeader( void );
2008-07-12 22:00:00 +02:00
void CL_DrawDemoRecording( void );
2012-03-01 21:00:00 +01:00
void CL_WriteDemoUserCmd( int cmdnumber );
void CL_WriteDemoMessage( qboolean startup, int start, sizebuf_t *msg );
void CL_WriteDemoUserMessage( const byte *buffer, size_t size );
qboolean CL_DemoReadMessage( byte *buffer, size_t *length );
void CL_WriteDemoJumpTime( void );
void CL_CloseDemoHeader( void );
2008-05-20 22:00:00 +02:00
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
2011-10-09 22:00:00 +02:00
//
// cl_events.c
//
void CL_ParseEvent( sizebuf_t *msg );
void CL_ParseReliableEvent( sizebuf_t *msg );
void CL_SetEventIndex( const char *szEvName, int ev_index );
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
void CL_PlaybackEvent( 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 );
void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func );
word CL_EventIndex( const char *name );
2011-12-04 21:00:00 +01:00
const char *CL_IndexEvent( word index );
2011-10-09 22:00:00 +02:00
void CL_ResetEvent( event_info_t *ei );
void CL_FireEvents( void );
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_FreeEntity( cl_entity_t *pEdict );
2010-07-19 22:00:00 +02:00
void CL_CenterPrint( const char *text, float y );
2010-03-28 22:00:00 +02:00
void CL_TextMessageParse( byte *pMemFile, int fileSize );
2011-01-03 22:00:00 +01:00
client_textmessage_t *CL_TextMessageGet( const char *pName );
2010-07-01 22:00:00 +02:00
int pfnDecalIndexFromName( const char *szDecalName );
2010-12-25 22:00:00 +01:00
int pfnIndexFromTrace( struct pmtrace_s *pTrace );
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 );
2012-01-27 21:00:00 +01:00
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
2011-09-28 22:00:00 +02:00
void TextAdjustSize( int *x, int *y, int *w, int *h );
void PicAdjustSize( float *x, float *y, float *w, float *h );
2012-02-11 21:00:00 +01:00
void CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_pe, pmtrace_t *tr );
void CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr );
void CL_SetTraceHull( int hull );
2010-03-06 22:00:00 +01:00
2011-04-06 22:00:00 +02:00
_inline cl_entity_t *CL_EDICT_NUM( int n )
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;
2011-04-06 22:00:00 +02:00
Host_Error( "CL_EDICT_NUM: bad number %i\n", n );
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 );
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 );
2011-09-19 22:00:00 +02:00
void SCR_TileClear( void );
void SCR_AddDirtyPoint( int x, int y );
2010-12-09 22:00:00 +01:00
void SCR_EndLoadingPlaque( void );
2010-12-27 22:00:00 +01:00
void SCR_RebuildGammaTable( 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 );
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 );
2011-08-21 22:00:00 +02:00
void V_SetupOverviewState( void );
void V_ProcessOverviewCmds( usercmd_t *cmd );
void V_MergeOverviewRefdef( ref_params_t *fd );
void V_WriteOverviewScript( 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 );
2011-02-15 22:00:00 +01:00
int CL_WaterEntity( const float *rgflPos );
2011-09-03 22:00:00 +02:00
cl_entity_t *CL_GetWaterEntity( const float *rgflPos );
2011-02-20 22:00:00 +01:00
void CL_SetupPMove( playermove_t *pmove, clientdata_t *cd, entity_state_t *state, usercmd_t *ucmd );
2012-02-11 21:00:00 +01:00
pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags );
2011-04-18 22:00:00 +02:00
void CL_ClearPhysEnts( void );
2010-11-15 22:00:00 +01:00
//
// cl_studio.c
//
2011-12-04 21:00:00 +01:00
void 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 );
2011-10-06 22:00:00 +02:00
void CL_UpdateStudioVars( cl_entity_t *ent, entity_state_t *newstate, qboolean noInterp );
2011-10-14 22:00:00 +02:00
qboolean CL_GetEntitySpatialization( int entnum, vec3_t origin, float *pradius );
2011-10-06 22:00:00 +02:00
void CL_UpdateEntityFields( cl_entity_t *ent );
2010-10-26 22:00:00 +02:00
qboolean CL_IsPlayerIndex( int idx );
2008-06-12 22:00:00 +02:00
2011-07-22 22:00:00 +02:00
//
// cl_remap.c
//
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
void CL_AllocRemapInfo( int topcolor, int bottomcolor );
void CL_FreeRemapInfo( remap_info_t *info );
void R_StudioSetRemapColors( int top, int bottom );
void CL_UpdateRemapInfo( int topcolor, int bottomcolor );
void CL_ClearAllRemaps( void );
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 );
2011-12-04 21:00:00 +01:00
void CL_DrawParticlesExternal( const float *vieworg, const float *fwd, const float *rt, const float *up, uint clipFlags );
2010-12-23 22:00:00 +01:00
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
void CL_PlayerDecal( int textureIndex, int entityIndex, float *pos );
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-12-19 22:00:00 +01:00
void CL_RegisterMuzzleFlashes( void );
2011-09-03 22:00:00 +02:00
void CL_ReadPointFile_f( void );
void CL_ReadLineFile_f( void );
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
//
2011-09-28 22:00:00 +02:00
extern convar_t *con_fontsize;
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 );
2011-04-08 22:00:00 +02:00
void Con_DrawDebug( void );
2007-11-04 22:00:00 +01:00
void Con_RunConsole( void );
void Con_DrawConsole( void );
2010-12-28 22:00:00 +01:00
void Con_DrawVersion( 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 );
2011-09-03 22:00:00 +02:00
int Con_DrawCharacter( int x, int y, int number, rgba_t color );
void Con_DrawCharacterLen( int number, int *width, int *height );
2010-07-20 22:00:00 +02:00
void Con_DefaultColor( int r, int g, int b );
2011-09-28 22:00:00 +02:00
void Con_SetFont( int fontNum );
2010-07-19 22:00:00 +02:00
void Con_CharEvent( int key );
2011-09-28 22:00:00 +02:00
void Con_RestoreFont( void );
2010-07-19 22:00:00 +02:00
void Key_Console( int key );
2011-07-07 22:00:00 +02:00
void Key_Message( 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
//
2011-04-08 22:00:00 +02:00
// s_main.c
2010-11-20 22:00:00 +01:00
//
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 );
2010-12-25 22:00:00 +01:00
void S_AmbientSound( const vec3_t pos, int ent, sound_t handle, float fvol, float attn, int pitch, int flags );
2010-11-20 22:00:00 +01:00
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 );
2011-03-20 22:00:00 +01:00
qboolean UI_LoadProgs( void );
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
2007-11-04 22:00:00 +01:00
#endif//CLIENT_H