C++ Simple autostop.

Начинающий
Статус
Оффлайн
Регистрация
18 Мар 2020
Сообщения
120
Реакции[?]
6
Поинты[?]
0
C++:
auto get_max_accel_onetap = [ & ]( ) {
        vec3_t v6 = g_inputpred.PredictionData.m_vecUnpredictedVelocity;
        float v8 = g_csgo.sv_friction->GetFloat( ) * g_cl.m_local->m_surfaceFriction( );
        float v11 = v6.length( );

        if ( v11 <= 0.1f )
            goto LABEL_12;

        float v43 = fmax( v11, g_csgo.sv_stopspeed->GetFloat( ) );
        float v23 = v43 * v8 * g_csgo.m_globals->m_interval;
        float v19 = fmax( 0.f, v11 - v23 );

        if ( v19 != v11 ) {
            v19 /= v11;

            v6 *= v19;
        }
        LABEL_12:
        return v6;
    };

    float m_side_move{ }, m_forward_move{ }, v54{ };
   
    if( get_max_accel_onetap( ).length_2d( ) > speed ) { // use velocity here as well????
   
        ang_t v23{ };
        vec3_t velocity = get_max_accel_onetap( ), v6;
        math::VectorAngles( ( velocity * -1.f ), v23 );
        v23.y = g_cl.m_view_angles.y - v23.y;
        math::AngleVectors( v23, &v6 );

        m_side_move = 450.0;
        m_forward_move = v6.x * velocity.length_2d( );
        v54 = v6.y * velocity.length_2d( );
        goto FINISH;
    }




    FINISH:
    if ( m_forward_move <= 450.0 )
    {
        if ( m_forward_move < -450.0 )
            m_forward_move = -450.0;
    }
    else
    {
        m_forward_move = 450.0;
    }
    if ( v54 <= 450.0 )
    {
        if ( v54 >= -450.0 )
            m_side_move = v54;
        else
            m_side_move = -450.0;
    }

    g_cl.m_cmd->m_forward_move = m_forward_move;
    g_cl.m_cmd->m_side_move = m_side_move;

}
 
Сверху Снизу