-
Автор темы
- #1
ксго 2016 года
детектит edgebug но плохо ведет до конца текстуры, могу видос приложить
детектит edgebug но плохо ведет до конца текстуры, могу видос приложить
Код:
struct {
vec2_t move;
int buttons;
i_restore_data move_data;
} backup;
if (!edgebug_t::detection) {
backup.move = vec2_t(cmd->forwardmove, cmd->sidemove);
backup.buttons = cmd->buttons;
for (int pre_ticks = 0; pre_ticks < 2; pre_ticks++) {
interfaces::prediction->restore_predict();
edgebug_t::flags = local_player->get_flags();
edgebug_t::velocity = local_player->get_velocity();
if (pre_ticks) {
edgebug_t::duck = true;
cmd->buttons |= in_duck;
engine_predict::restore_datas.restore_move_data.buttons |= in_duck;
engine_predict::restore_datas.restore_move_data.forward_move = 0;
engine_predict::restore_datas.restore_move_data.side_move = 0;
}
else {
edgebug_t::duck = false;
cmd->buttons &= ~in_duck;
engine_predict::restore_datas.restore_move_data.buttons &= ~in_duck;
engine_predict::restore_datas.restore_move_data.forward_move = 0;
engine_predict::restore_datas.restore_move_data.side_move = 0;
}
engine_predict::apply_restore_data(engine_predict::restore_datas, local_player, cmd);
for (int ticks = 0; ticks < 64; ticks++) {
if (edgebug_t::flags & fl_onground || edgebug_t::velocity.z > 0.f || (int)roundf(edgebug_t::velocity.z) == 0.0)
break;
engine_predict::start(local_player, cmd);
engine_predict::end(local_player);
if (is_edgebug(edgebug_t::velocity, local_player->get_velocity())) {
edgebug_t::ticks = interfaces::global_vars->tickcount + (ticks + 1);
edgebug_t::viewangles = cmd->viewangles;
edgebug_t::detection = true;
break;
}
if (local_player->get_flags() & fl_onground || local_player->get_velocity().z > 0.f || (int)roundf(local_player->get_velocity().z) == 0.0)
break;
edgebug_t::flags = local_player->get_flags();
edgebug_t::velocity = local_player->get_velocity();
}
}
cmd->buttons = backup.buttons;
cmd->forwardmove = backup.move.x;
cmd->sidemove = backup.move.y;
}
if (edgebug_t::detection) {
if (edgebug_t::ticks < interfaces::global_vars->tickcount || engine_predict::old::flags & fl_onground) {
edgebug_t::detection = false;
return;
}
interfaces::engine_client->set_view_angles(edgebug_t::viewangles);
if (edgebug_t::duck)
cmd->buttons |= in_duck;
else
cmd->buttons &= ~in_duck;
cmd->forwardmove = 0.f;
cmd->sidemove = 0.f;
return;
}
Код:
void engine_predict::store_restore_data(i_restore_data& restore_data,player_t* player, c_user_cmd* user_cmd)
{
restore_data.valid = true;
*restore_data.ground_entity = player->get_ground_entity();
restore_data.flags = player->get_flags();
restore_data.fall_velocity = player->get_fall_velocity();
restore_data.velocity = player->get_velocity();
restore_data.origin = player->get_vec_origin();
interfaces::prediction->setup_move(player, user_cmd, interfaces::move_helper, &restore_data.restore_move_data);
//memcpy(&restore_data.restore_move_data, &move_data, sizeof(i_move_data));
}
void engine_predict::apply_restore_data(i_restore_data& restore_data, player_t* player, c_user_cmd* user_cmd)
{
if (!restore_data.valid)
return;
interfaces::prediction->finish_move(player, user_cmd, &restore_data.restore_move_data);
player->get_ground_entity() = *restore_data.ground_entity;
player->get_flags() = restore_data.flags;
player->get_fall_velocity() = restore_data.fall_velocity;
player->get_velocity() = restore_data.velocity;
player->get_vec_origin() = restore_data.origin;
//memcpy(&move_data, &restore_data.restore_move_data, sizeof(i_move_data));
restore_data.reset();
}
Код:
void restore_predict() {
previous_start_frame = -1;
commands_predicted = 0;
server_commands_acknowledged = 0;
}