From bc30afcbafdb31fa76755eed4d0df8adb2a9ffb7 Mon Sep 17 00:00:00 2001 From: Roxanne Date: Fri, 1 Dec 2023 11:13:28 +0100 Subject: [PATCH] Refresh arena when travelling from one map to another --- src/Components/Modules/Maps.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index aeb62f5e..811d2e5d 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -105,14 +105,15 @@ namespace Components { std::string data = RawFiles::ReadRawFile(name, buffer, size); - if (Maps::UserMap.isValid()) + if (Maps::UserMap.isValid()) { const auto mapname = Maps::UserMap.getName(); const auto arena = GetArenaPath(mapname); if (Utils::IO::FileExists(arena)) { - data.append(Utils::IO::ReadFile(arena)); + // Replace all arenas with just this one + data = Utils::IO::ReadFile(arena); } } @@ -850,6 +851,9 @@ namespace Components // Load usermap arena file Utils::Hook(0x630A88, Maps::LoadArenaFileStub, HOOK_CALL).install()->quick(); + // Always refresh arena when loading or unloading a zone + Utils::Hook::Nop(0x485017, 2); + // Allow hiding specific smodels Utils::Hook(0x50E67C, Maps::HideModelStub, HOOK_CALL).install()->quick();