Added proofs to vehicle menu and improved waterproof feature. (#330)

- Added proofs section to vehicle menu that allows player to control damage bits. 
- Player can now drive or walk underwater with waterproof turned on.
- Added bring closest vehicle feature.
- Vehicle will not deform with collision proof on.
- Improved vehicle menu arrangement.
- Added plate changer in LSC.
- Updated LSC layout.
- Expanded wheel type feature.
- Fixed a bug where the mod section shows repetitive wheel mods.

Fixed issue #331
This commit is contained in:
aa15032261
2022-07-12 22:42:07 +08:00
committed by GitHub
parent cf52e9f77d
commit 44745c09d4
23 changed files with 1207 additions and 713 deletions

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@ namespace big
});
g_mobile_service->refresh_personal_vehicles();
if (ImGui::ListBoxHeader("##personal_veh_list", { 300, static_cast<float>(*g_pointers->m_resolution_y - 184 - 38 * num_of_rows) }))
if (ImGui::ListBoxHeader("###personal_veh_list", { 300, static_cast<float>(*g_pointers->m_resolution_y - 184 - 38 * num_of_rows) }))
{
if (g_mobile_service->personal_vehicles().empty())
@ -77,60 +77,58 @@ namespace big
display_name.find(lower_search) != std::string::npos ||
display_manufacturer.find(lower_search) != std::string::npos
) {
ImGui::PushID(personal_veh->get_id());
if (ImGui::Selectable(label.c_str(), false)) {
ImGui::PushID('v' << 24 & personal_veh->get_id());
components::selectable(label, false, [&personal_veh] {
if (g->clone_pv.spawn_clone)
{
g_fiber_pool->queue_job([&personal_veh] {
auto vehicle_idx = personal_veh->get_vehicle_idx();
auto veh_data = vehicle::get_vehicle_data_from_vehicle_idx(vehicle_idx);
auto vehicle_idx = personal_veh->get_vehicle_idx();
auto veh_data = vehicle::get_vehicle_data_from_vehicle_idx(vehicle_idx);
float y_offset = 0;
float y_offset = 0;
if (PED::IS_PED_IN_ANY_VEHICLE(self::ped, false))
{
y_offset = 10.f;
}
else if (!g->spawn.spawn_inside)
{
y_offset = 5.f;
}
if (self::veh != 0)
{
y_offset = 10.f;
}
else if (!g->clone_pv.spawn_inside)
{
y_offset = 5.f;
}
auto spawn_location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0.f, y_offset, 0.f);
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
auto spawn_location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0.f, y_offset, 0.f);
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
const char* spawn_plate = plate;
if (g->clone_pv.clone_plate)
{
spawn_plate = personal_veh->get_plate();
}
const char* spawn_plate = plate;
if (g->clone_pv.clone_plate)
{
spawn_plate = personal_veh->get_plate();
}
auto veh = vehicle::clone(veh_data, spawn_location, spawn_heading);
auto veh = vehicle::clone(veh_data, spawn_location, spawn_heading);
if (g->clone_pv.spawn_inside)
{
vehicle::telport_into_veh(veh);
}
if (g->clone_pv.spawn_inside)
{
vehicle::telport_into_veh(veh);
}
if (g->clone_pv.spawn_maxed)
{
vehicle::max_vehicle(veh);
}
if (g->clone_pv.spawn_maxed)
{
vehicle::max_vehicle(veh);
}
vehicle::set_plate(veh, spawn_plate);
});
vehicle::set_plate(veh, spawn_plate);
}
else
{
strcpy(search, "");
lower_search = search;
g_fiber_pool->queue_job([&personal_veh] {
personal_veh->summon();
});
personal_veh->summon();
}
}
g_vehicle_preview_service->stop_preview();
});
ImGui::PopID();
if (g->clone_pv.preview_vehicle && ImGui::IsItemHovered())

View File

@ -6,7 +6,8 @@
namespace big
{
void view::spawn() {
void view::spawn()
{
ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always);
ImGui::Checkbox("Preview", &g->spawn.preview_vehicle);
@ -52,12 +53,12 @@ namespace big
display_name.find(lower_search) != std::string::npos ||
display_manufacturer.find(lower_search) != std::string::npos
) {
//ImGui::PushID(item.hash);
ImGui::PushID(item.hash);
components::selectable(item.display_name, false, [item] {
float y_offset = 0;
if (PED::IS_PED_IN_ANY_VEHICLE(self::ped, false))
if (self::veh != 0)
{
y_offset = 10.f;
}
@ -85,7 +86,7 @@ namespace big
g_vehicle_preview_service->stop_preview();
});
//ImGui::PopID();
ImGui::PopID();
if (g->spawn.preview_vehicle && ImGui::IsItemHovered())
{

View File

@ -4,17 +4,55 @@
#include "script.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
#include "util/mobile.hpp"
namespace big
{
void view::vehicle() {
void view::vehicle()
{
components::button("MMI Fix All PV", [] {
int amount_fixed = mobile::mors_mutual::fix_all();
g_notification_service->push("Mobile",
fmt::format("{} vehicle{} been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have")
);
});
ImGui::SameLine();
components::button("Repair", [] {
vehicle::repair(self::veh);
});
ImGui::Separator();
components::button("Teleport to PV", [] {
Vehicle veh = globals::get_personal_vehicle();
teleport::into_vehicle(veh);
});
ImGui::SameLine();
components::button("Bring PV", [] {
Vehicle veh = globals::get_personal_vehicle();
vehicle::bring(veh, self::pos, true);
});
ImGui::SameLine();
components::button("Bring Closest Vehicle", [] {
Vehicle veh = vehicle::get_closest_to_location(self::pos, 200);
vehicle::bring(veh, self::pos, true, -1);
});
ImGui::Separator();
components::small_text("General");
ImGui::BeginGroup();
ImGui::Checkbox("Can Be Targeted", &g->vehicle.is_targetable);
ImGui::Checkbox("God Mode", &g->vehicle.god_mode);
ImGui::Checkbox("Horn Boost", &g->vehicle.horn_boost);
ImGui::Checkbox("Vehicle Jump", &g->vehicle.vehicle_jump);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Instant Brake", &g->vehicle.instant_brake);
ImGui::Checkbox("Can Be Targeted", &g->vehicle.is_targetable);
ImGui::Checkbox("Drive On Water", &g->vehicle.drive_on_water);
ImGui::EndGroup();
@ -22,31 +60,7 @@ namespace big
ImGui::BeginGroup();
ImGui::Checkbox("Seatbelt", &g->vehicle.seatbelt);
components::button("Repair", [] {
vehicle::repair(self::veh);
});
components::button("Instant in personal vehicle", [] {
if (!*g_pointers->m_is_session_started) return g_notification_service->push_warning("WARNING", "Go into GTA V Online to use this option");
vehicle::go_into_personal_vehicle();
});
if (ImGui::TreeNode("Paint"))
{
ImGui::ListBox("RGB Type", &g->vehicle.rainbow_paint, vehicle::rgb_types, 3);
if (g->vehicle.rainbow_paint)
{
ImGui::SliderInt("RGB Speed", &g->rgb.speed, 1, 10);
}
ImGui::TreePop();
}
ImGui::Checkbox("Turn Signals", &g->vehicle.turn_signals);
if (g->vehicle.turn_signals)
{
ImGui::Checkbox("Fully Automatic Signal", &g->vehicle.auto_turn_signals);
@ -56,91 +70,133 @@ namespace big
ImGui::Separator();
components::small_text("Auto Drive");
components::small_text("Proofs");
components::button("Drive To Waypoint", [] {
g->vehicle.auto_drive_to_waypoint = true;
});
components::button("Wander", [] {
g->vehicle.auto_drive_wander = true;
});
ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200);
components::button("E-Stop", [] {
g->vehicle.auto_drive_to_waypoint = false;
g->vehicle.auto_drive_wander = false;
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
});
if (ImGui::ListBox("Driving Style", &g->vehicle.driving_style_id, vehicle::driving_style_names, 2))
if (ImGui::Button("Check all"))
{
g->vehicle.driving_style_flags = vehicle::driving_styles[g->vehicle.driving_style_id];
g_notification_service->push_warning("Auto Drive", fmt::format("Driving style set to {}.", vehicle::driving_style_names[g->vehicle.driving_style_id]));
g->vehicle.proof_bullet = true;
g->vehicle.proof_fire = true;
g->vehicle.proof_collision = true;
g->vehicle.proof_melee = true;
g->vehicle.proof_explosion = true;
g->vehicle.proof_steam = true;
g->vehicle.proof_water = true;
}
ImGui::Separator();
components::small_text("Vehicle Fly");
ImGui::Checkbox("Enabled", &g->vehicle.fly.enabled);
ImGui::SameLine();
ImGui::Checkbox("Disable Collision", &g->vehicle.fly.no_collision);
ImGui::Checkbox("Don't Stop", &g->vehicle.fly.dont_stop);
if (ImGui::Button("Uncheck all"))
{
g->vehicle.proof_bullet = false;
g->vehicle.proof_fire = false;
g->vehicle.proof_collision = false;
g->vehicle.proof_melee = false;
g->vehicle.proof_explosion = false;
g->vehicle.proof_steam = false;
g->vehicle.proof_water = false;
}
ImGui::BeginGroup();
ImGui::Checkbox("Bullet", &g->vehicle.proof_bullet);
ImGui::Checkbox("Fire", &g->vehicle.proof_fire);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::Checkbox("Stop On Exit", &g->vehicle.fly.stop_on_exit);
ImGui::BeginGroup();
ImGui::SliderFloat("Speed", &g->vehicle.fly.speed, 1.f, 100.f, "%.0f", 1);
ImGui::Checkbox("Collision", &g->vehicle.proof_collision);
ImGui::Checkbox("Melee", &g->vehicle.proof_melee);
ImGui::Separator();
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
components::small_text("LS Customs");
ImGui::Checkbox("Explosion", &g->vehicle.proof_explosion);
ImGui::Checkbox("Steam", &g->vehicle.proof_steam);
components::button("Start LS Customs", [] {
g->vehicle.ls_customs = true;
});
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Water", &g->vehicle.proof_water);
ImGui::EndGroup();
ImGui::Separator();
components::small_text("Speedo Meter");
SpeedoMeter selected = g->vehicle.speedo_meter.type;
SpeedoMeter* speed_meter_type_ptr = &g->vehicle.speedo_meter.type;
ImGui::Text("Type:");
if (ImGui::BeginCombo("###speedo_type", speedo_meters[(int)selected].name))
if (ImGui::BeginCombo("Format", speedo_meters[(int)*speed_meter_type_ptr].name))
{
for (const speedo_meter& speedo : speedo_meters)
for (const auto& speedo : speedo_meters)
{
if (ImGui::Selectable(speedo.name, speedo.id == selected))
if (ImGui::Selectable(speedo.name, speedo.id == *speed_meter_type_ptr))
{
g->vehicle.speedo_meter.type = speedo.id;
*speed_meter_type_ptr = speedo.id;
}
if (speedo.id == selected)
if (speedo.id == *speed_meter_type_ptr)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::Text("Position");
float pos[2];
pos[0] = g->vehicle.speedo_meter.x;
pos[1] = g->vehicle.speedo_meter.y;
if (ImGui::SliderFloat2("###speedo_pos", pos, .001f, .999f, "%.3f"))
if (*speed_meter_type_ptr != SpeedoMeter::DISABLED)
{
g->vehicle.speedo_meter.x = pos[0];
g->vehicle.speedo_meter.y = pos[1];
ImGui::Text("Position (X, Y)");
float pos[2] = { g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y };
if (ImGui::SliderFloat2("###speedo_pos", pos, .001f, .999f, "%.3f"))
{
g->vehicle.speedo_meter.x = pos[0];
g->vehicle.speedo_meter.y = pos[1];
}
ImGui::SameLine();
ImGui::Checkbox("Left Sided", &g->vehicle.speedo_meter.left_side);
}
ImGui::Checkbox("Left Sided", &g->vehicle.speedo_meter.left_side);
g->vehicle.proof_mask = 0;
if (g->vehicle.god_mode)
{
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::GOD);
}
if (g->vehicle.proof_bullet)
{
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::BULLET);
}
if (g->vehicle.proof_fire)
{
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::FIRE);
}
if (g->vehicle.proof_collision)
{
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::COLLISION);
}
if (g->vehicle.proof_melee)
{
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::MELEE);
}
if (g->vehicle.proof_explosion)
{
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::EXPLOSION);
}
if (g->vehicle.proof_steam)
{
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::STEAM);
}
if (g->vehicle.proof_water)
{
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::WATER);
}
}
}

View File

@ -0,0 +1,103 @@
#include "core/data/speedo_meters.hpp"
#include "fiber_pool.hpp"
#include "gui/handling/handling_tabs.hpp"
#include "script.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
#include "util/mobile.hpp"
namespace big
{
void view::vehicle_fun()
{
components::small_text("Auto Drive");
components::button("Drive To Waypoint", [] {
g->vehicle.auto_drive_to_waypoint = true;
});
ImGui::SameLine();
components::button("Wander", [] {
g->vehicle.auto_drive_wander = true;
});
ImGui::SameLine();
components::button("Emergency Stop", [] {
g->vehicle.auto_drive_to_waypoint = false;
g->vehicle.auto_drive_wander = false;
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
});
ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200);
if (ImGui::BeginCombo("Driving Style", vehicle::driving_style_names[g->vehicle.driving_style_id]))
{
for (int i = 0; i < 2; i++)
{
if (ImGui::Selectable(vehicle::driving_style_names[i], g->vehicle.driving_style_id == i))
{
g->vehicle.driving_style_id = i;
g_notification_service->push_warning("Auto Drive", fmt::format("Driving style set to {}.", vehicle::driving_style_names[i]));
}
if (g->vehicle.driving_style_id == i)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::Separator();
components::small_text("Rainbow Paint");
ImGui::SetNextItemWidth(120);
if (ImGui::BeginCombo("RGB Type", vehicle::rgb_types[g->vehicle.rainbow_paint]))
{
for (int i = 0; i < 3; i++)
{
bool itemSelected = g->vehicle.rainbow_paint == i;
if (ImGui::Selectable(vehicle::rgb_types[i], itemSelected))
{
g->vehicle.rainbow_paint = i;
}
if (itemSelected)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
if (g->vehicle.rainbow_paint != 0)
{
ImGui::SameLine();
ImGui::SetNextItemWidth(150);
ImGui::SliderInt("RGB Speed", &g->rgb.speed, 1, 10);
}
ImGui::Separator();
components::small_text("Vehicle Fly");
ImGui::BeginGroup();
ImGui::Checkbox("Enabled", &g->vehicle.fly.enabled);
ImGui::Checkbox("Don't Stop", &g->vehicle.fly.dont_stop);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Disable Collision", &g->vehicle.fly.no_collision);
ImGui::Checkbox("Stop On Exit", &g->vehicle.fly.stop_on_exit);
ImGui::EndGroup();
ImGui::SliderFloat("Speed", &g->vehicle.fly.speed, 1.f, 100.f, "%.0f", 1);
}
}