Graceful Landing (#2660)

This commit is contained in:
Anvar 2024-01-28 09:17:26 -05:00 committed by GitHub
parent dfb3ecc9be
commit 49d31f8799
10 changed files with 56 additions and 2 deletions

View File

@ -0,0 +1,6 @@
#include "backend/bool_command.hpp"
namespace big
{
bool_command g_graceful_landing("gracefullanding", "GRACEFUL_LANDING", "GRACEFUL_LANDING_DESC", g.self.graceful_landing);
}

View File

@ -341,6 +341,7 @@ namespace big
bool auto_tp = false;
bool super_jump = false;
bool beast_jump = false;
bool graceful_landing = false;
bool healthregen = false;
float healthregenrate = 1.0f;
bool superman = false;

View File

@ -1974,6 +1974,23 @@ enum class eTaskTypeIndex
CTaskAnimatedFallback = 530
};
enum class eTaskFlags
{
ParachuteWhenCoordThresholdIsReached = 1 << 3,
CamShakeOnFall = 1 << 4,
PlayRagdollAnim = 1 << 5,
PlayDiveAnim = 1 << 7,
NoFallAnimation = 1 << 10,
NoSlowFall = 1 << 11,
Unk12 = 1 << 12,
SuperJump = 1 << 15,
LandOnJump = 1 << 16,
BeastJump = 1 << 17,
BeastJumpWithSuper = SuperJump | BeastJump,
GracefulLanding = NoFallAnimation | NoSlowFall | Unk12 | LandOnJump,
RagdollOnFall = BeastJump | PlayRagdollAnim
};
enum class eDoorId
{
VEH_EXT_DOOR_INVALID_ID = -1,

View File

@ -277,6 +277,7 @@ namespace big
PVOID m_allow_weapons_in_vehicle;
PVOID m_taskjump_constructor;
PVOID m_taskfall_constructor;
PVOID m_write_vehicle_proximity_migration_data_node;
functions::migrate_object m_migrate_object;

View File

@ -115,6 +115,8 @@ namespace big
detour_hook_helper::add<hooks::task_jump_constructor>("TJC", g_pointers->m_gta.m_taskjump_constructor);
detour_hook_helper::add<hooks::task_fall_constructor>("TFC", g_pointers->m_gta.m_taskfall_constructor);
detour_hook_helper::add<hooks::enumerate_audio_devices>("EAD", g_pointers->m_gta.m_enumerate_audio_devices);
detour_hook_helper::add<hooks::direct_sound_capture_create>("DSCC", g_pointers->m_gta.m_direct_sound_capture_create);

View File

@ -151,6 +151,8 @@ namespace big
static __int64 task_jump_constructor(uint64_t a1, int a2);
static void* task_fall_constructor(uint64_t a1, int a2);
static CBaseModelInfo* get_model_info(rage::joaat_t hash, uint32_t* a2);
static int enumerate_audio_devices(CFoundDevice* found_devices, int count, int flags);

View File

@ -0,0 +1,14 @@
#include "gta/enums.hpp"
#include "hooking/hooking.hpp"
namespace big
{
void* hooks::task_fall_constructor(uint64_t a1, int a2)
{
if (g.self.graceful_landing)
{
a2 |= (int)eTaskFlags::GracefulLanding;
}
return g_hooking->get_original<task_fall_constructor>()(a1, a2);
}
}

View File

@ -1,3 +1,4 @@
#include "gta/enums.hpp"
#include "hooking/hooking.hpp"
namespace big
@ -5,9 +6,9 @@ namespace big
__int64 hooks::task_jump_constructor(uint64_t a1, int a2)
{
if (g.self.super_jump)
a2 |= 1 << 15;
a2 |= (int)eTaskFlags::SuperJump;
if (g.self.beast_jump)
a2 |= (1 << 15) | (1 << 17);
a2 |= (int)eTaskFlags::BeastJumpWithSuper;
return g_hooking->get_original<task_jump_constructor>()(a1, a2);
}
}

View File

@ -1267,6 +1267,15 @@ namespace big
g_pointers->m_gta.m_taskjump_constructor = ptr.as<PVOID>();
}
},
// Task Fall Constructor
{
"TFC",
"E8 ? ? ? ? B3 04 08 98 A0",
[](memory::handle ptr)
{
g_pointers->m_gta.m_taskfall_constructor = ptr.add(1).rip().as<PVOID>();
}
},
// NetFilter Handle Message
{
"NHM",

View File

@ -40,6 +40,7 @@ namespace big
components::command_checkbox<"invis">();
if (g.self.invisibility)
components::command_checkbox<"localvis">(); // TODO: does nothing in SP
components::command_checkbox<"gracefullanding">();
// clang-format off
ImGui::BeginDisabled(!*g_pointers->m_gta.m_is_session_started ||