-
Автор темы
- #1
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.
You'll want to call this every frame as that's when the client normally updates animations for players.
Then in DrawModelExecute:
Код:
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;
}
}
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);
}