Исходник Resolver lw

Забаненный
Статус
Оффлайн
Регистрация
6 Ноя 2022
Сообщения
22
Реакции[?]
3
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Переделал под лв https://yougame.biz/threads/274274/
Больше гемора я в жизни не видел как переделовать под лв

Код:
enum ROTATE_MODE
{
ROTATE_SERVER,
ROTATE_LEFT,
ROTATE_RIGHT,
ROTATE_LOW_RIGHT,
ROTATE_LOW_LEFT
};

enum SIDE_MODE
{   
S_LEFT, 
S_RIGHT,  
S_SERVER, 
S_QUAD
};

enum AnimationLayer_t
{
ANIMATION_LAYER_AIMMATRIX = 0,
ANIMATION_LAYER_WEAPON_ACTION,
ANIMATION_LAYER_WEAPON_ACTION_RECROUCH,
ANIMATION_LAYER_ADJUST,
ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL,
ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB,
ANIMATION_LAYER_MOVEMENT_MOVE,
ANIMATION_LAYER_MOVEMENT_STRAFECHANGE,
ANIMATION_LAYER_WHOLE_BODY,
ANIMATION_LAYER_FLASHED,
ANIMATION_LAYER_FLINCH,
ANIMATION_LAYER_ALIVELOOP,
ANIMATION_LAYER_LEAN,
ANIMATION_LAYER_COUNT
};
Код:
class resolver
{
    player_t* player = nullptr;
    adjust_data* player_record = nullptr;

    float original_goal_feet_yaw = 0.0f;
    float original_pitch = 0.0f;

public:
    void initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch);
    void reset();
    float resolve_pitch();
    void resolve_yaw(player_t* player);
    void detect_side_of_playback_rate(const player_t* player, adjust_data& lag_record, adjust_data previous_record);
    void resolve_moves(player_t* e, adjust_data& lag_record);
    void set_abs_angles_and_bones(player_t* player, const int32_t rotation_mode);
    void setup_resolver_layers(player_t* player, adjust_data& lag_record, const int32_t rotation_mode);
    void resolve_stand(player_t* e, adjust_data& lag_record);
};

// class adjust_data

bool m_anim_resolved;
bool m_feet_delta;
std::array < std::array < AnimationLayer, ANIMATION_LAYER_COUNT >, 6 > m_resolver_layers = { };
std::array < std::array < AnimationLayer, ANIMATION_LAYER_ADJUST >, 6 > m_animation_layers = { };    int m_rotation_mode;
Код:
#include "animation_system.h"
#include "..\ragebot\aim.h"

void resolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch)
{
    player = e;
    player_record = record;

    original_goal_feet_yaw = math::normalize_yaw(goal_feet_yaw);
    original_pitch = math::normalize_pitch(pitch);
}

void resolver::reset()
{
    player = nullptr;
    player_record = nullptr;

    side = false;
    fake = false;

    original_goal_feet_yaw = 0.0f;
    original_pitch = 0.0f;
}
void resolver::instance(player_t* player)
{
    adjust_data lag_record;
    const adjust_data previous_record;
    if (!player || !player->is_alive())
        return;

    if (!player->get_animation_state())
        return;

    /* perhaps there will be questions about 1.2f
     * this is done due to the fact that people began to break the velocity with a micro-movement or something like that and the magic value of 1.2f comes out from here
     * or no ? hmm, interesting - https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2238
    */
    if (player->get_animation_state()->m_velocity_length_xy > 0.1f
        && fabsf(player->get_animation_state()->m_velocity_length_z) > 100.0f)
    {
        lag_record.m_is_moving = true;
        lag_record.m_is_standing = false;

        resolve_moves(player, lag_record);

        setup_resolver_layers(player, lag_record, lag_record.m_rotation_mode);
        //detect_side_of_playback_rate(player, lag_record, previous_record); //crash дебаг не помогает
    }
    else
    {
        lag_record.m_is_moving = false;
        lag_record.m_is_standing = true;

        resolve_stand(player, lag_record);
        setup_resolver_layers(player, lag_record, lag_record.m_rotation_mode);
    }

    /* if shot missed -> change current angle */
    /* brute side filling in rage-bot if does intersect hitbox */
    if (!lag_record.m_rotation_mode)
    {
        if (g_ctx.globals.missed_shots[player->EntIndex()] > 0)
        {
            auto new_rotation = ROTATE_SERVER;

            /* fucking cycle  xD */
            switch (lag_record.m_rotation_mode)
            {
            case ROTATE_LEFT: new_rotation = ROTATE_RIGHT;
                break;
            case ROTATE_RIGHT: new_rotation = ROTATE_LOW_RIGHT;
                break;
            case ROTATE_LOW_RIGHT: new_rotation = ROTATE_LOW_LEFT;
                break;
            case ROTATE_LOW_LEFT: new_rotation = ROTATE_LEFT;
                break;
            default: break;
            }

            /* set new value */
            lag_record.m_rotation_mode = new_rotation;
        }
    }
}

void resolver::detect_side_of_playback_rate(const player_t* player, adjust_data& lag_record, adjust_data previous_record)
{
    /* find player's side using animation playback rate
     * where the speed is greater, there is most likely the player's side
     * @note: delta_center - nervously smoking on the sidelines he-he
    */

    lag_record.m_anim_resolved = false;

    int m_side = 0;
    bool m_can_animate;

    if (!(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flWeight * 1000.0f))
    {
        if (lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flWeight * 1000.0f == previous_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flWeight * 1000.0f)
        {
            const float delta_left = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_LEFT).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);
            const float delta_right = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_RIGHT).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);
            const float delta_center = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_SERVER).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);
            const float delta_quad = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_QUAD).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);

            bool m_finally_active{};

            if (!(delta_quad * 1000.f)) {
                m_finally_active = true;
            }

            m_side = 0;
            float last_delta = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_QUAD).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);

            if (delta_center * 1000.f || delta_quad < delta_center) {
                m_can_animate = m_finally_active;
            }
            else {
                m_can_animate = true;
                m_side = ROTATE_SERVER;
                last_delta = delta_center;
            }

            if (!(delta_left * 1000.f) && last_delta >= delta_left) {
                m_can_animate = true;
                m_side = ROTATE_RIGHT;
                last_delta = delta_left;
            }

            if (!(delta_right * 1000.f) && last_delta >= delta_right) {
                m_can_animate = true;
                m_side = ROTATE_LEFT;
                //return;
            }
        }
        else {
            m_can_animate = false;
        }
    }

    lag_record.m_anim_resolved = m_can_animate;
    lag_record.m_rotation_mode = m_side;
}

void resolver::resolve_stand(player_t* player, adjust_data& lag_record)
{
    /* get player angle */
    const auto feet_delta = math::normalize_yaw(math::angle_diff(
        math::normalize_yaw(player->m_flLowerBodyYawTarget()),
        math::normalize_yaw(player->m_angEyeAngles().y)));

    const auto eye_diff = math::angle_diff(player->m_angEyeAngles().y, player->get_animation_state()->m_abs_yaw);

    /* the player has just moved from a state of RUNNING to a state of STANDING */
    auto stopped_moving = player->sequence_activity(lag_record.m_animation_layers.at(ANIMATION_LAYER_ADJUST).data()->m_nSequence) == ACT_CSGO_IDLE_ADJUST_STOPPEDMOVING;

    /* if player has delta >= 120 (max_desync_delta); */
    auto balance_adjust = player->sequence_activity(lag_record.m_animation_layers.at(ANIMATION_LAYER_ADJUST).data()->m_nSequence) == ACT_CSGO_IDLE_TURN_BALANCEADJUST;

    /* a very important thing for rebuild stopped moving
     * ref: https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2296
     * @note: you can use the logic from there, but only in the other direction, to detect the moves and rebuild something (started_moving_this_frame )
    */
    bool stopped_moving_this_frame = false;
    if (player->get_animation_state()->m_velocity_length_xy <= 0.1f)
    {
        stopped_moving_this_frame = player->get_animation_state()->m_duration_still <= 0;
        player->get_animation_state()->m_duration_moving = 0.0f;
        player->get_animation_state()->m_duration_still += player->get_animation_state()->m_last_update_increment;
    }

    /* rebuild balance adjust
     * thanks to my homies llama & valve
     * ref: https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2380
    */
    if (player->get_animation_state()->m_ladder_weight == 0.0f && player->get_animation_state()->m_land_anim_multiplier == 0.0f &&
        player->get_animation_state()->m_last_update_increment > 0.0f)
    {
        const auto current_feet_yaw = player->get_animation_state()->m_abs_yaw_last;
        const auto goal_feet_yaw = player->get_animation_state()->m_abs_yaw;
        auto eye_delta = current_feet_yaw - goal_feet_yaw;

        if (goal_feet_yaw < current_feet_yaw)
        {
            if (eye_delta >= 180.0f)
                eye_delta -= 360.0f;
        }
        else if (eye_delta <= -180.0f)
            eye_delta += 360.0f;

        if (eye_delta / player->get_animation_state()->m_last_update_increment > 120.f)
        {
            lag_record.m_animation_layers.at(ANIMATION_LAYER_ADJUST).data()->m_flCycle = 0.0f;

            lag_record.m_animation_layers.at(ANIMATION_LAYER_ADJUST).data()->m_flWeight = 0.0f;

            balance_adjust = true;
            player->get_animation_state()->m_adjust_started = true;
        }
    }

    /* rebuild stopped moving
     * ref: https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2302
    */
    if (!player->get_animation_state()->m_adjust_started && stopped_moving_this_frame && player->get_animation_state()->m_on_ground && player->get_animation_state()->m_ladder_weight == 0.0f && player->get_animation_state()->m_land_anim_multiplier == 0.0f && player->get_animation_state()->m_stutter_step < 50.0f)
    {
        stopped_moving = true;
        player->get_animation_state()->m_adjust_started = true;
    }

    /* just find our side if player meets all three conditions */
    if (stopped_moving || balance_adjust || player->get_animation_state()->m_adjust_started)
    {
        /* detect side */
        lag_record.m_rotation_mode = feet_delta > 0.0f && eye_diff > 0.0f ? ROTATE_LEFT : ROTATE_RIGHT;

        /* store value for logging */
        lag_record.m_feet_delta = feet_delta;

        /* update lby
         * ref: https://prnt.sc/26jm7xs | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2353
        */
        player->get_animation_state()->m_abs_yaw = math::ApproachAngle(player->m_flLowerBodyYawTarget(), player->get_animation_state()->m_abs_yaw, player->get_animation_state()->m_last_update_increment * 100.0f);
    }

    /* if rotation mode != server -> push rotation mode to last brute side */
    //g_sdk.m_resolver_data.m_last_brute_side[player->ent_index()] = lag_record.m_rotation_mode;
}

void resolver::resolve_moves(player_t* player, adjust_data& lag_record)
{
    /* too hard to explain, a lot of tests have been done with this shit, I'm too lazy */
    if (const auto eye_diff = math::normalize_yaw(math::angle_diff(player->m_angEyeAngles().y, player->get_animation_state()->m_abs_yaw)); eye_diff > player->get_max_desync_delta())
    {
        lag_record.m_rotation_mode = ROTATE_LOW_RIGHT;
    }
    else
    {
        if (player->m_angEyeAngles().y - 60 > eye_diff)
            lag_record.m_rotation_mode = ROTATE_LOW_LEFT;
    }

    player->get_animation_state()->m_abs_yaw = math::ApproachAngle(player->m_angEyeAngles().y, player->get_animation_state()->m_abs_yaw, (player->get_animation_state()->m_walk_to_run_transition * 20.0f + 30.0f) * player->get_animation_state()->m_last_update_increment);
}


void resolver::set_abs_angles_and_bones(player_t* player, const int32_t rotation_mode)
{
    switch (rotation_mode)
    {
    case ROTATE_LEFT:
    {
        player->get_animation_state()->m_abs_yaw = math::normalize_yaw(player->get_eye_pos().y + 60);
    }
    break;
    case ROTATE_RIGHT:
    {
        player->get_animation_state()->m_abs_yaw = math::normalize_yaw(player->m_angEyeAngles().y - 60);
    }
    break;
    default:
        break;
    }

    return player->invalidate_physics_recursive(ANGLES_CHANGED);
}

void resolver::setup_resolver_layers(player_t* player, adjust_data& lag_record, const int32_t rotation_mode)
{
    switch (rotation_mode)
    {
    case ROTATE_SERVER:
    {
        memcpy(lag_record.m_resolver_layers.at(S_SERVER).data(), player->get_animlayers(),
            sizeof(AnimationLayer) * ANIMATION_LAYER_COUNT);
    }
    break;
    case ROTATE_LEFT:
    case ROTATE_LOW_LEFT:
    {
        memcpy(lag_record.m_resolver_layers.at(S_LEFT).data(), player->get_animlayers(),
            sizeof(AnimationLayer) * ANIMATION_LAYER_COUNT);
    }
    break;
    case ROTATE_RIGHT:
    case ROTATE_LOW_RIGHT:
    {
        memcpy(lag_record.m_resolver_layers.at(S_RIGHT).data(), player->get_animlayers(),
            sizeof(AnimationLayer) * ANIMATION_LAYER_COUNT);
    }
    break;
    default: break;
    }
}

float resolver::resolve_pitch()
{
    return original_pitch;
}
 
Забаненный
Статус
Оффлайн
Регистрация
19 Дек 2020
Сообщения
9
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
зачем? пастеры и так нихуя не могут
дай им шанс думать
 
Начинающий
Статус
Оффлайн
Регистрация
22 Ноя 2022
Сообщения
4
Реакции[?]
0
Поинты[?]
0
я кнш новичок в "создание" читов но в общем при добавлении m_velocity_length_xy и m_velocity_length_z в c_baseplayeranimationstate ломается локал анимфикс
 
Забаненный
Статус
Оффлайн
Регистрация
6 Ноя 2022
Сообщения
22
Реакции[?]
3
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
я кнш новичок в "создание" читов но в общем при добавлении m_velocity_length_xy и m_velocity_length_z в c_baseplayeranimationstate ломается локал анимфикс
Возьми определение с енрейджа, и да это очень крутой легендвар, я тупо взял с луны локалки, помогло
 
Забаненный
Статус
Оффлайн
Регистрация
23 Ноя 2022
Сообщения
4
Реакции[?]
1
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
я кнш новичок в "создание" читов но в общем при добавлении m_velocity_length_xy и m_velocity_length_z в c_baseplayeranimationstate ломается локал анимфикс
нуу просто у тебя меняется размер структуры.. поэтому что то и отламывается
в лв есть z,xy
-> m_velocity
-> m_flUpVelocity
 
Начинающий
Статус
Оффлайн
Регистрация
22 Ноя 2022
Сообщения
4
Реакции[?]
0
Поинты[?]
0
Возьми определение с енрейджа, и да это очень крутой легендвар, я тупо взял с луны локалки, помогло
Хз мне чёт не помогло видать сама КС говорит не надо те читы делать иди лучше на анриле чёт сделай
 
Начинающий
Статус
Оффлайн
Регистрация
22 Ноя 2022
Сообщения
4
Реакции[?]
0
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
12 Мар 2022
Сообщения
72
Реакции[?]
4
Поинты[?]
5K
Переделал под лв https://yougame.biz/threads/274274/
Больше гемора я в жизни не видел как переделовать под лв

Код:
enum ROTATE_MODE
{
ROTATE_SERVER,
ROTATE_LEFT,
ROTATE_RIGHT,
ROTATE_LOW_RIGHT,
ROTATE_LOW_LEFT
};

enum SIDE_MODE
{   
S_LEFT, 
S_RIGHT,  
S_SERVER, 
S_QUAD
};

enum AnimationLayer_t
{
ANIMATION_LAYER_AIMMATRIX = 0,
ANIMATION_LAYER_WEAPON_ACTION,
ANIMATION_LAYER_WEAPON_ACTION_RECROUCH,
ANIMATION_LAYER_ADJUST,
ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL,
ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB,
ANIMATION_LAYER_MOVEMENT_MOVE,
ANIMATION_LAYER_MOVEMENT_STRAFECHANGE,
ANIMATION_LAYER_WHOLE_BODY,
ANIMATION_LAYER_FLASHED,
ANIMATION_LAYER_FLINCH,
ANIMATION_LAYER_ALIVELOOP,
ANIMATION_LAYER_LEAN,
ANIMATION_LAYER_COUNT
};
Код:
class resolver
{
    player_t* player = nullptr;
    adjust_data* player_record = nullptr;

    float original_goal_feet_yaw = 0.0f;
    float original_pitch = 0.0f;

public:
    void initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch);
    void reset();
    float resolve_pitch();
    void resolve_yaw(player_t* player);
    void detect_side_of_playback_rate(const player_t* player, adjust_data& lag_record, adjust_data previous_record);
    void resolve_moves(player_t* e, adjust_data& lag_record);
    void set_abs_angles_and_bones(player_t* player, const int32_t rotation_mode);
    void setup_resolver_layers(player_t* player, adjust_data& lag_record, const int32_t rotation_mode);
    void resolve_stand(player_t* e, adjust_data& lag_record);
};

// class adjust_data

bool m_anim_resolved;
bool m_feet_delta;
std::array < std::array < AnimationLayer, ANIMATION_LAYER_COUNT >, 6 > m_resolver_layers = { };
std::array < std::array < AnimationLayer, ANIMATION_LAYER_ADJUST >, 6 > m_animation_layers = { };    int m_rotation_mode;
Код:
#include "animation_system.h"
#include "..\ragebot\aim.h"

void resolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch)
{
    player = e;
    player_record = record;

    original_goal_feet_yaw = math::normalize_yaw(goal_feet_yaw);
    original_pitch = math::normalize_pitch(pitch);
}

void resolver::reset()
{
    player = nullptr;
    player_record = nullptr;

    side = false;
    fake = false;

    original_goal_feet_yaw = 0.0f;
    original_pitch = 0.0f;
}
void resolver::instance(player_t* player)
{
    adjust_data lag_record;
    const adjust_data previous_record;
    if (!player || !player->is_alive())
        return;

    if (!player->get_animation_state())
        return;

    /* perhaps there will be questions about 1.2f
     * this is done due to the fact that people began to break the velocity with a micro-movement or something like that and the magic value of 1.2f comes out from here
     * or no ? hmm, interesting - https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2238
    */
    if (player->get_animation_state()->m_velocity_length_xy > 0.1f
        && fabsf(player->get_animation_state()->m_velocity_length_z) > 100.0f)
    {
        lag_record.m_is_moving = true;
        lag_record.m_is_standing = false;

        resolve_moves(player, lag_record);

        setup_resolver_layers(player, lag_record, lag_record.m_rotation_mode);
        //detect_side_of_playback_rate(player, lag_record, previous_record); //crash дебаг не помогает
    }
    else
    {
        lag_record.m_is_moving = false;
        lag_record.m_is_standing = true;

        resolve_stand(player, lag_record);
        setup_resolver_layers(player, lag_record, lag_record.m_rotation_mode);
    }

    /* if shot missed -> change current angle */
    /* brute side filling in rage-bot if does intersect hitbox */
    if (!lag_record.m_rotation_mode)
    {
        if (g_ctx.globals.missed_shots[player->EntIndex()] > 0)
        {
            auto new_rotation = ROTATE_SERVER;

            /* fucking cycle  xD */
            switch (lag_record.m_rotation_mode)
            {
            case ROTATE_LEFT: new_rotation = ROTATE_RIGHT;
                break;
            case ROTATE_RIGHT: new_rotation = ROTATE_LOW_RIGHT;
                break;
            case ROTATE_LOW_RIGHT: new_rotation = ROTATE_LOW_LEFT;
                break;
            case ROTATE_LOW_LEFT: new_rotation = ROTATE_LEFT;
                break;
            default: break;
            }

            /* set new value */
            lag_record.m_rotation_mode = new_rotation;
        }
    }
}

void resolver::detect_side_of_playback_rate(const player_t* player, adjust_data& lag_record, adjust_data previous_record)
{
    /* find player's side using animation playback rate
     * where the speed is greater, there is most likely the player's side
     * @note: delta_center - nervously smoking on the sidelines he-he
    */

    lag_record.m_anim_resolved = false;

    int m_side = 0;
    bool m_can_animate;

    if (!(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flWeight * 1000.0f))
    {
        if (lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flWeight * 1000.0f == previous_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flWeight * 1000.0f)
        {
            const float delta_left = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_LEFT).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);
            const float delta_right = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_RIGHT).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);
            const float delta_center = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_SERVER).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);
            const float delta_quad = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_QUAD).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);

            bool m_finally_active{};

            if (!(delta_quad * 1000.f)) {
                m_finally_active = true;
            }

            m_side = 0;
            float last_delta = abs(lag_record.m_animation_layers.at(ANIMATION_LAYER_MOVEMENT_MOVE).data()->m_flPlaybackRate
                - lag_record.m_resolver_layers.at(S_QUAD).at(ANIMATION_LAYER_MOVEMENT_MOVE).m_flPlaybackRate);

            if (delta_center * 1000.f || delta_quad < delta_center) {
                m_can_animate = m_finally_active;
            }
            else {
                m_can_animate = true;
                m_side = ROTATE_SERVER;
                last_delta = delta_center;
            }

            if (!(delta_left * 1000.f) && last_delta >= delta_left) {
                m_can_animate = true;
                m_side = ROTATE_RIGHT;
                last_delta = delta_left;
            }

            if (!(delta_right * 1000.f) && last_delta >= delta_right) {
                m_can_animate = true;
                m_side = ROTATE_LEFT;
                //return;
            }
        }
        else {
            m_can_animate = false;
        }
    }

    lag_record.m_anim_resolved = m_can_animate;
    lag_record.m_rotation_mode = m_side;
}

void resolver::resolve_stand(player_t* player, adjust_data& lag_record)
{
    /* get player angle */
    const auto feet_delta = math::normalize_yaw(math::angle_diff(
        math::normalize_yaw(player->m_flLowerBodyYawTarget()),
        math::normalize_yaw(player->m_angEyeAngles().y)));

    const auto eye_diff = math::angle_diff(player->m_angEyeAngles().y, player->get_animation_state()->m_abs_yaw);

    /* the player has just moved from a state of RUNNING to a state of STANDING */
    auto stopped_moving = player->sequence_activity(lag_record.m_animation_layers.at(ANIMATION_LAYER_ADJUST).data()->m_nSequence) == ACT_CSGO_IDLE_ADJUST_STOPPEDMOVING;

    /* if player has delta >= 120 (max_desync_delta); */
    auto balance_adjust = player->sequence_activity(lag_record.m_animation_layers.at(ANIMATION_LAYER_ADJUST).data()->m_nSequence) == ACT_CSGO_IDLE_TURN_BALANCEADJUST;

    /* a very important thing for rebuild stopped moving
     * ref: https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2296
     * @note: you can use the logic from there, but only in the other direction, to detect the moves and rebuild something (started_moving_this_frame )
    */
    bool stopped_moving_this_frame = false;
    if (player->get_animation_state()->m_velocity_length_xy <= 0.1f)
    {
        stopped_moving_this_frame = player->get_animation_state()->m_duration_still <= 0;
        player->get_animation_state()->m_duration_moving = 0.0f;
        player->get_animation_state()->m_duration_still += player->get_animation_state()->m_last_update_increment;
    }

    /* rebuild balance adjust
     * thanks to my homies llama & valve
     * ref: https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2380
    */
    if (player->get_animation_state()->m_ladder_weight == 0.0f && player->get_animation_state()->m_land_anim_multiplier == 0.0f &&
        player->get_animation_state()->m_last_update_increment > 0.0f)
    {
        const auto current_feet_yaw = player->get_animation_state()->m_abs_yaw_last;
        const auto goal_feet_yaw = player->get_animation_state()->m_abs_yaw;
        auto eye_delta = current_feet_yaw - goal_feet_yaw;

        if (goal_feet_yaw < current_feet_yaw)
        {
            if (eye_delta >= 180.0f)
                eye_delta -= 360.0f;
        }
        else if (eye_delta <= -180.0f)
            eye_delta += 360.0f;

        if (eye_delta / player->get_animation_state()->m_last_update_increment > 120.f)
        {
            lag_record.m_animation_layers.at(ANIMATION_LAYER_ADJUST).data()->m_flCycle = 0.0f;

            lag_record.m_animation_layers.at(ANIMATION_LAYER_ADJUST).data()->m_flWeight = 0.0f;

            balance_adjust = true;
            player->get_animation_state()->m_adjust_started = true;
        }
    }

    /* rebuild stopped moving
     * ref: https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2302
    */
    if (!player->get_animation_state()->m_adjust_started && stopped_moving_this_frame && player->get_animation_state()->m_on_ground && player->get_animation_state()->m_ladder_weight == 0.0f && player->get_animation_state()->m_land_anim_multiplier == 0.0f && player->get_animation_state()->m_stutter_step < 50.0f)
    {
        stopped_moving = true;
        player->get_animation_state()->m_adjust_started = true;
    }

    /* just find our side if player meets all three conditions */
    if (stopped_moving || balance_adjust || player->get_animation_state()->m_adjust_started)
    {
        /* detect side */
        lag_record.m_rotation_mode = feet_delta > 0.0f && eye_diff > 0.0f ? ROTATE_LEFT : ROTATE_RIGHT;

        /* store value for logging */
        lag_record.m_feet_delta = feet_delta;

        /* update lby
         * ref: https://prnt.sc/26jm7xs | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/csgo_playeranimstate.cpp#L2353
        */
        player->get_animation_state()->m_abs_yaw = math::ApproachAngle(player->m_flLowerBodyYawTarget(), player->get_animation_state()->m_abs_yaw, player->get_animation_state()->m_last_update_increment * 100.0f);
    }

    /* if rotation mode != server -> push rotation mode to last brute side */
    //g_sdk.m_resolver_data.m_last_brute_side[player->ent_index()] = lag_record.m_rotation_mode;
}

void resolver::resolve_moves(player_t* player, adjust_data& lag_record)
{
    /* too hard to explain, a lot of tests have been done with this shit, I'm too lazy */
    if (const auto eye_diff = math::normalize_yaw(math::angle_diff(player->m_angEyeAngles().y, player->get_animation_state()->m_abs_yaw)); eye_diff > player->get_max_desync_delta())
    {
        lag_record.m_rotation_mode = ROTATE_LOW_RIGHT;
    }
    else
    {
        if (player->m_angEyeAngles().y - 60 > eye_diff)
            lag_record.m_rotation_mode = ROTATE_LOW_LEFT;
    }

    player->get_animation_state()->m_abs_yaw = math::ApproachAngle(player->m_angEyeAngles().y, player->get_animation_state()->m_abs_yaw, (player->get_animation_state()->m_walk_to_run_transition * 20.0f + 30.0f) * player->get_animation_state()->m_last_update_increment);
}


void resolver::set_abs_angles_and_bones(player_t* player, const int32_t rotation_mode)
{
    switch (rotation_mode)
    {
    case ROTATE_LEFT:
    {
        player->get_animation_state()->m_abs_yaw = math::normalize_yaw(player->get_eye_pos().y + 60);
    }
    break;
    case ROTATE_RIGHT:
    {
        player->get_animation_state()->m_abs_yaw = math::normalize_yaw(player->m_angEyeAngles().y - 60);
    }
    break;
    default:
        break;
    }

    return player->invalidate_physics_recursive(ANGLES_CHANGED);
}

void resolver::setup_resolver_layers(player_t* player, adjust_data& lag_record, const int32_t rotation_mode)
{
    switch (rotation_mode)
    {
    case ROTATE_SERVER:
    {
        memcpy(lag_record.m_resolver_layers.at(S_SERVER).data(), player->get_animlayers(),
            sizeof(AnimationLayer) * ANIMATION_LAYER_COUNT);
    }
    break;
    case ROTATE_LEFT:
    case ROTATE_LOW_LEFT:
    {
        memcpy(lag_record.m_resolver_layers.at(S_LEFT).data(), player->get_animlayers(),
            sizeof(AnimationLayer) * ANIMATION_LAYER_COUNT);
    }
    break;
    case ROTATE_RIGHT:
    case ROTATE_LOW_RIGHT:
    {
        memcpy(lag_record.m_resolver_layers.at(S_RIGHT).data(), player->get_animlayers(),
            sizeof(AnimationLayer) * ANIMATION_LAYER_COUNT);
    }
    break;
    default: break;
    }
}

float resolver::resolve_pitch()
{
    return original_pitch;
}
куда и как это всё пихать,обьясните мне пж я тупой
 
Начинающий
Статус
Оффлайн
Регистрация
12 Мар 2022
Сообщения
72
Реакции[?]
4
Поинты[?]
5K
Сверху Снизу