2021-09-06 18:40:37 -04:00
|
|
|
#include <std_include.hpp>
|
2021-04-23 14:57:21 -04:00
|
|
|
#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-09-06 18:40:37 -04:00
|
|
|
|
|
|
|
void* sub_46148()
|
|
|
|
{
|
2021-12-27 22:25:14 -05:00
|
|
|
static uint64_t off_11C52460 = 0xAD0C58_b;
|
2021-09-06 18:40:37 -04:00
|
|
|
return &off_11C52460;
|
|
|
|
}
|
2021-12-27 22:25:14 -05:00
|
|
|
|
|
|
|
DECLSPEC_NORETURN void quit_stub(const int code)
|
|
|
|
{
|
|
|
|
component_loader::pre_destroy();
|
|
|
|
exit(0);
|
|
|
|
}
|
2021-04-23 14:57:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class component final : public component_interface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void post_unpack() override
|
|
|
|
{
|
2021-09-06 18:40:37 -04:00
|
|
|
// Not sure but it works
|
2021-12-03 14:47:16 -05:00
|
|
|
utils::hook::set(0x633080_b, 0xC301B0);
|
|
|
|
utils::hook::set(0x272F70_b, 0xC301B0);
|
|
|
|
utils::hook::jump(0x46148_b, sub_46148, true);
|
2021-09-06 18:40:37 -04:00
|
|
|
|
2021-12-27 22:25:14 -05:00
|
|
|
utils::hook::jump(0x64EF10_b, quit_stub, true);
|
|
|
|
|
2021-04-23 14:57:21 -04:00
|
|
|
// Unlock fps in main menu
|
2021-12-03 14:47:16 -05:00
|
|
|
utils::hook::set<BYTE>(0x3D8E1B_b, 0xEB);
|
2021-04-23 14:57:21 -04:00
|
|
|
|
|
|
|
// Disable battle net popup
|
2021-12-03 14:47:16 -05:00
|
|
|
utils::hook::nop(0x5F4496_b, 5);
|
2021-08-29 13:11:58 -04:00
|
|
|
|
2021-12-03 14:47:16 -05:00
|
|
|
pm_crashland_hook.create(0x688A20_b, pm_crashland_stub);
|
2021-04-26 16:34:43 -04:00
|
|
|
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)
|