From c1fde0e07919a2cf8e005a3f3000b7727a681d75 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 14 Jul 2013 16:39:21 +0000 Subject: [PATCH] fix join/observe not updating spectator userinfo properly in mvds. fix a couple of other recent mvd bugs. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4422 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/dotnet2005/ftequake.sln | 1 + engine/server/server.h | 1 + engine/server/sv_main.c | 8 ++++++-- engine/server/sv_mvd.c | 26 ++++++++++++++++++++++---- engine/server/sv_send.c | 2 ++ engine/server/svhl_game.c | 1 - plugins/jabber/jabberclient.c | 6 +++++- 7 files changed, 37 insertions(+), 8 deletions(-) diff --git a/engine/dotnet2005/ftequake.sln b/engine/dotnet2005/ftequake.sln index e3aea23ea..1560ebefb 100644 --- a/engine/dotnet2005/ftequake.sln +++ b/engine/dotnet2005/ftequake.sln @@ -86,6 +86,7 @@ Global {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|x64.ActiveCfg = GLDebug|x64 {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|x64.Build.0 = GLDebug|x64 {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|Win32.ActiveCfg = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|Win32.Build.0 = GLRelease|Win32 {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|x64.ActiveCfg = GLRelease|x64 {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|x64.Build.0 = GLRelease|x64 {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|Win32.ActiveCfg = MDebug|Win32 diff --git a/engine/server/server.h b/engine/server/server.h index 57e5dec5a..64b81e738 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -1318,6 +1318,7 @@ char *SV_Demo_CurrentOutput(void); void SV_MVDInit(void); char *SV_MVDNum(char *buffer, int bufferlen, int num); void SV_SendMVDMessage(void); +void SV_MVD_WriteReliables(void); qboolean SV_ReadMVD (void); void SV_FlushDemoSignon (void); void DestFlush(qboolean compleate); diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 42bc1e34c..93bace647 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -888,11 +888,12 @@ void SV_GeneratePublicUserInfo(int pext, client_t *cl, char *info, int infolengt //FIXME: we should probably use some sort of priority system instead if I'm honest about it if (pext & PEXT_BIGUSERINFOS) - Q_strncpyz (info, cl->userinfo, sizeof(info)); + Q_strncpyz (info, cl->userinfo, infolength); else { if (infolength >= BASIC_INFO_STRING) infolength = BASIC_INFO_STRING; + *info = 0; for (i = 0; (key = Info_KeyForNumber(cl->userinfo, i)); i++) { if (!*key) @@ -929,7 +930,10 @@ void SV_FullClientUpdate (client_t *client, client_t *to) SV_FullClientUpdate(client, &svs.clients[i]); } if (sv.mvdrecording) - SV_FullClientUpdate(client, &demo.recorder); + { + SV_FullClientUpdate(client, &demo.recorder); + SV_MVD_WriteReliables(); + } return; } diff --git a/engine/server/sv_mvd.c b/engine/server/sv_mvd.c index 1b45458d2..69a6144ac 100644 --- a/engine/server/sv_mvd.c +++ b/engine/server/sv_mvd.c @@ -757,7 +757,7 @@ void SV_MVDPings (void) client_t *client; int j; - for (j = 0, client = svs.clients; j < demo.recorder.max_net_ents; j++, client++) + for (j = 0, client = svs.clients; j < demo.recorder.max_net_clients; j++, client++) { if (client->state != cs_spawned) continue; @@ -1010,6 +1010,24 @@ void SV_WriteMVDMessage (sizebuf_t *msg, int type, int to, float time) DestFlush(false); } +//if you use ClientRelaible to write to demo.recorder's message buffer (for code reuse) call this function to ensure its flushed. +void SV_MVD_WriteReliables(void) +{ + int i; + if (demo.recorder.netchan.message.cursize) + { + SV_WriteMVDMessage(&demo.recorder.netchan.message, dem_all, 0, sv.time); + demo.recorder.netchan.message.cursize = 0; + } + for (i = 0; i < demo.recorder.num_backbuf; i++) + { + demo.recorder.backbuf.data = demo.recorder.backbuf_data[i]; + demo.recorder.backbuf.cursize = demo.recorder.backbuf_size[i]; + SV_WriteMVDMessage(&demo.recorder.backbuf, dem_all, 0, sv.time); + demo.recorder.backbuf_size[i] = 0; + } + demo.recorder.backbuf.cursize = 0; +} /* ==================== @@ -1085,7 +1103,7 @@ qboolean SV_MVDWritePackets (int num) // find two frames // one before the exact time (time - msec) and one after, // then we can interpolte exact position for current frame - for (i = 0, cl = frame->clients, demoinfo = demo.info; i < demo.recorder.max_net_ents ; i++, cl++, demoinfo++) + for (i = 0, cl = frame->clients, demoinfo = demo.info; i < demo.recorder.max_net_clients ; i++, cl++, demoinfo++) { if (cl->parsecount != demo.lastwritten) continue; // not valid @@ -1887,9 +1905,9 @@ void SV_MVD_SendInitialGamestate(mvddest_t *dest) // send current status of all other players - for (i = 0; i < demo.recorder.max_net_ents; i++) + for (i = 0; i < demo.recorder.max_net_clients; i++) { - player = svs.clients + i; + player = &svs.clients[i]; SV_MVD_FullClientUpdate(&buf, player); diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index c2e8ff3ae..8ab8fc8ab 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -2572,6 +2572,8 @@ void SV_SendMVDMessage(void) /*figure out what the stat values should be*/ SV_CalcClientStats(c, statsi, statsf, statss); + //FIXME we should do something about the packet overhead here. each MVDWrite_Begin is a separate packet! + for (j=0 ; j -#include "../../engine/common/netinc.h" #include "xml.h" //#define NOICE @@ -58,6 +58,10 @@ client compat: #define VOIP #endif +#ifdef JINGLE + #include "../../engine/common/netinc.h" +#endif + #define DEFAULTDOMAIN "" #define DEFAULTRESOURCE "Quake" #define QUAKEMEDIATYPE "quake"