From 2033288b11035dc5da64103897ac7c69a77d49da Mon Sep 17 00:00:00 2001 From: thehorizon84 <149878244+thehorizon84@users.noreply.github.com> Date: Fri, 8 Dec 2023 14:13:06 +0100 Subject: [PATCH] feat: Unlock Interaction Menu, Weapon Explosion Radius Modifier & improve fast respawn(#2489) --- src/backend/looped/self/fast_respawn.cpp | 25 ++++++++------ .../looped/self/interaction_menu_freedom.cpp | 17 ++++++++++ .../weapons/modify_explosion_radius.cpp | 34 +++++++++++++++++++ src/core/scr_globals.hpp | 4 +++ src/core/settings.hpp | 7 ++-- src/views/self/view_self.cpp | 1 + src/views/self/view_weapons.cpp | 3 ++ 7 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 src/backend/looped/self/interaction_menu_freedom.cpp create mode 100644 src/backend/looped/weapons/modify_explosion_radius.cpp diff --git a/src/backend/looped/self/fast_respawn.cpp b/src/backend/looped/self/fast_respawn.cpp index 9593ac00..cd912063 100644 --- a/src/backend/looped/self/fast_respawn.cpp +++ b/src/backend/looped/self/fast_respawn.cpp @@ -1,8 +1,7 @@ #include "backend/looped/looped.hpp" #include "backend/looped_command.hpp" -#include "fiber_pool.hpp" -#include "gta/enums.hpp" -#include "natives.hpp" +#include "util/misc.hpp" +#include "core/scr_globals.hpp" namespace big { @@ -12,14 +11,18 @@ namespace big virtual void on_tick() override { - if (PED::IS_PED_DEAD_OR_DYING(self::ped, true)) - { - PED::RESURRECT_PED(self::ped); - ENTITY::SET_ENTITY_COORDS_NO_OFFSET(self::ped, self::pos.x, self::pos.y, self::pos.z, 0, 0, 0); - TASK::CLEAR_PED_TASKS_IMMEDIATELY(self::ped); - MISC::FORCE_GAME_STATE_PLAYING(); - MISC::TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME("respawn_controller"); - } + // disable wasted sound cause it's annoying + *scr_globals::disable_wasted_sound.as() = true; + + // triggers respawn instantly upon death, has no effect if not respawning so no need to check if the player's dead + misc::set_bit(&(*scr_globals::freemode_properties.at(1685).at(756).as()), 1); // Update: freemode -> KILL_STRIP_H -> Above that = "!IS_BIT_SET(global, 2)" + } + + virtual void on_disable() override + { + *scr_globals::disable_wasted_sound.as() = false; + + misc::clear_bit(&(*scr_globals::freemode_properties.at(1685).at(756).as()), 1); } }; diff --git a/src/backend/looped/self/interaction_menu_freedom.cpp b/src/backend/looped/self/interaction_menu_freedom.cpp new file mode 100644 index 00000000..06957be3 --- /dev/null +++ b/src/backend/looped/self/interaction_menu_freedom.cpp @@ -0,0 +1,17 @@ +#include "backend/looped_command.hpp" +#include "core/scr_globals.hpp" + +namespace big +{ + class interaction_menu_freedom : looped_command + { + using looped_command::looped_command; + + virtual void on_tick() override + { + *scr_globals::interaction_menu_access.as() = 1; // sets itself to the original value every frame while you're in the interaction menu, so no need for a reset + } + }; + + interaction_menu_freedom g_interaction_menu_freedom("interactionmenufreedom", "INTERACTION_MENU_FREEDOM", "INTERACTION_MENU_FREEDOM_DESC", g.self.interaction_menu_freedom); +} \ No newline at end of file diff --git a/src/backend/looped/weapons/modify_explosion_radius.cpp b/src/backend/looped/weapons/modify_explosion_radius.cpp new file mode 100644 index 00000000..d953135e --- /dev/null +++ b/src/backend/looped/weapons/modify_explosion_radius.cpp @@ -0,0 +1,34 @@ +#include "backend/looped_command.hpp" +#include "natives.hpp" + +namespace big +{ + class modify_explosion_radius : looped_command + { + using looped_command::looped_command; + + Hash ped_weapon; + + virtual void on_tick() override + { + Hash weapon{}; + WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon, 0); + + if (weapon != ped_weapon) + { + WEAPON::SET_WEAPON_AOE_MODIFIER(weapon, 1); + ped_weapon = weapon; + } + + WEAPON::SET_WEAPON_AOE_MODIFIER(weapon, g.weapons.set_explosion_radius); + } + virtual void on_disable() override + { + Hash weapon{}; + WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon, 0); + WEAPON::SET_WEAPON_AOE_MODIFIER(weapon, 1); + } + }; + + modify_explosion_radius g_modify_explosion_radius("modifyexplosionradius", "BACKEND_LOOPED_WEAPONS_MODIFY_EXPLOSION_RADIUS", "BACKEND_LOOPED_WEAPONS_MODIFY_EXPLOSION_RADIUS_DESC", g.weapons.modify_explosion_radius); +} diff --git a/src/core/scr_globals.hpp b/src/core/scr_globals.hpp index 8759752c..d09c7728 100644 --- a/src/core/scr_globals.hpp +++ b/src/core/scr_globals.hpp @@ -56,6 +56,10 @@ namespace big::scr_globals static inline const script_global gun_van(1956855); + static inline const script_global interaction_menu_access(2766623); // am_pi_menu -> PI_BIK_13_2_H -> global = true; + + static inline const script_global disable_wasted_sound(2764735); // freemode -> AUDIO::PLAY_SOUND_FRONTEND(-1, "Wasted", "POWER_PLAY_General_Soundset", true); + static inline const script_global passive(1574582); static inline const script_global property_garage(1945123); diff --git a/src/core/settings.hpp b/src/core/settings.hpp index 7fbe2bda..99c2f904 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -348,6 +348,7 @@ namespace big bool prompt_ambient_animations = false; std::string persist_outfit = ""; bool persist_outfits_mis = false; + bool interaction_menu_freedom = false; struct hud { @@ -383,7 +384,7 @@ namespace big NLOHMANN_DEFINE_TYPE_INTRUSIVE(super_hero_fly, gradual, explosions, auto_land, charge, ptfx, fly_speed, initial_launch) } super_hero_fly{}; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(self, ipls, ptfx_effects, clean_player, force_wanted_level, passive, free_cam, invisibility, local_visibility, never_wanted, no_ragdoll, noclip, noclip_aim_speed_multiplier, noclip_speed_multiplier, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water, proof_mask, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, healthregen, healthregenrate, hud, superman, custom_weapon_stop, prompt_ambient_animations, persist_outfit, persist_outfits_mis, super_hero_fly) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(self, ipls, ptfx_effects, clean_player, force_wanted_level, passive, free_cam, invisibility, local_visibility, never_wanted, no_ragdoll, noclip, noclip_aim_speed_multiplier, noclip_speed_multiplier, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water, proof_mask, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, healthregen, healthregenrate, hud, superman, custom_weapon_stop, prompt_ambient_animations, persist_outfit, persist_outfits_mis, interaction_menu_freedom, super_hero_fly) } self{}; struct session @@ -860,6 +861,8 @@ namespace big bool infinite_mag = false; float increased_damage = 1; bool increase_damage = false; + float set_explosion_radius = 1.f; + bool modify_explosion_radius = false; bool no_recoil = false; bool no_spread = false; std::string vehicle_gun_model = "bus"; @@ -872,7 +875,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, paintgun, 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, set_explosion_radius, modify_explosion_radius, 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/views/self/view_self.cpp b/src/views/self/view_self.cpp index 1baae19d..15fd0eb0 100644 --- a/src/views/self/view_self.cpp +++ b/src/views/self/view_self.cpp @@ -69,6 +69,7 @@ namespace big components::command_checkbox<"noragdoll">(); components::command_checkbox<"fastrun">(); components::command_checkbox<"noidlekick">(); + components::command_checkbox<"interactionmenufreedom">(); components::command_checkbox<"walkunder">(); if (!g.self.super_jump) components::command_checkbox<"beastjump">(); diff --git a/src/views/self/view_weapons.cpp b/src/views/self/view_weapons.cpp index 51e8c767..695d3093 100644 --- a/src/views/self/view_weapons.cpp +++ b/src/views/self/view_weapons.cpp @@ -121,6 +121,9 @@ namespace big components::command_checkbox<"incrdamage">(); ImGui::InputFloat("VIEW_WEAPON_DAMAGE"_T.data(), &g.weapons.increased_damage, .1, 10, "%.1f"); + components::command_checkbox<"modifyexplosionradius">(); + ImGui::InputFloat("VIEW_WEAPON_EXPLOSION_RADIUS"_T.data(), &g.weapons.set_explosion_radius, .1, 200, "%.1f"); + ImGui::SeparatorText("CUSTOM_WEAPONS"_T.data()); ImGui::Checkbox("VIEW_WEAPON_CUSTOM_GUN_ONLY_FIRES_WHEN_THE_WEAPON_IS_OUT"_T.data(), &g.self.custom_weapon_stop);