Make backtrack chams work for off-screen entities

This commit is contained in:
BenCat07 2020-05-08 23:10:52 +02:00
parent ee2ded6073
commit f4ec99c4f0
4 changed files with 30 additions and 4 deletions

View File

@ -119,7 +119,7 @@
<AutoVariable width="fill" target="misc.ping-reducer.target" label="Target Ping"/>
<AutoVariable width="fill" target="backtrack.latency" label="Fake Latency" min="0" max="1000" step="25"/>
<AutoVariable width="fill" target="backtrack.draw" label="Draw Backtrack" tooltip="Draw ticks on screen"/>
<AutoVariable width="fill" target="backtrack.chams" label="Backtrack Chams" tooltip="Draw Chams for the ticks"/>
<AutoVariable width="fill" target="backtrack.chams" label="Backtrack Chams" tooltip="Draw Chams for the ticks (Note that transparent viewmodels make them transparent if the entity being backtracked walks off-screen)"/>
<AutoVariable width="fill" target="backtrack.chams.ticks" label="Chams Amount" tooltip="How many ticks to draw (WARNING, this can cause lag)"/>
<AutoVariable width="fill" target="backtrack.chams.color" label="Chams Color" tooltip="Color for the chams."/>
<AutoVariable width="fill" target="backtrack.chams.color.solid" label="Solid Color" tooltip="Draw a Solid color instead of tinting the model"/>

View File

@ -81,6 +81,10 @@ public:
// Check if backtrack is enabled
bool isBacktrackEnabled;
#if ENABLE_VISUALS
// Drawing Backtrack chams
bool isDrawing;
#endif
// Event callbacks
void CreateMove();
void CreateMoveLate();

View File

@ -179,6 +179,8 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod
return;
}
return original::DrawModelExecute(this_, state, info, bone);
// Don't do it when we are trying to enforce backtrack chams
if (!hacks::tf2::backtrack::backtrack.isDrawing)
return original::DrawModelExecute(this_, state, info, bone);
} // namespace hooked_methods
} // namespace hooked_methods

View File

@ -348,14 +348,34 @@ void EffectChams::Render(int x, int y, int w, int h)
PROF_SECTION(DRAW_chams);
if (!isHackActive() || disable_visuals)
return;
if (!effect_chams::enable)
if (!effect_chams::enable && !(hacks::tf2::backtrack::backtrack.chams && hacks::tf2::backtrack::backtrack.isBacktrackEnabled))
return;
if (g_Settings.bInvalid)
return;
if (!init)
if (!init && effect_chams::enable)
Init();
if (!isHackActive() || (g_IEngine->IsTakingScreenshot() && clean_screenshots))
return;
if (hacks::tf2::backtrack::backtrack.chams && hacks::tf2::backtrack::backtrack.isBacktrackEnabled)
{
CMatRenderContextPtr ptr(GET_RENDER_CONTEXT);
BeginRenderChams();
// Don't mark as normal chams drawing
drawing = false;
for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || i == g_IEngine->GetLocalPlayer() || !ent->m_bAlivePlayer() || ent->m_Type() != ENTITY_PLAYER)
continue;
// Entity won't draw in some cases so help the chams a bit
hacks::tf2::backtrack::backtrack.isDrawing = true;
RAW_ENT(ent)->DrawModel(1);
hacks::tf2::backtrack::backtrack.isDrawing = false;
}
EndRenderChams();
}
if (!effect_chams::enable)
return;
CMatRenderContextPtr ptr(GET_RENDER_CONTEXT);
BeginRenderChams();
for (int i = 1; i <= HIGHEST_ENTITY; i++)