refactor: all weapons in vehicle (#1197)
This commit is contained in:
parent
96d1c26242
commit
51e3b6e132
@ -7,20 +7,10 @@ namespace big
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -123,6 +123,8 @@ namespace big
|
||||
|
||||
detour_hook_helper::add<hooks::fipackfile_mount>("FPFM", g_pointers->m_fipackfile_mount);
|
||||
|
||||
detour_hook_helper::add<hooks::allow_weapons_in_vehicle>("AWIV", g_pointers->m_allow_weapons_in_vehicle);
|
||||
|
||||
g_hooking = this;
|
||||
}
|
||||
|
||||
|
@ -165,6 +165,8 @@ namespace big
|
||||
static void write_vehicle_proximity_migration_data_node(rage::netObject* veh, CVehicleProximityMigrationDataNode* node);
|
||||
|
||||
static bool fipackfile_mount(rage::fiPackfile* this_, const char* mount_point);
|
||||
|
||||
static bool allow_weapons_in_vehicle(int64_t unk, int weaponinfo_group);
|
||||
};
|
||||
|
||||
class minhook_keepalive
|
||||
|
15
src/hooks/misc/allow_weapons_in_vehicle.cpp
Normal file
15
src/hooks/misc/allow_weapons_in_vehicle.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::allow_weapons_in_vehicle(int64_t unk, int weaponinfo_group)
|
||||
{
|
||||
if (g.vehicle.unlimited_weapons)
|
||||
{
|
||||
if (weaponinfo_group == RAGE_JOAAT("GROUP_THROWN")) //Because the thrower can be used without bypassing, we let the game decide the return value, since this function has multiple xrefs, it may be necessary to return 0 at some point
|
||||
return g_hooking->get_original<allow_weapons_in_vehicle>()(unk, weaponinfo_group);
|
||||
return true;
|
||||
}
|
||||
return g_hooking->get_original<allow_weapons_in_vehicle>()(unk, weaponinfo_group);
|
||||
}
|
||||
}
|
@ -737,8 +737,8 @@ namespace big
|
||||
});
|
||||
|
||||
// Allow Weapons In Vehicle
|
||||
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
|
||||
main_batch.add("AWIV", "49 8B 40 08 39 10", [this](memory::handle ptr) {
|
||||
m_allow_weapons_in_vehicle = ptr.sub(23).as<PVOID>();
|
||||
});
|
||||
|
||||
// Crash Trigger
|
||||
|
@ -255,7 +255,7 @@ namespace big
|
||||
bool* m_refresh_audio_input{};
|
||||
|
||||
memory::byte_patch* m_disable_collision{};
|
||||
memory::byte_patch* m_allow_weapons_in_vehicle{};
|
||||
PVOID m_allow_weapons_in_vehicle{};
|
||||
|
||||
PVOID m_taskjump_constructor{};
|
||||
|
||||
|
Reference in New Issue
Block a user