diff --git a/TODO b/TODO index ae3b0d03..15f7c56a 100755 --- a/TODO +++ b/TODO @@ -26,7 +26,6 @@ No Trigger Mediguns // // More projectile weapons aimbot (wrap assassin, wrangler, airstrike) // // // // // // -Make building aimbot compensate for gravity on projectile weapons // // // // // // // // diff --git a/data/menu/nullifiedcat/misc/Misc2.xml b/data/menu/nullifiedcat/misc/Misc2.xml index c99a8fcf..856a3693 100755 --- a/data/menu/nullifiedcat/misc/Misc2.xml +++ b/data/menu/nullifiedcat/misc/Misc2.xml @@ -1,5 +1,6 @@ + \ No newline at end of file diff --git a/include/prediction.hpp b/include/prediction.hpp index 812faae9..96ee3a8b 100644 --- a/include/prediction.hpp +++ b/include/prediction.hpp @@ -17,6 +17,8 @@ Vector SimpleLatencyPrediction(CachedEntity *ent, int hb); bool PerformProjectilePrediction(CachedEntity *target, int hitbox); +Vector BuildingPrediction(CachedEntity *building, Vector vec, float speed, + float gravity); Vector ProjectilePrediction(CachedEntity *ent, int hb, float speed, float gravitymod, float entgmod); Vector ProjectilePrediction_Engine(CachedEntity *ent, int hb, float speed, diff --git a/include/visual/colors.hpp b/include/visual/colors.hpp index a6fc93b4..df598905 100644 --- a/include/visual/colors.hpp +++ b/include/visual/colors.hpp @@ -125,19 +125,19 @@ constexpr rgba_t empty = FromRGBA8(0, 0, 0, 0); constexpr rgba_t FromHSL(float h, float s, float v) { - if (s <= 0.0) + if (s <= 0.0f) { // < is bogus, just shuts up warnings return rgba_t{ v, v, v, 1.0f }; } float hh = h; - if (hh >= 360.0) - hh = 0.0; - hh /= 60.0; + if (hh >= 360.0f) + hh = 0.0f; + hh /= 60.0f; long i = long(hh); float ff = hh - i; - float p = v * (1.0 - s); - float q = v * (1.0 - (s * ff)); - float t = v * (1.0 - (s * (1.0 - ff))); + float p = v * (1.0f - s); + float q = v * (1.0f - (s * ff)); + float t = v * (1.0f - (s * (1.0f - ff))); switch (i) { @@ -149,7 +149,6 @@ constexpr rgba_t FromHSL(float h, float s, float v) return rgba_t{ p, v, t, 1.0f }; case 3: return rgba_t{ p, q, v, 1.0f }; - break; case 4: return rgba_t{ t, p, v, 1.0f }; case 5: diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 12447001..ef6b0c8f 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -438,8 +438,7 @@ bool IsTargetStateGood(CachedEntity *entity) { PROF_SECTION(PT_aimbot_targetstatecheck); - if (shouldBacktrack() && - entity->m_Type() != ENTITY_PLAYER) + if (shouldBacktrack() && entity->m_Type() != ENTITY_PLAYER) return false; // Checks for Players if (entity->m_Type() == ENTITY_PLAYER) @@ -827,7 +826,7 @@ void DoAutoshoot() // Release Sticky if > chargetime, 3.85 is the max second chargetime, // but we want a percent so here we go - if ((chargetime >= 3.85f / *sticky_autoshoot) && begansticky > 3) + if ((chargetime >= 3.85f * *sticky_autoshoot) && begansticky > 3) { current_user_cmd->buttons &= ~IN_ATTACK; hacks::shared::antiaim::SetSafeSpace(3); @@ -929,7 +928,8 @@ const Vector &PredictEntity(CachedEntity *entity) } else if (entity->m_Type() == ENTITY_BUILDING) { - result = GetBuildingPosition(entity); + result = BuildingPrediction(entity, GetBuildingPosition(entity), + cur_proj_speed, cur_proj_grav); // Other } else diff --git a/src/hacks/CMakeLists.txt b/src/hacks/CMakeLists.txt index 7112faf7..a95ed09f 100755 --- a/src/hacks/CMakeLists.txt +++ b/src/hacks/CMakeLists.txt @@ -7,6 +7,7 @@ if(NOT LagbotMode) target_sources(cathook PRIVATE "${CMAKE_CURRENT_LIST_DIR}/Achievement.cpp" "${CMAKE_CURRENT_LIST_DIR}/Aimbot.cpp" + "${CMAKE_CURRENT_LIST_DIR}/AimSandwich.cpp" "${CMAKE_CURRENT_LIST_DIR}/Announcer.cpp" "${CMAKE_CURRENT_LIST_DIR}/AntiAim.cpp" "${CMAKE_CURRENT_LIST_DIR}/AntiAntiAim.cpp" diff --git a/src/hacks/KillSay.cpp b/src/hacks/KillSay.cpp index dcfccf0d..9e80f3d2 100644 --- a/src/hacks/KillSay.cpp +++ b/src/hacks/KillSay.cpp @@ -58,14 +58,15 @@ std::string ComposeKillSay(IGameEvent *event) if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) return ""; std::string msg = source->at(rand() % source->size()); - if(source->size() != 1) + if (source->size() != 1) { - // checks if the killsays.txt file is not 1 line. 100% sure it's going to crash if it is. - while (msg == lastmsg) - { - msg = source->at(rand() % source->size()); - } - lastmsg = msg; + // checks if the killsays.txt file is not 1 line. 100% sure it's going + //to crash if it is. + while (msg == lastmsg) + { + msg = source->at(rand() % source->size()); + } + lastmsg = msg; } player_info_s info; g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info); diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index dd66909f..6a3e2082 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -26,7 +26,8 @@ static settings::Bool engine_pred{ "misc.engine-prediction", "false" }; static settings::Bool debug_projectiles{ "debug.projectiles", "false" }; static settings::Int semiauto{ "misc.semi-auto", "0" }; static settings::Int fakelag_amount{ "misc.fakelag", "0" }; -static settings::Bool auto_disguise{ "misc.autodisguise", "true" }; +static settings::Bool auto_disguise{ "misc.autodisguise", "false" }; +static settings::Bool fuckmode{ "misc.fuckmode", "false" }; class CMoveData; #if LAGBOT_MODE @@ -142,9 +143,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, { if (CE_GOOD(LOCAL_W) && minigun_jump && LOCAL_W->m_iClassID() == CL_CLASS(CTFMinigun)) - { CE_INT(LOCAL_W, netvar.iWeaponState) = 0; - } } #endif ret = original::CreateMove(this_, input_sample_time, cmd); @@ -201,6 +200,12 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, ipc::UpdateServerAddress(); #endif } + if (*fuckmode) + { + static int prevbuttons = 0; + current_user_cmd->buttons |= prevbuttons; + prevbuttons |= current_user_cmd->buttons; + } hooked_methods::CreateMove(); if (nolerp) diff --git a/src/hooks/visual/DrawModelExecute.cpp b/src/hooks/visual/DrawModelExecute.cpp index 3e7ea0fa..e8047549 100644 --- a/src/hooks/visual/DrawModelExecute.cpp +++ b/src/hooks/visual/DrawModelExecute.cpp @@ -55,17 +55,11 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, { IClientEntity *ent = unk->GetIClientEntity(); if (ent) - { if (ent->entindex() == spectator_target) - { return; - } - } if (ent && !effect_chams::g_EffectChams.drawing && effect_chams::g_EffectChams.ShouldRenderChams(ent)) - { return; - } } return original::DrawModelExecute(this_, state, info, bone); diff --git a/src/playerlist.cpp b/src/playerlist.cpp index 05379acf..cefe42bf 100644 --- a/src/playerlist.cpp +++ b/src/playerlist.cpp @@ -192,7 +192,8 @@ CatCommand pl_set_state( continue; std::string currname(info.name); std::replace(currname.begin(), currname.end(), ' ', '-'); - std::replace_if(currname.begin(), currname.end(),[](char x){return !isprint(x);}, '*'); + std::replace_if(currname.begin(), currname.end(), + [](char x) { return !isprint(x); }, '*'); if (currname.find(name) != 0) continue; id = i; @@ -259,7 +260,8 @@ static int cat_pl_set_state_completionCallback( continue; std::string name(info.name); std::replace(name.begin(), name.end(), ' ', '-'); - std::replace_if(name.begin(), name.end(),[](char x){return !isprint(x);}, '*'); + std::replace_if(name.begin(), name.end(), + [](char x) { return !isprint(x); }, '*'); names.push_back(name); } std::sort(names.begin(), names.end()); diff --git a/src/prediction.cpp b/src/prediction.cpp index 06ef1818..72d0eb38 100644 --- a/src/prediction.cpp +++ b/src/prediction.cpp @@ -256,7 +256,66 @@ Vector ProjectilePrediction_Engine(CachedEntity *ent, int hb, float speed, result.y - origin.y, result.z - origin.z);*/ return result; } +Vector BuildingPrediction(CachedEntity *building, Vector vec, float speed, + float gravity) +{ + if (!vec.z || CE_BAD(building)) + return Vector(); + Vector result = vec; + // if (not debug_pp_extrapolate) { + //} else { + // result = SimpleLatencyPrediction(ent, hb); + // + //} + float latency = g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + + g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_INCOMING); + if (speed == 0.0f) + return Vector(); + trace::filter_no_player.SetSelf(RAW_ENT(building)); + float dtg = DistanceToGround(vec); + // TODO ProjAim + float medianTime = g_pLocalPlayer->v_Eye.DistTo(result) / speed; + float range = 1.5f; + float currenttime = medianTime - range; + if (currenttime <= 0.0f) + currenttime = 0.01f; + float besttime = currenttime; + float mindelta = 65536.0f; + Vector bestpos = result; + int maxsteps = 300; + for (int steps = 0; steps < maxsteps; + steps++, currenttime += ((float) (2 * range) / (float) maxsteps)) + { + Vector curpos = result; + curpos += 0 * currenttime; + if (debug_pp_extrapolate) + { + curpos += 0 * currenttime * latency; + } + if (dtg > 0.0f) + { + curpos.z -= currenttime * currenttime * 400.0f * 0; + if (curpos.z < result.z - dtg) + curpos.z = result.z - dtg; + } + float rockettime = g_pLocalPlayer->v_Eye.DistTo(curpos) / speed; + if (debug_pp_rockettimeping) + rockettime += + g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING); + if (fabs(rockettime - currenttime) < mindelta) + { + besttime = currenttime; + bestpos = curpos; + mindelta = fabs(rockettime - currenttime); + } + } + if (debug_pp_rockettimeping) + besttime += g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING); + bestpos.z += (400 * besttime * besttime * gravity); + // S = at^2/2 ; t = sqrt(2S/a)*/ + return bestpos; +} Vector ProjectilePrediction(CachedEntity *ent, int hb, float speed, float gravitymod, float entgmod) { diff --git a/src/projlogging.cpp b/src/projlogging.cpp index 4f213533..2a092004 100644 --- a/src/projlogging.cpp +++ b/src/projlogging.cpp @@ -8,9 +8,9 @@ #include "projlogging.hpp" #include "common.hpp" +Vector prevloc[2048]{}; namespace projectile_logging { - void Update() { for (int i = 1; i < HIGHEST_ENTITY; i++) @@ -18,13 +18,31 @@ void Update() CachedEntity *ent = ENTITY(i); if (CE_BAD(ent)) continue; - if (ent->m_Type() == ENTITY_PROJECTILE) + const model_t *model = RAW_ENT(ent)->GetModel(); + bool issandwich = false; + if (model && tickcount % 33 == 0) { - int owner = CE_INT(ent, 0x894) & 0xFFF; + std::string model_name(g_IModelInfo->GetModelName(model)); + if (model_name.find("plate") != std::string::npos) + { + issandwich = true; + Vector abs_orig = RAW_ENT(ent)->GetAbsOrigin(); + float movement = prevloc[i].DistTo(abs_orig); + logging::Info("Sandwich movement: %f", movement); + prevloc[i] = abs_orig; + } + } + if (ent->m_Type() == ENTITY_PROJECTILE || issandwich) + { + /*int owner = CE_INT(ent, 0x894) & 0xFFF; if (owner != LOCAL_W->m_IDX) - continue; + continue;*/ if (tickcount % 20 == 0) { + Vector abs_orig = RAW_ENT(ent)->GetAbsOrigin(); + float movement = prevloc[i].DistTo(abs_orig); + logging::Info("movement: %f", movement); + prevloc[i] = abs_orig; const Vector &v = ent->m_vecVelocity; const Vector &a = ent->m_vecAcceleration; Vector eav;