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

700 lines
19 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"
2008-12-25 22:00:00 +01:00
#include "clgame_api.h"
2009-11-02 22:00:00 +01:00
#include "com_world.h"
2007-11-05 22:00:00 +01:00
2009-10-13 22:00:00 +02:00
#define MAX_DEMOS 32
2007-11-05 22:00:00 +01:00
#define MAX_EDIT_LINE 256
#define COMMAND_HISTORY 32
2008-06-22 22:00:00 +02:00
#define MAX_SERVERS 64
2009-10-23 22:00:00 +02:00
#define MAX_GAME_TITLES 1024
2008-07-23 22:00:00 +02:00
#define ColorIndex(c) (((c) - '0') & 7)
2007-06-21 22:00:00 +02:00
2009-06-24 22:00:00 +02:00
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - clgame.edicts))
2008-12-26 22:00:00 +01:00
#define EDICT_NUM( num ) CL_EDICT_NUM( num, __FILE__, __LINE__ )
#define STRING( offset ) CL_GetString( offset )
#define MAKE_STRING(str) CL_AllocString( str )
2008-12-25 22:00:00 +01:00
2009-12-04 22:00:00 +01:00
typedef struct player_info_s
{
char name[CS_SIZE];
char userinfo[MAX_INFO_STRING];
char model[CS_SIZE];
} player_info_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
{
bool valid; // cleared if delta parsing was invalid
2009-09-16 22:00:00 +02:00
int serverframe;
2009-09-20 22:00:00 +02:00
int servertime;
2009-09-16 22:00:00 +02:00
int deltaframe;
2008-09-09 22:00:00 +02:00
byte areabits[MAX_MAP_AREA_BYTES]; // portalarea visibility bits
2008-07-10 22:00:00 +02:00
int num_entities;
2008-07-11 22:00:00 +02:00
int parse_entities; // non-masked index into cl_parse_entities array
2007-06-21 22:00:00 +02:00
} frame_t;
2007-11-05 22:00:00 +01:00
// console stuff
typedef struct field_s
{
2009-09-16 22:00:00 +02:00
int cursor;
int scroll;
int widthInChars;
char buffer[MAX_EDIT_LINE];
int maxchars; // menu stuff
2007-11-05 22:00:00 +01:00
} field_t;
2009-09-16 22:00:00 +02:00
#define CMD_BACKUP 64 // allow a lot of command backups for very fast systems
#define CMD_MASK (CMD_BACKUP - 1)
2007-06-21 22:00:00 +02:00
2009-09-28 22:00:00 +02:00
// the cl_parse_entities must be large enough to hold UPDATE_BACKUP frames of
// entities, so that when a delta compressed message arives from the server
// it can be un-deltad from the original
#define MAX_PARSE_ENTITIES 2048
2007-06-21 22:00:00 +02:00
//
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
2008-08-03 22:00:00 +02:00
bool video_prepped; // false if on new level or new ref dll
bool audio_prepped; // false if on new level or new snd dll
2009-09-28 22:00:00 +02:00
bool force_refdef; // vid has changed, so we can't use a paused refdef
2007-11-06 22:00:00 +01:00
int parse_entities; // index (not anded off) into cl_parse_entities[]
2007-06-21 22:00:00 +02:00
2009-09-16 22:00:00 +02:00
int cmd_number;
usercmd_t cmds[CMD_BACKUP]; // each mesage will send several old cmds
2009-11-15 22:00:00 +01:00
long cmd_time[CMD_BACKUP]; // time sent, for calculating pings
2009-09-16 22:00:00 +02:00
2008-12-26 22:00:00 +01:00
frame_t frame; // received from server
2009-09-16 22:00:00 +02:00
frame_t *oldframe; // previous frame to lerping from
int surpressCount; // number of messages rate supressed
2007-06-21 22:00:00 +02:00
frame_t frames[UPDATE_BACKUP];
2008-07-06 22:00:00 +02:00
// mouse current position
int mouse_x[2];
int mouse_y[2];
int mouse_step;
2007-06-21 22:00:00 +02:00
2009-09-20 22:00:00 +02:00
int mtime[2]; // the timestamp of the last two messages
int time; // this is the time value that the client
2009-09-16 22:00:00 +02:00
// is rendering at. always <= cls.realtime
int render_flags; // clearing at end of frame
2009-09-18 22:00:00 +02:00
float lerpFrac; // interpolation value
2008-12-26 22:00:00 +01:00
ref_params_t refdef; // shared refdef
2009-01-05 22:00:00 +01:00
client_data_t data; // hud data
2007-06-21 22:00:00 +02:00
2009-11-23 22:00:00 +01:00
cinematics_t *cin;
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
2009-11-15 22:00:00 +01:00
vec3_t predicted_origins[CMD_BACKUP];// for debug comparing against server
2009-09-20 22:00:00 +02:00
float predicted_step; // for stair up smoothing
uint predicted_step_time;
vec3_t predicted_origin; // generated by CL_PredictMovement
vec3_t predicted_angles;
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;
2009-06-24 22:00:00 +02:00
int servercount; // server identification for prespawns
2009-09-20 22:00:00 +02:00
int serverframetime; // server frametime
2008-10-27 22:00:00 +01:00
char configstrings[MAX_CONFIGSTRINGS][CS_SIZE];
2009-11-23 22:00:00 +01:00
char physinfo[MAX_INFO_STRING]; // physics info string
2007-06-21 22:00:00 +02:00
2009-09-28 22:00:00 +02:00
entity_state_t entity_curstates[MAX_PARSE_ENTITIES];
2007-06-21 22:00:00 +02:00
// locally derived information from server state
2009-10-28 22:00:00 +01:00
model_t models[MAX_MODELS];
2008-08-02 22:00:00 +02:00
string_t edict_classnames[MAX_CLASSNAMES];
2007-11-01 22:00:00 +01:00
sound_t sound_precache[MAX_SOUNDS];
2008-12-15 22:00:00 +01:00
shader_t decal_shaders[MAX_DECALS];
2007-11-04 22:00:00 +01:00
} client_t;
2007-06-21 22:00:00 +02:00
2007-11-04 22:00:00 +01:00
extern client_t cl;
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;
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
} e_scrshot;
2009-10-15 22:00:00 +02:00
typedef struct
{
byte open; // 0 = mouth closed, 255 = mouth agape
byte sndcount; // counter for running average
int sndavg; // running average
} mouth_t;
2008-12-25 22:00:00 +01:00
// cl_private_edict_t
2008-12-26 22:00:00 +01:00
struct cl_priv_s
2008-07-24 22:00:00 +02:00
{
2009-11-26 22:00:00 +01:00
link_t area; // linked to a division node or leaf
bool linked;
2009-09-16 22:00:00 +02:00
int serverframe; // if not current, this ent isn't in the frame
2009-10-18 22:00:00 +02:00
2008-07-24 22:00:00 +02:00
entity_state_t current;
entity_state_t prev; // will always be valid, but might just be a copy of current
2009-10-18 22:00:00 +02:00
prevframe_t latched; // previous frame to lerping from
2009-10-15 22:00:00 +02:00
// studiomodels attachments
vec3_t origin[MAXSTUDIOATTACHMENTS];
vec3_t angles[MAXSTUDIOATTACHMENTS];
mouth_t mouth; // shared mouth info
2008-07-24 22:00:00 +02:00
};
2008-06-22 22:00:00 +02:00
typedef struct serverinfo_s
{
char *mapname;
char *hostname;
char *shortname;
char *gamename;
char *netaddress;
char *playerstr;
int numplayers;
int maxplayers;
char *pingstring;
bool statusPacket;
int ping;
} serverinfo_t;
2009-01-09 22:00:00 +01:00
typedef enum { key_console = 0, key_game, key_hudmenu, key_message, key_menu } keydest_t;
2008-12-25 22:00:00 +01:00
typedef struct
{
2008-12-26 22:00:00 +01:00
char name[CS_SIZE];
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
2008-12-25 22:00:00 +01:00
} user_message_t;
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;
2009-12-03 22:00:00 +01:00
typedef struct
{
// temp handle
HSPRITE hSprite;
// scissor test
int scissor_x;
int scissor_y;
int scissor_width;
int scissor_height;
bool scissor_test;
2009-12-04 22:00:00 +01:00
// centerprint stuff
int centerPrintY;
int centerPrintTime;
int centerPrintCharWidth;
char centerPrint[2048];
int centerPrintLines;
HSPRITE hHudFont;
2009-12-03 22:00:00 +01:00
// crosshair members
HSPRITE hCrosshair;
wrect_t rcCrosshair;
rgba_t rgbaCrosshair;
} draw_stuff_t;
2009-10-20 22:00:00 +02:00
#define MAX_TRIPOLYS 2048
#define MAX_TRIVERTS 128
#define MAX_TRIELEMS MAX_TRIVERTS * 6
#define MAX_TRIANGLES MAX_TRIELEMS / 3
typedef struct
{
poly_t currentPolygon;
shader_t currentShader;
int currentFrame;
int vertexState;
int drawMode;
rgba_t color;
bool checkFlush;
bool hasNormals;
bool caps[3];
vec3_t *verts;
vec3_t *normals;
vec2_t *stcoords;
rgba_t *colors;
uint *elems;
vec3_t vertsArray[MAX_TRIPOLYS][MAX_TRIVERTS];
vec3_t normalsArray[MAX_TRIPOLYS][MAX_TRIVERTS];
vec2_t stcoordsArray[MAX_TRIPOLYS][MAX_TRIVERTS];
rgba_t colorsArray[MAX_TRIPOLYS][MAX_TRIVERTS];
uint elemsArray[MAX_TRIPOLYS][MAX_TRIELEMS];
int numPolys;
int numVertex;
int numColor;
int numIndex;
} tri_state_t;
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
2009-06-24 22:00:00 +02:00
byte *private; // client.dll private pool
2009-10-11 22:00:00 +02:00
string maptitle; // display map title
2009-06-24 22:00:00 +02:00
union
{
edict_t *edicts; // acess by edict number
void *vp; // acess by offset in bytes
};
2009-11-26 22:00:00 +01:00
// movement values from server
movevars_t movevars;
movevars_t oldmovevars;
playermove_t *pmove; // pmove state
2009-09-28 22:00:00 +02:00
cl_globalvars_t *globals;
2008-12-25 22:00:00 +01:00
user_message_t *msg[MAX_USER_MESSAGES];
2009-12-02 22:00:00 +01:00
user_event_t *events[MAX_EVENTS]; // keep static to avoid fragment memory
2009-11-28 22:00:00 +01:00
entity_state_t *baselines;
2009-09-28 22:00:00 +02:00
2009-12-03 22:00:00 +01:00
draw_stuff_t ds; // draw2d stuff (hud, weaponmenu etc)
SCREENINFO scrInfo; // actual screen info
2009-10-20 22:00:00 +02:00
tri_state_t *pTri;
2009-10-23 22:00:00 +02:00
client_textmessage_t titles[MAX_GAME_TITLES];
int numTitles;
2009-10-18 22:00:00 +02:00
edict_t viewent; // viewmodel or playermodel in UI_PlayerSetup
edict_t playermodel; // uiPlayerSetup latched vars
2008-12-25 22:00:00 +01:00
int numMessages; // actual count of user messages
int hStringTable; // stringtable handle
2009-01-11 22:00:00 +01:00
2008-12-25 22:00:00 +01:00
} clgame_static_t;
2007-06-21 22:00:00 +02:00
typedef struct
{
connstate_t state;
2008-08-04 22:00:00 +02:00
bool initialized;
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-09-17 22:00:00 +02:00
float frametime; // seconds since last frame
2009-09-20 22:00:00 +02:00
int realtime;
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-06-21 22:00:00 +02:00
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
2009-09-20 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
2007-06-21 22:00:00 +02:00
2008-06-30 22:00:00 +02:00
int challenge; // from the server to use for connecting
2008-11-09 22:00:00 +01:00
shader_t consoleFont; // current console font
2008-11-15 22:00:00 +01:00
shader_t clientFont; // current client font
2008-11-09 22:00:00 +01:00
shader_t consoleBack; // console background
2009-10-18 22:00:00 +02:00
shader_t fillShader; // used for emulate FillRGBA to avoid wrong draw-sort
2009-11-23 22:00:00 +01:00
shader_t particle; // used for drawing quake1 particles (SV_ParticleEffect)
2008-12-26 22:00:00 +01:00
shader_t netIcon; // netIcon displayed bad network connection
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
2009-09-23 22:00:00 +02:00
e_scrshot scrshot_request; // request for screen shot
e_scrshot scrshot_action; // in-action
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
2008-08-02 22:00:00 +02:00
// demo recording info must be here, so it isn't clearing on level change
2008-05-20 22:00:00 +02:00
bool demorecording;
bool demoplayback;
2008-08-02 22:00:00 +02:00
bool demowaiting; // don't record until a non-delta message is received
2009-10-18 22:00:00 +02:00
bool drawplaque; // draw plaque when level is loading
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;
2008-06-22 22:00:00 +02:00
serverinfo_t serverlist[MAX_SERVERS]; // servers to join
int numservers;
2009-09-20 22:00:00 +02:00
int pingtime; // servers timebase
2007-06-21 22:00:00 +02:00
} client_static_t;
extern client_static_t cls;
2008-12-26 22:00:00 +01:00
extern clgame_static_t clgame;
2007-06-21 22:00:00 +02:00
2008-07-04 22:00:00 +02:00
/*
==============================================================
SCREEN CONSTS
==============================================================
*/
2009-09-10 22:00:00 +02:00
extern rgba_t g_color_table[8];
2008-01-15 22:00:00 +01:00
2007-06-21 22:00:00 +02:00
//
// cvars
//
2009-09-17 22:00:00 +02:00
extern cvar_t *cl_predict;
extern cvar_t *cl_showfps;
extern cvar_t *cl_upspeed;
extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_backspeed;
extern cvar_t *cl_sidespeed;
extern cvar_t *cl_shownet;
extern cvar_t *cl_yawspeed;
extern cvar_t *cl_pitchspeed;
extern cvar_t *cl_envshot_size;
extern cvar_t *cl_run;
extern cvar_t *cl_font;
2009-12-03 22:00:00 +01:00
extern cvar_t *cl_crosshair;
2009-09-17 22:00:00 +02:00
extern cvar_t *cl_anglespeedkey;
extern cvar_t *cl_showmiss;
extern cvar_t *cl_particles;
extern cvar_t *cl_particlelod;
extern cvar_t *cl_testentities;
extern cvar_t *cl_testlights;
extern cvar_t *cl_testflashlight;
extern cvar_t *cl_levelshot_name;
extern cvar_t *scr_centertime;
2009-11-02 22:00:00 +01:00
extern cvar_t *scr_download;
extern cvar_t *scr_loading;
2009-11-23 22:00:00 +01:00
extern cvar_t *userinfo;
2009-09-17 22:00:00 +02:00
extern cvar_t *con_font;
2007-06-21 22:00:00 +02:00
//=============================================================================
2008-07-11 22:00:00 +02:00
2008-08-02 22:00:00 +02:00
bool CL_CheckOrDownloadFile( const char *filename );
2007-06-21 22:00:00 +02:00
//=================================================
2008-06-14 22:00:00 +02:00
void CL_TeleportSplash( vec3_t org );
2008-05-20 22:00:00 +02:00
int CL_ParseEntityBits( sizebuf_t *msg, uint *bits );
void CL_ParseFrame( sizebuf_t *msg );
2007-06-21 22:00:00 +02:00
2008-06-30 22:00:00 +02:00
void CL_ParseTempEnts( sizebuf_t *msg );
2008-05-20 22:00:00 +02:00
void CL_ParseConfigString( sizebuf_t *msg );
2007-06-21 22:00:00 +02:00
void CL_SetLightstyle (int i);
void CL_RunParticles (void);
void CL_RunDLights (void);
void CL_RunLightStyles (void);
void CL_AddEntities (void);
void CL_AddDLights (void);
void CL_AddLightStyles (void);
//=================================================
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
//
2007-06-21 22:00:00 +02:00
void CL_Quit_f (void);
2007-11-06 22:00:00 +01:00
void CL_ScreenShot_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 );
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-01-20 22:00:00 +01:00
void CL_SetFont_f( void );
2008-08-04 22:00:00 +02:00
void SCR_Viewpos_f( void );
2007-06-21 22:00:00 +02:00
//
// cl_main
//
2007-09-13 22:00:00 +02:00
extern render_exp_t *re;
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 );
void CL_GetChallengePacket( void );
void CL_PingServers_f( void );
void CL_Snd_Restart_f( void );
void CL_RequestNextDownload( void );
2007-06-21 22:00:00 +02:00
//
2008-07-11 22:00:00 +02:00
// cl_input.c
2007-06-21 22:00:00 +02:00
//
2007-11-17 22:00:00 +01:00
void CL_InitInput( void );
void CL_ShutdownInput( void );
void CL_UpdateMouse( void );
2007-06-21 22:00:00 +02:00
void CL_SendCmd (void);
void CL_SendMove (usercmd_t *cmd);
void CL_ClearState (void);
void CL_ReadPackets (void);
int CL_ReadFromServer (void);
void CL_WriteToServer (usercmd_t *cmd);
void IN_CenterView (void);
2008-07-11 22:00:00 +02:00
2007-06-21 22:00:00 +02:00
//
// cl_demo.c
//
2008-07-12 22:00:00 +02:00
void CL_DrawDemoRecording( void );
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 );
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-05-23 22:00:00 +02:00
//
// cl_progs.c
//
void CL_InitClientProgs( void );
void CL_FreeClientProgs( void );
2008-12-26 22:00:00 +01:00
void CL_DrawHUD( int state );
2008-12-25 22:00:00 +01:00
edict_t *CL_GetEdict( int entnum );
2009-12-04 22:00:00 +01:00
void CL_FadeAlpha( int starttime, int endtime, rgba_t color );
2009-09-25 22:00:00 +02:00
void CL_InitEdicts( void );
2008-07-01 22:00:00 +02:00
void CL_FreeEdicts( void );
2009-11-27 22:00:00 +01:00
void CL_InitWorld( void );
2008-12-25 22:00:00 +01:00
//
// cl_game.c
//
void CL_UnloadProgs( void );
bool CL_LoadProgs( const char *name );
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
2008-12-26 22:00:00 +01:00
void CL_LinkUserMessage( char *pszName, const int svc_num );
void CL_SortUserMessages( void );
2008-12-25 22:00:00 +01:00
edict_t *CL_AllocEdict( void );
2009-01-04 22:00:00 +01:00
void CL_InitEdict( edict_t *pEdict );
2008-12-25 22:00:00 +01:00
void CL_FreeEdict( edict_t *pEdict );
2008-12-26 22:00:00 +01:00
string_t CL_AllocString( const char *szValue );
const char *CL_GetString( string_t iString );
2009-11-23 22:00:00 +01:00
void CL_CenterPrint( const char *text, int y, int charWidth );
2009-11-26 22:00:00 +01:00
bool CL_IsValidEdict( const edict_t *e );
const char *CL_ClassName( const edict_t *e );
2009-12-02 22:00:00 +01:00
void CL_SetEventIndex( const char *szEvName, int ev_index );
2008-12-25 22:00:00 +01:00
2008-12-26 22:00:00 +01:00
_inline edict_t *CL_EDICT_NUM( int n, const char *file, const int line )
2008-12-25 22:00:00 +01:00
{
2009-09-28 22:00:00 +02:00
if((n >= 0) && (n < clgame.globals->maxEntities))
2009-06-24 22:00:00 +02:00
return clgame.edicts + 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
//
2009-11-25 22:00:00 +01:00
int CL_CalcNet( void );
2008-05-20 22:00:00 +02:00
void CL_ParseServerMessage( sizebuf_t *msg );
2008-12-03 22:00:00 +01:00
void CL_RunBackgroundTrack( void );
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
//
2008-11-15 22:00:00 +01:00
void SCR_RegisterShaders( void );
2008-07-04 22:00:00 +02:00
void SCR_AdjustSize( float *x, float *y, float *w, float *h );
2008-11-09 22:00:00 +01:00
void SCR_DrawPic( float x, float y, float width, float height, shader_t shader );
2009-09-10 22:00:00 +02:00
void SCR_FillRect( float x, float y, float width, float height, const rgba_t color );
2008-07-04 22:00:00 +02:00
void SCR_DrawSmallChar( int x, int y, int ch );
void SCR_DrawChar( int x, int y, float w, float h, int ch );
2009-09-10 22:00:00 +02:00
void SCR_DrawSmallStringExt( int x, int y, const char *string, rgba_t setColor, bool forceColor );
void SCR_DrawStringExt( int x, int y, float w, float h, const char *string, rgba_t setColor, bool forceColor );
void SCR_DrawBigString( int x, int y, const char *s, byte alpha );
void SCR_DrawBigStringColor( int x, int y, const char *s, rgba_t color );
2009-09-23 22:00:00 +02:00
void SCR_MakeScreenShot( void );
2009-10-18 22:00:00 +02:00
void SCR_MakeLevelShot( 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 );
void SCR_DrawNet( 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 );
2007-11-06 22:00:00 +01:00
bool V_PreRender( void );
void V_PostRender( void );
2007-11-05 22:00:00 +01:00
void V_RenderView( void );
2008-06-28 22:00:00 +02:00
float V_CalcFov( float fov_x, float width, float height );
2007-06-21 22:00:00 +02:00
//
2008-12-25 22:00:00 +01:00
// cl_phys.c
2007-06-21 22:00:00 +02:00
//
void CL_InitPrediction (void);
void CL_PredictMove (void);
2009-01-11 22:00:00 +01:00
void CL_CheckPredictionError( void );
void CL_CheckVelocity( edict_t *ent );
2009-01-23 22:00:00 +01:00
bool CL_CheckWater( edict_t *ent );
2007-06-21 22:00:00 +02: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
//
void CL_GetEntitySoundSpatialization( int ent, vec3_t origin, vec3_t velocity );
void CL_AddLoopingSounds( void );
2007-06-21 22:00:00 +02:00
//
2009-11-03 22:00:00 +01:00
// cl_effects.c
2007-06-21 22:00:00 +02:00
//
2008-11-27 22:00:00 +01:00
void CL_AddParticles( void );
void CL_AddDecals( void );
2008-06-30 22:00:00 +02:00
void CL_ClearEffects( void );
2009-01-22 22:00:00 +01:00
void CL_TestLights( void );
void CL_TestEntities( void );
2009-11-23 22:00:00 +01:00
void CL_FindExplosionPlane( const vec3_t origin, float radius, vec3_t result );
2009-01-15 22:00:00 +01:00
bool pfnAddParticle( cparticle_t *src, HSPRITE shader, int flags );
void pfnAddDecal( float *org, float *dir, float *rgba, float rot, float rad, HSPRITE hSpr, int flags );
2009-09-17 22:00:00 +02:00
void pfnAddDLight( const float *org, const float *rgb, float radius, float time, int flags, int key );
2009-11-23 22:00:00 +01:00
void CL_ParticleEffect( const vec3_t org, const vec3_t dir, int color, int count ); // q1 legacy
void CL_SpawnStaticDecal( vec3_t origin, int decalIndex, int entityIndex, int modelIndex );
2009-12-02 22:00:00 +01:00
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
word CL_PrecacheEvent( const char *name );
void CL_ResetEvent( event_info_t *ei );
void CL_FireEvents( void );
2009-11-23 22:00:00 +01:00
2007-06-21 22:00:00 +02:00
//
// cl_pred.c
//
2007-11-04 22:00:00 +01:00
void CL_PredictMovement (void);
//
// cl_con.c
//
bool Con_Active( void );
void Con_CheckResize( void );
void Con_Init( void );
void Con_Clear_f( void );
void Con_ToggleConsole_f( void );
void Con_DrawNotify( void );
void Con_ClearNotify( void );
void Con_RunConsole( void );
void Con_DrawConsole( void );
void Con_PageUp( void );
void Con_PageDown( void );
void Con_Top( void );
void Con_Bottom( void );
void Con_Close( void );
2007-11-05 22:00:00 +01:00
extern bool chat_team;
extern bool anykeydown;
2007-11-04 22:00:00 +01:00
extern int g_console_field_width;
2007-11-05 22:00:00 +01:00
extern field_t historyEditLines[COMMAND_HISTORY];
extern field_t g_consoleField;
extern field_t chatField;
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
//
2009-10-16 22:00:00 +02:00
typedef enum { UI_CLOSEMENU, UI_MAINMENU } uiActiveMenu_t;
2008-06-28 22:00:00 +02:00
2009-09-20 22:00:00 +02:00
void UI_UpdateMenu( int realtime );
2008-06-28 22:00:00 +02:00
void UI_KeyEvent( int key );
2009-09-10 22:00:00 +02:00
void UI_MouseMove( int x, int y );
void UI_SetActiveMenu( uiActiveMenu_t activeMenu );
void UI_AddServerToList( netadr_t adr, const char *info );
2009-09-11 22:00:00 +02:00
bool UI_CreditsActive( void );
2009-09-10 22:00:00 +02:00
bool UI_IsVisible( void );
void UI_Precache( void );
void UI_Init( void );
2008-06-28 22:00:00 +02:00
void UI_Shutdown( void );
2007-11-05 22:00:00 +01:00
//
// cl_keys.c
//
void Field_Clear( field_t *edit );
void Field_CharEvent( field_t *edit, int ch );
void Field_KeyDownEvent( field_t *edit, int key );
void Field_Draw( field_t *edit, int x, int y, int width, bool showCursor );
void Field_BigDraw( field_t *edit, int x, int y, int width, bool showCursor );
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 );
bool SCR_PlayCinematic( const char *name );
bool 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
2009-11-26 22:00:00 +01:00
//
// cl_world.c
//
void CL_ClearWorld( void );
void CL_UnlinkEdict( edict_t *ent );
void CL_ClassifyEdict( edict_t *ent );
void CL_LinkEdict( edict_t *ent, bool touch_triggers );
int CL_AreaEdicts( const vec3_t mins, const vec3_t maxs, edict_t **list, int maxcount, int areatype );
trace_t CL_ClipMoveToEntity( edict_t *e, const vec3_t p0, vec3_t b0, vec3_t b1, const vec3_t p1, uint mask, int flags );
trace_t CL_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e );
edict_t *CL_TestPlayerPosition( const vec3_t origin, edict_t *pass, TraceResult *tr );
trace_t CL_MoveToss( edict_t *tossent, edict_t *ignore );
int CL_BaseContents( const vec3_t p, edict_t *e );
int CL_PointContents( const vec3_t p );
2007-11-04 22:00:00 +01:00
#endif//CLIENT_H