Added headlight, neon light and custom tire options to LSC. (#332)

This commit is contained in:
aa15032261 2022-07-14 22:16:30 +08:00 committed by GitHub
parent 44745c09d4
commit bbd1af8738
19 changed files with 1101 additions and 411 deletions

View File

@ -3,28 +3,98 @@
namespace big::remote
{
inline bool download_binary(const std::string_view file_url, const std::filesystem::path& location)
inline bool get_remote_file_etag(const std::string_view file_url)
{
std::ofstream file(location, std::ios::binary | std::ios::trunc);
try
{
http::Request req(file_url.data());
http::Response res = req.send("GET", "", {}, 10s);
http::Response res = req.send("HEAD", "", { "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/6.0" }, 10s);
std::ostream_iterator<std::uint8_t> outputIter(file);
std::copy(res.body.begin(), res.body.end(), outputIter);
for (auto& header : res.headers)
{
LOG(WARNING) << header;
}
}
catch (const std::exception& e)
{
LOG(INFO) << "Failed to download binary, is the host down?: " << e.what();
file.close();
return false;
}
file.close();
return true;
}
inline std::string get_etag_from_headers(std::vector<std::string> headers)
{
std::string remote_etag = "";
for (auto& header : headers)
{
if (header.rfind("ETag", 0) == 0)
{
remote_etag = header;
break;
}
}
return remote_etag;
}
inline bool update_binary(const std::string_view file_url, const std::filesystem::path& file_location, const std::filesystem::path& etag_location)
{
try
{
std::string local_etag = "";
std::string remote_etag = "";
try {
{
std::ifstream file_etag_ifstream(etag_location, std::ios::binary);
std::stringstream file_etag_stringstream;
file_etag_stringstream << file_etag_ifstream.rdbuf();
local_etag = file_etag_stringstream.str();
}
if (!local_etag.empty())
{
http::Request req(file_url.data());
http::Response res = req.send("HEAD", "", { "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/6.0" }, 10s);
remote_etag = get_etag_from_headers(res.headers);
if (remote_etag == local_etag)
{
return false;
}
}
}
catch (const std::exception& e)
{
LOG(INFO) << "Update Error: " << e.what();
}
http::Request req(file_url.data());
http::Response res = req.send("GET", "", {}, 10s);
std::ofstream file_ofstream(file_location, std::ios::binary | std::ios::trunc);
std::ostream_iterator<std::uint8_t> file_out_iter(file_ofstream);
std::copy(res.body.begin(), res.body.end(), file_out_iter);
remote_etag = get_etag_from_headers(res.headers);
std::ofstream file_etag_ofstream(etag_location, std::ios::binary | std::ios::trunc);
file_etag_ofstream << remote_etag;
return true;
}
catch (const std::exception& e)
{
LOG(INFO) << "Failed to download binary, is the host down?: " << e.what();
}
return false;
}
}

View File

@ -14,7 +14,7 @@ namespace big
static bool ran_once = false;
static int changing_driving_styles = false;
static int current_driving_style = false;
static int current_speed;
static float current_speed;
if (g->vehicle.auto_drive_to_waypoint)
{
@ -41,12 +41,17 @@ namespace big
g_notification_service->push_warning("Auto Drive", "Start driving or leave car to take back control.");
}
current_speed = g->vehicle.auto_drive_speed;
current_driving_style = g->vehicle.driving_style_flags;
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
TASK::TASK_VEHICLE_DRIVE_TO_COORD(self::ped, self::veh, location.x, location.y, location.z, static_cast<float>(g->vehicle.auto_drive_speed), 5, ENTITY::GET_ENTITY_MODEL(self::veh), g->vehicle.driving_style_flags, 20, true);
current_driving_style = g->vehicle.driving_style_flags;
current_speed = g->vehicle.auto_drive_speed;
TASK::TASK_VEHICLE_DRIVE_TO_COORD(
self::ped, self::veh,
location.x, location.y, location.z, current_speed,
5, ENTITY::GET_ENTITY_MODEL(self::veh),
current_driving_style, 20, true
);
g->vehicle.auto_drive_to_waypoint = false;

View File

@ -14,7 +14,7 @@ namespace big
static bool ran_once = false;
static int changing_driving_styles = false;
static int current_driving_style = false;
static int current_speed;
static float current_speed;
if (g->vehicle.auto_drive_wander)
{
@ -32,13 +32,12 @@ namespace big
else
{
g->vehicle.auto_drive_wander = false;
current_speed = g->vehicle.auto_drive_speed;
current_driving_style = g->vehicle.driving_style_flags;
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
TASK::TASK_VEHICLE_DRIVE_WANDER(self::ped, self::veh, static_cast<float>(g->vehicle.auto_drive_speed), g->vehicle.driving_style_flags);
current_driving_style = g->vehicle.driving_style_flags;
current_speed = g->vehicle.auto_drive_speed;
TASK::TASK_VEHICLE_DRIVE_WANDER(self::ped, self::veh, current_speed, current_driving_style);
wandering = true;

View File

@ -16,13 +16,11 @@ namespace big
ENTITY::SET_ENTITY_ROTATION(vehicle, cam_pos.x, cam_pos.y, cam_pos.z, 1, true);
ENTITY::SET_ENTITY_COLLISION(vehicle, !g->vehicle.fly.no_collision, true);
float locspeed = (g->vehicle.fly.speed * 10);
float locspeed2 = g->vehicle.fly.speed;
float locspeed = g->vehicle.fly.speed;
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{
locspeed *= 2;
locspeed2 *= 2;
}

View File

@ -1,45 +1,61 @@
#include "backend/looped/looped.hpp"
#include "core/data/speedo_meters.hpp"
#include "natives.hpp"
#include "util/vehicle.hpp"
namespace big
{
void looped::vehicle_speedo_meter()
{
SpeedoMeter speedo_type = g->vehicle.speedo_meter.type;
if (
!g->vehicle.speedo_meter.enabled ||
self::veh == 0 ||
HUD::IS_PAUSE_MENU_ACTIVE() ||
HUD::IS_WARNING_MESSAGE_ACTIVE() ||
CAM::IS_SCREEN_FADED_OUT() ||
CAM::IS_SCREEN_FADING_OUT() ||
CAM::IS_SCREEN_FADING_IN()
) {
return;
}
if (speedo_type == SpeedoMeter::DISABLED || HUD::IS_PAUSE_MENU_ACTIVE() || HUD::IS_WARNING_MESSAGE_ACTIVE() || CAM::IS_SCREEN_FADED_OUT() || CAM::IS_SCREEN_FADING_OUT() || CAM::IS_SCREEN_FADING_IN()) return;
if (self::veh == 0) return;
char speed_type[16], speed[16];
float veh_speed = ENTITY::GET_ENTITY_SPEED(self::veh);
switch (speedo_type)
int char_width = 3;
float veh_speed = vehicle::mps_to_speed(
ENTITY::GET_ENTITY_SPEED(self::veh),
g->vehicle.speed_unit
);
switch (g->vehicle.speed_unit)
{
case SpeedoMeter::KMH:
veh_speed *= 3.6;
strcpy(speed_type, "kph");
case SpeedUnit::KMPH:
strcpy(speed_type, "kmph");
char_width = 4;
break;
case SpeedoMeter::MPH:
veh_speed *= 2.2369;
case SpeedUnit::MIPH:
strcpy(speed_type, "mph");
break;
case SpeedUnit::MPS:
strcpy(speed_type, "mps");
break;
}
sprintf(speed, "%*d", g->vehicle.speedo_meter.left_side ? 0 : 3, (int)veh_speed);
sprintf(speed, "%*d", g->vehicle.speedo_meter.left_side ? 0 : char_width, (int)veh_speed);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.9f, .9f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed_type);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y, 1);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.9f, .9f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y + .04f, 1);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g->vehicle.speedo_meter.x + (g->vehicle.speedo_meter.left_side ? 0 : .003f), g->vehicle.speedo_meter.y + .04f, 1);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.91f, .91f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed_type);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y, 1);
}
}

View File

@ -0,0 +1,192 @@
#pragma once
#include "gta\VehicleValues.h"
static const std::map<int, std::string> lsc_plate_styles = {
{ PLATE_BLUEONWHITE1, "Blue on White 1" },
{ PLATE_BLUEONWHITE2, "Blue on White 2" },
{ PLATE_BLUEONWHITE3, "Blue on White 3" },
{ PLATE_YELLOWONBLACK, "Yellow on Black" },
{ PLATE_YELLOWONBLUE, "Yellow on Blue" },
{ PLATE_YANKTON, "Yankton" }
};
static const std::map<int, std::string> lsc_wheel_styles = {
{ WHEEL_TYPE_SPORT, "Sport" },
{ WHEEL_TYPE_MUSCLE, "Muscle" },
{ WHEEL_TYPE_LOWRIDER, "Lowrider" },
{ WHEEL_TYPE_SUV, "SUV" },
{ WHEEL_TYPE_OFFROAD, "Offroad" },
{ WHEEL_TYPE_TUNER, "Tuner" },
{ WHEEL_TYPE_BIKEWHEELS, "Bike Wheels" },
{ WHEEL_TYPE_HIGHEND, "High End" },
{ WHEEL_TYPE_BENNYS_ORIGINAL, "Bennys Original" },
{ WHEEL_TYPE_BENNYS_BESPOKE, "Bennys Bespoke" },
{ WHEEL_TYPE_OPEN_WHEEL, "Open Wheel" },
{ WHEEL_TYPE_STREET, "Street" },
{ WHEEL_TYPE_TRACK, "Track" }
};
static const std::map<int, std::string> lsc_window_tint_types = {
{ WINDOWTINT_NONE, "None" },
{ WINDOWTINT_BLACK, "Black" },
{ WINDOWTINT_DARKSMOKE, "Dark" },
{ WINDOWTINT_LIGHTSMOKE, "Light" },
{ WINDOWTINT_STOCK, "Stock" },
{ WINDOWTINT_LIMO, "Limo" },
{ WINDOWTINT_GREEN, "Green" }
};
static const std::map<int, std::string> lsc_classic_colors = {
{ COLOR_CLASSIC_BLACK, "Black" },
{ COLOR_CLASSIC_CARBON_BLACK, "Carbon Black" },
{ COLOR_CLASSIC_GRAPHITE, "Graphite" },
{ COLOR_CLASSIC_ANHRACITE_BLACK, "Anthracite Black" },
{ COLOR_CLASSIC_BLACK_STEEL, "Black Steel" },
{ COLOR_CLASSIC_DARK_STEEL, "Dark Steel" },
{ COLOR_CLASSIC_SILVER, "Silver" },
{ COLOR_CLASSIC_BLUISH_SILVER, "Bluish Silver" },
{ COLOR_CLASSIC_ROLLED_STEEL, "Rolled Steel" },
{ COLOR_CLASSIC_SHADOW_SILVER, "Shadow SIlver" },
{ COLOR_CLASSIC_STONE_SILVER, "Stone Silver" },
{ COLOR_CLASSIC_MIDNIGHT_SILVER, "Midnight Silver" },
{ COLOR_CLASSIC_CAST_IRON_SILVER, "Cast Iron Silver" },
{ COLOR_CLASSIC_RED, "Red" },
{ COLOR_CLASSIC_TORINO_RED, "Torino Red" },
{ COLOR_CLASSIC_FORMULA_RED, "Formula Red" },
{ COLOR_CLASSIC_LAVA_RED, "Lava Red" },
{ COLOR_CLASSIC_BLAZE_RED, "Blaze Red" },
{ COLOR_CLASSIC_GRACE_RED, "Grace Red" },
{ COLOR_CLASSIC_GARNET_RED, "Garnet Red" },
{ COLOR_CLASSIC_SUNSET_RED, "Sunset Red" },
{ COLOR_CLASSIC_CABERNET_RED, "Cabernet Red" },
{ COLOR_CLASSIC_WINE_RED, "Wine Red" },
{ COLOR_CLASSIC_CANDY_RED, "Candy Red" },
{ COLOR_CLASSIC_HOT_PINK, "Hot Pink" },
{ COLOR_CLASSIC_PFSITER_PINK, "Pfister Pink" },
{ COLOR_CLASSIC_SALMON_PINK, "Salmon Pink" },
{ COLOR_CLASSIC_SUNRISE_ORANGE, "Sunrise Orange" },
{ COLOR_CLASSIC_ORANGE, "Orange" },
{ COLOR_CLASSIC_BRIGHT_ORANGE, "Bright Orange" },
{ COLOR_CLASSIC_GOLD, "Gold" },
{ COLOR_CLASSIC_BRONZE, "Bronze" },
{ COLOR_CLASSIC_YELLOW, "Yellow" },
{ COLOR_CLASSIC_RACE_YELLOW, "Race Yellow" },
{ COLOR_CLASSIC_DEW_YELLOW, "Dew Yellow" },
{ COLOR_CLASSIC_DARK_GREEN, "Dark Green" },
{ COLOR_CLASSIC_RACING_GREEN, "Racing Green" },
{ COLOR_CLASSIC_SEA_GREEN, "Sea Green" },
{ COLOR_CLASSIC_OLIVE_GREEN, "Olive Green" },
{ COLOR_CLASSIC_BRIGHT_GREEN, "Bright Green" },
{ COLOR_CLASSIC_GASOLINE_GREEN, "Gasoline Green" },
{ COLOR_CLASSIC_LIME_GREEN, "Lime Green" },
{ COLOR_CLASSIC_MIDNIGHT_BLUE, "Midnight Blue" },
{ COLOR_CLASSIC_GALAXY_BLUE, "Galaxy Blue" },
{ COLOR_CLASSIC_DARK_BLUE, "Dark Blue" },
{ COLOR_CLASSIC_SAXON_BLUE, "Saxon Blue" },
{ COLOR_CLASSIC_BLUE, "Blue" },
{ COLOR_CLASSIC_MARINER_BLUE, "Mariner Blue" },
{ COLOR_CLASSIC_HARBOR_BLUE, "Harbor Blue" },
{ COLOR_CLASSIC_DIAMOND_BLUE, "Diamond Blue" },
{ COLOR_CLASSIC_SURF_BLUE, "Surf Blue" },
{ COLOR_CLASSIC_NAUTICAL_BLUE, "Nautical Blue" },
{ COLOR_CLASSIC_RACING_BLUE, "Racing Blue" },
{ COLOR_CLASSIC_ULTRA_BLUE, "Ultra Blue" },
{ COLOR_CLASSIC_LIGHT_BLUE, "Light Blue" },
{ COLOR_CLASSIC_CHOCOLATE_BROWN, "Chocolate Brown" },
{ COLOR_CLASSIC_BISON_BROWN, "Bison Brown" },
{ COLOR_CLASSIC_CREEEN_BROWN, "Creek Brown" },
{ COLOR_CLASSIC_FELTZER_BROWN, "Feltzer Brown" },
{ COLOR_CLASSIC_MAPLE_BROWN, "Maple Brown" },
{ COLOR_CLASSIC_BEECHWOOD_BROWN, "Beechwood Brown" },
{ COLOR_CLASSIC_SIENNA_BROWN, "Sienna Brown" },
{ COLOR_CLASSIC_SADDLE_BROWN, "Saddle Brown" },
{ COLOR_CLASSIC_MOSS_BROWN, "Moss Brown" },
{ COLOR_CLASSIC_WOODBEECH_BROWN, "Woodbeech Brown" },
{ COLOR_CLASSIC_STRAW_BROWN, "Straw Brown" },
{ COLOR_CLASSIC_SANDY_BROWN, "Sandy Brown" },
{ COLOR_CLASSIC_BLEACHED_BROWN, "Bleached Brown" },
{ COLOR_CLASSIC_SCHAFTER_PURPLE, "Schafter Purple" },
{ COLOR_CLASSIC_SPINNAKER_PURPLE, "Spinnaker Purple" },
{ COLOR_CLASSIC_MIDNIGHT_PURPLE, "Midnight Purple" },
{ COLOR_CLASSIC_BRIGHT_PURPLE, "Bright Purple" },
{ COLOR_CLASSIC_CREAM, "Cream" },
{ COLOR_CLASSIC_ICE_WHITE, "Ice White" },
{ COLOR_CLASSIC_FROST_WHITE, "Frost White" }
};
static const std::map<int, std::string> lsc_matte_colors = {
{ COLOR_MATTE_BLACK, "Black" },
{ COLOR_MATTE_GRAY, "Gray" },
{ COLOR_MATTE_LIGHT_GRAY, "Light Gray" },
{ COLOR_MATTE_ICE_WHITE, "Ice White" },
{ COLOR_MATTE_BLUE, "Blue" },
{ COLOR_MATTE_DARK_BLUE, "Dark Blue" },
{ COLOR_MATTE_MIDNIGHT_BLUE, "Midnight Blue" },
{ COLOR_MATTE_MIDNIGHT_PURPLE, "Midnight Purple" },
{ COLOR_MATTE_SCHAFTER_PURPLE, "Shafter Purple" },
{ COLOR_MATTE_RED, "Red" },
{ COLOR_MATTE_DARK_RED, "Dark Red" },
{ COLOR_MATTE_ORANGE, "Orange" },
{ COLOR_MATTE_YELLOW, "Yellow" },
{ COLOR_MATTE_LIME_GREEN, "Lime Green" },
{ COLOR_MATTE_GREEN, "Green" },
{ COLOR_MATTE_FOREST_GREEN, "Forest Green" },
{ COLOR_MATTE_FOLIAGE_GREEN, "Foliage Green" },
{ COLOR_MATTE_OLIVE_DARB, "Olive Drab" },
{ COLOR_MATTE_DARK_EARTH, "Dark Earth" },
{ COLOR_MATTE_DESERT_TAN, "Desert Tan" }
};
static const std::map<int, std::string> lsc_metal_colors = {
{ COLOR_METALS_BRUSHED_STEEL, "Brushed Steel" },
{ COLOR_METALS_BRUSHED_BLACK_STEEL, "Brushed Black Steel" },
{ COLOR_METALS_BRUSHED_ALUMINUM, "Brushed Aluminium" },
{ COLOR_METALS_PURE_GOLD, "Pure Gold" },
{ COLOR_METALS_BRUSHED_GOLD, "Brushed Gold" }
};
static const std::map<int, std::string> lsc_headlight_colors = {
{ XENON_DEFAULT, "Default" },
{ XENON_WHITE, "White" },
{ XENON_BLUE, "Blue" },
{ XENON_ELECTRIC_BLUE, "Electric Blue" },
{ XENON_MINT_GREEN, "Mint Green" },
{ XENON_LIME_GREEN, "Lime Green" },
{ XENON_YELLOW, "Yellow" },
{ XENON_GOLDEN_SHOWER, "Golden Shower" },
{ XENON_ORANGE, "Orange" },
{ XENON_RED, "Red" },
{ XENON_PONY_PINK, "Pony Pink" },
{ XENON_HOT_PINK, "Hot Pink" },
{ XENON_PURPLE, "Purple" },
{ XENON_BACKLIGHT, "Backlight" }
};
static const std::map<std::string, std::vector<int>> lsc_tire_smoke_rgb = {
{ "White", { TIRESMOKE_COLOR_WHITE } },
{ "Black", { TIRESMOKE_COLOR_BLACK } },
{ "Blue", { TIRESMOKE_COLOR_BLUE } },
{ "Yellow", { TIRESMOKE_COLOR_YELLOW } },
{ "Purple", { TIRESMOKE_COLOR_PURPLE } },
{ "Orange", { TIRESMOKE_COLOR_ORANGE } },
{ "Green", { TIRESMOKE_COLOR_GREEN } },
{ "Red", { TIRESMOKE_COLOR_RED } },
{ "Pink", { TIRESMOKE_COLOR_PINK } },
{ "Brown", { TIRESMOKE_COLOR_BROWN } }
};
static const std::map<std::string, std::vector<int>> lsc_neon_rgb = {
{ "White", { NEON_COLOR_WHITE } },
{ "Blue", { NEON_COLOR_BLUE } },
{ "Electro Blue", { NEON_COLOR_ELECTRICBLUE } },
{ "Mint Green", { NEON_COLOR_MINTGREEN } },
{ "Lime Green", { NEON_COLOR_LIMEGREEN } },
{ "Yellow", { NEON_COLOR_YELLOW } },
{ "Golden Shower", { NEON_COLOR_GOLDENSHOWER } },
{ "Orange", { NEON_COLOR_ORANGE } },
{ "Red", { NEON_COLOR_RED } },
{ "Pony Pink", { NEON_COLOR_PONYPINK } },
{ "Hot Pink", { NEON_COLOR_HOTPINK } },
{ "Purple", { NEON_COLOR_PURPLE } }
};

View File

@ -0,0 +1,8 @@
#pragma once
#include "core/enums.hpp"
static const std::string speed_unit_strings[3] = {
"km/h",
"mi/h",
"m/s"
};

View File

@ -1,13 +0,0 @@
#pragma once
#include "core/enums.hpp"
struct speedo_meter {
big::SpeedoMeter id;
const char name[16];
};
const speedo_meter speedo_meters[] = {
{ big::SpeedoMeter::DISABLED, "Disabled" },
{ big::SpeedoMeter::KMH, "km/h" },
{ big::SpeedoMeter::MPH, "mph" }
};

View File

@ -1,18 +0,0 @@
#pragma once
#include "gta\VehicleValues.h"
struct vehicle_plate_type {
PlateTextIndexs type;
const char name[16];
};
#define PLATE_TYPE_SIZE 6
vehicle_plate_type vehicle_plate_types[PLATE_TYPE_SIZE] = {
{ PLATE_BLUEONWHITE1, "Blue on White 1" },
{ PLATE_BLUEONWHITE2, "Blue on White 2" },
{ PLATE_BLUEONWHITE3, "Blue on White 3" },
{ PLATE_YELLOWONBLACK, "Yellow on Black" },
{ PLATE_YELLOWONBLUE, "Yellow on Blue" },
{ PLATE_YANKTON, "Yankton" }
};

View File

@ -1,21 +0,0 @@
#pragma once
#include "gta\VehicleValues.h"
struct vehicle_wheel_type {
WheelTypes type;
const char name[16];
};
std::map<int, std::string> vehicle_wheel_types = {
{ WHEEL_TYPE_SPORT, "Sport" },
{ WHEEL_TYPE_MUSCLE, "Muscle" },
{ WHEEL_TYPE_LOWRIDER, "Lowrider" },
{ WHEEL_TYPE_SUV, "SUV" },
{ WHEEL_TYPE_OFFROAD, "Offroad" },
{ WHEEL_TYPE_TUNER, "Tuner" },
{ WHEEL_TYPE_BIKEWHEELS, "Bike Wheels" },
{ WHEEL_TYPE_HIGHEND, "High End" },
{ WHEEL_TYPE_BENNYS_ORIGINAL, "Bennys Original" },
{ WHEEL_TYPE_BENNYS_BESPOKE, "Bennys Bespoke" },
{ WHEEL_TYPE_F1, "F1" }
};

View File

@ -186,13 +186,15 @@ namespace big
LEAVE_ONLINE = -1
};
enum class SpeedoMeter
enum class SpeedUnit : uint32_t
{
DISABLED,
KMH,
MPH
KMPH,
MIPH,
MPS
};
enum class eEntityProofs : uint32_t
{
BULLET = 1 << 4,

View File

@ -213,11 +213,10 @@ namespace big
struct vehicle {
struct speedo_meter {
SpeedoMeter type = SpeedoMeter::DISABLED;
float x = .9f;
float y = .72f;
bool enabled = false;
bool left_side = false;
};
@ -230,6 +229,8 @@ namespace big
float speed = 1;
};
SpeedUnit speed_unit = SpeedUnit::MIPH;
bool god_mode = false;
bool proof_bullet = false;
bool proof_fire = false;
@ -251,7 +252,7 @@ namespace big
bool ls_customs = false; // don't save this to dis
bool seatbelt = false;
bool turn_signals = false;
int auto_drive_speed = 1;
float auto_drive_speed = 1;
int driving_style_flags = 443;
int driving_style_id = 0;
int rainbow_paint = 0;
@ -552,6 +553,7 @@ namespace big
this->spoofing.rockstar_id = j["spoofing"]["rockstar_id"];
this->spoofing.username = j["spoofing"]["username"];
this->vehicle.speed_unit = (SpeedUnit)j["vehicle"]["speed_unit"];
this->vehicle.god_mode = j["vehicle"]["god_mode"];
this->vehicle.proof_bullet = j["vehicle"]["proof_bullet"];
this->vehicle.proof_fire = j["vehicle"]["proof_fire"];
@ -566,7 +568,8 @@ namespace big
this->vehicle.auto_drive_wander = j["vehicle"]["auto_drive_wander"];
this->vehicle.auto_turn_signals = j["vehicle"]["auto_turn_signals"];
this->vehicle.drive_on_water = j["vehicle"]["drive_on_water"];
this->vehicle.driving_style_id = j["vehicle"]["driving_style"];
this->vehicle.driving_style_id = j["vehicle"]["driving_style_id"];
this->vehicle.driving_style_flags = j["vehicle"]["driving_style_flag"];
this->vehicle.horn_boost = j["vehicle"]["horn_boost"];
this->vehicle.vehicle_jump = j["vehicle"]["vehicle_jump"];
this->vehicle.instant_brake = j["vehicle"]["instant_brake"];
@ -575,7 +578,7 @@ namespace big
this->vehicle.seatbelt = j["vehicle"]["seatbelt"];
this->vehicle.turn_signals = j["vehicle"]["turn_signals"];
this->vehicle.speedo_meter.type = (SpeedoMeter)j["vehicle"]["speedo_meter"]["type"];
this->vehicle.speedo_meter.enabled = j["vehicle"]["speedo_meter"]["enabled"];
this->vehicle.speedo_meter.left_side = j["vehicle"]["speedo_meter"]["left_side"];
this->vehicle.speedo_meter.x = j["vehicle"]["speedo_meter"]["position_x"];
this->vehicle.speedo_meter.y = j["vehicle"]["speedo_meter"]["position_y"];
@ -832,6 +835,7 @@ namespace big
},
{
"vehicle", {
{ "speed_unit", this->vehicle.speed_unit },
{ "god_mode", this->vehicle.god_mode },
{ "proof_bullet", this->vehicle.proof_bullet },
{ "proof_fire", this->vehicle.proof_fire },
@ -846,7 +850,8 @@ namespace big
{ "auto_drive_wander", this->vehicle.auto_drive_wander },
{ "auto_turn_signals", this->vehicle.auto_turn_signals },
{ "drive_on_water", this->vehicle.drive_on_water },
{ "driving_style", this->vehicle.driving_style_id },
{ "driving_style_id", this->vehicle.driving_style_id },
{ "driving_style_flag", this->vehicle.driving_style_flags },
{ "horn_boost", this->vehicle.horn_boost },
{ "vehicle_jump", this->vehicle.vehicle_jump },
{ "instant_brake", this->vehicle.instant_brake },
@ -856,7 +861,7 @@ namespace big
{ "seatbelt", this->vehicle.seatbelt },
{
"speedo_meter", {
{ "type", (int)this->vehicle.speedo_meter.type },
{ "enabled", this->vehicle.speedo_meter.enabled },
{ "left_side", this->vehicle.speedo_meter.left_side },
{ "position_x", this->vehicle.speedo_meter.x },
{ "position_y", this->vehicle.speedo_meter.y },

View File

@ -23,7 +23,9 @@ enum WheelTypes
WHEEL_TYPE_HIGHEND,
WHEEL_TYPE_BENNYS_ORIGINAL,
WHEEL_TYPE_BENNYS_BESPOKE,
WHEEL_TYPE_F1
WHEEL_TYPE_OPEN_WHEEL,
WHEEL_TYPE_STREET,
WHEEL_TYPE_TRACK
};
enum VehicleWeapons
@ -382,6 +384,14 @@ enum VehicleModType
MOD_LIVERY
};
enum CustomVehicleModType
{
MOD_WHEEL_TYPE = -101,
MOD_PLATE_STYLE = -102,
MOD_WINDOW_TINT = -103
};
static const char* mod_names[] = { "MOD_SPOILERS", "MOD_FRONTBUMPER", "MOD_REARBUMPER", "MOD_SIDESKIRT", "MOD_EXHAUST", "MOD_FRAME", "MOD_GRILLE", "MOD_HOOD", "MOD_FENDER", "MOD_RIGHTFENDER", "MOD_ROOF", "MOD_ENGINE", "MOD_BRAKES", "MOD_TRANSMISSION", "MOD_HORNS", "MOD_SUSPENSION", "MOD_ARMOR", "", "MOD_TURBO", "", "MOD_TIRESMOKE", "", "MOD_XENONHEADLIGHTS", "MOD_FRONTWHEEL", "MOD_REARWHEEL", "MOD_PLATEHOLDER", "MOD_VANITYPLATES", "MOD_TRIMDESIGN", "MOD_ORNAMENTS", "MOD_DASHBOARD", "MOD_DIALDESIGN", "MOD_DOORSPEAKERS", "MOD_SEATS", "MOD_STEERINGWHEELS", "MOD_COLUMNSHIFTERLEVERS", "MOD_PLAQUES", "MOD_SPEAKERS", "MOD_TRUNK", "MOD_HYDRAULICS", "MOD_ENGINEBLOCK", "MOD_AIRFILTER", "MOD_STRUTS", "MOD_ARCHCOVER", "MOD_AERIALS", "MOD_TRIM", "MOD_TANK", "MOD_WINDOWS", "", "MOD_LIVERY" };
enum VehicleModHorns
@ -603,6 +613,24 @@ enum WindowTints //m8 do you even int tint?
WINDOWTINT_GREEN
};
enum HeadlightColors
{
XENON_DEFAULT = -1,
XENON_WHITE,
XENON_BLUE,
XENON_ELECTRIC_BLUE,
XENON_MINT_GREEN,
XENON_LIME_GREEN,
XENON_YELLOW,
XENON_GOLDEN_SHOWER,
XENON_ORANGE,
XENON_RED,
XENON_PONY_PINK,
XENON_HOT_PINK,
XENON_PURPLE,
XENON_BACKLIGHT
};
#define NEON_COLOR_WHITE 222, 222, 255
#define NEON_COLOR_BLUE 2, 21, 255
#define NEON_COLOR_ELECTRICBLUE 3, 83, 255

View File

@ -40,21 +40,33 @@ namespace big
}
vehicle_preview_service::vehicle_preview_service() :
m_vehicle_file(g_file_manager->get_project_file("./lib/vehicles.json"))
m_vehicle_file(g_file_manager->get_project_file("./lib/vehicles.json")),
m_vehicle_file_etag(g_file_manager->get_project_file("./lib/vehicles_etag.txt"))
{
if (m_vehicle_file.exists())
this->load();
else
{
g_thread_pool->push([this]()
{
if (remote::download_binary("http://github-proxy.damon.sh/DurtyFree/gta-v-data-dumps/master/vehicles.json", m_vehicle_file.get_path()))
this->load();
else
LOG(WARNING) << "Failed to download vehicles.json data...";
});
this->load();
LOG(INFO) << "Vehicle data loaded.";
}
g_thread_pool->push([this]() {
bool ret = remote::update_binary(
"http://github-proxy.damon.sh/DurtyFree/gta-v-data-dumps/master/vehicles.json",
m_vehicle_file.get_path(),
m_vehicle_file_etag.get_path()
);
if (ret)
{
this->load();
LOG(INFO) << "Vehicle data updated.";
}
else if (!m_vehicle_file.exists())
{
LOG(WARNING) << "Failed to download vehicles.json data...";
}
});
g_vehicle_preview_service = this;
}

View File

@ -18,6 +18,7 @@ namespace big
class vehicle_preview_service
{
file m_vehicle_file;
file m_vehicle_file_etag;
std::condition_variable m_cond;
std::mutex m_mutex;

View File

@ -18,6 +18,36 @@ namespace big::vehicle
*script_global(2671447).at(8).as<int*>() = 1;
}
inline float mps_to_speed(float mps, SpeedUnit speed_unit)
{
switch (speed_unit)
{
case SpeedUnit::KMPH:
return mps * 3.6f;
break;
case SpeedUnit::MIPH:
return mps * 2.2369f;
break;
}
return mps;
}
inline float speed_to_mps(float speed, SpeedUnit speed_unit)
{
switch (speed_unit)
{
case SpeedUnit::KMPH:
return speed / 3.6f;
break;
case SpeedUnit::MIPH:
return speed / 2.2369f;
break;
}
return speed;
}
inline void bring(Vehicle veh, Vector3 location, bool put_in = true, int seatIdx = -1)
{
if (!ENTITY::IS_ENTITY_A_VEHICLE(veh)) return g_notification_service->push_error("Vehicle", "Invalid handle");
@ -184,6 +214,7 @@ namespace big::vehicle
}
// permission fix
*spawn_global.at(27).at(1).as<int32_t*>() = 0;
*spawn_global.at(27).at(19).as<int32_t*>() = -1;
*spawn_global.at(27).at(60).as<int32_t*>() = 1;
*spawn_global.at(27).at(77).as<int32_t*>() = 4030726305;

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
#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"
#include "core/data/speed_units.hpp"
namespace big
{
@ -23,7 +23,7 @@ namespace big
ImGui::Separator();
components::button("Teleport to PV", [] {
components::button("Teleport in PV", [] {
Vehicle veh = globals::get_personal_vehicle();
teleport::into_vehicle(veh);
});
@ -125,29 +125,33 @@ namespace big
ImGui::Separator();
components::small_text("Speed Unit");
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::KMPH].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::KMPH
);
ImGui::SameLine();
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::MIPH].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::MIPH
);
ImGui::SameLine();
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::MPS].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::MPS
);
ImGui::Separator();
components::small_text("Speedo Meter");
SpeedoMeter* speed_meter_type_ptr = &g->vehicle.speedo_meter.type;
ImGui::Checkbox("Enabled", &g->vehicle.speedo_meter.enabled);
if (ImGui::BeginCombo("Format", speedo_meters[(int)*speed_meter_type_ptr].name))
{
for (const auto& speedo : speedo_meters)
{
if (ImGui::Selectable(speedo.name, speedo.id == *speed_meter_type_ptr))
{
*speed_meter_type_ptr = speedo.id;
}
if (speedo.id == *speed_meter_type_ptr)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
if (*speed_meter_type_ptr != SpeedoMeter::DISABLED)
if (g->vehicle.speedo_meter.enabled)
{
ImGui::Text("Position (X, Y)");
@ -164,7 +168,6 @@ namespace big
ImGui::Checkbox("Left Sided", &g->vehicle.speedo_meter.left_side);
}
g->vehicle.proof_mask = 0;
if (g->vehicle.god_mode)
{

View File

@ -1,10 +1,10 @@
#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"
#include "core/data/speed_units.hpp"
namespace big
{
@ -28,7 +28,16 @@ namespace big
TASK::CLEAR_PED_TASKS(self::ped);
});
ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200);
float auto_drive_speed_user_unit = vehicle::mps_to_speed(g->vehicle.auto_drive_speed, g->vehicle.speed_unit);
if (ImGui::SliderFloat(
fmt::format("Top Speed({})", speed_unit_strings[(int)g->vehicle.speed_unit]).c_str(),
&auto_drive_speed_user_unit,
vehicle::mps_to_speed(0.f, g->vehicle.speed_unit),
vehicle::mps_to_speed(150.f, g->vehicle.speed_unit),
"%.1f"
)) {
g->vehicle.auto_drive_speed = vehicle::speed_to_mps(auto_drive_speed_user_unit, g->vehicle.speed_unit);
}
if (ImGui::BeginCombo("Driving Style", vehicle::driving_style_names[g->vehicle.driving_style_id]))
{
@ -37,6 +46,7 @@ namespace big
if (ImGui::Selectable(vehicle::driving_style_names[i], g->vehicle.driving_style_id == i))
{
g->vehicle.driving_style_id = i;
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[i]));
}
@ -98,6 +108,15 @@ namespace big
ImGui::EndGroup();
ImGui::SliderFloat("Speed", &g->vehicle.fly.speed, 1.f, 100.f, "%.0f", 1);
float fly_speed_user_unit = vehicle::mps_to_speed(g->vehicle.fly.speed, g->vehicle.speed_unit);
if (ImGui::SliderFloat(
fmt::format("Speed({})", speed_unit_strings[(int)g->vehicle.speed_unit]).c_str(),
&fly_speed_user_unit,
vehicle::mps_to_speed(0.f, g->vehicle.speed_unit),
vehicle::mps_to_speed(150.f, g->vehicle.speed_unit),
"%.1f"
)) {
g->vehicle.fly.speed = vehicle::speed_to_mps(fly_speed_user_unit, g->vehicle.speed_unit);
}
}
}