Big net::msg conversion

This commit is contained in:
iikorni
2026-08-30 12:38:12 -05:00
parent 216dd1aecd
commit df2b863d72
36 changed files with 2860 additions and 2764 deletions
+41 -41
View File
@@ -374,8 +374,8 @@ static void PF_sprint (void)
client = &svs.clients[entnum-1];
MSG_WriteChar (&client->message,svc_print);
MSG_WriteString (&client->message, s );
client->message.write_char(svc_print);
client->message.write_string(s);
}
@@ -405,8 +405,8 @@ static void PF_centerprint (void)
client = &svs.clients[entnum-1];
MSG_WriteChar (&client->message,svc_centerprint);
MSG_WriteString (&client->message, s);
client->message.write_char(svc_centerprint);
client->message.write_string(s);
}
@@ -615,23 +615,23 @@ static void PF_ambientsound (void)
//johnfitz -- PROTOCOL_FITZQUAKE
if (large)
MSG_WriteByte (sv.signon,svc_spawnstaticsound2);
sv.signons[sv.current_signon].write_byte(svc_spawnstaticsound2);
else
MSG_WriteByte (sv.signon,svc_spawnstaticsound);
sv.signons[sv.current_signon].write_byte(svc_spawnstaticsound);
//johnfitz
for (i = 0; i < 3; i++)
MSG_WriteCoord(sv.signon, pos[i], sv.protocolflags);
sv.signons[sv.current_signon].write_coord(pos[i], static_cast<net::rmq_flags>(sv.protocolflags));
//johnfitz -- PROTOCOL_FITZQUAKE
if (large)
MSG_WriteShort(sv.signon, soundnum);
sv.signons[sv.current_signon].write_short(soundnum);
else
MSG_WriteByte (sv.signon, soundnum);
sv.signons[sv.current_signon].write_byte(soundnum);
//johnfitz
MSG_WriteByte (sv.signon, vol*255);
MSG_WriteByte (sv.signon, attenuation*64);
sv.signons[sv.current_signon].write_byte(vol*255);
sv.signons[sv.current_signon].write_byte(attenuation*64);
}
@@ -1284,9 +1284,9 @@ static void PF_lightstyle (void)
{
if (client->active || client->spawned)
{
MSG_WriteChar (&client->message, svc_lightstyle);
MSG_WriteChar (&client->message, style);
MSG_WriteString (&client->message, val);
client->message.write_char(svc_lightstyle);
client->message.write_char(style);
client->message.write_string(val);
}
}
}
@@ -1502,7 +1502,7 @@ MESSAGE WRITING
===============================================================================
*/
static sizebuf_t *WriteDest (void)
static net::msg &WriteDest (void)
{
int entnum;
int dest;
@@ -1512,67 +1512,67 @@ static sizebuf_t *WriteDest (void)
switch (dest)
{
case MSG_BROADCAST:
return &sv.datagram;
return sv.datagram;
case MSG_ONE:
ent = PROG_TO_EDICT(pr_global_struct->msg_entity);
entnum = NUM_FOR_EDICT(ent);
if (entnum < 1 || entnum > svs.maxclients)
PR_RunError ("WriteDest: not a client");
return &svs.clients[entnum-1].message;
return svs.clients[entnum-1].message;
case MSG_ALL:
return &sv.reliable_datagram;
return sv.reliable_datagram;
case MSG_INIT:
return sv.signon;
return sv.signons[sv.current_signon];
default:
PR_RunError ("WriteDest: bad destination");
break;
}
return NULL;
throw std::runtime_error{"WHOOPS"};
}
static void PF_WriteByte (void)
{
MSG_WriteByte (WriteDest(), G_FLOAT(OFS_PARM1));
WriteDest().write_byte(G_FLOAT(OFS_PARM1));
}
static void PF_WriteChar (void)
{
MSG_WriteChar (WriteDest(), G_FLOAT(OFS_PARM1));
WriteDest().write_char(G_FLOAT(OFS_PARM1));
}
static void PF_WriteShort (void)
{
MSG_WriteShort (WriteDest(), G_FLOAT(OFS_PARM1));
WriteDest().write_short(G_FLOAT(OFS_PARM1));
}
static void PF_WriteLong (void)
{
MSG_WriteLong (WriteDest(), G_FLOAT(OFS_PARM1));
WriteDest().write_long(G_FLOAT(OFS_PARM1));
}
static void PF_WriteAngle (void)
{
MSG_WriteAngle (WriteDest(), G_FLOAT(OFS_PARM1), sv.protocolflags);
WriteDest().write_angle(G_FLOAT(OFS_PARM1), static_cast<net::rmq_flags>(sv.protocolflags));
}
static void PF_WriteCoord (void)
{
MSG_WriteCoord (WriteDest(), G_FLOAT(OFS_PARM1), sv.protocolflags);
WriteDest().write_coord(G_FLOAT(OFS_PARM1), static_cast<net::rmq_flags>(sv.protocolflags));
}
static void PF_WriteString (void)
{
MSG_WriteString (WriteDest(), LOC_GetString(G_STRING(OFS_PARM1)));
WriteDest().write_string(LOC_GetString(G_STRING(OFS_PARM1)));
}
static void PF_WriteEntity (void)
{
MSG_WriteShort (WriteDest(), G_EDICTNUM(OFS_PARM1));
WriteDest().write_short(G_EDICTNUM(OFS_PARM1));
}
//=============================================================================
@@ -1628,38 +1628,38 @@ static void PF_makestatic (void)
if (bits)
{
MSG_WriteByte (sv.signon, svc_spawnstatic2);
MSG_WriteByte (sv.signon, bits);
sv.signons[sv.current_signon].write_byte(svc_spawnstatic2);
sv.signons[sv.current_signon].write_byte(bits);
}
else
MSG_WriteByte (sv.signon, svc_spawnstatic);
sv.signons[sv.current_signon].write_byte(svc_spawnstatic);
if (bits & B_LARGEMODEL)
MSG_WriteShort (sv.signon, SV_ModelIndex(PR_GetString(ent->v.model)));
sv.signons[sv.current_signon].write_short(SV_ModelIndex(PR_GetString(ent->v.model)));
else
MSG_WriteByte (sv.signon, SV_ModelIndex(PR_GetString(ent->v.model)));
sv.signons[sv.current_signon].write_byte(SV_ModelIndex(PR_GetString(ent->v.model)));
if (bits & B_LARGEFRAME)
MSG_WriteShort (sv.signon, ent->v.frame);
sv.signons[sv.current_signon].write_short(ent->v.frame);
else
MSG_WriteByte (sv.signon, ent->v.frame);
sv.signons[sv.current_signon].write_byte(ent->v.frame);
//johnfitz
MSG_WriteByte (sv.signon, ent->v.colormap);
MSG_WriteByte (sv.signon, ent->v.skin);
sv.signons[sv.current_signon].write_byte(ent->v.colormap);
sv.signons[sv.current_signon].write_byte(ent->v.skin);
for (i = 0; i < 3; i++)
{
MSG_WriteCoord(sv.signon, ent->v.origin[i], sv.protocolflags);
MSG_WriteAngle(sv.signon, ent->v.angles[i], sv.protocolflags);
sv.signons[sv.current_signon].write_coord(ent->v.origin[i], static_cast<net::rmq_flags>(sv.protocolflags));
sv.signons[sv.current_signon].write_angle(ent->v.angles[i], static_cast<net::rmq_flags>(sv.protocolflags));
}
//johnfitz -- PROTOCOL_FITZQUAKE
if (bits & B_ALPHA)
MSG_WriteByte (sv.signon, ent->alpha);
sv.signons[sv.current_signon].write_byte(ent->alpha);
//johnfitz
if (bits & B_SCALE)
MSG_WriteByte (sv.signon, ent->scale);
sv.signons[sv.current_signon].write_byte(ent->scale);
// throw the entity away now
ED_Free (ent);