Исходник Corrected PlayerMove for 2018 hvh

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
343
Реакции[?]
216
Поинты[?]
122K
C++:
void LagCompensation::PlayerMove( LagRecord* record ) {
    vec3_t start, end, normal;
    CGametrace trace;
    CTraceFilterWorldOnly filter;

    start = record->m_pred_origin;
    end = start + ( record->m_pred_velocity * g_csgo.m_globals->m_interval );

    g_csgo.m_engine_trace->TraceRay( Ray( start, end, record->m_mins, record->m_maxs ), CONTENTS_SOLID, &filter, &trace );

    if ( trace.m_fraction != 1.f ) {
        for ( int i = 0; i < 2; ++i ) {
            record->m_pred_velocity -= trace.m_plane.m_normal * record->m_pred_velocity.dot( trace.m_plane.m_normal );

            float adjust = record->m_pred_velocity.dot( trace.m_plane.m_normal );
            if ( adjust < 0.f )
                record->m_pred_velocity -= ( trace.m_plane.m_normal * adjust );

            start = trace.m_endpos;
            end = start + ( record->m_pred_velocity * ( g_csgo.m_globals->m_interval * ( 1.f - trace.m_fraction ) ) );

            g_csgo.m_engine_trace->TraceRay( Ray( start, end, record->m_mins, record->m_maxs ), CONTENTS_SOLID, &filter, &trace );
            if ( trace.m_fraction == 1.f )
                break;
        }
    }

    record->m_pred_origin = trace.m_endpos;
    end = trace.m_endpos;
    end.z -= 2.f;

    g_csgo.m_engine_trace->TraceRay( Ray( record->m_pred_origin, end, record->m_mins, record->m_maxs ), CONTENTS_SOLID, &filter, &trace );

    record->m_pred_flags &= ~FL_ONGROUND;
    if ( trace.m_fraction != 1.f && trace.m_plane.m_normal.z > 0.7f )
        record->m_pred_flags |= FL_ONGROUND;

}
 
like amiri in my mind
Пользователь
Статус
Оффлайн
Регистрация
4 Дек 2022
Сообщения
308
Реакции[?]
54
Поинты[?]
1K
Сверху Снизу