From eb54acf1408cdd5a4cb79967b0f45624d306d233 Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Sat, 28 Sep 2002 02:33:39 +0000 Subject: [PATCH] Whitespace. --- nq/source/host_cmd.c | 139 ++++++++++++++++++++++--------------------- nq/source/sv_main.c | 80 ++++++++++++------------- qw/source/cl_main.c | 26 ++++---- qw/source/pmove.c | 24 ++++---- 4 files changed, 131 insertions(+), 138 deletions(-) diff --git a/nq/source/host_cmd.c b/nq/source/host_cmd.c index 4453ced01..f2a1fcc28 100644 --- a/nq/source/host_cmd.c +++ b/nq/source/host_cmd.c @@ -1074,88 +1074,93 @@ Host_Give_f (void) case '7': case '8': case '9': - // MED 01/04/97 added hipnotic give stuff - if (hipnotic) { - if (t[0] == '6') { - if (t[1] == 'a') + // MED 01/04/97 added hipnotic give stuff + if (hipnotic) { + if (t[0] == '6') { + if (t[1] == 'a') + SVfloat (sv_player, items) = + (int) SVfloat (sv_player, items) + | HIT_PROXIMITY_GUN; + else + SVfloat (sv_player, items) = + (int) SVfloat (sv_player, items) + | IT_GRENADE_LAUNCHER; + } else if (t[0] == '9') SVfloat (sv_player, items) = - (int) SVfloat (sv_player, items) | HIT_PROXIMITY_GUN; - else + (int) SVfloat (sv_player, items) | HIT_LASER_CANNON; + else if (t[0] == '0') SVfloat (sv_player, items) = - (int) SVfloat (sv_player, items) | IT_GRENADE_LAUNCHER; - } else if (t[0] == '9') - SVfloat (sv_player, items) = - (int) SVfloat (sv_player, items) | HIT_LASER_CANNON; - else if (t[0] == '0') - SVfloat (sv_player, items) = (int) SVfloat (sv_player, items) | HIT_MJOLNIR; - else if (t[0] >= '2') - SVfloat (sv_player, items) = - (int) SVfloat (sv_player, items) | (IT_SHOTGUN << (t[0] - '2')); - } else { - if (t[0] >= '2') - SVfloat (sv_player, items) = - (int) SVfloat (sv_player, items) | (IT_SHOTGUN << (t[0] - '2')); - } - break; + (int) SVfloat (sv_player, items) | HIT_MJOLNIR; + else if (t[0] >= '2') + SVfloat (sv_player, items) = + (int) SVfloat (sv_player, items) + | (IT_SHOTGUN << (t[0] - '2')); + } else { + if (t[0] >= '2') + SVfloat (sv_player, items) = + (int) SVfloat (sv_player, items) + | (IT_SHOTGUN << (t[0] - '2')); + } + break; case 's': - if (rogue) { - SVfloat (sv_player, ammo_shells1) = v; - } + if (rogue) { + SVfloat (sv_player, ammo_shells1) = v; + } - SVfloat (sv_player, ammo_shells) = v; - break; + SVfloat (sv_player, ammo_shells) = v; + break; case 'n': - if (rogue) { - SVfloat (sv_player, ammo_nails1) = v; - if (SVfloat (sv_player, weapon) <= IT_LIGHTNING) + if (rogue) { + SVfloat (sv_player, ammo_nails1) = v; + if (SVfloat (sv_player, weapon) <= IT_LIGHTNING) + SVfloat (sv_player, ammo_nails) = v; + } else { SVfloat (sv_player, ammo_nails) = v; - } else { - SVfloat (sv_player, ammo_nails) = v; - } - break; + } + break; case 'l': - if (rogue) { - SVfloat (sv_player, ammo_lava_nails) = v; - if (SVfloat (sv_player, weapon) > IT_LIGHTNING) - SVfloat (sv_player, ammo_nails) = v; - } - break; + if (rogue) { + SVfloat (sv_player, ammo_lava_nails) = v; + if (SVfloat (sv_player, weapon) > IT_LIGHTNING) + SVfloat (sv_player, ammo_nails) = v; + } + break; case 'r': - if (rogue) { - SVfloat (sv_player, ammo_rockets1) = v; - if (SVfloat (sv_player, weapon) <= IT_LIGHTNING) + if (rogue) { + SVfloat (sv_player, ammo_rockets1) = v; + if (SVfloat (sv_player, weapon) <= IT_LIGHTNING) + SVfloat (sv_player, ammo_rockets) = v; + } else { SVfloat (sv_player, ammo_rockets) = v; - } else { - SVfloat (sv_player, ammo_rockets) = v; - } - break; + } + break; case 'm': - if (rogue) { - SVfloat (sv_player, ammo_multi_rockets) = 0; - if (SVfloat (sv_player, weapon) > IT_LIGHTNING) - SVfloat (sv_player, ammo_rockets) = v; - } - break; + if (rogue) { + SVfloat (sv_player, ammo_multi_rockets) = 0; + if (SVfloat (sv_player, weapon) > IT_LIGHTNING) + SVfloat (sv_player, ammo_rockets) = v; + } + break; case 'h': - SVfloat (sv_player, health) = v; - break; + SVfloat (sv_player, health) = v; + break; case 'c': - if (rogue) { - SVfloat (sv_player, ammo_cells1) = v; - if (SVfloat (sv_player, weapon) <= IT_LIGHTNING) + if (rogue) { + SVfloat (sv_player, ammo_cells1) = v; + if (SVfloat (sv_player, weapon) <= IT_LIGHTNING) + SVfloat (sv_player, ammo_cells) = v; + } else { SVfloat (sv_player, ammo_cells) = v; - } else { - SVfloat (sv_player, ammo_cells) = v; - } - break; + } + break; case 'p': - if (rogue) { - SVfloat (sv_player, ammo_plasma) = v; - if (SVfloat (sv_player, weapon) > IT_LIGHTNING) - SVfloat (sv_player, ammo_cells) = v; - } - break; + if (rogue) { + SVfloat (sv_player, ammo_plasma) = v; + if (SVfloat (sv_player, weapon) > IT_LIGHTNING) + SVfloat (sv_player, ammo_cells) = v; + } + break; } } #endif diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 1e0951fa5..605e6cb74 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -182,7 +182,7 @@ void SV_SendServerinfo (client_t *client) { const char **s; - char message[2048]; + char message[2048]; MSG_WriteByte (&client->message, svc_print); snprintf (message, sizeof (message), "%c\nVersion %s server (%i CRC)", 2, @@ -392,8 +392,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) ent = NEXT_EDICT (&sv_pr_state, sv.edicts); for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) { // ignore if not touching a PV leaf - if (ent != clent) // clent is ALLWAYS sent - { + if (ent != clent) { // clent is ALLWAYS sent // ignore ents without visible models if (!SVfloat (ent, modelindex) || !*PR_GetString (&sv_pr_state, SVstring (ent, model))) @@ -500,11 +499,9 @@ SV_CleanupEnts (void) edict_t *ent; ent = NEXT_EDICT (&sv_pr_state, sv.edicts); - for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) { - SVfloat (ent, effects) = (int) SVfloat (ent, effects) & - ~EF_MUZZLEFLASH; - } - + for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) + SVfloat (ent, effects) = (int) SVfloat (ent, effects) + & ~EF_MUZZLEFLASH; } void @@ -596,7 +593,7 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) MSG_WriteByte (msg, SVvector (ent, velocity)[i] / 16); } - // [always sent] if (bits & SU_ITEMS) +// if (bits & SU_ITEMS) // [always sent] MSG_WriteLong (msg, items); if (bits & SU_WEAPONFRAME) @@ -604,9 +601,8 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) if (bits & SU_ARMOR) MSG_WriteByte (msg, SVfloat (ent, armorvalue)); if (bits & SU_WEAPON) - MSG_WriteByte (msg, - SV_ModelIndex (PR_GetString (&sv_pr_state, SVstring - (ent, weaponmodel)))); + MSG_WriteByte (msg, SV_ModelIndex (PR_GetString (&sv_pr_state, SVstring + (ent, weaponmodel)))); MSG_WriteShort (msg, SVfloat (ent, health)); MSG_WriteByte (msg, SVfloat (ent, currentammo)); @@ -667,7 +663,8 @@ SV_UpdateToReliableMessages (void) // check for changes to be sent over the reliable streams for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++) { - if (host_client->old_frags != (int) SVfloat (host_client->edict, frags)) { + if (host_client->old_frags != (int) SVfloat (host_client->edict, + frags)) { for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) { if (!client->active) @@ -733,12 +730,11 @@ SV_SendClientMessages (void) if (!SV_SendClientDatagram (host_client)) continue; } else { - // the player isn't totally in the game yet - // send small keepalive messages if too much time has passed - // send a full message when the next signon stage has been - // requested - // some other message data (name changes, etc) may accumulate - // between signon stages + // The player isn't totally in the game yet + // Send small keepalive messages if too much time has passed + // Send a full message when the next signon stage has been + // requested; some other message data (name changes, etc) may + // accumulate between signon stages if (!host_client->sendsignon) { if (realtime - host_client->last_message > 5) SV_SendNop (host_client); @@ -746,9 +742,8 @@ SV_SendClientMessages (void) } } - // check for an overflowed message. Should only happen - // on a very fucked up connection that backs up a lot, then - // changes level + // check for an overflowed message. Should only happen on a very + // fucked up connection that backs up a lot, then changes level if (host_client->message.overflowed) { SV_DropClient (true); host_client->message.overflowed = false; @@ -813,34 +808,35 @@ SV_CreateBaseline (void) // create entity baseline VectorCopy (SVvector (svent, origin), - ((entity_state_t*)svent->data)->origin); + ((entity_state_t *) svent->data)->origin); VectorCopy (SVvector (svent, angles), - ((entity_state_t*)svent->data)->angles); - ((entity_state_t*)svent->data)->frame = SVfloat (svent, frame); - ((entity_state_t*)svent->data)->skin = SVfloat (svent, skin); + ((entity_state_t *) svent->data)->angles); + ((entity_state_t *) svent->data)->frame = SVfloat (svent, frame); + ((entity_state_t *) svent->data)->skin = SVfloat (svent, skin); if (entnum > 0 && entnum <= svs.maxclients) { - ((entity_state_t*)svent->data)->colormap = entnum; - ((entity_state_t*)svent->data)->modelindex = SV_ModelIndex + ((entity_state_t *) svent->data)->colormap = entnum; + ((entity_state_t *) svent->data)->modelindex = SV_ModelIndex ("progs/player.mdl"); } else { - ((entity_state_t*)svent->data)->colormap = 0; - ((entity_state_t*)svent->data)->modelindex = - SV_ModelIndex (PR_GetString (&sv_pr_state,SVstring (svent, - model))); + ((entity_state_t *) svent->data)->colormap = 0; + ((entity_state_t *) svent->data)->modelindex = + SV_ModelIndex (PR_GetString (&sv_pr_state, SVstring (svent, + model))); } // add to the message MSG_WriteByte (&sv.signon, svc_spawnbaseline); MSG_WriteShort (&sv.signon, entnum); - MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->modelindex); - MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->frame); - MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->colormap); - MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->skin); + MSG_WriteByte (&sv.signon, + ((entity_state_t *) svent->data)->modelindex); + MSG_WriteByte (&sv.signon, ((entity_state_t *) svent->data)->frame); + MSG_WriteByte (&sv.signon, ((entity_state_t *) svent->data)->colormap); + MSG_WriteByte (&sv.signon, ((entity_state_t *) svent->data)->skin); MSG_WriteCoordAngleV (&sv.signon, - ((entity_state_t*)svent->data)->origin, - ((entity_state_t*)svent->data)->angles); + ((entity_state_t *) svent->data)->origin, + ((entity_state_t *) svent->data)->angles); } } @@ -890,12 +886,10 @@ SV_SaveSpawnparms (void) EDICT_TO_PROG (&sv_pr_state, host_client->edict); PR_ExecuteProgram (&sv_pr_state, sv_funcs.SetChangeParms); for (j = 0; j < NUM_SPAWN_PARMS; j++) - host_client->spawn_parms[j] = - sv_globals.parms[j]; + host_client->spawn_parms[j] = sv_globals.parms[j]; } } - /* SV_SpawnServer @@ -1031,8 +1025,8 @@ SV_SpawnServer (const char *server) SV_CreateBaseline (); // send serverinfo to all connected clients - for (i = 0, host_client = svs.clients; i < svs.maxclients; - i++, host_client++) + for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, + host_client++) if (host_client->active) SV_SendServerinfo (host_client); diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 5bf3ec386..6fc0d20a5 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -223,13 +223,11 @@ char prespawn_name[] = "prespawn %i 0 %i"; char modellist_name[] = "modellist %i %i"; char soundlist_name[] = "soundlist %i %i"; - void CL_RSShot_f (void); extern cvar_t *cl_showscoresuid; - void CL_Sbar_f (cvar_t *var) { @@ -265,8 +263,8 @@ CL_SendConnectPacket (void) double t1, t2; // JACK: Fixed bug where DNS lookups would cause two connects real fast -// Now, adds lookup time to the connect time. -// Should I add it to realtime instead?!?! +// Now, adds lookup time to the connect time. +// Should I add it to realtime instead?!?! if (cls.state != ca_disconnected) return; @@ -375,10 +373,8 @@ CL_Rcon_f (void) to = cls.netchan.remote_address; else { if (!rcon_address->string[0]) { - Con_Printf ("You must either be connected, " - "or set the 'rcon_address' cvar " - "to issue rcon commands\n"); - + Con_Printf ("You must either be connected, or set the " + "'rcon_address' cvar to issue rcon commands\n"); return; } NET_StringToAdr (rcon_address->string, &to); @@ -586,7 +582,7 @@ CL_FullServerinfo_f (void) server_version = strdup (p); } else if ((p = Info_ValueForKey (cl.serverinfo, "*version")) && *p) { if (server_version == NULL) - Con_Printf ("QaukeWorld v%s Server\n", p); + Con_Printf ("QuakeWorld v%s Server\n", p); server_version = strdup (p); } @@ -1245,10 +1241,10 @@ CL_Init (void) // forward to server commands Cmd_AddCommand ("kill", CL_Cmd_ForwardToServer, "Suicide :)"); Cmd_AddCommand ("pause", CL_Cmd_ForwardToServer, "Pause the game"); - Cmd_AddCommand ("say", CL_Cmd_ForwardToServer, "Say something to all other " - "players"); - Cmd_AddCommand ("say_team", CL_Cmd_ForwardToServer, "Say something only to " - "people on your team"); + Cmd_AddCommand ("say", CL_Cmd_ForwardToServer, "Say something to all " + "other players"); + Cmd_AddCommand ("say_team", CL_Cmd_ForwardToServer, "Say something only " + "to people on your team"); Cmd_AddCommand ("serverinfo", CL_Cmd_ForwardToServer, "Report the current " "server info"); } @@ -1522,7 +1518,7 @@ Host_Frame (float time) if ((sleeptime = Host_SimulationTime (time)) != 0) { #ifdef HAVE_USLEEP if (cl_usleep_cache && sleeptime > 0.002) // minimum sleep time - usleep ((unsigned long)(sleeptime * 1000000 / 2)); + usleep ((unsigned long) (sleeptime * 1000000 / 2)); #endif return; // framerate is too high } @@ -1687,7 +1683,7 @@ Host_Init (void) // only reads from within the quake file system, and changing that is // probably Not A Good Thing (tm). fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG, CVAR_ROM, NULL, - "global configuration file"); + "global configuration file"); Cmd_Exec_File (cl_cbuf, fs_globalcfg->string); Cbuf_Execute_Sets (cl_cbuf); diff --git a/qw/source/pmove.c b/qw/source/pmove.c index 1a53d12bc..4ff5a26bb 100644 --- a/qw/source/pmove.c +++ b/qw/source/pmove.c @@ -108,13 +108,13 @@ PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) return blocked; } +#define MAX_CLIP_PLANES 5 + /* PM_FlyMove The basic solid body movement clip that slides along multiple planes */ -#define MAX_CLIP_PLANES 5 - int PM_FlyMove (void) { @@ -240,8 +240,7 @@ PM_FlymodeMove (void) VectorCopy (pmvel, pmtmp); pmspeed = VectorNormalize (pmtmp); // don't alter pmvel - if (pmspeed > movevars.maxspeed) // there IS a spoon, Neo.. - { + if (pmspeed > movevars.maxspeed) { // there IS a spoon, Neo.. VectorScale (pmvel, movevars.maxspeed / pmspeed, pmvel); pmspeed = movevars.maxspeed; } @@ -306,9 +305,8 @@ PM_GroundMove (void) VectorCopy (pmove.origin, dest); dest[2] += STEPSIZE; trace = PM_PlayerMove (pmove.origin, dest); - if (!trace.startsolid && !trace.allsolid) { + if (!trace.startsolid && !trace.allsolid) VectorCopy (trace.endpos, pmove.origin); - } // slide move PM_FlyMove (); @@ -318,9 +316,8 @@ PM_GroundMove (void) trace = PM_PlayerMove (pmove.origin, dest); if (trace.plane.normal[2] < 0.7) goto usedown; - if (!trace.startsolid && !trace.allsolid) { + if (!trace.startsolid && !trace.allsolid) VectorCopy (trace.endpos, pmove.origin); - } VectorCopy (pmove.origin, up); // decide which one went farther @@ -487,8 +484,8 @@ PM_WaterMove (void) VectorCopy (dest, start); start[2] += STEPSIZE + 1; trace = PM_PlayerMove (start, dest); - if (!trace.startsolid && !trace.allsolid) // FIXME: check steep slope? - { // walked up the step + if (!trace.startsolid && !trace.allsolid) { // FIXME: check steep slope? + // walked up the step VectorCopy (trace.endpos, pmove.origin); return; } @@ -544,9 +541,9 @@ PM_AirMove (void) if (!PM_FlyMove ()) { // the move didn't get blocked PM_CategorizePosition (); - if (onground != -1) // but we're on ground now - { + if (onground != -1) { // but we're on ground now vec3_t original; + // This is a hack to fix the jumping bug VectorCopy (pmove.origin, original); // Calculate correct velocity @@ -750,7 +747,7 @@ SpectatorMove (void) speed = sqrt (speed); drop = 0; - friction = movevars.friction * 1.5; // extra friction + friction = movevars.friction * 1.5; // extra friction control = speed < movevars.stopspeed ? movevars.stopspeed : speed; drop += control * friction * frametime; @@ -831,6 +828,7 @@ PlayerMove (void) && onground != -1 && pmove.oldonground == -1 // just landed && no_pogo_stick->int_val & 2) { float save = movevars.friction; + pmove.waterjumptime = 0; movevars.friction *= 3; PM_Friction ();