C++ My full resolver for lw

Начинающий
Статус
Оффлайн
Регистрация
11 Окт 2020
Сообщения
12
Реакции[?]
10
Поинты[?]
0
делал с алкашкой в руках не судите это рофл ресольвер, но на скаут сервере что-то могу :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
       
    }
}
this is not your resolver at all, this is all just pseudocode which means that u reversed some other lw paste
 
Похожие темы
Сверху Снизу