diff --git a/src/backend/backend.cpp b/src/backend/backend.cpp index 5baed134..d701ab81 100644 --- a/src/backend/backend.cpp +++ b/src/backend/backend.cpp @@ -36,6 +36,7 @@ namespace big looped::self_hud(); looped::self_unlimited_oxygen(); looped::self_no_water_collision(); + looped::self_mobile_radio(); script::get_current()->yield(); } diff --git a/src/backend/looped/looped.hpp b/src/backend/looped/looped.hpp index 1f31ce78..1ad6b8e3 100644 --- a/src/backend/looped/looped.hpp +++ b/src/backend/looped/looped.hpp @@ -36,6 +36,7 @@ namespace big static void self_hud(); static void self_unlimited_oxygen(); static void self_no_water_collision(); + static void self_mobile_radio(); static void session_local_time(); diff --git a/src/backend/looped/self/mobile_radio.cpp b/src/backend/looped/self/mobile_radio.cpp new file mode 100644 index 00000000..e9adf8d2 --- /dev/null +++ b/src/backend/looped/self/mobile_radio.cpp @@ -0,0 +1,25 @@ +#include "backend/looped/looped.hpp" +#include "natives.hpp" + +namespace big +{ + static bool bLastMobileRadio = false; + + void looped::self_mobile_radio() + { + const bool bMobileRadio = g->self.mobile_radio; + + if (bMobileRadio) + { + AUDIO::SET_MOBILE_PHONE_RADIO_STATE(true); + AUDIO::SET_MOBILE_RADIO_ENABLED_DURING_GAMEPLAY(true); + } + else if (bMobileRadio != bLastMobileRadio) + { + AUDIO::SET_MOBILE_PHONE_RADIO_STATE(false); + AUDIO::SET_MOBILE_RADIO_ENABLED_DURING_GAMEPLAY(false); + } + + bLastMobileRadio = bMobileRadio; + } +} diff --git a/src/core/globals.hpp b/src/core/globals.hpp index ad0fde0f..aed21457 100644 --- a/src/core/globals.hpp +++ b/src/core/globals.hpp @@ -169,6 +169,7 @@ namespace big bool hide_ammo = false; int selected_hud_component = 1; bool hud_components_states[(int)HudComponents::HUD_WEAPONS] = { false }; + bool mobile_radio = false; }; struct session @@ -300,6 +301,8 @@ namespace big bool vehicle_jump = false; bool keep_vehicle_repaired = false; bool no_water_collision = false; + bool disable_engine_auto_start = false; + bool change_engine_state_immediately = false; speedo_meter speedo_meter{}; rainbow_paint rainbow_paint{}; fly fly{}; @@ -576,6 +579,7 @@ namespace big this->self.hud_components_states[i] = j["self"]["hud_components_states"].at(i); this->self.unlimited_oxygen = j["self"]["unlimited_oxygen"]; this->self.no_water_collision = j["self"]["no_water_collision"]; + this->self.mobile_radio = j["self"]["mobile_radio"]; this->session.log_chat_messages = j["session"]["log_chat_messages"]; this->session.log_text_messages = j["session"]["log_text_messages"]; @@ -636,6 +640,8 @@ namespace big this->vehicle.seatbelt = j["vehicle"]["seatbelt"]; this->vehicle.turn_signals = j["vehicle"]["turn_signals"]; this->vehicle.no_water_collision = j["vehicle"]["no_water_collision"]; + this->vehicle.disable_engine_auto_start = j["vehicle"]["disable_engine_auto_start"]; + this->vehicle.change_engine_state_immediately = j["vehicle"]["change_engine_state_immediately"]; this->vehicle.speedo_meter.enabled = j["vehicle"]["speedo_meter"]["enabled"]; this->vehicle.speedo_meter.left_side = j["vehicle"]["speedo_meter"]["left_side"]; @@ -876,6 +882,7 @@ namespace big }, { "unlimited_oxygen", this->self.unlimited_oxygen }, { "no_water_collision", this->self.no_water_collision }, + { "mobile_radio", this->self.mobile_radio }, } }, { @@ -963,6 +970,8 @@ namespace big { "turn_signals", this->vehicle.turn_signals }, { "seatbelt", this->vehicle.seatbelt }, { "no_water_collision", this->vehicle.no_water_collision }, + { "disable_engine_auto_start", this->vehicle.disable_engine_auto_start }, + { "change_engine_state_immediately", this->vehicle.change_engine_state_immediately }, { "speedo_meter", { diff --git a/src/util/vehicle.hpp b/src/util/vehicle.hpp index c7511b0b..cd95b009 100644 --- a/src/util/vehicle.hpp +++ b/src/util/vehicle.hpp @@ -658,4 +658,12 @@ namespace big::vehicle } } } + + inline void set_engine_state(Vehicle current_vehicle, bool state, bool immediately, bool disable_auto_start) + { + if (current_vehicle) + VEHICLE::SET_VEHICLE_ENGINE_ON(current_vehicle, state, immediately, disable_auto_start); + else + return g_notification_service->push_warning("Vehicle", "Please be in a car first then try again."); + } } diff --git a/src/views/self/view_self.cpp b/src/views/self/view_self.cpp index 0ed16d62..71a3045c 100644 --- a/src/views/self/view_self.cpp +++ b/src/views/self/view_self.cpp @@ -80,6 +80,8 @@ namespace big ImGui::Checkbox("No Collision", &g->self.no_collision); + ImGui::Checkbox("Mobile Radio", &g->self.mobile_radio); + ImGui::EndGroup(); ImGui::Separator(); diff --git a/src/views/vehicle/view_vehicle.cpp b/src/views/vehicle/view_vehicle.cpp index 82fe8888..b84bf419 100644 --- a/src/views/vehicle/view_vehicle.cpp +++ b/src/views/vehicle/view_vehicle.cpp @@ -41,6 +41,29 @@ namespace big ImGui::Separator(); + components::button("Turn Engine On", [] { + vehicle::set_engine_state( + self::veh, + true, + g->vehicle.change_engine_state_immediately, + g->vehicle.disable_engine_auto_start + ); + }); + ImGui::SameLine(); + components::button("Turn Engine Off", [] { + vehicle::set_engine_state( + self::veh, + false, + g->vehicle.change_engine_state_immediately, + g->vehicle.disable_engine_auto_start + ); + }); + ImGui::Checkbox("Disable Engine Auto Start", &g->vehicle.disable_engine_auto_start); + ImGui::SameLine(); + ImGui::Checkbox("Change State Immediately", &g->vehicle.change_engine_state_immediately); + + ImGui::Separator(); + components::sub_title("General"); { ImGui::BeginGroup();