Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
46 if (buf->overflowed) {
48 Com_WPrintf(
"Demo message overflowed (should never happen).\n");
55 msglen = LittleLong(buf->cursize);
60 if (ret != buf->cursize)
63 Com_DDPrintf(
"%s: wrote %"PRIz
" bytes\n", __func__, buf->cursize);
78 entity_packed_t oldpack, newpack;
79 entity_state_t *oldent, *newent;
80 int oldindex, newindex;
82 int i, from_num_entities;
85 from_num_entities = 0;
92 while (newindex < to->numEntities || oldindex < from_num_entities) {
96 i = (to->
firstEntity + newindex) & PARSE_ENTITIES_MASK;
98 newnum = newent->number;
101 if (oldindex >= from_num_entities) {
104 i = (from->
firstEntity + oldindex) & PARSE_ENTITIES_MASK;
106 oldnum = oldent->number;
109 if (newnum == oldnum) {
118 newent->number <=
cl.
maxclients ? MSG_ES_NEWENTITY : 0);
124 if (newnum < oldnum) {
133 if (newnum > oldnum) {
146 int fromnum,
int tonum)
148 player_packed_t oldpack, newpack;
176 #define FRAME_PRE (cls.demo.frames_written)
177 #define FRAME_CUR (cls.demo.frames_written + 1)
212 Com_DPrintf(
"Demo frame overflowed (%"PRIz
" + %"PRIz
" > %"PRIz
")\n",
218 Com_WPrintf(
"Too many demo frames don't fit into %"PRIz
" bytes.\n"
219 "Try to increase 'cl_demomsglen' value and restart recording.\n",
240 sec = frames / 10; frames %= 10;
241 min = sec / 60; sec %= 60;
243 len +=
Q_scnprintf(buffer + len, size - len,
", %d:%02d.%d",
247 len +=
Q_scnprintf(buffer + len, size - len,
", %d frame%s dropped",
253 len +=
Q_scnprintf(buffer + len, size - len,
", %d message%s dropped",
271 char buffer[MAX_QPATH];
274 Com_Printf(
"Not recording a demo.\n");
279 msglen = (uint32_t)-1;
293 Com_Printf(
"Stopped demo (%s).\n", buffer);
300 {
"h",
"help",
"display this message" },
301 {
"z",
"compress",
"compress demo with gzip" },
302 {
"e",
"extended",
"use extended packet size" },
303 {
"s",
"standard",
"use standard packet size" },
318 char buffer[MAX_OSPATH];
322 entity_packed_t
pack;
325 unsigned mode = FS_MODE_WRITE;
329 MAX_PACKETLEN_WRITABLE);
335 Com_Printf(
"Begin client demo recording.\n");
339 mode |= FS_FLAG_GZIP;
341 size = MAX_PACKETLEN_WRITABLE;
344 size = MAX_PACKETLEN_WRITABLE_DEFAULT;
353 Com_Printf(
"Already recording (%s).\n", buffer);
358 Com_Printf(
"Missing filename argument.\n");
364 Com_Printf(
"You must be in a level to record.\n");
377 Com_Printf(
"Recording client demo to %s.\n", buffer);
407 for (i = 0; i < MAX_CONFIGSTRINGS; i++) {
416 if (
msg_write.cursize + len + 4 > size) {
423 MSG_WriteData(s, len);
428 for (i = 1; i < MAX_EDICTS; i++) {
461 for (i = 0; i < CS_BITMAP_LONGS; i++) {
462 if (((uint32_t *)
cl.
dcs)[i] == 0)
466 for (j = 0; j < 32; j++, index++) {
467 if (!Q_IsBitSet(
cl.
dcs, index))
502 Com_Printf(
"Not recording a demo.\n");
507 Com_Printf(
"Suspended demo recording.\n");
518 Com_Printf(
"Resumed demo recording.\n");
538 return read < 0 ? read : Q_ERR_UNEXPECTED_EOF;
542 if (CHECK_GZIP_HEADER(ul)) {
549 return read < 0 ? read : Q_ERR_UNEXPECTED_EOF;
554 if (ul == MVD_MAGIC) {
557 return read < 0 ? read : Q_ERR_UNEXPECTED_EOF;
560 return Q_ERR_UNEXPECTED_EOF;
562 msglen = LittleShort(us);
565 if (ul == (uint32_t)-1) {
566 return Q_ERR_UNEXPECTED_EOF;
568 msglen = LittleLong(ul);
574 return Q_ERR_INVALID_FORMAT;
582 if (read != msglen) {
583 return read < 0 ? read : Q_ERR_UNEXPECTED_EOF;
597 return read < 0 ? read : Q_ERR_UNEXPECTED_EOF;
601 if (msglen == (uint32_t)-1) {
605 msglen = LittleLong(msglen);
607 return Q_ERR_INVALID_FORMAT;
615 if (read != msglen) {
616 return read < 0 ? read : Q_ERR_UNEXPECTED_EOF;
628 Com_Error(ERR_DISCONNECT,
"Demo finished");
660 if (ret < 0 || (ret == 0 && wait == 0)) {
695 char name[MAX_OSPATH];
700 Com_Printf(
"Usage: %s <filename>\n",
Cmd_Argv(0));
712 Com_Printf(
"Couldn't read %s: %s\n", name,
Q_ErrorString(type));
721 Com_Printf(
"MVD support was not compiled in.\n");
728 SV_Shutdown(
"Server was killed.\n", ERR_DISCONNECT);
753 FS_File_g(
"demos",
"*.dm2;*.dm2.gz;*.mvd2;*.mvd2.gz", FS_SEARCH_SAVEPATH | FS_SEARCH_BYFILTER, ctx);
802 for (i = 0; i < UPDATE_BACKUP; i++) {
804 frame = &
cl.
frames[j & UPDATE_MASK];
816 for (i = 0; i < MAX_CONFIGSTRINGS; i++) {
820 if (!strcmp(from, to))
829 MSG_WriteData(to, len);
837 snap = Z_Malloc(
sizeof(*snap) +
msg_write.cursize - 1);
888 if (len > 0 && ofs > 0) {
906 int i, j, ret, index, frames, dest, prev;
910 Com_Printf(
"Usage: %s [+-]<timespec>\n",
Cmd_Argv(0));
922 Com_Printf(
"Not playing a demo.\n");
928 if (*to ==
'-' || *to ==
'+') {
930 if (!Com_ParseTimespec(to + 1, &frames)) {
931 Com_Printf(
"Invalid relative timespec.\n");
939 if (!Com_ParseTimespec(to, &dest)) {
940 Com_Printf(
"Invalid absolute timespec.\n");
973 Com_DPrintf(
"found snap at %d\n", snap->
framenum);
984 for (i = 0; i < MAX_CONFIGSTRINGS; i++) {
988 if (!strcmp(from, to))
1001 }
else if (frames < 0) {
1002 Com_Printf(
"Couldn't seek backwards without snapshots!\n");
1026 for (i = 0; i < CS_BITMAP_LONGS; i++) {
1027 if (((uint32_t *)
cl.
dcs)[i] == 0)
1031 for (j = 0; j < 32; j++, index++) {
1032 if (Q_IsBitSet(
cl.
dcs, index))
1040 memset(&
cl.oldkeyframe, 0,
sizeof(
cl.oldkeyframe));
1069 if (index >= CS_PLAYERSKINS && index < CS_PLAYERSKINS + MAX_CLIENTS) {
1070 if (index - CS_PLAYERSKINS == clientNum) {
1071 Q_strlcpy(info->pov,
string,
sizeof(info->pov));
1072 p = strchr(info->pov,
'\\');
1077 }
else if (index == CS_MODELS + 1) {
1078 len = strlen(
string);
1080 memcpy(info->map,
string + 5, len - 9);
1081 info->map[len - 9] = 0;
1095 char string[MAX_QPATH];
1096 int clientNum, type;
1129 if (
c != svc_configstring) {
1133 if (index < 0 || index >= MAX_CONFIGSTRINGS) {
1155 if (index == MAX_CONFIGSTRINGS) {
1158 if (index < 0 || index >= MAX_CONFIGSTRINGS) {
1198 Com_Printf(
"%u frames, %3.1f seconds: %3.1f fps\n",
1211 Com_DPrintf(
"Freed %"PRIz
" bytes of snaps\n", total);
void SV_Shutdown(const char *finalmsg, error_type_t type)
char configstrings[MAX_CONFIGSTRINGS][MAX_QPATH]
cvar_t * Cvar_Set(const char *var_name, const char *value)
qhandle_t FS_EasyOpenFile(char *buf, size_t size, unsigned mode, const char *dir, const char *name, const char *ext)
static demosnap_t * find_snapshot(int framenum)
void CL_UpdateRecordingSetting(void)
entity_state_t entityStates[MAX_PARSE_ENTITIES]
static int parse_next_message(int wait)
byte msg_read_buffer[MAX_MSGLEN]
size_t Com_FormatSizeLong(char *dest, size_t destsize, off_t bytes)
struct client_static_s::@3 demo
ssize_t FS_Read(void *buf, size_t len, qhandle_t f)
static void parse_info_string(demoInfo_t *info, int clientNum, int index, const char *string)
qerror_t FS_FilterFile(qhandle_t f)
void S_StopAllSounds(void)
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
const char * Q_ErrorString(qerror_t error)
void SCR_UpdateScreen(void)
static byte demo_buffer[MAX_PACKETLEN]
static void emit_packet_entities(server_frame_t *from, server_frame_t *to)
static void CL_Seek_f(void)
static void CL_Demo_c(genctx_t *ctx, int argnum)
void SZ_WriteByte(sizebuf_t *sb, int c)
byte dcs[CS_BITMAP_BYTES]
void SZ_WriteShort(sizebuf_t *sb, int c)
ssize_t FS_Tell(qhandle_t f)
void Cmd_PrintUsage(const cmd_option_t *opt, const char *suffix)
qboolean CL_WriteDemoMessage(sizebuf_t *buf)
void CL_SeekDemoMessage(void)
void Cbuf_InsertText(cmdbuf_t *buf, const char *text)
static size_t format_demo_size(char *buffer, size_t size)
void MSG_WriteByte(int c)
static int read_first_message(qhandle_t f)
char baseconfigstrings[MAX_CONFIGSTRINGS][MAX_QPATH]
unsigned Sys_Milliseconds(void)
void SZ_Init(sizebuf_t *buf, void *data, size_t size)
static void update_status(void)
void CL_Disconnect(error_type_t type)
static int read_next_message(qhandle_t f)
ssize_t FS_FOpenFile(const char *name, qhandle_t *f, unsigned mode)
void Com_Error(error_type_t type, const char *fmt,...)
void MSG_PackEntity(entity_packed_t *out, const entity_state_t *in, qboolean short_angles)
void MSG_PackPlayer(player_packed_t *out, const player_state_t *in)
static void emit_delta_frame(server_frame_t *from, server_frame_t *to, int fromnum, int tonum)
int Cmd_ParseOptions(const cmd_option_t *opt)
entity_state_t baselines[MAX_EDICTS]
static const cmdreg_t c_demo[]
void Cbuf_AddText(cmdbuf_t *buf, const char *text)
char * va(const char *format,...)
void FS_File_g(const char *path, const char *ext, unsigned flags, genctx_t *ctx)
void CL_EmitDemoFrame(void)
void CL_ClearEffects(void)
char layout[MAX_NET_STRING]
static void CL_Record_f(void)
byte areabits[MAX_MAP_AREA_BYTES]
static cvar_t * cl_demowait
void Cmd_Register(const cmdreg_t *reg)
void MSG_WriteDeltaEntity(const entity_packed_t *from, const entity_packed_t *to, msgEsFlags_t flags)
static size_t format_demo_status(char *buffer, size_t size)
static cvar_t * cl_demosnaps
char servername[MAX_OSPATH]
size_t Q_strlcpy(char *dst, const char *src, size_t size)
demoInfo_t * CL_GetDemoInfo(const char *path, demoInfo_t *info)
void MSG_WriteShort(int c)
static cvar_t * cl_demomsglen
static const cmd_option_t o_record[]
static void CL_PlayDemo_f(void)
static void CL_Suspend_f(void)
ssize_t FS_Length(qhandle_t f)
void CL_UpdateConfigstring(int index)
ssize_t FS_Write(const void *buf, size_t len, qhandle_t f)
server_frame_t frames[UPDATE_BACKUP]
void MSG_WriteString(const char *string)
void MSG_WriteLong(int c)
int Cvar_ClampInteger(cvar_t *var, int min, int max)
size_t MSG_ReadString(char *dest, size_t size)
char * COM_SkipPath(const char *pathname)
void Cbuf_Execute(cmdbuf_t *buf)
void Cmd_PrintHelp(const cmd_option_t *opt)
static void finish_demo(int ret)
void Con_Popup(qboolean force)
static uint32_t pack(uint64_t n)
char * Cvar_VariableString(const char *var_name)
void FS_FCloseFile(qhandle_t f)
void CL_CleanupDemos(void)
void CL_DemoFrame(int msec)
qerror_t FS_Seek(qhandle_t f, off_t offset)
void CL_GTV_Transmit(void)
void CL_EmitDemoSnapshot(void)
size_t Q_scnprintf(char *dest, size_t size, const char *fmt,...)
void CL_ParseServerMessage(void)
void CL_FirstDemoFrame(void)
void SZ_Clear(sizebuf_t *buf)
void MSG_WriteDeltaPlayerstate_Default(const player_packed_t *from, const player_packed_t *to)
static void resume_record(void)