2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 // intended velocities
38 char map
[MAX_STYLESTRING
];
43 char name
[MAX_SCOREBOARDNAME
];
46 int colors
; // two 4 bit fields
47 byte translations
[VID_GRADES
*256];
56 #define CSHIFT_CONTENTS 0
57 #define CSHIFT_DAMAGE 1
58 #define CSHIFT_BONUS 2
59 #define CSHIFT_POWERUP 3
62 #define NAME_LENGTH 64
66 // client_state_t should hold all pieces of the client state
69 #define SIGNONS 4 // signon messages to receive before connected
71 #define MAX_DLIGHTS 32
76 float die
; // stop lighting after this time
77 float decay
; // drop this each second
78 float minlight
; // don't add when contributing less
80 vec3_t color
; // LordHavoc: .lit support
82 qboolean dark
; // subtracts light instead of adding
91 struct model_s
*model
;
96 #define MAX_EFRAGS 640
98 #define MAX_MAPSTRING 2048
100 #define MAX_DEMONAME 16
103 ca_dedicated
, // a dedicated server with no ability to start a client
104 ca_disconnected
, // full screen console with no connection
105 ca_connected
// valid netcon, talking to a server
109 // the client_static_t structure is persistant through an arbitrary number
110 // of server connections
116 // personalization data sent to server
117 char mapstring
[MAX_QPATH
];
118 char spawnparms
[MAX_MAPSTRING
]; // to restart a level
121 int demonum
; // -1 = don't play demos
122 char demos
[MAX_DEMOS
][MAX_DEMONAME
]; // when not playing
124 // demo recording info must be here, because record is started before
125 // entering a map (and clearing client_state_t)
126 qboolean demorecording
;
127 qboolean demoplayback
;
129 int forcetrack
; // -1 = use normal cd track
131 int td_lastframe
; // to meter out one message a frame
132 int td_startframe
; // host_framecount at start
133 float td_starttime
; // realtime at second frame of timedemo
136 // connection information
137 int signon
; // 0 to SIGNONS
138 struct qsocket_s
*netcon
;
139 sizebuf_t message
; // writing buffer to send to server
143 extern client_static_t cls
;
146 // the client_state_t structure is wiped completely at every
151 int movemessages
; // since connecting to this server
152 // throw out the first couple, so the player
153 // doesn't accidentally do something the
155 usercmd_t cmd
; // last command sent to the server
157 // information for local display
158 int stats
[MAX_CL_STATS
]; // health, etc
159 int items
; // inventory bit flags
160 float item_gettime
[32]; // cl.time of aquiring item, for blinking
161 float faceanimtime
; // use anim frame if cl.time < this
163 cshift_t cshifts
[NUM_CSHIFTS
]; // color shifts for damage, powerups
164 cshift_t prev_cshifts
[NUM_CSHIFTS
]; // and content types
166 // the client maintains its own idea of view angles, which are
167 // sent to the server each frame. The server sets punchangle when
168 // the view is temporarliy offset, and an angle reset commands at the start
169 // of each level and after teleporting.
170 vec3_t mviewangles
[2]; // during demo playback viewangles is lerped
174 vec3_t mvelocity
[2]; // update by server, used for lean+bob
176 vec3_t velocity
; // lerped between mvelocity[0] and [1]
178 vec3_t punchangle
; // temporary offset
180 // pitch drifting vars
188 float crouch
; // local amount for smoothing stepups
190 qboolean paused
; // send over by server
194 int intermission
; // don't change view angle, full screen, etc
195 int completed_time
; // latched at intermission start
197 double mtime
[2]; // the timestamp of last two messages
198 double time
; // clients view of time, should be between
199 // servertime and oldservertime to generate
200 // a lerp point for other data
201 double oldtime
; // previous cl.time, time-oldtime is used
202 // to decay light values and smooth step ups
205 float last_received_message
; // (realtime) for net trouble icon
208 // information that is static for the entire time connected to a server
210 struct model_s
*model_precache
[MAX_MODELS
];
211 struct sfx_s
*sound_precache
[MAX_SOUNDS
];
213 char levelname
[40]; // for display on solo scoreboard
214 int viewentity
; // cl_entitites[cl.viewentity] = player
218 // refresh related state
219 struct model_s
*worldmodel
; // cl_entitites[0].model
220 struct efrag_s
*free_efrags
;
221 int num_entities
; // held in cl_entities array
222 int num_statics
; // held in cl_staticentities array
223 entity_t viewent
; // the gun model
225 int cdtrack
, looptrack
; // cd audio
228 scoreboard_t
*scores
; // [cl.maxclients]
231 // light level at player's position including dlights
232 // this is sent back to the server each frame
233 // architectually ugly but it works
242 extern cvar_t cl_name
;
243 extern cvar_t cl_color
;
245 extern cvar_t max_fps
;
247 extern cvar_t cl_upspeed
;
248 extern cvar_t cl_forwardspeed
;
249 extern cvar_t cl_backspeed
;
250 extern cvar_t cl_sidespeed
;
252 extern cvar_t cl_movespeedkey
;
254 extern cvar_t cl_yawspeed
;
255 extern cvar_t cl_pitchspeed
;
257 extern cvar_t cl_anglespeedkey
;
259 extern cvar_t cl_autofire
;
261 extern cvar_t cl_shownet
;
262 extern cvar_t cl_nolerp
;
264 extern cvar_t cl_pitchdriftspeed
;
265 extern cvar_t lookspring
;
266 extern cvar_t lookstrafe
;
267 extern cvar_t lookcenter
;
268 extern cvar_t in_sensitivity
;
269 extern cvar_t in_tolerance
;
270 extern cvar_t in_acceleration
;
272 extern cvar_t cl_autoaim
;
274 extern cvar_t m_pitch
;
276 extern cvar_t m_forward
;
277 extern cvar_t m_side
;
279 //#define MAX_TEMP_ENTITIES 128 // lightning bolts, etc
280 //#define MAX_STATIC_ENTITIES 128 // torches, etc
281 #define MAX_TEMP_ENTITIES 256 // lightning bolts, etc
282 #define MAX_STATIC_ENTITIES 256 // torches, etc
284 extern client_state_t cl
;
286 // FIXME, allocate dynamically
287 extern efrag_t cl_efrags
[MAX_EFRAGS
];
288 extern entity_t cl_entities
[MAX_EDICTS
];
289 extern entity_t cl_static_entities
[MAX_STATIC_ENTITIES
];
290 extern lightstyle_t cl_lightstyle
[MAX_LIGHTSTYLES
];
291 extern dlight_t cl_dlights
[MAX_DLIGHTS
];
292 extern entity_t cl_temp_entities
[MAX_TEMP_ENTITIES
];
293 extern beam_t cl_beams
[MAX_BEAMS
];
295 //=============================================================================
300 dlight_t
*CL_AllocDlight (int key
);
301 void CL_DecayLights (void);
305 void CL_EstablishConnection (char *host
);
306 void CL_Signon1 (void);
307 void CL_Signon2 (void);
308 void CL_Signon3 (void);
309 void CL_Signon4 (void);
311 void CL_Disconnect (void);
312 void CL_Disconnect_f (void);
313 void CL_NextDemo (void);
315 //#define MAX_VISEDICTS 256
316 #define MAX_VISEDICTS 512
317 extern int cl_numvisedicts
;
318 extern entity_t
*cl_visedicts
[MAX_VISEDICTS
];
321 typedef enum modelindex_s
{
322 mi_player
, mi_eyes
, mi_rocket
, mi_grenade
, mi_flame0
, mi_flame1
, mi_flame2
,
323 mi_explo1
, mi_explo2
, mi_bubble
,
324 mi_fish
, mi_dog
, mi_soldier
, mi_enforcer
, mi_knight
, mi_hknight
,
325 mi_scrag
, mi_ogre
, mi_fiend
, mi_vore
, mi_shambler
,
326 mi_h_dog
, mi_h_soldier
, mi_h_enforcer
, mi_h_knight
, mi_h_hknight
, mi_h_scrag
,
327 mi_h_ogre
, mi_h_fiend
, mi_h_vore
, mi_h_shambler
, mi_h_zombie
, mi_h_player
,
328 mi_gib1
, mi_gib2
, mi_gib3
, NUM_MODELINDEX
331 extern modelindex_t cl_modelindex
[NUM_MODELINDEX
];
332 extern char *cl_modelnames
[NUM_MODELINDEX
];
339 int down
[2]; // key nums holding it down
340 int state
; // low bit is down state
343 extern kbutton_t in_mlook
, in_klook
;
344 extern kbutton_t in_strafe
;
345 extern kbutton_t in_speed
;
347 void CL_InitInput (void);
348 void CL_SendCmd (void);
349 void CL_SendMove (usercmd_t
*cmd
);
351 void CL_ParseTEnt (void);
352 void CL_UpdateTEnts (void);
354 void CL_ClearState (void);
357 int CL_ReadFromServer (void);
358 void CL_WriteToServer (usercmd_t
*cmd
);
359 void CL_BaseMove (usercmd_t
*cmd
);
362 float CL_KeyState (kbutton_t
*key
);
363 char *Key_KeynumToString (int keynum
);
368 void CL_StopPlayback (void);
369 int CL_GetMessage (void);
371 void CL_Stop_f (void);
372 void CL_Record_f (void);
373 void CL_PlayDemo_f (void);
374 void CL_TimeDemo_f (void);
379 void CL_ParseServerMessage (void);
380 void CL_NewTranslation (int slot
);
385 void V_StartPitchDrift (void);
386 void V_StopPitchDrift (void);
388 void V_RenderView (void);
389 void V_UpdatePalette (void);
390 void V_Register (void);
391 void V_ParseDamage (void);
392 void V_SetContentsColor (int contents
);
398 void CL_InitTEnts (void);
399 void CL_SignonReply (void);