From 867efbb957d847b31a166efef32f6449dc8701ca Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Wed, 23 Oct 2019 21:26:00 +0200 Subject: [PATCH] Enable render_zoomed by default --- src/hacks/Misc.cpp | 19 +++++++++++++++---- src/visual/EffectGlow.cpp | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index a596e489..4bc2dabe 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -21,7 +21,9 @@ namespace hacks::shared::misc { -static settings::Boolean render_zoomed{ "visual.render-local-zoomed", "false" }; +#if !ENFORCE_STREAM_SAFETY && ENABLE_VISUALS +static settings::Boolean render_zoomed{ "visual.render-local-zoomed", "true" }; +#endif static settings::Boolean anti_afk{ "misc.anti-afk", "false" }; static settings::Boolean auto_strafe{ "misc.autostrafe", "false" }; static settings::Boolean tauntslide{ "misc.tauntslide-tf2c", "false" }; @@ -39,12 +41,19 @@ static settings::Boolean no_homo{ "misc.no-homo", "true" }; static settings::Boolean show_spectators{ "misc.show-spectators", "false" }; #endif -static void tryPatchLocalPlayerShouldDraw(settings::VariableBase &, bool after) +#if !ENFORCE_STREAM_SAFETY && ENABLE_VISUALS +static void tryPatchLocalPlayerShouldDraw(bool after) { static BytePatch patch_shoulddraw{ gSignatures.GetClientSignature, "80 BB ? ? ? ? ? 75 DE", 0xD, { 0xE0 } }; after ? patch_shoulddraw.Patch() : patch_shoulddraw.Shutdown(); } +static void tryPatchLocalPlayerShouldDraw_callback(settings::VariableBase &, bool after) +{ + tryPatchLocalPlayerShouldDraw(after); +} +#endif + static Timer anti_afk_timer{}; static int last_buttons{ 0 }; @@ -749,9 +758,9 @@ void Shutdown() { if (CE_BAD(LOCAL_E)) return; +#if ENABLE_VISUALS && !ENFORCE_STREAM_SAFETY // unpatching local player render_zoomed = false; -#if ENABLE_VISUALS && !ENFORCE_STREAM_SAFETY patch_playerpanel->Shutdown(); patch_scoreboard1->Shutdown(); patch_scoreboard2->Shutdown(); @@ -769,9 +778,11 @@ static InitRoutine init([]() { EC::Register(EC::Shutdown, Shutdown, "draw_local_player", EC::average); EC::Register(EC::CreateMove, CreateMove, "cm_misc_hacks", EC::average); #if ENABLE_VISUALS - render_zoomed.installChangeCallback(tryPatchLocalPlayerShouldDraw); EC::Register(EC::Draw, DrawText, "draw_misc_hacks", EC::average); #if !ENFORCE_STREAM_SAFETY + if (render_zoomed) + tryPatchLocalPlayerShouldDraw(true); + render_zoomed.installChangeCallback(tryPatchLocalPlayerShouldDraw_callback); patch_playerpanel = std::make_unique(gSignatures.GetClientSignature, "0F 94 45 DF", 0x0, std::vector{ 0xC6, 0x45, 0xDF, 0x01 }); uintptr_t addr_scrbrd = gSignatures.GetClientSignature("8B 10 89 74 24 04 89 04 24 FF 92 ? ? ? ? 83 F8 02 75 09"); patch_scoreboard1 = std::make_unique(addr_scrbrd, std::vector{ 0xEB, 0x31, 0xE8, 0x78, 0x46, 0x10, 0x00, 0xE9, 0xC9, 0x06, 0x00, 0x00 }); diff --git a/src/visual/EffectGlow.cpp b/src/visual/EffectGlow.cpp index d62670e2..edee59e9 100644 --- a/src/visual/EffectGlow.cpp +++ b/src/visual/EffectGlow.cpp @@ -251,6 +251,8 @@ rgba_t EffectGlow::GlowColor(IClientEntity *entity) { return colors::Health_dimgreen(ent->m_iHealth(), ent->m_iMaxHealth()); } + else if (!playerlist::IsDefault(ent)) + return playerlist::Color(ent); break; }