diff --git a/.gitignore b/.gitignore index 717bd12d74..3ef27d03f7 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ Release_*/ *.idb *.pdb *.rc -*.bin *.vcxproj* *.sln *.dll* diff --git a/css_zstd_training_set.tar.gz b/css_zstd_training_set.tar.gz deleted file mode 100644 index cb0178906b..0000000000 Binary files a/css_zstd_training_set.tar.gz and /dev/null differ diff --git a/engine/cl_main.cpp b/engine/cl_main.cpp index 416d1fc692..b86515f36d 100644 --- a/engine/cl_main.cpp +++ b/engine/cl_main.cpp @@ -89,7 +89,7 @@ void WriteConfig_f( ConVar *var, const char *pOldString ); // If we get more than 250 messages in the incoming buffer queue, dump any above this # #define MAX_INCOMING_MESSAGES 250 // Size of command send buffer -#define MAX_CMD_BUFFER 4000 +#define MAX_CMD_BUFFER 0x10000 CGlobalVarsBase g_ClientGlobalVariables( true ); IVideoRecorder *g_pVideoRecorder = NULL; diff --git a/engine/common.cpp b/engine/common.cpp index 74597905c3..544e5c0432 100644 --- a/engine/common.cpp +++ b/engine/common.cpp @@ -1391,7 +1391,7 @@ bool COM_BufferToBufferCompress_ZSTD(void* dest, Assert( destLen ); Assert( source ); -//#define ZSTD_GENERATE_TRAINING_SET +#define ZSTD_GENERATE_TRAINING_SET #ifdef ZSTD_GENERATE_TRAINING_SET static int zstdTrainingSetCount = 0; diff --git a/game/shared/usercmd.cpp b/game/shared/usercmd.cpp index b19f39cc84..83911890b1 100644 --- a/game/shared/usercmd.cpp +++ b/game/shared/usercmd.cpp @@ -10,7 +10,8 @@ #include "bitbuf.h" #include "checksum_md5.h" #include "const.h" -#include "platform.h" +#include "utlvector.h" +#include "shareddefs.h" // memdbgon must be the last include file in a .cpp file!!! #ifdef CLIENT_DLL @@ -176,56 +177,54 @@ void WriteUsercmd( bf_write *buf, const CUserCmd *to, const CUserCmd *from ) else { buf->WriteOneBit( 0 ); - } + } + - int entityCount = 0; #ifdef CLIENT_DLL + int highestEntityIndex = 0; if (cl_entitylist) - entityCount = cl_entitylist->GetHighestEntityIndex(); + highestEntityIndex = cl_entitylist->GetHighestEntityIndex(); #else - entityCount = MAX_EDICTS; + static constexpr auto highestEntityIndex = MAX_EDICTS-1; #endif - buf->WriteSignedVarInt32(entityCount); + // Write entity count + buf->WriteUBitLong(highestEntityIndex, 11); - if (entityCount > 0) + // Write finally simulation data with entity index + for (unsigned int i = 0; i <= highestEntityIndex; i++) { - for (int i = 0; i <= entityCount; i++) + if (from->simulationdata[i].m_flInterpolatedSimulationTime + != to->simulationdata[i].m_flInterpolatedSimulationTime) { - if (to->simulationdata[i].m_flInterpolatedSimulationTime - != from->simulationdata[i].m_flInterpolatedSimulationTime) - { - buf->WriteOneBit(1); - buf->WriteFloat( - to->simulationdata[i].m_flInterpolatedSimulationTime); - } - else - { - buf->WriteOneBit(0); - } + buf->WriteOneBit(1); + buf->WriteBitFloat(to->simulationdata[i].m_flInterpolatedSimulationTime); + } + else + { + buf->WriteOneBit(0); + } - if (to->simulationdata[i].m_flSimulationTime - != from->simulationdata[i].m_flSimulationTime) - { - buf->WriteOneBit(1); - buf->WriteFloat(to->simulationdata[i].m_flSimulationTime); - } - else - { - buf->WriteOneBit(0); - } + if (from->simulationdata[i].m_flSimulationTime != to->simulationdata[i].m_flSimulationTime) + { + buf->WriteOneBit(1); + buf->WriteBitFloat(to->simulationdata[i].m_flSimulationTime); + } + else + { + buf->WriteOneBit(0); } } - if ( to->debug_hitboxes != from->debug_hitboxes ) - { - buf->WriteOneBit( 1 ); - buf->WriteByte( to->debug_hitboxes ); - } - else - { - buf->WriteOneBit( 0 ); - } + if (to->debug_hitboxes != from->debug_hitboxes) + { + buf->WriteOneBit(1); + buf->WriteUBitLong(to->debug_hitboxes, 2); + } + else + { + buf->WriteOneBit(0); + } #if defined( HL2_CLIENT_DLL ) if ( to->entitygroundcontact.Count() != 0 ) @@ -346,29 +345,24 @@ void ReadUsercmd( bf_read *buf, CUserCmd *move, CUserCmd *from ) move->mousedy = buf->ReadShort(); } - const auto entityCount = buf->ReadSignedVarInt32(); + const auto highestEntityIndex = buf->ReadUBitLong(11); - if (entityCount > 0) + for (unsigned int i = 0; i <= highestEntityIndex;i++) { - for (int i = 0; i <= entityCount; i++) - { - if (buf->ReadOneBit()) - { - move->simulationdata[i].m_flInterpolatedSimulationTime = buf - ->ReadFloat(); - } + if (buf->ReadOneBit()) + { + move->simulationdata[i].m_flInterpolatedSimulationTime = buf->ReadBitFloat(); + } - if (buf->ReadOneBit()) - { - move->simulationdata[i].m_flSimulationTime = buf - ->ReadFloat(); - } - } - } + if (buf->ReadOneBit()) + { + move->simulationdata[i].m_flSimulationTime = buf->ReadBitFloat(); + } + } if ( buf->ReadOneBit() ) { - move->debug_hitboxes = (CUserCmd::debug_hitboxes_t)buf->ReadByte(); + move->debug_hitboxes = (CUserCmd::debug_hitboxes_t)buf->ReadUBitLong(2); } #if defined( HL2_DLL ) diff --git a/css_zstd_training_set.dictionary b/zstd_game_data/css.dictionary similarity index 58% rename from css_zstd_training_set.dictionary rename to zstd_game_data/css.dictionary index bd91aaefc4..475f1919e9 100644 Binary files a/css_zstd_training_set.dictionary and b/zstd_game_data/css.dictionary differ