diff --git a/include/Makefile.am b/include/Makefile.am index 4578ff53b..883b78027 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -12,7 +12,7 @@ EXTRA_DIST = asm_i386.h alsa_funcs_list.h adivtab.h anorm_dots.h anorms.h \ r_local.h r_screen.h r_shared.h rua_internal.h sbar.h skin_stencil.h \ snd_render.h varrays.h vgamodes.h view.h vregset.h winquake.h world.h \ \ - qw/msg_backbuf.h qw/msg_ucmd.h qw/pmove.h qw/protocol.h \ + qw/bothdefs.h qw/msg_backbuf.h qw/msg_ucmd.h qw/pmove.h qw/protocol.h \ \ win32/fnmatch.h \ \ diff --git a/qw/include/bothdefs.h b/include/qw/bothdefs.h similarity index 100% rename from qw/include/bothdefs.h rename to include/qw/bothdefs.h diff --git a/qtv/include/server.h b/qtv/include/server.h index 5dc50225a..44f4c8508 100644 --- a/qtv/include/server.h +++ b/qtv/include/server.h @@ -80,6 +80,7 @@ typedef struct server_s { struct info_s *info; char *soundlist[MAX_SOUNDS + 1]; char *modellist[MAX_MODELS + 1]; + char *lightstyles[MAX_LIGHTSTYLES]; int playermodel; struct client_s *clients; diff --git a/qtv/source/client.c b/qtv/source/client.c index b4c3f9f24..f805ac788 100644 --- a/qtv/source/client.c +++ b/qtv/source/client.c @@ -54,6 +54,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/info.h" #include "QF/va.h" +#include "qw/bothdefs.h" #include "qw/msg_ucmd.h" #include "qw/protocol.h" @@ -159,7 +160,11 @@ static void cl_prespawn_f (client_t *cl, void *unused) { const char *cmd; + const char *info; server_t *sv = cl->server; + player_t *pl; + int i; + sizebuf_t *msg; if (!cl->server) return; @@ -168,6 +173,51 @@ cl_prespawn_f (client_t *cl, void *unused) Client_New (cl); return; } + for (i = 0, pl = sv->players; i < MAX_SV_PLAYERS; i++, pl++) { + if (!pl->info) + continue; + msg = MSG_ReliableCheckBlock (&cl->backbuf, 24 + pl->info->cursize); + MSG_WriteByte (msg, svc_updatefrags); + MSG_WriteByte (msg, i); + MSG_WriteShort (msg, pl->frags); + MSG_WriteByte (msg, svc_updateping); + MSG_WriteByte (msg, i); + MSG_WriteShort (msg, 333/*XXX*/); + MSG_WriteByte (msg, svc_updatepl); + MSG_WriteByte (msg, i); + MSG_WriteByte (msg, 0/*XXX*/); + MSG_WriteByte (msg, svc_updateentertime); + MSG_WriteByte (msg, i); + MSG_WriteFloat (msg, 0/*XXX*/); + info = pl->info ? Info_MakeString (pl->info, 0) : ""; + MSG_WriteByte (msg, svc_updateuserinfo); + MSG_WriteByte (msg, i); + MSG_WriteLong (msg, pl->uid); + MSG_WriteString (msg, info); + if (cl->backbuf.num_backbuf) + MSG_Reliable_FinishWrite (&cl->backbuf); + } + for (i = 0; i < MAX_LIGHTSTYLES; i++) { + MSG_ReliableWrite_Begin (&cl->backbuf, svc_lightstyle, + 3 + (sv->lightstyles[i] ? + strlen (sv->lightstyles[i]) : 1)); + MSG_ReliableWrite_Byte (&cl->backbuf, i); + MSG_ReliableWrite_String (&cl->backbuf, sv->lightstyles[i]); + } + MSG_ReliableWrite_Begin (&cl->backbuf, svc_updatestatlong, 6); + MSG_ReliableWrite_Byte (&cl->backbuf, STAT_TOTALSECRETS); + MSG_ReliableWrite_Long (&cl->backbuf, + sv->players[0].stats[STAT_TOTALSECRETS]); + MSG_ReliableWrite_Begin (&cl->backbuf, svc_updatestatlong, 6); + MSG_ReliableWrite_Byte (&cl->backbuf, STAT_TOTALMONSTERS); + MSG_ReliableWrite_Long (&cl->backbuf, + sv->players[0].stats[STAT_TOTALMONSTERS]); + MSG_ReliableWrite_Begin (&cl->backbuf, svc_updatestatlong, 6); + MSG_ReliableWrite_Byte (&cl->backbuf, STAT_SECRETS); + MSG_ReliableWrite_Long (&cl->backbuf, sv->players[0].stats[STAT_SECRETS]); + MSG_ReliableWrite_Begin (&cl->backbuf, svc_updatestatlong, 6); + MSG_ReliableWrite_Byte (&cl->backbuf, STAT_SECRETS); + MSG_ReliableWrite_Long (&cl->backbuf, sv->players[0].stats[STAT_SECRETS]); cmd = va ("cmd spawn %i 0\n", cl->server->spawncount); MSG_ReliableWrite_Begin (&cl->backbuf, svc_stufftext, strlen (cmd) + 2); MSG_ReliableWrite_String (&cl->backbuf, cmd); @@ -247,6 +297,9 @@ cl_serverinfo_f (client_t *cl, void *unused) static void cl_download_f (client_t *cl, void *unused) { + MSG_ReliableWrite_Begin (&cl->backbuf, svc_download, 4); + MSG_ReliableWrite_Short (&cl->backbuf, -1); + MSG_ReliableWrite_Byte (&cl->backbuf, 0); } static void diff --git a/qtv/source/sv_parse.c b/qtv/source/sv_parse.c index e66108225..83d78957e 100644 --- a/qtv/source/sv_parse.c +++ b/qtv/source/sv_parse.c @@ -784,6 +784,19 @@ sv_print (server_t *sv, qmsg_t *msg) Server_Broadcast (sv, 1, data, len); } +static void +sv_lightstyle (server_t *sv, qmsg_t *msg) +{ + int ind = MSG_ReadByte (msg); + const char *style = MSG_ReadString (msg); + + if (ind > MAX_LIGHTSTYLES) + return; + if (sv->lightstyles[ind]) + free (sv->lightstyles[ind]); + sv->lightstyles[ind] = strdup (style); +} + void sv_parse (server_t *sv, qmsg_t *msg, int reliable) { @@ -950,9 +963,7 @@ sv_parse (server_t *sv, qmsg_t *msg, int reliable) sv_spawnstatic (sv, msg); break; case svc_lightstyle: - //XXX - MSG_ReadByte (msg); - MSG_ReadString (msg); + sv_lightstyle (sv, msg); break; } } diff --git a/qw/include/Makefile.am b/qw/include/Makefile.am index 9dec1b7bb..8a9d90813 100644 --- a/qw/include/Makefile.am +++ b/qw/include/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS= foreign EXTRA_DIST = \ - bothdefs.h cl_cam.h cl_chat.h cl_demo.h cl_ents.h cl_input.h \ + cl_cam.h cl_chat.h cl_demo.h cl_ents.h cl_input.h \ cl_main.h cl_parse.h cl_pred.h cl_skin.h cl_slist.h cl_tent.h \ client.h crudefile.h game.h host.h server.h sv_gib.h sv_demo.h \ sv_pr_cmds.h sv_pr_qwe.h sv_progs.h sv_qtv.h diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index ac7854640..2edba69e4 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -47,7 +47,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "qw/msg_ucmd.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "cl_cam.h" #include "cl_ents.h" #include "cl_main.h" diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index a2759d03f..334dd0e88 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -85,7 +85,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/vid.h" #include "QF/gib.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "buildnum.h" #include "cl_cam.h" #include "cl_chat.h" diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 366b88fbd..457685651 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -61,7 +61,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/dstring.h" #include "QF/gib.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "cl_cam.h" #include "cl_chat.h" #include "cl_ents.h" diff --git a/qw/source/cl_pred.c b/qw/source/cl_pred.c index f4b0a8843..7910418bf 100644 --- a/qw/source/cl_pred.c +++ b/qw/source/cl_pred.c @@ -37,7 +37,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/cvar.h" #include "QF/keys.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "compat.h" #include "cl_ents.h" #include "cl_pred.h" diff --git a/qw/source/cl_slist.c b/qw/source/cl_slist.c index 60c8a7493..2b165c893 100644 --- a/qw/source/cl_slist.c +++ b/qw/source/cl_slist.c @@ -70,7 +70,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/sys.h" #include "QF/va.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "cl_main.h" #include "cl_slist.h" #include "client.h" diff --git a/qw/source/cl_view.c b/qw/source/cl_view.c index dfead6e6f..47c57dc99 100644 --- a/qw/source/cl_view.c +++ b/qw/source/cl_view.c @@ -40,7 +40,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/screen.h" #include "QF/vid.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "cl_main.h" #include "client.h" #include "compat.h" diff --git a/qw/source/sbar.c b/qw/source/sbar.c index 4ef9828de..c878c7845 100644 --- a/qw/source/sbar.c +++ b/qw/source/sbar.c @@ -57,7 +57,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/vid.h" #include "QF/view.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "cl_cam.h" #include "cl_parse.h" #include "client.h" diff --git a/qw/source/sv_ccmds.c b/qw/source/sv_ccmds.c index 15a9b1952..08604c2ea 100644 --- a/qw/source/sv_ccmds.c +++ b/qw/source/sv_ccmds.c @@ -52,7 +52,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/sys.h" #include "QF/va.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "compat.h" #include "server.h" #include "sv_demo.h" diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 3f1b034e4..8af792868 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -79,7 +79,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/ver_check.h" #include "QF/zone.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "buildnum.h" #include "compat.h" #include "crudefile.h" diff --git a/qw/source/sv_recorder.c b/qw/source/sv_recorder.c index 1e2257ac4..41f593b34 100644 --- a/qw/source/sv_recorder.c +++ b/qw/source/sv_recorder.c @@ -49,7 +49,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/sizebuf.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "server.h" #include "sv_demo.h" #include "sv_progs.h" diff --git a/qw/source/sv_send.c b/qw/source/sv_send.c index 2129d8013..e4a150d6d 100644 --- a/qw/source/sv_send.c +++ b/qw/source/sv_send.c @@ -49,7 +49,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/sound.h" // FIXME: DEFAULT_SOUND_PACKET_* #include "QF/sys.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "compat.h" #include "server.h" #include "sv_progs.h" diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index 3e4200450..42914610a 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -59,7 +59,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "qw/msg_ucmd.h" #include "qw/msg_ucmd.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "compat.h" #include "qw/pmove.h" #include "server.h" diff --git a/qw/source/teamplay.c b/qw/source/teamplay.c index dc158b7fd..356db3213 100644 --- a/qw/source/teamplay.c +++ b/qw/source/teamplay.c @@ -54,7 +54,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/skin.h" #include "QF/gib.h" -#include "bothdefs.h" +#include "qw/bothdefs.h" #include "cl_input.h" #include "client.h" #include "compat.h"