From 78eadd4eb1b70fb7be47a412da3ce582d211a089 Mon Sep 17 00:00:00 2001 From: rackover Date: Fri, 2 Jul 2021 11:43:04 +0200 Subject: [PATCH] WIP entity skipping --- src/Components/Modules/QuickPatch.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index 4b0e78b3..69bc0e66 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -396,6 +396,28 @@ namespace Components return std::function < T >(reinterpret_cast(procAddr)); } + int __cdecl G_ParseSpawnVars(Game::SpawnVar* spawnVar){ + if (Zones::Version() >= VERSION_ALPHA2) { + for (auto i = 0; i < spawnVar->numSpawnVars; i++) + { + char** kvPair = spawnVar->spawnVars[i]; + auto key = kvPair[0]; + auto val = kvPair[1]; + + bool isSpecOps = strncmp(key, "script_specialops", 16) == 0; + bool isSpecOpsOnly = *val == 49; // 49 => Ascii "1" + + if (isSpecOps && isSpecOpsOnly) { + spawnVar->spawnVars[i] = nullptr; + } + } + } + + Components::Logger::Print("G_SpawnString: %s %d\n", spawnVar->spawnVarChars, spawnVar->numSpawnVarChars); + + return Utils::Hook::Call(0x4B3410)(spawnVar); + } + QuickPatch::QuickPatch() { QuickPatch::FrameTime = 0; @@ -439,6 +461,10 @@ namespace Components (0xC000007B /*0x0000000A*/, 0, nullptr, nullptr, OptionShutdownSystem, &response); }); + Utils::Hook(0x4D8845, G_ParseSpawnVars, HOOK_CALL).install()->quick(); + Utils::Hook(0x4D8880, G_ParseSpawnVars, HOOK_CALL).install()->quick(); + Utils::Hook(0x4D886A, G_ParseSpawnVars, 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();