diff --git a/src/module/player_movement.cpp b/src/module/player_movement.cpp index 2cb6fbf..431b1ae 100644 --- a/src/module/player_movement.cpp +++ b/src/module/player_movement.cpp @@ -125,7 +125,7 @@ __declspec(naked) void player_movement::jump_push_off_ladder_stub() } } -void player_movement::jump_start_stub() +__declspec(naked) void player_movement::jump_start_stub() { __asm { @@ -176,6 +176,40 @@ void player_movement::jump_apply_slowdown_stub(game::native::playerState_s* ps) } } +float player_movement::jump_get_land_factor(game::native::playerState_s* ps) +{ + assert(ps->pm_flags & game::native::PMF_JUMPING); + assert(ps->pm_time <= game::native::JUMP_LAND_SLOWDOWN_TIME); + + if (!player_movement::jump_slowdownEnable->current.enabled + || (ps->pm_flags & game::native::PMF_DIVING) != 0) + { + return 1.0f; + } + + if (ps->pm_time < 1700) + { + return (ps->pm_time * 1.5f * 0.000588f) + 1.0f; + } + + return 2.5f; +} + +__declspec(naked) void player_movement::jump_get_land_factor_stub() +{ + __asm + { + pushad + + push eax // ps + call player_movement::jump_get_land_factor + add esp, 4 + + popad + ret + } +} + const game::native::dvar_t* player_movement::dvar_register_player_sustain_ammo(const char* dvar_name, bool value, unsigned __int16 /*flags*/, const char* description) { @@ -251,6 +285,7 @@ void player_movement::patch_mp() utils::hook::nop(0x41696E, 1); // Nop skipped opcode utils::hook(0x4225CA, &player_movement::jump_apply_slowdown_stub, HOOK_CALL).install()->quick(); // PM_WalkMove + utils::hook(0x41669B, &player_movement::jump_get_land_factor_stub, HOOK_CALL).install()->quick(); // Jump_Start } void player_movement::patch_sp() diff --git a/src/module/player_movement.hpp b/src/module/player_movement.hpp index afe2241..bf7bd15 100644 --- a/src/module/player_movement.hpp +++ b/src/module/player_movement.hpp @@ -56,6 +56,8 @@ private: static void jump_start_stub(); static void jump_apply_slowdown_stub(game::native::playerState_s* ps); + static float jump_get_land_factor(game::native::playerState_s* ps); + static void jump_get_land_factor_stub(); static void patch_mp(); static void patch_sp();