2000-05-10 20:33:16 +00:00
|
|
|
/*
|
2000-05-11 16:03:29 +00:00
|
|
|
cl_parse.c
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-22 06:46:35 +00:00
|
|
|
parse a message received from the server
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-11 16:03:29 +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.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
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.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
2000-05-10 20:33:16 +00:00
|
|
|
*/
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-17 10:03:19 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-12-08 06:51:37 +00:00
|
|
|
# include "config.h"
|
2000-05-17 10:03:19 +00:00
|
|
|
#endif
|
2000-12-05 06:33:44 +00:00
|
|
|
|
2000-12-30 03:23:31 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ERRNO_H
|
|
|
|
#include <errno.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "bothdefs.h"
|
|
|
|
#include "cdaudio.h"
|
|
|
|
#include "cl_ents.h"
|
|
|
|
#include "cl_input.h"
|
|
|
|
#include "cl_main.h"
|
|
|
|
#include "cl_parse.h"
|
|
|
|
#include "cl_tent.h"
|
2000-05-21 08:24:45 +00:00
|
|
|
#include "client.h"
|
|
|
|
#include "cmd.h"
|
|
|
|
#include "console.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "host.h"
|
2000-05-21 08:24:45 +00:00
|
|
|
#include "msg.h"
|
|
|
|
#include "pmove.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "protocol.h"
|
|
|
|
#include "screen.h"
|
2000-05-21 08:24:45 +00:00
|
|
|
#include "sbar.h"
|
2000-10-29 15:35:24 +00:00
|
|
|
#include "skin.h"
|
2000-12-30 05:18:48 +00:00
|
|
|
#include "sound.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "teamplay.h"
|
|
|
|
#include "va.h"
|
2000-10-29 15:35:24 +00:00
|
|
|
#include "view.h"
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
extern cvar_t *gl_flashblend;
|
|
|
|
extern cvar_t *cl_autoexec;
|
2000-05-13 00:27:23 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
char *svc_strings[] = {
|
2000-05-10 11:29:38 +00:00
|
|
|
"svc_bad",
|
|
|
|
"svc_nop",
|
|
|
|
"svc_disconnect",
|
|
|
|
"svc_updatestat",
|
2000-12-08 06:51:37 +00:00
|
|
|
"svc_version", // [long] server version
|
|
|
|
"svc_setview", // [short] entity number
|
|
|
|
"svc_sound", // <see code>
|
|
|
|
"svc_time", // [float] server time
|
|
|
|
"svc_print", // [string] null terminated string
|
|
|
|
"svc_stufftext", // [string] stuffed into client's
|
|
|
|
// console buffer
|
|
|
|
// the string should be \n terminated
|
|
|
|
"svc_setangle", // [vec3] set the view angle to this
|
|
|
|
// absolute value
|
|
|
|
|
|
|
|
"svc_serverdata", // [long] version ...
|
|
|
|
"svc_lightstyle", // [byte] [string]
|
|
|
|
"svc_updatename", // [byte] [string]
|
|
|
|
"svc_updatefrags", // [byte] [short]
|
|
|
|
"svc_clientdata", // <shortbits + data>
|
|
|
|
"svc_stopsound", // <see code>
|
|
|
|
"svc_updatecolors", // [byte] [byte]
|
|
|
|
"svc_particle", // [vec3] <variable>
|
|
|
|
"svc_damage", // [byte] impact [byte] blood [vec3]
|
|
|
|
// from
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
"svc_spawnstatic",
|
|
|
|
"OBSOLETE svc_spawnbinary",
|
|
|
|
"svc_spawnbaseline",
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
"svc_temp_entity", // <variable>
|
2000-05-10 11:29:38 +00:00
|
|
|
"svc_setpause",
|
|
|
|
"svc_signonnum",
|
|
|
|
"svc_centerprint",
|
|
|
|
"svc_killedmonster",
|
|
|
|
"svc_foundsecret",
|
|
|
|
"svc_spawnstaticsound",
|
|
|
|
"svc_intermission",
|
|
|
|
"svc_finale",
|
|
|
|
|
|
|
|
"svc_cdtrack",
|
|
|
|
"svc_sellscreen",
|
|
|
|
|
|
|
|
"svc_smallkick",
|
|
|
|
"svc_bigkick",
|
|
|
|
|
|
|
|
"svc_updateping",
|
|
|
|
"svc_updateentertime",
|
|
|
|
|
|
|
|
"svc_updatestatlong",
|
|
|
|
"svc_muzzleflash",
|
|
|
|
"svc_updateuserinfo",
|
|
|
|
"svc_download",
|
|
|
|
"svc_playerinfo",
|
|
|
|
"svc_nails",
|
|
|
|
"svc_choke",
|
|
|
|
"svc_modellist",
|
|
|
|
"svc_soundlist",
|
|
|
|
"svc_packetentities",
|
2000-12-08 06:51:37 +00:00
|
|
|
"svc_deltapacketentities",
|
2000-05-10 11:29:38 +00:00
|
|
|
"svc_maxspeed",
|
|
|
|
"svc_entgravity",
|
|
|
|
|
|
|
|
"svc_setinfo",
|
|
|
|
"svc_serverinfo",
|
|
|
|
"svc_updatepl",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL",
|
|
|
|
"NEW PROTOCOL"
|
|
|
|
};
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
int oldparsecountmod;
|
|
|
|
int parsecountmod;
|
|
|
|
double parsecounttime;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
int cl_spikeindex, cl_playerindex, cl_flagindex;
|
|
|
|
int cl_h_playerindex, cl_gib1index, cl_gib2index, cl_gib3index;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
int packet_latency[NET_TIMINGS];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
int
|
|
|
|
CL_CalcNet (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int a, i;
|
|
|
|
frame_t *frame;
|
|
|
|
int lost;
|
|
|
|
|
|
|
|
for (i = cls.netchan.outgoing_sequence - UPDATE_BACKUP + 1;
|
|
|
|
i <= cls.netchan.outgoing_sequence; i++) {
|
|
|
|
frame = &cl.frames[i & UPDATE_MASK];
|
2000-05-10 11:29:38 +00:00
|
|
|
if (frame->receivedtime == -1)
|
2000-12-08 06:51:37 +00:00
|
|
|
packet_latency[i & NET_TIMINGSMASK] = 9999; // dropped
|
2000-05-10 11:29:38 +00:00
|
|
|
else if (frame->receivedtime == -2)
|
2000-12-08 06:51:37 +00:00
|
|
|
packet_latency[i & NET_TIMINGSMASK] = 10000; // choked
|
2000-05-10 11:29:38 +00:00
|
|
|
else if (frame->invalid)
|
2000-12-08 06:51:37 +00:00
|
|
|
packet_latency[i & NET_TIMINGSMASK] = 9998; // invalid delta
|
2000-05-10 11:29:38 +00:00
|
|
|
else
|
2000-12-08 06:51:37 +00:00
|
|
|
packet_latency[i & NET_TIMINGSMASK] =
|
|
|
|
(frame->receivedtime - frame->senttime) * 20;
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
lost = 0;
|
2000-12-08 06:51:37 +00:00
|
|
|
for (a = 0; a < NET_TIMINGS; a++) {
|
|
|
|
i = (cls.netchan.outgoing_sequence - a) & NET_TIMINGSMASK;
|
2000-05-10 11:29:38 +00:00
|
|
|
if (packet_latency[i] == 9999)
|
|
|
|
lost++;
|
|
|
|
}
|
|
|
|
return lost * 100 / NET_TIMINGS;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
CL_CheckOrDownloadFile
|
|
|
|
|
|
|
|
Returns true if the file exists, otherwise it attempts
|
|
|
|
to start a download from the server.
|
|
|
|
===============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
qboolean
|
|
|
|
CL_CheckOrDownloadFile (char *filename)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
QFile *f;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-03 01:57:29 +00:00
|
|
|
if (strstr (filename, "..")) {
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("Refusing to download a path with ..\n");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-12-03 01:57:29 +00:00
|
|
|
if (!snd_initialized && strnequal ("sound/", filename, 6)) {
|
|
|
|
// don't bother downloading sownds if we can't play them
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
COM_FOpenFile (filename, &f);
|
2000-12-08 06:51:37 +00:00
|
|
|
if (f) { // it exists, no need to download
|
2000-09-27 19:44:26 +00:00
|
|
|
Qclose (f);
|
2000-05-10 11:29:38 +00:00
|
|
|
return true;
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
// ZOID - can't download when recording
|
2000-05-10 11:29:38 +00:00
|
|
|
if (cls.demorecording) {
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_Printf ("Unable to download %s in record mode.\n",
|
|
|
|
cls.downloadname);
|
2000-05-10 11:29:38 +00:00
|
|
|
return true;
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
// ZOID - can't download when playback
|
2000-05-10 11:29:38 +00:00
|
|
|
if (cls.demoplayback)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
strcpy (cls.downloadname, filename);
|
|
|
|
Con_Printf ("Downloading %s...\n", cls.downloadname);
|
|
|
|
|
|
|
|
// download to a temp name, and only rename
|
|
|
|
// to the real name when done, so if interrupted
|
|
|
|
// a runt file wont be left
|
|
|
|
COM_StripExtension (cls.downloadname, cls.downloadtempname);
|
2000-12-08 06:51:37 +00:00
|
|
|
strncat (cls.downloadtempname, ".tmp",
|
2000-12-05 16:04:12 +00:00
|
|
|
sizeof (cls.downloadtempname) - strlen (cls.downloadtempname));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2000-12-08 06:51:37 +00:00
|
|
|
MSG_WriteString (&cls.netchan.message,
|
|
|
|
va ("download %s", cls.downloadname));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
cls.downloadnumber++;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
Model_NextDownload
|
|
|
|
=================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
Model_NextDownload (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
char *s;
|
|
|
|
int i;
|
|
|
|
extern char gamedirfile[];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (cls.downloadnumber == 0) {
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("Checking models...\n");
|
|
|
|
cls.downloadnumber = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
cls.downloadtype = dl_model;
|
2001-01-06 08:03:14 +00:00
|
|
|
for (; cl.model_name[cls.downloadnumber][0]; cls.downloadnumber++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
s = cl.model_name[cls.downloadnumber];
|
|
|
|
if (s[0] == '*')
|
2000-12-08 06:51:37 +00:00
|
|
|
continue; // inline brush model
|
|
|
|
if (!CL_CheckOrDownloadFile (s))
|
|
|
|
return; // started a download
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
for (i = 1; i < MAX_MODELS; i++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
if (!cl.model_name[i][0])
|
|
|
|
break;
|
|
|
|
|
|
|
|
cl.model_precache[i] = Mod_ForName (cl.model_name[i], false);
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (!cl.model_precache[i]) {
|
2001-01-06 08:03:14 +00:00
|
|
|
Con_Printf ("\nThe required model file '%s' could not be found or downloaded.\n\n", cl.model_name[i]);
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("You may need to download or purchase a %s client "
|
2000-12-08 06:51:37 +00:00
|
|
|
"pack in order to play on this server.\n\n",
|
|
|
|
gamedirfile);
|
2000-05-10 11:29:38 +00:00
|
|
|
CL_Disconnect ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-06 08:03:14 +00:00
|
|
|
// Something went wrong (probably in the server, probably a TF server)
|
|
|
|
// We need to disconnect gracefully.
|
|
|
|
if (!cl.model_precache[1]) {
|
|
|
|
Con_Printf ("\nThe server has failed to provide the map name.\n\n");
|
|
|
|
Con_Printf ("Disconnecting to prevent a crash.\n\n");
|
|
|
|
CL_Disconnect ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
// all done
|
2000-12-08 06:51:37 +00:00
|
|
|
cl.worldmodel = cl.model_precache[1];
|
2000-05-10 11:29:38 +00:00
|
|
|
R_NewMap ();
|
2000-10-06 16:30:37 +00:00
|
|
|
Team_NewMap ();
|
2000-12-08 06:51:37 +00:00
|
|
|
Hunk_Check (); // make sure nothing is hurt
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// done with modellist, request first of static signon messages
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2000-12-08 06:51:37 +00:00
|
|
|
// MSG_WriteString (&cls.netchan.message, va("prespawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2));
|
|
|
|
MSG_WriteString (&cls.netchan.message,
|
|
|
|
va (prespawn_name, cl.servercount,
|
|
|
|
cl.worldmodel->checksum2));
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
Sound_NextDownload
|
|
|
|
=================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
Sound_NextDownload (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
char *s;
|
|
|
|
int i;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (cls.downloadnumber == 0) {
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("Checking sounds...\n");
|
|
|
|
cls.downloadnumber = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
cls.downloadtype = dl_sound;
|
2000-12-08 06:51:37 +00:00
|
|
|
for (; cl.sound_name[cls.downloadnumber][0];
|
|
|
|
cls.downloadnumber++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
s = cl.sound_name[cls.downloadnumber];
|
2000-12-08 06:51:37 +00:00
|
|
|
if (!CL_CheckOrDownloadFile (va ("sound/%s", s)))
|
|
|
|
return; // started a download
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
for (i = 1; i < MAX_SOUNDS; i++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
if (!cl.sound_name[i][0])
|
|
|
|
break;
|
|
|
|
cl.sound_precache[i] = S_PrecacheSound (cl.sound_name[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// done with sounds, request models now
|
2000-12-08 06:51:37 +00:00
|
|
|
memset (cl.model_precache, 0, sizeof (cl.model_precache));
|
2000-05-10 11:29:38 +00:00
|
|
|
cl_playerindex = -1;
|
|
|
|
cl_spikeindex = -1;
|
|
|
|
cl_flagindex = -1;
|
2000-08-02 23:00:39 +00:00
|
|
|
cl_h_playerindex = -1;
|
|
|
|
cl_gib1index = cl_gib2index = cl_gib3index = -1;
|
2000-05-10 11:29:38 +00:00
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2000-12-08 06:51:37 +00:00
|
|
|
// MSG_WriteString (&cls.netchan.message, va("modellist %i 0", cl.servercount));
|
|
|
|
MSG_WriteString (&cls.netchan.message,
|
|
|
|
va (modellist_name, cl.servercount, 0));
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
======================
|
|
|
|
CL_RequestNextDownload
|
|
|
|
======================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_RequestNextDownload (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
switch (cls.downloadtype) {
|
|
|
|
case dl_single:
|
|
|
|
break;
|
|
|
|
case dl_skin:
|
|
|
|
Skin_NextDownload ();
|
|
|
|
break;
|
|
|
|
case dl_model:
|
|
|
|
Model_NextDownload ();
|
|
|
|
break;
|
|
|
|
case dl_sound:
|
|
|
|
Sound_NextDownload ();
|
|
|
|
break;
|
|
|
|
case dl_none:
|
|
|
|
default:
|
|
|
|
Con_DPrintf ("Unknown download type.\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=====================
|
|
|
|
CL_ParseDownload
|
|
|
|
|
|
|
|
A download message has been received from the server
|
|
|
|
=====================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseDownload (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int size, percent;
|
|
|
|
byte name[1024];
|
|
|
|
int r;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
// read the data
|
|
|
|
size = MSG_ReadShort ();
|
|
|
|
percent = MSG_ReadByte ();
|
|
|
|
|
|
|
|
if (cls.demoplayback) {
|
|
|
|
if (size > 0)
|
|
|
|
msg_readcount += size;
|
2000-12-08 06:51:37 +00:00
|
|
|
return; // not in demo playback
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2000-09-28 06:11:55 +00:00
|
|
|
if (size == -1) {
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("File not found.\n");
|
2000-09-28 06:11:55 +00:00
|
|
|
if (cls.download) {
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("cls.download shouldn't have been set\n");
|
2000-09-27 19:44:26 +00:00
|
|
|
Qclose (cls.download);
|
2000-05-10 11:29:38 +00:00
|
|
|
cls.download = NULL;
|
|
|
|
}
|
|
|
|
CL_RequestNextDownload ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-09-28 06:11:55 +00:00
|
|
|
if (size == -2) {
|
2000-12-08 06:51:37 +00:00
|
|
|
char *newname = MSG_ReadString ();
|
|
|
|
|
|
|
|
if (strncmp (newname, cls.downloadname, strlen (cls.downloadname))
|
|
|
|
|| strstr (newname + strlen (cls.downloadname), "/")) {
|
|
|
|
Con_Printf
|
|
|
|
("WARNING: server tried to give a strange new name: %s\n",
|
|
|
|
newname);
|
2000-09-28 06:11:55 +00:00
|
|
|
CL_RequestNextDownload ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (cls.download) {
|
|
|
|
Qclose (cls.download);
|
|
|
|
unlink (cls.downloadname);
|
|
|
|
}
|
|
|
|
strncpy (cls.downloadname, newname, sizeof (cls.downloadname));
|
|
|
|
Con_Printf ("downloading to %s\n", cls.downloadname);
|
|
|
|
return;
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
// open the file if not opened yet
|
2000-09-28 06:11:55 +00:00
|
|
|
if (!cls.download) {
|
2000-12-08 06:51:37 +00:00
|
|
|
if (strncmp (cls.downloadtempname, "skins/", 6))
|
|
|
|
snprintf (name, sizeof (name), "%s/%s", com_gamedir,
|
|
|
|
cls.downloadtempname);
|
2000-05-10 11:29:38 +00:00
|
|
|
else
|
2000-12-08 06:51:37 +00:00
|
|
|
snprintf (name, sizeof (name), "%s/qw/%s", fs_userpath->string,
|
|
|
|
cls.downloadtempname);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
COM_CreatePath (name);
|
|
|
|
|
2000-09-27 19:44:26 +00:00
|
|
|
cls.download = Qopen (name, "wb");
|
2000-09-28 06:11:55 +00:00
|
|
|
if (!cls.download) {
|
2000-05-10 11:29:38 +00:00
|
|
|
msg_readcount += size;
|
|
|
|
Con_Printf ("Failed to open %s\n", cls.downloadtempname);
|
|
|
|
CL_RequestNextDownload ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-27 19:44:26 +00:00
|
|
|
Qwrite (cls.download, net_message.data + msg_readcount, size);
|
2000-05-10 11:29:38 +00:00
|
|
|
msg_readcount += size;
|
|
|
|
|
2000-09-28 06:11:55 +00:00
|
|
|
if (percent != 100) {
|
2000-05-10 11:29:38 +00:00
|
|
|
// change display routines by zoid
|
|
|
|
// request next block
|
|
|
|
#if 0
|
|
|
|
Con_Printf (".");
|
2000-12-08 06:51:37 +00:00
|
|
|
if (10 * (percent / 10) != cls.downloadpercent) {
|
|
|
|
cls.downloadpercent = 10 * (percent / 10);
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("%i%%", cls.downloadpercent);
|
|
|
|
}
|
|
|
|
#endif
|
2000-11-09 19:31:07 +00:00
|
|
|
if (percent != cls.downloadpercent)
|
2000-12-08 06:51:37 +00:00
|
|
|
VID_SetCaption (va
|
|
|
|
("Downloading %s %d%%", cls.downloadname, percent));
|
2000-05-10 11:29:38 +00:00
|
|
|
cls.downloadpercent = percent;
|
|
|
|
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
|
|
|
SZ_Print (&cls.netchan.message, "nextdl");
|
2000-09-28 06:11:55 +00:00
|
|
|
} else {
|
2000-12-08 06:51:37 +00:00
|
|
|
char oldn[MAX_OSPATH];
|
|
|
|
char newn[MAX_OSPATH];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
Con_Printf ("100%%\n");
|
|
|
|
#endif
|
|
|
|
|
2000-09-27 19:44:26 +00:00
|
|
|
Qclose (cls.download);
|
2000-11-09 19:31:07 +00:00
|
|
|
VID_SetCaption (va ("Connecting to %s", cls.servername));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// rename the temp file to it's final name
|
2000-12-08 06:51:37 +00:00
|
|
|
if (strcmp (cls.downloadtempname, cls.downloadname)) {
|
|
|
|
if (strncmp (cls.downloadtempname, "skins/", 6)) {
|
|
|
|
snprintf (oldn, sizeof (oldn), "%s/%s", com_gamedir,
|
|
|
|
cls.downloadtempname);
|
|
|
|
snprintf (newn, sizeof (newn), "%s/%s", com_gamedir,
|
|
|
|
cls.downloadname);
|
2000-05-10 11:29:38 +00:00
|
|
|
} else {
|
2000-12-08 06:51:37 +00:00
|
|
|
snprintf (oldn, sizeof (oldn), "%s/qw/%s", fs_userpath->string,
|
|
|
|
cls.downloadtempname);
|
|
|
|
snprintf (newn, sizeof (newn), "%s/qw/%s", fs_userpath->string,
|
|
|
|
cls.downloadname);
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
2000-10-06 16:30:37 +00:00
|
|
|
r = Qrename (oldn, newn);
|
2000-05-10 11:29:38 +00:00
|
|
|
if (r)
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_Printf ("failed to rename, %s.\n", strerror (errno));
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cls.download = NULL;
|
|
|
|
cls.downloadpercent = 0;
|
|
|
|
|
|
|
|
// get another file if needed
|
|
|
|
|
|
|
|
CL_RequestNextDownload ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static byte *upload_data;
|
2000-12-08 06:51:37 +00:00
|
|
|
static int upload_pos;
|
|
|
|
static int upload_size;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_NextUpload (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
byte buffer[1024];
|
|
|
|
int r;
|
|
|
|
int percent;
|
|
|
|
int size;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
if (!upload_data)
|
|
|
|
return;
|
|
|
|
|
|
|
|
r = upload_size - upload_pos;
|
|
|
|
if (r > 768)
|
|
|
|
r = 768;
|
2000-12-08 06:51:37 +00:00
|
|
|
memcpy (buffer, upload_data + upload_pos, r);
|
2000-05-10 11:29:38 +00:00
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_upload);
|
|
|
|
MSG_WriteShort (&cls.netchan.message, r);
|
|
|
|
|
|
|
|
upload_pos += r;
|
|
|
|
size = upload_size;
|
|
|
|
if (!size)
|
|
|
|
size = 1;
|
2000-12-08 06:51:37 +00:00
|
|
|
percent = upload_pos * 100 / size;
|
2000-05-10 11:29:38 +00:00
|
|
|
MSG_WriteByte (&cls.netchan.message, percent);
|
|
|
|
SZ_Write (&cls.netchan.message, buffer, r);
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_DPrintf ("UPLOAD: %6d: %d written\n", upload_pos - r, r);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
if (upload_pos != upload_size)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Con_Printf ("Upload completed\n");
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
free (upload_data);
|
2000-05-10 11:29:38 +00:00
|
|
|
upload_data = 0;
|
|
|
|
upload_pos = upload_size = 0;
|
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_StartUpload (byte * data, int size)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
|
|
|
if (cls.state < ca_onserver)
|
2000-12-08 06:51:37 +00:00
|
|
|
return; // gotta be connected
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// override
|
|
|
|
if (upload_data)
|
2000-12-08 06:51:37 +00:00
|
|
|
free (upload_data);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_DPrintf ("Upload starting of %d...\n", size);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
upload_data = malloc (size);
|
|
|
|
memcpy (upload_data, data, size);
|
2000-05-10 11:29:38 +00:00
|
|
|
upload_size = size;
|
|
|
|
upload_pos = 0;
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
CL_NextUpload ();
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
qboolean
|
|
|
|
CL_IsUploading (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
|
|
|
if (upload_data)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_StopUpload (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
|
|
|
if (upload_data)
|
2000-12-08 06:51:37 +00:00
|
|
|
free (upload_data);
|
2000-05-10 11:29:38 +00:00
|
|
|
upload_data = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=====================================================================
|
|
|
|
|
|
|
|
SERVER CONNECTING MESSAGES
|
|
|
|
|
|
|
|
=====================================================================
|
|
|
|
*/
|
|
|
|
|
2000-12-28 09:33:49 +00:00
|
|
|
void Draw_ClearCache (void);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-12-28 09:33:49 +00:00
|
|
|
void CL_ClearBaselines (void); // LordHavoc: BIG BUG-FIX!
|
2000-06-23 18:36:59 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
/*
|
|
|
|
==================
|
|
|
|
CL_ParseServerData
|
|
|
|
==================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseServerData (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
char *str;
|
|
|
|
char fn[MAX_OSPATH];
|
|
|
|
qboolean cflag = false;
|
|
|
|
extern char gamedirfile[MAX_OSPATH];
|
|
|
|
int protover;
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_DPrintf ("Serverdata packet received.\n");
|
|
|
|
//
|
|
|
|
// wipe the client_state_t struct
|
|
|
|
//
|
|
|
|
CL_ClearState ();
|
|
|
|
|
|
|
|
// parse protocol version number
|
|
|
|
// allow 2.2 and 2.29 demos to play
|
|
|
|
protover = MSG_ReadLong ();
|
2000-12-08 06:51:37 +00:00
|
|
|
if (protover != PROTOCOL_VERSION &&
|
|
|
|
!(cls.demoplayback
|
|
|
|
&& (protover == 26 || protover == 27
|
|
|
|
|| protover ==
|
|
|
|
28)))
|
|
|
|
Host_EndGame
|
|
|
|
("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/",
|
|
|
|
protover, PROTOCOL_VERSION);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
cl.servercount = MSG_ReadLong ();
|
|
|
|
|
|
|
|
// game directory
|
|
|
|
str = MSG_ReadString ();
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (stricmp (gamedirfile, str)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
// save current config
|
2000-12-08 06:51:37 +00:00
|
|
|
Host_WriteConfiguration ();
|
2000-05-10 11:29:38 +00:00
|
|
|
cflag = true;
|
2000-06-23 18:36:59 +00:00
|
|
|
Draw_ClearCache ();
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
COM_Gamedir (str);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
// ZOID--run the autoexec.cfg in the gamedir
|
|
|
|
// if it exists
|
2000-05-10 11:29:38 +00:00
|
|
|
if (cflag) {
|
2000-12-08 06:51:37 +00:00
|
|
|
int cl_warncmd_val = cl_warncmd->int_val;
|
|
|
|
|
2000-10-07 04:06:08 +00:00
|
|
|
Cbuf_AddText ("cl_warncmd 0\n");
|
|
|
|
Cbuf_AddText ("exec config.cfg\n");
|
|
|
|
Cbuf_AddText ("exec frontend.cfg\n");
|
2000-10-17 03:17:42 +00:00
|
|
|
if (cl_autoexec->int_val) {
|
2000-10-07 04:06:08 +00:00
|
|
|
Cbuf_AddText ("exec autoexec.cfg\n");
|
2000-05-23 11:29:15 +00:00
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
snprintf (fn, sizeof (fn), "cl_warncmd %d\n", cl_warncmd_val);
|
|
|
|
Cbuf_AddText (fn);
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
// parse player slot, high bit means spectator
|
|
|
|
cl.playernum = MSG_ReadByte ();
|
2000-12-08 06:51:37 +00:00
|
|
|
if (cl.playernum & 128) {
|
2000-05-10 11:29:38 +00:00
|
|
|
cl.spectator = true;
|
|
|
|
cl.playernum &= ~128;
|
|
|
|
}
|
|
|
|
// get the full level name
|
|
|
|
str = MSG_ReadString ();
|
2000-12-08 06:51:37 +00:00
|
|
|
strncpy (cl.levelname, str, sizeof (cl.levelname) - 1);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// get the movevars
|
2000-12-08 06:51:37 +00:00
|
|
|
movevars.gravity = MSG_ReadFloat ();
|
|
|
|
movevars.stopspeed = MSG_ReadFloat ();
|
|
|
|
movevars.maxspeed = MSG_ReadFloat ();
|
|
|
|
movevars.spectatormaxspeed = MSG_ReadFloat ();
|
|
|
|
movevars.accelerate = MSG_ReadFloat ();
|
|
|
|
movevars.airaccelerate = MSG_ReadFloat ();
|
|
|
|
movevars.wateraccelerate = MSG_ReadFloat ();
|
|
|
|
movevars.friction = MSG_ReadFloat ();
|
|
|
|
movevars.waterfriction = MSG_ReadFloat ();
|
|
|
|
movevars.entgravity = MSG_ReadFloat ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// seperate the printfs so the server message can have a color
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_Printf
|
|
|
|
("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("%c%s\n", 2, str);
|
|
|
|
|
|
|
|
// ask for the sound list next
|
2000-12-08 06:51:37 +00:00
|
|
|
memset (cl.sound_name, 0, sizeof (cl.sound_name));
|
2000-05-10 11:29:38 +00:00
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2000-12-08 06:51:37 +00:00
|
|
|
// MSG_WriteString (&cls.netchan.message, va("soundlist %i 0", cl.servercount));
|
|
|
|
MSG_WriteString (&cls.netchan.message,
|
|
|
|
va (soundlist_name, cl.servercount, 0));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// now waiting for downloads, etc
|
|
|
|
cls.state = ca_onserver;
|
2000-07-04 00:49:01 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
CL_ClearBaselines ();
|
2000-07-04 00:49:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// LordHavoc: BIG BUG-FIX! Clear baselines each time it connects...
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
2000-12-28 09:33:49 +00:00
|
|
|
CL_ClearBaselines (void)
|
2000-07-04 00:49:01 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
memset (cl_baselines, 0, sizeof (cl_baselines));
|
|
|
|
for (i = 0; i < MAX_EDICTS; i++) {
|
2000-07-04 00:49:01 +00:00
|
|
|
cl_baselines[i].alpha = 255;
|
|
|
|
cl_baselines[i].scale = 16;
|
|
|
|
cl_baselines[i].glowcolor = 254;
|
|
|
|
cl_baselines[i].glowsize = 0;
|
|
|
|
cl_baselines[i].colormod = 255;
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==================
|
|
|
|
CL_ParseSoundlist
|
|
|
|
==================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseSoundlist (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int numsounds;
|
|
|
|
char *str;
|
|
|
|
int n;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// precache sounds
|
2000-12-08 06:51:37 +00:00
|
|
|
// memset (cl.sound_precache, 0, sizeof(cl.sound_precache));
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
numsounds = MSG_ReadByte ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
str = MSG_ReadString ();
|
|
|
|
if (!str[0])
|
|
|
|
break;
|
|
|
|
numsounds++;
|
|
|
|
if (numsounds == MAX_SOUNDS)
|
|
|
|
Host_EndGame ("Server sent too many sound_precache");
|
|
|
|
strcpy (cl.sound_name[numsounds], str);
|
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
n = MSG_ReadByte ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
if (n) {
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2000-12-08 06:51:37 +00:00
|
|
|
// MSG_WriteString (&cls.netchan.message, va("soundlist %i %i", cl.servercount, n));
|
|
|
|
MSG_WriteString (&cls.netchan.message,
|
|
|
|
va (soundlist_name, cl.servercount, n));
|
2000-05-10 11:29:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cls.downloadnumber = 0;
|
|
|
|
cls.downloadtype = dl_sound;
|
|
|
|
Sound_NextDownload ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==================
|
|
|
|
CL_ParseModellist
|
|
|
|
==================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseModellist (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int nummodels;
|
|
|
|
char *str;
|
|
|
|
int n;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// precache models and note certain default indexes
|
2000-12-08 06:51:37 +00:00
|
|
|
nummodels = MSG_ReadByte ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
for (;;) {
|
2000-05-10 11:29:38 +00:00
|
|
|
str = MSG_ReadString ();
|
|
|
|
if (!str[0])
|
|
|
|
break;
|
|
|
|
nummodels++;
|
2000-12-08 06:51:37 +00:00
|
|
|
if (nummodels == MAX_MODELS)
|
2000-05-10 11:29:38 +00:00
|
|
|
Host_EndGame ("Server sent too many model_precache");
|
|
|
|
strcpy (cl.model_name[nummodels], str);
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (!strcmp (cl.model_name[nummodels], "progs/spike.mdl"))
|
2000-05-10 11:29:38 +00:00
|
|
|
cl_spikeindex = nummodels;
|
2000-12-08 06:51:37 +00:00
|
|
|
else if (!strcmp (cl.model_name[nummodels], "progs/player.mdl"))
|
2000-05-10 11:29:38 +00:00
|
|
|
cl_playerindex = nummodels;
|
2000-12-08 06:51:37 +00:00
|
|
|
else if (!strcmp (cl.model_name[nummodels], "progs/flag.mdl"))
|
2000-05-10 11:29:38 +00:00
|
|
|
cl_flagindex = nummodels;
|
2000-08-02 23:00:39 +00:00
|
|
|
// for deadbodyfilter &gibfilter
|
2000-12-08 06:51:37 +00:00
|
|
|
else if (!strcmp (cl.model_name[nummodels], "progs/h_player.mdl"))
|
2000-08-02 23:00:39 +00:00
|
|
|
cl_h_playerindex = nummodels;
|
2000-12-08 06:51:37 +00:00
|
|
|
else if (!strcmp (cl.model_name[nummodels], "progs/gib1.mdl"))
|
2000-08-02 23:00:39 +00:00
|
|
|
cl_gib1index = nummodels;
|
2000-12-08 06:51:37 +00:00
|
|
|
else if (!strcmp (cl.model_name[nummodels], "progs/gib2.mdl"))
|
2000-08-02 23:00:39 +00:00
|
|
|
cl_gib2index = nummodels;
|
2000-12-08 06:51:37 +00:00
|
|
|
else if (!strcmp (cl.model_name[nummodels], "progs/gib3.mdl"))
|
2000-08-02 23:00:39 +00:00
|
|
|
cl_gib3index = nummodels;
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
n = MSG_ReadByte ();
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
if (n) {
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2000-12-08 06:51:37 +00:00
|
|
|
// MSG_WriteString (&cls.netchan.message, va("modellist %i %i", cl.servercount, n));
|
|
|
|
MSG_WriteString (&cls.netchan.message,
|
|
|
|
va (modellist_name, cl.servercount, n));
|
2000-05-10 11:29:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cls.downloadnumber = 0;
|
|
|
|
cls.downloadtype = dl_model;
|
|
|
|
Model_NextDownload ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==================
|
|
|
|
CL_ParseBaseline
|
|
|
|
==================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseBaseline (entity_state_t *es)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int i;
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
es->modelindex = MSG_ReadByte ();
|
|
|
|
es->frame = MSG_ReadByte ();
|
2000-12-08 06:51:37 +00:00
|
|
|
es->colormap = MSG_ReadByte ();
|
|
|
|
es->skinnum = MSG_ReadByte ();
|
|
|
|
for (i = 0; i < 3; i++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
es->origin[i] = MSG_ReadCoord ();
|
|
|
|
es->angles[i] = MSG_ReadAngle ();
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
// LordHavoc: set up the baseline to account for new effects (alpha,
|
|
|
|
// colormod, etc)
|
2000-07-01 04:56:13 +00:00
|
|
|
es->alpha = 255;
|
|
|
|
es->scale = 16;
|
|
|
|
es->glowcolor = 254;
|
|
|
|
es->glowsize = 0;
|
|
|
|
es->colormod = 255;
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
=====================
|
|
|
|
CL_ParseStatic
|
|
|
|
|
|
|
|
Static entities are non-interactive world objects
|
|
|
|
like torches
|
|
|
|
=====================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseStatic (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
entity_t *ent;
|
|
|
|
entity_state_t es;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
CL_ParseBaseline (&es);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-12-21 20:43:19 +00:00
|
|
|
if (cl.num_statics >= MAX_STATIC_ENTITIES)
|
2000-05-10 11:29:38 +00:00
|
|
|
Host_EndGame ("Too many static entities");
|
2000-12-21 20:43:19 +00:00
|
|
|
ent = &cl_static_entities[cl.num_statics++];
|
|
|
|
CL_Init_Entity (ent);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-21 20:43:19 +00:00
|
|
|
// copy it to the current state
|
2000-05-10 11:29:38 +00:00
|
|
|
ent->model = cl.model_precache[es.modelindex];
|
|
|
|
ent->frame = es.frame;
|
|
|
|
ent->skinnum = es.skinnum;
|
|
|
|
|
|
|
|
VectorCopy (es.origin, ent->origin);
|
|
|
|
VectorCopy (es.angles, ent->angles);
|
2000-07-01 04:56:13 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
R_AddEfrags (ent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
CL_ParseStaticSound
|
|
|
|
===================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseStaticSound (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
vec3_t org;
|
|
|
|
int sound_num, vol, atten;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
2000-05-10 11:29:38 +00:00
|
|
|
org[i] = MSG_ReadCoord ();
|
|
|
|
sound_num = MSG_ReadByte ();
|
|
|
|
vol = MSG_ReadByte ();
|
|
|
|
atten = MSG_ReadByte ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
=====================================================================
|
|
|
|
|
|
|
|
ACTION MESSAGES
|
|
|
|
|
|
|
|
=====================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
==================
|
|
|
|
CL_ParseStartSoundPacket
|
|
|
|
==================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseStartSoundPacket (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
vec3_t pos;
|
|
|
|
int channel, ent;
|
|
|
|
int sound_num;
|
|
|
|
int volume;
|
|
|
|
float attenuation;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
channel = MSG_ReadShort ();
|
|
|
|
|
|
|
|
if (channel & SND_VOLUME)
|
2000-05-10 11:29:38 +00:00
|
|
|
volume = MSG_ReadByte ();
|
|
|
|
else
|
|
|
|
volume = DEFAULT_SOUND_PACKET_VOLUME;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
if (channel & SND_ATTENUATION)
|
2000-05-10 11:29:38 +00:00
|
|
|
attenuation = MSG_ReadByte () / 64.0;
|
|
|
|
else
|
|
|
|
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
sound_num = MSG_ReadByte ();
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
for (i = 0; i < 3; i++)
|
2000-05-10 11:29:38 +00:00
|
|
|
pos[i] = MSG_ReadCoord ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
ent = (channel >> 3) & 1023;
|
2000-05-10 11:29:38 +00:00
|
|
|
channel &= 7;
|
|
|
|
|
|
|
|
if (ent > MAX_EDICTS)
|
|
|
|
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos,
|
|
|
|
volume / 255.0, attenuation);
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
==================
|
|
|
|
CL_ParseClientdata
|
|
|
|
|
|
|
|
Server information pertaining to this client only, sent every frame
|
|
|
|
==================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ParseClientdata (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int i;
|
|
|
|
float latency;
|
|
|
|
frame_t *frame;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// calculate simulated time of message
|
|
|
|
oldparsecountmod = parsecountmod;
|
|
|
|
|
|
|
|
i = cls.netchan.incoming_acknowledged;
|
|
|
|
cl.parsecount = i;
|
|
|
|
i &= UPDATE_MASK;
|
|
|
|
parsecountmod = i;
|
|
|
|
frame = &cl.frames[i];
|
|
|
|
parsecounttime = cl.frames[i].senttime;
|
|
|
|
|
|
|
|
frame->receivedtime = realtime;
|
|
|
|
|
|
|
|
// calculate latency
|
|
|
|
latency = frame->receivedtime - frame->senttime;
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (latency < 0 || latency > 1.0) {
|
|
|
|
// Con_Printf ("Odd latency: %5.2f\n", latency);
|
|
|
|
} else {
|
|
|
|
// drift the average latency towards the observed latency
|
2000-05-10 11:29:38 +00:00
|
|
|
if (latency < cls.latency)
|
|
|
|
cls.latency = latency;
|
|
|
|
else
|
2000-12-08 06:51:37 +00:00
|
|
|
cls.latency += 0.001; // drift up, so correction are needed
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
CL_UpdateUserinfo
|
|
|
|
==============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ProcessUserInfo (int slot, player_info_t *player)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
strncpy (player->name, Info_ValueForKey (player->userinfo, "name"),
|
|
|
|
sizeof (player->name) - 1);
|
|
|
|
player->topcolor = atoi (Info_ValueForKey (player->userinfo, "topcolor"));
|
|
|
|
player->bottomcolor =
|
|
|
|
atoi (Info_ValueForKey (player->userinfo, "bottomcolor"));
|
2000-05-10 11:29:38 +00:00
|
|
|
if (Info_ValueForKey (player->userinfo, "*spectator")[0])
|
|
|
|
player->spectator = true;
|
|
|
|
else
|
|
|
|
player->spectator = false;
|
|
|
|
|
|
|
|
if (cls.state == ca_active)
|
|
|
|
Skin_Find (player);
|
|
|
|
|
|
|
|
Sbar_Changed ();
|
|
|
|
CL_NewTranslation (slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
CL_UpdateUserinfo
|
|
|
|
==============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_UpdateUserinfo (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int slot;
|
|
|
|
player_info_t *player;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
slot = MSG_ReadByte ();
|
|
|
|
if (slot >= MAX_CLIENTS)
|
2000-12-08 06:51:37 +00:00
|
|
|
Host_EndGame
|
|
|
|
("CL_ParseServerMessage: svc_updateuserinfo > MAX_SCOREBOARD");
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
player = &cl.players[slot];
|
|
|
|
player->userid = MSG_ReadLong ();
|
2000-12-08 06:51:37 +00:00
|
|
|
strncpy (player->userinfo, MSG_ReadString (),
|
|
|
|
sizeof (player->userinfo) - 1);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
CL_ProcessUserInfo (slot, player);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
CL_SetInfo
|
|
|
|
==============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_SetInfo (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int slot;
|
|
|
|
player_info_t *player;
|
|
|
|
char key[MAX_MSGLEN];
|
|
|
|
char value[MAX_MSGLEN];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
slot = MSG_ReadByte ();
|
|
|
|
if (slot >= MAX_CLIENTS)
|
|
|
|
Host_EndGame ("CL_ParseServerMessage: svc_setinfo > MAX_SCOREBOARD");
|
|
|
|
|
|
|
|
player = &cl.players[slot];
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
strncpy (key, MSG_ReadString (), sizeof (key) - 1);
|
|
|
|
key[sizeof (key) - 1] = 0;
|
|
|
|
strncpy (value, MSG_ReadString (), sizeof (value) - 1);
|
|
|
|
key[sizeof (value) - 1] = 0;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_DPrintf ("SETINFO %s: %s=%s\n", player->name, key, value);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
Info_SetValueForKey (player->userinfo, key, value, MAX_INFO_STRING);
|
|
|
|
|
|
|
|
CL_ProcessUserInfo (slot, player);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
CL_ServerInfo
|
|
|
|
==============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_ServerInfo (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
char key[MAX_MSGLEN];
|
|
|
|
char value[MAX_MSGLEN];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
strncpy (key, MSG_ReadString (), sizeof (key) - 1);
|
|
|
|
key[sizeof (key) - 1] = 0;
|
|
|
|
strncpy (value, MSG_ReadString (), sizeof (value) - 1);
|
|
|
|
key[sizeof (value) - 1] = 0;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_DPrintf ("SERVERINFO: %s=%s\n", key, value);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
Info_SetValueForKey (cl.serverinfo, key, value, MAX_SERVERINFO_STRING);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=====================
|
|
|
|
CL_SetStat
|
|
|
|
=====================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_SetStat (int stat, int value)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int j;
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
if (stat < 0 || stat >= MAX_CL_STATS)
|
2000-12-08 06:51:37 +00:00
|
|
|
// Sys_Error ("CL_SetStat: %i is invalid", stat);
|
2000-07-31 12:54:11 +00:00
|
|
|
Host_EndGame ("CL_SetStat: %i is invalid", stat);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
Sbar_Changed ();
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-10-06 16:30:37 +00:00
|
|
|
switch (stat) {
|
2000-12-08 06:51:37 +00:00
|
|
|
case STAT_ITEMS: // set flash times
|
2000-10-06 16:30:37 +00:00
|
|
|
Sbar_Changed ();
|
2000-12-08 06:51:37 +00:00
|
|
|
for (j = 0; j < 32; j++)
|
|
|
|
if ((value & (1 << j)) && !(cl.stats[stat] & (1 << j)))
|
2000-10-06 16:30:37 +00:00
|
|
|
cl.item_gettime[j] = cl.time;
|
|
|
|
break;
|
|
|
|
case STAT_HEALTH:
|
|
|
|
if (value <= 0)
|
2000-12-08 06:51:37 +00:00
|
|
|
Team_Dead ();
|
2000-10-06 16:30:37 +00:00
|
|
|
break;
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cl.stats[stat] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
CL_MuzzleFlash
|
|
|
|
==============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_MuzzleFlash (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
vec3_t fv, rv, uv;
|
|
|
|
dlight_t *dl;
|
|
|
|
int i;
|
|
|
|
player_state_t *pl;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
i = MSG_ReadShort ();
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if ((unsigned int) (i - 1) >= MAX_CLIENTS)
|
2000-05-10 11:29:38 +00:00
|
|
|
return;
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
pl = &cl.frames[parsecountmod].playerstate[i - 1];
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
dl = CL_AllocDlight (i);
|
2000-12-08 06:51:37 +00:00
|
|
|
VectorCopy (pl->origin, dl->origin);
|
2000-05-10 11:29:38 +00:00
|
|
|
AngleVectors (pl->viewangles, fv, rv, uv);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
VectorMA (dl->origin, 18, fv, dl->origin);
|
2000-12-08 06:51:37 +00:00
|
|
|
dl->radius = 200 + (rand () & 31);
|
2000-05-10 11:29:38 +00:00
|
|
|
dl->minlight = 32;
|
|
|
|
dl->die = cl.time + 0.1;
|
|
|
|
dl->color[0] = 0.2;
|
|
|
|
dl->color[1] = 0.1;
|
|
|
|
dl->color[2] = 0.05;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-17 03:17:42 +00:00
|
|
|
#define SHOWNET(x) if (cl_shownet->int_val == 2) Con_Printf ("%3i:%s\n", msg_readcount-1, x);
|
2000-05-10 11:29:38 +00:00
|
|
|
/*
|
|
|
|
=====================
|
|
|
|
CL_ParseServerMessage
|
|
|
|
=====================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
int received_framecount;
|
|
|
|
void
|
|
|
|
CL_ParseServerMessage (void)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int cmd;
|
|
|
|
char *s;
|
|
|
|
int i, j;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
received_framecount = host_framecount;
|
|
|
|
cl.last_servermessage = realtime;
|
|
|
|
CL_ClearProjectiles ();
|
|
|
|
|
|
|
|
//
|
|
|
|
// if recording demos, copy the message out
|
|
|
|
//
|
2000-10-17 03:17:42 +00:00
|
|
|
if (cl_shownet->int_val == 1)
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_Printf ("%i ", net_message.cursize);
|
2000-10-17 03:17:42 +00:00
|
|
|
else if (cl_shownet->int_val == 2)
|
2000-05-10 11:29:38 +00:00
|
|
|
Con_Printf ("------------------\n");
|
|
|
|
|
|
|
|
|
|
|
|
CL_ParseClientdata ();
|
|
|
|
|
|
|
|
//
|
|
|
|
// parse the message
|
|
|
|
//
|
2000-12-08 06:51:37 +00:00
|
|
|
while (1) {
|
|
|
|
if (msg_badread) {
|
2000-05-10 11:29:38 +00:00
|
|
|
Host_EndGame ("CL_ParseServerMessage: Bad server message");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd = MSG_ReadByte ();
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (cmd == -1) {
|
|
|
|
msg_readcount++; // so the EOM showner has the right
|
|
|
|
// value
|
|
|
|
SHOWNET ("END OF MESSAGE");
|
2000-05-10 11:29:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
SHOWNET (svc_strings[cmd]);
|
|
|
|
|
|
|
|
// other commands
|
|
|
|
switch (cmd) {
|
|
|
|
default:
|
|
|
|
Host_EndGame
|
|
|
|
("CL_ParseServerMessage: Illegible server message");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_nop:
|
|
|
|
// Con_Printf ("svc_nop\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_disconnect:
|
|
|
|
if (cls.state == ca_connected)
|
|
|
|
Host_EndGame ("Server disconnected\n"
|
|
|
|
"Server version may not be compatible");
|
|
|
|
else
|
|
|
|
Host_EndGame ("Server disconnected");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_print:
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
s = MSG_ReadString ();
|
|
|
|
if (i == PRINT_CHAT) {
|
|
|
|
// TODO: cl_nofake 2 -- accept fake messages from
|
|
|
|
// teammates
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if (cl_nofake->int_val) {
|
|
|
|
for (p = s; *p; p++)
|
|
|
|
if (*p == 13)
|
|
|
|
*p = '#';
|
|
|
|
}
|
|
|
|
con_ormask = 128;
|
|
|
|
S_LocalSound ("misc/talk.wav");
|
2000-08-22 18:54:01 +00:00
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
Con_Printf ("%s", s);
|
|
|
|
con_ormask = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_centerprint:
|
|
|
|
SCR_CenterPrint (MSG_ReadString ());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_stufftext:
|
|
|
|
s = MSG_ReadString ();
|
|
|
|
Con_DPrintf ("stufftext: %s\n", s);
|
|
|
|
Cbuf_AddText (s);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_damage:
|
|
|
|
V_ParseDamage ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_serverdata:
|
|
|
|
Cbuf_Execute (); // make sure any stuffed commands are
|
|
|
|
// done
|
|
|
|
CL_ParseServerData ();
|
|
|
|
vid.recalc_refdef = true; // leave full screen intermission
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_setangle:
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
cl.viewangles[i] = MSG_ReadAngle ();
|
|
|
|
// cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_lightstyle:
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
if (i >= MAX_LIGHTSTYLES)
|
|
|
|
// Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
|
|
|
|
Host_EndGame ("svc_lightstyle > MAX_LIGHTSTYLES");
|
|
|
|
strcpy (cl_lightstyle[i].map, MSG_ReadString ());
|
|
|
|
cl_lightstyle[i].length = strlen (cl_lightstyle[i].map);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_sound:
|
|
|
|
CL_ParseStartSoundPacket ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_stopsound:
|
|
|
|
i = MSG_ReadShort ();
|
|
|
|
S_StopSound (i >> 3, i & 7);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_updatefrags:
|
|
|
|
Sbar_Changed ();
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
if (i >= MAX_CLIENTS)
|
|
|
|
Host_EndGame
|
|
|
|
("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
|
|
|
|
cl.players[i].frags = MSG_ReadShort ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_updateping:
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
if (i >= MAX_CLIENTS)
|
|
|
|
Host_EndGame
|
|
|
|
("CL_ParseServerMessage: svc_updateping > MAX_SCOREBOARD");
|
|
|
|
cl.players[i].ping = MSG_ReadShort ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_updatepl:
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
if (i >= MAX_CLIENTS)
|
|
|
|
Host_EndGame
|
|
|
|
("CL_ParseServerMessage: svc_updatepl > MAX_SCOREBOARD");
|
|
|
|
cl.players[i].pl = MSG_ReadByte ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_updateentertime:
|
|
|
|
// time is sent over as seconds ago
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
if (i >= MAX_CLIENTS)
|
|
|
|
Host_EndGame
|
|
|
|
("CL_ParseServerMessage: svc_updateentertime > MAX_SCOREBOARD");
|
|
|
|
cl.players[i].entertime = realtime - MSG_ReadFloat ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_spawnbaseline:
|
|
|
|
i = MSG_ReadShort ();
|
|
|
|
CL_ParseBaseline (&cl_baselines[i]);
|
|
|
|
break;
|
|
|
|
case svc_spawnstatic:
|
|
|
|
CL_ParseStatic ();
|
|
|
|
break;
|
|
|
|
case svc_temp_entity:
|
|
|
|
CL_ParseTEnt ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_killedmonster:
|
|
|
|
cl.stats[STAT_MONSTERS]++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_foundsecret:
|
|
|
|
cl.stats[STAT_SECRETS]++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_updatestat:
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
j = MSG_ReadByte ();
|
|
|
|
CL_SetStat (i, j);
|
|
|
|
break;
|
|
|
|
case svc_updatestatlong:
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
j = MSG_ReadLong ();
|
|
|
|
CL_SetStat (i, j);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_spawnstaticsound:
|
|
|
|
CL_ParseStaticSound ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_cdtrack:
|
|
|
|
cl.cdtrack = MSG_ReadByte ();
|
|
|
|
CDAudio_Play ((byte) cl.cdtrack, true);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_intermission:
|
|
|
|
Con_DPrintf ("svc_intermission\n");
|
|
|
|
cl.intermission = 1;
|
|
|
|
cl.completed_time = realtime;
|
|
|
|
vid.recalc_refdef = true; // go to full screen
|
|
|
|
Con_DPrintf ("intermission simorg: ");
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
cl.simorg[i] = MSG_ReadCoord ();
|
|
|
|
Con_DPrintf ("%f ", cl.simorg[i]);
|
|
|
|
}
|
|
|
|
Con_DPrintf ("\nintermission simangles: ");
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
cl.simangles[i] = MSG_ReadAngle ();
|
|
|
|
Con_DPrintf ("%f ", cl.simangles[i]);
|
|
|
|
}
|
|
|
|
Con_DPrintf ("\n");
|
|
|
|
VectorCopy (vec3_origin, cl.simvel);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_finale:
|
|
|
|
cl.intermission = 2;
|
|
|
|
cl.completed_time = realtime;
|
|
|
|
vid.recalc_refdef = true; // go to full screen
|
|
|
|
SCR_CenterPrint (MSG_ReadString ());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_sellscreen:
|
|
|
|
Cmd_ExecuteString ("help");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_smallkick:
|
|
|
|
cl.punchangle = -2;
|
|
|
|
break;
|
|
|
|
case svc_bigkick:
|
|
|
|
cl.punchangle = -4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_muzzleflash:
|
|
|
|
CL_MuzzleFlash ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_updateuserinfo:
|
|
|
|
CL_UpdateUserinfo ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_setinfo:
|
|
|
|
CL_SetInfo ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_serverinfo:
|
|
|
|
CL_ServerInfo ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_download:
|
|
|
|
CL_ParseDownload ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_playerinfo:
|
|
|
|
CL_ParsePlayerinfo ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_nails:
|
|
|
|
CL_ParseProjectiles ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_chokecount: // some preceding packets were choked
|
|
|
|
i = MSG_ReadByte ();
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
cl.
|
|
|
|
frames[(cls.netchan.incoming_acknowledged - 1 - j) &
|
|
|
|
UPDATE_MASK].receivedtime = -2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_modellist:
|
|
|
|
CL_ParseModellist ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_soundlist:
|
|
|
|
CL_ParseSoundlist ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_packetentities:
|
|
|
|
CL_ParsePacketEntities (false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_deltapacketentities:
|
|
|
|
CL_ParsePacketEntities (true);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_maxspeed:
|
|
|
|
movevars.maxspeed = MSG_ReadFloat ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_entgravity:
|
|
|
|
movevars.entgravity = MSG_ReadFloat ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case svc_setpause:
|
|
|
|
cl.paused = MSG_ReadByte ();
|
|
|
|
if (cl.paused)
|
|
|
|
CDAudio_Pause ();
|
|
|
|
else
|
|
|
|
CDAudio_Resume ();
|
|
|
|
break;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CL_SetSolidEntities ();
|
|
|
|
}
|