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;
else {
if (!rcon_address->string[0]) {
Con_Printf ("You must either be connected,\n"
"or set the 'rcon_address' cvar\n"
Con_Printf ("You must either be connected, "
"or set the 'rcon_address' cvar "
"to issue rcon commands\n");
return;
@ -611,7 +611,7 @@ CL_FullServerinfo_f (void)
cl.watervis = atoi (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;
Info_SetValueForKey (cls.userinfo, key, value,
(!strequal (key, "name"))
| (strequal (key, "team") << 1));
(!strequal (key, "name")) |
(strequal (key, "team") << 1));
}
}
@ -727,8 +727,8 @@ CL_SetInfo_f (void)
return;
Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2),
(!strequal (Cmd_Argv (1), "name"))
| (strequal (Cmd_Argv (2), "team") << 1));
(!strequal (Cmd_Argv (1), "name")) |
(strequal (Cmd_Argv (2), "team") << 1));
if (cls.state >= ca_connected)
Cmd_ForwardToServer ();
}
@ -753,7 +753,6 @@ CL_GetInfo_f (void)
CL_Packet_f
packet <destination> <contents>
Contents allows \n escape character
*/
void
@ -912,8 +911,8 @@ CL_ConnectionlessPacket (void)
if (!cl_allow_cmd_pkt->int_val ||
((*(unsigned int *) net_from.ip !=
*(unsigned int *) net_local_adr.ip
&& *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK)))) {
*(unsigned int *) net_local_adr.ip &&
*(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK)))) {
Con_Printf ("Command packet from remote host. Ignored.\n");
return;
}
@ -930,10 +929,9 @@ CL_ConnectionlessPacket (void)
while (len && isspace ((byte) s[len - 1]))
len--;
if (!allowremotecmd
&& (!*localid->string
|| strlen (localid->string) > len
|| strncmp (localid->string, s, len))) {
if (!allowremotecmd && (!*localid->string ||
strlen (localid->string) > len ||
strncmp (localid->string, s, len))) {
if (!*localid->string) {
Con_Printf ("===========================\n");
Con_Printf ("Command packet received from local host, but no "
@ -1014,7 +1012,6 @@ CL_ConnectionlessPacket (void)
Host_EndGame ("End of demo");
else
Con_Printf ("svc_disconnect\n");
// Host_EndGame ("Server disconnected");
return;
}
@ -1024,7 +1021,6 @@ CL_ConnectionlessPacket (void)
void
CL_ReadPackets (void)
{
// while (NET_GetPacket ())
while (CL_GetMessage ()) {
if (net_message->message->cursize == -1)
@ -1059,9 +1055,6 @@ CL_ReadPackets (void)
if (!Netchan_Process (&cls.netchan))
continue; // wasn't accepted for some reason
CL_ParseServerMessage ();
// if (cls.demoplayback && cls.state >= ca_active && !CL_DemoBehind())
// return;
}
// check timeout
@ -1135,7 +1128,7 @@ CL_SetState (cactive_t state)
// Auto demo recorder starts here
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 {
r_active = false;
game_target = IMT_CONSOLE;
@ -1161,7 +1154,6 @@ CL_Init (void)
Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", 0);
Info_SetValueForKey (cls.userinfo, "rate", "2500", 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);
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 ("changing", CL_Changing_f, "Used when maps are changing");
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"
"the demo will be called Year-Month-Day-Hour-Minute-Mapname");
Cmd_AddCommand ("record", CL_Record_f, "Record a demo, if no filename "
"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 "
"server");
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 "
"w_switch - Determines the highest weapon that Quake "
"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 "
"set setinfo variables");
Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "Used by GameSpy "
"and Qlist to obtain server variables");
Cmd_AddCommand ("getserverinfo", CL_Getserverinfo_f, "Returns the value corresponding to key"
" $1 in the server info.");
Cmd_AddCommand ("getserverinfo", CL_Getserverinfo_f, "Returns the value "
"corresponding to key $1 in the server info.");
Cmd_AddCommand ("download", CL_Download_f, "Manually download a quake "
"file from the server");
Cmd_AddCommand ("nextul", CL_NextUpload, "Tells the client to send the "
"next upload");
Cmd_AddCommand ("stopul", CL_StopUpload, "Tells the client to stop "
"uploading");
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view "
"to be level");
// forward to server commands
@ -1360,8 +1354,8 @@ CL_Init_Cvars (void)
"Turn this on to save cpu when fps limited. "
"May affect frame rate adversely depending on "
"local machine/os conditions");
cl_autorecord = Cvar_Get ("cl_autorecord", "0", CVAR_ARCHIVE, NULL,
"Turn this on, if you want to record every game");
cl_autorecord = Cvar_Get ("cl_autorecord", "0", CVAR_ARCHIVE, NULL, "Turn "
"this on, if you want to record every game");
}
/*

View file

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

View file

@ -162,7 +162,6 @@ int cl_h_playerindex, cl_gib1index, cl_gib2index, cl_gib3index;
int packet_latency[NET_TIMINGS];
int
CL_CalcNet (void)
{
@ -231,9 +230,8 @@ CL_CheckOrDownloadFile (const char *filename)
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
// 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);
strncat (cls.downloadtempname, ".tmp",
sizeof (cls.downloadtempname) - strlen (cls.downloadtempname));
@ -552,7 +550,7 @@ void
CL_StartUpload (byte * data, int size)
{
if (cls.state < ca_onserver)
return; // gotta be connected
return; // must be connected
// override
if (upload_data)
@ -584,7 +582,7 @@ CL_StopUpload (void)
upload_data = NULL;
}
/* SERVER CONNECTING MESSAGES */
// SERVER CONNECTING MESSAGES =================================================
void Draw_ClearCache (void);
void CL_ClearBaselines (void); // LordHavoc: BIG BUG-FIX!
@ -607,9 +605,8 @@ CL_ParseServerData (void)
// parse protocol version number
// allow 2.2 and 2.29 demos to play
protover = MSG_ReadLong (net_message);
if (protover != PROTOCOL_VERSION &&
!(cls.demoplayback
&& (protover <= 26 && protover >= 28)))
if (protover != PROTOCOL_VERSION
&& !(cls.demoplayback && (protover <= 26 && protover >= 28)))
Host_Error ("Server returned version %i, not %i\nYou probably "
"need to upgrade.\nCheck http://www.quakeworld.net/",
protover, PROTOCOL_VERSION);
@ -628,8 +625,7 @@ CL_ParseServerData (void)
COM_Gamedir (str);
// ZOID--run the autoexec.cfg in the gamedir
// if it exists
// ZOID--run the autoexec.cfg in the gamedir if it exists
if (cflag) {
int cmd_warncmd_val = cmd_warncmd->int_val;
@ -848,7 +844,7 @@ CL_ParseStaticSound (void)
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
}
/* ACTION MESSAGES */
// ACTION MESSAGES ============================================================
void
CL_ParseStartSoundPacket (void)
@ -955,10 +951,9 @@ CL_ProcessUserInfo (int slot, player_info_t *player)
void
CL_UpdateUserinfo (void)
{
int slot;
player_info_t *player;
int uid;
int slot, uid;
const char *info;
player_info_t *player;
slot = MSG_ReadByte (net_message);
if (slot >= MAX_CLIENTS)
@ -985,8 +980,7 @@ void
CL_SetInfo (void)
{
char key[MAX_MSGLEN], value[MAX_MSGLEN];
int slot;
int flags;
int flags, slot;
player_info_t *player;
slot = MSG_ReadByte (net_message);
@ -1044,7 +1038,6 @@ CL_SetStat (int stat, int value)
int j;
if (stat < 0 || stat >= MAX_CL_STATS)
// Sys_Error ("CL_SetStat: %i is invalid", stat);
Host_Error ("CL_SetStat: %i is invalid", stat);
Sbar_Changed ();
@ -1160,6 +1153,7 @@ CL_ParseServerMessage (void)
case svc_print: {
char p[2048];
i = MSG_ReadByte (net_message);
s = MSG_ReadString (net_message);
if (i == PRINT_CHAT) {
@ -1167,6 +1161,7 @@ CL_ParseServerMessage (void)
if (cl_nofake->int_val) {
char *c;
strncpy (p, s, sizeof (p));
p[sizeof (p) - 1] = 0;
for (c = p; *c; c++) {
@ -1211,21 +1206,19 @@ CL_ParseServerMessage (void)
break;
case svc_serverdata:
Cbuf_Execute (); // make sure any stuffed commands are
// done
Cbuf_Execute (); // make sure any stuffed commands are done
CL_ParseServerData ();
vid.recalc_refdef = true; // leave full screen intermission
break;
case svc_setangle:
MSG_ReadAngleV (net_message, cl.viewangles);
// cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0;
// FIXME cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0;
break;
case svc_lightstyle:
i = MSG_ReadByte (net_message);
if (i >= MAX_LIGHTSTYLES)
// Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
strcpy (r_lightstyle[i].map, MSG_ReadString (net_message));
r_lightstyle[i].length = strlen (r_lightstyle[i].map);
@ -1279,9 +1272,15 @@ CL_ParseServerMessage (void)
i = MSG_ReadShort (net_message);
CL_ParseBaseline (&cl_baselines[i]);
break;
case svc_spawnstatic:
CL_ParseStatic ();
break;
case svc_spawnstaticsound:
CL_ParseStaticSound ();
break;
case svc_temp_entity:
CL_ParseTEnt ();
break;
@ -1299,16 +1298,13 @@ CL_ParseServerMessage (void)
j = MSG_ReadByte (net_message);
CL_SetStat (i, j);
break;
case svc_updatestatlong:
i = MSG_ReadByte (net_message);
j = MSG_ReadLong (net_message);
CL_SetStat (i, j);
break;
case svc_spawnstaticsound:
CL_ParseStaticSound ();
break;
case svc_cdtrack:
cl.cdtrack = MSG_ReadByte (net_message);
CDAudio_Play ((byte) cl.cdtrack, true);
@ -1331,10 +1327,8 @@ CL_ParseServerMessage (void)
Con_DPrintf ("\n");
VectorCopy (vec3_origin, cl.simvel);
/*
automatic fraglogging (by elmex)
XXX: Should this _really_ called here?
*/
// automatic fraglogging (by elmex)
// XXX: Should this _really_ called here?
if (!cls.demoplayback)
Sbar_LogFrags();
break;
@ -1354,6 +1348,7 @@ CL_ParseServerMessage (void)
case svc_smallkick:
cl.punchangle = -2;
break;
case svc_bigkick:
cl.punchangle = -4;
break;
@ -1389,8 +1384,7 @@ CL_ParseServerMessage (void)
case svc_chokecount: // some preceding packets were choked
i = MSG_ReadByte (net_message);
for (j = 0; j < i; j++)
cl.
frames[(cls.netchan.incoming_acknowledged - 1 - j) &
cl.frames[(cls.netchan.incoming_acknowledged - 1 - j) &
UPDATE_MASK].receivedtime = -2;
break;
@ -1425,7 +1419,6 @@ CL_ParseServerMessage (void)
else
CDAudio_Resume ();
break;
}
}

View file

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

View file

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

View file

@ -186,6 +186,7 @@ CL_AllocBeam (int ent)
{
int i;
beam_t *b;
// override any beam with the same entity
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
return b;
@ -247,7 +248,7 @@ setup_beam (beam_t *b)
while (ent_count--) {
ent = &b->ent_list[ent_count];
VectorMA (org, d, dist, ent->origin);
d += 1;
d += 1.0;
ent->model = b->model;
ent->angles[0] = pitch;
ent->angles[1] = yaw;
@ -289,7 +290,7 @@ CL_ParseTEnt (void)
byte type;
dlight_t *dl;
explosion_t *ex;
int colorStart, colorLength, rnd;
int colorStart, colorLength;
int cnt = -1;
vec3_t pos;
@ -311,16 +312,19 @@ CL_ParseTEnt (void)
MSG_ReadCoordV (net_message, pos);
R_SpikeEffect (pos);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
else {
rnd = rand () & 3;
if (rnd == 1)
switch (rand () % 20) {
case 19:
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);
else
break;
case 17:
case 16:
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
break;
default:
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
}
break;
@ -328,16 +332,19 @@ CL_ParseTEnt (void)
MSG_ReadCoordV (net_message, pos);
R_SuperSpikeEffect (pos);
if (rand () % 5)
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
else {
rnd = rand () & 3;
if (rnd == 1)
switch (rand () % 20) {
case 19:
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);
else
break;
case 17:
case 16:
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
break;
default:
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
}
break;