mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 00:24:12 +00:00
Begin phase 2 :)
- link net_svc.c to the server - add a NET_SVC_Print_Emit function - make the server use the above instead of svc_print manually It's actually kind of ugly, because of how backbuffers are implimented. Hopefully I'll be able to clean that up later.
This commit is contained in:
parent
7b4e5e69af
commit
56f1d6f49b
5 changed files with 35 additions and 8 deletions
|
@ -199,6 +199,7 @@ typedef struct net_svc_deltapacketentities_s
|
||||||
entity_state_t deltas[MAX_PACKET_ENTITIES];
|
entity_state_t deltas[MAX_PACKET_ENTITIES];
|
||||||
} net_svc_deltapacketentities_t;
|
} net_svc_deltapacketentities_t;
|
||||||
|
|
||||||
|
net_status_t NET_SVC_Print_Emit (net_svc_print_t *block, sizebuf_t *buf);
|
||||||
net_status_t NET_SVC_Print_Parse (net_svc_print_t *block, msg_t *msg);
|
net_status_t NET_SVC_Print_Parse (net_svc_print_t *block, msg_t *msg);
|
||||||
net_status_t NET_SVC_Damage_Parse (net_svc_damage_t *block, msg_t *msg);
|
net_status_t NET_SVC_Damage_Parse (net_svc_damage_t *block, msg_t *msg);
|
||||||
net_status_t NET_SVC_ServerData_Parse (net_svc_serverdata_t *block, msg_t *msg);
|
net_status_t NET_SVC_ServerData_Parse (net_svc_serverdata_t *block, msg_t *msg);
|
||||||
|
|
|
@ -52,7 +52,7 @@ libasm_la_SOURCES= $(asm_src)
|
||||||
noinst_LTLIBRARIES= libqfnet.la $(asm)
|
noinst_LTLIBRARIES= libqfnet.la $(asm)
|
||||||
|
|
||||||
common_sources= buildnum.c com.c game.c msg_ucmd.c pmove.c pmovetst.c \
|
common_sources= buildnum.c com.c game.c msg_ucmd.c pmove.c pmovetst.c \
|
||||||
net_packetlog.c
|
net_packetlog.c net_svc.c
|
||||||
|
|
||||||
common_ldflags= -export-dynamic
|
common_ldflags= -export-dynamic
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ client_LIB_DEPS= libqfnet.la libasm.la $(qf_client_LIBS)
|
||||||
client_sources= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \
|
client_sources= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \
|
||||||
cl_main.c cl_misc.c cl_ngraph.c cl_parse.c cl_pred.c \
|
cl_main.c cl_misc.c cl_ngraph.c cl_parse.c cl_pred.c \
|
||||||
cl_screen.c cl_skin.c cl_slist.c cl_tent.c cl_view.c \
|
cl_screen.c cl_skin.c cl_slist.c cl_tent.c cl_view.c \
|
||||||
console.c locs.c net_svc.c sbar.c skin.c teamplay.c
|
console.c locs.c sbar.c skin.c teamplay.c
|
||||||
|
|
||||||
# Software-rendering clients
|
# Software-rendering clients
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,15 @@ static const char rcsid[] =
|
||||||
#include "msg_ucmd.h" // FIXME
|
#include "msg_ucmd.h" // FIXME
|
||||||
#include "net_svc.h"
|
#include "net_svc.h"
|
||||||
|
|
||||||
|
net_status_t
|
||||||
|
NET_SVC_Print_Emit (net_svc_print_t *block, sizebuf_t *buf)
|
||||||
|
{
|
||||||
|
MSG_WriteByte (buf, block->level);
|
||||||
|
MSG_WriteString (buf, block->message);
|
||||||
|
|
||||||
|
return buf->overflowed;
|
||||||
|
}
|
||||||
|
|
||||||
net_status_t
|
net_status_t
|
||||||
NET_SVC_Print_Parse (net_svc_print_t *block, msg_t *msg)
|
NET_SVC_Print_Parse (net_svc_print_t *block, msg_t *msg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,6 +76,7 @@ static const char rcsid[] =
|
||||||
#include "crudefile.h"
|
#include "crudefile.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
#include "net_svc.h"
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "sv_progs.h"
|
#include "sv_progs.h"
|
||||||
|
@ -260,11 +261,14 @@ SV_FinalMessage (const char *message)
|
||||||
{
|
{
|
||||||
client_t *cl;
|
client_t *cl;
|
||||||
int i;
|
int i;
|
||||||
|
net_svc_print_t block;
|
||||||
|
|
||||||
|
block.level = PRINT_HIGH;
|
||||||
|
block.message = message;
|
||||||
|
|
||||||
SZ_Clear (net_message->message);
|
SZ_Clear (net_message->message);
|
||||||
MSG_WriteByte (net_message->message, svc_print);
|
MSG_WriteByte (net_message->message, svc_print);
|
||||||
MSG_WriteByte (net_message->message, PRINT_HIGH);
|
NET_SVC_Print_Emit (&block, net_message->message);
|
||||||
MSG_WriteString (net_message->message, message);
|
|
||||||
MSG_WriteByte (net_message->message, svc_disconnect);
|
MSG_WriteByte (net_message->message, svc_disconnect);
|
||||||
|
|
||||||
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++)
|
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++)
|
||||||
|
|
|
@ -49,6 +49,7 @@ static const char rcsid[] =
|
||||||
|
|
||||||
#include "bothdefs.h"
|
#include "bothdefs.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "net_svc.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "sv_progs.h"
|
#include "sv_progs.h"
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ void
|
||||||
SV_FlushRedirect (void)
|
SV_FlushRedirect (void)
|
||||||
{
|
{
|
||||||
char send[8000 + 6];
|
char send[8000 + 6];
|
||||||
|
net_svc_print_t block;
|
||||||
|
|
||||||
if (sv_redirected == RD_PACKET) {
|
if (sv_redirected == RD_PACKET) {
|
||||||
send[0] = 0xff;
|
send[0] = 0xff;
|
||||||
|
@ -80,10 +82,15 @@ SV_FlushRedirect (void)
|
||||||
|
|
||||||
NET_SendPacket (strlen (send) + 1, send, net_from);
|
NET_SendPacket (strlen (send) + 1, send, net_from);
|
||||||
} else if (sv_redirected == RD_CLIENT) {
|
} else if (sv_redirected == RD_CLIENT) {
|
||||||
|
block.level = PRINT_HIGH;
|
||||||
|
block.message = outputbuf;
|
||||||
ClientReliableWrite_Begin (host_client, svc_print,
|
ClientReliableWrite_Begin (host_client, svc_print,
|
||||||
strlen (outputbuf) + 3);
|
strlen (outputbuf) + 3);
|
||||||
ClientReliableWrite_Byte (host_client, PRINT_HIGH);
|
if (host_client->num_backbuf) {
|
||||||
ClientReliableWrite_String (host_client, outputbuf);
|
NET_SVC_Print_Emit (&block, &host_client->backbuf);
|
||||||
|
ClientReliable_FinishWrite (host_client);
|
||||||
|
} else
|
||||||
|
NET_SVC_Print_Emit (&block, &host_client->netchan.message);
|
||||||
}
|
}
|
||||||
// clear it
|
// clear it
|
||||||
outputbuf[0] = 0;
|
outputbuf[0] = 0;
|
||||||
|
@ -220,6 +227,7 @@ SV_PrintToClient (client_t *cl, int level, const char *string)
|
||||||
unsigned char *b;
|
unsigned char *b;
|
||||||
int size;
|
int size;
|
||||||
static int buffer_size;
|
static int buffer_size;
|
||||||
|
net_svc_print_t block;
|
||||||
|
|
||||||
size = strlen (string) + 1;
|
size = strlen (string) + 1;
|
||||||
if (size > buffer_size) {
|
if (size > buffer_size) {
|
||||||
|
@ -239,9 +247,14 @@ SV_PrintToClient (client_t *cl, int level, const char *string)
|
||||||
if (*b != 0xFF)
|
if (*b != 0xFF)
|
||||||
b++;
|
b++;
|
||||||
|
|
||||||
|
block.level = level;
|
||||||
|
block.message = buffer;
|
||||||
ClientReliableWrite_Begin (cl, svc_print, strlen (buffer) + 3);
|
ClientReliableWrite_Begin (cl, svc_print, strlen (buffer) + 3);
|
||||||
ClientReliableWrite_Byte (cl, level);
|
if (cl->num_backbuf) {
|
||||||
ClientReliableWrite_String (cl, buffer);
|
NET_SVC_Print_Emit (&block, &cl->backbuf);
|
||||||
|
ClientReliable_FinishWrite (cl);
|
||||||
|
} else
|
||||||
|
NET_SVC_Print_Emit (&block, &cl->netchan.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue