feat(Handling): Added around 32 handling properties to modify

This commit is contained in:
Yimura 2021-01-22 02:10:08 +01:00
parent bfe01d19f4
commit ff0866a009
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682
15 changed files with 334 additions and 83 deletions

View File

@ -34,6 +34,7 @@ namespace big
spoof_rank();
// Vehicle
handling();
no_bike_fall();
speedo_meter();
sticky_tyres();

View File

@ -8,6 +8,7 @@
#include "features/notify.hpp"
#include "features/stats.hpp"
#include "features/teleport.hpp"
#include "gta/ped_factory.hpp"
namespace big
{
@ -21,6 +22,11 @@ namespace big
// Temporary Variable struct
inline temp g_temp = temp{};
inline CAutomobile* g_vehicle;
inline bool g_in_vehicle = false;
inline bool g_handling_window = false;
// Screen Width & Height
inline int x, y;
@ -53,6 +59,8 @@ namespace big
void sticky_tyres();
void super_sprint();
void handling();
void update_screen_sizes();
void update_player_structs();
}

View File

@ -124,8 +124,10 @@ namespace big::features::functions
take_control_of_entity(ent);
ENTITY::DETACH_ENTITY(ent, 1, 1);
ENTITY::SET_ENTITY_VISIBLE(ent, false, false);
NETWORK::_NETWORK_SET_ENTITY_INVISIBLE_TO_NETWORK(ent, true);
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(ent, 0, 0, 0, 0, 0, 0);
ENTITY::SET_ENTITY_AS_MISSION_ENTITY(ent, 0, 1);
ENTITY::SET_ENTITY_AS_MISSION_ENTITY(ent, 1, 1);
ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&ent);
ENTITY::DELETE_ENTITY(&ent);
}

View File

@ -0,0 +1,26 @@
#include "features.hpp"
#include "gta_util.hpp"
namespace big
{
static Vehicle veh = -1;
void features::handling()
{
CPed* ped = gta_util::get_local_ped();
g_in_vehicle = ped->m_in_vehicle == 0;
if (g_in_vehicle)
{
Vehicle currVeh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false);
if (veh != currVeh && ped->m_vehicle != NULL)
{
veh = currVeh;
// Copy the new vehicle data to our global
g_vehicle = ped->m_vehicle;
}
}
}
}

View File

@ -54,11 +54,13 @@ public:
uint8_t m_godmode; //0x0189
char pad_018A[1722]; //0x018A
float m_health; //0x0844
char pad_0848[188]; //0x0848
float m_health2; //0x0904
char pad_0908[48]; //0x0908
char pad_0848[192]; //0x0848
float m_health2; //0x0908
char pad_090C[44]; //0x090C
class CHandlingData* m_handling; //0x0938
char pad_0940[796]; //0x0940
char pad_0940[688]; //0x0940
class WheelArray* m_wheels; //0x0BF0
char pad_0BF8[100]; //0x0BF8
float m_gravity; //0x0C5C
}; //Size: 0x0C60
static_assert(sizeof(CAutomobile) == 0xC60);
@ -124,33 +126,48 @@ public:
float m_mass; //0x000C
char pad_0010[16]; //0x0010
rage::vector3 m_centre_of_mass; //0x0020
float m_drive_bias_front; //0x002C
char pad_002C[4]; //0x002C
rage::vector3 m_inertia_multiplier; //0x0030
float m_drive_inertia; //0x003C
char pad_003C[4]; //0x003C
float m_buoyancy; //0x0040
char pad_0044[8]; //0x0044
char pad_0044[4]; //0x0044
float m_drive_bias_front; //0x0048
float m_acceleration; //0x004C
char pad_0050[8]; //0x0050
uint8_t m_initial_drive_gears; //0x0050
char pad_0051[3]; //0x0051
float m_drive_inertia; //0x0054
float m_upshift; //0x0058
float m_downshift; //0x005C
float m_initial_drive_force; //0x0060
char pad_0064[8]; //0x0064
float m_brakeforce; //0x006C
char pad_0070[24]; //0x0070
float m_brake_force; //0x006C
char pad_0070[4]; //0x0070
float m_brake_bias; //0x0074
char pad_0078[4]; //0x0078
float m_handbrake_force; //0x007C
char pad_0080[8]; //0x0080
float m_traction_curve_max; //0x0088
char pad_008C[4]; //0x008C
float m_traction_curve_min; //0x0090
char pad_0094[36]; //0x0094
char pad_0094[12]; //0x0094
float m_traction_spring_delta_max; //0x00A0
char pad_00A4[4]; //0x00A4
float m_low_speed_traction_loss_mult; //0x00A8
float m_camber_stiffness; //0x00AC
float m_traction_bias_front; //0x00B0
char pad_00B4[4]; //0x00B4
float m_traction_loss_mult; //0x00B8
float m_suspension_force; //0x00BC
float m_suspension_comp_damp; //0x00C0
float m_suspension_rebound_damp; //0x00C4
float m_suspension_upper_limit; //0x00C8
float m_suspension_lower_limit; //0x00CC
float m_camber_stiffness; //0x00D0
char pad_00D4[8]; //0x00D4
float m_suspension_raise; //0x00D0
float m_suspension_bias_front; //0x00D4
char pad_00D8[4]; //0x00D8
float m_anti_rollbar_force; //0x00DC
char pad_00E0[8]; //0x00E0
float m_anti_rollbar_bias_front; //0x00E0
char pad_00E4[4]; //0x00E4
float m_roll_centre_height_front; //0x00E8
float m_roll_centre_height_rear; //0x00EC
float m_collision_damage_mult; //0x00F0
@ -159,8 +176,11 @@ public:
float m_engine_damage_mult; //0x00FC
float m_petrol_tank_volume; //0x0100
float m_oil_volume; //0x0104
}; //Size: 0x0108
static_assert(sizeof(CHandlingData) == 0x108);
char pad_0108[4]; //0x0108
rage::vector3 m_seat_index_dist; //0x010C
uint32_t m_monetary_value; //0x0118
}; //Size: 0x011C
static_assert(sizeof(CHandlingData) == 0x11C);
class CWeaponInfo
{
@ -175,4 +195,25 @@ public:
char pad_0000[136]; //0x0000
}; //Size: 0x0088
static_assert(sizeof(CPedModelInfo) == 0x88);
class WheelArray
{
public:
class CWheel* m_wheel1; //0x0000
class CWheel* m_wheel2; //0x0008
class CWheel* m_wheel3; //0x0010
class CWheel* m_wheel4; //0x0018
char pad_0020[88]; //0x0020
}; //Size: 0x0078
static_assert(sizeof(WheelArray) == 0x78);
class CWheel
{
public:
char pad_0000[8]; //0x0000
float m_camber; //0x0008
float m_camber_inverted; //0x000C
char pad_0010[552]; //0x0010
}; //Size: 0x0238
static_assert(sizeof(CWheel) == 0x238);
#pragma pack(pop)

View File

@ -105,17 +105,20 @@ namespace big
{
TRY_CLAUSE
{
// gui/top_bar.cpp
// gui/window/top_bar.cpp
window::render_top_bar();
// gui/main_window.cpp
// gui/window/main.cpp
window::render_main_window();
// gui/user_sidebar.cpp
// gui/window/user_sidebar.cpp
window::render_user_sidebar();
// gui/player_window.cpp
// gui/window/player.cpp
window::render_player_window();
// gui/window/handling.cpp
window::render_handling_window();
}
EXCEPT_CLAUSE
}

View File

@ -28,6 +28,12 @@ namespace big
static void player_griefing();
static void player_teleport();
static void player_drop();
static void handling_physics();
static void handling_transmission();
static void handling_brakes();
static void handling_traction();
static void handling_suspension();
};
}

View File

@ -0,0 +1,23 @@
#include "gui/tab_bar.hpp"
namespace big
{
void tabbar::handling_brakes()
{
if (ImGui::BeginTabItem("Brakes"))
{
ImGui::Text("Brake Force");
ImGui::SliderFloat("##brake force", &g_vehicle->m_handling->m_brake_force, 0.f, 50.f);
ImGui::Text("Brake Bias (1.0 = front, 0.0 = rear, 0.5 = balanced)");
float fBrakeBias = g_vehicle->m_handling->m_brake_bias / 2;
if (ImGui::SliderFloat("##brake bias front", &fBrakeBias, 0.f, 1.f))
g_vehicle->m_handling->m_brake_bias = fBrakeBias * 2;
ImGui::Text("Hand Brake Force");
ImGui::SliderFloat("##hand brake force", &g_vehicle->m_handling->m_handbrake_force, 0.f, 50.f);
ImGui::EndTabItem();
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,35 @@
#include "gui/tab_bar.hpp"
namespace big
{
void tabbar::handling_traction()
{
if (ImGui::BeginTabItem("Traction"))
{
ImGui::Text("Acceleration/Braking Grip");
ImGui::SliderFloat("##traction curve min", &g_vehicle->m_handling->m_traction_curve_min, 0.f, 7.f);
ImGui::Text("Cornering Grip");
ImGui::SliderFloat("##traction curve max", &g_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_vehicle->m_handling->m_traction_spring_delta_max, 0.f, 2.f);
ImGui::Text("Burnout Multiplier");
ImGui::SliderFloat("##low speed traction loss mult", &g_vehicle->m_handling->m_low_speed_traction_loss_mult, 0.f, 2.f);
ImGui::Text("Camber Stiffness (grip when drifting)");
ImGui::SliderFloat("##camber stiffness", &g_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_vehicle->m_handling->m_traction_bias_front / 2;
if (ImGui::SliderFloat("##traction bias front", &fTractionBiasFront, 0.01f, .99f))
g_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_vehicle->m_handling->m_traction_loss_mult, 0.f, 5.f);
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,37 @@
#include "gui/tab_bar.hpp"
namespace big
{
void tabbar::handling_transmission()
{
if (ImGui::BeginTabItem("Transmission"))
{
ImGui::Text("Acceleration Multiplier");
ImGui::SliderFloat("##acceleration", &g_vehicle->m_handling->m_acceleration, 0.f, 50.f);
ImGui::Text("Drive Bias (1.0 = front, 0.0 = rear, 0.5 = balanced 4WD)");
float fDriveBiasFront = g_vehicle->m_handling->m_drive_bias_front / 2;
if (ImGui::SliderFloat("##drive_bias_front", &fDriveBiasFront, 0.f, 1.0f))
g_vehicle->m_handling->m_drive_bias_front = fDriveBiasFront * 2;
ImGui::Text("Gears");
int nInitialDriveGears = g_vehicle->m_handling->m_initial_drive_gears;
if (ImGui::SliderInt("##initial_gears", &nInitialDriveGears, 1, 12))
g_vehicle->m_handling->m_initial_drive_gears = nInitialDriveGears;
ImGui::Text("Upshift Rate");
ImGui::SliderFloat("##upshift", &g_vehicle->m_handling->m_upshift, 0.f, 10.f);
ImGui::Text("Downshift Rate");
ImGui::SliderFloat("##downshift", &g_vehicle->m_handling->m_downshift, 0.f, 10.f);
ImGui::Text("Transmission Output (force)");
ImGui::SliderFloat("##initial drive force", &g_vehicle->m_handling->m_initial_drive_force, 0.01f, 2.f);
ImGui::Text("Max Velocity (broken)");
//ImGui::SliderFloat("##initial drive max flat vel", );
ImGui::EndTabItem();
}
}
}

View File

@ -7,15 +7,15 @@ namespace big
{
CPed* ped = gta_util::get_local_ped();
bool bVehGodMode = ped->m_vehicle == nullptr ? false : (ped->m_vehicle->m_godmode & 0x1) == 0x1;
if (ImGui::Checkbox("Vehicle God Mode", &bVehGodMode))
if (ped->m_vehicle != nullptr)
ped->m_vehicle->m_godmode = bVehGodMode ? 0x1 : 0x0;
ImGui::Separator();
if (ImGui::BeginTabItem("Vehicle"))
{
bool bVehGodMode = ped->m_vehicle == nullptr ? false : (ped->m_vehicle->m_godmode & 0x1) == 0x1;
if (ImGui::Checkbox("Vehicle God Mode", &bVehGodMode))
if (ped->m_vehicle != nullptr)
ped->m_vehicle->m_godmode = bVehGodMode ? 0x1 : 0x0;
ImGui::Separator();
if (ImGui::TreeNode("Speedometer"))
{
static const char* speedo_options[] = { "None", "km/h", "mph" };
@ -39,62 +39,9 @@ namespace big
ImGui::TreePop();
}
if (ImGui::TreeNode("Handling"))
{
CAutomobile* veh = ped->m_vehicle;
ImGui::Separator();
static float fAcceleration = veh == nullptr ? 1.f : veh->m_handling->m_acceleration;
if (ImGui::SliderFloat("Acceleration", &fAcceleration, 0.f, 100.f))
if (veh != nullptr)
veh->m_handling->m_acceleration = fAcceleration;
static float fBrakeForce = veh == nullptr ? 1.f : veh->m_handling->m_brakeforce;
if (ImGui::SliderFloat("Brake Force", &fBrakeForce, 0.f, 100.f))
if (veh != nullptr)
veh->m_handling->m_brakeforce = fBrakeForce;
static float fGravity = veh == nullptr ? 1.f : veh->m_gravity;
if (ImGui::SliderFloat("Gravity", &fGravity, -24.f, 24.f))
if (veh != nullptr)
veh->m_gravity = fGravity;
static float fUpshift = veh == nullptr ? 1.f : veh->m_handling->m_upshift;
static float fDownShift = veh == nullptr ? 1.f : veh->m_handling->m_downshift;
if (ImGui::SliderFloat("Upshift", &fUpshift, 0.f, 100.f))
if (veh != nullptr)
veh->m_handling->m_upshift = fUpshift;
if (ImGui::SliderFloat("Downshift", &fDownShift, 0.f, 100.f))
if (veh != nullptr)
veh->m_handling->m_downshift = fDownShift;
static float fMass = veh == nullptr ? 1.f : veh->m_handling->m_mass;
if (ImGui::InputFloat("Mass", &fMass))
if (veh != nullptr)
veh->m_handling->m_mass = fMass;
static float fTractionCurveMax = veh == nullptr ? 1.f : veh->m_handling->m_traction_curve_max;
static float fTractionCurveMin = veh == nullptr ? 1.f : veh->m_handling->m_traction_curve_min;
if (ImGui::SliderFloat("Traction Curve Max", &fTractionCurveMax, 0.f, 100.f))
if (veh != nullptr)
veh->m_handling->m_traction_curve_max = fTractionCurveMax;
if (ImGui::SliderFloat("Traction Curve Min", &fTractionCurveMin, 0.f, 100.f))
if (veh != nullptr)
veh->m_handling->m_traction_curve_min = fTractionCurveMin;
static float fTractionLoss = veh == nullptr ? 1.f : veh->m_handling->m_traction_loss_mult;
if (ImGui::SliderFloat("Off-Road Traction Loss (lower better)", &fTractionLoss, 0.f, 2.f))
if (veh != nullptr)
veh->m_handling->m_traction_loss_mult = fTractionLoss;
static float fDriveBiasFront = veh == nullptr ? .5f : veh->m_handling->m_drive_bias_front;
if (ImGui::SliderFloat("Drive Bias Front", &fDriveBiasFront, 0.f, 1.f))
if (veh != nullptr)
veh->m_handling->m_drive_bias_front = fDriveBiasFront;
ImGui::TreePop();
}
ImGui::Checkbox("Handling", &g_handling_window);
ImGui::Separator();

View File

@ -10,5 +10,7 @@ namespace big
static void render_main_window();
static void render_user_sidebar();
static void render_player_window();
static void render_handling_window();
};
}

View File

@ -0,0 +1,26 @@
#include "gui/window.hpp"
#include "gui/tab_bar.hpp"
#include "features.hpp"
namespace big
{
void window::render_handling_window()
{
if (g_handling_window && ImGui::Begin("Handling", &g_handling_window))
{
if (g_in_vehicle && g_vehicle != nullptr)
{
ImGui::BeginTabBar("handling_tabbar");
tabbar::handling_physics();
tabbar::handling_brakes();
tabbar::handling_suspension();
tabbar::handling_traction();
tabbar::handling_transmission();
ImGui::EndTabBar();
}
else ImGui::Text("You're not in a vehicle right now.");
ImGui::End();
}
}
}