2021-04-23 14:57:21 -04:00
|
|
|
#include <stdinc.hpp>
|
|
|
|
#include "loader/component_loader.hpp"
|
|
|
|
|
|
|
|
#include "game/game.hpp"
|
2021-04-26 16:34:43 -04:00
|
|
|
#include "game/dvars.hpp"
|
2021-04-23 14:57:21 -04:00
|
|
|
|
|
|
|
#include <utils/hook.hpp>
|
|
|
|
|
|
|
|
namespace patches
|
|
|
|
{
|
|
|
|
namespace
|
|
|
|
{
|
2021-04-26 16:34:43 -04:00
|
|
|
utils::hook::detour pm_crashland_hook;
|
2021-04-23 14:57:21 -04:00
|
|
|
|
2021-04-26 16:34:43 -04:00
|
|
|
void pm_crashland_stub(void* ps, void* pm)
|
|
|
|
{
|
|
|
|
if (dvars::jump_enableFallDamage->current.enabled)
|
|
|
|
{
|
|
|
|
pm_crashland_hook.invoke<void>(ps, pm);
|
|
|
|
}
|
|
|
|
}
|
2021-04-23 14:57:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class component final : public component_interface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void post_unpack() override
|
|
|
|
{
|
|
|
|
// Unlock fps in main menu
|
|
|
|
utils::hook::set<BYTE>(game::base_address + 0x3D8E1B, 0xEB);
|
|
|
|
|
|
|
|
// Disable battle net popup
|
|
|
|
utils::hook::set(game::base_address + 0xBE7F83C, true);
|
2021-04-26 16:34:43 -04:00
|
|
|
|
|
|
|
pm_crashland_hook.create(game::base_address + 0x688A20, pm_crashland_stub);
|
|
|
|
dvars::jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", 1, game::DVAR_FLAG_REPLICATED);
|
|
|
|
|
2021-04-26 19:35:55 -04:00
|
|
|
dvars::register_float("jump_height", 39, 0, 1000, game::DVAR_FLAG_REPLICATED);
|
|
|
|
dvars::register_float("g_gravity", 800, 1, 1000, game::DVAR_FLAG_REPLICATED);
|
|
|
|
dvars::register_int("g_speed", 190, 0, 1000, game::DVAR_FLAG_REPLICATED);
|
2021-04-23 14:57:21 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
REGISTER_COMPONENT(patches::component)
|