Add ToggleSmoothCameraAction

- Added ModMenuModule::ToggleSmoothCameraAction
This commit is contained in:
izawartka 2026-08-19 18:04:06 +02:00
parent 3cc88ea19f
commit cd56d3908a
5 changed files with 65 additions and 0 deletions

View File

@ -480,6 +480,7 @@
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-invisibility.h" />
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-mouse-control.h" />
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-native-cheat.h" />
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-smooth-camera.h" />
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-steering-assist.h" />
<ClInclude Include="src\modules\modmenu\quick-actions\turn-vehicle-engine-off.h" />
<ClInclude Include="src\modules\modmenu\reset-binds-manager.h" />
@ -779,6 +780,7 @@
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-invisibility.cpp" />
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-mouse-control.cpp" />
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-native-cheat.cpp" />
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-smooth-camera.cpp" />
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-steering-assist.cpp" />
<ClCompile Include="src\modules\modmenu\quick-actions\turn-vehicle-engine-off.cpp" />
<ClCompile Include="src\modules\modmenu\reset-binds-manager.cpp" />

View File

@ -235,6 +235,7 @@
<ClCompile Include="src\modules\modmenu\utils\scrf-lerp-utils.cpp" />
<ClCompile Include="src\modules\modmenu\menus\smooth-vehicle-camera-menu.cpp" />
<ClCompile Include="src\modules\modmenu\menus\smooth-follow-camera-menu.cpp" />
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-smooth-camera.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\converters\ammo.h" />
@ -604,6 +605,7 @@
<ClInclude Include="src\modules\modmenu\utils\scrf-lerp-utils.h" />
<ClInclude Include="src\modules\modmenu\menus\smooth-vehicle-camera-menu.h" />
<ClInclude Include="src\modules\modmenu\menus\smooth-follow-camera-menu.h" />
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-smooth-camera.h" />
</ItemGroup>
<ItemGroup>
<None Include="GTA2.props" />

View File

@ -16,5 +16,6 @@
#include "toggle-invisibility.h"
#include "toggle-mouse-control.h"
#include "toggle-native-cheat.h"
#include "toggle-smooth-camera.h"
#include "toggle-steering-assist.h"
#include "turn-vehicle-engine-off.h"

View File

@ -0,0 +1,44 @@
#include "toggle-smooth-camera.h"
#include "../cheats/camera/smooth-camera.h"
#include "../toast-manager.h"
#include "../quick-action-registry.h"
static const std::string typeId = "ModMenu_ToggleSmoothCamera";
static const std::wstring typeLabel = L"Toggle smooth camera";
ModMenuModule::ToggleSmoothCameraAction::ToggleSmoothCameraAction()
{}
ModMenuModule::ToggleSmoothCameraAction::~ToggleSmoothCameraAction()
{}
const std::string& ModMenuModule::ToggleSmoothCameraAction::GetTypeId()
{
return typeId;
}
const std::wstring& ModMenuModule::ToggleSmoothCameraAction::GetTypeLabel()
{
return typeLabel;
}
void ModMenuModule::ToggleSmoothCameraAction::Execute()
{
auto* cheat = SmoothCameraCheat::GetInstance();
bool doEnable = !cheat->IsEnabled();
cheat->SetEnabled(doEnable);
if (doEnable) {
ToastManager::GetInstance()->Show({ L"Smooth camera enabled" });
}
else {
ToastManager::GetInstance()->Show({ L"Smooth camera disabled" });
}
}
const std::wstring& ModMenuModule::ToggleSmoothCameraAction::GetLabel() const
{
return typeLabel;
}
REGISTER_QUICK_ACTION(ToggleSmoothCameraAction)

View File

@ -0,0 +1,16 @@
#pragma once
#include "../common.h"
#include "../quick-action-base.h"
namespace ModMenuModule {
class ToggleSmoothCameraAction : public QuickActionBase, public Core::EventListenerSupport {
public:
ToggleSmoothCameraAction();
virtual ~ToggleSmoothCameraAction();
static const std::string& GetTypeId();
static const std::wstring& GetTypeLabel();
void Execute() override;
const std::wstring& GetLabel() const override;
};
}