mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
feat: add increased bullet penetration dvar (#704)
Co-authored-by: FutureRave <edoardo.sanguineti222@gmail.com>
This commit is contained in:
parent
96ff5add75
commit
75aff9d860
44
src/client/component/bullet.cpp
Normal file
44
src/client/component/bullet.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include <std_include.hpp>
|
||||||
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
#include "game/dvars.hpp"
|
||||||
|
|
||||||
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
|
namespace bullet
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
utils::hook::detour bg_get_surface_penetration_depth_hook;
|
||||||
|
|
||||||
|
float bg_get_surface_penetration_depth_stub(game::Weapon weapon, bool is_alternate, int surfaceType)
|
||||||
|
{
|
||||||
|
if (dvars::bg_surfacePenetration->current.value > 0.0f)
|
||||||
|
{
|
||||||
|
return dvars::bg_surfacePenetration->current.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bg_get_surface_penetration_depth_hook.invoke<float>(weapon, is_alternate, surfaceType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
if (game::environment::is_sp())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dvars::bg_surfacePenetration = game::Dvar_RegisterFloat("bg_surfacePenetration", 0.0f,
|
||||||
|
0.0f, std::numeric_limits<float>::max(), game::DVAR_FLAG_SAVED,
|
||||||
|
"Set to a value greater than 0 to override the surface penetration depth");
|
||||||
|
bg_get_surface_penetration_depth_hook.create(0x1401641A0, &bg_get_surface_penetration_depth_stub);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_COMPONENT(bullet::component)
|
@ -20,6 +20,8 @@ namespace dvars
|
|||||||
game::dvar_t* g_playerEjection = nullptr;
|
game::dvar_t* g_playerEjection = nullptr;
|
||||||
game::dvar_t* g_playerCollision = nullptr;
|
game::dvar_t* g_playerCollision = nullptr;
|
||||||
|
|
||||||
|
game::dvar_t* bg_surfacePenetration = nullptr;
|
||||||
|
|
||||||
game::dvar_t* pm_bouncing = nullptr;
|
game::dvar_t* pm_bouncing = nullptr;
|
||||||
game::dvar_t* g_dump_scripts = nullptr;
|
game::dvar_t* g_dump_scripts = nullptr;
|
||||||
game::dvar_t* g_gravity = nullptr;
|
game::dvar_t* g_gravity = nullptr;
|
||||||
|
@ -19,6 +19,8 @@ namespace dvars
|
|||||||
extern game::dvar_t* g_playerCollision;
|
extern game::dvar_t* g_playerCollision;
|
||||||
extern game::dvar_t* g_playerEjection;
|
extern game::dvar_t* g_playerEjection;
|
||||||
|
|
||||||
|
extern game::dvar_t* bg_surfacePenetration;
|
||||||
|
|
||||||
extern game::dvar_t* pm_bouncing;
|
extern game::dvar_t* pm_bouncing;
|
||||||
extern game::dvar_t* g_dump_scripts;
|
extern game::dvar_t* g_dump_scripts;
|
||||||
extern game::dvar_t* g_gravity;
|
extern game::dvar_t* g_gravity;
|
||||||
|
Loading…
Reference in New Issue
Block a user