-
Автор темы
- #1
resolver.cpp:
inline void prepare_jitter(c_cs_player* player, resolver_info_t& resolver_info, anim_record_t* current)
{
auto& jitter = resolver_info.jitter;
jitter.yaw_cache[jitter.yaw_cache_offset % YAW_CACHE_SIZE] = current->eye_angles.y;
if (jitter.yaw_cache_offset >= YAW_CACHE_SIZE)
jitter.yaw_cache_offset = 0;
else
jitter.yaw_cache_offset++;
float total_yaw_change = 0.f;
int num_changes = 0;
for (int i = 0; i < YAW_CACHE_SIZE - 1; ++i)
{
float diff = std::fabsf(jitter.yaw_cache[i] - jitter.yaw_cache[i + 1]);
total_yaw_change += diff;
if (diff != 0.f) num_changes++;
}
float avg_yaw_change = num_changes > 0 ? total_yaw_change / num_changes : 0.f;
jitter.is_jitter = avg_yaw_change > JITTER_THRESHOLD;
}
resolver.hpp:
constexpr auto JITTER_THRESHOLD = 10.0f;