Fix problems & fully remove jump slowdown

This commit is contained in:
FutureRave 2022-03-17 13:29:01 +00:00
parent f3ee6d4299
commit a3fc61e120
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
2 changed files with 38 additions and 1 deletions

View File

@ -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()

View File

@ -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();