From d8b7b8801a6b9081dd06da7dc48bc4ac5ba40d08 Mon Sep 17 00:00:00 2001 From: Yimura Date: Mon, 20 Dec 2021 11:37:23 +0100 Subject: [PATCH] feat(CPed): In vehicle property is a bit field, check against bit instead of one value --- BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp | 2 +- BigBaseV2/src/core/enums.hpp | 8 ++++++++ BigBaseV2/src/gui/window/window_handling.cpp | 2 +- BigBaseV2/src/services/vehicle_service.cpp | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp b/BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp index 52262c35..6a7f15dd 100644 --- a/BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp +++ b/BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp @@ -7,7 +7,7 @@ namespace big if (!g.vehicle.god_mode || g_local_player == nullptr || g_local_player->m_vehicle == nullptr) return; - if (g_local_player->m_in_vehicle == 0x0) + if (g_local_player->m_in_vehicle & (int)ePedTask::TASK_FOOT) { g_local_player->m_vehicle->m_deform_god = 0x8C; g_local_player->m_vehicle->m_godmode = 0x1; diff --git a/BigBaseV2/src/core/enums.hpp b/BigBaseV2/src/core/enums.hpp index 3a6d29b9..fe3af2fa 100644 --- a/BigBaseV2/src/core/enums.hpp +++ b/BigBaseV2/src/core/enums.hpp @@ -101,6 +101,14 @@ namespace big EXP_TAG_SUBMARINE_BIG = 82, }; + enum class ePedTask + { + TASK_NONE, + TASK_FOOT = 1 << 4, + TASK_UNK = 1 << 5, + TASK_DRIVING = 1 << 6 + }; + enum class eRemoteEvent { Bounty = 1294995624, diff --git a/BigBaseV2/src/gui/window/window_handling.cpp b/BigBaseV2/src/gui/window/window_handling.cpp index 528a5073..d795422d 100644 --- a/BigBaseV2/src/gui/window/window_handling.cpp +++ b/BigBaseV2/src/gui/window/window_handling.cpp @@ -11,7 +11,7 @@ namespace big ImGui::SetNextWindowPos({ 50, 50 }, ImGuiCond_FirstUseEver); if (g.window.handling && ImGui::Begin("Handling", &g.window.handling)) { - if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_in_vehicle == 0x10) + if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_in_vehicle & (int)ePedTask::TASK_FOOT) { ImGui::Text("Please enter a vehicle."); diff --git a/BigBaseV2/src/services/vehicle_service.cpp b/BigBaseV2/src/services/vehicle_service.cpp index 6354bd64..4c4c0a4a 100644 --- a/BigBaseV2/src/services/vehicle_service.cpp +++ b/BigBaseV2/src/services/vehicle_service.cpp @@ -21,7 +21,7 @@ namespace big int vehicle_service::attempt_save() { - if (g_local_player == nullptr || g_local_player->m_in_vehicle == 0x10 || g_local_player->m_vehicle == nullptr) + if (g_local_player == nullptr || g_local_player->m_in_vehicle & (int)ePedTask::TASK_FOOT || g_local_player->m_vehicle == nullptr) return -1; if (m_handling_backup.find(g_local_player->m_vehicle->m_handling->m_model_hash) != m_handling_backup.end()) return 0;