diff --git a/include/QF/msg.h b/include/QF/msg.h index 59f350453..5713a04d5 100644 --- a/include/QF/msg.h +++ b/include/QF/msg.h @@ -36,9 +36,12 @@ void MSG_WriteShort (sizebuf_t *sb, unsigned int c); void MSG_WriteLong (sizebuf_t *sb, unsigned int c); void MSG_WriteFloat (sizebuf_t *sb, float f); void MSG_WriteString (sizebuf_t *sb, const char *s); -void MSG_WriteCoord (sizebuf_t *sb, float f); -void MSG_WriteAngle (sizebuf_t *sb, float f); -void MSG_WriteAngle16 (sizebuf_t *sb, float f); +void MSG_WriteCoord (sizebuf_t *sb, float coord); +void MSG_WriteCoordV (sizebuf_t *sb, vec3_t coord); +void MSG_WriteCoordAngleV (sizebuf_t *sb, vec3_t coord, vec3_t angles); +void MSG_WriteAngle (sizebuf_t *sb, float angle); +void MSG_WriteAngleV (sizebuf_t *sb, vec3_t angles); +void MSG_WriteAngle16 (sizebuf_t *sb, float angle16); typedef struct msg_s { int readcount; @@ -59,8 +62,10 @@ const char *MSG_ReadString (msg_t *msg); const char *MSG_ReadStringLine (msg_t *msg); float MSG_ReadCoord (msg_t *msg); -void MSG_ReadCoord3 (msg_t *msg, vec3_t coord); +void MSG_ReadCoordV (msg_t *msg, vec3_t coord); float MSG_ReadAngle (msg_t *msg); +void MSG_ReadCoordAngleV (msg_t *msg, vec3_t coord, vec3_t angles); +void MSG_ReadAngleV (msg_t *msg, vec3_t angles); float MSG_ReadAngle16 (msg_t *msg); #endif diff --git a/libs/util/msg.c b/libs/util/msg.c index d4e0baf84..8ad8edd36 100644 --- a/libs/util/msg.c +++ b/libs/util/msg.c @@ -116,21 +116,50 @@ MSG_WriteString (sizebuf_t *sb, const char *s) } void -MSG_WriteCoord (sizebuf_t *sb, float f) +MSG_WriteCoord (sizebuf_t *sb, float coord) { - MSG_WriteShort (sb, (unsigned int) (f * 8.0)); + MSG_WriteShort (sb, (unsigned int) (coord * 8.0)); } void -MSG_WriteAngle (sizebuf_t *sb, float f) +MSG_WriteCoordV (sizebuf_t *sb, vec3_t coord) { - MSG_WriteByte (sb, (unsigned int) (f * 256 / 360) & 255); + int i; + + for (i = 0; i < 3; i++) + MSG_WriteShort (sb, (unsigned int) (coord[i] * 8.0)); } void -MSG_WriteAngle16 (sizebuf_t *sb, float f) +MSG_WriteCoordAngleV (sizebuf_t *sb, vec3_t coord, vec3_t angles) { - MSG_WriteShort (sb, (unsigned int) (f * 65536 / 360) & 65535); + int i; + + for (i = 0; i < 3; i++) { + MSG_WriteShort (sb, (unsigned int) (coord[i] * 8.0)); + MSG_WriteByte (sb, (unsigned int) (angles[i] * 256 / 360) & 255); + } +} + +void +MSG_WriteAngle (sizebuf_t *sb, float angle) +{ + MSG_WriteByte (sb, (unsigned int) (angle * 256 / 360) & 255); +} + +void +MSG_WriteAngleV (sizebuf_t *sb, vec3_t angles) +{ + int i; + + for (i = 0; i < 3; i++) + MSG_WriteByte (sb, (unsigned int) (angles[i] * 256 / 360) & 255); +} + +void +MSG_WriteAngle16 (sizebuf_t *sb, float angle16) +{ + MSG_WriteShort (sb, (unsigned int) (angle16 * 65536 / 360) & 65535); } @@ -272,11 +301,23 @@ MSG_ReadCoord (msg_t *msg) } void -MSG_ReadCoord3 (msg_t *msg, vec3_t coord) +MSG_ReadCoordV (msg_t *msg, vec3_t coord) { - coord[0] = MSG_ReadShort (msg) * (1.0 / 8.0); - coord[1] = MSG_ReadShort (msg) * (1.0 / 8.0); - coord[2] = MSG_ReadShort (msg) * (1.0 / 8.0); + int i; + + for (i = 0; i < 3; i++) + coord[i] = MSG_ReadShort (msg) * (1.0 / 8.0); +} + +void +MSG_ReadCoordAngleV (msg_t *msg, vec3_t coord, vec3_t angles) +{ + int i; + + for (i = 0; i < 3; i++) { + coord[i] = MSG_ReadShort (msg) * (1.0 / 8.0); + angles[i] = MSG_ReadChar (msg) * (360.0 / 256.0); + } } float @@ -285,6 +326,15 @@ MSG_ReadAngle (msg_t *msg) return MSG_ReadChar (msg) * (360.0 / 256.0); } +void +MSG_ReadAngleV (msg_t *msg, vec3_t angles) +{ + int i; + + for (i = 0; i < 3; i++) + angles[i] = MSG_ReadChar (msg) * (360.0 / 256.0); +} + float MSG_ReadAngle16 (msg_t *msg) { diff --git a/nq/source/cl_input.c b/nq/source/cl_input.c index a7b616d78..b0fe9d4c8 100644 --- a/nq/source/cl_input.c +++ b/nq/source/cl_input.c @@ -540,7 +540,7 @@ void CL_SendMove (usercmd_t *cmd) { byte data[128]; - int bits, i; + int bits; sizebuf_t buf; buf.maxsize = 128; @@ -554,8 +554,7 @@ CL_SendMove (usercmd_t *cmd) MSG_WriteFloat (&buf, cl.mtime[0]); // so server can get ping times - for (i = 0; i < 3; i++) - MSG_WriteAngle (&buf, cl.viewangles[i]); + MSG_WriteAngleV (&buf, cl.viewangles); MSG_WriteShort (&buf, cmd->forwardmove); MSG_WriteShort (&buf, cmd->sidemove); diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index 3386b07bc..1effe18f6 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -151,7 +151,7 @@ CL_ParseStartSoundPacket (void) if (ent > MAX_EDICTS) Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent); - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume / 255.0, attenuation); @@ -484,18 +484,15 @@ CL_ParseUpdate (int bits) void CL_ParseBaseline (cl_entity_state_t *state) { - int i; - state->baseline.modelindex = MSG_ReadByte (net_message); state->baseline.frame = MSG_ReadByte (net_message); state->baseline.colormap = MSG_ReadByte (net_message); state->baseline.skin = MSG_ReadByte (net_message); - for (i = 0; i < 3; i++) { - state->baseline.origin[i] = MSG_ReadCoord (net_message); - state->baseline.angles[i] = MSG_ReadAngle (net_message); - } - // LordHavoc: set up the baseline to account for new effects (alpha, - // colormod, etc) + + MSG_ReadCoordAngleV (net_message, state->baseline.origin, + state->baseline.angles); + + // LordHavoc: set up baseline for new effects (alpha, colormod, etc) state->baseline.alpha = 255; state->baseline.scale = 16; state->baseline.glow_color = 254; @@ -646,7 +643,7 @@ CL_ParseStaticSound (void) int sound_num, vol, atten; vec3_t org; - MSG_ReadCoord3 (net_message, org); + MSG_ReadCoordV (net_message, org); sound_num = MSG_ReadByte (net_message); vol = MSG_ReadByte (net_message); atten = MSG_ReadByte (net_message); @@ -746,8 +743,7 @@ CL_ParseServerMessage (void) break; case svc_setangle: - for (i = 0; i < 3; i++) - cl.viewangles[i] = MSG_ReadAngle (net_message); + MSG_ReadAngleV (net_message, cl.viewangles); break; case svc_setview: @@ -778,7 +774,7 @@ CL_ParseServerMessage (void) if (i >= cl.maxclients) Host_Error ("CL_ParseServerMessage: svc_updatename > " "MAX_SCOREBOARD"); - strcpy (cl.scores[i].name, MSG_ReadString (net_message)); + strcpy (cl.scores[i].name, MSG_ReadString (net_message)); break; case svc_updatefrags: diff --git a/nq/source/cl_tent.c b/nq/source/cl_tent.c index a7d29f1ba..3a2c50b85 100644 --- a/nq/source/cl_tent.c +++ b/nq/source/cl_tent.c @@ -186,8 +186,8 @@ CL_ParseBeam (model_t *m) ent = MSG_ReadShort (net_message); - MSG_ReadCoord3 (net_message, start); - MSG_ReadCoord3 (net_message, end); + MSG_ReadCoordV (net_message, start); + MSG_ReadCoordV (net_message, end); // override any beam with the same entity for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) @@ -233,19 +233,19 @@ CL_ParseTEnt (void) } switch (type) { case TE_WIZSPIKE: // spike hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_WizSpikeEffect (pos); S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1); break; case TE_KNIGHTSPIKE: // spike hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_KnightSpikeEffect (pos); S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1); break; case TE_SPIKE: // spike hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_SpikeEffect (pos); if (rand () % 5) @@ -262,7 +262,7 @@ CL_ParseTEnt (void) break; case TE_SUPERSPIKE: // super spike hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_SuperSpikeEffect (pos); if (rand () % 5) @@ -280,7 +280,7 @@ CL_ParseTEnt (void) case TE_EXPLOSION: // rocket explosion // particles - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_ParticleExplosion (pos); // light @@ -304,7 +304,7 @@ CL_ParseTEnt (void) break; case TE_TAREXPLOSION: // tarbaby explosion - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_BlobExplosion (pos); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); @@ -329,17 +329,17 @@ CL_ParseTEnt (void) // PGM 01/21/97 case TE_LAVASPLASH: - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_LavaSplash (pos); break; case TE_TELEPORT: - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_TeleportSplash (pos); break; case TE_EXPLOSION2: // color mapped explosion - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); colorStart = MSG_ReadByte (net_message); colorLength = MSG_ReadByte (net_message); R_ParticleExplosion2 (pos, colorStart, colorLength); @@ -358,18 +358,18 @@ CL_ParseTEnt (void) break; case TE_GUNSHOT: // bullet hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_GunshotEffect (pos, 20); break; case TE_BLOOD: // bullet hitting body cnt = MSG_ReadByte (net_message) * 20; - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_BloodPuffEffect (pos, cnt); break; case TE_LIGHTNINGBLOOD: // lightning hitting body - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); // light dl = R_AllocDlight (0); @@ -490,7 +490,7 @@ CL_ParseParticleEffect (void) int i, count, color; vec3_t org, dir; - MSG_ReadCoord3 (net_message, org); + MSG_ReadCoordV (net_message, org); for (i = 0; i < 3; i++) dir[i] = MSG_ReadChar (net_message) * (15.0 / 16.0); count = MSG_ReadByte (net_message); diff --git a/nq/source/cl_view.c b/nq/source/cl_view.c index b13a26642..2cef1f25e 100644 --- a/nq/source/cl_view.c +++ b/nq/source/cl_view.c @@ -216,7 +216,7 @@ V_ParseDamage (void) armor = MSG_ReadByte (net_message); blood = MSG_ReadByte (net_message); - MSG_ReadCoord3 (net_message, from); + MSG_ReadCoordV (net_message, from); count = blood * 0.5 + armor * 0.5; if (count < 10) diff --git a/nq/source/host_cmd.c b/nq/source/host_cmd.c index ca042478a..d3e97bb43 100644 --- a/nq/source/host_cmd.c +++ b/nq/source/host_cmd.c @@ -52,11 +52,6 @@ int current_skill; void Mod_Print (void); -/* -================== -Host_Quit_f -================== -*/ void Host_Quit_f (void) @@ -71,12 +66,6 @@ Host_Quit_f (void) Sys_Quit (); } - -/* -================== -Host_Status_f -================== -*/ void Host_Status_f (void) { @@ -125,11 +114,9 @@ Host_Status_f (void) /* -================== -Host_God_f + Host_God_f -Sets client to godmode -================== + Sets client to godmode */ void Host_God_f (void) @@ -160,7 +147,8 @@ Host_Notarget_f (void) if (*sv_globals.deathmatch && !host_client->privileged) return; - SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^ FL_NOTARGET; + SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^ + FL_NOTARGET; if (!((int) SVfloat (sv_player, flags) & FL_NOTARGET)) SV_ClientPrintf ("notarget OFF\n"); else @@ -192,11 +180,9 @@ Host_Noclip_f (void) } /* -================== -Host_Fly_f + Host_Fly_f -Sets client to flymode -================== + Sets client to flymode */ void Host_Fly_f (void) @@ -218,13 +204,6 @@ Host_Fly_f (void) } } - -/* -================== -Host_Ping_f - -================== -*/ void Host_Ping_f (void) { @@ -249,23 +228,14 @@ Host_Ping_f (void) } } -/* -=============================================================================== - -SERVER TRANSITIONS - -=============================================================================== -*/ - +// SERVER TRANSITIONS ========================================================= /* -====================== -Host_Map_f + Host_Map_f -handle a -map -command from the console. Active clients are kicked off. -====================== + handle a + map + command from the console. Active clients are kicked off. */ void Host_Map_f (void) @@ -315,11 +285,9 @@ Host_Map_f (void) } /* -================== -Host_Changelevel_f + Host_Changelevel_f -Goes to a new map, taking all clients along -================== + Goes to a new map, taking all clients along */ void Host_Changelevel_f (void) @@ -327,7 +295,8 @@ Host_Changelevel_f (void) char level[MAX_QPATH]; if (Cmd_Argc () != 2) { - Con_Printf ("changelevel : continue game on a new level\n"); + Con_Printf ("changelevel : continue game on a new " + "level\n"); return; } if (!sv.active || cls.demoplayback) { @@ -340,11 +309,9 @@ Host_Changelevel_f (void) } /* -================== -Host_Restart_f + Host_Restart_f -Restarts the current server for a dead player -================== + Restarts the current server for a dead player */ void Host_Restart_f (void) @@ -357,18 +324,15 @@ Host_Restart_f (void) if (cmd_source != src_command) return; strcpy (mapname, sv.name); // must copy out, because it gets - // cleared - // in sv_spawnserver + // cleared in sv_spawnserver SV_SpawnServer (mapname); } /* -================== -Host_Reconnect_f + Host_Reconnect_f -This command causes the client to wait for the signon messages again. -This is sent just before a server changes levels -================== + This command causes the client to wait for the signon messages again. + This is sent just before a server changes levels */ void Host_Reconnect_f (void) @@ -378,11 +342,9 @@ Host_Reconnect_f (void) } /* -===================== -Host_Connect_f + Host_Connect_f -User command to connect to server -===================== + User command to connect to server */ void Host_Connect_f (void) @@ -399,23 +361,14 @@ Host_Connect_f (void) Host_Reconnect_f (); } - -/* -=============================================================================== - -LOAD / SAVE GAME - -=============================================================================== -*/ +// LOAD / SAVE GAME =========================================================== #define SAVEGAME_VERSION 5 /* -=============== -Host_SavegameComment + Host_SavegameComment -Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current -=============== + Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current */ void Host_SavegameComment (char *text) @@ -429,19 +382,13 @@ Host_SavegameComment (char *text) snprintf (kills, sizeof (kills), "kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]); memcpy (text + 22, kills, strlen (kills)); -// convert space to _ to make stdio happy + // convert space to _ to make stdio happy for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++) if (text[i] == ' ') text[i] = '_'; text[SAVEGAME_COMMENT_LENGTH] = '\0'; } - -/* -=============== -Host_Savegame_f -=============== -*/ void Host_Savegame_f (void) { @@ -479,7 +426,8 @@ Host_Savegame_f (void) } for (i = 0; i < svs.maxclients; i++) { - if (svs.clients[i].active && (SVfloat (svs.clients[i].edict, health) <= 0)) { + if (svs.clients[i].active && (SVfloat (svs.clients[i].edict, health) + <= 0)) { Con_Printf ("Can't savegame with a dead player\n"); return; } @@ -504,8 +452,7 @@ Host_Savegame_f (void) Qprintf (f, "%s\n", sv.name); Qprintf (f, "%f\n", sv.time); -// write the light styles - + // write the light styles for (i = 0; i < MAX_LIGHTSTYLES; i++) { if (sv.lightstyles[i]) Qprintf (f, "%s\n", sv.lightstyles[i]); @@ -523,12 +470,6 @@ Host_Savegame_f (void) Con_Printf ("done.\n"); } - -/* -=============== -Host_Loadgame_f -=============== -*/ void Host_Loadgame_f (void) { @@ -558,8 +499,8 @@ Host_Loadgame_f (void) snprintf (name, sizeof (name), "%s/%s", com_gamedir, Cmd_Argv (1)); COM_DefaultExtension (name, ".sav"); -// we can't call SCR_BeginLoadingPlaque, because too much stack space has -// been used. The menu calls it before stuffing loadgame command + // we can't call SCR_BeginLoadingPlaque, because too much stack space has + // been used. The menu calls it before stuffing loadgame command // SCR_BeginLoadingPlaque (); Con_Printf ("Loading game from %s...\n", name); @@ -583,7 +524,8 @@ Host_Loadgame_f (void) Qgets (f, buf, sizeof (buf)); sscanf (buf, "%f\n", &spawn_parms[i]); } -// this silliness is so we can load 1.06 save files, which have float skill values + // this silliness is so we can load 1.06 save files, which have float skill + // values Qgets (f, buf, sizeof (buf)); sscanf (buf, "%f\n", &tfloat); current_skill = (int) (tfloat + 0.1); @@ -604,8 +546,7 @@ Host_Loadgame_f (void) sv.paused = true; // pause until all clients connect sv.loadgame = true; -// load the light styles - + // load the light styles for (i = 0; i < MAX_LIGHTSTYLES; i++) { Qgets (f, buf, sizeof (buf)); sscanf (buf, "%s\n", str); @@ -613,7 +554,7 @@ Host_Loadgame_f (void) strcpy (sv.lightstyles[i], str); } -// load the edicts out of the savegame file + // load the edicts out of the savegame file entnum = -1; // -1 is the globals while (!Qeof (f)) { for (i = 0; i < sizeof (str) - 1; i++) { @@ -667,14 +608,8 @@ Host_Loadgame_f (void) } } - //============================================================================ -/* -====================== -Host_Name_f -====================== -*/ void Host_Name_f (void) { @@ -705,14 +640,12 @@ Host_Name_f (void) SVstring (host_client->edict, netname) = PR_SetString (&sv_pr_state, host_client->name); -// send notification to all clients - + // send notification to all clients MSG_WriteByte (&sv.reliable_datagram, svc_updatename); MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); MSG_WriteString (&sv.reliable_datagram, host_client->name); } - void Host_Version_f (void) { @@ -747,12 +680,12 @@ Host_Say (qboolean teamonly) p = Hunk_TempAlloc (strlen(Cmd_Args (1)) + 1); strcpy (p, Cmd_Args (1)); -// remove quotes if present + // remove quotes if present if (*p == '"') { p++; p[strlen (p) - 1] = 0; } -// turn on color set 1 + // turn on color set 1 if (!fromServer) snprintf (text, sizeof (text), "%c%s: ", 1, save->name); else @@ -768,8 +701,9 @@ Host_Say (qboolean teamonly) for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) { if (!client || !client->active || !client->spawned) continue; - if (teamplay->int_val && teamonly - && SVfloat (client->edict, team) != SVfloat (save->edict, team)) continue; + if (teamplay->int_val && teamonly && SVfloat (client->edict, team) != + SVfloat (save->edict, team)) + continue; host_client = client; SV_ClientPrintf ("%s", text); } @@ -778,21 +712,18 @@ Host_Say (qboolean teamonly) Con_Printf ("%s", &text[1]); } - void Host_Say_f (void) { Host_Say (false); } - void Host_Say_Team_f (void) { Host_Say (true); } - void Host_Tell_f (void) { @@ -816,12 +747,12 @@ Host_Tell_f (void) p = Hunk_TempAlloc (strlen(Cmd_Args (1)) + 1); strcpy (p, Cmd_Args (1)); -// remove quotes if present + // remove quotes if present if (*p == '"') { p++; p[strlen (p) - 1] = 0; } -// check length & truncate if necessary + // check length & truncate if necessary j = sizeof (text) - 2 - strlen (text); // -2 for /n and null terminator if (strlen (p) > j) p[j] = 0; @@ -842,11 +773,6 @@ Host_Tell_f (void) host_client = save; } -/* -================== -Host_Kill_f -================== -*/ void Host_Kill_f (void) { @@ -861,17 +787,10 @@ Host_Kill_f (void) } *sv_globals.time = sv.time; - *sv_globals.self = - EDICT_TO_PROG (&sv_pr_state, sv_player); + *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, sv_player); PR_ExecuteProgram (&sv_pr_state, sv_funcs.ClientKill); } - -/* -================== -Host_Pause_f -================== -*/ void Host_Pause_f (void) { @@ -887,10 +806,12 @@ Host_Pause_f (void) if (sv.paused) { SV_BroadcastPrintf ("%s paused the game\n", - PR_GetString (&sv_pr_state, SVstring (sv_player, netname))); + PR_GetString (&sv_pr_state, + SVstring (sv_player, netname))); } else { SV_BroadcastPrintf ("%s unpaused the game\n", - PR_GetString (&sv_pr_state, SVstring (sv_player, netname))); + PR_GetString (&sv_pr_state, + SVstring (sv_player, netname))); } // send notification to all clients @@ -901,12 +822,6 @@ Host_Pause_f (void) //=========================================================================== - -/* -================== -Host_PreSpawn_f -================== -*/ void Host_PreSpawn_f (void) { @@ -926,11 +841,6 @@ Host_PreSpawn_f (void) host_client->sendsignon = true; } -/* -================== -Host_Spawn_f -================== -*/ void Host_Spawn_f (void) { @@ -947,45 +857,36 @@ Host_Spawn_f (void) Con_Printf ("Spawn not valid -- already spawned\n"); return; } -// run the entrance script - if (sv.loadgame) { // loaded games are fully inited - // already + // run the entrance script + if (sv.loadgame) { // loaded games are fully inited already // if this is the last client to be connected, unpause sv.paused = false; } else { // set up the edict ent = host_client->edict; - memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4); SVfloat (ent, colormap) = NUM_FOR_EDICT (&sv_pr_state, ent); SVfloat (ent, team) = (host_client->colors & 15) + 1; - SVstring (ent, netname) = PR_SetString (&sv_pr_state, host_client->name); + SVstring (ent, netname) = PR_SetString (&sv_pr_state, + host_client->name); // copy spawn parms out of the client_t - for (i = 0; i < NUM_SPAWN_PARMS; i++) sv_globals.parms[i] = host_client->spawn_parms[i]; // call the spawn function - *sv_globals.time = sv.time; - *sv_globals.self = - EDICT_TO_PROG (&sv_pr_state, sv_player); - PR_ExecuteProgram (&sv_pr_state, - sv_funcs.ClientConnect); - + *sv_globals.self = EDICT_TO_PROG (&sv_pr_state, sv_player); + PR_ExecuteProgram (&sv_pr_state, sv_funcs.ClientConnect); if ((Sys_DoubleTime () - host_client->netconnection->connecttime) <= sv.time) Con_Printf ("%s entered the game\n", host_client->name); - - PR_ExecuteProgram (&sv_pr_state, - sv_funcs.PutClientInServer); + PR_ExecuteProgram (&sv_pr_state, sv_funcs.PutClientInServer); } - -// send all current names, colors, and frag counts + // send all current names, colors, and frag counts SZ_Clear (&host_client->message); -// send time of update + // send time of update MSG_WriteByte (&host_client->message, svc_time); MSG_WriteFloat (&host_client->message, sv.time); @@ -1001,16 +902,14 @@ Host_Spawn_f (void) MSG_WriteByte (&host_client->message, client->colors); } -// send all current light styles + // send all current light styles for (i = 0; i < MAX_LIGHTSTYLES; i++) { MSG_WriteByte (&host_client->message, svc_lightstyle); MSG_WriteByte (&host_client->message, (char) i); MSG_WriteString (&host_client->message, sv.lightstyles[i]); } -// -// send some stats -// + // send some stats MSG_WriteByte (&host_client->message, svc_updatestat); MSG_WriteByte (&host_client->message, STAT_TOTALSECRETS); MSG_WriteLong (&host_client->message, @@ -1031,17 +930,15 @@ Host_Spawn_f (void) MSG_WriteLong (&host_client->message, *sv_globals.killed_monsters); - -// -// send a fixangle -// Never send a roll angle, because savegames can catch the server -// in a state where it is expecting the client to correct the angle -// and it won't happen if the game was just loaded, so you wind up -// with a permanent head tilt + // send a fixangle + // Never send a roll angle, because savegames can catch the server + // in a state where it is expecting the client to correct the angle + // and it won't happen if the game was just loaded, so you wind up + // with a permanent head tilt ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients)); MSG_WriteByte (&host_client->message, svc_setangle); - for (i = 0; i < 2; i++) - MSG_WriteAngle (&host_client->message, SVvector (ent, angles)[i]); + MSG_WriteAngle (&host_client->message, SVvector (ent, angles)[0]); + MSG_WriteAngle (&host_client->message, SVvector (ent, angles)[1]); MSG_WriteAngle (&host_client->message, 0); SV_WriteClientdataToMessage (sv_player, &host_client->message); @@ -1051,11 +948,6 @@ Host_Spawn_f (void) host_client->sendsignon = true; } -/* -================== -Host_Begin_f -================== -*/ void Host_Begin_f (void) { @@ -1069,13 +961,10 @@ Host_Begin_f (void) //=========================================================================== - /* -================== -Host_Kick_f + Host_Kick_f -Kicks a user off of the server -================== + Kicks a user off of the server */ void Host_Kick_f (void) @@ -1149,21 +1038,10 @@ Host_Kick_f (void) host_client = save; } -/* -=============================================================================== - -DEBUGGING TOOLS - -=============================================================================== -*/ +// DEBUGGING TOOLS ============================================================ // FIXME: This cheat should be re-implemented OUTSIDE the engine! #if 0 -/* -================== -Host_Give_f -================== -*/ void Host_Give_f (void) { @@ -1302,7 +1180,6 @@ Host_Give_f (void) } #endif - edict_t * FindViewthing (void) { @@ -1311,18 +1188,14 @@ FindViewthing (void) for (i = 0; i < sv.num_edicts; i++) { e = EDICT_NUM (&sv_pr_state, i); - if (!strcmp (PR_GetString (&sv_pr_state, SVstring (e, classname)), "viewthing")) + if (!strcmp (PR_GetString (&sv_pr_state, SVstring (e, classname)), + "viewthing")) return e; } Con_Printf ("No viewthing on map\n"); return NULL; } -/* -================== -Host_Viewmodel_f -================== -*/ void Host_Viewmodel_f (void) { @@ -1343,11 +1216,6 @@ Host_Viewmodel_f (void) cl.model_precache[(int) SVfloat (e, modelindex)] = m; } -/* -================== -Host_Viewframe_f -================== -*/ void Host_Viewframe_f (void) { @@ -1367,7 +1235,6 @@ Host_Viewframe_f (void) SVfloat (e, frame) = f; } - void PrintFrameName (model_t *m, int frame) { @@ -1383,11 +1250,6 @@ PrintFrameName (model_t *m, int frame) Cache_Release (&m->cache); } -/* -================== -Host_Viewnext_f -================== -*/ void Host_Viewnext_f (void) { @@ -1406,11 +1268,6 @@ Host_Viewnext_f (void) PrintFrameName (m, SVfloat (e, frame)); } -/* -================== -Host_Viewprev_f -================== -*/ void Host_Viewprev_f (void) { @@ -1430,20 +1287,8 @@ Host_Viewprev_f (void) PrintFrameName (m, SVfloat (e, frame)); } -/* -=============================================================================== +// DEMO LOOP CONTROL ========================================================== -DEMO LOOP CONTROL - -=============================================================================== -*/ - - -/* -================== -Host_Startdemos_f -================== -*/ void Host_Startdemos_f (void) { @@ -1472,13 +1317,10 @@ Host_Startdemos_f (void) cls.demonum = -1; } - /* -================== -Host_Demos_f + Host_Demos_f -Return to looping demos -================== + Return to looping demos */ void Host_Demos_f (void) @@ -1492,11 +1334,9 @@ Host_Demos_f (void) } /* -================== -Host_Stopdemo_f + Host_Stopdemo_f -Return to looping demos -================== + Return to looping demos */ void Host_Stopdemo_f (void) @@ -1511,11 +1351,6 @@ Host_Stopdemo_f (void) //============================================================================= -/* -================== -Host_InitCommands -================== -*/ void Host_InitCommands (void) { diff --git a/nq/source/pr_cmds.c b/nq/source/pr_cmds.c index 38adf8f7f..0b239975d 100644 --- a/nq/source/pr_cmds.c +++ b/nq/source/pr_cmds.c @@ -370,18 +370,18 @@ PF_particle (progs_t *pr) void PF_ambientsound (progs_t *pr) { - const char **check; - const char *samp; - float *pos; - float vol, attenuation; - int i, soundnum; + const char **check; + const char *samp; + float *pos; + float vol, attenuation; + int soundnum; pos = G_VECTOR (pr, OFS_PARM0); samp = G_STRING (pr, OFS_PARM1); vol = G_FLOAT (pr, OFS_PARM2); attenuation = G_FLOAT (pr, OFS_PARM3); -// check to see if samp was properly precached + // check to see if samp was properly precached for (soundnum = 0, check = sv.sound_precache; *check; check++, soundnum++) if (!strcmp (*check, samp)) break; @@ -390,14 +390,11 @@ PF_ambientsound (progs_t *pr) Con_Printf ("no precache: %s\n", samp); return; } -// add an svc_spawnambient command to the level signon packet + // add an svc_spawnambient command to the level signon packet MSG_WriteByte (&sv.signon, svc_spawnstaticsound); - for (i = 0; i < 3; i++) - MSG_WriteCoord (&sv.signon, pos[i]); - + MSG_WriteCoordV (&sv.signon, pos); MSG_WriteByte (&sv.signon, soundnum); - MSG_WriteByte (&sv.signon, vol * 255); MSG_WriteByte (&sv.signon, attenuation * 64); @@ -1114,23 +1111,26 @@ void PF_makestatic (progs_t *pr) { edict_t *ent; - int i; ent = G_EDICT (pr, OFS_PARM0); MSG_WriteByte (&sv.signon, svc_spawnstatic); - MSG_WriteByte (&sv.signon, SV_ModelIndex (PR_GetString (pr, SVstring (ent, model)))); + MSG_WriteByte (&sv.signon, + SV_ModelIndex (PR_GetString (pr, SVstring (ent, model)))); MSG_WriteByte (&sv.signon, SVfloat (ent, frame)); MSG_WriteByte (&sv.signon, SVfloat (ent, colormap)); MSG_WriteByte (&sv.signon, SVfloat (ent, skin)); - for (i = 0; i < 3; i++) { + + MSG_WriteCoordAngleV (&sv.signon, SVvector (ent, origin), + SVvector (ent, angles)); +/* for (i = 0; i < 3; i++) { // FIXME: DESPAIR MSG_WriteCoord (&sv.signon, SVvector (ent, origin)[i]); MSG_WriteAngle (&sv.signon, SVvector (ent, angles)[i]); - } + } */ -// throw the entity away now + // throw the entity away now ED_Free (pr, ent); } @@ -1166,7 +1166,7 @@ PF_changelevel (progs_t *pr) { char *s; -// make sure we don't issue two changelevels + // make sure we don't issue two changelevels if (svs.changelevel_issued) return; svs.changelevel_issued = true; @@ -1334,7 +1334,8 @@ PF_rotate_bbox (progs_t *pr) VectorScale (offsets[j][0], -1, hull->clip_maxs); // set up the clip planes for (i = 0; i < 6; i++) { - hull->planes[i].dist = calc_dist (verts[i], dir[i / 2], offsets[j]); + hull->planes[i].dist = calc_dist (verts[i], dir[i / 2], + offsets[j]); hull->planes[i].type = 4; VectorCopy (dir[i / 2], hull->planes[i].normal); //Con_Printf ("%f %f %f %f\n", @@ -1345,7 +1346,6 @@ PF_rotate_bbox (progs_t *pr) } } - void PF_Fixme (progs_t *pr) { diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 963a653d7..5431f7557 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -91,9 +91,7 @@ SV_StartParticle (vec3_t org, vec3_t dir, int color, int count) if (sv.datagram.cursize > MAX_DATAGRAM - 16) return; MSG_WriteByte (&sv.datagram, svc_particle); - MSG_WriteCoord (&sv.datagram, org[0]); - MSG_WriteCoord (&sv.datagram, org[1]); - MSG_WriteCoord (&sv.datagram, org[2]); + MSG_WriteCoordV (&sv.datagram, org); for (i = 0; i < 3; i++) { v = dir[i] * 16; if (v > 127) @@ -166,7 +164,7 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, MSG_WriteByte (&sv.datagram, attenuation * 64); MSG_WriteShort (&sv.datagram, channel); MSG_WriteByte (&sv.datagram, sound_num); - for (i = 0; i < 3; i++) + for (i=0; i < 3; i++) MSG_WriteCoord (&sv.datagram, SVvector (entity, origin)[i] + 0.5 * (SVvector (entity, mins)[i] + SVvector (entity, maxs)[i])); @@ -523,11 +521,10 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) MSG_WriteByte (msg, svc_damage); MSG_WriteByte (msg, SVfloat (ent, dmg_save)); MSG_WriteByte (msg, SVfloat (ent, dmg_take)); - for (i = 0; i < 3; i++) + for (i=0; i < 3; i++) MSG_WriteCoord (msg, SVvector (other, origin)[i] + 0.5 * (SVvector (other, mins)[i] + SVvector (other, maxs)[i])); - SVfloat (ent, dmg_take) = 0; SVfloat (ent, dmg_save) = 0; } @@ -538,8 +535,7 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) // a fixangle might get lost in a dropped packet. Oh well. if (SVfloat (ent, fixangle)) { MSG_WriteByte (msg, svc_setangle); - for (i = 0; i < 3; i++) - MSG_WriteAngle (msg, SVvector (ent, angles)[i]); + MSG_WriteAngleV (msg, SVvector (ent, angles)); SVfloat (ent, fixangle) = 0; } @@ -807,7 +803,7 @@ SV_ModelIndex (const char *name) void SV_CreateBaseline (void) { - int entnum, i; + int entnum; edict_t *svent; for (entnum = 0; entnum < sv.num_edicts; entnum++) { @@ -844,16 +840,13 @@ SV_CreateBaseline (void) 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); - for (i = 0; i < 3; i++) { - MSG_WriteCoord (&sv.signon, - ((entity_state_t*)svent->data)->origin[i]); - MSG_WriteAngle (&sv.signon, - ((entity_state_t*)svent->data)->angles[i]); - } + + MSG_WriteCoordAngleV (&sv.signon, + ((entity_state_t*)svent->data)->origin, + ((entity_state_t*)svent->data)->angles); } } - /* SV_SendReconnect diff --git a/nq/source/sv_user.c b/nq/source/sv_user.c index 74a3a11fb..ffc695917 100644 --- a/nq/source/sv_user.c +++ b/nq/source/sv_user.c @@ -420,8 +420,7 @@ SV_ReadClientMove (usercmd_t *move) host_client->num_pings++; // read current angles - for (i = 0; i < 3; i++) - angle[i] = MSG_ReadAngle (net_message); + MSG_ReadAngleV (net_message, angle); VectorCopy (angle, SVvector (host_client->edict, v_angle)); diff --git a/qw/source/cl_cam.c b/qw/source/cl_cam.c index 8a7526272..824a45554 100644 --- a/qw/source/cl_cam.c +++ b/qw/source/cl_cam.c @@ -425,9 +425,7 @@ Cam_Track (usercmd_t *cmd) sizeof (desired_position)) != 0) { MSG_WriteByte (&cls.netchan.message, clc_tmove); - MSG_WriteCoord (&cls.netchan.message, desired_position[0]); - MSG_WriteCoord (&cls.netchan.message, desired_position[1]); - MSG_WriteCoord (&cls.netchan.message, desired_position[2]); + MSG_WriteCoordV (&cls.netchan.message, desired_position); // move there locally immediately VectorCopy (desired_position, self->origin); } @@ -441,9 +439,7 @@ Cam_Track (usercmd_t *cmd) cmd->forwardmove = cmd->sidemove = cmd->upmove = 0; if (len > 16) { // close enough? MSG_WriteByte (&cls.netchan.message, clc_tmove); - MSG_WriteCoord (&cls.netchan.message, desired_position[0]); - MSG_WriteCoord (&cls.netchan.message, desired_position[1]); - MSG_WriteCoord (&cls.netchan.message, desired_position[2]); + MSG_WriteCoordV (&cls.netchan.message, desired_position); } // move there locally immediately VectorCopy (desired_position, self->origin); diff --git a/qw/source/cl_demo.c b/qw/source/cl_demo.c index 34f02f311..4829eb9a1 100644 --- a/qw/source/cl_demo.c +++ b/qw/source/cl_demo.c @@ -566,10 +566,7 @@ CL_Record_f (void) MSG_WriteByte (&buf, ent->frame); MSG_WriteByte (&buf, 0); MSG_WriteByte (&buf, ent->skinnum); - for (j = 0; j < 3; j++) { - MSG_WriteCoord (&buf, ent->origin[j]); - MSG_WriteAngle (&buf, ent->angles[j]); - } + MSG_WriteCoordAngleV (&buf, ent->origin, ent->angles); if (buf.cursize > MAX_MSGLEN / 2) { CL_WriteRecordDemoMessage (&buf, seq++); @@ -593,10 +590,7 @@ CL_Record_f (void) MSG_WriteByte (&buf, es->frame); MSG_WriteByte (&buf, es->colormap); MSG_WriteByte (&buf, es->skinnum); - for (j = 0; j < 3; j++) { - MSG_WriteCoord (&buf, es->origin[j]); - MSG_WriteAngle (&buf, es->angles[j]); - } + MSG_WriteCoordAngleV (&buf, es->origin, es->angles); if (buf.cursize > MAX_MSGLEN / 2) { CL_WriteRecordDemoMessage (&buf, seq++); diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index bf048f896..aaa9f1ded 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -610,7 +610,7 @@ CL_ParsePlayerinfo (void) flags = state->flags = MSG_ReadShort (net_message); state->messagenum = cl.parsecount; - MSG_ReadCoord3 (net_message, state->origin); + MSG_ReadCoordV (net_message, state->origin); state->frame = MSG_ReadByte (net_message); diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index ffc97fa99..d1e3f47e2 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -802,18 +802,14 @@ CL_ParseModellist (void) void CL_ParseBaseline (entity_state_t *es) { - int i; - es->modelindex = MSG_ReadByte (net_message); es->frame = MSG_ReadByte (net_message); es->colormap = MSG_ReadByte (net_message); es->skinnum = MSG_ReadByte (net_message); - for (i = 0; i < 3; i++) { - es->origin[i] = MSG_ReadCoord (net_message); - es->angles[i] = MSG_ReadAngle (net_message); - } - // LordHavoc: set up the baseline to account for new effects (alpha, - // colormod, etc) + + MSG_ReadCoordAngleV (net_message, es->origin, es->angles); + + // LordHavoc: set up baseline to for new effects (alpha, colormod, etc) es->alpha = 255; es->scale = 16; es->glow_color = 254; @@ -857,7 +853,7 @@ CL_ParseStaticSound (void) int sound_num, vol, atten; vec3_t org; - MSG_ReadCoord3 (net_message, org); + MSG_ReadCoordV (net_message, org); sound_num = MSG_ReadByte (net_message); vol = MSG_ReadByte (net_message); atten = MSG_ReadByte (net_message); @@ -888,7 +884,7 @@ CL_ParseStartSoundPacket (void) sound_num = MSG_ReadByte (net_message); - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); ent = (channel >> 3) & 1023; channel &= 7; @@ -1214,8 +1210,7 @@ CL_ParseServerMessage (void) break; case svc_setangle: - for (i = 0; i < 3; i++) - cl.viewangles[i] = MSG_ReadAngle (net_message); + MSG_ReadAngleV (net_message, cl.viewangles); // cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0; break; @@ -1317,15 +1312,13 @@ CL_ParseServerMessage (void) cl.completed_time = realtime; vid.recalc_refdef = true; // go to full screen Con_DPrintf ("intermission simorg: "); - MSG_ReadCoord3 (net_message, cl.simorg); - for (i = 0; i < 3; i++) { + MSG_ReadCoordV (net_message, cl.simorg); + for (i = 0; i < 3; i++) Con_DPrintf ("%f ", cl.simorg[i]); - } Con_DPrintf ("\nintermission simangles: "); - for (i = 0; i < 3; i++) { - cl.simangles[i] = MSG_ReadAngle (net_message); + MSG_ReadAngleV (net_message, cl.simangles); + for (i = 0; i < 3; i++) Con_DPrintf ("%f ", cl.simangles[i]); - } Con_DPrintf ("\n"); VectorCopy (vec3_origin, cl.simvel); break; diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index 06ec07800..a96d3d303 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -191,8 +191,8 @@ CL_ParseBeam (model_t *m) ent = MSG_ReadShort (net_message); - MSG_ReadCoord3 (net_message, start); - MSG_ReadCoord3 (net_message, end); + MSG_ReadCoordV (net_message, start); + MSG_ReadCoordV (net_message, end); // override any beam with the same entity for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) @@ -233,19 +233,19 @@ CL_ParseTEnt (void) type = MSG_ReadByte (net_message); switch (type) { case TE_WIZSPIKE: // spike hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_WizSpikeEffect (pos); S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1); break; case TE_KNIGHTSPIKE: // spike hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_KnightSpikeEffect (pos); S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1); break; case TE_SPIKE: // spike hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_SpikeEffect (pos); if (rand () % 5) @@ -262,7 +262,7 @@ CL_ParseTEnt (void) break; case TE_SUPERSPIKE: // super spike hitting wall - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_SuperSpikeEffect (pos); if (rand () % 5) @@ -280,7 +280,7 @@ CL_ParseTEnt (void) case TE_EXPLOSION: // rocket explosion // particles - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_ParticleExplosion (pos); // light @@ -304,7 +304,7 @@ CL_ParseTEnt (void) break; case TE_TAREXPLOSION: // tarbaby explosion - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_BlobExplosion (pos); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); @@ -329,17 +329,17 @@ CL_ParseTEnt (void) // PGM 01/21/97 case TE_LAVASPLASH: - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_LavaSplash (pos); break; case TE_TELEPORT: - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_TeleportSplash (pos); break; case TE_EXPLOSION2: // color mapped explosion - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); colorStart = MSG_ReadByte (net_message); colorLength = MSG_ReadByte (net_message); R_ParticleExplosion2 (pos, colorStart, colorLength); @@ -359,18 +359,18 @@ CL_ParseTEnt (void) case TE_GUNSHOT: // bullet hitting wall cnt = MSG_ReadByte (net_message) * 20; - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_GunshotEffect (pos, cnt); break; case TE_BLOOD: // bullet hitting body cnt = MSG_ReadByte (net_message) * 20; - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); R_BloodPuffEffect (pos, cnt); break; case TE_LIGHTNINGBLOOD: // lightning hitting body - MSG_ReadCoord3 (net_message, pos); + MSG_ReadCoordV (net_message, pos); // light dl = R_AllocDlight (0); diff --git a/qw/source/sv_ents.c b/qw/source/sv_ents.c index ea1490f91..33741f4eb 100644 --- a/qw/source/sv_ents.c +++ b/qw/source/sv_ents.c @@ -430,8 +430,7 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs, MSG_WriteByte (msg, j); MSG_WriteShort (msg, pflags); - for (i = 0; i < 3; i++) - MSG_WriteCoord (msg, SVvector (ent, origin)[i]); + MSG_WriteCoordV (msg, SVvector (ent, origin)); MSG_WriteByte (msg, SVfloat (ent, frame)); diff --git a/qw/source/sv_init.c b/qw/source/sv_init.c index eb08dc542..cdeb4f43a 100644 --- a/qw/source/sv_init.c +++ b/qw/source/sv_init.c @@ -104,7 +104,7 @@ SV_FlushSignon (void) void SV_CreateBaseline (void) { - int i, entnum; + int entnum; edict_t *svent; for (entnum = 0; entnum < sv.num_edicts; entnum++) { @@ -150,12 +150,10 @@ SV_CreateBaseline (void) 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)->skinnum); - for (i = 0; i < 3; i++) { - MSG_WriteCoord (&sv.signon, - ((entity_state_t*)svent->data)->origin[i]); - MSG_WriteAngle (&sv.signon, - ((entity_state_t*)svent->data)->angles[i]); - } + + MSG_WriteCoordAngleV (&sv.signon, + ((entity_state_t*)svent->data)->origin, + ((entity_state_t*)svent->data)->angles); } } diff --git a/qw/source/sv_pr_cmds.c b/qw/source/sv_pr_cmds.c index 9f6fcb1e7..191e8c4b7 100644 --- a/qw/source/sv_pr_cmds.c +++ b/qw/source/sv_pr_cmds.c @@ -281,7 +281,7 @@ PF_ambientsound (progs_t *pr) const char *samp; float *pos; float vol, attenuation; - int i, soundnum; + int soundnum; pos = G_VECTOR (pr, OFS_PARM0); samp = G_STRING (pr, OFS_PARM1); @@ -300,8 +300,7 @@ PF_ambientsound (progs_t *pr) // add an svc_spawnambient command to the level signon packet MSG_WriteByte (&sv.signon, svc_spawnstaticsound); - for (i = 0; i < 3; i++) - MSG_WriteCoord (&sv.signon, pos[i]); + MSG_WriteCoordV (&sv.signon, pos); MSG_WriteByte (&sv.signon, soundnum); @@ -1145,7 +1144,6 @@ PF_makestatic (progs_t *pr) { const char *model; edict_t *ent; - int i; ent = G_EDICT (pr, OFS_PARM0); @@ -1158,11 +1156,9 @@ PF_makestatic (progs_t *pr) MSG_WriteByte (&sv.signon, SVfloat (ent, frame)); MSG_WriteByte (&sv.signon, SVfloat (ent, colormap)); MSG_WriteByte (&sv.signon, SVfloat (ent, skin)); - for (i = 0; i < 3; i++) { - MSG_WriteCoord (&sv.signon, SVvector (ent, origin)[i]); - MSG_WriteAngle (&sv.signon, SVvector (ent, angles)[i]); - } + MSG_WriteCoordAngleV (&sv.signon, SVvector (ent, origin), + SVvector (ent, angles)); // throw the entity away now ED_Free (pr, ent); } diff --git a/qw/source/sv_send.c b/qw/source/sv_send.c index 9c4c7bb5c..9eabf9c30 100644 --- a/qw/source/sv_send.c +++ b/qw/source/sv_send.c @@ -483,8 +483,7 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, if (channel & SND_ATTENUATION) MSG_WriteByte (&sv.multicast, attenuation * 64); MSG_WriteByte (&sv.multicast, sound_num); - for (i = 0; i < 3; i++) - MSG_WriteCoord (&sv.multicast, origin[i]); + MSG_WriteCoordV (&sv.multicast, origin); if (use_phs) SV_Multicast (origin, reliable ? MULTICAST_PHS_R : MULTICAST_PHS); @@ -541,15 +540,13 @@ SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg) MSG_WriteCoord (msg, SVvector (other, origin)[i] + 0.5 * (SVvector (other, mins)[i] + SVvector (other, maxs)[i])); - SVfloat (ent, dmg_take) = 0; SVfloat (ent, dmg_save) = 0; } // a fixangle might get lost in a dropped packet. Oh well. if (SVfloat (ent, fixangle)) { MSG_WriteByte (msg, svc_setangle); - for (i = 0; i < 3; i++) - MSG_WriteAngle (msg, SVvector (ent, angles)[i]); + MSG_WriteAngleV (msg, SVvector (ent, angles)); SVfloat (ent, fixangle) = 0; } } diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index 80edaa79e..0085d25b6 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -548,7 +548,8 @@ SV_Begin_f (void) ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients)); MSG_WriteByte (&host_client->netchan.message, svc_setangle); for (i = 0; i < 2; i++) - MSG_WriteAngle (&host_client->netchan.message, SVvector (ent, angles)[i]); + MSG_WriteAngle (&host_client->netchan.message, + SVvector (ent, angles)[i]); MSG_WriteAngle (&host_client->netchan.message, 0); #endif } @@ -1782,7 +1783,7 @@ SV_ExecuteClientMessage (client_t *cl) break; case clc_tmove: - MSG_ReadCoord3 (net_message, o); + MSG_ReadCoordV (net_message, o); // only allowed by spectators if (host_client->spectator) { VectorCopy (o, SVvector (sv_player, origin));