Big net::msg conversion
This commit is contained in:
+45
-41
@@ -1203,9 +1203,9 @@ static void Host_Name_f(void) {
|
||||
host_client->edict->v.netname = PR_SetEngineString(host_client->name);
|
||||
|
||||
// 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);
|
||||
sv.reliable_datagram.write_byte(svc_updatename);
|
||||
sv.reliable_datagram.write_byte(host_client - svs.clients);
|
||||
sv.reliable_datagram.write_string(host_client->name);
|
||||
}
|
||||
|
||||
static void Host_Say(bool teamonly) {
|
||||
@@ -1383,9 +1383,9 @@ static void Host_Color_f(void) {
|
||||
host_client->edict->v.team = bottom + 1;
|
||||
|
||||
// send notification to all clients
|
||||
MSG_WriteByte(&sv.reliable_datagram, svc_updatecolors);
|
||||
MSG_WriteByte(&sv.reliable_datagram, host_client - svs.clients);
|
||||
MSG_WriteByte(&sv.reliable_datagram, host_client->colors);
|
||||
sv.reliable_datagram.write_byte(svc_updatecolors);
|
||||
sv.reliable_datagram.write_byte(host_client - svs.clients);
|
||||
sv.reliable_datagram.write_byte(host_client->colors);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1438,8 +1438,8 @@ static void Host_Pause_f(void) {
|
||||
}
|
||||
|
||||
// send notification to all clients
|
||||
MSG_WriteByte(&sv.reliable_datagram, svc_setpause);
|
||||
MSG_WriteByte(&sv.reliable_datagram, sv.paused);
|
||||
sv.reliable_datagram.write_byte(svc_setpause);
|
||||
sv.reliable_datagram.write_byte(sv.paused);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1514,49 +1514,53 @@ static void Host_Spawn_f(void) {
|
||||
}
|
||||
|
||||
// send all current names, colors, and frag counts
|
||||
SZ_Clear(&host_client->message);
|
||||
host_client->message.clear();
|
||||
|
||||
// send time of update
|
||||
MSG_WriteByte(&host_client->message, svc_time);
|
||||
MSG_WriteFloat(&host_client->message, sv.time);
|
||||
host_client->message.write_byte(svc_time);
|
||||
host_client->message.write_float(sv.time);
|
||||
|
||||
for (i = 0, client = svs.clients; i < svs.maxclients; i++, client++) {
|
||||
MSG_WriteByte(&host_client->message, svc_updatename);
|
||||
MSG_WriteByte(&host_client->message, i);
|
||||
MSG_WriteString(&host_client->message, client->name);
|
||||
MSG_WriteByte(&host_client->message, svc_updatefrags);
|
||||
MSG_WriteByte(&host_client->message, i);
|
||||
MSG_WriteShort(&host_client->message, client->old_frags);
|
||||
MSG_WriteByte(&host_client->message, svc_updatecolors);
|
||||
MSG_WriteByte(&host_client->message, i);
|
||||
MSG_WriteByte(&host_client->message, client->colors);
|
||||
host_client->message.write_byte(svc_updatename);
|
||||
host_client->message.write_byte(i);
|
||||
host_client->message.write_string(client->name);
|
||||
host_client->message.write_byte(svc_updatefrags);
|
||||
host_client->message.write_byte(i);
|
||||
host_client->message.write_short(client->old_frags);
|
||||
host_client->message.write_byte(svc_updatecolors);
|
||||
host_client->message.write_byte(i);
|
||||
host_client->message.write_byte(client->colors);
|
||||
}
|
||||
|
||||
// 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]);
|
||||
host_client->message.write_byte(svc_lightstyle);
|
||||
host_client->message.write_byte((char) i);
|
||||
if (sv.lightstyles[i]) {
|
||||
host_client->message.write_string(sv.lightstyles[i]);
|
||||
} else {
|
||||
host_client->message.write_string("m"); // TODO: HACK
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// send some stats
|
||||
//
|
||||
MSG_WriteByte(&host_client->message, svc_updatestat);
|
||||
MSG_WriteByte(&host_client->message, STAT_TOTALSECRETS);
|
||||
MSG_WriteLong(&host_client->message, pr_global_struct->total_secrets);
|
||||
host_client->message.write_byte(svc_updatestat);
|
||||
host_client->message.write_byte(STAT_TOTALSECRETS);
|
||||
host_client->message.write_long(pr_global_struct->total_secrets);
|
||||
|
||||
MSG_WriteByte(&host_client->message, svc_updatestat);
|
||||
MSG_WriteByte(&host_client->message, STAT_TOTALMONSTERS);
|
||||
MSG_WriteLong(&host_client->message, pr_global_struct->total_monsters);
|
||||
host_client->message.write_byte(svc_updatestat);
|
||||
host_client->message.write_byte(STAT_TOTALMONSTERS);
|
||||
host_client->message.write_long(pr_global_struct->total_monsters);
|
||||
|
||||
MSG_WriteByte(&host_client->message, svc_updatestat);
|
||||
MSG_WriteByte(&host_client->message, STAT_SECRETS);
|
||||
MSG_WriteLong(&host_client->message, pr_global_struct->found_secrets);
|
||||
host_client->message.write_byte(svc_updatestat);
|
||||
host_client->message.write_byte(STAT_SECRETS);
|
||||
host_client->message.write_long(pr_global_struct->found_secrets);
|
||||
|
||||
MSG_WriteByte(&host_client->message, svc_updatestat);
|
||||
MSG_WriteByte(&host_client->message, STAT_MONSTERS);
|
||||
MSG_WriteLong(&host_client->message, pr_global_struct->killed_monsters);
|
||||
host_client->message.write_byte(svc_updatestat);
|
||||
host_client->message.write_byte(STAT_MONSTERS);
|
||||
host_client->message.write_long(pr_global_struct->killed_monsters);
|
||||
|
||||
//
|
||||
// send a fixangle
|
||||
@@ -1565,15 +1569,15 @@ static void Host_Spawn_f(void) {
|
||||
// and it won't happen if the game was just loaded, so you wind up
|
||||
// with a permanent head tilt
|
||||
ent = EDICT_NUM(1 + (host_client - svs.clients));
|
||||
MSG_WriteByte(&host_client->message, svc_setangle);
|
||||
host_client->message.write_byte(svc_setangle);
|
||||
for (i = 0; i < 2; i++)
|
||||
MSG_WriteAngle(&host_client->message, ent->v.angles[i], sv.protocolflags);
|
||||
MSG_WriteAngle(&host_client->message, 0, sv.protocolflags);
|
||||
host_client->message.write_angle(ent->v.angles[i], static_cast<net::rmq_flags>(sv.protocolflags));
|
||||
host_client->message.write_angle(0, static_cast<net::rmq_flags>(sv.protocolflags));
|
||||
|
||||
SV_WriteClientdataToMessage(sv_player, &host_client->message);
|
||||
SV_WriteClientdataToMessage(sv_player, host_client->message);
|
||||
|
||||
MSG_WriteByte(&host_client->message, svc_signonnum);
|
||||
MSG_WriteByte(&host_client->message, 3);
|
||||
host_client->message.write_byte(svc_signonnum);
|
||||
host_client->message.write_byte(3);
|
||||
host_client->sendsignon = PRESPAWN_FLUSH;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user