Исходник Maagma( nemesis ) multipoint to supremacy

Пользователь
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
291
Реакции[?]
184
Поинты[?]
90K
C++:
float AimPlayer::calc_point_scale( const float spread, const float max, const float dist, const vec3_t& dir, const vec3_t& right, const vec3_t& up ) {
    const auto v1 = g_cl.m_weapon->GetInaccuracy( ) + spread;

    auto v28 = right * v1 + dir + up * v1;

    v28.normalize( );

    const auto delta = math::angle_diff( math::to_deg( std::atan2( dir.y, dir.x ) ), math::to_deg( std::atan2( v28.y, v28.x ) ) );

    const auto v23 = max + dist / std::tan( math::to_rad( 180.f - ( delta + 90.f ) ) );
    if ( v23 > max )
        return 1.f;

    float v25{};
    if ( v23 >= 0.f )
        v25 = v23;

    return v25 / max;
}

__forceinline BoneArray vector_matrix( const vec3_t& in ) {
    vec3_t right{}, up{};

    if ( in.x == 0.f
        && in.y == 0.f ) {
        right = { 0.f, -1.f, 0.f };
        up = { -in.z, 0.f, 0.f };
    }
    else {
        right = in.cross( { 0.f, 0.f, 1.f } ).normalized( );
        up = right.cross( in ).normalized( );
    }

    BoneArray ret{};

    ret[ 0 ][ 0 ] = in.x;
    ret[ 1 ][ 0 ] = in.y;
    ret[ 2 ][ 0 ] = in.z;

    ret[ 0 ][ 1 ] = -right.x;
    ret[ 1 ][ 1 ] = -right.y;
    ret[ 2 ][ 1 ] = -right.z;

    ret[ 0 ][ 2 ] = up.x;
    ret[ 1 ][ 2 ] = up.y;
    ret[ 2 ][ 2 ] = up.z;

    return ret;
}

__forceinline void vector_rotate( const vec3_t& in, const BoneArray& matrix, vec3_t& out ) {
    out = { in.dot( matrix[ 0 ] ), in.dot( matrix[ 1 ] ), in.dot( matrix[ 2 ] ) };
}

void AimPlayer::calc_capsule_points( const int index, const BoneArray* matrix, float scale, std::vector< vec3_t >& points ) const {
    // reset points. -- why not
    points.clear( );
    
    vec3_t min{}, max{};

    const model_t* model = m_player->GetModel( );
    if ( !model )
        return ;

    studiohdr_t* hdr = g_csgo.m_model_info->GetStudioModel( model );
    if ( !hdr )
        return ;

    mstudiohitboxset_t* set = hdr->GetHitboxSet( m_player->m_nHitboxSet( ) );
    if ( !set )
        return ;

    mstudiobbox_t* hitbox = set->GetHitbox( index );
    if ( !hitbox )
        return ;

    auto matrix_normal = matrix[ hitbox->m_bone ]; // this is matrix

    math::VectorTransform( hitbox->m_mins, matrix_normal, min );
    math::VectorTransform( hitbox->m_maxs, matrix_normal, max );
    static auto matrix0 = vector_matrix( { 0.f, 0.f, 1.f } ); // VECTOR TO MATRIX??
    auto matrix1 = vector_matrix( ( max - min ).normalized( ) );

    // for indexes
    for ( const auto& vertices : { vec3_t{ 0.95f, 0.f, 0.f },vec3_t{ -0.95f, 0.f, 0.f },vec3_t{ 0.f, 0.95f, 0.f },vec3_t{ 0.f, -0.95f, 0.f },vec3_t{ 0.f, 0.f, 0.95f },vec3_t{ 0.f, 0.f, -0.95f } } ) {
        vec3_t point{};

        vector_rotate( vertices, matrix0, point );
        vector_rotate( point, matrix1, point );

        point *= scale;

        if ( vertices.z > 0.f )
            point += min - max;

        points.emplace_back( point + max );
    }
}

bool AimPlayer::nemesis_multipoping( LagRecord* record, BoneArray* bones, int index, std::vector< vec3_t >& points ) {
    // reset points. -- why not
    points.clear( );

    const model_t* model = m_player->GetModel( );
    if ( !model )
        return false;

    studiohdr_t* hdr = g_csgo.m_model_info->GetStudioModel( model );
    if ( !hdr )
        return false;

    mstudiohitboxset_t* set = hdr->GetHitboxSet( m_player->m_nHitboxSet( ) );
    if ( !set )
        return false;

    mstudiobbox_t* hitbox = set->GetHitbox( index );
    if ( !hitbox )
        return false;

    // there it starts
    auto matrix = bones[ hitbox->m_bone ]; // this is matrix
    float scale{};
    scale = 0.5f;

    vec3_t point{};
    const auto center = ( hitbox->m_mins + hitbox->m_maxs ) / 2.f;
    math::VectorTransform( center, matrix, point );

    // add a point
    // add a point
    points.emplace_back( point );

    // setup this
    if ( const auto weapon = g_cl.m_local->GetActiveWeapon( ) ) {
        weapon->UpdateAccuracyPenalty( );

        const auto item_index = weapon->m_iItemDefinitionIndex( );
        const auto v11 =
            item_index == AWP || item_index == G3SG1
            || item_index == SCAR20 || item_index == SSG08;
        const auto wpn_data = weapon->GetWpnData( );

        if ( g_cl.m_local->m_fFlags( ) & FL_DUCKING )
            m_min_inaccuracy = v11 ? wpn_data->m_inaccuracy_crouch_alt : wpn_data->m_inaccuracy_crouch;
        else
            m_min_inaccuracy = v11 ? wpn_data->m_inaccuracy_stand_alt : wpn_data->m_inaccuracy_stand;

        static bool once_debug = false;
        if ( !once_debug ) {
            std::cout << std::to_string( m_min_inaccuracy ) + " m_min_inaccuracy\n";
            once_debug = true;
        }

        if ( GetAsyncKeyState( VK_HOME ) )
            once_debug = false;
    }

    static bool once_debug = false;
    if ( !once_debug ) {
        std::cout << std::to_string( scale ) + " scal_e\n";
        once_debug = true;
    }

    if ( GetAsyncKeyState( VK_HOME ) )
        once_debug = false;

    // we do not have static pointscale
    if ( !settings.static_pscale ) {
        const auto max = ( hitbox->m_maxs - hitbox->m_mins ).length( ) * 0.5f + hitbox->m_radius;
        auto dir = ( point - g_cl.m_local->GetShootPosition( ) ); // get shoot position.
        const auto dist = dir.normalize( );
        vec3_t right{}, up{};

        if ( dir.x == 0.f
            && dir.y == 0.f )
        {
            right = { 0.f, -1.f, 0.f };
            up = { -dir.z, 0.f, 0.f };
        }
        else
        {
            right = dir.cross( { 0.f, 0.f, 1.f } ).normalized( );
            up = right.cross( dir ).normalized( );
        }

        scale = calc_point_scale( g_cl.m_weapon->GetSpread( ), max, dist, dir, right, up );
        if ( scale <= 0.f && g_cl.m_weapon->GetSpread( ) > m_min_inaccuracy )
            scale = calc_point_scale( m_min_inaccuracy, max, dist, dir, right, up );
    }

    if ( scale <= 0.f )
        return false;

    if ( hitbox->m_radius <= 0.f ) {
        point = { center.x + ( hitbox->m_mins.x - center.x ) * scale, center.y, center.z };
        math::VectorTransform( point, matrix, point );

        points.emplace_back( point );
        point = { center.x + ( hitbox->m_maxs.x - center.x ) * scale, center.y, center.z };
        math::VectorTransform( point, matrix, point );
        points.emplace_back( point );

        return false; // we got it exit the func
    }

    if ( index ) {
        if ( index == 3 ) {
            if ( !settings.static_pscale && scale > 0.9f )
                scale = 0.9f;
        }
        else {
            if ( index != 2 && index != 6 ) {
                if ( index == 4 || index == 5 ) {
                    if ( !settings.static_pscale && scale > 0.9f )
                        scale=0.9f;

                    point = { center.x, hitbox->m_maxs.y - hitbox->m_radius * scale, center.z };
                    math::VectorTransform( point, matrix, point );
                    points. emplace_back( point );
                }

                return false; // exit this now.
            }

            if ( !settings.static_pscale && scale > 0.9f )
                scale=0.9f;

            if ( index == 6 ) {
                point = { center.x, hitbox->m_maxs.y - hitbox->m_radius * scale, center.z };
                math::VectorTransform( point, matrix, point );
                points. emplace_back( point );

                return false; // exit this now
            }
        }

        // in nemesis is with return in front, but c++ doesnt let me make it like that -- dutu
        calc_capsule_points( index, bones, scale, points );

        // finish, --dutu
        point = { hitbox->m_maxs.x + 0.70710678f * ( hitbox->m_radius * scale ), hitbox->m_maxs.y - 0.70710678f * ( hitbox->m_radius * scale ), hitbox->m_maxs.z };
        math::VectorTransform( point, matrix, point );
        points. emplace_back( point );
        point = { hitbox->m_maxs.x, hitbox->m_maxs.y, hitbox->m_maxs.z + hitbox->m_radius * scale };
        math::VectorTransform( point, matrix, point );
        points. emplace_back( point );
        point = { hitbox->m_maxs.x, hitbox->m_maxs.y, hitbox->m_maxs.z - hitbox->m_radius * scale };
        math::VectorTransform( point, matrix, point );
        points. emplace_back( point );
        point = { hitbox->m_maxs.x, hitbox->m_maxs.y - hitbox->m_radius * scale, hitbox->m_maxs.z };
        math::VectorTransform( point, matrix, point );
        points. emplace_back( point );
    }
}
 
Забаненный
Статус
Оффлайн
Регистрация
21 Июн 2021
Сообщения
85
Реакции[?]
10
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
do urself a favor and stop posting 🔥🔥🔥💯💯💯😞😞😞
 
Забаненный
Статус
Оффлайн
Регистрация
12 Янв 2023
Сообщения
11
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
float AimPlayer::calc_point_scale( const float spread, const float max, const float dist, const vec3_t& dir, const vec3_t& right, const vec3_t& up ) {
    const auto v1 = g_cl.m_weapon->GetInaccuracy( ) + spread;

    auto v28 = right * v1 + dir + up * v1;

    v28.normalize( );

    const auto delta = math::angle_diff( math::to_deg( std::atan2( dir.y, dir.x ) ), math::to_deg( std::atan2( v28.y, v28.x ) ) );

    const auto v23 = max + dist / std::tan( math::to_rad( 180.f - ( delta + 90.f ) ) );
    if ( v23 > max )
        return 1.f;

    float v25{};
    if ( v23 >= 0.f )
        v25 = v23;

    return v25 / max;
}

__forceinline BoneArray vector_matrix( const vec3_t& in ) {
    vec3_t right{}, up{};

    if ( in.x == 0.f
        && in.y == 0.f ) {
        right = { 0.f, -1.f, 0.f };
        up = { -in.z, 0.f, 0.f };
    }
    else {
        right = in.cross( { 0.f, 0.f, 1.f } ).normalized( );
        up = right.cross( in ).normalized( );
    }

    BoneArray ret{};

    ret[ 0 ][ 0 ] = in.x;
    ret[ 1 ][ 0 ] = in.y;
    ret[ 2 ][ 0 ] = in.z;

    ret[ 0 ][ 1 ] = -right.x;
    ret[ 1 ][ 1 ] = -right.y;
    ret[ 2 ][ 1 ] = -right.z;

    ret[ 0 ][ 2 ] = up.x;
    ret[ 1 ][ 2 ] = up.y;
    ret[ 2 ][ 2 ] = up.z;

    return ret;
}

__forceinline void vector_rotate( const vec3_t& in, const BoneArray& matrix, vec3_t& out ) {
    out = { in.dot( matrix[ 0 ] ), in.dot( matrix[ 1 ] ), in.dot( matrix[ 2 ] ) };
}

void AimPlayer::calc_capsule_points( const int index, const BoneArray* matrix, float scale, std::vector< vec3_t >& points ) const {
    // reset points. -- why not
    points.clear( );
   
    vec3_t min{}, max{};

    const model_t* model = m_player->GetModel( );
    if ( !model )
        return ;

    studiohdr_t* hdr = g_csgo.m_model_info->GetStudioModel( model );
    if ( !hdr )
        return ;

    mstudiohitboxset_t* set = hdr->GetHitboxSet( m_player->m_nHitboxSet( ) );
    if ( !set )
        return ;

    mstudiobbox_t* hitbox = set->GetHitbox( index );
    if ( !hitbox )
        return ;

    auto matrix_normal = matrix[ hitbox->m_bone ]; // this is matrix

    math::VectorTransform( hitbox->m_mins, matrix_normal, min );
    math::VectorTransform( hitbox->m_maxs, matrix_normal, max );
    static auto matrix0 = vector_matrix( { 0.f, 0.f, 1.f } ); // VECTOR TO MATRIX??
    auto matrix1 = vector_matrix( ( max - min ).normalized( ) );

    // for indexes
    for ( const auto& vertices : { vec3_t{ 0.95f, 0.f, 0.f },vec3_t{ -0.95f, 0.f, 0.f },vec3_t{ 0.f, 0.95f, 0.f },vec3_t{ 0.f, -0.95f, 0.f },vec3_t{ 0.f, 0.f, 0.95f },vec3_t{ 0.f, 0.f, -0.95f } } ) {
        vec3_t point{};

        vector_rotate( vertices, matrix0, point );
        vector_rotate( point, matrix1, point );

        point *= scale;

        if ( vertices.z > 0.f )
            point += min - max;

        points.emplace_back( point + max );
    }
}

bool AimPlayer::nemesis_multipoping( LagRecord* record, BoneArray* bones, int index, std::vector< vec3_t >& points ) {
    // reset points. -- why not
    points.clear( );

    const model_t* model = m_player->GetModel( );
    if ( !model )
        return false;

    studiohdr_t* hdr = g_csgo.m_model_info->GetStudioModel( model );
    if ( !hdr )
        return false;

    mstudiohitboxset_t* set = hdr->GetHitboxSet( m_player->m_nHitboxSet( ) );
    if ( !set )
        return false;

    mstudiobbox_t* hitbox = set->GetHitbox( index );
    if ( !hitbox )
        return false;

    // there it starts
    auto matrix = bones[ hitbox->m_bone ]; // this is matrix
    float scale{};
    scale = 0.5f;

    vec3_t point{};
    const auto center = ( hitbox->m_mins + hitbox->m_maxs ) / 2.f;
    math::VectorTransform( center, matrix, point );

    // add a point
    // add a point
    points.emplace_back( point );

    // setup this
    if ( const auto weapon = g_cl.m_local->GetActiveWeapon( ) ) {
        weapon->UpdateAccuracyPenalty( );

        const auto item_index = weapon->m_iItemDefinitionIndex( );
        const auto v11 =
            item_index == AWP || item_index == G3SG1
            || item_index == SCAR20 || item_index == SSG08;
        const auto wpn_data = weapon->GetWpnData( );

        if ( g_cl.m_local->m_fFlags( ) & FL_DUCKING )
            m_min_inaccuracy = v11 ? wpn_data->m_inaccuracy_crouch_alt : wpn_data->m_inaccuracy_crouch;
        else
            m_min_inaccuracy = v11 ? wpn_data->m_inaccuracy_stand_alt : wpn_data->m_inaccuracy_stand;

        static bool once_debug = false;
        if ( !once_debug ) {
            std::cout << std::to_string( m_min_inaccuracy ) + " m_min_inaccuracy\n";
            once_debug = true;
        }

        if ( GetAsyncKeyState( VK_HOME ) )
            once_debug = false;
    }

    static bool once_debug = false;
    if ( !once_debug ) {
        std::cout << std::to_string( scale ) + " scal_e\n";
        once_debug = true;
    }

    if ( GetAsyncKeyState( VK_HOME ) )
        once_debug = false;

    // we do not have static pointscale
    if ( !settings.static_pscale ) {
        const auto max = ( hitbox->m_maxs - hitbox->m_mins ).length( ) * 0.5f + hitbox->m_radius;
        auto dir = ( point - g_cl.m_local->GetShootPosition( ) ); // get shoot position.
        const auto dist = dir.normalize( );
        vec3_t right{}, up{};

        if ( dir.x == 0.f
            && dir.y == 0.f )
        {
            right = { 0.f, -1.f, 0.f };
            up = { -dir.z, 0.f, 0.f };
        }
        else
        {
            right = dir.cross( { 0.f, 0.f, 1.f } ).normalized( );
            up = right.cross( dir ).normalized( );
        }

        scale = calc_point_scale( g_cl.m_weapon->GetSpread( ), max, dist, dir, right, up );
        if ( scale <= 0.f && g_cl.m_weapon->GetSpread( ) > m_min_inaccuracy )
            scale = calc_point_scale( m_min_inaccuracy, max, dist, dir, right, up );
    }

    if ( scale <= 0.f )
        return false;

    if ( hitbox->m_radius <= 0.f ) {
        point = { center.x + ( hitbox->m_mins.x - center.x ) * scale, center.y, center.z };
        math::VectorTransform( point, matrix, point );

        points.emplace_back( point );
        point = { center.x + ( hitbox->m_maxs.x - center.x ) * scale, center.y, center.z };
        math::VectorTransform( point, matrix, point );
        points.emplace_back( point );

        return false; // we got it exit the func
    }

    if ( index ) {
        if ( index == 3 ) {
            if ( !settings.static_pscale && scale > 0.9f )
                scale = 0.9f;
        }
        else {
            if ( index != 2 && index != 6 ) {
                if ( index == 4 || index == 5 ) {
                    if ( !settings.static_pscale && scale > 0.9f )
                        scale=0.9f;

                    point = { center.x, hitbox->m_maxs.y - hitbox->m_radius * scale, center.z };
                    math::VectorTransform( point, matrix, point );
                    points. emplace_back(point);
                }

                return false; // exit this now.
            }

            if ( !settings.static_pscale && scale > 0.9f )
                scale=0.9f;

            if ( index == 6 ) {
                point = { center.x, hitbox->m_maxs.y - hitbox->m_radius * scale, center.z };
                math::VectorTransform( point, matrix, point );
                points. emplace_back(point);

                return false; // exit this now
            }
        }

        // in nemesis is with return in front, but c++ doesnt let me make it like that -- dutu
        calc_capsule_points( index, bones, scale, points );

        // finish, --dutu
        point = { hitbox->m_maxs.x + 0.70710678f * ( hitbox->m_radius * scale ), hitbox->m_maxs.y - 0.70710678f * ( hitbox->m_radius * scale ), hitbox->m_maxs.z };
        math::VectorTransform( point, matrix, point );
        points. emplace_back(point);
        point = { hitbox->m_maxs.x, hitbox->m_maxs.y, hitbox->m_maxs.z + hitbox->m_radius * scale };
        math::VectorTransform( point, matrix, point );
        points. emplace_back(point);
        point = { hitbox->m_maxs.x, hitbox->m_maxs.y, hitbox->m_maxs.z - hitbox->m_radius * scale };
        math::VectorTransform( point, matrix, point );
        points. emplace_back(point);
        point = { hitbox->m_maxs.x, hitbox->m_maxs.y - hitbox->m_radius * scale, hitbox->m_maxs.z };
        math::VectorTransform( point, matrix, point );
        points. emplace_back(point);
    }
}
you realize this isn't even correct, right? a majority of shit in magmaa is wrong...
 
Начинающий
Статус
Оффлайн
Регистрация
26 Фев 2021
Сообщения
108
Реакции[?]
25
Поинты[?]
17K
why s there dutu comment
is it from him 💀
oh wait u dutu i think
 
Начинающий
Статус
Оффлайн
Регистрация
24 Авг 2022
Сообщения
37
Реакции[?]
0
Поинты[?]
0
Сверху Снизу