feat(vehicle): no collision and all weapons (#1030)

This commit is contained in:
Aure7138 2023-02-28 20:42:23 +08:00 committed by GitHub
parent 555e9e45ba
commit 168a85c139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 128 additions and 31 deletions

View File

@ -0,0 +1,26 @@
#include "backend/looped_command.hpp"
#include "pointers.hpp"
namespace big
{
class veh_no_collision : looped_command
{
using looped_command::looped_command;
virtual void on_enable() override
{
g_pointers->m_disable_collision->apply();
}
virtual void on_tick() override
{
}
virtual void on_disable() override
{
g_pointers->m_disable_collision->restore();
}
};
veh_no_collision g_veh_no_collision("vehnocollision", "No Collision", "Same as Ped No Collision, except this is global and also affects Ped", g.vehicle.no_collision);
}

View File

@ -0,0 +1,26 @@
#include "backend/looped_command.hpp"
#include "pointers.hpp"
namespace big
{
class veh_unlimited_weapons : looped_command
{
using looped_command::looped_command;
virtual void on_enable() override
{
g_pointers->m_allow_weapons_in_vehicle->apply();
}
virtual void on_tick() override
{
}
virtual void on_disable() override
{
g_pointers->m_allow_weapons_in_vehicle->restore();
}
};
veh_unlimited_weapons g_veh_unlimited_weapons("vehallweapons", "Allow Weapons In Vehicle", "Allows you to use all weapons in vehicle", g.vehicle.unlimited_weapons);
}

View File

@ -591,6 +591,8 @@ namespace big
bool localveh_visibility = false;
bool localped_visibility = true;
bool keep_on_ground = false;
bool no_collision = false;
bool unlimited_weapons = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle,
speedo_meter, fly, rainbow_paint, speed_unit, god_mode,
@ -598,7 +600,7 @@ namespace big
auto_drive_destination, auto_drive_style, auto_drive_speed, auto_turn_signals, boost_behavior,
drive_on_water, horn_boost, instant_brake, block_homing, seatbelt, turn_signals, vehicle_jump,
keep_vehicle_repaired, no_water_collision, disable_engine_auto_start, change_engine_state_immediately,
vehinvisibility, localveh_visibility, localped_visibility, keep_on_ground)
vehinvisibility, localveh_visibility, localped_visibility, keep_on_ground, no_collision, unlimited_weapons)
} vehicle{};
struct weapons

View File

@ -66,32 +66,66 @@ namespace big
{
const auto action = src->get_arg<ControllerInputs>(1);
if (g.weapons.interior_weapon)
if (g.weapons.interior_weapon) // Filtering from the inside of Kosatka
{
switch (action)
{
// case ControllerInputs::INPUT_JUMP: TODO: add as separate feature
case ControllerInputs::INPUT_ATTACK:
case ControllerInputs::INPUT_AIM:
case ControllerInputs::INPUT_DUCK:
case ControllerInputs::INPUT_SELECT_WEAPON:
case ControllerInputs::INPUT_COVER:
case ControllerInputs::INPUT_TALK:
case ControllerInputs::INPUT_DETONATE:
case ControllerInputs::INPUT_WEAPON_SPECIAL:
case ControllerInputs::INPUT_WEAPON_SPECIAL_TWO:
case ControllerInputs::INPUT_VEH_AIM:
case ControllerInputs::INPUT_VEH_ATTACK:
case ControllerInputs::INPUT_VEH_ATTACK2:
case ControllerInputs::INPUT_VEH_HEADLIGHT:
case ControllerInputs::INPUT_VEH_NEXT_RADIO:
case ControllerInputs::INPUT_VEH_PREV_RADIO:
case ControllerInputs::INPUT_VEH_NEXT_RADIO_TRACK:
case ControllerInputs::INPUT_VEH_PREV_RADIO_TRACK:
case ControllerInputs::INPUT_VEH_RADIO_WHEEL:
case ControllerInputs::INPUT_VEH_PASSENGER_AIM:
case ControllerInputs::INPUT_VEH_PASSENGER_ATTACK:
case ControllerInputs::INPUT_VEH_SELECT_NEXT_WEAPON:
case ControllerInputs::INPUT_VEH_SELECT_PREV_WEAPON:
case ControllerInputs::INPUT_DETONATE:
case ControllerInputs::INPUT_PICKUP:
// case ControllerInputs::INPUT_JUMP: TODO: add as separate feature
case ControllerInputs::INPUT_TALK:
case ControllerInputs::INPUT_AIM:
case ControllerInputs::INPUT_VEH_ROOF:
case ControllerInputs::INPUT_VEH_JUMP:
case ControllerInputs::INPUT_VEH_FLY_ATTACK:
case ControllerInputs::INPUT_MELEE_ATTACK_LIGHT:
case ControllerInputs::INPUT_MELEE_ATTACK_HEAVY:
case ControllerInputs::INPUT_MELEE_ATTACK_ALTERNATE:
case ControllerInputs::INPUT_MELEE_BLOCK:
case ControllerInputs::INPUT_VEH_ATTACK:
case ControllerInputs::INPUT_VEH_ATTACK2:
case ControllerInputs::INPUT_VEH_AIM:
case ControllerInputs::INPUT_VEH_PASSENGER_ATTACK:
case ControllerInputs::INPUT_VEH_FLY_SELECT_NEXT_WEAPON:
case ControllerInputs::INPUT_ATTACK:
case ControllerInputs::INPUT_NEXT_WEAPON:
case ControllerInputs::INPUT_PREV_WEAPON:
case ControllerInputs::INPUT_SELECT_NEXT_WEAPON:
case ControllerInputs::INPUT_SELECT_PREV_WEAPON:
case ControllerInputs::INPUT_SELECT_WEAPON_UNARMED:
case ControllerInputs::INPUT_SELECT_WEAPON_MELEE:
case ControllerInputs::INPUT_SELECT_WEAPON_HANDGUN:
case ControllerInputs::INPUT_SELECT_WEAPON_SHOTGUN:
case ControllerInputs::INPUT_SELECT_WEAPON_SMG:
case ControllerInputs::INPUT_SELECT_WEAPON_AUTO_RIFLE:
case ControllerInputs::INPUT_SELECT_WEAPON_SNIPER:
case ControllerInputs::INPUT_SELECT_WEAPON_HEAVY:
case ControllerInputs::INPUT_SELECT_WEAPON_SPECIAL:
case ControllerInputs::INPUT_ATTACK2:
case ControllerInputs::INPUT_MELEE_ATTACK1:
case ControllerInputs::INPUT_MELEE_ATTACK2:
case ControllerInputs::INPUT_VEH_GUN_LEFT:
case ControllerInputs::INPUT_VEH_GUN_RIGHT:
case ControllerInputs::INPUT_VEH_GUN_UP:
case ControllerInputs::INPUT_VEH_GUN_DOWN:
case ControllerInputs::INPUT_VEH_HYDRAULICS_CONTROL_TOGGLE:
case ControllerInputs::INPUT_VEH_MELEE_HOLD:
case ControllerInputs::INPUT_VEH_MELEE_LEFT:
case ControllerInputs::INPUT_VEH_MELEE_RIGHT:
case ControllerInputs::INPUT_VEH_CAR_JUMP:
case ControllerInputs::INPUT_VEH_ROCKET_BOOST:
case ControllerInputs::INPUT_VEH_FLY_BOOST:
case ControllerInputs::INPUT_VEH_PARACHUTE:
case ControllerInputs::INPUT_VEH_BIKE_WINGS:
case ControllerInputs::INPUT_VEH_TRANSFORM:
return;
}
}
@ -106,5 +140,10 @@ namespace big
HUD::HUD_FORCE_WEAPON_WHEEL(src->get_arg<BOOL>(0));
}
void NETWORK_CASINO_CAN_BET(rage::scrNativeCallContext* src)
{
src->set_return_value<BOOL>(TRUE);
}
}
}

View File

@ -1,10 +0,0 @@
namespace big
{
namespace casino
{
void NETWORK_CASINO_CAN_BET(rage::scrNativeCallContext* src)
{
src->set_return_value<BOOL>(TRUE);
}
}
}

View File

@ -6,7 +6,6 @@
#include "shop_controller.hpp"
#include "network_session_host.hpp"
#include "am_launcher.hpp"
#include "casino.hpp"
#include "creator.hpp"
#include "crossmap.hpp"
@ -110,6 +109,7 @@ namespace big
add_native_detour(0xADF692B254977C0C, all_scripts::SET_CURRENT_PED_WEAPON);
add_native_detour(0xFE99B66D079CF6BC, all_scripts::DISABLE_CONTROL_ACTION);
add_native_detour(0xEB354E5376BC81A7, all_scripts::HUD_FORCE_WEAPON_WHEEL);
add_native_detour(0x158C16F5E4CF41F8, all_scripts::NETWORK_CASINO_CAN_BET); //bypass casino country restrictions
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x06843DA7060A026B, carmod_shop::SET_ENTITY_COORDS);
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x8E2530AA8ADA980E, carmod_shop::SET_ENTITY_HEADING);
@ -144,9 +144,6 @@ namespace big
add_native_detour(RAGE_JOAAT("fm_lts_creator"), 0x3D3D8B3BE5A83D35, creator::GET_USED_CREATOR_BUDGET);
add_native_detour(RAGE_JOAAT("fm_survival_creator"), 0x3D3D8B3BE5A83D35, creator::GET_USED_CREATOR_BUDGET);
//bypass casino country restrictions
add_native_detour(0x158C16F5E4CF41F8, casino::NETWORK_CASINO_CAN_BET);
for (auto& entry : *g_pointers->m_script_program_table)
if (entry.m_program)
hook_program(entry.m_program);

View File

@ -819,6 +819,18 @@ namespace big
m_write_player_camera_data_node = ptr.as<PVOID>();
});
// DC
main_batch.add("DC", "48 8B D1 49 8B CA ? ? ? ? ? 48 8B D1 49 8B CA", [this](memory::handle ptr)
{
m_disable_collision = memory::byte_patch::make(ptr.sub(2).as<uint8_t*>(), 0xEB).get();
});
// AWIV
main_batch.add("AWIV", "49 3B C9 7C F0 ? ? C3", [this](memory::handle ptr)
{
m_allow_weapons_in_vehicle = memory::byte_patch::make(ptr.add(5).as<uint16_t*>(), 0x01B0).get(); //In order for the second xref loop not to stop
});
auto mem_region = memory::module("GTA5.exe");
if (!main_batch.run(mem_region))
{

View File

@ -240,6 +240,9 @@ namespace big
PVOID m_receive_pickup{};
PVOID m_write_player_camera_data_node{};
memory::byte_patch* m_disable_collision{};
memory::byte_patch* m_allow_weapons_in_vehicle{};
};
inline pointers* g_pointers{};

View File

@ -76,6 +76,8 @@ namespace big
{
components::command_checkbox<"localinvisveh">();
}
components::command_checkbox<"vehnocollision">();
components::command_checkbox<"vehallweapons">();
ImGui::EndGroup();
ImGui::SameLine();