Исходник Engine_predict_player

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
343
Реакции[?]
216
Поинты[?]
122K
C++:
void lag_compensation::engine_predict_player(Player* entity, int ticks, bool called_from_create_move, bool was_jumping, bool ducking, bool forward_velocity, AimPlayer* const p_c_player) {
  if (forward_velocity) {
    ang_t velocity_angles;
    math::vector_angles(entity->m_vec_velocity(), velocity_angles);
    velocity_angles.clamp();
    entity->m_ang_eye_angles() = velocity_angles;
  }

  for (int i = 0; i < ticks; i++) {
    ang_t eye_angles = entity->m_ang_eye_angles();
    eye_angles.clamp();
    ang_t velocity_angles;
    math::vector_angles(entity->m_vec_velocity(), velocity_angles);
    float yawdelta = math::clamp_yaw(eye_angles.y - velocity_angles.y);
    CUserCmd new_cmd;
    CMoveData new_data;
    memset(&new_data, 0, sizeof(CMoveData));
    memset(&new_cmd, 0, sizeof(CUserCmd));
    new_cmd.m_view_angles = entity->m_ang_eye_angles();
    new_cmd.m_view_angles.clamp();
    new_cmd.m_tick = g_cl.m_cmd->m_tick;

    if (ducking)
      new_cmd.m_buttons = IN_DUCK;

    if ((was_jumping && entity->m_f_flags() & FL_ONGROUND) || entity->m_b_is_in_duck_jump())
      new_cmd.m_buttons |= IN_JUMP;

    if (*(DWORD*)((DWORD)entity + 0x389D))
      new_cmd.m_buttons |= IN_SPEED;

    new_cmd.m_command_number = g_cl.m_cmd->m_command_number;
    new_cmd.m_predicted = false;

    if (entity->m_vec_velocity().length() != 0.0f) {
      if (yawdelta < 0.0f)
        yawdelta += 360.0f;
      float yawdeltaabs = fabsf(yawdelta);

      if (yawdelta > 359.5f || yawdelta < 0.5f) {
        new_cmd.m_buttons |= IN_FORWARD;
        new_cmd.m_forward_move = 450.0f;
        new_cmd.m_side_move = 0.0f;
      }
      else if (yawdelta > 179.5f && yawdelta < 180.5f) {
        new_cmd.m_buttons |= IN_BACK;
        new_cmd.m_forward_move = -450.0f;
        new_cmd.m_side_move = 0.0f;
      }
}
 
like amiri in my mind
Пользователь
Статус
Оффлайн
Регистрация
4 Дек 2022
Сообщения
308
Реакции[?]
54
Поинты[?]
1K
so what is pred engine for?
also why are u tryin to predict 64 ticks at once? :anguished: :cry:
 
Последнее редактирование:
Сверху Снизу