Fixed Weapon Hotkeys and introduced Hold For Boost to Boost. (#1692)

* Fixed #1690.

* Added Hold For Boost to Boost Behavior.

* Added Teleport into Personal Vehicle and Toggle Vehicle Fly Mode as hotkeys.

* Fixed pvtp command not working if you were inside a building.
This commit is contained in:
gir489 2023-07-12 12:55:53 -04:00 committed by GitHub
parent 5162cf98c7
commit 3b7c103873
8 changed files with 34 additions and 15 deletions

View File

@ -11,11 +11,8 @@ namespace big
virtual void execute(const std::vector<std::uint64_t>&, const std::shared_ptr<command_context> ctx)
{
if (g_local_player && g_local_player->m_vehicle)
{
Vehicle veh = mobile::mechanic::get_personal_vehicle();
teleport::into_vehicle(veh);
}
Vehicle veh = mobile::mechanic::get_personal_vehicle();
teleport::into_vehicle(veh);
}
};

View File

@ -1,5 +1,6 @@
#include "backend/looped/looped.hpp"
#include "core/enums.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
namespace big
@ -20,6 +21,18 @@ namespace big
vehicle->m_boost_allow_recharge = true;
vehicle->m_boost = 3.f;
}
else if (g.vehicle.boost_behavior == eBoostBehaviors::HOLD_FOR_INFINITE)
{
if (vehicle->m_boost_state && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ROCKET_BOOST))
{
vehicle->m_boost_allow_recharge = true;
vehicle->m_boost = 3.f;
}
else if (vehicle->m_boost_state)
{
vehicle->m_boost_state = false;
}
}
}
}
}

View File

@ -6,7 +6,7 @@
namespace big
{
const int input_array[6] = {(int)ControllerInputs::INPUT_SELECT_WEAPON_UNARMED, (int)ControllerInputs::INPUT_SELECT_WEAPON_MELEE, (int)ControllerInputs::INPUT_SELECT_WEAPON_HANDGUN, (int)ControllerInputs::INPUT_SELECT_WEAPON_SHOTGUN, (int)ControllerInputs::INPUT_SELECT_WEAPON_SMG, (int)ControllerInputs::INPUT_SELECT_WEAPON_AUTO_RIFLE};
const int input_array[6] = {(int)ControllerInputs::INPUT_SELECT_WEAPON_UNARMED, (int)ControllerInputs::INPUT_SELECT_WEAPON_MELEE, (int)ControllerInputs::INPUT_SELECT_WEAPON_SHOTGUN, (int)ControllerInputs::INPUT_SELECT_WEAPON_HEAVY, (int)ControllerInputs::INPUT_SELECT_WEAPON_SPECIAL, (int)ControllerInputs::INPUT_SELECT_WEAPON_HANDGUN};
static void resolve_weapon_hotkey(Hash weapon)
{
@ -34,7 +34,7 @@ namespace big
WEAPON::GET_CURRENT_PED_VEHICLE_WEAPON(player_ped, &current_vehicle_weapon);
for (int iterator_keys = 0; iterator_keys < 6; iterator_keys++)
{
PAD::DISABLE_CONTROL_ACTION(0, input_array[iterator_keys], TRUE);
PAD::DISABLE_CONTROL_ACTION(0, input_array[iterator_keys], FALSE);
if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, input_array[iterator_keys]))
{
auto hotkey_vector = g.weapons.weapon_hotkeys[iterator_keys];

View File

@ -6,9 +6,10 @@ namespace big
{
DEFAULT,
INSTANT_REFIL,
INFINITE_BOOST
INFINITE_BOOST,
HOLD_FOR_INFINITE
};
NLOHMANN_JSON_SERIALIZE_ENUM(eBoostBehaviors, {{eBoostBehaviors::DEFAULT, "default"}, {eBoostBehaviors::INSTANT_REFIL, "instant"}, {eBoostBehaviors::INFINITE_BOOST, "infinite"}})
NLOHMANN_JSON_SERIALIZE_ENUM(eBoostBehaviors, {{eBoostBehaviors::DEFAULT, "default"}, {eBoostBehaviors::INSTANT_REFIL, "instant"}, {eBoostBehaviors::INFINITE_BOOST, "infinite"}, {eBoostBehaviors::HOLD_FOR_INFINITE, "hold"}})
enum class CustomWeapon
{

View File

@ -403,7 +403,9 @@ namespace big
int menu_toggle = VK_INSERT;
int teleport_waypoint = 0;
int teleport_objective = 0;
int teleport_pv = 0;
int noclip = 0;
int vehicle_flymode = 0;
int bringvehicle = 0;
int invis = 0;
int heal = 0;
@ -417,13 +419,13 @@ namespace big
int localinvisveh = 0;
int fill_ammo = 0;
int fast_quit = 0;
int cmd_excecutor = 0x55;
int cmd_excecutor = 'U';
int repairpv = 0;
int open_vehicle_controller = 0;
int clear_wanted = 0;
int random_ped_components = 0;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(hotkeys, editing_menu_toggle, menu_toggle, teleport_waypoint, teleport_objective, noclip, 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)
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;

View File

@ -14,9 +14,10 @@ namespace big
// ordered alphabetically to more easily see if a certain hotkey is present
register_hotkey("beastjump", g.settings.hotkeys.beastjump, RAGE_JOAAT("beastjump"));
register_hotkey("bringpv", g.settings.hotkeys.bringvehicle, RAGE_JOAAT("bringpv"));
register_hotkey("clearwantedlvl", g.settings.hotkeys.clear_wanted, RAGE_JOAAT("clearwantedlvl"));
register_hotkey("cmdexecutor", g.settings.hotkeys.cmd_excecutor, RAGE_JOAAT("cmdexecutor"));
register_hotkey("fastrun", g.settings.hotkeys.superrun, RAGE_JOAAT("fastrun"));
register_hotkey("fastquit", g.settings.hotkeys.fast_quit, RAGE_JOAAT("fastquit"));
register_hotkey("fastrun", g.settings.hotkeys.superrun, RAGE_JOAAT("fastrun"));
register_hotkey("fillammo", g.settings.hotkeys.fill_ammo, RAGE_JOAAT("fillammo"));
register_hotkey("fillsnacks", g.settings.hotkeys.fill_inventory, RAGE_JOAAT("fillsnacks"));
register_hotkey("freecam", g.settings.hotkeys.freecam, RAGE_JOAAT("freecam"));
@ -26,12 +27,13 @@ namespace big
register_hotkey("localinvisveh", g.settings.hotkeys.localinvisveh, RAGE_JOAAT("localinvisveh"));
register_hotkey("noclip", g.settings.hotkeys.noclip, RAGE_JOAAT("noclip"));
register_hotkey("objective", g.settings.hotkeys.teleport_objective, RAGE_JOAAT("objectivetp"));
register_hotkey("pvtp", g.settings.hotkeys.teleport_pv, RAGE_JOAAT("pvtp"));
register_hotkey("repairpv", g.settings.hotkeys.repairpv, RAGE_JOAAT("repairpv"));
register_hotkey("skipcutscene", g.settings.hotkeys.skip_cutscene, RAGE_JOAAT("skipcutscene"));
register_hotkey("superjump", g.settings.hotkeys.superjump, RAGE_JOAAT("superjump"));
register_hotkey("vehiclecontroller", g.settings.hotkeys.open_vehicle_controller, RAGE_JOAAT("vehiclecontrol"));
register_hotkey("vehiclefly", g.settings.hotkeys.vehicle_flymode, RAGE_JOAAT("vehiclefly"));
register_hotkey("waypoint", g.settings.hotkeys.teleport_waypoint, RAGE_JOAAT("waypointtp"));
register_hotkey("clearwantedlvl", g.settings.hotkeys.clear_wanted, RAGE_JOAAT("clearwantedlvl"));
g_renderer->add_wndproc_callback([this](HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
wndproc(static_cast<eKeyState>(msg), wparam);

View File

@ -15,6 +15,8 @@ namespace big
g_hotkey_service->update_hotkey("waypoint", g.settings.hotkeys.teleport_waypoint);
if (ImGui::Hotkey("Teleport to objective", &g.settings.hotkeys.teleport_objective))
g_hotkey_service->update_hotkey("objective", g.settings.hotkeys.teleport_objective);
if (ImGui::Hotkey("Teleport into PV", &g.settings.hotkeys.teleport_pv))
g_hotkey_service->update_hotkey("pvtp", g.settings.hotkeys.teleport_pv);
if (ImGui::Hotkey("Toggle Noclip", &g.settings.hotkeys.noclip))
g_hotkey_service->update_hotkey("noclip", g.settings.hotkeys.noclip);
@ -50,6 +52,8 @@ namespace big
g_hotkey_service->update_hotkey("repairpv", g.settings.hotkeys.repairpv);
if (ImGui::Hotkey("Vehicle controller", &g.settings.hotkeys.open_vehicle_controller))
g_hotkey_service->update_hotkey("vehiclecontroller", g.settings.hotkeys.open_vehicle_controller);
if (ImGui::Hotkey("Toggle Vehicle Fly", &g.settings.hotkeys.vehicle_flymode))
g_hotkey_service->update_hotkey("vehiclefly", g.settings.hotkeys.vehicle_flymode);
if (ImGui::Hotkey("Clear Wanted", &g.settings.hotkeys.clear_wanted))
g_hotkey_service->update_hotkey("clearwantedlvl", g.settings.hotkeys.clear_wanted);

View File

@ -175,10 +175,10 @@ namespace big
}
ImGui::Separator();
const char* boost_behaviors[] = {"DEFAULT"_T.data(), "INSTANT_REFILL"_T.data(), "INFINITE"_T.data()};
const char* boost_behaviors[] = {"DEFAULT"_T.data(), "INSTANT_REFILL"_T.data(), "INFINITE"_T.data(), "HOLD_FOR_BOOST"_T.data()};
if (ImGui::BeginCombo("BOOST_BEHAVIOR"_T.data(), boost_behaviors[static_cast<int>(g.vehicle.boost_behavior)]))
{
for (int i = 0; i < 3; i++)
for (int i = 0; i < 4; i++)
{
bool itemSelected = g.vehicle.boost_behavior == static_cast<eBoostBehaviors>(i);