From 64df22aa8c8e26bf3be7b708e43be58b22e33b81 Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Wed, 3 Jul 2002 05:40:33 +0000 Subject: [PATCH] Whitespace, dead code removal, and a couple of tiny cleanups. --- qw/source/cl_main.c | 68 ++++++++--------- qw/source/cl_ngraph.c | 4 +- qw/source/cl_parse.c | 165 ++++++++++++++++++++---------------------- qw/source/cl_screen.c | 10 +-- qw/source/cl_skin.c | 1 - qw/source/cl_tent.c | 51 +++++++------ 6 files changed, 144 insertions(+), 155 deletions(-) diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 83490034e..bb0c666c9 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -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 - 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) @@ -1057,11 +1053,8 @@ CL_ReadPackets (void) continue; } if (!Netchan_Process (&cls.netchan)) - continue; // wasn't accepted for some reason + continue; // wasn't accepted for some reason CL_ParseServerMessage (); - -// if (cls.demoplayback && cls.state >= ca_active && !CL_DemoBehind()) -// return; } // check timeout @@ -1102,7 +1095,7 @@ CL_Download_f (void) SZ_Print (&cls.netchan.message, va ("download %s\n", Cmd_Argv (1))); } else { 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 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"); } /* @@ -1494,11 +1488,11 @@ int nopacketcount; void Host_Frame (float time) { - static double time1 = 0; - static double time2 = 0; - static double time3 = 0; - float sleeptime; - int pass1, pass2, pass3; + static double time1 = 0; + static double time2 = 0; + static double time3 = 0; + float sleeptime; + int pass1, pass2, pass3; if (setjmp (host_abort)) // something bad happened, or the server disconnected @@ -1794,7 +1788,7 @@ Host_Init (void) build_number ()); 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); diff --git a/qw/source/cl_ngraph.c b/qw/source/cl_ngraph.c index ea9c0f91b..58fb53f94 100644 --- a/qw/source/cl_ngraph.c +++ b/qw/source/cl_ngraph.c @@ -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); diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index f4354b775..3187d5a1f 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -162,22 +162,21 @@ int cl_h_playerindex, cl_gib1index, cl_gib2index, cl_gib3index; int packet_latency[NET_TIMINGS]; - int CL_CalcNet (void) { - int lost, a, i; - frame_t *frame; + int lost, a, i; + frame_t *frame; for (i = cls.netchan.outgoing_sequence - UPDATE_BACKUP + 1; i <= cls.netchan.outgoing_sequence; i++) { frame = &cl.frames[i & UPDATE_MASK]; if (frame->receivedtime == -1) - packet_latency[i & NET_TIMINGSMASK] = 9999; // dropped + packet_latency[i & NET_TIMINGSMASK] = 9999; // dropped else if (frame->receivedtime == -2) packet_latency[i & NET_TIMINGSMASK] = 10000; // choked else if (frame->invalid) - packet_latency[i & NET_TIMINGSMASK] = 9998; // invalid delta + packet_latency[i & NET_TIMINGSMASK] = 9998; // invalid delta else packet_latency[i & NET_TIMINGSMASK] = (frame->receivedtime - frame->senttime) * 20; @@ -201,7 +200,7 @@ CL_CalcNet (void) qboolean CL_CheckOrDownloadFile (const char *filename) { - VFile *f; + VFile *f; if (strstr (filename, "..")) { Con_Printf ("Refusing to download a path with ..\n"); @@ -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)); @@ -250,8 +248,8 @@ CL_CheckOrDownloadFile (const char *filename) void Model_NextDownload (void) { - char *s; - int i; + char *s; + int i; if (cls.downloadnumber == 0) { Con_Printf ("Checking models...\n"); @@ -263,9 +261,9 @@ Model_NextDownload (void) for (; cl.model_name[cls.downloadnumber][0]; cls.downloadnumber++) { s = cl.model_name[cls.downloadnumber]; if (s[0] == '*') - continue; // inline brush model + continue; // inline brush model if (!CL_CheckOrDownloadFile (s)) - return; // started a download + return; // started a download } for (i = 1; i < MAX_MODELS; i++) { @@ -320,7 +318,7 @@ Model_NextDownload (void) R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS); Team_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 MSG_WriteByte (&cls.netchan.message, clc_stringcmd); @@ -332,8 +330,8 @@ Model_NextDownload (void) void Sound_NextDownload (void) { - char *s; - int i; + char *s; + int i; if (cls.downloadnumber == 0) { Con_Printf ("Checking sounds...\n"); @@ -396,8 +394,8 @@ CL_RequestNextDownload (void) void CL_ParseDownload (void) { - byte name[1024]; - int size, percent, r; + byte name[1024]; + int size, percent, r; // read the data size = MSG_ReadShort (net_message); @@ -423,7 +421,7 @@ CL_ParseDownload (void) } 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)) || strstr (newname + strlen (cls.downloadname), "/")) { @@ -476,8 +474,8 @@ CL_ParseDownload (void) MSG_WriteByte (&cls.netchan.message, clc_stringcmd); SZ_Print (&cls.netchan.message, "nextdl"); } else { - char oldn[MAX_OSPATH]; - char newn[MAX_OSPATH]; + char oldn[MAX_OSPATH]; + char newn[MAX_OSPATH]; Qclose (cls.download); VID_SetCaption (va ("Connecting to %s", cls.servername)); @@ -510,13 +508,13 @@ CL_ParseDownload (void) } static byte *upload_data; -static int upload_pos, upload_size; +static int upload_pos, upload_size; void CL_NextUpload (void) { - byte buffer[1024]; - int percent, size, r; + byte buffer[1024]; + int percent, size, r; if (!upload_data) return; @@ -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! @@ -592,10 +590,10 @@ void CL_ClearBaselines (void); // LordHavoc: BIG BUG-FIX! void CL_ParseServerData (void) { - char fn[MAX_OSPATH]; + char fn[MAX_OSPATH]; const char *str; - int protover; - qboolean cflag = false; + int protover; + qboolean cflag = false; extern char gamedirfile[MAX_OSPATH]; @@ -607,12 +605,11 @@ 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))) - Host_Error ("Server returned version %i, not %i\nYou probably " - "need to upgrade.\nCheck http://www.quakeworld.net/", - protover, PROTOCOL_VERSION); + 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); cl.servercount = MSG_ReadLong (net_message); @@ -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; @@ -690,7 +686,7 @@ CL_ParseServerData (void) void CL_ClearBaselines (void) { - int i; + int i; memset (cl_baselines, 0, sizeof (cl_baselines)); for (i = 0; i < MAX_EDICTS; i++) { @@ -706,7 +702,7 @@ void CL_ParseSoundlist (void) { const char *str; - int numsounds, n; + int numsounds, n; // precache sounds // memset (cl.sound_precache, 0, sizeof(cl.sound_precache)); @@ -740,7 +736,7 @@ CL_ParseSoundlist (void) void CL_ParseModellist (void) { - int nummodels, n; + int nummodels, n; const char *str; // precache models and note certain default indexes @@ -813,8 +809,8 @@ CL_ParseBaseline (entity_state_t *es) void CL_ParseStatic (void) { - entity_t *ent; - entity_state_t es; + entity_t *ent; + entity_state_t es; CL_ParseBaseline (&es); @@ -837,8 +833,8 @@ CL_ParseStatic (void) void CL_ParseStaticSound (void) { - int sound_num, vol, atten; - vec3_t org; + int sound_num, vol, atten; + vec3_t org; MSG_ReadCoordV (net_message, org); sound_num = MSG_ReadByte (net_message); @@ -848,14 +844,14 @@ CL_ParseStaticSound (void) S_StaticSound (cl.sound_precache[sound_num], org, vol, atten); } -/* ACTION MESSAGES */ +// ACTION MESSAGES ============================================================ void CL_ParseStartSoundPacket (void) { - float attenuation; - int channel, ent, sound_num, volume; - vec3_t pos; + float attenuation; + int channel, ent, sound_num, volume; + vec3_t pos; channel = MSG_ReadShort (net_message); @@ -891,9 +887,9 @@ CL_ParseStartSoundPacket (void) void CL_ParseClientdata (void) { - float latency; - frame_t *frame; - int i; + float latency; + frame_t *frame; + int i; // calculate simulated time of message oldparsecountmod = parsecountmod; @@ -922,7 +918,7 @@ CL_ParseClientdata (void) void CL_ProcessUserInfo (int slot, player_info_t *player) { - char skin[512]; + char skin[512]; const char *s; s = Info_ValueForKey (player->userinfo, "skin"); @@ -955,10 +951,9 @@ CL_ProcessUserInfo (int slot, player_info_t *player) void CL_UpdateUserinfo (void) { - int slot; - player_info_t *player; - int uid; - const char *info; + int slot, uid; + const char *info; + player_info_t *player; slot = MSG_ReadByte (net_message); if (slot >= MAX_CLIENTS) @@ -984,10 +979,9 @@ CL_UpdateUserinfo (void) void CL_SetInfo (void) { - char key[MAX_MSGLEN], value[MAX_MSGLEN]; - int slot; - int flags; - player_info_t *player; + char key[MAX_MSGLEN], value[MAX_MSGLEN]; + int flags, slot; + player_info_t *player; slot = MSG_ReadByte (net_message); if (slot >= MAX_CLIENTS) @@ -1015,7 +1009,7 @@ CL_SetInfo (void) 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); key[sizeof (key) - 1] = 0; @@ -1041,10 +1035,9 @@ CL_ServerInfo (void) void CL_SetStat (int stat, int value) { - int j; + 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 (); @@ -1069,9 +1062,9 @@ void CL_MuzzleFlash (void) { dlight_t *dl; - int i; + int i; player_state_t *pl; - vec3_t fv, rv, uv; + vec3_t fv, rv, uv; 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); -int received_framecount; +int received_framecount; void Sbar_LogFrags(void); @@ -1109,7 +1102,7 @@ CL_ParseServerMessage (void) { const char *s; static dstring_t *stuffbuf; - int cmd, i, j; + int cmd, i, j; received_framecount = host_framecount; cl.last_servermessage = realtime; @@ -1159,14 +1152,16 @@ CL_ParseServerMessage (void) break; case svc_print: { - char p[2048]; + char p[2048]; + i = MSG_ReadByte (net_message); s = MSG_ReadString (net_message); if (i == PRINT_CHAT) { // TODO: cl_nofake 2 -- accept fake messages from teammates if (cl_nofake->int_val) { - char *c; + 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; @@ -1343,7 +1337,7 @@ CL_ParseServerMessage (void) Con_Printf("svc_finale\n"); cl.intermission = 2; 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)); break; @@ -1354,6 +1348,7 @@ CL_ParseServerMessage (void) case svc_smallkick: cl.punchangle = -2; break; + case svc_bigkick: cl.punchangle = -4; break; @@ -1389,9 +1384,8 @@ 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) & - UPDATE_MASK].receivedtime = -2; + cl.frames[(cls.netchan.incoming_acknowledged - 1 - j) & + UPDATE_MASK].receivedtime = -2; break; case svc_modellist: @@ -1425,7 +1419,6 @@ CL_ParseServerMessage (void) else CDAudio_Resume (); break; - } } diff --git a/qw/source/cl_screen.c b/qw/source/cl_screen.c index b92de3474..07697580c 100644 --- a/qw/source/cl_screen.c +++ b/qw/source/cl_screen.c @@ -70,14 +70,15 @@ SCR_DrawNet (void) void CL_NetStats (void) { - int x, y; + 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"); diff --git a/qw/source/cl_skin.c b/qw/source/cl_skin.c index 9348304fa..73e6161ab 100644 --- a/qw/source/cl_skin.c +++ b/qw/source/cl_skin.c @@ -56,7 +56,6 @@ cvar_t *topcolor; cvar_t *bottomcolor; - void Skin_NextDownload (void) { diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index ef1db122e..6ccb403bb 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -144,7 +144,7 @@ CL_Init_Entity (entity_t *ent) void CL_ClearTEnts (void) { - int i; + int i; memset (&cl_beams, 0, sizeof (cl_beams)); memset (&cl_explosions, 0, sizeof (cl_explosions)); @@ -152,11 +152,11 @@ CL_ClearTEnts (void) int 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++) { - CL_Init_Entity(&cl_explosions[i].ent); + CL_Init_Entity (&cl_explosions[i].ent); } } @@ -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; @@ -370,7 +377,7 @@ CL_ParseTEnt (void) ex->ent.model = cl_spr_explod; break; - case TE_TAREXPLOSION: // tarbaby explosion + case TE_TAREXPLOSION: // tarbaby explosion MSG_ReadCoordV (net_message, pos); R_BlobExplosion (pos); @@ -426,13 +433,13 @@ CL_ParseTEnt (void) 3 + 2] * (1.0 / 255.0); break; - case TE_GUNSHOT: // bullet hitting wall + case TE_GUNSHOT: // bullet hitting wall cnt = MSG_ReadByte (net_message) * 20; MSG_ReadCoordV (net_message, pos); R_GunshotEffect (pos, cnt); break; - case TE_BLOOD: // bullet hitting body + case TE_BLOOD: // bullet hitting body cnt = MSG_ReadByte (net_message) * 20; MSG_ReadCoordV (net_message, pos); R_BloodPuffEffect (pos, cnt);