Implement jump_enableFallDamage
This commit is contained in:
parent
214226ad5a
commit
b3e1fc38eb
@ -2,6 +2,7 @@
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
|
||||
@ -9,7 +10,15 @@ namespace patches
|
||||
{
|
||||
namespace
|
||||
{
|
||||
utils::hook::detour pm_crashland_hook;
|
||||
|
||||
void pm_crashland_stub(void* ps, void* pm)
|
||||
{
|
||||
if (dvars::jump_enableFallDamage->current.enabled)
|
||||
{
|
||||
pm_crashland_hook.invoke<void>(ps, pm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
@ -22,6 +31,13 @@ namespace patches
|
||||
|
||||
// Disable battle net popup
|
||||
utils::hook::set(game::base_address + 0xBE7F83C, true);
|
||||
|
||||
pm_crashland_hook.create(game::base_address + 0x688A20, pm_crashland_stub);
|
||||
dvars::jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", 1, game::DVAR_FLAG_REPLICATED);
|
||||
|
||||
dvars::jump_enableFallDamage = dvars::register_float("jump_height", 39, 0, 1000, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::jump_enableFallDamage = dvars::register_float("g_gravity", 800, 1, 1000, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::jump_enableFallDamage = dvars::register_int("g_speed", 190, 0, 1000, game::DVAR_FLAG_REPLICATED);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ namespace dvars
|
||||
game::dvar_t* con_inputDvarInactiveValueColor = nullptr;
|
||||
game::dvar_t* con_inputCmdMatchColor = nullptr;
|
||||
|
||||
game::dvar_t* jump_enableFallDamage;
|
||||
|
||||
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain)
|
||||
{
|
||||
if (domain.vector.min == -FLT_MAX)
|
||||
@ -1163,6 +1165,15 @@ namespace dvars
|
||||
return game::Dvar_RegisterInt(hash, "", value, min, max, flags);
|
||||
}
|
||||
|
||||
game::dvar_t* register_bool(const std::string& name, bool value, game::DvarFlags flags)
|
||||
{
|
||||
const auto hash = game::generateHashValue(name.data());
|
||||
|
||||
dvar_list.push_back(name);
|
||||
|
||||
return game::Dvar_RegisterBool(hash, "", value, flags);
|
||||
}
|
||||
|
||||
game::dvar_t* register_float(const std::string& name, float value, float min, float max, game::DvarFlags flags)
|
||||
{
|
||||
const auto hash = game::generateHashValue(name.data());
|
||||
|
@ -16,22 +16,7 @@ namespace dvars
|
||||
extern game::dvar_t* con_inputDvarInactiveValueColor;
|
||||
extern game::dvar_t* con_inputCmdMatchColor;
|
||||
|
||||
extern game::dvar_t* g_playerCollision;
|
||||
extern game::dvar_t* g_playerEjection;
|
||||
extern game::dvar_t* g_gravity;
|
||||
extern game::dvar_t* g_speed;
|
||||
|
||||
extern game::dvar_t* pm_bouncing;
|
||||
|
||||
extern game::dvar_t* r_aspectRatioCustom;
|
||||
extern game::dvar_t* jump_slowDownEnable;
|
||||
extern game::dvar_t* jump_enableFallDamage;
|
||||
extern game::dvar_t* jump_height;
|
||||
extern game::dvar_t* jump_ladderPushVel;
|
||||
|
||||
extern game::dvar_t* r_fullbright;
|
||||
|
||||
extern game::dvar_t* aimassist_enabled;
|
||||
|
||||
extern std::vector<std::string> dvar_list;
|
||||
|
||||
@ -39,6 +24,7 @@ namespace dvars
|
||||
std::string dvar_get_domain(const game::dvar_type type, const game::dvar_limits& domain);
|
||||
|
||||
game::dvar_t* register_int(const std::string& name, int value, int min, int max, game::DvarFlags flags);
|
||||
game::dvar_t* register_bool(const std::string& name, bool value, game::DvarFlags flags);
|
||||
game::dvar_t* register_float(const std::string& name, float value, float min, float max, game::DvarFlags flags);
|
||||
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z, float w, float min, float max, game::DvarFlags flags);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user