Fix issues addressed in pr

This commit is contained in:
BenCat07 2020-05-29 22:12:20 +02:00
parent 7fe05104a9
commit 61ecbc5609
3 changed files with 28 additions and 17 deletions

View File

@ -718,7 +718,7 @@ void AddCritString(const std::string &string, const rgba_t &color)
void DrawCritStrings()
{
// Positions, base on crit meter itself and draw Centered
float x = *bar_x + *size * 2.0f / 2.0f;
float x = *bar_x + *size;
float y = *bar_y + *size / 5.0f;
if (bar_string != "")

View File

@ -12,6 +12,7 @@ static settings::Boolean enable{ "anti-anti-aim.enable", "false" };
static settings::Boolean debug{ "anti-anti-aim.debug.enable", "false" };
std::unordered_map<unsigned, brutedata> resolver_map;
std::array<CachedEntity *, 32> sniperdot_array;
static inline void modifyAnlges()
{
@ -26,6 +27,26 @@ static inline void modifyAnlges()
angle.y = data.new_angle.y;
}
}
static inline void CreateMove()
{
// Empty the array
sniperdot_array.fill(0);
// Find sniper dots
for (int i = g_IEngine->GetMaxClients() + 1; i <= HIGHEST_ENTITY; i++)
{
CachedEntity *dot_ent = ENTITY(i);
// Not a sniper dot
if (CE_BAD(dot_ent) || dot_ent->m_iClassID() != CL_CLASS(CSniperDot))
continue;
// Get the player it belongs to
auto ent_idx = HandleToIDX(CE_INT(dot_ent, netvar.m_hOwnerEntity));
// IDX check
if (IDX_BAD(ent_idx) || ent_idx > sniperdot_array.size() || ent_idx <= 0)
continue;
// Good sniper dot, add to array
sniperdot_array.at(ent_idx - 1) = dot_ent;
}
}
void frameStageNotify(ClientFrameStage_t stage)
{
@ -68,7 +89,7 @@ static float resolveAnglePitch(float angle, brutedata &brute, CachedEntity *ent)
{
brute.original_angle.x = angle;
// Get SniperDot associated with entity if not already found
// Get CSniperDot associated with entity
CachedEntity *sniper_dot = nullptr;
// Get Weapon id
@ -81,19 +102,8 @@ static float resolveAnglePitch(float angle, brutedata &brute, CachedEntity *ent)
// Check weapon for validity
if (CE_GOOD(weapon_ent) && (weapon_ent->m_iClassID() == CL_CLASS(CTFSniperRifle) || weapon_ent->m_iClassID() == CL_CLASS(CTFSniperRifleDecap) || weapon_ent->m_iClassID() == CL_CLASS(CTFSniperRifleClassic)))
{
// Find sniper dot for this weapon
for (int i = g_IEngine->GetMaxClients() + 1; i <= HIGHEST_ENTITY; i++)
{
CachedEntity *dot_ent = ENTITY(i);
// Not a sniper dot
if (CE_BAD(dot_ent) || dot_ent->m_iClassID() != CL_CLASS(CSniperDot))
continue;
// Not the sniperdot of that entity
if (HandleToIDX(CE_INT(dot_ent, netvar.m_hOwnerEntity)) != ent->m_IDX)
continue;
// Found sniper dot
sniper_dot = dot_ent;
}
// Get Sniperdot
sniper_dot = sniperdot_array.at(ent->m_IDX - 1);
}
}
// No sniper dot/not using a sniperrifle.
@ -245,8 +255,9 @@ static void shutdown()
static InitRoutine init([]() {
hook();
EC::Register(EC::Shutdown, shutdown, "antiantiaim_shutdown");
EC::Register(EC::CreateMove, CreateMove, "cm_antiantiaim");
#if ENABLE_TEXTMODE
EC::Register(EC::CreateMove, modifyAnlges, "cm_antiantiaim");
EC::Register(EC::CreateMove, modifyAnlges, "cm_textmodeantiantiaim");
#endif
});
} // namespace hacks::shared::anti_anti_aim

View File

@ -215,7 +215,7 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, bf_read &
break;
}
std::vector<std::string> res = { "skid", "script", "cheat", "hak", "hac", "f1", "hax", "vac", "ban", "bot", "report", "kick", "h@x", "hcak", "chaet", "one" };
std::vector<std::string> res = { "skid", "script", "cheat", "hak", "hac", "f1", "hax", "vac", "ban", "bot", "report", "kick", "hcak", "chaet", "one" };
if (claz)
res.emplace_back(claz);