Whitespace, dead code removal, and a couple of tiny cleanups.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-07-03 05:40:33 +00:00
parent c8fcdd5813
commit 64df22aa8c
6 changed files with 144 additions and 155 deletions

View file

@ -374,8 +374,8 @@ CL_Rcon_f (void)
to = cls.netchan.remote_address; to = cls.netchan.remote_address;
else { else {
if (!rcon_address->string[0]) { if (!rcon_address->string[0]) {
Con_Printf ("You must either be connected,\n" Con_Printf ("You must either be connected, "
"or set the 'rcon_address' cvar\n" "or set the 'rcon_address' cvar "
"to issue rcon commands\n"); "to issue rcon commands\n");
return; return;
@ -611,7 +611,7 @@ CL_FullServerinfo_f (void)
cl.watervis = atoi (p); cl.watervis = atoi (p);
} }
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) { if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
//FIXME didn't actually do anything anyway // FIXME: Didn't actually do anything anyway
} }
} }
@ -701,8 +701,8 @@ CL_FullInfo_f (void)
continue; continue;
Info_SetValueForKey (cls.userinfo, key, value, Info_SetValueForKey (cls.userinfo, key, value,
(!strequal (key, "name")) (!strequal (key, "name")) |
| (strequal (key, "team") << 1)); (strequal (key, "team") << 1));
} }
} }
@ -727,8 +727,8 @@ CL_SetInfo_f (void)
return; return;
Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2), Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2),
(!strequal (Cmd_Argv (1), "name")) (!strequal (Cmd_Argv (1), "name")) |
| (strequal (Cmd_Argv (2), "team") << 1)); (strequal (Cmd_Argv (2), "team") << 1));
if (cls.state >= ca_connected) if (cls.state >= ca_connected)
Cmd_ForwardToServer (); Cmd_ForwardToServer ();
} }
@ -753,7 +753,6 @@ CL_GetInfo_f (void)
CL_Packet_f CL_Packet_f
packet <destination> <contents> packet <destination> <contents>
Contents allows \n escape character Contents allows \n escape character
*/ */
void void
@ -912,8 +911,8 @@ CL_ConnectionlessPacket (void)
if (!cl_allow_cmd_pkt->int_val || if (!cl_allow_cmd_pkt->int_val ||
((*(unsigned int *) net_from.ip != ((*(unsigned int *) net_from.ip !=
*(unsigned int *) net_local_adr.ip *(unsigned int *) net_local_adr.ip &&
&& *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK)))) { *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK)))) {
Con_Printf ("Command packet from remote host. Ignored.\n"); Con_Printf ("Command packet from remote host. Ignored.\n");
return; return;
} }
@ -930,10 +929,9 @@ CL_ConnectionlessPacket (void)
while (len && isspace ((byte) s[len - 1])) while (len && isspace ((byte) s[len - 1]))
len--; len--;
if (!allowremotecmd if (!allowremotecmd && (!*localid->string ||
&& (!*localid->string strlen (localid->string) > len ||
|| strlen (localid->string) > len strncmp (localid->string, s, len))) {
|| strncmp (localid->string, s, len))) {
if (!*localid->string) { if (!*localid->string) {
Con_Printf ("===========================\n"); Con_Printf ("===========================\n");
Con_Printf ("Command packet received from local host, but no " Con_Printf ("Command packet received from local host, but no "
@ -1014,7 +1012,6 @@ CL_ConnectionlessPacket (void)
Host_EndGame ("End of demo"); Host_EndGame ("End of demo");
else else
Con_Printf ("svc_disconnect\n"); Con_Printf ("svc_disconnect\n");
// Host_EndGame ("Server disconnected");
return; return;
} }
@ -1024,7 +1021,6 @@ CL_ConnectionlessPacket (void)
void void
CL_ReadPackets (void) CL_ReadPackets (void)
{ {
// while (NET_GetPacket ())
while (CL_GetMessage ()) { while (CL_GetMessage ()) {
if (net_message->message->cursize == -1) if (net_message->message->cursize == -1)
@ -1057,11 +1053,8 @@ CL_ReadPackets (void)
continue; continue;
} }
if (!Netchan_Process (&cls.netchan)) if (!Netchan_Process (&cls.netchan))
continue; // wasn't accepted for some reason continue; // wasn't accepted for some reason
CL_ParseServerMessage (); CL_ParseServerMessage ();
// if (cls.demoplayback && cls.state >= ca_active && !CL_DemoBehind())
// return;
} }
// check timeout // check timeout
@ -1102,7 +1095,7 @@ CL_Download_f (void)
SZ_Print (&cls.netchan.message, va ("download %s\n", Cmd_Argv (1))); SZ_Print (&cls.netchan.message, va ("download %s\n", Cmd_Argv (1)));
} else { } else {
Con_Printf ("error downloading %s: %s\n", Cmd_Argv (1), Con_Printf ("error downloading %s: %s\n", Cmd_Argv (1),
strerror (errno)); strerror (errno));
} }
} }
@ -1135,7 +1128,7 @@ CL_SetState (cactive_t state)
// Auto demo recorder starts here // Auto demo recorder starts here
if(cl_autorecord->int_val && !cls.demoplayback && !cls.demorecording) if(cl_autorecord->int_val && !cls.demoplayback && !cls.demorecording)
CL_Record (0); // FIXME might want a cvar here CL_Record (0); // FIXME: might want a cvar here
} else { } else {
r_active = false; r_active = false;
game_target = IMT_CONSOLE; game_target = IMT_CONSOLE;
@ -1161,7 +1154,6 @@ CL_Init (void)
Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", 0); Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", 0);
Info_SetValueForKey (cls.userinfo, "rate", "2500", 0); Info_SetValueForKey (cls.userinfo, "rate", "2500", 0);
Info_SetValueForKey (cls.userinfo, "msg", "1", 0); Info_SetValueForKey (cls.userinfo, "msg", "1", 0);
// snprintf (st, sizeof(st), "%s-%04d", QW_VERSION, build_number());
snprintf (st, sizeof (st), "%s", QW_VERSION); snprintf (st, sizeof (st), "%s", QW_VERSION);
Info_SetValueForStarKey (cls.userinfo, "*ver", st, 0); Info_SetValueForStarKey (cls.userinfo, "*ver", st, 0);
@ -1176,8 +1168,10 @@ CL_Init (void)
Cmd_AddCommand ("version", CL_Version_f, "Report version information"); Cmd_AddCommand ("version", CL_Version_f, "Report version information");
Cmd_AddCommand ("changing", CL_Changing_f, "Used when maps are changing"); Cmd_AddCommand ("changing", CL_Changing_f, "Used when maps are changing");
Cmd_AddCommand ("disconnect", CL_Disconnect_f, "Disconnect from server"); Cmd_AddCommand ("disconnect", CL_Disconnect_f, "Disconnect from server");
Cmd_AddCommand ("record", CL_Record_f, "Record a demo, if no filename argument is given\n" Cmd_AddCommand ("record", CL_Record_f, "Record a demo, if no filename "
"the demo will be called Year-Month-Day-Hour-Minute-Mapname"); "argument is given\n"
"the demo will be called Year-Month-Day-Hour-Minute-"
"Mapname");
Cmd_AddCommand ("rerecord", CL_ReRecord_f, "Rerecord a demo on the same " Cmd_AddCommand ("rerecord", CL_ReRecord_f, "Rerecord a demo on the same "
"server"); "server");
Cmd_AddCommand ("snap", CL_RSShot_f, "Take a screenshot and upload it to " Cmd_AddCommand ("snap", CL_RSShot_f, "Take a screenshot and upload it to "
@ -1212,20 +1206,20 @@ CL_Init (void)
"that Quake should switch to upon a backpack pickup.\n " "that Quake should switch to upon a backpack pickup.\n "
"w_switch - Determines the highest weapon that Quake " "w_switch - Determines the highest weapon that Quake "
"should switch to upon a weapon pickup."); "should switch to upon a weapon pickup.");
Cmd_AddCommand ("getinfo", CL_GetInfo_f, "Returns the value of client info key $1"); Cmd_AddCommand ("getinfo", CL_GetInfo_f, "Returns the value of client "
"info key $1");
Cmd_AddCommand ("fullinfo", CL_FullInfo_f, "Used by GameSpy and Qlist to " Cmd_AddCommand ("fullinfo", CL_FullInfo_f, "Used by GameSpy and Qlist to "
"set setinfo variables"); "set setinfo variables");
Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "Used by GameSpy " Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "Used by GameSpy "
"and Qlist to obtain server variables"); "and Qlist to obtain server variables");
Cmd_AddCommand ("getserverinfo", CL_Getserverinfo_f, "Returns the value corresponding to key" Cmd_AddCommand ("getserverinfo", CL_Getserverinfo_f, "Returns the value "
" $1 in the server info."); "corresponding to key $1 in the server info.");
Cmd_AddCommand ("download", CL_Download_f, "Manually download a quake " Cmd_AddCommand ("download", CL_Download_f, "Manually download a quake "
"file from the server"); "file from the server");
Cmd_AddCommand ("nextul", CL_NextUpload, "Tells the client to send the " Cmd_AddCommand ("nextul", CL_NextUpload, "Tells the client to send the "
"next upload"); "next upload");
Cmd_AddCommand ("stopul", CL_StopUpload, "Tells the client to stop " Cmd_AddCommand ("stopul", CL_StopUpload, "Tells the client to stop "
"uploading"); "uploading");
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view " Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view "
"to be level"); "to be level");
// forward to server commands // forward to server commands
@ -1360,8 +1354,8 @@ CL_Init_Cvars (void)
"Turn this on to save cpu when fps limited. " "Turn this on to save cpu when fps limited. "
"May affect frame rate adversely depending on " "May affect frame rate adversely depending on "
"local machine/os conditions"); "local machine/os conditions");
cl_autorecord = Cvar_Get ("cl_autorecord", "0", CVAR_ARCHIVE, NULL, cl_autorecord = Cvar_Get ("cl_autorecord", "0", CVAR_ARCHIVE, NULL, "Turn "
"Turn this on, if you want to record every game"); "this on, if you want to record every game");
} }
/* /*
@ -1494,11 +1488,11 @@ int nopacketcount;
void void
Host_Frame (float time) Host_Frame (float time)
{ {
static double time1 = 0; static double time1 = 0;
static double time2 = 0; static double time2 = 0;
static double time3 = 0; static double time3 = 0;
float sleeptime; float sleeptime;
int pass1, pass2, pass3; int pass1, pass2, pass3;
if (setjmp (host_abort)) if (setjmp (host_abort))
// something bad happened, or the server disconnected // something bad happened, or the server disconnected
@ -1794,7 +1788,7 @@ Host_Init (void)
build_number ()); build_number ());
Con_Printf ("\x80\x81\x81\x82 %s initialized \x80\x81\x81\x82\n", PROGRAM); Con_Printf ("\x80\x81\x81\x82 %s initialized \x80\x81\x81\x82\n", PROGRAM);
Con_NewMap (); // force the menus to be loaded Con_NewMap (); // force the menus to be loaded
CL_UpdateScreen (realtime); CL_UpdateScreen (realtime);

View file

@ -58,8 +58,6 @@ CL_NetGraph (void)
if (!r_netgraph->int_val) if (!r_netgraph->int_val)
return; return;
a = 0; // shut up gcc
x = hudswap ? vid.width - (NET_TIMINGS + 16): 0; x = hudswap ? vid.width - (NET_TIMINGS + 16): 0;
y = vid.height - sb_lines - 24 - r_graphheight->int_val - 1; y = vid.height - sb_lines - 24 - r_graphheight->int_val - 1;
@ -76,7 +74,7 @@ CL_NetGraph (void)
l = NET_TIMINGS; l = NET_TIMINGS;
if (l > r_refdef.vrect.width - 8) if (l > r_refdef.vrect.width - 8)
l = r_refdef.vrect.width - 8; l = r_refdef.vrect.width - 8;
i = (cls.netchan.outgoing_sequence - a) & NET_TIMINGSMASK; i = cls.netchan.outgoing_sequence & NET_TIMINGSMASK;
a = i - l; a = i - l;
if (a < 0) { if (a < 0) {
R_LineGraph (x, y, &packet_latency[a + NET_TIMINGS], -a); R_LineGraph (x, y, &packet_latency[a + NET_TIMINGS], -a);

View file

@ -162,22 +162,21 @@ int cl_h_playerindex, cl_gib1index, cl_gib2index, cl_gib3index;
int packet_latency[NET_TIMINGS]; int packet_latency[NET_TIMINGS];
int int
CL_CalcNet (void) CL_CalcNet (void)
{ {
int lost, a, i; int lost, a, i;
frame_t *frame; frame_t *frame;
for (i = cls.netchan.outgoing_sequence - UPDATE_BACKUP + 1; for (i = cls.netchan.outgoing_sequence - UPDATE_BACKUP + 1;
i <= cls.netchan.outgoing_sequence; i++) { i <= cls.netchan.outgoing_sequence; i++) {
frame = &cl.frames[i & UPDATE_MASK]; frame = &cl.frames[i & UPDATE_MASK];
if (frame->receivedtime == -1) if (frame->receivedtime == -1)
packet_latency[i & NET_TIMINGSMASK] = 9999; // dropped packet_latency[i & NET_TIMINGSMASK] = 9999; // dropped
else if (frame->receivedtime == -2) else if (frame->receivedtime == -2)
packet_latency[i & NET_TIMINGSMASK] = 10000; // choked packet_latency[i & NET_TIMINGSMASK] = 10000; // choked
else if (frame->invalid) else if (frame->invalid)
packet_latency[i & NET_TIMINGSMASK] = 9998; // invalid delta packet_latency[i & NET_TIMINGSMASK] = 9998; // invalid delta
else else
packet_latency[i & NET_TIMINGSMASK] = packet_latency[i & NET_TIMINGSMASK] =
(frame->receivedtime - frame->senttime) * 20; (frame->receivedtime - frame->senttime) * 20;
@ -201,7 +200,7 @@ CL_CalcNet (void)
qboolean qboolean
CL_CheckOrDownloadFile (const char *filename) CL_CheckOrDownloadFile (const char *filename)
{ {
VFile *f; VFile *f;
if (strstr (filename, "..")) { if (strstr (filename, "..")) {
Con_Printf ("Refusing to download a path with ..\n"); Con_Printf ("Refusing to download a path with ..\n");
@ -231,9 +230,8 @@ CL_CheckOrDownloadFile (const char *filename)
strcpy (cls.downloadname, filename); strcpy (cls.downloadname, filename);
Con_Printf ("Downloading %s...\n", cls.downloadname); Con_Printf ("Downloading %s...\n", cls.downloadname);
// download to a temp name, and only rename // download to a temp name, and only rename to the real name when done,
// to the real name when done, so if interrupted // so if interrupted a runt file wont be left
// a runt file wont be left
COM_StripExtension (cls.downloadname, cls.downloadtempname); COM_StripExtension (cls.downloadname, cls.downloadtempname);
strncat (cls.downloadtempname, ".tmp", strncat (cls.downloadtempname, ".tmp",
sizeof (cls.downloadtempname) - strlen (cls.downloadtempname)); sizeof (cls.downloadtempname) - strlen (cls.downloadtempname));
@ -250,8 +248,8 @@ CL_CheckOrDownloadFile (const char *filename)
void void
Model_NextDownload (void) Model_NextDownload (void)
{ {
char *s; char *s;
int i; int i;
if (cls.downloadnumber == 0) { if (cls.downloadnumber == 0) {
Con_Printf ("Checking models...\n"); Con_Printf ("Checking models...\n");
@ -263,9 +261,9 @@ Model_NextDownload (void)
for (; cl.model_name[cls.downloadnumber][0]; cls.downloadnumber++) { for (; cl.model_name[cls.downloadnumber][0]; cls.downloadnumber++) {
s = cl.model_name[cls.downloadnumber]; s = cl.model_name[cls.downloadnumber];
if (s[0] == '*') if (s[0] == '*')
continue; // inline brush model continue; // inline brush model
if (!CL_CheckOrDownloadFile (s)) if (!CL_CheckOrDownloadFile (s))
return; // started a download return; // started a download
} }
for (i = 1; i < MAX_MODELS; i++) { for (i = 1; i < MAX_MODELS; i++) {
@ -320,7 +318,7 @@ Model_NextDownload (void)
R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS); R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS);
Team_NewMap (); Team_NewMap ();
Con_NewMap (); Con_NewMap ();
Hunk_Check (); // make sure nothing is hurt Hunk_Check (); // make sure nothing is hurt
// done with modellist, request first of static signon messages // done with modellist, request first of static signon messages
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
@ -332,8 +330,8 @@ Model_NextDownload (void)
void void
Sound_NextDownload (void) Sound_NextDownload (void)
{ {
char *s; char *s;
int i; int i;
if (cls.downloadnumber == 0) { if (cls.downloadnumber == 0) {
Con_Printf ("Checking sounds...\n"); Con_Printf ("Checking sounds...\n");
@ -396,8 +394,8 @@ CL_RequestNextDownload (void)
void void
CL_ParseDownload (void) CL_ParseDownload (void)
{ {
byte name[1024]; byte name[1024];
int size, percent, r; int size, percent, r;
// read the data // read the data
size = MSG_ReadShort (net_message); size = MSG_ReadShort (net_message);
@ -423,7 +421,7 @@ CL_ParseDownload (void)
} }
if (size == -2) { if (size == -2) {
const char *newname = MSG_ReadString (net_message); const char *newname = MSG_ReadString (net_message);
if (strncmp (newname, cls.downloadname, strlen (cls.downloadname)) if (strncmp (newname, cls.downloadname, strlen (cls.downloadname))
|| strstr (newname + strlen (cls.downloadname), "/")) { || strstr (newname + strlen (cls.downloadname), "/")) {
@ -476,8 +474,8 @@ CL_ParseDownload (void)
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, "nextdl"); SZ_Print (&cls.netchan.message, "nextdl");
} else { } else {
char oldn[MAX_OSPATH]; char oldn[MAX_OSPATH];
char newn[MAX_OSPATH]; char newn[MAX_OSPATH];
Qclose (cls.download); Qclose (cls.download);
VID_SetCaption (va ("Connecting to %s", cls.servername)); VID_SetCaption (va ("Connecting to %s", cls.servername));
@ -510,13 +508,13 @@ CL_ParseDownload (void)
} }
static byte *upload_data; static byte *upload_data;
static int upload_pos, upload_size; static int upload_pos, upload_size;
void void
CL_NextUpload (void) CL_NextUpload (void)
{ {
byte buffer[1024]; byte buffer[1024];
int percent, size, r; int percent, size, r;
if (!upload_data) if (!upload_data)
return; return;
@ -552,7 +550,7 @@ void
CL_StartUpload (byte * data, int size) CL_StartUpload (byte * data, int size)
{ {
if (cls.state < ca_onserver) if (cls.state < ca_onserver)
return; // gotta be connected return; // must be connected
// override // override
if (upload_data) if (upload_data)
@ -584,7 +582,7 @@ CL_StopUpload (void)
upload_data = NULL; upload_data = NULL;
} }
/* SERVER CONNECTING MESSAGES */ // SERVER CONNECTING MESSAGES =================================================
void Draw_ClearCache (void); void Draw_ClearCache (void);
void CL_ClearBaselines (void); // LordHavoc: BIG BUG-FIX! void CL_ClearBaselines (void); // LordHavoc: BIG BUG-FIX!
@ -592,10 +590,10 @@ void CL_ClearBaselines (void); // LordHavoc: BIG BUG-FIX!
void void
CL_ParseServerData (void) CL_ParseServerData (void)
{ {
char fn[MAX_OSPATH]; char fn[MAX_OSPATH];
const char *str; const char *str;
int protover; int protover;
qboolean cflag = false; qboolean cflag = false;
extern char gamedirfile[MAX_OSPATH]; extern char gamedirfile[MAX_OSPATH];
@ -607,12 +605,11 @@ CL_ParseServerData (void)
// parse protocol version number // parse protocol version number
// allow 2.2 and 2.29 demos to play // allow 2.2 and 2.29 demos to play
protover = MSG_ReadLong (net_message); protover = MSG_ReadLong (net_message);
if (protover != PROTOCOL_VERSION && if (protover != PROTOCOL_VERSION
!(cls.demoplayback && !(cls.demoplayback && (protover <= 26 && protover >= 28)))
&& (protover <= 26 && protover >= 28))) Host_Error ("Server returned version %i, not %i\nYou probably "
Host_Error ("Server returned version %i, not %i\nYou probably " "need to upgrade.\nCheck http://www.quakeworld.net/",
"need to upgrade.\nCheck http://www.quakeworld.net/", protover, PROTOCOL_VERSION);
protover, PROTOCOL_VERSION);
cl.servercount = MSG_ReadLong (net_message); cl.servercount = MSG_ReadLong (net_message);
@ -628,8 +625,7 @@ CL_ParseServerData (void)
COM_Gamedir (str); COM_Gamedir (str);
// ZOID--run the autoexec.cfg in the gamedir // ZOID--run the autoexec.cfg in the gamedir if it exists
// if it exists
if (cflag) { if (cflag) {
int cmd_warncmd_val = cmd_warncmd->int_val; int cmd_warncmd_val = cmd_warncmd->int_val;
@ -690,7 +686,7 @@ CL_ParseServerData (void)
void void
CL_ClearBaselines (void) CL_ClearBaselines (void)
{ {
int i; int i;
memset (cl_baselines, 0, sizeof (cl_baselines)); memset (cl_baselines, 0, sizeof (cl_baselines));
for (i = 0; i < MAX_EDICTS; i++) { for (i = 0; i < MAX_EDICTS; i++) {
@ -706,7 +702,7 @@ void
CL_ParseSoundlist (void) CL_ParseSoundlist (void)
{ {
const char *str; const char *str;
int numsounds, n; int numsounds, n;
// precache sounds // precache sounds
// memset (cl.sound_precache, 0, sizeof(cl.sound_precache)); // memset (cl.sound_precache, 0, sizeof(cl.sound_precache));
@ -740,7 +736,7 @@ CL_ParseSoundlist (void)
void void
CL_ParseModellist (void) CL_ParseModellist (void)
{ {
int nummodels, n; int nummodels, n;
const char *str; const char *str;
// precache models and note certain default indexes // precache models and note certain default indexes
@ -813,8 +809,8 @@ CL_ParseBaseline (entity_state_t *es)
void void
CL_ParseStatic (void) CL_ParseStatic (void)
{ {
entity_t *ent; entity_t *ent;
entity_state_t es; entity_state_t es;
CL_ParseBaseline (&es); CL_ParseBaseline (&es);
@ -837,8 +833,8 @@ CL_ParseStatic (void)
void void
CL_ParseStaticSound (void) CL_ParseStaticSound (void)
{ {
int sound_num, vol, atten; int sound_num, vol, atten;
vec3_t org; vec3_t org;
MSG_ReadCoordV (net_message, org); MSG_ReadCoordV (net_message, org);
sound_num = MSG_ReadByte (net_message); sound_num = MSG_ReadByte (net_message);
@ -848,14 +844,14 @@ CL_ParseStaticSound (void)
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten); S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
} }
/* ACTION MESSAGES */ // ACTION MESSAGES ============================================================
void void
CL_ParseStartSoundPacket (void) CL_ParseStartSoundPacket (void)
{ {
float attenuation; float attenuation;
int channel, ent, sound_num, volume; int channel, ent, sound_num, volume;
vec3_t pos; vec3_t pos;
channel = MSG_ReadShort (net_message); channel = MSG_ReadShort (net_message);
@ -891,9 +887,9 @@ CL_ParseStartSoundPacket (void)
void void
CL_ParseClientdata (void) CL_ParseClientdata (void)
{ {
float latency; float latency;
frame_t *frame; frame_t *frame;
int i; int i;
// calculate simulated time of message // calculate simulated time of message
oldparsecountmod = parsecountmod; oldparsecountmod = parsecountmod;
@ -922,7 +918,7 @@ CL_ParseClientdata (void)
void void
CL_ProcessUserInfo (int slot, player_info_t *player) CL_ProcessUserInfo (int slot, player_info_t *player)
{ {
char skin[512]; char skin[512];
const char *s; const char *s;
s = Info_ValueForKey (player->userinfo, "skin"); s = Info_ValueForKey (player->userinfo, "skin");
@ -955,10 +951,9 @@ CL_ProcessUserInfo (int slot, player_info_t *player)
void void
CL_UpdateUserinfo (void) CL_UpdateUserinfo (void)
{ {
int slot; int slot, uid;
player_info_t *player; const char *info;
int uid; player_info_t *player;
const char *info;
slot = MSG_ReadByte (net_message); slot = MSG_ReadByte (net_message);
if (slot >= MAX_CLIENTS) if (slot >= MAX_CLIENTS)
@ -984,10 +979,9 @@ CL_UpdateUserinfo (void)
void void
CL_SetInfo (void) CL_SetInfo (void)
{ {
char key[MAX_MSGLEN], value[MAX_MSGLEN]; char key[MAX_MSGLEN], value[MAX_MSGLEN];
int slot; int flags, slot;
int flags; player_info_t *player;
player_info_t *player;
slot = MSG_ReadByte (net_message); slot = MSG_ReadByte (net_message);
if (slot >= MAX_CLIENTS) if (slot >= MAX_CLIENTS)
@ -1015,7 +1009,7 @@ CL_SetInfo (void)
void void
CL_ServerInfo (void) CL_ServerInfo (void)
{ {
char key[MAX_MSGLEN], value[MAX_MSGLEN]; char key[MAX_MSGLEN], value[MAX_MSGLEN];
strncpy (key, MSG_ReadString (net_message), sizeof (key) - 1); strncpy (key, MSG_ReadString (net_message), sizeof (key) - 1);
key[sizeof (key) - 1] = 0; key[sizeof (key) - 1] = 0;
@ -1041,10 +1035,9 @@ CL_ServerInfo (void)
void void
CL_SetStat (int stat, int value) CL_SetStat (int stat, int value)
{ {
int j; int j;
if (stat < 0 || stat >= MAX_CL_STATS) if (stat < 0 || stat >= MAX_CL_STATS)
// Sys_Error ("CL_SetStat: %i is invalid", stat);
Host_Error ("CL_SetStat: %i is invalid", stat); Host_Error ("CL_SetStat: %i is invalid", stat);
Sbar_Changed (); Sbar_Changed ();
@ -1069,9 +1062,9 @@ void
CL_MuzzleFlash (void) CL_MuzzleFlash (void)
{ {
dlight_t *dl; dlight_t *dl;
int i; int i;
player_state_t *pl; player_state_t *pl;
vec3_t fv, rv, uv; vec3_t fv, rv, uv;
i = MSG_ReadShort (net_message); i = MSG_ReadShort (net_message);
@ -1100,7 +1093,7 @@ CL_MuzzleFlash (void)
#define SHOWNET(x) if (cl_shownet->int_val == 2) Con_Printf ("%3i:%s\n", net_message->readcount-1, x); #define SHOWNET(x) if (cl_shownet->int_val == 2) Con_Printf ("%3i:%s\n", net_message->readcount-1, x);
int received_framecount; int received_framecount;
void Sbar_LogFrags(void); void Sbar_LogFrags(void);
@ -1109,7 +1102,7 @@ CL_ParseServerMessage (void)
{ {
const char *s; const char *s;
static dstring_t *stuffbuf; static dstring_t *stuffbuf;
int cmd, i, j; int cmd, i, j;
received_framecount = host_framecount; received_framecount = host_framecount;
cl.last_servermessage = realtime; cl.last_servermessage = realtime;
@ -1159,14 +1152,16 @@ CL_ParseServerMessage (void)
break; break;
case svc_print: { case svc_print: {
char p[2048]; char p[2048];
i = MSG_ReadByte (net_message); i = MSG_ReadByte (net_message);
s = MSG_ReadString (net_message); s = MSG_ReadString (net_message);
if (i == PRINT_CHAT) { if (i == PRINT_CHAT) {
// TODO: cl_nofake 2 -- accept fake messages from teammates // TODO: cl_nofake 2 -- accept fake messages from teammates
if (cl_nofake->int_val) { if (cl_nofake->int_val) {
char *c; char *c;
strncpy (p, s, sizeof (p)); strncpy (p, s, sizeof (p));
p[sizeof (p) - 1] = 0; p[sizeof (p) - 1] = 0;
for (c = p; *c; c++) { for (c = p; *c; c++) {
@ -1211,21 +1206,19 @@ CL_ParseServerMessage (void)
break; break;
case svc_serverdata: case svc_serverdata:
Cbuf_Execute (); // make sure any stuffed commands are Cbuf_Execute (); // make sure any stuffed commands are done
// done
CL_ParseServerData (); CL_ParseServerData ();
vid.recalc_refdef = true; // leave full screen intermission vid.recalc_refdef = true; // leave full screen intermission
break; break;
case svc_setangle: case svc_setangle:
MSG_ReadAngleV (net_message, cl.viewangles); MSG_ReadAngleV (net_message, cl.viewangles);
// cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0; // FIXME cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0;
break; break;
case svc_lightstyle: case svc_lightstyle:
i = MSG_ReadByte (net_message); i = MSG_ReadByte (net_message);
if (i >= MAX_LIGHTSTYLES) if (i >= MAX_LIGHTSTYLES)
// Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES"); Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
strcpy (r_lightstyle[i].map, MSG_ReadString (net_message)); strcpy (r_lightstyle[i].map, MSG_ReadString (net_message));
r_lightstyle[i].length = strlen (r_lightstyle[i].map); r_lightstyle[i].length = strlen (r_lightstyle[i].map);
@ -1279,9 +1272,15 @@ CL_ParseServerMessage (void)
i = MSG_ReadShort (net_message); i = MSG_ReadShort (net_message);
CL_ParseBaseline (&cl_baselines[i]); CL_ParseBaseline (&cl_baselines[i]);
break; break;
case svc_spawnstatic: case svc_spawnstatic:
CL_ParseStatic (); CL_ParseStatic ();
break; break;
case svc_spawnstaticsound:
CL_ParseStaticSound ();
break;
case svc_temp_entity: case svc_temp_entity:
CL_ParseTEnt (); CL_ParseTEnt ();
break; break;
@ -1299,16 +1298,13 @@ CL_ParseServerMessage (void)
j = MSG_ReadByte (net_message); j = MSG_ReadByte (net_message);
CL_SetStat (i, j); CL_SetStat (i, j);
break; break;
case svc_updatestatlong: case svc_updatestatlong:
i = MSG_ReadByte (net_message); i = MSG_ReadByte (net_message);
j = MSG_ReadLong (net_message); j = MSG_ReadLong (net_message);
CL_SetStat (i, j); CL_SetStat (i, j);
break; break;
case svc_spawnstaticsound:
CL_ParseStaticSound ();
break;
case svc_cdtrack: case svc_cdtrack:
cl.cdtrack = MSG_ReadByte (net_message); cl.cdtrack = MSG_ReadByte (net_message);
CDAudio_Play ((byte) cl.cdtrack, true); CDAudio_Play ((byte) cl.cdtrack, true);
@ -1331,10 +1327,8 @@ CL_ParseServerMessage (void)
Con_DPrintf ("\n"); Con_DPrintf ("\n");
VectorCopy (vec3_origin, cl.simvel); VectorCopy (vec3_origin, cl.simvel);
/* // automatic fraglogging (by elmex)
automatic fraglogging (by elmex) // XXX: Should this _really_ called here?
XXX: Should this _really_ called here?
*/
if (!cls.demoplayback) if (!cls.demoplayback)
Sbar_LogFrags(); Sbar_LogFrags();
break; break;
@ -1343,7 +1337,7 @@ CL_ParseServerMessage (void)
Con_Printf("svc_finale\n"); Con_Printf("svc_finale\n");
cl.intermission = 2; cl.intermission = 2;
cl.completed_time = realtime; cl.completed_time = realtime;
vid.recalc_refdef = true; // go to full screen vid.recalc_refdef = true; // go to full screen
SCR_CenterPrint (MSG_ReadString (net_message)); SCR_CenterPrint (MSG_ReadString (net_message));
break; break;
@ -1354,6 +1348,7 @@ CL_ParseServerMessage (void)
case svc_smallkick: case svc_smallkick:
cl.punchangle = -2; cl.punchangle = -2;
break; break;
case svc_bigkick: case svc_bigkick:
cl.punchangle = -4; cl.punchangle = -4;
break; break;
@ -1389,9 +1384,8 @@ CL_ParseServerMessage (void)
case svc_chokecount: // some preceding packets were choked case svc_chokecount: // some preceding packets were choked
i = MSG_ReadByte (net_message); i = MSG_ReadByte (net_message);
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
cl. cl.frames[(cls.netchan.incoming_acknowledged - 1 - j) &
frames[(cls.netchan.incoming_acknowledged - 1 - j) & UPDATE_MASK].receivedtime = -2;
UPDATE_MASK].receivedtime = -2;
break; break;
case svc_modellist: case svc_modellist:
@ -1425,7 +1419,6 @@ CL_ParseServerMessage (void)
else else
CDAudio_Resume (); CDAudio_Resume ();
break; break;
} }
} }

View file

@ -70,14 +70,15 @@ SCR_DrawNet (void)
void void
CL_NetStats (void) CL_NetStats (void)
{ {
int x, y; int x, y;
if (!show_ping->int_val && !show_pl->int_val) if (!show_ping->int_val && !show_pl->int_val)
return; return;
if (cls.state != ca_active) if (cls.state != ca_active)
return; return;
x = hudswap ? vid.width - 104 : 0; x = hudswap ? vid.width - 104 : 0;
y = vid.height - sb_lines - 16; y = vid.height - sb_lines - 16;
// request new ping times every two second // request new ping times every two seconds
if (realtime - cl.last_ping_request > 2) { if (realtime - cl.last_ping_request > 2) {
cl.last_ping_request = realtime; cl.last_ping_request = realtime;
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
@ -115,13 +116,10 @@ static SCR_Func scr_funcs[] = {
SCR_CheckDrawCenterString, SCR_CheckDrawCenterString,
Sbar_Draw, Sbar_Draw,
SCR_DrawConsole, SCR_DrawConsole,
// FIXME: MENUCODE
// M_Draw,
0 0
}; };
void void
CL_UpdateScreen (double realtime) CL_UpdateScreen (double realtime)
{ {
@ -149,7 +147,7 @@ CL_RSShot_f (void)
if (CL_IsUploading ()) if (CL_IsUploading ())
return; // already one pending return; // already one pending
if (cls.state < ca_onserver) if (cls.state < ca_onserver)
return; // gotta be connected return; // must be connected
Con_Printf ("Remote screen shot requested.\n"); Con_Printf ("Remote screen shot requested.\n");

View file

@ -56,7 +56,6 @@ cvar_t *topcolor;
cvar_t *bottomcolor; cvar_t *bottomcolor;
void void
Skin_NextDownload (void) Skin_NextDownload (void)
{ {

View file

@ -144,7 +144,7 @@ CL_Init_Entity (entity_t *ent)
void void
CL_ClearTEnts (void) CL_ClearTEnts (void)
{ {
int i; int i;
memset (&cl_beams, 0, sizeof (cl_beams)); memset (&cl_beams, 0, sizeof (cl_beams));
memset (&cl_explosions, 0, sizeof (cl_explosions)); memset (&cl_explosions, 0, sizeof (cl_explosions));
@ -152,11 +152,11 @@ CL_ClearTEnts (void)
int j; int j;
for (j = 0; j < MAX_BEAM_ENTS; j++) { for (j = 0; j < MAX_BEAM_ENTS; j++) {
CL_Init_Entity(&cl_beams[i].ent_list[j]); CL_Init_Entity (&cl_beams[i].ent_list[j]);
} }
} }
for (i = 0; i < MAX_EXPLOSIONS; i++) { for (i = 0; i < MAX_EXPLOSIONS; i++) {
CL_Init_Entity(&cl_explosions[i].ent); CL_Init_Entity (&cl_explosions[i].ent);
} }
} }
@ -186,6 +186,7 @@ CL_AllocBeam (int ent)
{ {
int i; int i;
beam_t *b; beam_t *b;
// override any beam with the same entity // override any beam with the same entity
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
return b; return b;
@ -247,7 +248,7 @@ setup_beam (beam_t *b)
while (ent_count--) { while (ent_count--) {
ent = &b->ent_list[ent_count]; ent = &b->ent_list[ent_count];
VectorMA (org, d, dist, ent->origin); VectorMA (org, d, dist, ent->origin);
d += 1; d += 1.0;
ent->model = b->model; ent->model = b->model;
ent->angles[0] = pitch; ent->angles[0] = pitch;
ent->angles[1] = yaw; ent->angles[1] = yaw;
@ -289,7 +290,7 @@ CL_ParseTEnt (void)
byte type; byte type;
dlight_t *dl; dlight_t *dl;
explosion_t *ex; explosion_t *ex;
int colorStart, colorLength, rnd; int colorStart, colorLength;
int cnt = -1; int cnt = -1;
vec3_t pos; vec3_t pos;
@ -311,16 +312,19 @@ CL_ParseTEnt (void)
MSG_ReadCoordV (net_message, pos); MSG_ReadCoordV (net_message, pos);
R_SpikeEffect (pos); R_SpikeEffect (pos);
if (rand () % 5) switch (rand () % 20) {
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1); case 19:
else {
rnd = rand () & 3;
if (rnd == 1)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1); S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1);
else if (rnd == 2) break;
case 18:
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1); S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1);
else break;
case 17:
case 16:
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1); S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
break;
default:
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
} }
break; break;
@ -328,16 +332,19 @@ CL_ParseTEnt (void)
MSG_ReadCoordV (net_message, pos); MSG_ReadCoordV (net_message, pos);
R_SuperSpikeEffect (pos); R_SuperSpikeEffect (pos);
if (rand () % 5) switch (rand () % 20) {
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1); case 19:
else {
rnd = rand () & 3;
if (rnd == 1)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1); S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1);
else if (rnd == 2) break;
case 18:
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1); S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1);
else break;
case 17:
case 16:
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1); S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
break;
default:
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
} }
break; break;
@ -370,7 +377,7 @@ CL_ParseTEnt (void)
ex->ent.model = cl_spr_explod; ex->ent.model = cl_spr_explod;
break; break;
case TE_TAREXPLOSION: // tarbaby explosion case TE_TAREXPLOSION: // tarbaby explosion
MSG_ReadCoordV (net_message, pos); MSG_ReadCoordV (net_message, pos);
R_BlobExplosion (pos); R_BlobExplosion (pos);
@ -426,13 +433,13 @@ CL_ParseTEnt (void)
3 + 2] * (1.0 / 255.0); 3 + 2] * (1.0 / 255.0);
break; break;
case TE_GUNSHOT: // bullet hitting wall case TE_GUNSHOT: // bullet hitting wall
cnt = MSG_ReadByte (net_message) * 20; cnt = MSG_ReadByte (net_message) * 20;
MSG_ReadCoordV (net_message, pos); MSG_ReadCoordV (net_message, pos);
R_GunshotEffect (pos, cnt); R_GunshotEffect (pos, cnt);
break; break;
case TE_BLOOD: // bullet hitting body case TE_BLOOD: // bullet hitting body
cnt = MSG_ReadByte (net_message) * 20; cnt = MSG_ReadByte (net_message) * 20;
MSG_ReadCoordV (net_message, pos); MSG_ReadCoordV (net_message, pos);
R_BloodPuffEffect (pos, cnt); R_BloodPuffEffect (pos, cnt);