Исходник LW Resolver but Slightly changed (Nothing Special I just got bored)

Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2022
Сообщения
112
Реакции[?]
9
Поинты[?]
2K
Resolver.cpp:
#include "animation_system.h"
#include "..\ragebot\aim.h"
#include "../visuals/player_esp.h"

/* Semi Fixed Resolver by Purlex */
void CResolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch)
{
    player=e;
    player_record = record;

    original_pitch = math::normalize_pitch(pitch);
    original_goal_feet_yaw = math::normalize_yaw(goal_feet_yaw);
}

void CResolver::initialize_yaw(player_t* e, adjust_data* record)
{
    player=e;
    player_record = record;

    player_record->left = b_yaw(player, player->m_angEyeAngles().y, 1);
    player_record->right = b_yaw(player, player->m_angEyeAngles().y, 2);
    player_record->middle = b_yaw(player, player->m_angEyeAngles().y, 3);
}

void CResolver::reset()
{
    player = nullptr;
    player_record = nullptr;

    side=false;
    fake=false;

    was_first_brute force = false;
    was_second_bruteforce = false;

    original_goal_feet_yaw = 0.0f;
    original_pitch=0.0f;
}

bool CResolver::IsAdjustingBalance()
{
    for (int i = 0; i < 15; i++)
    {
        const int activity = player->sequence_activity(player_record->layers[i].m_nSequence);
        if (activity == 979)
        {
            return true;
        }
    }
    return false;
}

bool CResolver::is_breaking_lby(AnimationLayer cur_layer, AnimationLayer prev_layer)
{
    if (IsAdjustingBalance())
    {
        if ((prev_layer.m_flCycle != cur_layer.m_flCycle) || cur_layer.m_flWeight == 1.f)
        {
            return true;
        }
        else if (cur_layer.m_flWeight == 0.f && (prev_layer.m_flCycle > 0.92f && cur_layer.m_flCycle > 0.92f))
        {
            return true;
        }
    }
    return false;
}

static auto GetSmoothedVelocity = [](float min_delta, Vector a, Vector b) {
    Vector delta = a - b;
    float delta_length = delta.Length();

    if (delta_length <= min_delta)
    {
        if (-min_delta <= delta_length)
            return a;
        else
        {
            float iradius = 1.0f / (delta_length + FLT_EPSILON);
            return b - ((delta * iradius) * min_delta);
        }
    }
    else
    {
        float iradius = 1.0f / (delta_length + FLT_EPSILON);
        return b + ((delta * iradius) * min_delta);
    }
};

inline float anglemod(float a)
{
    a = (360.f / 65536) * ((int)(a * (65536.f / 360.0f)) & 65535);
    return a;
}

float ApproachAngle(float target, float value, float speed)
{
    target = anglemod(target);
    value = anglemod(value);

    float delta = target - value;

    if (speed < 0)
        speed = -speed;

    if (delta < -180)
        delta += 360;
    else if (delta > 180)
        delta -= 360;

    if (delta > speed)
        value += speed;
    else if (delta < -speed)
        value -= speed;
    else
        value = target;

    return value;
}

float CResolver::b_yaw(player_t* entity, float original_yaw, int idk)
{
    float best_rotation = original_yaw;

    if (idk == 1)
    {
        for (int i = 1; i <= 8; i++)
        {
            float rotation = original_yaw - (45.f * i);

            if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) < 37.f)
            {
                best_rotation = rotation;
                break;
            }
            else if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) > 37.f)
            {
                best_rotation = rotation;
                break;
            }
        }
    }

    if (idk == 2)
    {
        for (int i = 1; i <= 8; i++)
        {
            float rotation = original_yaw + (45.f * i);

            if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) < 37.f)
            {
                best_rotation = rotation;
                break;
            }
            else if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) > 37.f)
            {
                best_rotation = rotation;
                break;
            }
        }
    }

    if (idk == 3)
    {
        if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) < 37.f)
        {
            best_rotation = original_yaw;
        }
        else if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) > 37.f)
        {
            best_rotation = original_yaw + 180.f;
        }
    }

    return best_rotation;
}

bool is_slow_walking(player_t* player)
{
    return player->m_vecVelocity().Length2D() <= (player->m_flMaxspeed() / 3);
}

int GetChokedPackets(player_t*player)
{
    if (player->m_flSimulationTime() > player->m_flOldSimulationTime())
        return TIME_TO_TICKS(fabsf(player->m_flSimulationTime() - player->m_flOldSimulationTime()));
    return 1;
}

void layer_test(player_t* player, adjust_data* record)
{
    if (player->GetAnimOverlay(3))
    {
        auto layers = player->GetAnimOverlays();
        auto activity = player->sequence_activity(layers[3].m_nSequence);

        //Using keyframes of act 979 causes issues while jumping
        if (activity == 979)
        {
            record->adjusting_balance = true;
        }

        //Check if player is breaking LBY by moving
        if (layers[3].m_flWeight < 0.1f && activity != 0)
        {
            record->breaking_lby = true;
        }
    }
}

void get_side_standing(player_t* player, float goal_feet_yaw, adjust_data* record)
{
    Vector velocity = player->m_vecVelocity();
    vector direction;
    Vector pivot = player->m_vecOrigin();

    math::angle_vectors(QAngle(0, goal_feet_yaw, 0), direction);

    float speed = velocity.Length2D();

    vector velocity_direction = velocity.Normalized();

    Vector side1, side2;
    VectorAngles(velocity_direction, side1);

    side2 = side1 + QAngle(0, 90, 0);

    vector newvec1, newvec2;
    AngleVectors(side1, &newvec1);
    AngleVectors(side2, &newvec2);

    newvec1 *= 45.f;
    newvec2 *= 45.f;

    Vector eye_pos = player->GetEyePos();

    Ray_tray;
    ray.Init(eye_pos, (eye_pos + (newvec1 + newvec2)).Length2D());

    trace_ttr;

    CTraceFilter traceFilter;
    traceFilter.pSkip = player;

    g_EngineTrace->TraceRay(ray, MASK_SHOT_BRUSHONLY, &traceFilter, &tr);

    Vector hitpoint = tr endpos;

    Ray_t ray1;
    ray1.Init(eye_pos, (eye_pos - (newvec1 + newvec2)).Length2D());

    g_EngineTrace->TraceRay(ray1, MASK_SHOT_BRUSHONLY, &traceFilter, &tr);

    if ((hitpoint - tr.endpos).Length() > 65.f)
    {
        // i take sides here incase some retard decides to use wallbug or something similar to that to fuck up the resolver. this avoids him fucking up the direction resolve so he gets his real head back.
        if ((velocity_direction.Dot(newvec1) > newvec2.Dot(velocity_direction)) && !record->bruteforce)
        {
            record->last_resolve_side = false;
            record->has_balance_adjusted = false;
            record->direction = newvec1;
        }
        else if ((velocity_direction.Dot(newvec1) < newvec2.Dot(velocity_direction)) && !record->bruteforce)
        {
            record->last_resolve_side = true;
            record->has_balance_adjusted = false;
            record->direction = newvec2;
        }
        else
        {
            record->has_balance_adjusted = true;
            record->direction = Vector(1, 0, 0);
        }
    }
    else
    {
        record->has_balance_adjusted = true;
        record->direction = Vector(1, 0, 0);
    }
}

void get_back(player_t* player, float goal_feet_yaw, adjust_data* record)
{
    Vector velocity = player->m_vecVelocity();
    vector direction;
    Vector pivot = player->m_vecOrigin();

    math::angle_vectors(QAngle(0, goal_feet_yaw, 0), direction);

    float speed = velocity.Length2D();

    vector velocity_direction = velocity.Normalized();

    Vector side1, side2;
    VectorAngles(velocity_direction, side1);

    side2 = side1 + QAngle(0, 180, 0);

    vector newvec1, newvec2;
    AngleVectors(side1, &newvec1);
    AngleVectors(side2, &newvec2);

    newvec1 *= 45.f;
    newvec2 *= 45.f;

    Vector eye_pos = player->GetEyePos();

    Ray_tray;
    ray.Init(eye_pos, (eye_pos + (newvec1 + newvec2)).Length2D());

    trace_ttr;

    CTraceFilter traceFilter;
    traceFilter.pSkip = player;

    g_EngineTrace->TraceRay(ray, MASK_SHOT_BRUSHONLY, &traceFilter, &tr);

    Vector hitpoint = tr endpos;

    Ray_t ray1;
    ray1.Init(eye_pos, (eye_pos - (newvec1 + newvec2)).Length2D());

    g_EngineTrace->TraceRay(ray1, MASK_SHOT_BRUSHONLY, &traceFilter, &tr);

    if ((hitpoint - tr.endpos).Length() > 65.f)
    {
        if ((velocity_direction.Dot(newvec1) > newvec2.Dot(velocity_direction)) && !record->bruteforce)
        {
            record->last_resolve_side = false;
            record->has_balance_adjusted = false;
            record->direction = newvec1;
        }
        else if ((velocity_direction.Dot(newvec1) < newvec2.Dot(velocity_direction)) && !record->bruteforce)
        {
            record->last_resolve_side = true;
            record->has_balance_adjusted = false;
            record->direction = newvec2;
        }
        else
        {
            record->has_balance_adjusted = true;
            record->direction = Vector(1, 0, 0);
        }
    }
    else
    {
        record->has_balance_adjusted = true;
        record->direction = Vector(1, 0, 0);
    }
}

float GetFeetYaw(player_t* player)
{
    if (!player)
        return 0.f;

    const float pose_param = player->m_flPoseParameter()[11];

    const float goal_feet_yaw = player->m_flLowerBodyYawTarget();

    return goal_feet_yaw;
}

float CResolver::ResolveYaw(player_t*player)
{
    if (!player)
        return 0.f;

    float yaw = player->m_angEyeAngles().y;

    adjust_data* record = &player_record[player->EntIndex()];

    if (!record)
        return yaw;

    float goal_feet_yaw = GetFeetYaw(player);

    if (record->adjusting_balance)
    {
        // Inverse lby breaker.
        if (record->breaking_lby && !record->bruteforce && !record->has_balance_adjusted)
        {
            get_side_standing(player, goal_feet_yaw, record);
        }

        if (record->last_resolve_side && record->has_balance_adjusted)
        {
            yaw = (goal_feet_yaw - 90.f) + 180.f;
        }
        else if (!record->last_resolve_side && record->has_balance_adjusted)
        {
            yaw = (goal_feet_yaw + 90.f) + 180.f;
        }
        else if (record->bruteforce && record->last_resolve_side && !record->has_balance_adjusted)
        {
            yaw = b_yaw(player, yaw, 1);
        }
        else if (record->bruteforce && !record->last_resolve_side && !record->has_balance_adjusted)
        {
            yaw = b_yaw(player, yaw, 2);
        }

        //Last resort.
        if (record->has_balance_adjusted && record->last_resolve_side)
        {
            yaw = (goal_feet_yaw - 90.f) + 180.f;
        }
        else if (record->has_balance_adjusted && !record->last_resolve_side)
        {
            yaw = (goal_feet_yaw + 90.f) + 180.f;
        }

        record->should_fake = true;
    }

    return yaw;
}

void CResolver::Resolve(player_t* player)
{
    if (!player)
        return;

    adjust_data* record = &player_record[player->EntIndex()];

    if (!record)
        return;

    record->should_fake = false;

    layer_test(player, record);

    if (player->GetAnimOverlay(3))
    {
        // player is using standup anim, check if it's breaking balance.
        if (is_breaking_lby(player->GetAnimOverlay(3), record->layers[3]))
        {
            record->adjusting_balance = true;
        }
        else
        {
            record->adjusting_balance = false;
        }
    }

    // pre-resolve
    if (!record->adjusting_balance)
    {
        record->last_resolve_side = false;
        record->should_fake = false;
    }
    else
    {
        // not standing
        if (!player->IsStanding())
        {
            // broke balance, apply yaw resolve
            if (record->breaking_lby)
            {
                if (record->has_balance_adjusted)
                {
                    if (record->last_resolve_side)
                    {
                        player->m_angEyeAngles().y = (record->yaw - 90.f) + 180.f;
                    }
                    else
                    {
                        player->m_angEyeAngles().y = (record->yaw + 90.f) + 180.f;
                    }
                }
                else if (record->bruteforce)
                {
                    if (record->last_resolve_side)
                    {
                        player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 1);
                    }
                    else
                    {
                        player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 2);
                    }
                }
            }

            record->should_fake = true;
        }
        else
        {
            // not moving
            if (!is_slow_walking(player))
            {
                if (!record->has_balance_adjusted && !record->bruteforce)
                {
                    if (record->last_resolve_side)
                    {
                        player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 1);
                    }
                    else
                    {
                        player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 2);
                    }
                }
                else if (record->has_balance_adjusted)
                {
                    if (record->last_resolve_side)
                    {
                        player->m_angEyeAngles().y = (record->yaw - 90.f) + 180.f;
                    }
                    else
                    {
                        player->m_angEyeAngles().y = (record->yaw + 90.f) + 180.f;
                    }
                }

                record->should_fake = true;
            }
            else
            {
                // balancing
                if (record->breaking_lby)
                {
                    record->should_fake = true;

                    // adjust balance
                    if (record->brute force)
                    {
                        if (!record->has_balance_adjusted)
                        {
                            if (record->last_resolve_side)
                            {
                                player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 1);
                            }
                            else
                            {
                                player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 2);
                            }
                        }
                    }
                    else
                    {
                        if (record->has_balance_adjusted)
                        {
                            if (record->last_resolve_side)
                            {
                                player->m_angEyeAngles().y = (record->yaw - 90.f) + 180.f;
                            }
                            else
                            {
                                player->m_angEyeAngles().y = (record->yaw + 90.f) + 180.f;
                            }
                        }
                    }
                }
            }
        }
    }
}

and tbh I already know its bad I didn't even test got to lazy its 4:23 AM

Maybe I'll actually take my time and help y'all legendware pasters with making a resolver :?
 
Skeet paster
Пользователь
Статус
Оффлайн
Регистрация
17 Фев 2021
Сообщения
149
Реакции[?]
40
Поинты[?]
4K
Обзор кода:

  1. Резольвер содержит класс CResolver, который имеет различные методы и функции для управления и решения проблемы разрешения угла камеры игрока.
  2. Метод initialize инициализирует резольвер с информацией о игроке, записях и целевом угле камеры.
  3. Метод initialize_yaw инициализирует резольвер только с информацией об игроке и записях, без целевого угла камеры.
  4. Метод reset сбрасывает состояние резольвера.
  5. Метод IsAdjustingBalance проверяет, находится ли игрок в процессе корректировки баланса.
  6. Метод is_breaking_lby проверяет, нарушает ли игрок баланс при выполнении анимации.
  7. Метод GetSmoothedVelocity возвращает сглаженное значение скорости игрока.
  8. Метод anglemod нормализует угол.
  9. Метод ApproachAngle возвращает новое значение угла, приближающееся к целевому значению с заданной скоростью.
  10. Метод b_yaw выполняет некоторую логику для разрешения угла камеры.
Улучшения и дополнения:

  1. Для полной функциональности резольвера требуется предоставить недостающие функции и классы, такие как player_t, adjust_data, math::normalize_pitch, math::normalize_yaw, и другие, чтобы понять полный контекст кода.
  2. Проверьте, правильно ли предоставленные функции и классы используются и взаимодействуют между собой. Убедитесь, что все необходимые зависимости добавлены и корректно настроены.
  3. Проверьте, есть ли в коде ошибки или опечатки, которые могут привести к непредвиденному поведению.
  4. Оптимизируйте код для лучшей производительности и эффективности.
  5. Добавьте комментарии к коду, чтобы было легче понять его назначение и функциональность
такое написал мне чат gpt XD
 
Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2022
Сообщения
112
Реакции[?]
9
Поинты[?]
2K
Code review:

  1. The resolver contains the CResolver class, which has various methods and functions to manage and solve the player's camera angle resolution problem.
  2. The initialize method initializes the resolver with information about the player, records, and the target camera angle.
  3. The initialize_yaw method initializes the resolver with only the player and records information, without the target camera angle.
  4. The reset method resets the state of the resolver.
  5. The IsAdjustingBalance method checks if the player is in the process of adjusting the balance.
  6. The is_breaking_lby method checks to see if the player is breaking balance when performing an animation.
  7. The GetSmoothedVelocity method returns the player's smoothed velocity value.
  8. The anglemod method normalizes the angle.
  9. The ApproachAngle method returns a new angle value approaching the target value at the specified rate.
  10. The b_yaw method does some logic to resolve the camera angle.
Improvements and additions:

  1. Full resolver functionality requires providing missing functions and classes such as player_t, adjust_data, math::normalize_pitch, math::normalize_yaw, and others to understand the full context of the code.
  2. Check if the provided functions and classes are used and interoperate correctly. Make sure all required dependencies are added and configured correctly.
  3. Check for bugs or typos in your code that could lead to unexpected behavior.
  4. Optimize your code for better performance and efficiency.
  5. Add comments to the code to make it easier to understand its purpose and functionality.
gpt chat wrote me this XD
if you ask an AI to explain this to you its gonna give you the exact same thing you just gave, I spent about 35 minutes-1hr 1/2 just messing around, this isn't an actually resolver......and half the shit thats in the code was already there lmao, just added a maybe 280 lines the other 276 lines were already there. But hey, asking an AI to explain what the functions of this do, it will tell you maybe use your brain next time ig?
I just asked it to explain what the code does and it kinda matches what you gave....what were you tryna achieve?
cht.pngChatGPT.png
 
Последнее редактирование:
Эксперт
Статус
Оффлайн
Регистрация
30 Дек 2019
Сообщения
1,967
Реакции[?]
955
Поинты[?]
17K
как вы заебали со своими пастами легендвара, от того что вы спастили весь паблик к себе, он нихуя не станет лучше. удалите вы это говно 4 летней давности
 
Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2022
Сообщения
112
Реакции[?]
9
Поинты[?]
2K
Эксперт
Статус
Оффлайн
Регистрация
29 Мар 2021
Сообщения
1,414
Реакции[?]
522
Поинты[?]
66K
зачем нам конструктор если мы можем ::initialize() пиздануть?? а??? а???
 
helicopter aa unofficial dev
Пользователь
Статус
Оффлайн
Регистрация
4 Апр 2021
Сообщения
412
Реакции[?]
72
Поинты[?]
6K
хд, ии прикольный код дал (почему я уверен, что он всяко лучше кода тса)
C++:
#include <cmath>
#include <iostream>

float NormalizeAngle(float angle)
{
    while (angle > 180.0f)
        angle -= 360.0f;
    while (angle < -180.0f)
        angle += 360.0f;
    return angle;
}

float ApproachAngle(float target, float value, float speed)
{
    float delta = NormalizeAngle(target - value);
    if (delta > speed)
        value += speed;
    else if (delta < -speed)
        value -= speed;
    else
        value = target;
    return NormalizeAngle(value);
}

void ResolveYaw(float& yaw, float lby, bool is_moving, bool on_ground, bool is_breaking_lby, bool is_balance_adjusting)
{
    const float resolve_yaw_offset = on_ground && is_breaking_lby && is_balance_adjusting ? 35.0f : 0.0f;

    if (is_moving || (is_breaking_lby && !is_balance_adjusting))
    {
        lby += resolve_yaw_offset;
    }
    else
    {
        static bool lby_updated = false;
        lby_updated = !lby_updated;
        lby = lby_updated ? lby + resolve_yaw_offset : lby;
    }

    float corrected_yaw = NormalizeAngle(lby - 180.0f);

    if (is_breaking_lby)
    {
        if (is_balance_adjusting)
            corrected_yaw = lby + resolve_yaw_offset;
        else
            corrected_yaw = NormalizeAngle(yaw - lby + resolve_yaw_offset);
    }

    yaw = ApproachAngle(corrected_yaw, yaw, 75.0f);
}

void ResolvePitch(float& pitch, float lby, float yaw)
{
    float yaw_delta = std::fabs(lby - yaw);

    if (yaw_delta < 35.0f)
        pitch = 0.0f;
    else if (yaw_delta < 135.0f)
        pitch = -180.0f;
    else
        pitch = 0.0f;
}

int main()
{
    // Пример использования резольвера

    // Входные данные
    float yaw = 90.0f; // Текущий угол поворота игрока
    float pitch = 0.0f; // Текущий угол наклона игрока
    float lby = 180.0f; // Угол поворота нижнего тела игрока (Lower Body Yaw)
    bool is_moving = true; // Игрок движется?
    bool on_ground = true; // Игрок на земле?
    bool is_breaking_lby = true; // Игрок "ломает" Lower Body Yaw?
    bool is_balance_adjusting = false; // Игрок выполняет коррекцию баланса?

    // Вызов функций резольвера для коррекции углов
    ResolveYaw(yaw, lby, is_moving, on_ground, is_breaking_lby, is_balance_adjusting);
    ResolvePitch(pitch, lby, yaw);

    // Вывод результатов
    std::cout << "Corrected Yaw: " << yaw << std::endl;
    std::cout << "Corrected Pitch: " << pitch << std::endl;

    return 0;
}
 
Feel TheSense
Забаненный
Статус
Оффлайн
Регистрация
20 Май 2023
Сообщения
89
Реакции[?]
23
Поинты[?]
5K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
хд, ии прикольный код дал (почему я уверен, что он всяко лучше кода тса)
C++:
#include <cmath>
#include <iostream>

float NormalizeAngle(float angle)
{
    while (angle > 180.0f)
        angle -= 360.0f;
    while (angle < -180.0f)
        angle += 360.0f;
    return angle;
}

float ApproachAngle(float target, float value, float speed)
{
    float delta = NormalizeAngle(target - value);
    if (delta > speed)
        value += speed;
    else if (delta < -speed)
        value -= speed;
    else
        value = target;
    return NormalizeAngle(value);
}

void ResolveYaw(float& yaw, float lby, bool is_moving, bool on_ground, bool is_breaking_lby, bool is_balance_adjusting)
{
    const float resolve_yaw_offset = on_ground && is_breaking_lby && is_balance_adjusting ? 35.0f : 0.0f;

    if (is_moving || (is_breaking_lby && !is_balance_adjusting))
    {
        lby += resolve_yaw_offset;
    }
    else
    {
        static bool lby_updated = false;
        lby_updated = !lby_updated;
        lby = lby_updated ? lby + resolve_yaw_offset : lby;
    }

    float corrected_yaw = NormalizeAngle(lby - 180.0f);

    if (is_breaking_lby)
    {
        if (is_balance_adjusting)
            corrected_yaw = lby + resolve_yaw_offset;
        else
            corrected_yaw = NormalizeAngle(yaw - lby + resolve_yaw_offset);
    }

    yaw = ApproachAngle(corrected_yaw, yaw, 75.0f);
}

void ResolvePitch(float& pitch, float lby, float yaw)
{
    float yaw_delta = std::fabs(lby - yaw);

    if (yaw_delta < 35.0f)
        pitch = 0.0f;
    else if (yaw_delta < 135.0f)
        pitch = -180.0f;
    else
        pitch = 0.0f;
}

int main()
{
    // Пример использования резольвера

    // Входные данные
    float yaw = 90.0f; // Текущий угол поворота игрока
    float pitch = 0.0f; // Текущий угол наклона игрока
    float lby = 180.0f; // Угол поворота нижнего тела игрока (Lower Body Yaw)
    bool is_moving = true; // Игрок движется?
    bool on_ground = true; // Игрок на земле?
    bool is_breaking_lby = true; // Игрок "ломает" Lower Body Yaw?
    bool is_balance_adjusting = false; // Игрок выполняет коррекцию баланса?

    // Вызов функций резольвера для коррекции углов
    ResolveYaw(yaw, lby, is_moving, on_ground, is_breaking_lby, is_balance_adjusting);
    ResolvePitch(pitch, lby, yaw);

    // Вывод результатов
    std::cout << "Corrected Yaw: " << yaw << std::endl;
    std::cout << "Corrected Pitch: " << pitch << std::endl;

    return 0;
}
норм ресик под супримаси
 
Пользователь
Статус
Оффлайн
Регистрация
3 Июл 2021
Сообщения
824
Реакции[?]
93
Поинты[?]
10K
хд, ии прикольный код дал (почему я уверен, что он всяко лучше кода тса)
C++:
#include <cmath>
#include <iostream>

float NormalizeAngle(float angle)
{
    while (angle > 180.0f)
        angle -= 360.0f;
    while (angle < -180.0f)
        angle += 360.0f;
    return angle;
}

float ApproachAngle(float target, float value, float speed)
{
    float delta = NormalizeAngle(target - value);
    if (delta > speed)
        value += speed;
    else if (delta < -speed)
        value -= speed;
    else
        value = target;
    return NormalizeAngle(value);
}

void ResolveYaw(float& yaw, float lby, bool is_moving, bool on_ground, bool is_breaking_lby, bool is_balance_adjusting)
{
    const float resolve_yaw_offset = on_ground && is_breaking_lby && is_balance_adjusting ? 35.0f : 0.0f;

    if (is_moving || (is_breaking_lby && !is_balance_adjusting))
    {
        lby += resolve_yaw_offset;
    }
    else
    {
        static bool lby_updated = false;
        lby_updated = !lby_updated;
        lby = lby_updated ? lby + resolve_yaw_offset : lby;
    }

    float corrected_yaw = NormalizeAngle(lby - 180.0f);

    if (is_breaking_lby)
    {
        if (is_balance_adjusting)
            corrected_yaw = lby + resolve_yaw_offset;
        else
            corrected_yaw = NormalizeAngle(yaw - lby + resolve_yaw_offset);
    }

    yaw = ApproachAngle(corrected_yaw, yaw, 75.0f);
}

void ResolvePitch(float& pitch, float lby, float yaw)
{
    float yaw_delta = std::fabs(lby - yaw);

    if (yaw_delta < 35.0f)
        pitch = 0.0f;
    else if (yaw_delta < 135.0f)
        pitch = -180.0f;
    else
        pitch = 0.0f;
}

int main()
{
    // Пример использования резольвера

    // Входные данные
    float yaw = 90.0f; // Текущий угол поворота игрока
    float pitch = 0.0f; // Текущий угол наклона игрока
    float lby = 180.0f; // Угол поворота нижнего тела игрока (Lower Body Yaw)
    bool is_moving = true; // Игрок движется?
    bool on_ground = true; // Игрок на земле?
    bool is_breaking_lby = true; // Игрок "ломает" Lower Body Yaw?
    bool is_balance_adjusting = false; // Игрок выполняет коррекцию баланса?

    // Вызов функций резольвера для коррекции углов
    ResolveYaw(yaw, lby, is_moving, on_ground, is_breaking_lby, is_balance_adjusting);
    ResolvePitch(pitch, lby, yaw);

    // Вывод результатов
    std::cout << "Corrected Yaw: " << yaw << std::endl;
    std::cout << "Corrected Pitch: " << pitch << std::endl;

    return 0;
}
хз правильно или нет но должно фиксить джиттеры
C++:
void ResolveYaw(float& yaw, float lby, bool is_moving, bool on_ground, bool is_breaking_lby, bool is_balance_adjusting)

{

    const float resolve_yaw_offset = on_ground && is_breaking_lby && is_balance_adjusting ? 35.0f : 0.0f;



    if (is_moving || (is_breaking_lby && !is_balance_adjusting))

    {

        lby += resolve_yaw_offset;

    }

    else

    {

        static bool lby_updated = false;

        lby_updated = !lby_updated;

        lby = lby_updated ? lby + resolve_yaw_offset : lby;

    }



    float corrected_yaw = NormalizeAngle(lby - 180.0f);



    if (is_breaking_lby)

    {

        if (is_balance_adjusting)

            corrected_yaw = lby + resolve_yaw_offset;

        else

        {

            float delta = NormalizeAngle(yaw - lby + resolve_yaw_offset);

            if (std::fabs(delta) < 35.0f) // Check for jitter

                corrected_yaw = yaw;

            else

                corrected_yaw = delta;

        }

    }



    yaw = ApproachAngle(corrected_yaw, yaw, 75.0f);

}
 
HvH Legend
Пользователь
Статус
Оффлайн
Регистрация
23 Окт 2022
Сообщения
269
Реакции[?]
67
Поинты[?]
49K
Resolver.cpp:
#include "animation_system.h"
#include "..\ragebot\aim.h"
#include "../visuals/player_esp.h"

/* Semi Fixed Resolver by Purlex */
void CResolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch)
{
    player=e;
    player_record = record;

    original_pitch = math::normalize_pitch(pitch);
    original_goal_feet_yaw = math::normalize_yaw(goal_feet_yaw);
}

void CResolver::initialize_yaw(player_t* e, adjust_data* record)
{
    player=e;
    player_record = record;

    player_record->left = b_yaw(player, player->m_angEyeAngles().y, 1);
    player_record->right = b_yaw(player, player->m_angEyeAngles().y, 2);
    player_record->middle = b_yaw(player, player->m_angEyeAngles().y, 3);
}

void CResolver::reset()
{
    player = nullptr;
    player_record = nullptr;

    side=false;
    fake=false;

    was_first_brute force = false;
    was_second_bruteforce = false;

    original_goal_feet_yaw = 0.0f;
    original_pitch=0.0f;
}

bool CResolver::IsAdjustingBalance()
{
    for (int i = 0; i < 15; i++)
    {
        const int activity = player->sequence_activity(player_record->layers[i].m_nSequence);
        if (activity == 979)
        {
            return true;
        }
    }
    return false;
}

bool CResolver::is_breaking_lby(AnimationLayer cur_layer, AnimationLayer prev_layer)
{
    if (IsAdjustingBalance())
    {
        if ((prev_layer.m_flCycle != cur_layer.m_flCycle) || cur_layer.m_flWeight == 1.f)
        {
            return true;
        }
        else if (cur_layer.m_flWeight == 0.f && (prev_layer.m_flCycle > 0.92f && cur_layer.m_flCycle > 0.92f))
        {
            return true;
        }
    }
    return false;
}

static auto GetSmoothedVelocity = [](float min_delta, Vector a, Vector b) {
    Vector delta = a - b;
    float delta_length = delta.Length();

    if (delta_length <= min_delta)
    {
        if (-min_delta <= delta_length)
            return a;
        else
        {
            float iradius = 1.0f / (delta_length + FLT_EPSILON);
            return b - ((delta * iradius) * min_delta);
        }
    }
    else
    {
        float iradius = 1.0f / (delta_length + FLT_EPSILON);
        return b + ((delta * iradius) * min_delta);
    }
};

inline float anglemod(float a)
{
    a = (360.f / 65536) * ((int)(a * (65536.f / 360.0f)) & 65535);
    return a;
}

float ApproachAngle(float target, float value, float speed)
{
    target = anglemod(target);
    value = anglemod(value);

    float delta = target - value;

    if (speed < 0)
        speed = -speed;

    if (delta < -180)
        delta += 360;
    else if (delta > 180)
        delta -= 360;

    if (delta > speed)
        value += speed;
    else if (delta < -speed)
        value -= speed;
    else
        value = target;

    return value;
}

float CResolver::b_yaw(player_t* entity, float original_yaw, int idk)
{
    float best_rotation = original_yaw;

    if (idk == 1)
    {
        for (int i = 1; i <= 8; i++)
        {
            float rotation = original_yaw - (45.f * i);

            if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) < 37.f)
            {
                best_rotation = rotation;
                break;
            }
            else if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) > 37.f)
            {
                best_rotation = rotation;
                break;
            }
        }
    }

    if (idk == 2)
    {
        for (int i = 1; i <= 8; i++)
        {
            float rotation = original_yaw + (45.f * i);

            if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) < 37.f)
            {
                best_rotation = rotation;
                break;
            }
            else if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) > 37.f)
            {
                best_rotation = rotation;
                break;
            }
        }
    }

    if (idk == 3)
    {
        if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) < 37.f)
        {
            best_rotation = original_yaw;
        }
        else if (entity->CanUseHitboxes() && entity->GetHitboxPos(0).DistTo(entity->GetHitboxPos(4)) > 37.f)
        {
            best_rotation = original_yaw + 180.f;
        }
    }

    return best_rotation;
}

bool is_slow_walking(player_t* player)
{
    return player->m_vecVelocity().Length2D() <= (player->m_flMaxspeed() / 3);
}

int GetChokedPackets(player_t*player)
{
    if (player->m_flSimulationTime() > player->m_flOldSimulationTime())
        return TIME_TO_TICKS(fabsf(player->m_flSimulationTime() - player->m_flOldSimulationTime()));
    return 1;
}

void layer_test(player_t* player, adjust_data* record)
{
    if (player->GetAnimOverlay(3))
    {
        auto layers = player->GetAnimOverlays();
        auto activity = player->sequence_activity(layers[3].m_nSequence);

        //Using keyframes of act 979 causes issues while jumping
        if (activity == 979)
        {
            record->adjusting_balance = true;
        }

        //Check if player is breaking LBY by moving
        if (layers[3].m_flWeight < 0.1f && activity != 0)
        {
            record->breaking_lby = true;
        }
    }
}

void get_side_standing(player_t* player, float goal_feet_yaw, adjust_data* record)
{
    Vector velocity = player->m_vecVelocity();
    vector direction;
    Vector pivot = player->m_vecOrigin();

    math::angle_vectors(QAngle(0, goal_feet_yaw, 0), direction);

    float speed = velocity.Length2D();

    vector velocity_direction = velocity.Normalized();

    Vector side1, side2;
    VectorAngles(velocity_direction, side1);

    side2 = side1 + QAngle(0, 90, 0);

    vector newvec1, newvec2;
    AngleVectors(side1, &newvec1);
    AngleVectors(side2, &newvec2);

    newvec1 *= 45.f;
    newvec2 *= 45.f;

    Vector eye_pos = player->GetEyePos();

    Ray_tray;
    ray.Init(eye_pos, (eye_pos + (newvec1 + newvec2)).Length2D());

    trace_ttr;

    CTraceFilter traceFilter;
    traceFilter.pSkip = player;

    g_EngineTrace->TraceRay(ray, MASK_SHOT_BRUSHONLY, &traceFilter, &tr);

    Vector hitpoint = tr endpos;

    Ray_t ray1;
    ray1.Init(eye_pos, (eye_pos - (newvec1 + newvec2)).Length2D());

    g_EngineTrace->TraceRay(ray1, MASK_SHOT_BRUSHONLY, &traceFilter, &tr);

    if ((hitpoint - tr.endpos).Length() > 65.f)
    {
        // i take sides here incase some retard decides to use wallbug or something similar to that to fuck up the resolver. this avoids him fucking up the direction resolve so he gets his real head back.
        if ((velocity_direction.Dot(newvec1) > newvec2.Dot(velocity_direction)) && !record->bruteforce)
        {
            record->last_resolve_side = false;
            record->has_balance_adjusted = false;
            record->direction = newvec1;
        }
        else if ((velocity_direction.Dot(newvec1) < newvec2.Dot(velocity_direction)) && !record->bruteforce)
        {
            record->last_resolve_side = true;
            record->has_balance_adjusted = false;
            record->direction = newvec2;
        }
        else
        {
            record->has_balance_adjusted = true;
            record->direction = Vector(1, 0, 0);
        }
    }
    else
    {
        record->has_balance_adjusted = true;
        record->direction = Vector(1, 0, 0);
    }
}

void get_back(player_t* player, float goal_feet_yaw, adjust_data* record)
{
    Vector velocity = player->m_vecVelocity();
    vector direction;
    Vector pivot = player->m_vecOrigin();

    math::angle_vectors(QAngle(0, goal_feet_yaw, 0), direction);

    float speed = velocity.Length2D();

    vector velocity_direction = velocity.Normalized();

    Vector side1, side2;
    VectorAngles(velocity_direction, side1);

    side2 = side1 + QAngle(0, 180, 0);

    vector newvec1, newvec2;
    AngleVectors(side1, &newvec1);
    AngleVectors(side2, &newvec2);

    newvec1 *= 45.f;
    newvec2 *= 45.f;

    Vector eye_pos = player->GetEyePos();

    Ray_tray;
    ray.Init(eye_pos, (eye_pos + (newvec1 + newvec2)).Length2D());

    trace_ttr;

    CTraceFilter traceFilter;
    traceFilter.pSkip = player;

    g_EngineTrace->TraceRay(ray, MASK_SHOT_BRUSHONLY, &traceFilter, &tr);

    Vector hitpoint = tr endpos;

    Ray_t ray1;
    ray1.Init(eye_pos, (eye_pos - (newvec1 + newvec2)).Length2D());

    g_EngineTrace->TraceRay(ray1, MASK_SHOT_BRUSHONLY, &traceFilter, &tr);

    if ((hitpoint - tr.endpos).Length() > 65.f)
    {
        if ((velocity_direction.Dot(newvec1) > newvec2.Dot(velocity_direction)) && !record->bruteforce)
        {
            record->last_resolve_side = false;
            record->has_balance_adjusted = false;
            record->direction = newvec1;
        }
        else if ((velocity_direction.Dot(newvec1) < newvec2.Dot(velocity_direction)) && !record->bruteforce)
        {
            record->last_resolve_side = true;
            record->has_balance_adjusted = false;
            record->direction = newvec2;
        }
        else
        {
            record->has_balance_adjusted = true;
            record->direction = Vector(1, 0, 0);
        }
    }
    else
    {
        record->has_balance_adjusted = true;
        record->direction = Vector(1, 0, 0);
    }
}

float GetFeetYaw(player_t* player)
{
    if (!player)
        return 0.f;

    const float pose_param = player->m_flPoseParameter()[11];

    const float goal_feet_yaw = player->m_flLowerBodyYawTarget();

    return goal_feet_yaw;
}

float CResolver::ResolveYaw(player_t*player)
{
    if (!player)
        return 0.f;

    float yaw = player->m_angEyeAngles().y;

    adjust_data* record = &player_record[player->EntIndex()];

    if (!record)
        return yaw;

    float goal_feet_yaw = GetFeetYaw(player);

    if (record->adjusting_balance)
    {
        // Inverse lby breaker.
        if (record->breaking_lby && !record->bruteforce && !record->has_balance_adjusted)
        {
            get_side_standing(player, goal_feet_yaw, record);
        }

        if (record->last_resolve_side && record->has_balance_adjusted)
        {
            yaw = (goal_feet_yaw - 90.f) + 180.f;
        }
        else if (!record->last_resolve_side && record->has_balance_adjusted)
        {
            yaw = (goal_feet_yaw + 90.f) + 180.f;
        }
        else if (record->bruteforce && record->last_resolve_side && !record->has_balance_adjusted)
        {
            yaw = b_yaw(player, yaw, 1);
        }
        else if (record->bruteforce && !record->last_resolve_side && !record->has_balance_adjusted)
        {
            yaw = b_yaw(player, yaw, 2);
        }

        //Last resort.
        if (record->has_balance_adjusted && record->last_resolve_side)
        {
            yaw = (goal_feet_yaw - 90.f) + 180.f;
        }
        else if (record->has_balance_adjusted && !record->last_resolve_side)
        {
            yaw = (goal_feet_yaw + 90.f) + 180.f;
        }

        record->should_fake = true;
    }

    return yaw;
}

void CResolver::Resolve(player_t* player)
{
    if (!player)
        return;

    adjust_data* record = &player_record[player->EntIndex()];

    if (!record)
        return;

    record->should_fake = false;

    layer_test(player, record);

    if (player->GetAnimOverlay(3))
    {
        // player is using standup anim, check if it's breaking balance.
        if (is_breaking_lby(player->GetAnimOverlay(3), record->layers[3]))
        {
            record->adjusting_balance = true;
        }
        else
        {
            record->adjusting_balance = false;
        }
    }

    // pre-resolve
    if (!record->adjusting_balance)
    {
        record->last_resolve_side = false;
        record->should_fake = false;
    }
    else
    {
        // not standing
        if (!player->IsStanding())
        {
            // broke balance, apply yaw resolve
            if (record->breaking_lby)
            {
                if (record->has_balance_adjusted)
                {
                    if (record->last_resolve_side)
                    {
                        player->m_angEyeAngles().y = (record->yaw - 90.f) + 180.f;
                    }
                    else
                    {
                        player->m_angEyeAngles().y = (record->yaw + 90.f) + 180.f;
                    }
                }
                else if (record->bruteforce)
                {
                    if (record->last_resolve_side)
                    {
                        player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 1);
                    }
                    else
                    {
                        player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 2);
                    }
                }
            }

            record->should_fake = true;
        }
        else
        {
            // not moving
            if (!is_slow_walking(player))
            {
                if (!record->has_balance_adjusted && !record->bruteforce)
                {
                    if (record->last_resolve_side)
                    {
                        player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 1);
                    }
                    else
                    {
                        player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 2);
                    }
                }
                else if (record->has_balance_adjusted)
                {
                    if (record->last_resolve_side)
                    {
                        player->m_angEyeAngles().y = (record->yaw - 90.f) + 180.f;
                    }
                    else
                    {
                        player->m_angEyeAngles().y = (record->yaw + 90.f) + 180.f;
                    }
                }

                record->should_fake = true;
            }
            else
            {
                // balancing
                if (record->breaking_lby)
                {
                    record->should_fake = true;

                    // adjust balance
                    if (record->brute force)
                    {
                        if (!record->has_balance_adjusted)
                        {
                            if (record->last_resolve_side)
                            {
                                player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 1);
                            }
                            else
                            {
                                player->m_angEyeAngles().y = b_yaw(player, player->m_angEyeAngles().y, 2);
                            }
                        }
                    }
                    else
                    {
                        if (record->has_balance_adjusted)
                        {
                            if (record->last_resolve_side)
                            {
                                player->m_angEyeAngles().y = (record->yaw - 90.f) + 180.f;
                            }
                            else
                            {
                                player->m_angEyeAngles().y = (record->yaw + 90.f) + 180.f;
                            }
                        }
                    }
                }
            }
        }
    }
}

and tbh I already know its bad I didn't even test got to lazy its 4:23 AM

Maybe I'll actually take my time and help y'all legendware pasters with making a resolver :?
Как вы задолбали со своими недопастами. Этот рез намного хуже чем дефолтный рез лв3...Нет смысла делать что-то с этого софта, там всё уже давно померло, смиритесь. Лучше юзать вейв 2:CoolCat:
 
Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2022
Сообщения
112
Реакции[?]
9
Поинты[?]
2K
How did you get on with your mischief. This cut is much worse than the default cut lv3... It makes no sense to do something with this software, everything has died there a long time ago, accept it. Better use wave 2:CoolCat:
You clearly can't read titles of the forum post, I don't care for legendware source code I was bored...Please read before saying something usless
 
Сверху Снизу