feat(GUI): Added handling window

This commit is contained in:
Yimura 2021-07-25 22:24:48 +02:00
parent 65388964d7
commit db13703b43
11 changed files with 280 additions and 17 deletions

View File

@ -10,6 +10,7 @@ namespace big
window::log();
window::main();
window::handling();
window::player();
window::users();

View File

@ -5,6 +5,7 @@ namespace big
class window {
public:
static void top_bar();
static void handling();
static void log();
static void main();
static void player();

View File

@ -0,0 +1,23 @@
#include "handling_tabs.hpp"
namespace big
{
void tab_handling::tab_braking()
{
if (ImGui::BeginTabItem("Braking"))
{
ImGui::Text("Brake Force");
ImGui::SliderFloat("##brake force", &g_local_player->m_vehicle->m_handling->m_brake_force, -50.f, 50.f);
ImGui::Text("Brake Bias (1.0 = front, 0.0 = rear, 0.5 = balanced)");
float fBrakeBias = g_local_player->m_vehicle->m_handling->m_brake_bias_front / 2;
if (ImGui::SliderFloat("##brake bias front", &fBrakeBias, 0.f, 1.f))
g_local_player->m_vehicle->m_handling->m_brake_bias_front = fBrakeBias * 2;
ImGui::Text("Hand Brake Force");
ImGui::SliderFloat("##hand brake force", &g_local_player->m_vehicle->m_handling->m_handbrake_force, -50.f, 50.f);
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,45 @@
#include "handling_tabs.hpp"
namespace big
{
void tab_handling::tab_phyics()
{
if (ImGui::BeginTabItem("Physics"))
{
ImGui::Text("Gravity");
ImGui::SliderFloat("##Gravity", &g_local_player->m_vehicle->m_gravity, -50.f, 50.f);
ImGui::Text("Mass");
ImGui::SliderFloat("##Mass", &g_local_player->m_vehicle->m_handling->m_mass, 0.f, 50000.f);
ImGui::Text("Centre of mass");
float fCenterOfMass[3];
fCenterOfMass[0] = g_local_player->m_vehicle->m_handling->m_centre_of_mass.x;
fCenterOfMass[1] = g_local_player->m_vehicle->m_handling->m_centre_of_mass.y;
fCenterOfMass[2] = g_local_player->m_vehicle->m_handling->m_centre_of_mass.z;
if (ImGui::SliderFloat3("##centre_of_mass", fCenterOfMass, -10.f, 10.f))
{
g_local_player->m_vehicle->m_handling->m_centre_of_mass.x = fCenterOfMass[0];
g_local_player->m_vehicle->m_handling->m_centre_of_mass.y = fCenterOfMass[1];
g_local_player->m_vehicle->m_handling->m_centre_of_mass.z = fCenterOfMass[2];
}
ImGui::Text("Inertia Multiplier");
float fInertiaMult[3];
fInertiaMult[0] = g_local_player->m_vehicle->m_handling->m_inertia_mult.x;
fInertiaMult[1] = g_local_player->m_vehicle->m_handling->m_inertia_mult.y;
fInertiaMult[2] = g_local_player->m_vehicle->m_handling->m_inertia_mult.z;
if (ImGui::SliderFloat3("##inertia_multiplier", fInertiaMult, -10.f, 10.f))
{
g_local_player->m_vehicle->m_handling->m_inertia_mult.x = fInertiaMult[0];
g_local_player->m_vehicle->m_handling->m_inertia_mult.y = fInertiaMult[1];
g_local_player->m_vehicle->m_handling->m_inertia_mult.z = fInertiaMult[2];
}
ImGui::Text("Buoyancy");
ImGui::SliderFloat("##buoyancy", &g_local_player->m_vehicle->m_handling->m_buoyancy, .01f, 99.f);
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,15 @@
#include "handling_tabs.hpp"
namespace big
{
void tab_handling::tab_steering()
{
if (ImGui::BeginTabItem("Steering"))
{
ImGui::Text("Steering Lock (degrees)");
ImGui::SliderAngle("##steering lock", &g_local_player->m_vehicle->m_handling->m_steering_lock, -90.f, 90.f);
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,49 @@
#include "handling_tabs.hpp"
namespace big
{
void tab_handling::tab_suspension()
{
if (ImGui::BeginTabItem("Suspension"))
{
ImGui::Text("Suspension Strength");
ImGui::SliderFloat("##suspension force", &g_local_player->m_vehicle->m_handling->m_suspension_force, 0.f, 5.f);
ImGui::Text("Suspension Compression (higher = stiffer)");
ImGui::SliderFloat("##suspension comp", &g_local_player->m_vehicle->m_handling->m_suspension_comp_damp, 0.f, 5.f);
ImGui::Text("Suspension Rebound (higher = stiffer)");
ImGui::SliderFloat("##suspension rebound", &g_local_player->m_vehicle->m_handling->m_suspension_rebound_damp, 0.f, 5.f);
ImGui::Text("Suspension Upper Limit");
ImGui::SliderFloat("##suspension upper", &g_local_player->m_vehicle->m_handling->m_suspension_upper_limit, -1.f, 1.f);
ImGui::Text("Suspension Lower Limit");
ImGui::SliderFloat("##suspension lower", &g_local_player->m_vehicle->m_handling->m_suspension_lower_limit, -1.f, 1.f);
ImGui::Text("Suspension Raise");
ImGui::SliderFloat("##suspension raise", &g_local_player->m_vehicle->m_handling->m_suspension_raise, -1.f, 1.f);
ImGui::Text("Suspension Bias (0.0 = front stiffer, 1.0 = rear stiffer");
float fSuspensionBiasFront = g_local_player->m_vehicle->m_handling->m_suspension_bias_front / 2;
if (ImGui::SliderFloat("##suspension bias", &fSuspensionBiasFront, 0.f, 1.f))
g_local_player->m_vehicle->m_handling->m_suspension_bias_front = fSuspensionBiasFront * 2;
ImGui::Text("Anti Rollbar Force (large = less body roll)");
ImGui::SliderFloat("##anti rollbar force", &g_local_player->m_vehicle->m_handling->m_anti_rollbar_force, 0.f, 10.f);
ImGui::Text("Anti Rollbar Bias (0 = front, 1 = rear)");
float fAntiRollBarBiasFront = g_local_player->m_vehicle->m_handling->m_anti_rollbar_bias_front / 2;
if (ImGui::SliderFloat("##anti rollbar bias", &fAntiRollBarBiasFront, 0.f, 1.f))
g_local_player->m_vehicle->m_handling->m_anti_rollbar_bias_front = fAntiRollBarBiasFront * 2;
ImGui::Text("Roll Centre Height Front");
ImGui::SliderFloat("##roll centre height front", &g_local_player->m_vehicle->m_handling->m_roll_centre_height_front, -1.f, 1.f);
ImGui::Text("Roll Centre Height Back");
ImGui::SliderFloat("##roll centre height back", &g_local_player->m_vehicle->m_handling->m_roll_centre_height_rear, -1.f, 1.f);
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,17 @@
#pragma once
#include "common.hpp"
#include "imgui.h"
namespace big
{
class tab_handling
{
public:
static void tab_braking();
static void tab_phyics();
static void tab_suspension();
static void tab_steering();
static void tab_traction();
static void tab_transmission();
};
}

View File

@ -0,0 +1,35 @@
#include "handling_tabs.hpp"
namespace big
{
void tab_handling::tab_traction()
{
if (ImGui::BeginTabItem("Traction"))
{
ImGui::Text("Acceleration/Braking Grip");
ImGui::SliderFloat("##traction curve min", &g_local_player->m_vehicle->m_handling->m_traction_curve_min, 0.f, 7.f);
ImGui::Text("Cornering Grip");
ImGui::SliderFloat("##traction curve max", &g_local_player->m_vehicle->m_handling->m_traction_curve_max, 0.f, 7.f);
ImGui::Text("Traction Spring Delta Max (distance from ground => grip)");
ImGui::SliderFloat("##traction spring delta max", &g_local_player->m_vehicle->m_handling->m_traction_spring_delta_max, 0.f, 2.f);
ImGui::Text("Burnout Multiplier");
ImGui::SliderFloat("##low speed traction loss mult", &g_local_player->m_vehicle->m_handling->m_low_speed_traction_loss_mult, 0.f, 10.f);
ImGui::Text("Camber Stiffness (grip when drifting)");
ImGui::SliderFloat("##camber stiffness", &g_local_player->m_vehicle->m_handling->m_camber_stiffness, -1.f, 1.f);
ImGui::Text("Traction Bias (1.0 = front, 0.0 = rear, 0.5 = balanced)");
float fTractionBiasFront = g_local_player->m_vehicle->m_handling->m_traction_bias_front / 2;
if (ImGui::SliderFloat("##traction bias front", &fTractionBiasFront, 0.01f, .99f))
g_local_player->m_vehicle->m_handling->m_traction_bias_front = fTractionBiasFront * 2;
ImGui::Text("Off-Road Traction Loss (1.0 = normal, lower = better)");
ImGui::SliderFloat("##traction loss mult", &g_local_player->m_vehicle->m_handling->m_traction_loss_mult, 0.f, 5.f);
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,36 @@
#include "handling_tabs.hpp"
namespace big
{
void tab_handling::tab_transmission()
{
if (ImGui::BeginTabItem("Transmission"))
{
ImGui::Text("Drive Bias (1.0 = front, 0.0 = rear, 0.5 = balanced 4WD)");
float fDriveBiasFront = g_local_player->m_vehicle->m_handling->m_drive_bias_front / 2;
if (ImGui::SliderFloat("##drive_bias_front", &fDriveBiasFront, 0.f, 1.0f))
g_local_player->m_vehicle->m_handling->m_drive_bias_front = fDriveBiasFront * 2;
ImGui::Text("Drive Bias (1.0 = rear, 0.0 = front, 0.5 = balanced 4WD)");
float fDriveBiasRear = g_local_player->m_vehicle->m_handling->m_drive_bias_rear / 2;
if (ImGui::SliderFloat("##drive_bias_rear", &fDriveBiasRear, 0.f, 1.0f))
g_local_player->m_vehicle->m_handling->m_drive_bias_rear = fDriveBiasRear * 2;
ImGui::Text("Gears");
int nInitialDriveGears = g_local_player->m_vehicle->m_handling->m_initial_drive_gears;
if (ImGui::SliderInt("##initial_gears", &nInitialDriveGears, 1, 12))
g_local_player->m_vehicle->m_handling->m_initial_drive_gears = nInitialDriveGears;
ImGui::Text("Upshift Rate");
ImGui::SliderFloat("##upshift", &g_local_player->m_vehicle->m_handling->m_upshift, 0.f, 10.f);
ImGui::Text("Downshift Rate");
ImGui::SliderFloat("##downshift", &g_local_player->m_vehicle->m_handling->m_downshift, 0.f, 10.f);
ImGui::Text("Transmission Output (force)");
ImGui::SliderFloat("##initial drive force", &g_local_player->m_vehicle->m_handling->m_initial_drive_force, 0.01f, 2.f);
ImGui::EndTabItem();
}
}
}

View File

@ -15,31 +15,39 @@ namespace big
{
if (ImGui::BeginTabItem("Vehicle"))
{
if (ImGui::Button("Bring Personal Vehicle"))
if (ImGui::TreeNode("General"))
{
QUEUE_JOB_BEGIN_CLAUSE()
if (ImGui::Button("Bring Personal Vehicle"))
{
Vector3 location;
if (!blip::get_blip_location(location, 225, 0)) return notify::above_map("No personal vehicle found, was it destroyed?");
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?");
Vehicle veh = vehicle::get_closest_to_location(location, 5.f);
if (veh == 0) return notify::above_map("Invalid vehicle handle...");
Vehicle veh = vehicle::get_closest_to_location(location, 5.f);
if (veh == 0) return notify::above_map("Invalid vehicle handle...");
location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true);
location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true);
vehicle::bring(veh, location);
}QUEUE_JOB_END_CLAUSE
}
vehicle::bring(veh, location);
}QUEUE_JOB_END_CLAUSE
}
ImGui::SameLine();
if (ImGui::Button("Repair"))
{
QUEUE_JOB_BEGIN_CLAUSE()
ImGui::SameLine();
if (ImGui::Button("Repair"))
{
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false);
QUEUE_JOB_BEGIN_CLAUSE()
{
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false);
vehicle::repair(veh);
}QUEUE_JOB_END_CLAUSE
vehicle::repair(veh);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Handling"))
g.window.handling = true;
ImGui::TreePop();
}
if (ImGui::TreeNode("Speedo Meter"))

View File

@ -0,0 +1,33 @@
#include "gui/window.hpp"
#include "handling/handling_tabs.hpp"
#include "imgui.h"
namespace big
{
void window::handling()
{
ImGui::SetNextWindowSize({ 500, 250 }, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowPos({ 50, 50 }, ImGuiCond_FirstUseEver);
if (g.window.handling && ImGui::Begin("Handling", &g.window.handling))
{
if (g_local_player->m_vehicle == nullptr)
{
ImGui::Text("Please enter a vehicle to modify handling.");
return;
}
ImGui::BeginTabBar("handling_tabbar");
tab_handling::tab_phyics();
tab_handling::tab_braking();
tab_handling::tab_steering();
tab_handling::tab_traction();
tab_handling::tab_suspension();
// rollbars
// misc
ImGui::EndTabBar();
ImGui::End();
}
}
}