collision & ejection

This commit is contained in:
Skull Merlin 2022-05-05 16:58:36 +03:00
parent 007e947611
commit 54185c8464
4 changed files with 44 additions and 0 deletions

View File

@ -25,6 +25,26 @@ namespace gameplay
} }
} }
int stuck_in_client_stub(void* entity)
{
if (dvars::g_playerEjection->current.enabled)
{
return utils::hook::invoke<int>(0x140326CE0, entity); // StuckInClient
}
return 0;
}
void cm_transformed_capsule_trace_stub(game::trace_t* results, const float* start, const float* end,
game::Bounds* bounds, game::Bounds* capsule, int contents, const float* origin, const float* angles)
{
if (dvars::g_playerCollision->current.enabled)
{
utils::hook::invoke<void>(0x1403FF860,
results, start, end, bounds, capsule, contents, origin, angles); // CM_TransformedCapsuleTrace
}
}
void pm_crashland_stub(game::mp::playerState_s* ps, void* pml) void pm_crashland_stub(game::mp::playerState_s* ps, void* pml)
{ {
if (jump_enableFallDamage->current.enabled) if (jump_enableFallDamage->current.enabled)
@ -91,6 +111,16 @@ namespace gameplay
utils::hook::call(0x1401E490F, pm_crashland_stub); utils::hook::call(0x1401E490F, pm_crashland_stub);
jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", true, game::DVAR_FLAG_REPLICATED, "Enable fall damage"); jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", true, game::DVAR_FLAG_REPLICATED, "Enable fall damage");
dvars::g_playerEjection = dvars::register_bool("g_playerEjection", true, game::DVAR_FLAG_REPLICATED,
"Flag whether player ejection is on or off");
utils::hook::call(0x140323333, stuck_in_client_stub);
// Implement player collision dvar
dvars::g_playerCollision = dvars::register_bool("g_playerCollision", true, game::DVAR_FLAG_REPLICATED,
"Flag whether player collision is on or off");
utils::hook::call(0x14049D7CF, cm_transformed_capsule_trace_stub); // SV_ClipMoveToEntity
utils::hook::call(0x140240BC3, cm_transformed_capsule_trace_stub); // CG_ClipMoveToEntity
// Implement bouncing dvar // Implement bouncing dvar
dvars::pm_bouncing = dvars::register_bool("pm_bouncing", false, dvars::pm_bouncing = dvars::register_bool("pm_bouncing", false,
game::DVAR_FLAG_REPLICATED, "Enable bouncing"); game::DVAR_FLAG_REPLICATED, "Enable bouncing");

View File

@ -21,6 +21,8 @@ namespace dvars
game::dvar_t* con_inputDvarValueColor = nullptr; game::dvar_t* con_inputDvarValueColor = nullptr;
game::dvar_t* con_inputDvarInactiveValueColor = nullptr; game::dvar_t* con_inputDvarInactiveValueColor = nullptr;
game::dvar_t* con_inputCmdMatchColor = nullptr; game::dvar_t* con_inputCmdMatchColor = nullptr;
game::dvar_t* g_playerEjection = nullptr;
game::dvar_t* g_playerCollision = nullptr;
game::dvar_t* jump_enableFallDamage; game::dvar_t* jump_enableFallDamage;

View File

@ -24,6 +24,8 @@ namespace dvars
extern game::dvar_t* con_inputDvarValueColor; extern game::dvar_t* con_inputDvarValueColor;
extern game::dvar_t* con_inputDvarInactiveValueColor; extern game::dvar_t* con_inputDvarInactiveValueColor;
extern game::dvar_t* con_inputCmdMatchColor; extern game::dvar_t* con_inputCmdMatchColor;
extern game::dvar_t* g_playerEjection;
extern game::dvar_t* g_playerCollision;
extern game::dvar_t* jump_enableFallDamage; extern game::dvar_t* jump_enableFallDamage;

View File

@ -1428,6 +1428,16 @@ namespace game
SV_LIVE_DROP_DISCONNECT = 0x1, SV_LIVE_DROP_DISCONNECT = 0x1,
}; };
struct trace_t
{
};
struct Bounds
{
float midPoint[3];
float halfSize[3];
};
namespace mp namespace mp
{ {
struct cachedSnapshot_t struct cachedSnapshot_t