Backtrack upgrade
This commit is contained in:
parent
c14cf74a32
commit
fe978996ce
@ -11,6 +11,8 @@
|
||||
|
||||
namespace hacks::shared::backtrack
|
||||
{
|
||||
extern settings::Int latency;
|
||||
|
||||
struct hitboxData
|
||||
{
|
||||
Vector center{ 0.0f, 0.0f, 0.0f };
|
||||
@ -38,7 +40,7 @@ struct BestTickData
|
||||
}
|
||||
};
|
||||
void Init();
|
||||
void AddLatencyToNetchan(INetChannel *, float);
|
||||
void AddLatencyToNetchan(INetChannel *);
|
||||
void UpdateIncomingSequences();
|
||||
extern int lastincomingsequencenumber;
|
||||
extern int BestTick;
|
||||
|
@ -17,6 +17,7 @@ time_t time_injected{ 0 };
|
||||
int g_AppID = 0;
|
||||
|
||||
ConVar *sv_client_min_interp_ratio;
|
||||
ConVar *sv_client_max_interp_ratio;
|
||||
ConVar *cl_interp_ratio;
|
||||
ConVar *cl_interp;
|
||||
ConVar *cl_interpolate;
|
||||
@ -29,6 +30,7 @@ int last_cmd_number = 0;
|
||||
void GlobalSettings::Init()
|
||||
{
|
||||
sv_client_min_interp_ratio = g_ICvar->FindVar("sv_client_min_interp_ratio");
|
||||
sv_client_max_interp_ratio = g_ICvar->FindVar("sv_client_max_interp_ratio");
|
||||
cl_interp_ratio = g_ICvar->FindVar("cl_interp_ratio");
|
||||
cl_interp = g_ICvar->FindVar("cl_interp");
|
||||
cl_interpolate = g_ICvar->FindVar("cl_interpolate");
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* AutoEquip.cpp
|
||||
*
|
||||
* Created on: Apr 26, 2018
|
||||
* Author: bencat07
|
||||
*/
|
||||
#include "common.hpp"
|
||||
|
||||
void CreateMove()
|
||||
{
|
||||
auto preset = g_ICvar->FindCommand("load_itempreset");
|
||||
const CCommand cmd;
|
||||
}
|
@ -18,12 +18,13 @@
|
||||
|
||||
static settings::Bool enable{ "backtrack.enable", "false" };
|
||||
static settings::Bool draw_bt{ "backtrack.draw", "false" };
|
||||
static settings::Int latency{ "backtrack.latency", "0" };
|
||||
static settings::Float mindistance{ "backtrack.min-distance", "60" };
|
||||
static settings::Int slots{ "backtrack.slots", "0" };
|
||||
|
||||
namespace hacks::shared::backtrack
|
||||
{
|
||||
settings::Int latency{ "backtrack.latency", "0" };
|
||||
|
||||
void EmptyBacktrackData(BacktrackData &i);
|
||||
std::pair<int, int> getBestEntBestTick();
|
||||
bool shouldBacktrack();
|
||||
@ -52,12 +53,14 @@ void UpdateIncomingSequences()
|
||||
sequences.pop_back();
|
||||
}
|
||||
}
|
||||
void AddLatencyToNetchan(INetChannel *ch, float Latency)
|
||||
void AddLatencyToNetchan(INetChannel *ch)
|
||||
{
|
||||
if (!isBacktrackEnabled)
|
||||
return;
|
||||
if (Latency > 200.0f)
|
||||
Latency -= ch->GetLatency(MAX_FLOWS);
|
||||
float Latency = *latency;
|
||||
Latency -= ch->GetAvgLatency(FLOW_OUTGOING) * 1000.0f;
|
||||
if (Latency < 0.0f)
|
||||
Latency = 0.0f;
|
||||
for (auto &seq : sequences)
|
||||
{
|
||||
if (g_GlobalVars->realtime - seq.curtime > Latency / 1000.0f)
|
||||
@ -251,10 +254,13 @@ bool shouldBacktrack()
|
||||
|
||||
float getLatency()
|
||||
{
|
||||
auto ch = (INetChannel *)g_IEngine->GetNetChannelInfo();
|
||||
auto ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
|
||||
if (!ch)
|
||||
return 0;
|
||||
return *latency - ch->GetLatency(MAX_FLOWS);
|
||||
float Latency = *latency - ch->GetLatency(FLOW_OUTGOING) * 1000.0f;
|
||||
if (Latency < 0.0f)
|
||||
Latency = 0.0f;
|
||||
return Latency;
|
||||
}
|
||||
|
||||
int getTicks()
|
||||
@ -264,24 +270,6 @@ int getTicks()
|
||||
|
||||
bool ValidTick(BacktrackData &i, CachedEntity *ent)
|
||||
{
|
||||
// TODO: Fix this func
|
||||
|
||||
// if (istickvalid[ent->m_IDX][i.index])
|
||||
// return true;
|
||||
// if (istickinvalid[ent->m_IDX][i.index])
|
||||
// return false;
|
||||
// if (IsVectorVisible(g_pLocalPlayer->v_Eye, i.hitboxes[head].center,
|
||||
// true))
|
||||
// if (fabsf(NET_FLOAT(RAW_ENT(ent), netvar.m_flSimulationTime) *
|
||||
// 1000.0f -
|
||||
// getLatency() - i.simtime * 1000.0f) <= 200.0f)
|
||||
// {
|
||||
// istickvalid[ent->m_IDX][i.index] = true;
|
||||
// return true;
|
||||
// }
|
||||
// istickinvalid[ent->m_IDX][i.index] = true;
|
||||
// return false;
|
||||
|
||||
if (!(fabsf(NET_FLOAT(RAW_ENT(ent), netvar.m_flSimulationTime) * 1000.0f - getLatency() - i.simtime * 1000.0f) < 200.0f))
|
||||
return false;
|
||||
return true;
|
||||
|
@ -16,7 +16,6 @@ target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/AutoBackstab.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/AutoDeadringer.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/AutoDetonator.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/AutoEquip.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/AutoHeal.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/AutoReflect.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/AutoSticky.cpp"
|
||||
|
@ -10,7 +10,7 @@ namespace hooked_methods
|
||||
{
|
||||
DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf)
|
||||
{
|
||||
if (!round(hacks::shared::backtrack::getLatency()))
|
||||
if (!round(*hacks::shared::backtrack::latency))
|
||||
return original::SendDatagram(ch, buf);
|
||||
int in = 0;
|
||||
int state = 0;
|
||||
@ -18,9 +18,7 @@ DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf)
|
||||
{
|
||||
in = ch->m_nInSequenceNr;
|
||||
state = ch->m_nInReliableState;
|
||||
|
||||
float latencysend = round((round((hacks::shared::backtrack::getLatency() - 0.5f) / 15.1515151515f) - 0.5f) * 15.1515151515f);
|
||||
hacks::shared::backtrack::AddLatencyToNetchan(ch, latencysend);
|
||||
hacks::shared::backtrack::AddLatencyToNetchan(ch);
|
||||
}
|
||||
|
||||
int ret = original::SendDatagram(ch, buf);
|
||||
|
Reference in New Issue
Block a user