From c058035677ced8b929187c28d23001788bb26c0a Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Fri, 12 Aug 2022 10:09:16 -0600 Subject: [PATCH] Fix #451 - Also added toggle damage overlay & hp overlay from @portra400nc 's CameraTools --- .../src/user/cheat/visuals/FreeCamera.cpp | 35 +++++++++++++++++-- .../src/user/cheat/visuals/FreeCamera.h | 2 ++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/cheat-library/src/user/cheat/visuals/FreeCamera.cpp b/cheat-library/src/user/cheat/visuals/FreeCamera.cpp index b39819f..9729259 100644 --- a/cheat-library/src/user/cheat/visuals/FreeCamera.cpp +++ b/cheat-library/src/user/cheat/visuals/FreeCamera.cpp @@ -11,6 +11,8 @@ namespace cheat::feature app::GameObject* mainCam = nullptr; app::Object_1* freeCamObj = nullptr; app::Object_1* mainCamObj = nullptr; + app::GameObject* damageOverlay = nullptr; + app::GameObject* hpOverlay = nullptr; app::Transform* freeCam_Transform; app::Component_1* freeCam_Camera; app::Component_1* mainCam_Camera; @@ -22,6 +24,8 @@ 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_DamageOverlay, "Damage Overlay", "Visuals::FreeCamera", false), + NF(f_HpOverlay, "Enemy HP Overlay", "Visuals::FreeCamera", false), NF(f_Speed, "Speed", "Visuals::FreeCamera", 1.0f), NF(f_LookSens, "Look Sensitivity", "Visuals::FreeCamera", 1.0f), NF(f_RollSpeed, "Roll Speed", "Visuals::FreeCamera", 1.0f), @@ -52,7 +56,13 @@ namespace cheat::feature void FreeCamera::DrawMain() { ConfigWidget("Enable", f_Enabled); - ConfigWidget("Freeze Character Animation", f_FreezeAnimation, "Freezes the active character's animation.\nAfter disabling, jump to un-freeze your character."); + ConfigWidget("Freeze Character Animation", f_FreezeAnimation, "Freezes the active character's animation."); + if (f_Enabled) + { + ConfigWidget("Toggle Damage Overlay", f_DamageOverlay, "Remove damage output overlay"); + ConfigWidget("Toggle Enemy HP Overlay", f_HpOverlay, "Remove enemy HP overlay"); + } + if (ImGui::BeginTable("FreeCameraDrawTable", 1, ImGuiTableFlags_NoBordersInBody)) { ImGui::TableNextRow(); @@ -245,9 +255,23 @@ namespace cheat::feature } if (freeCamObj) EnableFreeCam(); + + if (damageOverlay == nullptr) + damageOverlay = app::GameObject_Find(string_to_il2cppi("/Canvas/Pages/InLevelMainPage/GrpMainPage/ParticleDamageTextContainer"), nullptr); + else + app::GameObject_SetActive(damageOverlay, !f_DamageOverlay, nullptr); + + if (hpOverlay == nullptr) + hpOverlay = app::GameObject_Find(string_to_il2cppi("AvatarBoardCanvasV2(Clone)"), nullptr); + else + app::GameObject_SetActive(hpOverlay, !f_DamageOverlay, nullptr); } else + { DisableFreeCam(); + damageOverlay = nullptr; + hpOverlay = nullptr; + } // 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(); @@ -256,17 +280,24 @@ namespace cheat::feature if (animator == nullptr && rigidBody == nullptr) return; + static bool changed = false; + if (f_FreezeAnimation) { //auto constraints = app::Rigidbody_get_constraints(rigidBody, nullptr); //LOG_DEBUG("%s", magic_enum::enum_name(constraints).data()); app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezePosition, nullptr); app::Animator_set_speed(animator, 0.f, nullptr); + changed = false; } else { app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezeRotation, nullptr); - app::Animator_set_speed(animator, 1.f, nullptr); + if (!changed) + { + app::Animator_set_speed(animator, 1.f, nullptr); + changed = true; + } } } } \ No newline at end of file diff --git a/cheat-library/src/user/cheat/visuals/FreeCamera.h b/cheat-library/src/user/cheat/visuals/FreeCamera.h index 1084b4a..800affb 100644 --- a/cheat-library/src/user/cheat/visuals/FreeCamera.h +++ b/cheat-library/src/user/cheat/visuals/FreeCamera.h @@ -9,6 +9,8 @@ namespace cheat::feature public: config::Field> f_Enabled; config::Field> f_FreezeAnimation; + config::Field f_DamageOverlay; + config::Field f_HpOverlay; config::Field f_Speed; config::Field f_LookSens; config::Field f_RollSpeed;