Proper desync chams

Начинающий
Статус
Оффлайн
Регистрация
8 Фев 2019
Сообщения
23
Реакции[?]
2
Поинты[?]
0
In order to achieve proper desync chams you'll want to feed the incorrect data to a separate animation state and draw a model with the bones from that.


Код:
void animation_system::manage_local_fake_animstate()
{
    if (!game::local || !game::local->is_alive())
        return;
 
    static auto handle = game::local->get_ref_ehandle();
    static auto spawn_time = game::local->get_spawn_time();
    static auto old_sim_time = game::local->get_sim_time();
 
    bool allocate = (!fake_anim_state),
        change = (!allocate) && (game::local->get_ref_ehandle() != handle),
        reset = (!allocate && !change) && (game::local->get_spawn_time() != spawn_time);
 
    if (change)
        free(fake_anim_state);
 
    if (reset)
    {
        sdk::cs_player::reset_anim_state(fake_anim_state);
 
        spawn_time = game::local->get_spawn_time();
    }
 
    if (allocate || change)
    {
        auto* state = reinterpret_cast<sdk::cs_player_anim_state*>(malloc(sizeof(sdk::cs_player_anim_state)));
 
        if (state != nullptr)
            game::local->create_anim_state(state);
 
        handle = game::local->get_ref_ehandle();
        spawn_time = game::local->get_spawn_time();
 
        fake_anim_state = state;
    }
    else if (game::local->get_sim_time() != old_sim_time)
    {
        old_sim_time = game::local->get_sim_time();
 
        std::array<sdk::animation_layer, 13> networked_layers;
        std::copy(game::local->get_anim_layers(), game::local->get_anim_layers() + networked_layers.size(), networked_layers);
 
        auto backup_poses = game::local->get_pose_parameters();
        auto networked_angles = game::local->get_eye_angles();
 
        game::local->get_eye_angles() = anti_aim::choked_angles;
 
        game::local->update_anim_state(fake_anim_state, anti_aim::choked_angles);
        game::local->setup_bones(game::fake_matrix, 128, 0x7FF00, global_vars_base->cur_time);
 
        game::local->get_eye_angles() = networked_angles;
 
        std::copy(networked_layers.begin(), networked_layers.end(), game::local->get_anim_layers());
        game::local->get_pose_parameters() = backup_poses;
    }
}
You'll want to call this every frame as that's when the client normally updates animations for players.

Then in DrawModelExecute:

Код:
if (info.entity_index == game :: local-> index ())

{

    // set your materials, etc



    original (ecx, edx, context, state, info, game :: fake_matrix);

    model_render-> forced_material_override (nullptr);

}
 
Забаненный
Статус
Оффлайн
Регистрация
9 Янв 2019
Сообщения
701
Реакции[?]
295
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
this is wrong as fuck ( ghetto memory allocation for the new animstate... )
 
              ru p2cs > all                      
Разработчик
Статус
Оффлайн
Регистрация
19 Авг 2016
Сообщения
1,576
Реакции[?]
1,955
Поинты[?]
125K
( ghetto memory allocation for the new animstate... )
што????

в чем проблема юзания malloc??

безусловно можно просто передавать анимстейт с амперсантом и тогда аллоцировать память не придется, но блять, в malloc нет ничего ghetto. wtf???
 
Забаненный
Статус
Оффлайн
Регистрация
8 Ноя 2019
Сообщения
176
Реакции[?]
63
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Сверху Снизу