diff --git a/src/backend/backend.cpp b/src/backend/backend.cpp index 0b0ec542..c172217f 100644 --- a/src/backend/backend.cpp +++ b/src/backend/backend.cpp @@ -35,6 +35,7 @@ namespace big looped::system_desync_kick_protection(); looped::system_spoofing(); looped::system_mission_creator(); + looped::system_rainbow(); for (auto command : g_looped_commands) if (command->is_enabled()) @@ -64,6 +65,8 @@ namespace big while (g_running) { + looped::weapons_tp_gun(); + looped::weapons_paint_gun(); looped::weapons_ammo_special_type(); looped::weapons_cage_gun(); looped::weapons_delete_gun(); diff --git a/src/backend/looped/looped.hpp b/src/backend/looped/looped.hpp index 4dd72704..9e0657ee 100644 --- a/src/backend/looped/looped.hpp +++ b/src/backend/looped/looped.hpp @@ -39,12 +39,14 @@ namespace big static void system_desync_kick_protection(); static void system_spoofing(); static void system_mission_creator(); + static void system_rainbow(); static void vehicle_auto_drive(); static void vehicle_boost_behavior(); static void vehicle_ls_customs(); static void vehicle_rainbow_paint(); + static void weapons_tp_gun(); static void weapons_ammo_special_type(); static void weapons_cage_gun(); static void custom_gun_disable_control_action(); @@ -56,6 +58,7 @@ namespace big static void weapons_c4_limit(); static void weapons_do_persist_weapons(); static void weapons_do_weapon_hotkeys(); + static void weapons_paint_gun(); static void drive_train(); static void derail_train(); diff --git a/src/backend/looped/system/rgb.cpp b/src/backend/looped/system/rgb.cpp new file mode 100644 index 00000000..9ad0f387 --- /dev/null +++ b/src/backend/looped/system/rgb.cpp @@ -0,0 +1,101 @@ +#include "backend/looped/looped.hpp" +#include "core/data/color.hpp" + +namespace big +{ + void looped::system_rainbow() + { + static std::chrono::system_clock::time_point last_rgb_run_time; + static std::chrono::milliseconds delay = 0s; + + enum rgb_controller_t + { + rgb_controller_green_up, + rgb_controller_red_down, + rgb_controller_blue_up, + rgb_controller_green_down, + rgb_controller_red_up, + rgb_controller_blue_down, + }; + + + if (last_rgb_run_time + delay < std::chrono::system_clock::now()) + { + int delay_step = 100; + if (g.settings.rainbow.spasm) + { + rgb.red = rand() % 256; + rgb.green = rand() % 256; + rgb.blue = rand() % 256; + } + else if (g.settings.rainbow.fade) + { + int delay_step = 10; + + static int rgb_controller_v = rgb_controller_green_up; + + switch (rgb_controller_v) + { + case rgb_controller_green_up: + rgb.green += 5; + if (rgb.green >= 255) + { + rgb.green = 255; + rgb_controller_v = rgb_controller_red_down; + } + break; + + case rgb_controller_red_down: + rgb.red -= 5; + if (rgb.red < 0) + { + rgb.red = 0; + rgb_controller_v = rgb_controller_blue_up; + } + break; + + case rgb_controller_blue_up: + rgb.blue += 5; + if (rgb.blue >= 255) + { + rgb.blue = 255; + rgb_controller_v = rgb_controller_green_down; + } + break; + + case rgb_controller_green_down: + rgb.green -= 5; + if (rgb.green < 0) + { + rgb.green = 0; + rgb_controller_v = rgb_controller_red_up; + } + break; + + case rgb_controller_red_up: + rgb.red += 5; + if (rgb.red >= 255) + { + rgb.red = 255; + rgb_controller_v = rgb_controller_blue_down; + } + break; + + case rgb_controller_blue_down: + rgb.blue -= 5; + if (rgb.blue < 0) + { + rgb.blue = 0; + rgb_controller_v = rgb_controller_green_up; + } + break; + + default: break; + } + } + + delay = std::chrono::milliseconds(((delay_step * 10) + 10) - (g.settings.rainbow.speed * delay_step)); + last_rgb_run_time = std::chrono::system_clock::now(); + } + } +} \ No newline at end of file diff --git a/src/backend/looped/vehicle/rgb_paint.cpp b/src/backend/looped/vehicle/rgb_paint.cpp index bdf269dd..ce20a15c 100644 --- a/src/backend/looped/vehicle/rgb_paint.cpp +++ b/src/backend/looped/vehicle/rgb_paint.cpp @@ -3,25 +3,14 @@ #include "backend/looped/looped.hpp" #include "natives.hpp" #include "script.hpp" +#include "core/data/color.hpp" namespace big { - enum rgb_controller_t - { - rgb_controller_green_up, - rgb_controller_red_down, - rgb_controller_blue_up, - rgb_controller_green_down, - rgb_controller_red_up, - rgb_controller_blue_down, - }; - - std::chrono::system_clock::time_point last_rgb_run_time; - std::chrono::milliseconds delay = 0s; - void looped::vehicle_rainbow_paint() { - static int rgb_controller_v = rgb_controller_green_up; + static std::chrono::system_clock::time_point last_rgb_run_time; + static std::chrono::milliseconds delay = 0s; static int red = 255; static int green = 0; @@ -39,90 +28,30 @@ namespace big } else if (g.vehicle.rainbow_paint.type == RainbowPaintType::Fade) { - delay_step = 10; - - switch (rgb_controller_v) - { - case rgb_controller_green_up: - green += 5; - if (green >= 255) - { - green = 255; - rgb_controller_v = rgb_controller_red_down; - } - break; - - case rgb_controller_red_down: - red -= 5; - if (red < 0) - { - red = 0; - rgb_controller_v = rgb_controller_blue_up; - } - break; - - case rgb_controller_blue_up: - blue += 5; - if (blue >= 255) - { - blue = 255; - rgb_controller_v = rgb_controller_green_down; - } - break; - - case rgb_controller_green_down: - green -= 5; - if (green < 0) - { - green = 0; - rgb_controller_v = rgb_controller_red_up; - } - break; - - case rgb_controller_red_up: - red += 5; - if (red >= 255) - { - red = 255; - rgb_controller_v = rgb_controller_blue_down; - } - break; - - case rgb_controller_blue_down: - blue -= 5; - if (blue < 0) - { - blue = 0; - rgb_controller_v = rgb_controller_green_up; - } - break; - - default: break; - } + red = rgb.red; + blue = rgb.blue; + green = rgb.green; } - - Vehicle vehicle = self::veh; - if (g.vehicle.rainbow_paint.primary) { - VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(vehicle, red, green, blue); + VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(self::veh, red, green, blue); } if (g.vehicle.rainbow_paint.secondary) { - VEHICLE::SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(vehicle, red, green, blue); + VEHICLE::SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(self::veh, red, green, blue); } if (g.vehicle.rainbow_paint.neon) { - VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 0, 1); - VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 1, 1); - VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 2, 1); - VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 3, 1); - VEHICLE::SET_VEHICLE_NEON_COLOUR(vehicle, red, green, blue); + VEHICLE::SET_VEHICLE_NEON_ENABLED(self::veh, 0, 1); + VEHICLE::SET_VEHICLE_NEON_ENABLED(self::veh, 1, 1); + VEHICLE::SET_VEHICLE_NEON_ENABLED(self::veh, 2, 1); + VEHICLE::SET_VEHICLE_NEON_ENABLED(self::veh, 3, 1); + VEHICLE::SET_VEHICLE_NEON_COLOUR(self::veh, red, green, blue); } if (g.vehicle.rainbow_paint.smoke) { - VEHICLE::SET_VEHICLE_TYRE_SMOKE_COLOR(vehicle, red, green, blue); + VEHICLE::SET_VEHICLE_TYRE_SMOKE_COLOR(self::veh, red, green, blue); } delay = std::chrono::milliseconds(((delay_step * 10) + 10) - (g.vehicle.rainbow_paint.speed * delay_step)); diff --git a/src/backend/looped/weapons/cage_gun.cpp b/src/backend/looped/weapons/cage_gun.cpp index a1382b3b..b4e45133 100644 --- a/src/backend/looped/weapons/cage_gun.cpp +++ b/src/backend/looped/weapons/cage_gun.cpp @@ -28,5 +28,4 @@ namespace big } } } - } diff --git a/src/backend/looped/weapons/paintgun.cpp b/src/backend/looped/weapons/paintgun.cpp new file mode 100644 index 00000000..187d44ef --- /dev/null +++ b/src/backend/looped/weapons/paintgun.cpp @@ -0,0 +1,50 @@ +#include "backend/looped/looped.hpp" +#include "core/enums.hpp" +#include "gta/enums.hpp" +#include "util/entity.hpp" +#include "core/data/color.hpp" + +namespace big +{ + void looped::weapons_paint_gun() + { + if (g.weapons.paintgun.rainbow) + { + g.weapons.paintgun.col[0] = rgb.red; + g.weapons.paintgun.col[1] = rgb.green; + g.weapons.paintgun.col[2] = rgb.blue; + } + + if (g.weapons.custom_weapon == CustomWeapon::PAINT_GUN && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2))) + { + Vector3 c; entity::raycast(&c); + + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM)) + { + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK)) + { + GRAPHICS::ADD_DECAL((int)DecalTypes::splatters_paint, + c.x, + c.y, + c.z, + 0, //true + 0, //true + -1, //true + 0, + 1.f, + 0.f, // always 0 + 0.5f, //size x + 0.4f, //size y + g.weapons.paintgun.col[0], + g.weapons.paintgun.col[1], + g.weapons.paintgun.col[2], + g.weapons.paintgun.col[3], + -1, + true, + false, + false); + } + } + } + } +} \ No newline at end of file diff --git a/src/backend/looped/weapons/tpgun.cpp b/src/backend/looped/weapons/tpgun.cpp new file mode 100644 index 00000000..bd9feef2 --- /dev/null +++ b/src/backend/looped/weapons/tpgun.cpp @@ -0,0 +1,23 @@ +#include "backend/looped/looped.hpp" +#include "core/enums.hpp" +#include "gta/enums.hpp" +#include "util/entity.hpp" + +namespace big +{ + void looped::weapons_tp_gun() + { + if (g.weapons.custom_weapon == CustomWeapon::TP_GUN && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2))) + { + Vector3 c; entity::raycast(&c); + + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM)) + { + if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK)) + { + ENTITY::SET_ENTITY_COORDS(self::ped, c.x, c.y, c.z, 0, 0, 0, 0); + } + } + } + } +} \ No newline at end of file diff --git a/src/core/data/color.hpp b/src/core/data/color.hpp new file mode 100644 index 00000000..83f29dbe --- /dev/null +++ b/src/core/data/color.hpp @@ -0,0 +1,10 @@ +namespace big +{ + inline class rgb + { + public: + float red = 255.f; + float green = 0; + float blue = 0; + } rgb{}; +} \ No newline at end of file diff --git a/src/core/data/custom_weapons.hpp b/src/core/data/custom_weapons.hpp index 7b65dd86..321e3655 100644 --- a/src/core/data/custom_weapons.hpp +++ b/src/core/data/custom_weapons.hpp @@ -15,4 +15,6 @@ const custom_weapon custom_weapons[] = { {big::CustomWeapon::STEAL_VEHICLE_GUN, "Steal Vehicle Gun"}, {big::CustomWeapon::REPAIR_GUN, "Repair Gun"}, {big::CustomWeapon::VEHICLE_GUN, "Vehicle Gun"}, + {big::CustomWeapon::TP_GUN, "Tp Gun"}, + {big::CustomWeapon::PAINT_GUN, "Paint Gun"}, }; \ No newline at end of file diff --git a/src/core/enums.hpp b/src/core/enums.hpp index bf6b1401..3e6eee75 100644 --- a/src/core/enums.hpp +++ b/src/core/enums.hpp @@ -19,7 +19,9 @@ namespace big GRAVITY_GUN, STEAL_VEHICLE_GUN, REPAIR_GUN, - VEHICLE_GUN + VEHICLE_GUN, + TP_GUN, + PAINT_GUN }; NLOHMANN_JSON_SERIALIZE_ENUM(CustomWeapon, { @@ -30,6 +32,8 @@ namespace big {CustomWeapon::STEAL_VEHICLE_GUN, "steal"}, {CustomWeapon::REPAIR_GUN, "repair"}, {CustomWeapon::VEHICLE_GUN, "vehicle"}, + {CustomWeapon::TP_GUN, "tp"}, + {CustomWeapon::PAINT_GUN, "paint"}, }) enum class ContextEntityType : uint8_t diff --git a/src/core/settings.hpp b/src/core/settings.hpp index f49024dc..19d82d62 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -408,6 +408,15 @@ namespace big struct settings { + bool dev_dlc = false; + + struct rainbow + { + bool fade = false; + bool spasm = false; + int speed = 1; + } rainbow{}; + struct hotkeys { bool editing_menu_toggle = false; @@ -439,8 +448,6 @@ namespace big NLOHMANN_DEFINE_TYPE_INTRUSIVE(hotkeys, editing_menu_toggle, menu_toggle, teleport_waypoint, teleport_objective, teleport_pv, noclip, vehicle_flymode, bringvehicle, invis, heal, fill_inventory, skip_cutscene, freecam, superrun, superjump, beastjump, invisveh, localinvisveh, fill_ammo, fast_quit, cmd_excecutor, repairpv, open_vehicle_controller, clear_wanted, random_ped_components) } hotkeys{}; - bool dev_dlc = false; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(settings, hotkeys, dev_dlc) } settings{}; @@ -704,7 +711,14 @@ namespace big { bool launch_on_release = false; NLOHMANN_DEFINE_TYPE_INTRUSIVE(gravity_gun, launch_on_release) - } gravity_gun; + } gravity_gun{}; + + struct paintgun + { + bool rainbow = false; + float col[4] = {0.f, 0.f, 1.f, 1.f}; + NLOHMANN_DEFINE_TYPE_INTRUSIVE(paintgun, rainbow, col) + } paintgun{}; struct aimbot { @@ -739,7 +753,7 @@ namespace big bool enable_weapon_hotkeys = false; std::map> weapon_hotkeys{}; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapons, ammo_special, custom_weapon, aimbot, infinite_ammo, always_full_ammo, infinite_mag, increased_damage, increase_damage, no_recoil, no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun, interior_weapon, triggerbot, infinite_range, enable_weapon_hotkeys, weapon_hotkeys) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapons, ammo_special, custom_weapon, aimbot, infinite_ammo, always_full_ammo, infinite_mag, increased_damage, increase_damage, no_recoil, no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun, paintgun, interior_weapon, triggerbot, infinite_range, enable_weapon_hotkeys, weapon_hotkeys) } weapons{}; struct window diff --git a/src/gta/enums.hpp b/src/gta/enums.hpp index b59e1517..69e940ea 100644 --- a/src/gta/enums.hpp +++ b/src/gta/enums.hpp @@ -1474,6 +1474,62 @@ enum class eVehicleLockState VEHICLELOCK_CANNOT_ENTER }; +enum class DecalTypes +{ + splatters_blood = 1010, + splatters_blood_dir = 1015, + splatters_blood_mist = 1017, + splatters_mud = 1020, + splatters_paint = 1030, + splatters_water = 1040, + splatters_water_hydrant = 1050, + splatters_blood2 = 1110, + weapImpact_metal = 4010, + weapImpact_concrete = 4020, + weapImpact_mattress = 4030, + weapImpact_mud = 4032, + weapImpact_wood = 4050, + weapImpact_sand = 4053, + weapImpact_cardboard = 4040, + weapImpact_melee_glass = 4100, + weapImpact_glass_blood = 4102, + weapImpact_glass_blood2 = 4104, + weapImpact_shotgun_paper = 4200, + weapImpact_shotgun_mattress, + weapImpact_shotgun_metal, + weapImpact_shotgun_wood, + weapImpact_shotgun_dirt, + weapImpact_shotgun_tvscreen, + weapImpact_shotgun_tvscreen2, + weapImpact_shotgun_tvscreen3, + weapImpact_melee_concrete = 4310, + weapImpact_melee_wood = 4312, + weapImpact_melee_metal = 4314, + burn1 = 4421, + burn2, + burn3, + burn4, + burn5, + bang_concrete_bang = 5000, + bang_concrete_bang2, + bang_bullet_bang, + bang_bullet_bang2 = 5004, + bang_glass = 5031, + bang_glass2, + solidPool_water = 9000, + solidPool_blood, + solidPool_oil, + solidPool_petrol, + solidPool_mud, + porousPool_water, + porousPool_blood, + porousPool_oil, + porousPool_petrol, + porousPool_mud, + porousPool_water_ped_drip, + liquidTrail_water = 9050 +}; + enum class eTaskTypeIndex { CTaskHandsUp = 0, diff --git a/src/util/entity.hpp b/src/util/entity.hpp index 6cb96d49..e9e5f772 100644 --- a/src/util/entity.hpp +++ b/src/util/entity.hpp @@ -69,6 +69,34 @@ namespace big::entity return (bool)hit; } + inline bool raycast(Vector3* endcoor) + { + Entity ent; + BOOL hit; + Vector3 surfaceNormal; + + Vector3 camCoords = CAM::GET_GAMEPLAY_CAM_COORD(); + Vector3 dir = math::rotation_to_direction(CAM::GET_GAMEPLAY_CAM_ROT(2)); + Vector3 farCoords; + + farCoords.x = camCoords.x + dir.x * 1000; + farCoords.y = camCoords.y + dir.y * 1000; + farCoords.z = camCoords.z + dir.z * 1000; + + int ray = SHAPETEST::START_EXPENSIVE_SYNCHRONOUS_SHAPE_TEST_LOS_PROBE(camCoords.x, + camCoords.y, + camCoords.z, + farCoords.x, + farCoords.y, + farCoords.z, + -1, + 0, + 7); + SHAPETEST::GET_SHAPE_TEST_RESULT(ray, &hit, endcoor, &surfaceNormal, &ent); + + return (bool)hit; + } + inline bool network_has_control_of_entity(rage::netObject* net_object) { return !net_object || !net_object->m_next_owner_id && (net_object->m_control_id == -1); diff --git a/src/views/self/view_weapons.cpp b/src/views/self/view_weapons.cpp index 6e8a5b8e..e55166b1 100644 --- a/src/views/self/view_weapons.cpp +++ b/src/views/self/view_weapons.cpp @@ -148,6 +148,9 @@ namespace big } break; + case CustomWeapon::PAINT_GUN: + ImGui::Checkbox("Rainbow Color", &g.weapons.paintgun.rainbow); + if (!g.weapons.paintgun.rainbow) { ImGui::ColorEdit4("Paint Gun Color", g.weapons.paintgun.col); } } ImGui::SeparatorText("Aim Assistance"); @@ -216,12 +219,12 @@ namespace big ImGui::PushItemWidth(250); if (ImGui::BeginCombo("Attachments", selected_weapon_attachment.c_str())) { - auto weapon = g_gta_data_service->weapon_by_hash(selected_weapon_hash); + weapon_item weapon = g_gta_data_service->weapon_by_hash(selected_weapon_hash); if (!weapon.m_attachments.empty()) { for (std::string attachment : weapon.m_attachments) { - auto attachment_component = g_gta_data_service->weapon_component_by_name(attachment); + weapon_component attachment_component = g_gta_data_service->weapon_component_by_name(attachment); std::string attachment_name = attachment_component.m_display_name; Hash attachment_hash = attachment_component.m_hash; if (attachment_hash == NULL) @@ -280,7 +283,7 @@ namespace big ImGui::PushItemWidth(250); if (ImGui::BeginListBox("Saved Loadouts", ImVec2(200, 200))) { - for (auto filename : persist_weapons::list_weapon_loadouts()) + for (std::string filename : persist_weapons::list_weapon_loadouts()) { if (components::selectable(filename, filename == selected_loadout)) { @@ -330,7 +333,7 @@ namespace big for (auto& weapon_hash : g.weapons.weapon_hotkeys[selected_key]) { ImGui::PushID(counter); - auto weapon = g_gta_data_service->weapon_by_hash(weapon_hash); + weapon_item weapon = g_gta_data_service->weapon_by_hash(weapon_hash); ImGui::PushItemWidth(300); if (ImGui::BeginCombo("Weapons", weapon.m_display_name.c_str())) {