From c01a8c55e4882d90076c999c851e30ad868c866d Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Sat, 10 Sep 2022 03:44:16 -0600 Subject: [PATCH] Added block input mainly for free cam --- .../src/user/cheat/visuals/FreeCamera.cpp | 25 +++++++++++++++++++ .../src/user/cheat/visuals/FreeCamera.h | 1 + 2 files changed, 26 insertions(+) diff --git a/cheat-library/src/user/cheat/visuals/FreeCamera.cpp b/cheat-library/src/user/cheat/visuals/FreeCamera.cpp index 785860a..04e952d 100644 --- a/cheat-library/src/user/cheat/visuals/FreeCamera.cpp +++ b/cheat-library/src/user/cheat/visuals/FreeCamera.cpp @@ -25,6 +25,7 @@ namespace cheat::feature FreeCamera::FreeCamera() : Feature(), NF(f_Enabled, "Free Camera", "Visuals::FreeCamera", false), NF(f_FreezeAnimation, "Freeze Character Animation", "Visuals::FreeCamera", false), + NF(f_BlockInput, "Block Input", "Visuals::FreeCamera", false), NF(f_DamageOverlay, "Damage Overlay", "Visuals::FreeCamera", false), NF(f_HpOverlay, "Enemy HP Overlay", "Visuals::FreeCamera", false), NF(f_Speed, "Speed", "Visuals::FreeCamera", 1.0f), @@ -61,6 +62,7 @@ namespace cheat::feature { ConfigWidget("Enable", f_Enabled); ConfigWidget("Freeze Character Animation", f_FreezeAnimation, "Freezes the active character's animation."); + ConfigWidget("Block User Input", f_BlockInput, "If enabled, any input will be blocked."); if (f_Enabled) { ConfigWidget("Toggle Damage Overlay", f_DamageOverlay, "Remove damage output overlay"); @@ -242,6 +244,12 @@ namespace cheat::feature void FreeCamera::OnGameUpdate() { + auto uiManager = GET_SINGLETON(MoleMole_UIManager); + if (uiManager == nullptr) + return; + + static bool isBlock = false; + if (f_Enabled) { if (mainCam == nullptr) @@ -284,6 +292,23 @@ namespace cheat::feature hpOverlay = nullptr; } + if (f_BlockInput) + { + if (!isBlock) + { + app::MoleMole_UIManager_EnableInput(uiManager, false, false, false, nullptr); + isBlock = true; + } + } + else + { + if (isBlock) + { + app::MoleMole_UIManager_EnableInput(uiManager, true, false, false, nullptr); + isBlock = false; + } + } + // Taiga#5555: There's probably be a better way of implementing this. But for now, this is just what I came up with. auto& manager = game::EntityManager::instance(); auto animator = manager.avatar()->animator(); diff --git a/cheat-library/src/user/cheat/visuals/FreeCamera.h b/cheat-library/src/user/cheat/visuals/FreeCamera.h index 09d7d37..525b6ee 100644 --- a/cheat-library/src/user/cheat/visuals/FreeCamera.h +++ b/cheat-library/src/user/cheat/visuals/FreeCamera.h @@ -9,6 +9,7 @@ namespace cheat::feature public: config::Field> f_Enabled; config::Field> f_FreezeAnimation; + config::Field f_BlockInput; config::Field f_DamageOverlay; config::Field f_HpOverlay; config::Field f_Speed;