feat(Vehicle): Add Infinite & Instant Recharge Boost. Closes #221 (#383)

* Added Vehicle Boost Modifiers

* Changed to enum

* fixed typo
This commit is contained in:
Maddy 2022-08-09 13:14:02 -04:00 committed by GitHub
parent 8cb6c8e731
commit 930b7eef60
6 changed files with 73 additions and 10 deletions

View File

@ -75,6 +75,7 @@ namespace big
while (g_running)
{
looped::vehicle_auto_drive();
looped::vehicle_boost_behavior();
looped::vehicle_despawn_bypass();
looped::vehicle_drive_on_water();
looped::vehicle_god_mode();

View File

@ -42,6 +42,7 @@ namespace big
static void system_update_pointers();
static void vehicle_auto_drive();
static void vehicle_boost_behavior();
static void vehicle_despawn_bypass();
static void vehicle_drive_on_water();
static void vehicle_fly();

View File

@ -0,0 +1,27 @@
#include "backend/looped/looped.hpp"
#include "core/enums.hpp"
#include "natives.hpp"
namespace big
{
void looped::vehicle_boost_behavior()
{
auto* const vehicle = g_local_player->m_vehicle;
if (vehicle && VEHICLE::GET_HAS_ROCKET_BOOST_(self::veh))
{
if (g->vehicle.boost_behavior == eBoostBehaviors::INSTANT_REFIL && vehicle->m_boost == 0.f) // No Boost Refil Time
{
vehicle->m_boost = 1.f;
}
else if (g->vehicle.boost_behavior == eBoostBehaviors::INFINITE_BOOST) // Infinite Boost
{
if (vehicle->m_boost_state)
{
vehicle->m_boost_allow_recharge = true;
vehicle->m_boost = 1.f;
}
}
}
}
}

View File

@ -2,6 +2,13 @@
namespace big
{
enum class eBoostBehaviors
{
DEFAULT,
INSTANT_REFIL,
INFINITE_BOOST
};
enum class CustomWeapon
{
NONE,

View File

@ -242,21 +242,22 @@ namespace big
AutoDriveDestination auto_drive_destination = AutoDriveDestination::STOPPED;
AutoDriveStyle auto_drive_style = AutoDriveStyle::LAW_ABIDING;
float auto_drive_speed = 1;
bool auto_turn_signals = false;
eBoostBehaviors boost_behavior = eBoostBehaviors::DEFAULT;
bool drive_on_water = false;
bool horn_boost = false;
bool vehicle_jump = false;
bool instant_brake = false;
bool is_targetable = true;
bool ls_customs = false; // don't save this to dis
bool seatbelt = false;
bool turn_signals = false;
float auto_drive_speed = 1;
bool ls_customs = false; // don't save this to disk
bool rainbow_neon = false;
int rainbow_paint = 0;
bool rainbow_primary = false;
bool rainbow_secondary = false;
bool rainbow_neon = false;
bool rainbow_smoke = false;
bool seatbelt = false;
bool turn_signals = false;
bool vehicle_jump = false;
speedo_meter speedo_meter{};
fly fly{};
};
@ -555,6 +556,7 @@ namespace big
this->vehicle.proof_steam = j["vehicle"]["proof_steam"];
this->vehicle.proof_water = j["vehicle"]["proof_water"];
this->vehicle.proof_mask = j["vehicle"]["proof_mask"];
this->vehicle.boost_behavior = j["vehicle"]["boost_behavior"];
this->vehicle.auto_drive_style = j["vehicle"]["auto_drive_style"];
this->vehicle.auto_drive_speed = j["vehicle"]["auto_drive_speed"];
this->vehicle.auto_turn_signals = j["vehicle"]["auto_turn_signals"];
@ -832,6 +834,7 @@ namespace big
{ "auto_drive_style", this->vehicle.auto_drive_style },
{ "auto_drive_speed", this->vehicle.auto_drive_speed },
{ "auto_turn_signals", this->vehicle.auto_turn_signals },
{ "boost_behavior", this->vehicle.boost_behavior },
{ "drive_on_water", this->vehicle.drive_on_water },
{ "horn_boost", this->vehicle.horn_boost },
{ "vehicle_jump", this->vehicle.vehicle_jump },

View File

@ -1,10 +1,11 @@
#include "core/data/speed_units.hpp"
#include "core/enums.hpp"
#include "fiber_pool.hpp"
#include "gui/handling/handling_tabs.hpp"
#include "script.hpp"
#include "util/mobile.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
#include "util/mobile.hpp"
#include "core/data/speed_units.hpp"
namespace big
{
@ -36,7 +37,7 @@ namespace big
seats = tmp_seats;
ready = true;
});
});
}
@ -70,7 +71,7 @@ namespace big
components::button(name, [idx] {
PED::SET_PED_INTO_VEHICLE(self::ped, self::veh, idx);
});
});
if (!it.second)
{
ImGui::EndDisabled();
@ -176,6 +177,29 @@ namespace big
ImGui::Separator();
static constexpr char const* boost_behaviors[] = { "Default", "Instant Refill", "Infinite" };
if (ImGui::BeginCombo("Boost Behavior", boost_behaviors[static_cast<int>(g->vehicle.boost_behavior)]))
{
for (int i = 0; i < 3; i++)
{
bool itemSelected = g->vehicle.boost_behavior == static_cast<eBoostBehaviors>(i);
if (ImGui::Selectable(boost_behaviors[i], itemSelected))
{
g->vehicle.boost_behavior = static_cast<eBoostBehaviors>(i);
}
if (itemSelected)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::Separator();
components::small_text("Vehicle Fly");
ImGui::BeginGroup();