C++ My full resolver for lw

Пользователь
Статус
Оффлайн
Регистрация
9 Мар 2021
Сообщения
272
Реакции[?]
42
Поинты[?]
2K
делал с алкашкой в руках не судите это рофл ресольвер, но на скаут сервере что-то могу :roflanEbalo:
C++:
void resolver::resolve_yaw()
{

    if (fabs(original_pitch) > 85)
        fake = true;
    else if (!fake)
    {
        player_record->side = RESOLVER_ORIGINAL;
    }

    auto animstate = player->get_animation_state();

    if (!animstate)
        return;
    player_info_t player_info;

    if (!m_engine()->GetPlayerInfo(player->EntIndex(), &player_info) || !animstate || player_info.fakeplayer ||  !g_ctx.local()->is_alive() || player->m_iTeamNum() == g_ctx.local()->m_iTeamNum() || abs(TIME_TO_TICKS(player->m_flSimulationTime() - player->m_flOldSimulationTime()) - 1) )
    {
        player_record->side = RESOLVER_ORIGINAL;
        return;
    }
    Vector velocity = player->m_vecVelocity();
    
float flEyeYaw = player->m_angEyeAngles().y;
if (velocity.Length() > 1.1f || fabs(velocity.z) > 100.0f)
{
    original_goal_feet_yaw = ApproachAngle(
        flEyeYaw,
        original_goal_feet_yaw,
        ((animstate->m_bOnGround * 15.0f) + 30.0f) * m_clientstate()->m_choked_commands
    );
}
else
{
    original_goal_feet_yaw = ApproachAngle(
        player->m_flLowerBodyYawTarget(), original_goal_feet_yaw, m_clientstate()->m_choked_commands * 90.0f);
}
    auto animationstate = player->get_animation_state();
    auto entityindex = player->EntIndex() - 1;

    auto v7 = animationstate->m_flLastClientSideAnimationUpdateTime * 2000.0;
    auto velocityt = player->m_vecVelocity();
    velocityt.z = 0.0f;

    auto weapont = player->m_hActiveWeapon()->get_csweapon_info();

    float flMaxMovementSpeedt = 260.0f;
    if (weapont)
        flMaxMovementSpeedt = std::fmax(weapont->flMaxPlayerSpeed, 0.001f);

    auto m_flVelocityUnknown = *(float*)(uintptr_t(animationstate) + 0x2A4);

    
    
    float delta = animationstate->m_flLastClientSideAnimationUpdateTime * 60.0f;

    if (delta = 0.0f)
    {
        player->m_angEyeAngles().y = 90.0f;
        player->m_angEyeAngles().y = -90.0f;
    }
    bool bWasMovingLastUpdate = false;
    bool bJustStartedMovingLastUpdate = false;
    if (player->m_vecVelocity().Length2D() <= 0.0f)
    {
        animationstate->m_flTimeSinceStartedMoving = 0.0f;
        bWasMovingLastUpdate = animationstate->m_flTimeSinceStoppedMoving <= 0.0f;
        animationstate->m_flTimeSinceStoppedMoving += animationstate->m_flLastClientSideAnimationUpdateTime;
    }
    else
    {
        animationstate->m_flTimeSinceStoppedMoving = 0.0f;
        bJustStartedMovingLastUpdate = animationstate->m_flTimeSinceStartedMoving <= 0.0f;
        animationstate->m_flTimeSinceStartedMoving = animationstate->m_flLastClientSideAnimationUpdateTime + animationstate->m_flTimeSinceStartedMoving;
    }

    animationstate->m_flCurrentFeetYaw = animationstate->m_flGoalFeetYaw;

    auto v47 = std::clamp(animationstate->m_flGoalFeetYaw, -360.0f, 360.0f);
    auto v49 = math::normalize_yaw(AngleDiff(animationstate->m_flEyeYaw, v47));

    if (animationstate->m_flFeetSpeedForwardsOrSideWays >= 0.0)
        animationstate->m_flFeetSpeedForwardsOrSideWays = fminf(animationstate->m_flFeetSpeedForwardsOrSideWays, 1.0);
    else
        animationstate->m_flFeetSpeedForwardsOrSideWays = 0.0;

    auto v54 = animationstate->m_fDuckAmount;
    auto v55 = ((((*(float*)((uintptr_t)animationstate + 0x11C)) * -0.30000001) - 0.19999999) * animationstate->m_flFeetSpeedForwardsOrSideWays) + 1.0f;
    if (v54 > 0.0)
    {
        if (animationstate->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
            animationstate->m_flFeetSpeedUnknownForwardOrSideways = fminf(animationstate->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
        else
            animationstate->m_flFeetSpeedUnknownForwardOrSideways = 0.0;

        v55 += ((animationstate->m_flFeetSpeedUnknownForwardOrSideways * v54) * (0.5f - v55));
    }

    auto v58 = *(float*)((uintptr_t)animationstate + 0x334) * v55;
    auto v59 = *(float*)((uintptr_t)animationstate + 0x330) * v55;

    if (v49 <= v58)
    {
        if (v59 > v49)
            animationstate->m_flGoalFeetYaw = fabs(v59) + animationstate->m_flEyeYaw;
    }
    else
        animationstate->m_flGoalFeetYaw = animationstate->m_flEyeYaw - fabs(v58);

    animationstate->m_flGoalFeetYaw = math::normalize_yaw(animationstate->m_flGoalFeetYaw);

    if (player->m_vecVelocity().Length2D() > 1.1 || fabs(animationstate->flUpVelocity) > 100.0)
    {
        animationstate->m_flGoalFeetYaw = ApproachAngle(
            animationstate->m_flEyeYaw,
            animationstate->m_flGoalFeetYaw,
            (((*(float*)((uintptr_t)animationstate + 0x11C)) * 20.0f) + 30.0f)
            * animationstate->m_flLastClientSideAnimationUpdateTime);
    }
    else
    {
        animationstate->m_flGoalFeetYaw = ApproachAngle(
            player->m_flLowerBodyYawTarget(),
            animationstate->m_flGoalFeetYaw,
            animationstate->m_flLastClientSideAnimationUpdateTime * 100.0f);

    }

    bool  balance_adjust[128];

    if (player->m_vecVelocity().Length2D() <= 1.0
        && animationstate->m_bOnGround
        && animationstate->m_flLastClientSideAnimationUpdateTime > 0.0
        && (AngleDiff(animationstate->m_flCurrentFeetYaw, animationstate->m_flGoalFeetYaw) / animationstate->m_flLastClientSideAnimationUpdateTime) > 120.0)
    {
        balance_adjust[entityindex] = true;
    }
    else
        balance_adjust[entityindex] = false;

    if (player->m_vecVelocity().Length2D() > 0.0)
    {
        float velAngle = (atan2(-player->m_vecVelocity().y, -player->m_vecVelocity().x) * 180.0f) * (1.0f / M_PI);

        if (velAngle < 0.0f)
            velAngle += 360.0f;

        animationstate->m_flUnknownVelocityLean = math::normalize_yaw(AngleDiff(velAngle, animationstate->m_flGoalFeetYaw));
    }

    animationstate->m_flLeanAmount = math::normalize_yaw(AngleDiff(animationstate->m_flUnknownVelocityLean, animationstate->m_flCurrentTorsoYaw));

    if (bJustStartedMovingLastUpdate && animationstate->m_flFeetYawRate <= 0.0)
    {
        animationstate->m_flCurrentTorsoYaw = animationstate->m_flUnknownVelocityLean;
    }
    else
    {
        if (player->m_vecVelocity().Length2D() > 1.1f)
        {
            animationstate->m_flCurrentTorsoYaw = animationstate->m_flUnknownVelocityLean;
        }
        else
        {
            if (animationstate->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
                animationstate->m_flFeetSpeedUnknownForwardOrSideways = fminf(animationstate->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
            else
                animationstate->m_flFeetSpeedUnknownForwardOrSideways = 0.0;

            if (animationstate->m_flFeetSpeedForwardsOrSideWays >= 0.0)
                animationstate->m_flFeetSpeedForwardsOrSideWays = fminf(animationstate->m_flFeetSpeedForwardsOrSideWays, 1.0);
            else
                animationstate->m_flFeetSpeedForwardsOrSideWays = 0.0;

            //dword_10ADA7F8 = 1075729671;

            auto v105 = ((animationstate->m_flFeetSpeedUnknownForwardOrSideways - animationstate->m_flFeetSpeedForwardsOrSideWays) * animationstate->m_fDuckAmount) + animationstate->m_flFeetSpeedForwardsOrSideWays;
            auto v156 = math::normalize_yaw((((v105 + 1.1f) * animationstate->m_flUnknownVelocityLean) + animationstate->m_flCurrentTorsoYaw));

            animationstate->m_flCurrentTorsoYaw = v156;
        }
    }

    float eye_goalfeet_delta = AngleDiff(animationstate->m_flEyeYaw - animationstate->m_flGoalFeetYaw, 360.0f);
    float new_body_yaw_pose = 0.0f; //not initialized?

    if (eye_goalfeet_delta < 0.0f || v58 == 0.0f)
    {
        if (v59 != 0.0f)
            new_body_yaw_pose = (eye_goalfeet_delta / v59) * -60.0f;
    }
    else
    {
        new_body_yaw_pose = (eye_goalfeet_delta / v58) * 60.0f;
    }
    resolver* resolver_adjust;
    

    
    
    player_t* e;
    auto entity_index = e->EntIndex();

    auto entity_index2 = e->EntIndex() - 1;


    
const auto legitaa = animstate->m_flPitch < 20 && animstate->m_flPitch > -20 ;
//if(legitaa)
//{
//    player_record->side = RESOLVER_FIRST;
    //return;
//}


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 = side ? RESOLVER_LOW_FIRST : RESOLVER_LOW_SECOND;

        player_record->side = side ? RESOLVER_FIRST : RESOLVER_SECOND;

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

        was_first_bruteforce = true;

        was_first_low_bruteforce = false;
        was_second_low_bruteforce = false;
        return;
    case RESOLVER_SECOND:
        player_record->type = BRUTEFORCE;
        player_record->side = was_first_bruteforce ? (side ? RESOLVER_SECOND : RESOLVER_FIRST) : RESOLVER_LOW_FIRST;

        was_second_bruteforce = true;

        was_first_low_bruteforce = false;
        was_second_low_bruteforce = false;
        return;
    case RESOLVER_LOW_FIRST:
        player_record->type = BRUTEFORCE;
        player_record->side = was_second_low_bruteforce ? RESOLVER_LOW_SECOND : RESOLVER_LOW_FIRST;

        was_first_low_bruteforce = true;
        return;
    case RESOLVER_LOW_SECOND:
        player_record->type = BRUTEFORCE;
        player_record->side = was_first_low_bruteforce ? RESOLVER_LOW_FIRST : RESOLVER_LOW_SECOND;

        was_second_low_bruteforce = true;
        return;
    }
}

    
    if (legitaa)
    {







        
        for (int i = 1; i <= m_globals()->m_maxclients; i++) {
            player_t* entity;

            

            player_info_t player_info;


        
            auto anim_state = entity->get_animation_state();
            if (!anim_state)
                return;


        
                float final_feet_yaw = std::clamp(anim_state->m_flGoalFeetYaw, -180.f, 180.f);


                float old_feet_yaw = std::clamp(animstate->m_flFeetYawRate, -180.f, 180.f);

                float  eye_lby_delta = entity->m_angEyeAngles().y - entity->m_flLowerBodyYawTarget();


                if (fabs(eye_lby_delta > 35.f && entity->m_vecVelocity().Length2D() <= 2.f))
                {

                    final_feet_yaw += std::clamp(eye_lby_delta, -58.f, 58.f);


                    old_feet_yaw = final_feet_yaw;
                }


                anim_state->m_flGoalFeetYaw = final_feet_yaw;
                return;
            


        }
        
    }


bool m_bResolve;

    memcpy(resolver_adjust->resolver_layers, resolver_adjust->previous_layers, sizeof(AnimationLayer) * 13);
    float zero_goal_feet_yaw=0.0f;
    float move_delta=0.0f;
    side = 0;
    
    lagdata * lag_data;
    player->update_clientside_animation();
    
        if (player->m_fFlags() & FL_ONGROUND && animstate->m_flUpdateTimeDelta) {
            if (player->m_vecVelocity().Length2D() <= 1.1f) {
                if (resolver_adjust->previous_layers[3].m_flWeight == 0.0f && resolver_adjust->previous_layers[3].m_flCycle == 0.0f && resolver_adjust->previous_layers[6].m_flWeight == 0.0f && animstate->m_flUpdateTimeDelta) {

                    // detection side.
                    auto angle_difference_delta = math::angle_diff(animstate->m_flEyeYaw, zero_goal_feet_yaw);
                    side = (2 * (angle_difference_delta <= 0.0) - 1) ? 1 : -1;
                    float yaw = animstate->m_flGoalFeetYaw;
                    auto delta = AngleDiff(player->m_angEyeAngles().y, yaw);
                    auto positive_resolver = (2 * (delta <= 0.1f) - 1) > 0.1f;
                    side = positive_resolver ? 1 : -1;

                    side = math::clamp((2 * (delta <= 0.f) - 1), -1, 1);// copysign(1, delta);
                //lag_data->animations_updated = true;
                }
                else if ((abs(m_globals()->m_realtime) > 0.5f || resolver_adjust->previous_layers[7].m_flWeight >= 0.99f)
                    && int(resolver_adjust->resolver_layers[0][6].m_flCycle * 10000.f) == int(resolver_adjust->previous_layers[6].m_flCycle * 10000.f))
                {

                    float delta1 = abs(resolver_adjust->previous_layers[6].m_flPlaybackRate - resolver_adjust->resolver_layers[0][6].m_flPlaybackRate);

                    float delta2 = abs(resolver_adjust->previous_layers[6].m_flPlaybackRate - resolver_adjust->resolver_layers[2][6].m_flPlaybackRate);

                    float delta3 = abs(resolver_adjust->previous_layers[6].m_flPlaybackRate - resolver_adjust->resolver_layers[1][6].m_flPlaybackRate);

                    if (delta1 < delta3 || delta2 <= delta3 || (int)(float)(delta3 * 10000.0f))
                    {
                        if (delta1 >= delta2 && delta3 > delta2 && !(int)(float)(delta2 * 10000.0f))
                        {
                            side = 1;
                            lag_data->realtime = m_globals()->m_realtime;
                            m_bResolve = true;
                            //animstate->m_flGoalFeetYaw = math::NormalizedAngle(player->m_angEyeAngles().y + 60.f);//meme d1g
                            //negri pidori
                        }
                    }
                    else
                    {
                        side = -1;
                        lag_data->realtime = m_globals()->m_realtime;
                        m_bResolve = true;
                        //animstate->m_flGoalFeetYaw = math::NormalizedAngle(player->m_angEyeAngles().y - 60.f);//meme
                    }
                    memcpy(resolver_adjust->previous_layers, resolver_adjust->resolver_layers, move_delta), sizeof(AnimationLayer) * 13;
                    memcpy(resolver_adjust->previous_layers, resolver_adjust->resolver_layers, delta1), sizeof(AnimationLayer) * 13;
                    memcpy(resolver_adjust->previous_layers, resolver_adjust->resolver_layers, delta2), sizeof(AnimationLayer) * 13;
                    memcpy(resolver_adjust->previous_layers, resolver_adjust->resolver_layers, delta3), sizeof(AnimationLayer) * 13;

                    if (delta1 <= delta2)
                        move_delta = delta1;
                    else
                        move_delta = delta2;
                    if (move_delta > delta3)
                        move_delta = delta2;
                    if (!(delta1 * 10000.f) && (delta3 * 10000.f) != (delta2 * 10000.f))
                    {
                        if (move_delta == delta3)
                        {
                            //v56 = -v56;
                            delta2 = delta3;
                        }
                        else if (move_delta == delta2)
                        {
                            delta3 = delta2;
                        }
                    }
                    for (auto i = 0; i < 3; i++)
                    {
                        int max_delta = INT_MAX;
                        int best_side = -1;
                        auto anim_layer = player->get_animlayers();
                        int left_delta = -60;
                        int right_delta = 60;
                        auto resolver_layer = resolver_adjust->previous_layers;

                        if (resolver_layer->m_nSequence != anim_layer->m_nSequence
                            || resolver_layer->m_nOrder != anim_layer->m_nOrder)
                            continue;

                        auto delta = int(std::abs(anim_layer->m_flPlaybackRate - resolver_layer->m_flPlaybackRate) * 10000.f);
                        //auto wdelta = int(fabsf(anim_layer->m_flWeight - resolver_layer->m_flWeight) * 10000.f);

                        if (i == 2)
                            left_delta = delta;
                        else if (i == 1)
                            right_delta = delta;

                        if (max_delta > delta) {
                            max_delta = delta;
                            best_side = i;
                        }
                        if (best_side == -1)
                            return;

                        side = best_side;


                    }
                }
            }
            
        


        }
    
        
    
    
    
    auto standing = resolver_adjust->previous_layers[3].m_flWeight == 0 && resolver_adjust->previous_layers[3].m_flCycle == 0;
    if (standing)
    {
        if (!g_ctx.local()->is_alive())
            return;

        if (!g_ctx.globals.weapon)
            return;

        for (int i = 1; i < m_globals()->m_maxclients; ++i)
        {
            auto get_player = m_entitylist()->GetClientEntity(i);

            if (!player || !player->is_alive() || player->IsDormant() || player->m_iTeamNum() == g_ctx.local()->m_iTeamNum())
                continue;

            bool Autowalled = false, HitSide1 = false, HitSide2 = false;

            auto idx = player->EntIndex();

            float angToLocal = math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y;

            Vector ViewPoint = g_ctx.local()->m_vecOrigin() + Vector(0, 0, 90);
            Vector2D Side1 = { (45 * sin(DEG2RAD(angToLocal))),(45 * cos(DEG2RAD(angToLocal))) };
            Vector2D Side2 = { (45 * sin(DEG2RAD(angToLocal + 180))) ,(45 * cos(DEG2RAD(angToLocal + 180))) };

            Vector2D Side3 = { (50 * sin(DEG2RAD(angToLocal))),(50 * cos(DEG2RAD(angToLocal))) };
            Vector2D Side4 = { (50 * sin(DEG2RAD(angToLocal + 180))) ,(50 * cos(DEG2RAD(angToLocal + 180))) };

            Vector Origin = player->m_vecOrigin();

            Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };

            Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
            //const float FreestandSide[128];
            for (int side = 0; side < 2; side++)
            {
                Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x,  Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
                Vector ViewPointAutowall = { ViewPoint.x + OriginLeftRightLocal[side].x,  ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };

                if (CanHitFloatingPoint(OriginAutowall, ViewPoint))
                {
                    if (side == 0)
                    {
                        HitSide1 = true;
                        side = -1;
                    }
                    else if (side == 1)
                    {
                        HitSide2 = true;
                        side = 1;
                    }

                    Autowalled = true;
                }
                else
                {
                    for (int sidealternative = 0; sidealternative < 2; sidealternative++)
                    {
                        Vector ViewPointAutowallalternative = { Origin.x + OriginLeftRight[sidealternative].x,  Origin.y - OriginLeftRight[sidealternative].y , Origin.z + 90 };

                        if (CanHitFloatingPoint(ViewPointAutowallalternative, ViewPointAutowall))
                        {
                            if (sidealternative == 0)
                            {
                                HitSide1 = true;
                                side = -1;

                            }
                            else if (sidealternative == 1)
                            {
                                HitSide2 = true;
                                side = 1;

                            }

                            Autowalled = true;
                        }
                    }
                }
            }
        }
        for (int i = 1; i <= m_globals()->m_maxclients; i++)
        {
            player_t* player;
            if (!player || !player->is_alive() || player->IsDormant())
                continue;



            auto feet_yaw = resolver_adjust->previous_layers[3].m_flCycle > 0.9f && resolver_adjust->previous_layers[3].m_flWeight > 0.9f && player->m_vecVelocity().Length2D() < 0.1f;
            auto body_max_rotation = 60.f;
            if (feet_yaw <= 60)
            {
                if (-60 > feet_yaw)
                    player->m_angEyeAngles().y = body_max_rotation + player->m_angEyeAngles().y;
            }
            else
            {
                player->m_angEyeAngles().y = body_max_rotation - player->m_angEyeAngles().y;
            }
            if (resolver_adjust->previous_layers[3].m_flCycle > 0.9)
            {
                for (int resolve_delta = 60.f; resolve_delta < -60.f; resolve_delta = resolve_delta - 20.f)
                {
                    player->m_angEyeAngles().y = resolve_delta;
                }
            }
        }
        float flEyeYaw = animstate->m_flEyeYaw;
        float m_flGoalFeetYaw = animstate->m_flGoalFeetYaw;
        float flEyeDiff = AngleDiff(flEyeYaw - m_flGoalFeetYaw, 360.0f);



        // skeeteteetetteetettetetetetetetetete
        
        delta = std::remainder(math::normalize_yaw(player->m_angEyeAngles().y - player->m_flLowerBodyYawTarget()), 360.f) <= 0.f;
        if (2 * delta)
        {
            if (2 * delta == 2)
            {
                return ;
            }
        }
        else
        {
            return ;
        }
    
        int i;
        auto entity = player;
        if (!entity || !entity->is_alive())
            return;
        auto anim = entity->get_animation_state();
        int delta = abs_angle(entity->m_flLowerBodyYawTarget()) - abs_angle(entity->m_angEyeAngles().y);
        return;
        auto m_flEyeDelta = std::remainderf((player->m_angEyeAngles().y - player->m_flLowerBodyYawTarget()), 360.f) <= 0.f;
        int m_flSide;
    
        if (2 * m_flEyeDelta)
        {
            if (2 * m_flEyeDelta == 2)
            {
                m_flSide = -1;
            }
        }
        else
        {
            m_flSide = 1;
        }
        m_bResolve = true;
        float    m_flPreviousDelta = m_flEyeDelta;
        float m_flResolveValue;
        m_flResolveValue = 116.f;
        player->get_animation_state()->m_flGoalFeetYaw = (player->m_angEyeAngles().y + m_flResolveValue * m_flSide);
         flEyeDiff = AngleDiff(flEyeYaw - m_flGoalFeetYaw, 360.0f);
         flEyeYaw = e->m_angEyeAngles().y;
         m_flGoalFeetYaw = animstate->m_flGoalFeetYaw;
        
         if (flEyeDiff > 116)
             m_flGoalFeetYaw : 60, -60;//meme
        
    }
}
 
..................................................
Участник
Статус
Онлайн
Регистрация
13 Авг 2020
Сообщения
990
Реакции[?]
249
Поинты[?]
25K
Можешь ещё animation_system.h скинуть? лень просто ошибки фиксить
 
Пользователь
Статус
Оффлайн
Регистрация
9 Мар 2021
Сообщения
272
Реакции[?]
42
Поинты[?]
2K
Можешь ещё animation_system.h скинуть? лень просто ошибки фиксить
C++:
#pragma once

#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"
//player_t* e;
enum resolver_history
{
    HISTORY_UNKNOWN = -1,
    HISTORY_ORIGINAL,
    HISTORY_ZERO,
    HISTORY_DEFAULT,
    HISTORY_LOW
};

struct player_settings
{
    __int64 id;
    resolver_history res_type;
    bool faking;
    int neg;
    int pos;

    player_settings(__int64 id, resolver_history res_type, bool faking, int left, int right) noexcept : id(id), res_type(res_type), faking(faking), neg(neg), pos(pos)
    {

    }
};

enum
{
    MAIN,
    NONE,
    FIRST,
    SECOND
};

enum resolver_type
{
    ORIGINAL,
    BRUTEFORCE,
    LBY,
    TRACE,
    DIRECTIONAL,
    FREE_TRACE,
    FREE_DIRECTIONAL,
    ANIM_s,
    ANIM_m,
    LOCKED_SIDE
};

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 lagdata
{
   
public:
   

    float realtime ;


   
};
class resolver
{
    player_t* player = nullptr;
    adjust_data* player_record = nullptr;
    int FreestandSide[64];
    bool side = false;
    bool fake = false;
    bool was_first_bruteforce = false;
    bool was_second_bruteforce = false;
   
    bool was_first_low_bruteforce = false;
    bool was_second_low_bruteforce = false;
    AnimationLayer* animationlayers[13];
    float lock_side = 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 ResolveAngles(player_t* e);
    void resolve_yaw();
    float resolve_pitch();
    float goal_feet_yaw = 0.0f;
    float gfy_default = 0.0f;
    //void StoreAntifreestand();
    void CreateMove_Hooked();
    AnimationLayer resolver_layers[3][13];
    AnimationLayer previous_layers[13];

    float original_goal_feet_yaw = 0.0f;

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

    AnimationLayer layers[13];
    matrixes matrixes_data;

    resolver_type type;
    resolver_side side;

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

    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;

    // new
    float m_flLastShotSimtime;
    Vector m_angLastShotAngle;

    float shot;

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

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

        type = ORIGINAL;
        side = RESOLVER_ORIGINAL;

        invalid = false;
        immune = false;
        dormant = false;
        bot = 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();

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

        bot = player_info.fakeplayer;

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

        simulation_time = player->m_flSimulationTime();
        duck_amount = player->m_flDuckAmount();
        lby = player->m_flLowerBodyYawTarget();
        shot = player->m_iShotsFired();
        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)); //-V807

        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; //-V807
        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()->m_choked_commands;

        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 shot;
    float speed;
    Vector angles;
    Vector origin;

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

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

        simulation_time = 0.0f;
        duck_amount = 0.0f;
        shot =  0.0f;
        speed = 0.0f;
        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 SaveFeetAnims(CFeetData* m_pData, player_t* m_pPlayer);
    //    void RestoreFeetAnims(CFeetData* m_pData, player_t* m_pPlayer);
    resolver player_resolver[65];
    std::vector<player_settings> player_sets;
   
    bool is_dormant[65];
    float previous_goal_feet_yaw[65];
};
 
Разработчик
Статус
Оффлайн
Регистрация
1 Сен 2018
Сообщения
1,598
Реакции[?]
880
Поинты[?]
114K
C++:
                    if (delta1 <= delta2)
                        move_delta = delta1;
                    else
                        move_delta = delta2;
                    if (move_delta > delta3)
                        move_delta = delta2;
                    if (!(delta1 * 10000.f) && (delta3 * 10000.f) != (delta2 * 10000.f))


                        auto delta = int(std::abs(anim_layer->m_flPlaybackRate - resolver_layer->m_flPlaybackRate) * 10000.f);
                        //auto wdelta = int(fabsf(anim_layer->m_flWeight - resolver_layer->m_flWeight) * 10000.f);

            bool Autowalled = false, HitSide1 = false, HitSide2 = false;

            auto idx = player->EntIndex();

            float angToLocal = math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y;

            Vector ViewPoint = g_ctx.local()->m_vecOrigin() + Vector(0, 0, 90);
            Vector2D Side1 = { (45 * sin(DEG2RAD(angToLocal))),(45 * cos(DEG2RAD(angToLocal))) };
            Vector2D Side2 = { (45 * sin(DEG2RAD(angToLocal + 180))) ,(45 * cos(DEG2RAD(angToLocal + 180))) };

            Vector2D Side3 = { (50 * sin(DEG2RAD(angToLocal))),(50 * cos(DEG2RAD(angToLocal))) };
            Vector2D Side4 = { (50 * sin(DEG2RAD(angToLocal + 180))) ,(50 * cos(DEG2RAD(angToLocal + 180))) };


     

        auto m_flEyeDelta = std::remainderf((player->m_angEyeAngles().y - player->m_flLowerBodyYawTarget()), 360.f) <= 0.f;
 
        if (2 * m_flEyeDelta)
        {
            if (2 * m_flEyeDelta == 2)
            {
                m_flSide = -1;
            }
        }
        else
        {
            m_flSide = 1;
        }
     
}
Плохо,очень плохо.
 
Пользователь
Статус
Оффлайн
Регистрация
9 Мар 2021
Сообщения
272
Реакции[?]
42
Поинты[?]
2K
Участник
Статус
Оффлайн
Регистрация
27 Фев 2019
Сообщения
1,125
Реакции[?]
395
Поинты[?]
50K
Я так понимаю, спиздить Freestand хуйню из xy0, спиздить код из SetupVelocity, спиздить малый код из LW, это ресольвер блеать? Удали пожалуйста....
Кринж словил, особенно -глаза, когда чекал весь код. И да, алкоголь больше не бери в руки, и даже не заходи на форум пжпжпжпжжпж...
 
Пользователь
Статус
Оффлайн
Регистрация
9 Мар 2021
Сообщения
272
Реакции[?]
42
Поинты[?]
2K
Пользователь
Статус
Оффлайн
Регистрация
9 Мар 2021
Сообщения
272
Реакции[?]
42
Поинты[?]
2K
float ApproachAngle(float target, float value, float speed)
{
target = (target * 182.04445f) * 0.0054931641f;
value = (value * 182.04445f) * 0.0054931641f;

float delta = target - value;

// Speed is assumed to be positive
if (speed < 0)
speed = -speed;

if (delta < -180.0f)
delta += 360.0f;
else if (delta > 180.0f)
delta -= 360.0f;

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

return value;
}
 
Начинающий
Статус
Оффлайн
Регистрация
25 Июн 2019
Сообщения
32
Реакции[?]
1
Поинты[?]
0
float ApproachAngle(float target, float value, float speed)
{
target = (target * 182.04445f) * 0.0054931641f;
value = (value * 182.04445f) * 0.0054931641f;

float delta = target - value;

// Speed is assumed to be positive
if (speed < 0)
speed = -speed;

if (delta < -180.0f)
delta += 360.0f;
else if (delta > 180.0f)
delta -= 360.0f;

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

return value;
}
thanks
 
Начинающий
Статус
Оффлайн
Регистрация
3 Окт 2020
Сообщения
86
Реакции[?]
7
Поинты[?]
0
делал с алкашкой в руках не судите это рофл ресольвер, но на скаут сервере что-то могу :roflanEbalo:
C++:
void resolver::resolve_yaw()
{
    float delta = animationstate->m_flLastClientSideAnimationUpdateTime * 60.0f;
    if (delta = 0.0f)
    {
        player->m_angEyeAngles().y = 90.0f;
        player->m_angEyeAngles().y = -90.0f;
    }
nice delta comparison
 
Похожие темы
Сверху Снизу