From f4d9f22341ff2dd7474b0ba976b48c5e504eb1da Mon Sep 17 00:00:00 2001 From: Skull <86374920+skkuull@users.noreply.github.com> Date: Fri, 10 Jun 2022 20:55:03 +0300 Subject: [PATCH] ladder jump height https://github.com/XLabsProject/s1x-client/blob/develop/src/client/component/gameplay.cpp#L188-L191 --- src/client/component/gameplay.cpp | 21 +++++++++++++++++++++ src/client/game/dvars.cpp | 17 ++++++++++++----- src/client/game/dvars.hpp | 14 ++++++++------ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/client/component/gameplay.cpp b/src/client/component/gameplay.cpp index 6a846fc0..8bbfb5d2 100644 --- a/src/client/component/gameplay.cpp +++ b/src/client/component/gameplay.cpp @@ -218,6 +218,22 @@ namespace gameplay g_damage_hook.invoke(targ, inflictor, attacker, dir, point, damage, dflags, mod, weapon, is_alternate, hit_loc, model_index, part_name, time_offset, a15); } + + void* jump_push_off_ladder() + { + return utils::hook::assemble([](utils::hook::assembler& a) + { + a.push(rax); + + a.mov(rax, qword_ptr(reinterpret_cast(&dvars::jump_ladderPushVel))); + a.mulss(xmm7, dword_ptr(rax, 0x10)); + a.mulss(xmm6, dword_ptr(rax, 0x10)); + + a.pop(rax); + + a.jmp(0x2BD71C_b); + }); + } } class component final : public component_interface @@ -265,6 +281,11 @@ namespace gameplay utils::hook::inject(0x17EFE2_b, ×cale->current.value); // Com_UpdateSlowMotion utils::hook::inject(0x17F00C_b, ×cale->current.value); //Com_UpdateSlowMotion + dvars::jump_ladderPushVel = dvars::register_float("jump_ladderPushVel", 128.0f, + 0.0f, 1024.0f, game::DVAR_FLAG_REPLICATED, "The velocity of a jump off of a ladder"); + utils::hook::jump(0x2BD70C_b, jump_push_off_ladder(), true); + utils::hook::nop(0x2BD718_b, 4); // Nop skipped opcodes + jump_apply_slowdown_hook.create(0x2BD0B0_b, jump_apply_slowdown_stub); jump_slowDownEnable = dvars::register_bool("jump_slowDownEnable", true, game::DVAR_FLAG_REPLICATED, "Slow player movement after jumping"); diff --git a/src/client/game/dvars.cpp b/src/client/game/dvars.cpp index f933afeb..0919bdd4 100644 --- a/src/client/game/dvars.cpp +++ b/src/client/game/dvars.cpp @@ -26,17 +26,19 @@ namespace dvars game::dvar_t* player_sustainAmmo = nullptr; game::dvar_t* g_enableElevators = nullptr; - game::dvar_t* jump_enableFallDamage; - - game::dvar_t* r_fullbright; - game::dvar_t* r_chams; - game::dvar_t* g_speed = nullptr; game::dvar_t* g_gravity = nullptr; game::dvar_t* pm_bouncing = nullptr; + game::dvar_t* jump_ladderPushVel = nullptr; + + game::dvar_t* jump_enableFallDamage; + + game::dvar_t* r_fullbright; + game::dvar_t* r_chams; + game::dvar_t* cg_legacyCrashHandling; std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain) @@ -215,6 +217,11 @@ namespace dvars std::vector dvar_list = { + { + "ai_count", + "Sets AI count.", + generate_hash("ai_count") + }, { "accessToSubscriberContent", "Whether to display the subscriber maps.", diff --git a/src/client/game/dvars.hpp b/src/client/game/dvars.hpp index 3725df91..3c769b50 100644 --- a/src/client/game/dvars.hpp +++ b/src/client/game/dvars.hpp @@ -28,18 +28,20 @@ namespace dvars extern game::dvar_t* g_playerCollision; extern game::dvar_t* player_sustainAmmo; extern game::dvar_t* g_enableElevators; - - extern game::dvar_t* jump_enableFallDamage; - - extern game::dvar_t* r_fullbright; - extern game::dvar_t* r_chams; - + extern game::dvar_t* g_speed; extern game::dvar_t* g_gravity; extern game::dvar_t* pm_bouncing; + extern game::dvar_t* jump_ladderPushVel; + + extern game::dvar_t* jump_enableFallDamage; + + extern game::dvar_t* r_fullbright; + extern game::dvar_t* r_chams; + extern game::dvar_t* cg_legacyCrashHandling; extern std::vector dvar_list;