diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index 9dadd9ec..1e0be026 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -380,6 +380,34 @@ namespace Components } } + bool QuickPatch::IsDynClassnameStub(char* a1) + { + auto version = Zones::GetEntitiesZoneVersion(); + + if (version >= VERSION_LATEST_CODO) + { + for (auto i = 0; i < Game::spawnVars->numSpawnVars; i++) + { + char** kvPair = Game::spawnVars->spawnVars[i]; + auto key = kvPair[0]; + auto val = kvPair[1]; + + bool isSpecOps = strncmp(key, "script_specialops", 17) == 0; + bool isSpecOpsOnly = val[0] == '1' && val[1] == '\0'; + + if (isSpecOps && isSpecOpsOnly) + { + // This will prevent spawning of any entity that contains "script_specialops: '1'" + // It removes extra hitboxes / meshes on 461+ CODO multiplayer maps + return true; + } + } + } + + // Passthrough to the game's own IsDynClassname + return Utils::Hook::Call(0x444810)(a1); + } + QuickPatch::QuickPatch() { QuickPatch::FrameTime = 0; @@ -397,6 +425,9 @@ namespace Components ntdll.InvokePascal("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data); }); + // Filtering any mapents that is intended for Spec:Ops gamemode (CODO) and prevent them from spawning + Utils::Hook(0x5FBD6E, QuickPatch::IsDynClassnameStub, HOOK_CALL).install()->quick(); + // bounce dvar sv_enableBounces = Game::Dvar_RegisterBool("sv_enableBounces", false, Game::DVAR_FLAG_REPLICATED, "Enables bouncing on the server"); Utils::Hook(0x4B1B2D, QuickPatch::BounceStub, HOOK_JUMP).install()->quick(); diff --git a/src/Components/Modules/QuickPatch.hpp b/src/Components/Modules/QuickPatch.hpp index 37402355..1b0c979b 100644 --- a/src/Components/Modules/QuickPatch.hpp +++ b/src/Components/Modules/QuickPatch.hpp @@ -47,5 +47,6 @@ namespace Components static void PlayerCollisionStub(); static Game::dvar_t* g_playerEjection; static void PlayerEjectionStub(); + static bool IsDynClassnameStub(char* a1); }; } diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index d72d4b45..30572989 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -4,6 +4,7 @@ namespace Components { int Zones::ZoneVersion; + int Zones::EntitiesVersion; int Zones::FxEffectIndex; char* Zones::FxEffectStrings[64]; @@ -2561,6 +2562,8 @@ namespace Components int Zones::LoadMapEnts(bool atStreamStart, Game::MapEnts* buffer, int size) { + EntitiesVersion = Zones::Version(); + if (Zones::Version() >= 446) { size /= 44; diff --git a/src/Components/Modules/Zones.hpp b/src/Components/Modules/Zones.hpp index a869b1c0..dd1b5df6 100644 --- a/src/Components/Modules/Zones.hpp +++ b/src/Components/Modules/Zones.hpp @@ -24,10 +24,13 @@ namespace Components static int Version() { return Zones::ZoneVersion; }; + static int GetEntitiesZoneVersion() { return Zones::EntitiesVersion; }; + private: static int ZoneVersion; - + static int EntitiesVersion; + static int FxEffectIndex; static char* FxEffectStrings[64];