2010-02-15 23:26:55 +00:00
/*
Copyright ( C ) 1996 - 2001 Id Software , Inc .
Copyright ( C ) 2002 - 2009 John Fitzgibbons and others
2014-09-22 08:55:46 +00:00
Copyright ( C ) 2010 - 2014 QuakeSpasm developers
2010-02-15 23:26:55 +00:00
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 2
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 .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
# ifndef _CLIENT_H_
# define _CLIENT_H_
2010-02-15 23:26:55 +00:00
// client.h
typedef struct
{
int length ;
char map [ MAX_STYLESTRING ] ;
char average ; //johnfitz
char peak ; //johnfitz
} lightstyle_t ;
typedef struct
{
char name [ MAX_SCOREBOARDNAME ] ;
float entertime ;
int frags ;
2021-09-11 03:07:03 +00:00
plcolour_t shirt ;
plcolour_t pants ;
2017-09-17 02:12:53 +00:00
int ping ;
2020-09-02 08:43:25 +00:00
char userinfo [ 8192 ] ;
2010-02-15 23:26:55 +00:00
} scoreboard_t ;
typedef struct
{
int destcolor [ 3 ] ;
2018-05-13 07:07:15 +00:00
float percent ; // 0-256
2010-02-15 23:26:55 +00:00
} cshift_t ;
# define CSHIFT_CONTENTS 0
# define CSHIFT_DAMAGE 1
# define CSHIFT_BONUS 2
# define CSHIFT_POWERUP 3
# define NUM_CSHIFTS 4
# define NAME_LENGTH 64
//
// client_state_t should hold all pieces of the client state
//
# define SIGNONS 4 // signon messages to receive before connected
# define MAX_DLIGHTS 64 //johnfitz -- was 32
typedef struct
{
vec3_t origin ;
float radius ;
float die ; // stop lighting after this time
float decay ; // drop this each second
float minlight ; // don't add when contributing less
int key ;
vec3_t color ; //johnfitz -- lit support via lordhavoc
} dlight_t ;
# define MAX_BEAMS 32 //johnfitz -- was 24
typedef struct
{
int entity ;
2012-05-30 08:56:06 +00:00
struct qmodel_s * model ;
2010-02-15 23:26:55 +00:00
float endtime ;
vec3_t start , end ;
2017-09-17 02:12:53 +00:00
const char * trailname ;
struct trailstate_s * trailstate ;
2010-02-15 23:26:55 +00:00
} beam_t ;
# define MAX_MAPSTRING 2048
# define MAX_DEMOS 8
# define MAX_DEMONAME 16
typedef enum {
ca_dedicated , // a dedicated server with no ability to start a client
ca_disconnected , // full screen console with no connection
ca_connected // valid netcon, talking to a server
} cactive_t ;
//
// the client_static_t structure is persistant through an arbitrary number
// of server connections
//
typedef struct
{
cactive_t state ;
// personalization data sent to server
char spawnparms [ MAX_MAPSTRING ] ; // to restart a level
// demo loop control
2012-03-12 08:24:16 +00:00
int demonum ; // -1 = don't play demos
char demos [ MAX_DEMOS ] [ MAX_DEMONAME ] ; // when not playing
2010-02-15 23:26:55 +00:00
// demo recording info must be here, because record is started before
// entering a map (and clearing client_state_t)
qboolean demorecording ;
qboolean demoplayback ;
2014-12-08 19:30:36 +00:00
// did the user pause demo playback? (separate from cl.paused because we don't
// want a svc_setpause inside the demo to actually pause demo playback).
qboolean demopaused ;
2010-02-15 23:26:55 +00:00
qboolean timedemo ;
2012-03-12 08:24:16 +00:00
int forcetrack ; // -1 = use normal cd track
2010-02-15 23:26:55 +00:00
FILE * demofile ;
2012-03-12 08:24:16 +00:00
int td_lastframe ; // to meter out one message a frame
int td_startframe ; // host_framecount at start
2010-02-15 23:26:55 +00:00
float td_starttime ; // realtime at second frame of timedemo
// connection information
2012-03-12 08:24:16 +00:00
int signon ; // 0 to SIGNONS
2010-02-15 23:26:55 +00:00
struct qsocket_s * netcon ;
sizebuf_t message ; // writing buffer to send to server
2017-09-17 02:12:53 +00:00
//downloads don't restart/fail when the server sends random serverinfo packets
struct
{
qboolean active ;
unsigned int size ;
FILE * file ;
char current [ MAX_QPATH ] ; //also prevents us from repeatedly trying to download the same file
char temp [ MAX_OSPATH ] ; //the temp filename for the download, will be renamed to current
float starttime ;
} download ;
2020-07-02 19:05:51 +00:00
2020-09-02 08:43:25 +00:00
char userinfo [ 8192 ] ;
2020-07-02 19:05:51 +00:00
//Spike -- menuqc stuff.
qcvm_t menu_qcvm ;
2010-02-15 23:26:55 +00:00
} client_static_t ;
extern client_static_t cls ;
//
// the client_state_t structure is wiped completely at every
// server signon
//
typedef struct
{
int movemessages ; // since connecting to this server
// throw out the first couple, so the player
// doesn't accidentally do something the
// first frame
2020-09-04 11:18:05 +00:00
int ackedmovemessages ; // echo of movemessages from the server.
usercmd_t movecmds [ 64 ] ; // ringbuffer of previous movement commands (journal for prediction)
# define MOVECMDS_MASK (countof(cl.movecmds)-1)
2018-05-13 07:00:41 +00:00
usercmd_t pendingcmd ; // accumulated state from mice+joysticks.
2010-02-15 23:26:55 +00:00
// information for local display
int stats [ MAX_CL_STATS ] ; // health, etc
2017-09-17 02:12:53 +00:00
float statsf [ MAX_CL_STATS ] ;
2020-06-19 22:19:07 +00:00
char * statss [ MAX_CL_STATS ] ;
2010-02-15 23:26:55 +00:00
int items ; // inventory bit flags
float item_gettime [ 32 ] ; // cl.time of aquiring item, for blinking
float faceanimtime ; // use anim frame if cl.time < this
cshift_t cshifts [ NUM_CSHIFTS ] ; // color shifts for damage, powerups
cshift_t prev_cshifts [ NUM_CSHIFTS ] ; // and content types
// the client maintains its own idea of view angles, which are
// sent to the server each frame. The server sets punchangle when
// the view is temporarliy offset, and an angle reset commands at the start
// of each level and after teleporting.
vec3_t mviewangles [ 2 ] ; // during demo playback viewangles is lerped
// between these
vec3_t viewangles ;
vec3_t mvelocity [ 2 ] ; // update by server, used for lean+bob
// (0 is newest)
vec3_t velocity ; // lerped between mvelocity[0] and [1]
vec3_t punchangle ; // temporary offset
// pitch drifting vars
float pitchvel ;
qboolean nodrift ;
float driftmove ;
double laststop ;
float crouch ; // local amount for smoothing stepups
qboolean paused ; // send over by server
qboolean onground ;
qboolean inwater ;
int intermission ; // don't change view angle, full screen, etc
int completed_time ; // latched at intermission start
double mtime [ 2 ] ; // the timestamp of last two messages
double time ; // clients view of time, should be between
// servertime and oldservertime to generate
// a lerp point for other data
double oldtime ; // previous cl.time, time-oldtime is used
// to decay light values and smooth step ups
float last_received_message ; // (realtime) for net trouble icon
//
// information that is static for the entire time connected to a server
//
2012-05-30 08:56:06 +00:00
struct qmodel_s * model_precache [ MAX_MODELS ] ;
2020-09-03 10:39:38 +00:00
struct qmodel_s * model_precache_csqc [ MAX_MODELS ] ;
2010-02-15 23:26:55 +00:00
struct sfx_s * sound_precache [ MAX_SOUNDS ] ;
2010-02-16 09:47:04 +00:00
char mapname [ 128 ] ;
2010-02-15 23:26:55 +00:00
char levelname [ 128 ] ; // for display on solo scoreboard //johnfitz -- was 40.
int viewentity ; // cl_entitites[cl.viewentity] = player
int maxclients ;
int gametype ;
// refresh related state
2012-05-30 08:56:06 +00:00
struct qmodel_s * worldmodel ; // cl_entitites[0].model
2010-02-15 23:26:55 +00:00
struct efrag_s * free_efrags ;
2017-04-02 19:39:18 +00:00
int num_efrags ;
2017-09-17 02:12:53 +00:00
// int num_entities; // held in cl_entities array
// int num_statics; // held in cl_staticentities array
2010-02-15 23:26:55 +00:00
entity_t viewent ; // the gun model
2017-09-17 02:12:53 +00:00
entity_t * entities ; //spike -- moved into here
int max_edicts ;
int num_entities ;
entity_t * * static_entities ; //spike -- was static
int max_static_entities ;
int num_statics ;
2010-02-15 23:26:55 +00:00
int cdtrack , looptrack ; // cd audio
// frag scoreboard
scoreboard_t * scores ; // [cl.maxclients]
unsigned protocol ; //johnfitz
2016-06-24 06:15:41 +00:00
unsigned protocolflags ;
2020-09-03 08:37:49 +00:00
unsigned protocol_pext1 ; //spike -- flag of fte protocol extensions
2017-09-17 02:12:53 +00:00
unsigned protocol_pext2 ; //spike -- flag of fte protocol extensions
qboolean protocol_dpdownload ;
# ifdef PSET_SCRIPT
qboolean protocol_particles ;
struct
{
const char * name ;
int index ;
} particle_precache [ MAX_PARTICLETYPES ] ;
2018-05-01 00:35:14 +00:00
struct
{
const char * name ;
int index ;
} local_particle_precache [ MAX_PARTICLETYPES ] ;
2017-09-17 02:12:53 +00:00
# endif
int ackframes [ 8 ] ; //big enough to cover burst
unsigned int ackframes_count ;
qboolean requestresend ;
char stuffcmdbuf [ 1024 ] ; //comment-extensions are a thing with certain servers, make sure we can handle them properly without further hacks/breakages. there's also some server->client only console commands that we might as well try to handle a bit better, like reconnect
2020-09-04 10:53:42 +00:00
char printbuffer [ 1024 ] ;
2017-09-17 02:12:53 +00:00
enum
{
PRINT_NONE ,
PRINT_PINGS ,
// PRINT_STATUSINFO,
// PRINT_STATUSPLAYER,
// PRINT_STATUSIP,
} printtype ;
int printplayer ;
float expectingpingtimes ;
float printversionresponse ;
//spike -- moved this stuff here to deal with downloading content named by the server
qboolean sendprespawn ; //download+load content, send the prespawn command once done
int model_count ;
int model_download ;
char model_name [ MAX_MODELS ] [ MAX_QPATH ] ;
2020-09-03 10:39:38 +00:00
char model_name_csqc [ MAX_MODELS ] [ MAX_QPATH ] ; //negative indexes in the csqc are csqc ones.
2017-09-17 02:12:53 +00:00
int sound_count ;
int sound_download ;
char sound_name [ MAX_SOUNDS ] [ MAX_QPATH ] ;
//spike -- end downloads
2018-05-01 00:35:14 +00:00
qcvm_t qcvm ; //for csqc.
float csqc_sensitivity ; //scaler for sensitivity
2020-09-04 10:53:42 +00:00
size_t ssqc_to_csqc_max ;
edict_t * * ssqc_to_csqc ; //to find the csqc ent for an ssqc index.
2020-09-02 08:43:25 +00:00
2020-09-04 11:07:05 +00:00
qboolean listener_defined ;
vec3_t listener_origin ;
vec3_t listener_axis [ 3 ] ;
2020-09-02 08:43:25 +00:00
char serverinfo [ 8192 ] ; // \key\value infostring data.
2010-02-15 23:26:55 +00:00
} client_state_t ;
//
// cvars
//
extern cvar_t cl_name ;
2020-09-02 08:43:25 +00:00
extern cvar_t cl_topcolor , cl_bottomcolor ;
2010-02-15 23:26:55 +00:00
extern cvar_t cl_upspeed ;
extern cvar_t cl_forwardspeed ;
extern cvar_t cl_backspeed ;
extern cvar_t cl_sidespeed ;
extern cvar_t cl_movespeedkey ;
extern cvar_t cl_yawspeed ;
extern cvar_t cl_pitchspeed ;
extern cvar_t cl_anglespeedkey ;
2017-08-23 06:00:20 +00:00
extern cvar_t cl_alwaysrun ; // QuakeSpasm
2010-02-15 23:26:55 +00:00
extern cvar_t cl_autofire ;
2017-09-17 02:12:53 +00:00
extern cvar_t cl_recordingdemo ;
2010-02-15 23:26:55 +00:00
extern cvar_t cl_shownet ;
extern cvar_t cl_nolerp ;
2021-09-09 01:50:35 +00:00
extern cvar_t cl_demoreel ;
2010-02-15 23:26:55 +00:00
2012-10-12 07:33:11 +00:00
extern cvar_t cfg_unbindall ;
2010-02-15 23:26:55 +00:00
extern cvar_t cl_pitchdriftspeed ;
extern cvar_t lookspring ;
extern cvar_t lookstrafe ;
extern cvar_t sensitivity ;
extern cvar_t m_pitch ;
extern cvar_t m_yaw ;
extern cvar_t m_forward ;
extern cvar_t m_side ;
2017-09-17 02:12:53 +00:00
# define MAX_TEMP_ENTITIES 256 //johnfitz -- was 64
2010-02-15 23:26:55 +00:00
extern client_state_t cl ;
// FIXME, allocate dynamically
extern lightstyle_t cl_lightstyle [ MAX_LIGHTSTYLES ] ;
extern dlight_t cl_dlights [ MAX_DLIGHTS ] ;
extern entity_t cl_temp_entities [ MAX_TEMP_ENTITIES ] ;
extern beam_t cl_beams [ MAX_BEAMS ] ;
2017-09-17 02:12:53 +00:00
extern entity_t * * cl_visedicts ;
2010-02-15 23:26:55 +00:00
extern int cl_numvisedicts ;
2017-09-17 02:12:53 +00:00
extern int cl_maxvisedicts ; //extended if we exceeded it the previous frame
2010-02-15 23:26:55 +00:00
//=============================================================================
//
// cl_main
//
dlight_t * CL_AllocDlight ( int key ) ;
void CL_DecayLights ( void ) ;
void CL_Init ( void ) ;
2010-08-29 12:04:19 +00:00
void CL_EstablishConnection ( const char * host ) ;
2010-02-15 23:26:55 +00:00
void CL_Signon1 ( void ) ;
void CL_Signon2 ( void ) ;
void CL_Signon3 ( void ) ;
void CL_Signon4 ( void ) ;
void CL_Disconnect ( void ) ;
void CL_Disconnect_f ( void ) ;
void CL_NextDemo ( void ) ;
2020-09-02 08:43:25 +00:00
void SV_UpdateInfo ( int edict , const char * keyname , const char * value ) ;
2010-02-15 23:26:55 +00:00
//
// cl_input
//
typedef struct
{
int down [ 2 ] ; // key nums holding it down
int state ; // low bit is down state
} kbutton_t ;
extern kbutton_t in_mlook , in_klook ;
extern kbutton_t in_strafe ;
extern kbutton_t in_speed ;
void CL_InitInput ( void ) ;
2018-05-13 07:00:41 +00:00
void CL_AccumulateCmd ( void ) ;
2010-02-15 23:26:55 +00:00
void CL_SendCmd ( void ) ;
2011-12-12 14:11:17 +00:00
void CL_SendMove ( const usercmd_t * cmd ) ;
int CL_ReadFromServer ( void ) ;
2018-05-13 07:00:41 +00:00
void CL_AdjustAngles ( void ) ;
2011-12-12 14:11:17 +00:00
void CL_BaseMove ( usercmd_t * cmd ) ;
2020-09-04 11:18:05 +00:00
void CL_FinishMove ( usercmd_t * cmd ) ;
2010-02-15 23:26:55 +00:00
2017-09-17 02:12:53 +00:00
void CL_Download_Data ( void ) ;
qboolean CL_CheckDownloads ( void ) ;
void CL_ParseEffect ( qboolean big ) ;
2020-09-04 11:27:00 +00:00
void CL_UpdateBeam ( struct qmodel_s * m , const char * trailname , const char * impactname , int ent , float * start , float * end ) ;
2010-02-15 23:26:55 +00:00
void CL_ParseTEnt ( void ) ;
void CL_UpdateTEnts ( void ) ;
2020-06-19 22:19:07 +00:00
void CL_FreeState ( void ) ;
2010-02-15 23:26:55 +00:00
void CL_ClearState ( void ) ;
2017-09-17 02:12:53 +00:00
void CL_ClearTrailStates ( void ) ;
2010-02-15 23:26:55 +00:00
//
// cl_demo.c
//
void CL_StopPlayback ( void ) ;
int CL_GetMessage ( void ) ;
void CL_Stop_f ( void ) ;
void CL_Record_f ( void ) ;
void CL_PlayDemo_f ( void ) ;
void CL_TimeDemo_f ( void ) ;
//
// cl_parse.c
//
void CL_ParseServerMessage ( void ) ;
2017-09-17 02:12:53 +00:00
void CL_RegisterParticles ( void ) ;
//void CL_NewTranslation (int slot);
2010-02-15 23:26:55 +00:00
//
// view
//
void V_StartPitchDrift ( void ) ;
void V_StopPitchDrift ( void ) ;
void V_RenderView ( void ) ;
//void V_UpdatePalette (void); //johnfitz
void V_Register ( void ) ;
void V_ParseDamage ( void ) ;
void V_SetContentsColor ( int contents ) ;
//
// cl_tent
//
void CL_InitTEnts ( void ) ;
void CL_SignonReply ( void ) ;
2017-09-17 02:12:53 +00:00
float CL_TraceLine ( vec3_t start , vec3_t end , vec3_t impact , vec3_t normal , int * ent ) ;
chase.c, cl_input.c, cl_parse.c, client.h, common.c, common.h, console.h,
cvar.h, draw.h, gl_draw.c, gl_fog.c, gl_mesh.c, gl_model.c, gl_model.h,
gl_rmain.c, gl_rmisc.c, gl_screen.c, gl_sky.c, gl_texmgr.c, glquake.h,
host.c, keys.c, keys.h, main.c, menu.c, menu.h, pr_cmds.c, quakedef.h,
r_alias.c, r_brush.c, r_part.c, r_sprite.c, r_world.c, sbar.c, sbar.h,
screen.h, snd_dma.c, snd_mem.c, snd_mix.c, sv_main.c, sys_sdl.c, vid.h,
view.h, world.c, world.h: Loads of warning fixes about missing function
prototypes, missing parens around &, missing braces leading to ambiguous
else statements and unused and uninitialized variables. There are still a
couple of unitialised variables here and there, but not much. The warnings
about strict aliasing violations need taking care of.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@21 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 12:01:07 +00:00
2011-12-18 10:03:53 +00:00
//
// chase
//
extern cvar_t chase_active ;
void Chase_Init ( void ) ;
void TraceLine ( vec3_t start , vec3_t end , vec3_t impact ) ;
void Chase_UpdateForClient ( void ) ; //johnfitz
void Chase_UpdateForDrawing ( void ) ; //johnfitz
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
# endif /* _CLIENT_H_ */