Add an option to remove contracker animation from players

This commit is contained in:
BenCat07 2020-06-28 10:59:46 +02:00
parent 8bc0631bef
commit a9166b6f83
3 changed files with 31 additions and 6 deletions

View File

@ -174,6 +174,7 @@ public:
offset_t m_iTauntConcept;
offset_t m_iTauntIndex;
offset_t m_bViewingCYOAPDA;
offset_t m_angEyeAnglesLocal;
offset_t m_nSequence;
offset_t m_flSimulationTime;

View File

@ -59,12 +59,13 @@ void NetVars::Init()
this->m_nChargeResistType = gNetvars.get_offset("DT_WeaponMedigun", "m_nChargeResistType");
this->m_hHealingTarget = gNetvars.get_offset("DT_WeaponMedigun", "m_hHealingTarget");
this->m_flChargeLevel = gNetvars.get_offset("DT_WeaponMedigun", "NonLocalTFWeaponMedigunData", "m_flChargeLevel");
m_bFeignDeathReady = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_bFeignDeathReady");
m_bCarryingObject = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_bCarryingObject");
m_hCarriedObject = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_hCarriedObject");
m_nSequence = gNetvars.get_offset("DT_BaseAnimating", "m_nSequence");
m_iTauntIndex = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_iTauntIndex");
m_iTauntConcept = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_iTauntConcept");
this->m_bFeignDeathReady = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_bFeignDeathReady");
this->m_bCarryingObject = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_bCarryingObject");
this->m_hCarriedObject = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_hCarriedObject");
this->m_nSequence = gNetvars.get_offset("DT_BaseAnimating", "m_nSequence");
this->m_iTauntIndex = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_iTauntIndex");
this->m_iTauntConcept = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_iTauntConcept");
this->m_bViewingCYOAPDA = gNetvars.get_offset("DT_TFPlayer", "m_bViewingCYOAPDA");
}
this->res_iScore = gNetvars.get_offset("DT_TFPlayerResource", "baseclass", "m_iScore");
IF_GAME(IsTF())

View File

@ -48,6 +48,12 @@ static settings::Boolean misc_drawhitboxes{ "misc.draw-hitboxes", "false" };
static settings::Boolean misc_drawhitboxes_dead{ "misc.draw-hitboxes.dead-players", "false" };
#endif
#if ENABLE_TEXTMODE
static settings::Boolean fix_cyoaanim{ "remove.contracker", "true" };
#else
static settings::Boolean fix_cyoaanim{ "remove.contracker", "false" };
#endif
#if !ENFORCE_STREAM_SAFETY && ENABLE_VISUALS
static void tryPatchLocalPlayerShouldDraw(bool after)
{
@ -879,7 +885,24 @@ void Shutdown()
#endif
}
static ProxyFnHook cyoa_anim_hook{};
void cyoaview_nethook(const CRecvProxyData *data, void *pPlayer, void *out)
{
int value = data->m_Value.m_Int;
int *value_out = (int *) out;
if (!fix_cyoaanim)
{
*value_out = value;
return;
}
// Mark as not doing cyoa thing
if (CE_BAD(LOCAL_E) || pPlayer != RAW_ENT(LOCAL_E))
*value_out = false;
}
static InitRoutine init([]() {
HookNetvar({ "DT_TFPlayer", "m_bViewingCYOAPDA" }, cyoa_anim_hook, cyoaview_nethook);
teammatesPushaway = g_ICvar->FindVar("tf_avoidteammates_pushaway");
EC::Register(EC::Shutdown, Shutdown, "draw_local_player", EC::average);
EC::Register(EC::CreateMove, CreateMove, "cm_misc_hacks", EC::average);