/* ==================== SV_MVDStop stop recording a demo ==================== */ void SV_MVDStop (int reason) { if (!sv.mvdrecording) { Com_Printf ("Not recording a demo.\n"); return; } if (reason == 2) { DestCloseAllFlush(true); // stop and remove if (!demo.dest) sv.mvdrecording = false; SV_BroadcastPrintf (PRINT_CHAT, "Server recording canceled, demo removed\n"); Cvar_ForceSet(Cvar_Get("serverdemo", "", CVAR_ROM), ""); return; } // write a disconnect message to the demo file // clearup to be sure message will fit demo.dbuf->cursize = 0; demo.dbuf->h = NULL; demo.dbuf->bufsize = 0; MVDWrite_Begin(dem_all, 0, 2+strlen("EndOfDemo")); MSG_WriteByte ((sizebuf_t*)demo.dbuf, svc_disconnect); MSG_WriteString ((sizebuf_t*)demo.dbuf, "EndOfDemo"); SV_MVDWritePackets(demo.parsecount - demo.lastwritten + 1); // finish up DestCloseAllFlush(false); if (!demo.dest) sv.mvdrecording = false; if (!reason) SV_BroadcastPrintf (PRINT_CHAT, "Server recording completed\n"); else SV_BroadcastPrintf (PRINT_CHAT, "Server recording stoped\nMax demo size exceeded\n"); Cvar_ForceSet(Cvar_Get("serverdemo", "", CVAR_ROM), ""); }
void SV_MVDPings (void) { client_t *client; int j; for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) { if (client->state != cs_spawned) continue; MVDWrite_Begin (dem_all, 0, 7); MSG_WriteByte((sizebuf_t*)demo.dbuf, svc_updateping); MSG_WriteByte((sizebuf_t*)demo.dbuf, j); MSG_WriteShort((sizebuf_t*)demo.dbuf, SV_CalcPing(client)); MSG_WriteByte((sizebuf_t*)demo.dbuf, svc_updatepl); MSG_WriteByte ((sizebuf_t*)demo.dbuf, j); MSG_WriteByte ((sizebuf_t*)demo.dbuf, client->lossage); } }
/* ================== SV_ConSay_f ================== */ void SV_ConSay_f(void) { client_t *client; int j; char *p; char text[1024]; if (Cmd_Argc () < 2) return; strcpy (text, "console: "); p = Cmd_Args(); if (*p == '"') { p++; p[strlen(p)-1] = 0; } strcat(text, p); for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) { if (client->state != cs_spawned) continue; SV_ClientPrintf(client, PRINT_CHAT, "%s\n", text); } if (sv.mvdrecording) { MVDWrite_Begin (dem_all, 0, strlen(text)+3); MSG_WriteByte ((sizebuf_t*)demo.dbuf, svc_print); MSG_WriteByte ((sizebuf_t*)demo.dbuf, PRINT_CHAT); MSG_WriteString ((sizebuf_t*)demo.dbuf, text); } }