jump height dvar

This commit is contained in:
Skull 2022-06-11 21:48:09 +03:00
parent e9630d02fd
commit 7aaf230d12
4 changed files with 27 additions and 0 deletions

View File

@ -234,6 +234,11 @@ namespace gameplay
a.jmp(0x2BD71C_b);
});
}
void jump_start_stub(game::pmove_t* pm, game::pml_t* pml, float /*height*/)
{
utils::hook::invoke<void>(0x2BD800_b, pm, pml, dvars::jump_height->current.value);
}
}
class component final : public component_interface
@ -286,6 +291,10 @@ namespace gameplay
utils::hook::jump(0x2BD70C_b, jump_push_off_ladder(), true);
utils::hook::nop(0x2BD718_b, 4); // Nop skipped opcodes
dvars::jump_height = dvars::register_float("jump_height", 39.0f,
0.0f, 1000.0f, game::DVAR_FLAG_REPLICATED, "The maximum height of a player\'s jump");
utils::hook::call(0x2BD22D_b, jump_start_stub);
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

@ -34,6 +34,8 @@ namespace dvars
game::dvar_t* jump_ladderPushVel = nullptr;
game::dvar_t* jump_height = nullptr;
game::dvar_t* jump_enableFallDamage;
game::dvar_t* r_fullbright;

View File

@ -37,6 +37,8 @@ namespace dvars
extern game::dvar_t* jump_ladderPushVel;
extern game::dvar_t* jump_height;
extern game::dvar_t* jump_enableFallDamage;
extern game::dvar_t* r_fullbright;

View File

@ -1475,6 +1475,20 @@ namespace game
static_assert(offsetof(client_state_t, ping) == 0x4A50);
static_assert(offsetof(client_state_t, num_players) == 0x4A5C);
struct pmove_t
{
unsigned char __pad0[0x190];
};
static_assert(sizeof(pmove_t) == 0x190);
struct pml_t
{
unsigned char __pad0[0x130];
};
static_assert(sizeof(pml_t) == 0x130);
enum PlayerHandIndex
{
WEAPON_HAND_DEFAULT = 0x0,