From 5244a4e6b450c2e401b1734d6f93985b9a2ae2c5 Mon Sep 17 00:00:00 2001 From: Yimura Date: Sun, 22 May 2022 18:10:51 +0200 Subject: [PATCH] fix(ContextMenu): Run script function --- .../src/backend/looped/hud/context_menu.cpp | 48 ------------------ BigBaseV2/src/main.cpp | 3 +- .../src/services/context_menu_service.cpp | 49 +++++++++++++++++++ .../src/services/context_menu_service.hpp | 2 + 4 files changed, 52 insertions(+), 50 deletions(-) delete mode 100644 BigBaseV2/src/backend/looped/hud/context_menu.cpp diff --git a/BigBaseV2/src/backend/looped/hud/context_menu.cpp b/BigBaseV2/src/backend/looped/hud/context_menu.cpp deleted file mode 100644 index 2430075c..00000000 --- a/BigBaseV2/src/backend/looped/hud/context_menu.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "services/context_menu_service.hpp" -#include "backend/looped/looped.hpp" -#include "gta/enums.hpp" -#include "natives.hpp" - -namespace big -{ - void looped::context_menu() - { - if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_DUCK)) - { - g_context_menu_service->enabled = !g_context_menu_service->enabled; - } - - if (g_context_menu_service->enabled) - { - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_NEXT_WEAPON, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_PREV_WEAPON, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_VEH_NEXT_RADIO, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_VEH_SELECT_NEXT_WEAPON, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_SELECT_NEXT_WEAPON, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_SELECT_PREV_WEAPON, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_ATTACK, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_SPECIAL_ABILITY, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)ControllerInputs::INPUT_VEH_MOUSE_CONTROL_OVERRIDE, true); - - g_context_menu_service->get_entity_closest_to_screen_center(); - - const auto cm = g_context_menu_service->get_context_menu(); - if (cm == nullptr) - return; - - if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT)) - cm->current_option = cm->options.size() <= cm->current_option + 1 ? 0 : cm->current_option + 1; - if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV)) - cm->current_option = 0 > cm->current_option - 1 ? static_cast(cm->options.size()) - 1 : cm->current_option - 1; - if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK) || - PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_SPECIAL_ABILITY)) - { - if (!g_context_menu_service->m_pointer) - return; - cm->options.at(cm->current_option).command(); - } - } - } -} diff --git a/BigBaseV2/src/main.cpp b/BigBaseV2/src/main.cpp index d012054c..2cd90b44 100644 --- a/BigBaseV2/src/main.cpp +++ b/BigBaseV2/src/main.cpp @@ -90,8 +90,7 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) g_script_mgr.add_script(std::make_unique