Skull 2022-06-10 20:55:03 +03:00
parent c62663800a
commit f4d9f22341
3 changed files with 41 additions and 11 deletions

View File

@ -218,6 +218,22 @@ namespace gameplay
g_damage_hook.invoke<void>(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<int64_t>(&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, &timescale->current.value); // Com_UpdateSlowMotion
utils::hook::inject(0x17F00C_b, &timescale->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");

View File

@ -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_info> dvar_list =
{
{
"ai_count",
"Sets AI count.",
generate_hash("ai_count")
},
{
"accessToSubscriberContent",
"Whether to display the subscriber maps.",

View File

@ -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_info> dvar_list;