Kill MSG_WriteChar.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-07-02 19:13:53 +00:00
parent 8c2aa8f840
commit 5e5fdb7bc2
6 changed files with 19 additions and 29 deletions

View file

@ -49,16 +49,7 @@ static const char rcsid[] =
Handles byte ordering and avoids alignment errors Handles byte ordering and avoids alignment errors
*/ */
// writing functions // writing functions ==========================================================
void
MSG_WriteChar (sizebuf_t *sb, unsigned int c)
{
byte *buf;
buf = SZ_GetSpace (sb, 1);
*buf = c;
}
void void
MSG_WriteByte (sizebuf_t *sb, unsigned int c) MSG_WriteByte (sizebuf_t *sb, unsigned int c)
@ -173,8 +164,7 @@ MSG_WriteAngle16 (sizebuf_t *sb, float angle16)
MSG_WriteShort (sb, (unsigned int) (angle16 * (65536.0 / 360.0)) & 65535); MSG_WriteShort (sb, (unsigned int) (angle16 * (65536.0 / 360.0)) & 65535);
} }
// reading functions ==========================================================
// reading functions
void void
MSG_BeginReading (msg_t *msg) MSG_BeginReading (msg_t *msg)

View file

@ -305,7 +305,7 @@ PF_sprint (progs_t *pr)
client = &svs.clients[entnum - 1]; client = &svs.clients[entnum - 1];
MSG_WriteChar (&client->message, svc_print); MSG_WriteByte (&client->message, svc_print);
MSG_WriteString (&client->message, s); MSG_WriteString (&client->message, s);
} }
@ -334,7 +334,7 @@ PF_centerprint (progs_t *pr)
client = &svs.clients[entnum - 1]; client = &svs.clients[entnum - 1];
MSG_WriteChar (&client->message, svc_centerprint); MSG_WriteByte (&client->message, svc_centerprint);
MSG_WriteString (&client->message, s); MSG_WriteString (&client->message, s);
} }
@ -861,8 +861,8 @@ PF_lightstyle (progs_t *pr)
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++)
if (client->active || client->spawned) { if (client->active || client->spawned) {
MSG_WriteChar (&client->message, svc_lightstyle); MSG_WriteByte (&client->message, svc_lightstyle);
MSG_WriteChar (&client->message, style); MSG_WriteByte (&client->message, style);
MSG_WriteString (&client->message, val); MSG_WriteString (&client->message, val);
} }
} }
@ -1060,7 +1060,7 @@ PF_WriteByte (progs_t *pr)
void void
PF_WriteChar (progs_t *pr) PF_WriteChar (progs_t *pr)
{ {
MSG_WriteChar (WriteDest (pr), G_FLOAT (pr, OFS_PARM1)); MSG_WriteByte (WriteDest (pr), G_FLOAT (pr, OFS_PARM1));
} }
void void

View file

@ -98,7 +98,7 @@ SV_StartParticle (const vec3_t org, const vec3_t dir, int color, int count)
v = 127; v = 127;
else if (v < -128) else if (v < -128)
v = -128; v = -128;
MSG_WriteChar (&sv.datagram, v); MSG_WriteByte (&sv.datagram, v);
} }
MSG_WriteByte (&sv.datagram, count); MSG_WriteByte (&sv.datagram, count);
MSG_WriteByte (&sv.datagram, color); MSG_WriteByte (&sv.datagram, color);
@ -584,16 +584,16 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
MSG_WriteShort (msg, bits); MSG_WriteShort (msg, bits);
if (bits & SU_VIEWHEIGHT) if (bits & SU_VIEWHEIGHT)
MSG_WriteChar (msg, SVvector (ent, view_ofs)[2]); MSG_WriteByte (msg, SVvector (ent, view_ofs)[2]);
if (bits & SU_IDEALPITCH) if (bits & SU_IDEALPITCH)
MSG_WriteChar (msg, SVfloat (ent, idealpitch)); MSG_WriteByte (msg, SVfloat (ent, idealpitch));
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (bits & (SU_PUNCH1 << i)) if (bits & (SU_PUNCH1 << i))
MSG_WriteChar (msg, SVvector (ent, punchangle)[i]); MSG_WriteByte (msg, SVvector (ent, punchangle)[i]);
if (bits & (SU_VELOCITY1 << i)) if (bits & (SU_VELOCITY1 << i))
MSG_WriteChar (msg, SVvector (ent, velocity)[i] / 16); MSG_WriteByte (msg, SVvector (ent, velocity)[i] / 16);
} }
// [always sent] if (bits & SU_ITEMS) // [always sent] if (bits & SU_ITEMS)
@ -708,7 +708,7 @@ SV_SendNop (client_t *client)
msg.maxsize = sizeof (buf); msg.maxsize = sizeof (buf);
msg.cursize = 0; msg.cursize = 0;
MSG_WriteChar (&msg, svc_nop); MSG_WriteByte (&msg, svc_nop);
if (NET_SendUnreliableMessage (client->netconnection, &msg) == -1) if (NET_SendUnreliableMessage (client->netconnection, &msg) == -1)
SV_DropClient (true); // if the message couldn't send, kick off SV_DropClient (true); // if the message couldn't send, kick off
@ -859,7 +859,7 @@ SV_SendReconnect (void)
msg.cursize = 0; msg.cursize = 0;
msg.maxsize = sizeof (data); msg.maxsize = sizeof (data);
MSG_WriteChar (&msg, svc_stufftext); MSG_WriteByte (&msg, svc_stufftext);
MSG_WriteString (&msg, "reconnect\n"); MSG_WriteString (&msg, "reconnect\n");
NET_SendToAll (&msg, 5); NET_SendToAll (&msg, 5);

View file

@ -862,7 +862,7 @@ CL_Reconnect_f (void)
if (cls.state == ca_connected) { if (cls.state == ca_connected) {
Con_Printf ("reconnecting...\n"); Con_Printf ("reconnecting...\n");
VID_SetCaption ("Reconnecting"); VID_SetCaption ("Reconnecting");
MSG_WriteChar (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, "new"); MSG_WriteString (&cls.netchan.message, "new");
return; return;
} }
@ -905,7 +905,7 @@ CL_ConnectionlessPacket (void)
return; return;
} }
Netchan_Setup (&cls.netchan, net_from, cls.qport); Netchan_Setup (&cls.netchan, net_from, cls.qport);
MSG_WriteChar (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, "new"); MSG_WriteString (&cls.netchan.message, "new");
CL_SetState (ca_connected); CL_SetState (ca_connected);
Con_Printf ("Connected.\n"); Con_Printf ("Connected.\n");

View file

@ -137,10 +137,10 @@ void
ClientReliableWrite_Char (client_t *cl, int c) ClientReliableWrite_Char (client_t *cl, int c)
{ {
if (cl->num_backbuf) { if (cl->num_backbuf) {
MSG_WriteChar (&cl->backbuf, c); MSG_WriteByte (&cl->backbuf, c);
ClientReliable_FinishWrite (cl); ClientReliable_FinishWrite (cl);
} else } else
MSG_WriteChar (&cl->netchan.message, c); MSG_WriteByte (&cl->netchan.message, c);
} }
void void

View file

@ -1070,7 +1070,7 @@ PF_WriteChar (progs_t *pr)
ClientReliableCheckBlock (cl, 1); ClientReliableCheckBlock (cl, 1);
ClientReliableWrite_Char (cl, G_FLOAT (pr, OFS_PARM1)); ClientReliableWrite_Char (cl, G_FLOAT (pr, OFS_PARM1));
} else } else
MSG_WriteChar (WriteDest (pr), G_FLOAT (pr, OFS_PARM1)); MSG_WriteByte (WriteDest (pr), G_FLOAT (pr, OFS_PARM1));
} }
void void