57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
|
#include <std_include.hpp>
|
||
|
#include "loader/component_loader.hpp"
|
||
|
|
||
|
#include "dvars.hpp"
|
||
|
|
||
|
#include "game/game.hpp"
|
||
|
#include "game/dvars.hpp"
|
||
|
|
||
|
#include <utils/nt.hpp>
|
||
|
#include <utils/hook.hpp>
|
||
|
#include <utils/flags.hpp>
|
||
|
|
||
|
namespace gameplay
|
||
|
{
|
||
|
namespace
|
||
|
{
|
||
|
game::dvar_t* jump_slowDownEnable;
|
||
|
game::dvar_t* jump_enableFallDamage;
|
||
|
|
||
|
void jump_apply_slowdown_stub(game::mp::playerState_s* ps)
|
||
|
{
|
||
|
if (jump_slowDownEnable->current.enabled)
|
||
|
{
|
||
|
utils::hook::invoke<void>(0x1401D5360, ps);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void pm_crashland_stub(game::mp::playerState_s* ps, void* pml)
|
||
|
{
|
||
|
if (jump_enableFallDamage->current.enabled)
|
||
|
{
|
||
|
utils::hook::invoke<void>(0x1401E2D00, ps, pml);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class component final : public component_interface
|
||
|
{
|
||
|
public:
|
||
|
void post_unpack() override
|
||
|
{
|
||
|
if (game::environment::is_sp())
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
utils::hook::call(0x1401E8830, jump_apply_slowdown_stub);
|
||
|
jump_slowDownEnable = dvars::register_bool("jump_slowDownEnable", true, game::DVAR_FLAG_REPLICATED, true);
|
||
|
|
||
|
utils::hook::call(0x1401E490F, pm_crashland_stub);
|
||
|
jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", true, game::DVAR_FLAG_REPLICATED, true);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
REGISTER_COMPONENT(gameplay::component)
|