Add EnterAsPassengerAction
- Added ModMenuModule::EnterAsPassengerAction - Updated ModMenuModule::Utils::AddDefaultActions to include EnterAsPassengerAction
This commit is contained in:
parent
c0e93e1919
commit
b7b20ee931
@ -463,6 +463,7 @@
|
|||||||
<ClInclude Include="src\modules\modmenu\quick-action-manager.h" />
|
<ClInclude Include="src\modules\modmenu\quick-action-manager.h" />
|
||||||
<ClInclude Include="src\modules\modmenu\quick-action-registry.h" />
|
<ClInclude Include="src\modules\modmenu\quick-action-registry.h" />
|
||||||
<ClInclude Include="src\modules\modmenu\quick-actions\clear-wanted-level.h" />
|
<ClInclude Include="src\modules\modmenu\quick-actions\clear-wanted-level.h" />
|
||||||
|
<ClInclude Include="src\modules\modmenu\quick-actions\enter-as-passenger.h" />
|
||||||
<ClInclude Include="src\modules\modmenu\quick-actions\explode-vehicle.h" />
|
<ClInclude Include="src\modules\modmenu\quick-actions\explode-vehicle.h" />
|
||||||
<ClInclude Include="src\modules\modmenu\quick-actions\spawn-character.h" />
|
<ClInclude Include="src\modules\modmenu\quick-actions\spawn-character.h" />
|
||||||
<ClInclude Include="src\modules\modmenu\quick-actions\switch-camera-mode.h" />
|
<ClInclude Include="src\modules\modmenu\quick-actions\switch-camera-mode.h" />
|
||||||
@ -764,6 +765,7 @@
|
|||||||
<ClCompile Include="src\modules\modmenu\menus\weapons-menu.cpp" />
|
<ClCompile Include="src\modules\modmenu\menus\weapons-menu.cpp" />
|
||||||
<ClCompile Include="src\modules\modmenu\menus\world-menu.cpp" />
|
<ClCompile Include="src\modules\modmenu\menus\world-menu.cpp" />
|
||||||
<ClCompile Include="src\modules\modmenu\quick-action-manager.cpp" />
|
<ClCompile Include="src\modules\modmenu\quick-action-manager.cpp" />
|
||||||
|
<ClCompile Include="src\modules\modmenu\quick-actions\enter-as-passenger.cpp" />
|
||||||
<ClCompile Include="src\modules\modmenu\quick-actions\explode-vehicle.cpp" />
|
<ClCompile Include="src\modules\modmenu\quick-actions\explode-vehicle.cpp" />
|
||||||
<ClCompile Include="src\modules\modmenu\quick-actions\spawn-character.cpp" />
|
<ClCompile Include="src\modules\modmenu\quick-actions\spawn-character.cpp" />
|
||||||
<ClCompile Include="src\modules\modmenu\quick-actions\switch-camera-mode.cpp" />
|
<ClCompile Include="src\modules\modmenu\quick-actions\switch-camera-mode.cpp" />
|
||||||
|
|||||||
@ -237,6 +237,7 @@
|
|||||||
<ClCompile Include="src\modules\modmenu\menus\smooth-follow-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" />
|
<ClCompile Include="src\modules\modmenu\quick-actions\toggle-smooth-camera.cpp" />
|
||||||
<ClCompile Include="src\modules\modmenu\utils\enter-car-as-passenger.cpp" />
|
<ClCompile Include="src\modules\modmenu\utils\enter-car-as-passenger.cpp" />
|
||||||
|
<ClCompile Include="src\modules\modmenu\quick-actions\enter-as-passenger.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="src\converters\ammo.h" />
|
<ClInclude Include="src\converters\ammo.h" />
|
||||||
@ -608,6 +609,7 @@
|
|||||||
<ClInclude Include="src\modules\modmenu\menus\smooth-follow-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" />
|
<ClInclude Include="src\modules\modmenu\quick-actions\toggle-smooth-camera.h" />
|
||||||
<ClInclude Include="src\modules\modmenu\utils\enter-car-as-passenger.h" />
|
<ClInclude Include="src\modules\modmenu\utils\enter-car-as-passenger.h" />
|
||||||
|
<ClInclude Include="src\modules\modmenu\quick-actions\enter-as-passenger.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="GTA2.props" />
|
<None Include="GTA2.props" />
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace ModMenuModule {
|
|||||||
using QuickActionId = size_t;
|
using QuickActionId = size_t;
|
||||||
|
|
||||||
static constexpr uint16_t CURRENT_QUICK_ACTIONS_VERSION = 1;
|
static constexpr uint16_t CURRENT_QUICK_ACTIONS_VERSION = 1;
|
||||||
static constexpr uint16_t CURRENT_QUICK_ACTION_DEFAULTS_VERSION = 1;
|
static constexpr uint16_t CURRENT_QUICK_ACTION_DEFAULTS_VERSION = 2;
|
||||||
|
|
||||||
struct QuickActionInfo {
|
struct QuickActionInfo {
|
||||||
KeyBindingModule::Key key = {};
|
KeyBindingModule::Key key = {};
|
||||||
|
|||||||
42
src/modules/modmenu/quick-actions/enter-as-passenger.cpp
Normal file
42
src/modules/modmenu/quick-actions/enter-as-passenger.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include "enter-as-passenger.h"
|
||||||
|
#include "../utils/enter-car-as-passenger.h"
|
||||||
|
#include "../toast-manager.h"
|
||||||
|
#include "../quick-action-registry.h"
|
||||||
|
|
||||||
|
static const std::string typeId = "ModMenu_EnterAsPassenger";
|
||||||
|
static const std::wstring typeLabel = L"Enter as passenger";
|
||||||
|
|
||||||
|
ModMenuModule::EnterAsPassengerAction::EnterAsPassengerAction()
|
||||||
|
{}
|
||||||
|
|
||||||
|
ModMenuModule::EnterAsPassengerAction::~EnterAsPassengerAction()
|
||||||
|
{}
|
||||||
|
|
||||||
|
const std::string& ModMenuModule::EnterAsPassengerAction::GetTypeId()
|
||||||
|
{
|
||||||
|
return typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::wstring& ModMenuModule::EnterAsPassengerAction::GetTypeLabel()
|
||||||
|
{
|
||||||
|
return typeLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModMenuModule::EnterAsPassengerAction::Execute()
|
||||||
|
{
|
||||||
|
bool success = Utils::EnterCarAsPassenger();
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
ToastManager::GetInstance()->Show({ L"Entering vehicle as passenger" });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ToastManager::GetInstance()->Show({ L"Failed to enter vehicle", ToastType::Warning });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::wstring& ModMenuModule::EnterAsPassengerAction::GetLabel() const
|
||||||
|
{
|
||||||
|
return typeLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_QUICK_ACTION(EnterAsPassengerAction)
|
||||||
16
src/modules/modmenu/quick-actions/enter-as-passenger.h
Normal file
16
src/modules/modmenu/quick-actions/enter-as-passenger.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "../common.h"
|
||||||
|
#include "../quick-action-base.h"
|
||||||
|
|
||||||
|
namespace ModMenuModule {
|
||||||
|
class EnterAsPassengerAction : public QuickActionBase, public Core::EventListenerSupport {
|
||||||
|
public:
|
||||||
|
EnterAsPassengerAction();
|
||||||
|
virtual ~EnterAsPassengerAction();
|
||||||
|
static const std::string& GetTypeId();
|
||||||
|
static const std::wstring& GetTypeLabel();
|
||||||
|
|
||||||
|
void Execute() override;
|
||||||
|
const std::wstring& GetLabel() const override;
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clear-wanted-level.h"
|
#include "clear-wanted-level.h"
|
||||||
|
#include "enter-as-passenger.h"
|
||||||
#include "explode-all-vehicles.h"
|
#include "explode-all-vehicles.h"
|
||||||
#include "explode-vehicle.h"
|
#include "explode-vehicle.h"
|
||||||
#include "fix-vehicle.h"
|
#include "fix-vehicle.h"
|
||||||
|
|||||||
@ -32,6 +32,14 @@ bool ModMenuModule::Utils::AddDefaultActions(uint16_t prevVersion)
|
|||||||
QuickActionId clearWantedLevelActionId = quickActionManager->Add({ Game::KeyCode::DIK_P, false, false, true }, clearWantedLevelTypeIndex);
|
QuickActionId clearWantedLevelActionId = quickActionManager->Add({ Game::KeyCode::DIK_P, false, false, true }, clearWantedLevelTypeIndex);
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
case 1: {
|
||||||
|
spdlog::debug("Adding default actions version 1->2");
|
||||||
|
|
||||||
|
// Enter as passenger
|
||||||
|
QuickActionTypeIndex enterAsPassengerTypeIndex = typeid(EnterAsPassengerAction);
|
||||||
|
quickActionManager->Add({ Game::KeyCode::DIK_F, false, false, true }, enterAsPassengerTypeIndex);
|
||||||
|
}
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user