/* * @brief Dumps the current net message, prefixed by the length. */ void Cl_WriteDemoMessage(void) { int32_t len; if (!cls.demo_file) return; // if we received an uncompressed frame, write the demo header if (cl.frame.delta_frame < 1 && !Fs_Tell(cls.demo_file)) { Cl_WriteDemoHeader(); } // the first eight bytes are just packet sequencing stuff len = LittleLong(net_message.size - 8); Fs_Write(cls.demo_file, &len, sizeof(len), 1); Fs_Write(cls.demo_file, net_message.data + 8, len, 1); }
/* * Cl_WriteDemoMessage * * Dumps the current net message, prefixed by the length. */ void Cl_WriteDemoMessage(void) { int size; if (!cls.demo_file) return; if (cls.demo_waiting) // we have not yet received a non-delta frame return; if (!ftell(cls.demo_file)) // write header Cl_WriteDemoHeader(); // the first eight bytes are just packet sequencing stuff size = LittleLong(net_message.size - 8); Fs_Write(&size, 4, 1, cls.demo_file); // write the message payload Fs_Write(net_message.data + 8, size, 1, cls.demo_file); }
/** * @brief Dumps the current net message, prefixed by the length. */ void Cl_WriteDemoMessage(void) { if (!cls.demo_file) { return; } if (!Fs_Tell(cls.demo_file)) { if (cl.frame.delta_frame_num < 0) { Com_Debug(DEBUG_CLIENT, "Received uncompressed frame, writing demo header..\n"); Cl_WriteDemoHeader(); } else { return; // wait for an uncompressed packet } } // the first eight bytes are just packet sequencing stuff const int32_t len = LittleLong((int32_t) (net_message.size - 8)); Fs_Write(cls.demo_file, &len, sizeof(len), 1); Fs_Write(cls.demo_file, net_message.data + 8, len, 1); }