Исходник Resolver legendware

Начинающий
Статус
Оффлайн
Регистрация
28 Дек 2020
Сообщения
239
Реакции[?]
20
Поинты[?]
3K
Код:
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

#include "animation_system.h"
#include "..\ragebot\aim.h"

void resolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch)
{
    player = e;
    player_record = record;

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

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

    side = false;
    fake = false;

    was_first_bruteforce = false;
    was_second_bruteforce = false;

    original_goal_feet_yaw = 0.0f;
    original_pitch = 0.0f;
}

void resolver::detect_side(player_t* player)
{
    float last_side = 0.0f;
    int last_detect_side = 0;

    if (last_side)
    {
        if (last_side != last_detect_side)
        {
            last_side = player->m_flLowerBodyYawTarget() * 0.574f;
        }
        else
        {
            last_side == player->m_flOldSimulationTime();
        }
    }
    else if (last_side)
    {
        last_detect_side = last_side;
    }
}

void resolver::resolve_yaw()
{

    float no_side = FLT_MAX;

    auto animstate = player->get_animation_state();

    AnimationLayer layers[15];
    AnimationLayer moveLayers[3][15];
    memcpy(moveLayers, player->get_animlayers(), sizeof(AnimationLayer) * 15);

    auto speed = player->m_vecVelocity().Length2D();
    auto resolving_way = 0;
    int m_side;

    if (speed <= 0.1f)
    {
        auto delta = math::AngleDiff(player->m_angEyeAngles().y, player->get_animation_state()->m_flGoalFeetYaw);

        if (layers[3].m_flWeight == 0.0f && layers[3].m_flCycle == 0.0f)
        {

            resolving_way = (math::AngleDiff(player->get_animation_state()->m_flEyeYaw, player->get_animation_state()->m_flGoalFeetYaw) <= 0.0) - 1;
        }
    }

    if (int(layers[12].m_flWeight * 1000.0f) == int(layers[6].m_flWeight * 1000.0f))
    {
        float firstDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[0][6].m_flPlaybackRate);

        float secondDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[2][6].m_flPlaybackRate);

        float thirdDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[1][6].m_flPlaybackRate);

        if (firstDelta < secondDelta || thirdDelta <= secondDelta || (secondDelta * 1000.0))
        {
            if (firstDelta >= thirdDelta && secondDelta > thirdDelta && !(thirdDelta * 1000.0))
            {
                m_side = 1;
            }
        }
        else
        {
            m_side = -1;
        }
    }



    if (m_side = -1)
    {

        animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
        switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
        {
        case 0:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
            break;
        case 1:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 30.f);
            break;
        }


    }
    else if (m_side = 1)
    {

        animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
        switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
        {
        case 0:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
            break;
        case 1:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 30.f);
            break;
        }
    }




    if (g_ctx.globals.missed_shots[player->EntIndex()] >= 2 || g_ctx.globals.missed_shots[player->EntIndex()] && aim::get().last_target[player->EntIndex()].record.type != LBY)
    {
        switch (last_side)
        {
        case RESOLVER_ORIGINAL:
            g_ctx.globals.missed_shots[player->EntIndex()] = 0;
            fake = true;
            break;
        case RESOLVER_ZERO:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_LOW_FIRST;

            was_first_bruteforce = false;
            was_second_bruteforce = false;
            return;
        case RESOLVER_FIRST:
            player_record->type = BRUTEFORCE;
            player_record->side = was_second_bruteforce ? RESOLVER_ZERO : RESOLVER_SECOND;

            was_first_bruteforce = true;
            return;
        case RESOLVER_SECOND:
            player_record->type = BRUTEFORCE;
            player_record->side = was_first_bruteforce ? RESOLVER_ZERO : RESOLVER_FIRST;

            was_second_bruteforce = true;
            return;
        case RESOLVER_LOW_FIRST:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_LOW_SECOND;
            return;
        case RESOLVER_LOW_SECOND:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_FIRST;
            return;
        }
    }

    

    if (!animstate)
    {
        player_record->side = RESOLVER_ORIGINAL;
        return;
    }

    auto delta = math::normalize_yaw(player->m_angEyeAngles().y - original_goal_feet_yaw);
    auto valid_lby = true;

    if (animstate->m_velocity > 0.1f || fabs(animstate->flUpVelocity) > 100.f)
        valid_lby = animstate->m_flTimeSinceStartedMoving < 0.22f;

    if (fabs(delta) > 30.0f && valid_lby)
    {
        if (g_ctx.globals.missed_shots[player->EntIndex()])
            delta = -delta;

        if (delta > 30.0f)
        {
            player_record->type = LBY;
            player_record->side = RESOLVER_FIRST;
        }
        else if (delta < -30.0f)
        {
            player_record->type = LBY;
            player_record->side = RESOLVER_SECOND;
        }
    }
    else
    {
        auto trace = false;

        if (m_globals()->m_curtime - lock_side > 2.0f)
        {
            auto first_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first), player, g_ctx.local());
            auto second_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second), player, g_ctx.local());

            if (first_visible != second_visible)
            {
                trace = true;
                side = second_visible;
                lock_side = m_globals()->m_curtime;
            }
            else
            {
                auto first_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first));
                auto second_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second));

                if (fabs(first_position - second_position) > 1.0f)
                    side = first_position > second_position;
            }
        }
        else
            trace = true;

        if (side)
        {
            player_record->type = trace ? TRACE : DIRECTIONAL;
            player_record->side = RESOLVER_FIRST;
        }
        else
        {
            player_record->type = trace ? TRACE : DIRECTIONAL;
            player_record->side = RESOLVER_SECOND;
        }
    }
}

float resolver::resolve_pitch()
{
    return original_pitch;
}
animation_system.h

Код:
#pragma once

#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"

enum
{
    MAIN,
    NONE,
    FIRST,
    SECOND
};

enum resolver_type
{
    ORIGINAL,
    BRUTEFORCE,
    LBY,
    TRACE,
    DIRECTIONAL
};

enum resolver_side
{
    RESOLVER_ORIGINAL,
    RESOLVER_ZERO,
    RESOLVER_FIRST,
    RESOLVER_SECOND,
    RESOLVER_LOW_FIRST,
    RESOLVER_LOW_SECOND
};

struct matrixes
{
    matrix3x4_t main[MAXSTUDIOBONES];
    matrix3x4_t zero[MAXSTUDIOBONES];
    matrix3x4_t first[MAXSTUDIOBONES];
    matrix3x4_t second[MAXSTUDIOBONES];
};

class adjust_data;


class resolver
{
    player_t* player = nullptr;
    adjust_data* player_record = nullptr;

    bool side = false;
    bool fake = false;
    bool was_first_bruteforce = false;
    bool was_second_bruteforce = false;

    float lock_side = 0.0f;
    float original_goal_feet_yaw = 0.0f;
    float original_pitch = 0.0f;
public:
    void initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch);
    void reset();
    void resolve_yaw();
    void detect_side(player_t* player);
    float resolve_pitch();

    resolver_side last_side = RESOLVER_ORIGINAL;
};
class adjust_data //-V730
{
public:
    player_t* player;
    int i;

    AnimationLayer layers[15];
    matrixes matrixes_data;

    resolver_type type;
    resolver_side side;

    bool invalid;
    bool immune;
    bool dormant;
    bool bot;
    bool shot;

    int flags;
    int bone_count;

    float simulation_time;
    float duck_amount;
    float lby;

    Vector angles;
    Vector abs_angles;
    Vector velocity;
    Vector origin;
    Vector mins;
    Vector maxs;

    adjust_data() //-V730
    {
        reset();
    }

    void reset()
    {
        player = nullptr;
        i = -1;

        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        immune = false;
        dormant = false;
        bot = false;
        shot = false;

        flags = 0;
        bone_count = 0;

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        lby = 0.0f;

        angles.Zero();
        abs_angles.Zero();
        velocity.Zero();
        origin.Zero();
        mins.Zero();
        maxs.Zero();
    }

    adjust_data(player_t* e, bool store = true)
    {
        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        store_data(e, store);
    }

    void store_data(player_t* e, bool store = true)
    {
        if (!e->is_alive())
            return;

        player = e;
        i = player->EntIndex();

        if (store)
        {
            memcpy(layers, e->get_animlayers(), e->animlayer_count() * sizeof(AnimationLayer));
            memcpy(matrixes_data.main, player->m_CachedBoneData().Base(), player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));
        }

        immune = player->m_bGunGameImmunity() || player->m_fFlags() & FL_FROZEN;
        dormant = player->IsDormant();

#if RELEASE
        player_info_t player_info;
        m_engine()->GetPlayerInfo(i, &player_info);

        bot = player_info.fakeplayer;
#else
        bot = false;
#endif
        shot = player->m_hActiveWeapon() && (player->m_hActiveWeapon()->m_fLastShotTime() == player->m_flSimulationTime());

        flags = player->m_fFlags();
        bone_count = player->m_CachedBoneData().Count();

        simulation_time = player->m_flSimulationTime();
        duck_amount = player->m_flDuckAmount();
        lby = player->m_flLowerBodyYawTarget();

        angles = player->m_angEyeAngles();
        abs_angles = player->GetAbsAngles();
        velocity = player->m_vecVelocity();
        origin = player->m_vecOrigin();
        mins = player->GetCollideable()->OBBMins();
        maxs = player->GetCollideable()->OBBMaxs();
    }

    void adjust_player()
    {
        if (!valid(false))
            return;

        memcpy(player->get_animlayers(), layers, player->animlayer_count() * sizeof(AnimationLayer));
        memcpy(player->m_CachedBoneData().Base(), matrixes_data.main, player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));

        player->m_fFlags() = flags;
        player->m_CachedBoneData().m_Size = bone_count;

        player->m_flSimulationTime() = simulation_time;
        player->m_flDuckAmount() = duck_amount;
        player->m_flLowerBodyYawTarget() = lby;

        player->m_angEyeAngles() = angles;
        player->set_abs_angles(abs_angles);
        player->m_vecVelocity() = velocity;
        player->m_vecOrigin() = origin;
        player->set_abs_origin(origin);
        player->GetCollideable()->OBBMins() = mins;
        player->GetCollideable()->OBBMaxs() = maxs;
    }

    bool valid(bool extra_checks = true)
    {
        if (!this) //-V704
            return false;

        if (i > 0)
            player = (player_t*)m_entitylist()->GetClientEntity(i);

        if (!player)
            return false;

        if (player->m_lifeState() != LIFE_ALIVE)
            return false;

        if (immune)
            return false;

        if (dormant)
            return false;

        if (!extra_checks)
            return true;

        if (invalid)
            return false;

        auto net_channel_info = m_engine()->GetNetChannelInfo();

        if (!net_channel_info)
            return false;

        static auto sv_maxunlag = m_cvar()->FindVar(crypt_str("sv_maxunlag"));

        auto outgoing = net_channel_info->GetLatency(FLOW_OUTGOING);
        auto incoming = net_channel_info->GetLatency(FLOW_INCOMING);

        auto correct = math::clamp(outgoing + incoming + util::get_interpolation(), 0.0f, sv_maxunlag->GetFloat());

        auto curtime = g_ctx.local()->is_alive() ? TICKS_TO_TIME(g_ctx.globals.fixed_tickbase) : m_globals()->m_curtime;
        auto delta_time = correct - (curtime - simulation_time);

        if (fabs(delta_time) > 0.2f)
            return false;

        auto extra_choke = 0;

        if (g_ctx.globals.fakeducking)
            extra_choke = 14 - m_clientstate()->iChokedCommands;

        auto server_tickcount = extra_choke + m_globals()->m_tickcount + TIME_TO_TICKS(outgoing + incoming);
        auto dead_time = (int)(TICKS_TO_TIME(server_tickcount) - sv_maxunlag->GetFloat());

        if (simulation_time < (float)dead_time)
            return false;

        return true;
    }
};

class optimized_adjust_data
{
public:
    int i;
    player_t* player;

    float simulation_time;
    float duck_amount;
    float speed;
    Vector angles;
    Vector origin;
    bool shot;

    optimized_adjust_data() //-V730
    {
        reset();
    }

    void reset()
    {
        i = 0;
        player = nullptr;

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        speed = 0.0f;
        shot = false;

        angles.Zero();
        origin.Zero();
    }
};

extern std::deque <adjust_data> player_records[65];

class lagcompensation : public singleton <lagcompensation>
{
public:
    void fsn(ClientFrameStage_t stage);
    bool valid(int i, player_t* e);
    void update_player_animations(player_t* e);
    void player_extrapolation(player_t* e, Vector& vecorigin, Vector& vecvelocity, int& fFlags, bool bOnGround, int ticks);
    resolver player_resolver[65];

    bool is_dormant[65];
    float previous_goal_feet_yaw[65];
};
 
На ваш бан.
Эксперт
Статус
Оффлайн
Регистрация
7 Дек 2020
Сообщения
1,453
Реакции[?]
434
Поинты[?]
36K
Код:
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

#include "animation_system.h"
#include "..\ragebot\aim.h"

void resolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch)
{
    player = e;
    player_record = record;

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

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

    side = false;
    fake = false;

    was_first_bruteforce = false;
    was_second_bruteforce = false;

    original_goal_feet_yaw = 0.0f;
    original_pitch = 0.0f;
}

void resolver::detect_side(player_t* player)
{
    float last_side = 0.0f;
    int last_detect_side = 0;

    if (last_side)
    {
        if (last_side != last_detect_side)
        {
            last_side = player->m_flLowerBodyYawTarget() * 0.574f;
        }
        else
        {
            last_side == player->m_flOldSimulationTime();
        }
    }
    else if (last_side)
    {
        last_detect_side = last_side;
    }
}

void resolver::resolve_yaw()
{

    float no_side = FLT_MAX;

    auto animstate = player->get_animation_state();

    AnimationLayer layers[15];
    AnimationLayer moveLayers[3][15];
    memcpy(moveLayers, player->get_animlayers(), sizeof(AnimationLayer) * 15);

    auto speed = player->m_vecVelocity().Length2D();
    auto resolving_way = 0;
    int m_side;

    if (speed <= 0.1f)
    {
        auto delta = math::AngleDiff(player->m_angEyeAngles().y, player->get_animation_state()->m_flGoalFeetYaw);

        if (layers[3].m_flWeight == 0.0f && layers[3].m_flCycle == 0.0f)
        {

            resolving_way = (math::AngleDiff(player->get_animation_state()->m_flEyeYaw, player->get_animation_state()->m_flGoalFeetYaw) <= 0.0) - 1;
        }
    }

    if (int(layers[12].m_flWeight * 1000.0f) == int(layers[6].m_flWeight * 1000.0f))
    {
        float firstDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[0][6].m_flPlaybackRate);

        float secondDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[2][6].m_flPlaybackRate);

        float thirdDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[1][6].m_flPlaybackRate);

        if (firstDelta < secondDelta || thirdDelta <= secondDelta || (secondDelta * 1000.0))
        {
            if (firstDelta >= thirdDelta && secondDelta > thirdDelta && !(thirdDelta * 1000.0))
            {
                m_side = 1;
            }
        }
        else
        {
            m_side = -1;
        }
    }



    if (m_side = -1)
    {

        animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
        switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
        {
        case 0:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
            break;
        case 1:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 30.f);
            break;
        }


    }
    else if (m_side = 1)
    {

        animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
        switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
        {
        case 0:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
            break;
        case 1:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 30.f);
            break;
        }
    }




    if (g_ctx.globals.missed_shots[player->EntIndex()] >= 2 || g_ctx.globals.missed_shots[player->EntIndex()] && aim::get().last_target[player->EntIndex()].record.type != LBY)
    {
        switch (last_side)
        {
        case RESOLVER_ORIGINAL:
            g_ctx.globals.missed_shots[player->EntIndex()] = 0;
            fake = true;
            break;
        case RESOLVER_ZERO:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_LOW_FIRST;

            was_first_bruteforce = false;
            was_second_bruteforce = false;
            return;
        case RESOLVER_FIRST:
            player_record->type = BRUTEFORCE;
            player_record->side = was_second_bruteforce ? RESOLVER_ZERO : RESOLVER_SECOND;

            was_first_bruteforce = true;
            return;
        case RESOLVER_SECOND:
            player_record->type = BRUTEFORCE;
            player_record->side = was_first_bruteforce ? RESOLVER_ZERO : RESOLVER_FIRST;

            was_second_bruteforce = true;
            return;
        case RESOLVER_LOW_FIRST:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_LOW_SECOND;
            return;
        case RESOLVER_LOW_SECOND:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_FIRST;
            return;
        }
    }

   

    if (!animstate)
    {
        player_record->side = RESOLVER_ORIGINAL;
        return;
    }

    auto delta = math::normalize_yaw(player->m_angEyeAngles().y - original_goal_feet_yaw);
    auto valid_lby = true;

    if (animstate->m_velocity > 0.1f || fabs(animstate->flUpVelocity) > 100.f)
        valid_lby = animstate->m_flTimeSinceStartedMoving < 0.22f;

    if (fabs(delta) > 30.0f && valid_lby)
    {
        if (g_ctx.globals.missed_shots[player->EntIndex()])
            delta = -delta;

        if (delta > 30.0f)
        {
            player_record->type = LBY;
            player_record->side = RESOLVER_FIRST;
        }
        else if (delta < -30.0f)
        {
            player_record->type = LBY;
            player_record->side = RESOLVER_SECOND;
        }
    }
    else
    {
        auto trace = false;

        if (m_globals()->m_curtime - lock_side > 2.0f)
        {
            auto first_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first), player, g_ctx.local());
            auto second_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second), player, g_ctx.local());

            if (first_visible != second_visible)
            {
                trace = true;
                side = second_visible;
                lock_side = m_globals()->m_curtime;
            }
            else
            {
                auto first_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first));
                auto second_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second));

                if (fabs(first_position - second_position) > 1.0f)
                    side = first_position > second_position;
            }
        }
        else
            trace = true;

        if (side)
        {
            player_record->type = trace ? TRACE : DIRECTIONAL;
            player_record->side = RESOLVER_FIRST;
        }
        else
        {
            player_record->type = trace ? TRACE : DIRECTIONAL;
            player_record->side = RESOLVER_SECOND;
        }
    }
}

float resolver::resolve_pitch()
{
    return original_pitch;
}
animation_system.h

Код:
#pragma once

#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"

enum
{
    MAIN,
    NONE,
    FIRST,
    SECOND
};

enum resolver_type
{
    ORIGINAL,
    BRUTEFORCE,
    LBY,
    TRACE,
    DIRECTIONAL
};

enum resolver_side
{
    RESOLVER_ORIGINAL,
    RESOLVER_ZERO,
    RESOLVER_FIRST,
    RESOLVER_SECOND,
    RESOLVER_LOW_FIRST,
    RESOLVER_LOW_SECOND
};

struct matrixes
{
    matrix3x4_t main[MAXSTUDIOBONES];
    matrix3x4_t zero[MAXSTUDIOBONES];
    matrix3x4_t first[MAXSTUDIOBONES];
    matrix3x4_t second[MAXSTUDIOBONES];
};

class adjust_data;


class resolver
{
    player_t* player = nullptr;
    adjust_data* player_record = nullptr;

    bool side = false;
    bool fake = false;
    bool was_first_bruteforce = false;
    bool was_second_bruteforce = false;

    float lock_side = 0.0f;
    float original_goal_feet_yaw = 0.0f;
    float original_pitch = 0.0f;
public:
    void initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch);
    void reset();
    void resolve_yaw();
    void detect_side(player_t* player);
    float resolve_pitch();

    resolver_side last_side = RESOLVER_ORIGINAL;
};
class adjust_data //-V730
{
public:
    player_t* player;
    int i;

    AnimationLayer layers[15];
    matrixes matrixes_data;

    resolver_type type;
    resolver_side side;

    bool invalid;
    bool immune;
    bool dormant;
    bool bot;
    bool shot;

    int flags;
    int bone_count;

    float simulation_time;
    float duck_amount;
    float lby;

    Vector angles;
    Vector abs_angles;
    Vector velocity;
    Vector origin;
    Vector mins;
    Vector maxs;

    adjust_data() //-V730
    {
        reset();
    }

    void reset()
    {
        player = nullptr;
        i = -1;

        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        immune = false;
        dormant = false;
        bot = false;
        shot = false;

        flags = 0;
        bone_count = 0;

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        lby = 0.0f;

        angles.Zero();
        abs_angles.Zero();
        velocity.Zero();
        origin.Zero();
        mins.Zero();
        maxs.Zero();
    }

    adjust_data(player_t* e, bool store = true)
    {
        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        store_data(e, store);
    }

    void store_data(player_t* e, bool store = true)
    {
        if (!e->is_alive())
            return;

        player = e;
        i = player->EntIndex();

        if (store)
        {
            memcpy(layers, e->get_animlayers(), e->animlayer_count() * sizeof(AnimationLayer));
            memcpy(matrixes_data.main, player->m_CachedBoneData().Base(), player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));
        }

        immune = player->m_bGunGameImmunity() || player->m_fFlags() & FL_FROZEN;
        dormant = player->IsDormant();

#if RELEASE
        player_info_t player_info;
        m_engine()->GetPlayerInfo(i, &player_info);

        bot = player_info.fakeplayer;
#else
        bot = false;
#endif
        shot = player->m_hActiveWeapon() && (player->m_hActiveWeapon()->m_fLastShotTime() == player->m_flSimulationTime());

        flags = player->m_fFlags();
        bone_count = player->m_CachedBoneData().Count();

        simulation_time = player->m_flSimulationTime();
        duck_amount = player->m_flDuckAmount();
        lby = player->m_flLowerBodyYawTarget();

        angles = player->m_angEyeAngles();
        abs_angles = player->GetAbsAngles();
        velocity = player->m_vecVelocity();
        origin = player->m_vecOrigin();
        mins = player->GetCollideable()->OBBMins();
        maxs = player->GetCollideable()->OBBMaxs();
    }

    void adjust_player()
    {
        if (!valid(false))
            return;

        memcpy(player->get_animlayers(), layers, player->animlayer_count() * sizeof(AnimationLayer));
        memcpy(player->m_CachedBoneData().Base(), matrixes_data.main, player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));

        player->m_fFlags() = flags;
        player->m_CachedBoneData().m_Size = bone_count;

        player->m_flSimulationTime() = simulation_time;
        player->m_flDuckAmount() = duck_amount;
        player->m_flLowerBodyYawTarget() = lby;

        player->m_angEyeAngles() = angles;
        player->set_abs_angles(abs_angles);
        player->m_vecVelocity() = velocity;
        player->m_vecOrigin() = origin;
        player->set_abs_origin(origin);
        player->GetCollideable()->OBBMins() = mins;
        player->GetCollideable()->OBBMaxs() = maxs;
    }

    bool valid(bool extra_checks = true)
    {
        if (!this) //-V704
            return false;

        if (i > 0)
            player = (player_t*)m_entitylist()->GetClientEntity(i);

        if (!player)
            return false;

        if (player->m_lifeState() != LIFE_ALIVE)
            return false;

        if (immune)
            return false;

        if (dormant)
            return false;

        if (!extra_checks)
            return true;

        if (invalid)
            return false;

        auto net_channel_info = m_engine()->GetNetChannelInfo();

        if (!net_channel_info)
            return false;

        static auto sv_maxunlag = m_cvar()->FindVar(crypt_str("sv_maxunlag"));

        auto outgoing = net_channel_info->GetLatency(FLOW_OUTGOING);
        auto incoming = net_channel_info->GetLatency(FLOW_INCOMING);

        auto correct = math::clamp(outgoing + incoming + util::get_interpolation(), 0.0f, sv_maxunlag->GetFloat());

        auto curtime = g_ctx.local()->is_alive() ? TICKS_TO_TIME(g_ctx.globals.fixed_tickbase) : m_globals()->m_curtime;
        auto delta_time = correct - (curtime - simulation_time);

        if (fabs(delta_time) > 0.2f)
            return false;

        auto extra_choke = 0;

        if (g_ctx.globals.fakeducking)
            extra_choke = 14 - m_clientstate()->iChokedCommands;

        auto server_tickcount = extra_choke + m_globals()->m_tickcount + TIME_TO_TICKS(outgoing + incoming);
        auto dead_time = (int)(TICKS_TO_TIME(server_tickcount) - sv_maxunlag->GetFloat());

        if (simulation_time < (float)dead_time)
            return false;

        return true;
    }
};

class optimized_adjust_data
{
public:
    int i;
    player_t* player;

    float simulation_time;
    float duck_amount;
    float speed;
    Vector angles;
    Vector origin;
    bool shot;

    optimized_adjust_data() //-V730
    {
        reset();
    }

    void reset()
    {
        i = 0;
        player = nullptr;

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        speed = 0.0f;
        shot = false;

        angles.Zero();
        origin.Zero();
    }
};

extern std::deque <adjust_data> player_records[65];

class lagcompensation : public singleton <lagcompensation>
{
public:
    void fsn(ClientFrameStage_t stage);
    bool valid(int i, player_t* e);
    void update_player_animations(player_t* e);
    void player_extrapolation(player_t* e, Vector& vecorigin, Vector& vecvelocity, int& fFlags, bool bOnGround, int ticks);
    resolver player_resolver[65];

    bool is_dormant[65];
    float previous_goal_feet_yaw[65];
};
Нееет неет ну за что, боже???
 
Забаненный
Статус
Оффлайн
Регистрация
28 Янв 2021
Сообщения
137
Реакции[?]
17
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
kill me
Забаненный
Статус
Оффлайн
Регистрация
18 Дек 2018
Сообщения
365
Реакции[?]
70
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
КАЛЛЛ, ПРЯМ КАЛЛОМ ПАХНЕТ
 
Начинающий
Статус
Оффлайн
Регистрация
20 Май 2019
Сообщения
143
Реакции[?]
21
Поинты[?]
0
Модератор форума
Участник
Статус
Оффлайн
Регистрация
26 Янв 2020
Сообщения
378
Реакции[?]
157
Поинты[?]
9K
Забаненный
Статус
Оффлайн
Регистрация
28 Янв 2021
Сообщения
137
Реакции[?]
17
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Модератор форума
Участник
Статус
Оффлайн
Регистрация
26 Янв 2020
Сообщения
378
Реакции[?]
157
Поинты[?]
9K
Так это не мой рес, умник
сорри не тебе
Код:
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

#include "animation_system.h"
#include "..\ragebot\aim.h"

void resolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch)
{
    player = e;
    player_record = record;

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

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

    side = false;
    fake = false;

    was_first_bruteforce = false;
    was_second_bruteforce = false;

    original_goal_feet_yaw = 0.0f;
    original_pitch = 0.0f;
}

void resolver::detect_side(player_t* player)
{
    float last_side = 0.0f;
    int last_detect_side = 0;

    if (last_side)
    {
        if (last_side != last_detect_side)
        {
            last_side = player->m_flLowerBodyYawTarget() * 0.574f;
        }
        else
        {
            last_side == player->m_flOldSimulationTime();
        }
    }
    else if (last_side)
    {
        last_detect_side = last_side;
    }
}

void resolver::resolve_yaw()
{

    float no_side = FLT_MAX;

    auto animstate = player->get_animation_state();

    AnimationLayer layers[15];
    AnimationLayer moveLayers[3][15];
    memcpy(moveLayers, player->get_animlayers(), sizeof(AnimationLayer) * 15);

    auto speed = player->m_vecVelocity().Length2D();
    auto resolving_way = 0;
    int m_side;

    if (speed <= 0.1f)
    {
        auto delta = math::AngleDiff(player->m_angEyeAngles().y, player->get_animation_state()->m_flGoalFeetYaw);

        if (layers[3].m_flWeight == 0.0f && layers[3].m_flCycle == 0.0f)
        {

            resolving_way = (math::AngleDiff(player->get_animation_state()->m_flEyeYaw, player->get_animation_state()->m_flGoalFeetYaw) <= 0.0) - 1;
        }
    }

    if (int(layers[12].m_flWeight * 1000.0f) == int(layers[6].m_flWeight * 1000.0f))
    {
        float firstDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[0][6].m_flPlaybackRate);

        float secondDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[2][6].m_flPlaybackRate);

        float thirdDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[1][6].m_flPlaybackRate);

        if (firstDelta < secondDelta || thirdDelta <= secondDelta || (secondDelta * 1000.0))
        {
            if (firstDelta >= thirdDelta && secondDelta > thirdDelta && !(thirdDelta * 1000.0))
            {
                m_side = 1;
            }
        }
        else
        {
            m_side = -1;
        }
    }



    if (m_side = -1)
    {

        animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
        switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
        {
        case 0:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
            break;
        case 1:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 30.f);
            break;
        }


    }
    else if (m_side = 1)
    {

        animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
        switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
        {
        case 0:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
            break;
        case 1:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 30.f);
            break;
        }
    }




    if (g_ctx.globals.missed_shots[player->EntIndex()] >= 2 || g_ctx.globals.missed_shots[player->EntIndex()] && aim::get().last_target[player->EntIndex()].record.type != LBY)
    {
        switch (last_side)
        {
        case RESOLVER_ORIGINAL:
            g_ctx.globals.missed_shots[player->EntIndex()] = 0;
            fake = true;
            break;
        case RESOLVER_ZERO:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_LOW_FIRST;

            was_first_bruteforce = false;
            was_second_bruteforce = false;
            return;
        case RESOLVER_FIRST:
            player_record->type = BRUTEFORCE;
            player_record->side = was_second_bruteforce ? RESOLVER_ZERO : RESOLVER_SECOND;

            was_first_bruteforce = true;
            return;
        case RESOLVER_SECOND:
            player_record->type = BRUTEFORCE;
            player_record->side = was_first_bruteforce ? RESOLVER_ZERO : RESOLVER_FIRST;

            was_second_bruteforce = true;
            return;
        case RESOLVER_LOW_FIRST:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_LOW_SECOND;
            return;
        case RESOLVER_LOW_SECOND:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_FIRST;
            return;
        }
    }

   

    if (!animstate)
    {
        player_record->side = RESOLVER_ORIGINAL;
        return;
    }

    auto delta = math::normalize_yaw(player->m_angEyeAngles().y - original_goal_feet_yaw);
    auto valid_lby = true;

    if (animstate->m_velocity > 0.1f || fabs(animstate->flUpVelocity) > 100.f)
        valid_lby = animstate->m_flTimeSinceStartedMoving < 0.22f;

    if (fabs(delta) > 30.0f && valid_lby)
    {
        if (g_ctx.globals.missed_shots[player->EntIndex()])
            delta = -delta;

        if (delta > 30.0f)
        {
            player_record->type = LBY;
            player_record->side = RESOLVER_FIRST;
        }
        else if (delta < -30.0f)
        {
            player_record->type = LBY;
            player_record->side = RESOLVER_SECOND;
        }
    }
    else
    {
        auto trace = false;

        if (m_globals()->m_curtime - lock_side > 2.0f)
        {
            auto first_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first), player, g_ctx.local());
            auto second_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second), player, g_ctx.local());

            if (first_visible != second_visible)
            {
                trace = true;
                side = second_visible;
                lock_side = m_globals()->m_curtime;
            }
            else
            {
                auto first_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first));
                auto second_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second));

                if (fabs(first_position - second_position) > 1.0f)
                    side = first_position > second_position;
            }
        }
        else
            trace = true;

        if (side)
        {
            player_record->type = trace ? TRACE : DIRECTIONAL;
            player_record->side = RESOLVER_FIRST;
        }
        else
        {
            player_record->type = trace ? TRACE : DIRECTIONAL;
            player_record->side = RESOLVER_SECOND;
        }
    }
}

float resolver::resolve_pitch()
{
    return original_pitch;
}
animation_system.h

Код:
#pragma once

#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"

enum
{
    MAIN,
    NONE,
    FIRST,
    SECOND
};

enum resolver_type
{
    ORIGINAL,
    BRUTEFORCE,
    LBY,
    TRACE,
    DIRECTIONAL
};

enum resolver_side
{
    RESOLVER_ORIGINAL,
    RESOLVER_ZERO,
    RESOLVER_FIRST,
    RESOLVER_SECOND,
    RESOLVER_LOW_FIRST,
    RESOLVER_LOW_SECOND
};

struct matrixes
{
    matrix3x4_t main[MAXSTUDIOBONES];
    matrix3x4_t zero[MAXSTUDIOBONES];
    matrix3x4_t first[MAXSTUDIOBONES];
    matrix3x4_t second[MAXSTUDIOBONES];
};

class adjust_data;


class resolver
{
    player_t* player = nullptr;
    adjust_data* player_record = nullptr;

    bool side = false;
    bool fake = false;
    bool was_first_bruteforce = false;
    bool was_second_bruteforce = false;

    float lock_side = 0.0f;
    float original_goal_feet_yaw = 0.0f;
    float original_pitch = 0.0f;
public:
    void initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch);
    void reset();
    void resolve_yaw();
    void detect_side(player_t* player);
    float resolve_pitch();

    resolver_side last_side = RESOLVER_ORIGINAL;
};
class adjust_data //-V730
{
public:
    player_t* player;
    int i;

    AnimationLayer layers[15];
    matrixes matrixes_data;

    resolver_type type;
    resolver_side side;

    bool invalid;
    bool immune;
    bool dormant;
    bool bot;
    bool shot;

    int flags;
    int bone_count;

    float simulation_time;
    float duck_amount;
    float lby;

    Vector angles;
    Vector abs_angles;
    Vector velocity;
    Vector origin;
    Vector mins;
    Vector maxs;

    adjust_data() //-V730
    {
        reset();
    }

    void reset()
    {
        player = nullptr;
        i = -1;

        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        immune = false;
        dormant = false;
        bot = false;
        shot = false;

        flags = 0;
        bone_count = 0;

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        lby = 0.0f;

        angles.Zero();
        abs_angles.Zero();
        velocity.Zero();
        origin.Zero();
        mins.Zero();
        maxs.Zero();
    }

    adjust_data(player_t* e, bool store = true)
    {
        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        store_data(e, store);
    }

    void store_data(player_t* e, bool store = true)
    {
        if (!e->is_alive())
            return;

        player = e;
        i = player->EntIndex();

        if (store)
        {
            memcpy(layers, e->get_animlayers(), e->animlayer_count() * sizeof(AnimationLayer));
            memcpy(matrixes_data.main, player->m_CachedBoneData().Base(), player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));
        }

        immune = player->m_bGunGameImmunity() || player->m_fFlags() & FL_FROZEN;
        dormant = player->IsDormant();

#if RELEASE
        player_info_t player_info;
        m_engine()->GetPlayerInfo(i, &player_info);

        bot = player_info.fakeplayer;
#else
        bot = false;
#endif
        shot = player->m_hActiveWeapon() && (player->m_hActiveWeapon()->m_fLastShotTime() == player->m_flSimulationTime());

        flags = player->m_fFlags();
        bone_count = player->m_CachedBoneData().Count();

        simulation_time = player->m_flSimulationTime();
        duck_amount = player->m_flDuckAmount();
        lby = player->m_flLowerBodyYawTarget();

        angles = player->m_angEyeAngles();
        abs_angles = player->GetAbsAngles();
        velocity = player->m_vecVelocity();
        origin = player->m_vecOrigin();
        mins = player->GetCollideable()->OBBMins();
        maxs = player->GetCollideable()->OBBMaxs();
    }

    void adjust_player()
    {
        if (!valid(false))
            return;

        memcpy(player->get_animlayers(), layers, player->animlayer_count() * sizeof(AnimationLayer));
        memcpy(player->m_CachedBoneData().Base(), matrixes_data.main, player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));

        player->m_fFlags() = flags;
        player->m_CachedBoneData().m_Size = bone_count;

        player->m_flSimulationTime() = simulation_time;
        player->m_flDuckAmount() = duck_amount;
        player->m_flLowerBodyYawTarget() = lby;

        player->m_angEyeAngles() = angles;
        player->set_abs_angles(abs_angles);
        player->m_vecVelocity() = velocity;
        player->m_vecOrigin() = origin;
        player->set_abs_origin(origin);
        player->GetCollideable()->OBBMins() = mins;
        player->GetCollideable()->OBBMaxs() = maxs;
    }

    bool valid(bool extra_checks = true)
    {
        if (!this) //-V704
            return false;

        if (i > 0)
            player = (player_t*)m_entitylist()->GetClientEntity(i);

        if (!player)
            return false;

        if (player->m_lifeState() != LIFE_ALIVE)
            return false;

        if (immune)
            return false;

        if (dormant)
            return false;

        if (!extra_checks)
            return true;

        if (invalid)
            return false;

        auto net_channel_info = m_engine()->GetNetChannelInfo();

        if (!net_channel_info)
            return false;

        static auto sv_maxunlag = m_cvar()->FindVar(crypt_str("sv_maxunlag"));

        auto outgoing = net_channel_info->GetLatency(FLOW_OUTGOING);
        auto incoming = net_channel_info->GetLatency(FLOW_INCOMING);

        auto correct = math::clamp(outgoing + incoming + util::get_interpolation(), 0.0f, sv_maxunlag->GetFloat());

        auto curtime = g_ctx.local()->is_alive() ? TICKS_TO_TIME(g_ctx.globals.fixed_tickbase) : m_globals()->m_curtime;
        auto delta_time = correct - (curtime - simulation_time);

        if (fabs(delta_time) > 0.2f)
            return false;

        auto extra_choke = 0;

        if (g_ctx.globals.fakeducking)
            extra_choke = 14 - m_clientstate()->iChokedCommands;

        auto server_tickcount = extra_choke + m_globals()->m_tickcount + TIME_TO_TICKS(outgoing + incoming);
        auto dead_time = (int)(TICKS_TO_TIME(server_tickcount) - sv_maxunlag->GetFloat());

        if (simulation_time < (float)dead_time)
            return false;

        return true;
    }
};

class optimized_adjust_data
{
public:
    int i;
    player_t* player;

    float simulation_time;
    float duck_amount;
    float speed;
    Vector angles;
    Vector origin;
    bool shot;

    optimized_adjust_data() //-V730
    {
        reset();
    }

    void reset()
    {
        i = 0;
        player = nullptr;

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        speed = 0.0f;
        shot = false;

        angles.Zero();
        origin.Zero();
    }
};

extern std::deque <adjust_data> player_records[65];

class lagcompensation : public singleton <lagcompensation>
{
public:
    void fsn(ClientFrameStage_t stage);
    bool valid(int i, player_t* e);
    void update_player_animations(player_t* e);
    void player_extrapolation(player_t* e, Vector& vecorigin, Vector& vecvelocity, int& fFlags, bool bOnGround, int ticks);
    resolver player_resolver[65];

    bool is_dormant[65];
    float previous_goal_feet_yaw[65];
};
learcpp.com bro
 
Забаненный
Статус
Оффлайн
Регистрация
16 Янв 2021
Сообщения
12
Реакции[?]
1
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
go math.cpp and

C++:
float angle_diff(float destAngle, float srcAngle)
    {
        float delta;

        delta = fmodf(destAngle - srcAngle, 360.0f);
        if (destAngle > srcAngle)
        {
            if (delta >= 180)
                delta -= 360;
        }
        else
        {
            if (delta <= -180)
                delta += 360;
        }
        return delta;
    }
and math.hpp
C++:
float angle_diff(float destAngle, float srcAngle);
learncpp bro ha ha ha
 
Пользователь
Статус
Оффлайн
Регистрация
2 Фев 2019
Сообщения
242
Реакции[?]
34
Поинты[?]
2K
Код:
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

#include "animation_system.h"
#include "..\ragebot\aim.h"

void resolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch)
{
    player = e;
    player_record = record;

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

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

    side = false;
    fake = false;

    was_first_bruteforce = false;
    was_second_bruteforce = false;

    original_goal_feet_yaw = 0.0f;
    original_pitch = 0.0f;
}

void resolver::detect_side(player_t* player)
{
    float last_side = 0.0f;
    int last_detect_side = 0;

    if (last_side)
    {
        if (last_side != last_detect_side)
        {
            last_side = player->m_flLowerBodyYawTarget() * 0.574f;
        }
        else
        {
            last_side == player->m_flOldSimulationTime();
        }
    }
    else if (last_side)
    {
        last_detect_side = last_side;
    }
}

void resolver::resolve_yaw()
{

    float no_side = FLT_MAX;

    auto animstate = player->get_animation_state();

    AnimationLayer layers[15];
    AnimationLayer moveLayers[3][15];
    memcpy(moveLayers, player->get_animlayers(), sizeof(AnimationLayer) * 15);

    auto speed = player->m_vecVelocity().Length2D();
    auto resolving_way = 0;
    int m_side;

    if (speed <= 0.1f)
    {
        auto delta = math::AngleDiff(player->m_angEyeAngles().y, player->get_animation_state()->m_flGoalFeetYaw);

        if (layers[3].m_flWeight == 0.0f && layers[3].m_flCycle == 0.0f)
        {

            resolving_way = (math::AngleDiff(player->get_animation_state()->m_flEyeYaw, player->get_animation_state()->m_flGoalFeetYaw) <= 0.0) - 1;
        }
    }

    if (int(layers[12].m_flWeight * 1000.0f) == int(layers[6].m_flWeight * 1000.0f))
    {
        float firstDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[0][6].m_flPlaybackRate);

        float secondDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[2][6].m_flPlaybackRate);

        float thirdDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[1][6].m_flPlaybackRate);

        if (firstDelta < secondDelta || thirdDelta <= secondDelta || (secondDelta * 1000.0))
        {
            if (firstDelta >= thirdDelta && secondDelta > thirdDelta && !(thirdDelta * 1000.0))
            {
                m_side = 1;
            }
        }
        else
        {
            m_side = -1;
        }
    }



    if (m_side = -1)
    {

        animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
        switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
        {
        case 0:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
            break;
        case 1:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 30.f);
            break;
        }


    }
    else if (m_side = 1)
    {

        animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
        switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
        {
        case 0:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
            break;
        case 1:
            animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 30.f);
            break;
        }
    }




    if (g_ctx.globals.missed_shots[player->EntIndex()] >= 2 || g_ctx.globals.missed_shots[player->EntIndex()] && aim::get().last_target[player->EntIndex()].record.type != LBY)
    {
        switch (last_side)
        {
        case RESOLVER_ORIGINAL:
            g_ctx.globals.missed_shots[player->EntIndex()] = 0;
            fake = true;
            break;
        case RESOLVER_ZERO:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_LOW_FIRST;

            was_first_bruteforce = false;
            was_second_bruteforce = false;
            return;
        case RESOLVER_FIRST:
            player_record->type = BRUTEFORCE;
            player_record->side = was_second_bruteforce ? RESOLVER_ZERO : RESOLVER_SECOND;

            was_first_bruteforce = true;
            return;
        case RESOLVER_SECOND:
            player_record->type = BRUTEFORCE;
            player_record->side = was_first_bruteforce ? RESOLVER_ZERO : RESOLVER_FIRST;

            was_second_bruteforce = true;
            return;
        case RESOLVER_LOW_FIRST:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_LOW_SECOND;
            return;
        case RESOLVER_LOW_SECOND:
            player_record->type = BRUTEFORCE;
            player_record->side = RESOLVER_FIRST;
            return;
        }
    }

   

    if (!animstate)
    {
        player_record->side = RESOLVER_ORIGINAL;
        return;
    }

    auto delta = math::normalize_yaw(player->m_angEyeAngles().y - original_goal_feet_yaw);
    auto valid_lby = true;

    if (animstate->m_velocity > 0.1f || fabs(animstate->flUpVelocity) > 100.f)
        valid_lby = animstate->m_flTimeSinceStartedMoving < 0.22f;

    if (fabs(delta) > 30.0f && valid_lby)
    {
        if (g_ctx.globals.missed_shots[player->EntIndex()])
            delta = -delta;

        if (delta > 30.0f)
        {
            player_record->type = LBY;
            player_record->side = RESOLVER_FIRST;
        }
        else if (delta < -30.0f)
        {
            player_record->type = LBY;
            player_record->side = RESOLVER_SECOND;
        }
    }
    else
    {
        auto trace = false;

        if (m_globals()->m_curtime - lock_side > 2.0f)
        {
            auto first_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first), player, g_ctx.local());
            auto second_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second), player, g_ctx.local());

            if (first_visible != second_visible)
            {
                trace = true;
                side = second_visible;
                lock_side = m_globals()->m_curtime;
            }
            else
            {
                auto first_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first));
                auto second_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second));

                if (fabs(first_position - second_position) > 1.0f)
                    side = first_position > second_position;
            }
        }
        else
            trace = true;

        if (side)
        {
            player_record->type = trace ? TRACE : DIRECTIONAL;
            player_record->side = RESOLVER_FIRST;
        }
        else
        {
            player_record->type = trace ? TRACE : DIRECTIONAL;
            player_record->side = RESOLVER_SECOND;
        }
    }
}

float resolver::resolve_pitch()
{
    return original_pitch;
}
animation_system.h

Код:
#pragma once

#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"

enum
{
    MAIN,
    NONE,
    FIRST,
    SECOND
};

enum resolver_type
{
    ORIGINAL,
    BRUTEFORCE,
    LBY,
    TRACE,
    DIRECTIONAL
};

enum resolver_side
{
    RESOLVER_ORIGINAL,
    RESOLVER_ZERO,
    RESOLVER_FIRST,
    RESOLVER_SECOND,
    RESOLVER_LOW_FIRST,
    RESOLVER_LOW_SECOND
};

struct matrixes
{
    matrix3x4_t main[MAXSTUDIOBONES];
    matrix3x4_t zero[MAXSTUDIOBONES];
    matrix3x4_t first[MAXSTUDIOBONES];
    matrix3x4_t second[MAXSTUDIOBONES];
};

class adjust_data;


class resolver
{
    player_t* player = nullptr;
    adjust_data* player_record = nullptr;

    bool side = false;
    bool fake = false;
    bool was_first_bruteforce = false;
    bool was_second_bruteforce = false;

    float lock_side = 0.0f;
    float original_goal_feet_yaw = 0.0f;
    float original_pitch = 0.0f;
public:
    void initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch);
    void reset();
    void resolve_yaw();
    void detect_side(player_t* player);
    float resolve_pitch();

    resolver_side last_side = RESOLVER_ORIGINAL;
};
class adjust_data //-V730
{
public:
    player_t* player;
    int i;

    AnimationLayer layers[15];
    matrixes matrixes_data;

    resolver_type type;
    resolver_side side;

    bool invalid;
    bool immune;
    bool dormant;
    bool bot;
    bool shot;

    int flags;
    int bone_count;

    float simulation_time;
    float duck_amount;
    float lby;

    Vector angles;
    Vector abs_angles;
    Vector velocity;
    Vector origin;
    Vector mins;
    Vector maxs;

    adjust_data() //-V730
    {
        reset();
    }

    void reset()
    {
        player = nullptr;
        i = -1;

        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        immune = false;
        dormant = false;
        bot = false;
        shot = false;

        flags = 0;
        bone_count = 0;

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        lby = 0.0f;

        angles.Zero();
        abs_angles.Zero();
        velocity.Zero();
        origin.Zero();
        mins.Zero();
        maxs.Zero();
    }

    adjust_data(player_t* e, bool store = true)
    {
        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        store_data(e, store);
    }

    void store_data(player_t* e, bool store = true)
    {
        if (!e->is_alive())
            return;

        player = e;
        i = player->EntIndex();

        if (store)
        {
            memcpy(layers, e->get_animlayers(), e->animlayer_count() * sizeof(AnimationLayer));
            memcpy(matrixes_data.main, player->m_CachedBoneData().Base(), player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));
        }

        immune = player->m_bGunGameImmunity() || player->m_fFlags() & FL_FROZEN;
        dormant = player->IsDormant();

#if RELEASE
        player_info_t player_info;
        m_engine()->GetPlayerInfo(i, &player_info);

        bot = player_info.fakeplayer;
#else
        bot = false;
#endif
        shot = player->m_hActiveWeapon() && (player->m_hActiveWeapon()->m_fLastShotTime() == player->m_flSimulationTime());

        flags = player->m_fFlags();
        bone_count = player->m_CachedBoneData().Count();

        simulation_time = player->m_flSimulationTime();
        duck_amount = player->m_flDuckAmount();
        lby = player->m_flLowerBodyYawTarget();

        angles = player->m_angEyeAngles();
        abs_angles = player->GetAbsAngles();
        velocity = player->m_vecVelocity();
        origin = player->m_vecOrigin();
        mins = player->GetCollideable()->OBBMins();
        maxs = player->GetCollideable()->OBBMaxs();
    }

    void adjust_player()
    {
        if (!valid(false))
            return;

        memcpy(player->get_animlayers(), layers, player->animlayer_count() * sizeof(AnimationLayer));
        memcpy(player->m_CachedBoneData().Base(), matrixes_data.main, player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));

        player->m_fFlags() = flags;
        player->m_CachedBoneData().m_Size = bone_count;

        player->m_flSimulationTime() = simulation_time;
        player->m_flDuckAmount() = duck_amount;
        player->m_flLowerBodyYawTarget() = lby;

        player->m_angEyeAngles() = angles;
        player->set_abs_angles(abs_angles);
        player->m_vecVelocity() = velocity;
        player->m_vecOrigin() = origin;
        player->set_abs_origin(origin);
        player->GetCollideable()->OBBMins() = mins;
        player->GetCollideable()->OBBMaxs() = maxs;
    }

    bool valid(bool extra_checks = true)
    {
        if (!this) //-V704
            return false;

        if (i > 0)
            player = (player_t*)m_entitylist()->GetClientEntity(i);

        if (!player)
            return false;

        if (player->m_lifeState() != LIFE_ALIVE)
            return false;

        if (immune)
            return false;

        if (dormant)
            return false;

        if (!extra_checks)
            return true;

        if (invalid)
            return false;

        auto net_channel_info = m_engine()->GetNetChannelInfo();

        if (!net_channel_info)
            return false;

        static auto sv_maxunlag = m_cvar()->FindVar(crypt_str("sv_maxunlag"));

        auto outgoing = net_channel_info->GetLatency(FLOW_OUTGOING);
        auto incoming = net_channel_info->GetLatency(FLOW_INCOMING);

        auto correct = math::clamp(outgoing + incoming + util::get_interpolation(), 0.0f, sv_maxunlag->GetFloat());

        auto curtime = g_ctx.local()->is_alive() ? TICKS_TO_TIME(g_ctx.globals.fixed_tickbase) : m_globals()->m_curtime;
        auto delta_time = correct - (curtime - simulation_time);

        if (fabs(delta_time) > 0.2f)
            return false;

        auto extra_choke = 0;

        if (g_ctx.globals.fakeducking)
            extra_choke = 14 - m_clientstate()->iChokedCommands;

        auto server_tickcount = extra_choke + m_globals()->m_tickcount + TIME_TO_TICKS(outgoing + incoming);
        auto dead_time = (int)(TICKS_TO_TIME(server_tickcount) - sv_maxunlag->GetFloat());

        if (simulation_time < (float)dead_time)
            return false;

        return true;
    }
};

class optimized_adjust_data
{
public:
    int i;
    player_t* player;

    float simulation_time;
    float duck_amount;
    float speed;
    Vector angles;
    Vector origin;
    bool shot;

    optimized_adjust_data() //-V730
    {
        reset();
    }

    void reset()
    {
        i = 0;
        player = nullptr;

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        speed = 0.0f;
        shot = false;

        angles.Zero();
        origin.Zero();
    }
};

extern std::deque <adjust_data> player_records[65];

class lagcompensation : public singleton <lagcompensation>
{
public:
    void fsn(ClientFrameStage_t stage);
    bool valid(int i, player_t* e);
    void update_player_animations(player_t* e);
    void player_extrapolation(player_t* e, Vector& vecorigin, Vector& vecvelocity, int& fFlags, bool bOnGround, int ticks);
    resolver player_resolver[65];

    bool is_dormant[65];
    float previous_goal_feet_yaw[65];
};
что за кринж
 
Сверху Снизу