From 44f1b2067ed5e95f88f15e1283a944f544db4b71 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Thu, 7 Jul 2022 13:32:37 +0600 Subject: [PATCH] Add move speed toggle to freecam --- resource/common/locale/English.toml | 2 +- src/game.cpp | 70 ++++++++++++++++++----------- src/teleport.cpp | 2 +- 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index 0027dad..1bafeb8 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -67,7 +67,7 @@ ForbiddenWantedLevel = "Forbidden area wl" ForbiddenWantedLevelText = "Wanted levels that appears outside of LS without completing missions" FPSLimit = "FPS limit" Freecam = "Freecam" -FreecamTip = "Press Enter to teleport player to camera location" +FreecamTip = "Shortcuts:\n\nEnter : Teleport player to camera\nMouse wheel : Zoom\nCtrl+ mouse wheel : Movement speed" FreePNS = "Free pay n spray" FreezeGame = "Freeze game" FreezeGameTime = "Freeze game time" diff --git a/src/game.cpp b/src/game.cpp index d31e61f..dee5791 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -122,24 +122,40 @@ void Freecam::Process() if (CPad::NewMouseControllerState.wheelUp) { - if (m_fFOV > 10.0f) + if (KeyPressed(VK_LCONTROL) && m_nMul != 10) { - m_fFOV -= 2.0f * speed; + ++m_nMul; + SetHelpMessage(std::to_string(m_nMul).c_str()); } + else + { + if (m_fFOV > 10.0f) + { + m_fFOV -= 2.0f * speed; + } - TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_fFOV, 250, true); - Command(true); + TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_fFOV, 250, true); + Command(true); + } } if (CPad::NewMouseControllerState.wheelDown) { - if (m_fFOV < 115.0f) + if (KeyPressed(VK_LCONTROL) && m_nMul != 1) { - m_fFOV += 2.0f * speed; + --m_nMul; + SetHelpMessage(std::to_string(m_nMul).c_str()); } + else + { + if (m_fFOV < 115.0f) + { + m_fFOV += 2.0f * speed; + } - TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_fFOV, 250, true); - Command(true); + TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_fFOV, 250, true); + Command(true); + } } m_pPed->SetHeading(m_fTotalMouse.x); @@ -166,26 +182,26 @@ void Freecam::Clear() void RandomCheats::Process() { + static bool genCheats = false; + if (!genCheats) + { + // Generate enabled cheats vector + for (auto [k, v] : m_pData.Items()) + { + /* + [ + cheat_id = [ cheat_name, state (true/false) ] + ] + */ + std::string key { k.str() }; + m_EnabledCheats[std::stoi(key)][0] = v.value_or("Unknown"); + m_EnabledCheats[std::stoi(key)][1] = "true"; + } + genCheats = true; + } + if (m_bEnabled) { - static bool genCheats = false; - if (!genCheats) - { - // Generate enabled cheats vector - for (auto [k, v] : m_pData.Items()) - { - /* - [ - cheat_id = [ cheat_name, state (true/false) ] - ] - */ - std::string key { k.str() }; - m_EnabledCheats[std::stoi(key)][0] = v.value_or("Unknown"); - m_EnabledCheats[std::stoi(key)][1] = "true"; - } - genCheats = true; - } - uint timer = CTimer::m_snTimeInMilliseconds; if ((timer - m_nTimer) > (static_cast(m_nInterval) * 1000)) { @@ -596,7 +612,7 @@ void Game::ShowPage() ImGui::Spacing(); ImGui::SliderFloat(TEXT("Game.FieldOfView"), &Freecam::m_fFOV, 5.0f, 120.0f); - ImGui::SliderInt(TEXT("Game.Movement Speed"), &Freecam::m_nMul, 1, 10); + ImGui::SliderInt(TEXT("Game.MovementSpeed"), &Freecam::m_nMul, 1, 10); ImGui::Spacing(); ImGui::TextWrapped(TEXT("Game.FreecamTip")); ImGui::Spacing(); diff --git a/src/teleport.cpp b/src/teleport.cpp index 7d11fa3..15ddd5c 100644 --- a/src/teleport.cpp +++ b/src/teleport.cpp @@ -321,7 +321,7 @@ void Teleport::ShowPage() } ImGui::SameLine(); #ifdef GTASA - if (ImGui::Button(TEXT("Teleport.TeleportMarker"), Widget::CalcSize(2))) + if (ImGui::Button((TEXT_S("Teleport.TeleportMarker") + "##Btn").c_str(), Widget::CalcSize(2))) { TeleportPlayer(true); }