Movement fix by ENRAGE to LW

Трахов
Пользователь
Статус
Оффлайн
Регистрация
6 Фев 2020
Сообщения
490
Реакции[?]
87
Поинты[?]
2K
C++:
void movement_fix(Vector& wish_angle, CUserCmd* m_pcmd)
    {
        Vector Zero(0.0f, 0.0f, 0.0f);

        Vector wish_forward, wish_right, wish_up, cmd_forward, cmd_right, cmd_up;

        auto viewangles = m_pcmd->m_viewangles;
        auto movedata = Vector(m_pcmd->m_forwardmove, m_pcmd->m_sidemove, m_pcmd->m_upmove);
        viewangles.Normalize();

        if (!(g_ctx.local()->m_fFlags() & FL_ONGROUND) && viewangles.z != 0.f)
            movedata.y = 0.f;

        math::angle_vectors(wish_angle, &wish_forward, &wish_right, &wish_up);
        math::angle_vectors(viewangles, &cmd_forward, &cmd_right, &cmd_up);

        const auto v8 = sqrtf(wish_forward.x * wish_forward.x + wish_forward.y * wish_forward.y),
            v10 = sqrtf(wish_right.x * wish_right.x + wish_right.y * wish_right.y),
            v12 = sqrtf(wish_up.z * wish_up.z);

        Vector wish_forward_norm(1.0f / v8 * wish_forward.x, 1.0f / v8 * wish_forward.y, 0.f),
            wish_right_norm(1.0f / v10 * wish_right.x, 1.0f / v10 * wish_right.y, 0.f),
            wish_up_norm(0.f, 0.f, 1.0f / v12 * wish_up.z);

        const auto v14 = sqrtf(cmd_forward.x * cmd_forward.x + cmd_forward.y * cmd_forward.y),
            v16 = sqrtf(cmd_right.x * cmd_right.x + cmd_right.y * cmd_right.y),
            v18 = sqrtf(cmd_up.z * cmd_up.z);

        Vector cmd_forward_norm(1.0f / v14 * cmd_forward.x, 1.0f / v14 * cmd_forward.y, 1.0f / v14 * 0.0f),
            cmd_right_norm(1.0f / v16 * cmd_right.x, 1.0f / v16 * cmd_right.y, 1.0f / v16 * 0.0f),
            cmd_up_norm(0.f, 0.f, 1.0f / v18 * cmd_up.z);

        const auto v22 = wish_forward_norm.x * movedata.x,
            v26 = wish_forward_norm.y * movedata.x,
            v28 = wish_forward_norm.z * movedata.x,
            v24 = wish_right_norm.x * movedata.y,
            v23 = wish_right_norm.y * movedata.y,
            v25 = wish_right_norm.z * movedata.y,
            v30 = wish_up_norm.x * movedata.z,
            v27 = wish_up_norm.z * movedata.z,
            v29 = wish_up_norm.y * movedata.z;

        Vector correct_movement = Zero;

        correct_movement.x = cmd_forward_norm.x * v24 + cmd_forward_norm.y * v23 + cmd_forward_norm.z * v25
            + (cmd_forward_norm.x * v22 + cmd_forward_norm.y * v26 + cmd_forward_norm.z * v28)
            + (cmd_forward_norm.y * v30 + cmd_forward_norm.x * v29 + cmd_forward_norm.z * v27);

        correct_movement.y = cmd_right_norm.x * v24 + cmd_right_norm.y * v23 + cmd_right_norm.z * v25
            + (cmd_right_norm.x * v22 + cmd_right_norm.y * v26 + cmd_right_norm.z * v28)
            + (cmd_right_norm.x * v29 + cmd_right_norm.y * v30 + cmd_right_norm.z * v27);

        correct_movement.z = cmd_up_norm.x * v23 + cmd_up_norm.y * v24 + cmd_up_norm.z * v25
            + (cmd_up_norm.x * v26 + cmd_up_norm.y * v22 + cmd_up_norm.z * v28)
            + (cmd_up_norm.x * v30 + cmd_up_norm.y * v29 + cmd_up_norm.z * v27);

        correct_movement.x = math::clamp(correct_movement.x, -450.f, 450.f);
        correct_movement.y = math::clamp(correct_movement.y, -450.f, 450.f);
        correct_movement.z = math::clamp(correct_movement.z, -320.f, 320.f);

        m_pcmd->m_forwardmove = correct_movement.x;
        m_pcmd->m_sidemove = correct_movement.y;
        m_pcmd->m_upmove = correct_movement.z;
    }
 
Пользователь
Статус
Оффлайн
Регистрация
19 Авг 2020
Сообщения
193
Реакции[?]
40
Поинты[?]
0
боюсь спросить, что ты тут пофиксил?
Что ж вы такие пастеры то головного мозга. Функция так НАЗЫВАЕТСЯ - movement_fix, используется она в хуке креейт мува, то что скинул автор это просто конверт данной функции из другого чита в лв.
 
Сверху Снизу