Big net::msg conversion
This commit is contained in:
+11
-17
@@ -328,33 +328,27 @@ CL_SendMove
|
||||
void CL_SendMove(const usercmd_t *cmd) {
|
||||
int i;
|
||||
int bits;
|
||||
sizebuf_t buf;
|
||||
byte data[128];
|
||||
|
||||
buf.maxsize = 128;
|
||||
buf.cursize = 0;
|
||||
buf.data = data;
|
||||
net::msg msg{};
|
||||
|
||||
cl.cmd = *cmd;
|
||||
|
||||
//
|
||||
// send the movement message
|
||||
//
|
||||
MSG_WriteByte(&buf, clc_move);
|
||||
|
||||
MSG_WriteFloat(&buf, cl.mtime[0]); // so server can get ping times
|
||||
msg.write_byte(clc_move);
|
||||
msg.write_float(cl.mtime[0]);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
//johnfitz -- 16-bit angles for PROTOCOL_FITZQUAKE
|
||||
if (cl.protocol == PROTOCOL_NETQUAKE)
|
||||
MSG_WriteAngle(&buf, cl.viewangles[i], cl.protocolflags);
|
||||
msg.write_angle(cl.viewangles[i], static_cast<net::rmq_flags>(cl.protocolflags));
|
||||
else
|
||||
MSG_WriteAngle16(&buf, cl.viewangles[i], cl.protocolflags);
|
||||
msg.write_angle_16(cl.viewangles[i], static_cast<net::rmq_flags>(cl.protocolflags));
|
||||
//johnfitz
|
||||
|
||||
MSG_WriteShort(&buf, cmd->forwardmove);
|
||||
MSG_WriteShort(&buf, cmd->sidemove);
|
||||
MSG_WriteShort(&buf, cmd->upmove);
|
||||
msg.write_short(cmd->forwardmove);
|
||||
msg.write_short(cmd->sidemove);
|
||||
msg.write_short(cmd->upmove);
|
||||
|
||||
//
|
||||
// send button bits
|
||||
@@ -369,9 +363,9 @@ void CL_SendMove(const usercmd_t *cmd) {
|
||||
bits |= 2;
|
||||
in_jump.state &= ~2;
|
||||
|
||||
MSG_WriteByte(&buf, bits);
|
||||
msg.write_byte(bits);
|
||||
|
||||
MSG_WriteByte(&buf, in_impulse);
|
||||
msg.write_byte(in_impulse);
|
||||
in_impulse = 0;
|
||||
|
||||
//
|
||||
@@ -387,7 +381,7 @@ void CL_SendMove(const usercmd_t *cmd) {
|
||||
if (++cl.movemessages <= 2)
|
||||
return;
|
||||
|
||||
if (NET_SendUnreliableMessage(cls.netcon, &buf) == -1) {
|
||||
if (NET_SendUnreliableMessage(cls.netcon, msg) == -1) {
|
||||
console::info("CL_SendMove: lost server connection\n");
|
||||
CL_Disconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user