TmpMenu/BigBaseV2/src/gui/window/main/tab_vehicle.cpp

97 lines
2.2 KiB
C++
Raw Normal View History

2021-05-19 18:11:19 +02:00
#include "core/data/speedo_meters.hpp"
#include "fiber_pool.hpp"
#include "main_tabs.hpp"
#include "script.hpp"
#include "util/blip.hpp"
#include "util/entity.hpp"
#include "util/notify.hpp"
#include "util/vehicle.hpp"
2021-05-19 18:11:19 +02:00
namespace big
{
static char model[12];
void tab_main::tab_vehicle()
{
if (ImGui::BeginTabItem("Vehicle"))
{
2021-07-25 22:24:48 +02:00
if (ImGui::TreeNode("General"))
{
2021-07-25 22:24:48 +02:00
if (ImGui::Button("Bring Personal Vehicle"))
{
2021-07-25 22:24:48 +02:00
QUEUE_JOB_BEGIN_CLAUSE()
{
Vector3 location;
if (!blip::get_blip_location(location, 225, 0)) return notify::above_map("No personal vehicle found, was it destroyed?");
2021-07-25 22:24:48 +02:00
Vehicle veh = vehicle::get_closest_to_location(location, 5.f);
if (veh == 0) return notify::above_map("Invalid vehicle handle...");
2021-07-25 22:24:48 +02:00
location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true);
2021-07-25 22:24:48 +02:00
vehicle::bring(veh, location);
}QUEUE_JOB_END_CLAUSE
}
2021-07-25 22:24:48 +02:00
ImGui::SameLine();
if (ImGui::Button("Repair"))
2021-07-23 11:59:53 +02:00
{
2021-07-25 22:24:48 +02:00
QUEUE_JOB_BEGIN_CLAUSE()
{
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false);
2021-07-23 11:59:53 +02:00
2021-07-25 22:24:48 +02:00
vehicle::repair(veh);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Handling"))
g.window.handling = true;
ImGui::TreePop();
2021-07-23 11:59:53 +02:00
}
2021-05-19 18:11:19 +02:00
if (ImGui::TreeNode("Speedo Meter"))
{
SpeedoMeter selected = g.vehicle.speedo_meter.type;
2021-05-19 18:11:19 +02:00
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"))
{
g.vehicle.speedo_meter.x = pos[0];
g.vehicle.speedo_meter.y = pos[1];
}
ImGui::Checkbox("Left Sided", &g.vehicle.speedo_meter.left_side);
ImGui::Separator();
ImGui::Text("Type:");
2021-07-23 11:59:53 +02:00
if (ImGui::BeginCombo("###speedo_type", speedo_meters[(int)selected].name))
2021-05-19 18:11:19 +02:00
{
2021-07-23 11:59:53 +02:00
for (const speedo_meter &speedo : speedo_meters)
2021-05-19 18:11:19 +02:00
{
if (ImGui::Selectable(speedo.name, speedo.id == selected))
{
g.vehicle.speedo_meter.type = speedo.id;
2021-05-19 18:11:19 +02:00
}
if (speedo.id == selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
ImGui::TreePop();
}
2021-05-20 23:18:44 +02:00
ImGui::Checkbox("Horn Boost", &g.vehicle.horn_boost);
2021-05-19 18:11:19 +02:00
ImGui::EndTabItem();
}
}
}