-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
https://yougame.biz/threads/248777/ (noad) - взял отсюда
https://yougame.biz/threads/96665/ (noad) - взял отсюда
https://yougame.biz/threads/96665/ (noad) - взял отсюда
Код:
auto animstate = player->get_animation_state();
auto speed = player->m_vecVelocity().Length2D();
if (player->m_fFlags() & FL_ONGROUND)
{
if (player->m_vecVelocity().Length2D() < 0.1f)
{
auto delta = math::normalize_yaw(player->m_angEyeAngles().y - animstate->m_flGoalFeetYaw);
if (previous_layers[3].m_flWeight == 0.0f && previous_layers[3].m_flCycle == 0.0f) {
ResolverIndex = std::clamp((2 * (delta <= 0.f) - 1), -1, 1);
}
}
else if (!int(previous_layers[12].m_flWeight * 1000.f))
{
if (int(previous_layers[6].m_flWeight * 1000.f) == int(previous_layers[6].m_flWeight * 1000.f))
{
float delta1 = abs(previous_layers[6].m_flPlaybackRate - resolver_layers[0][6].m_flPlaybackRate);
float delta2 = abs(previous_layers[6].m_flPlaybackRate - resolver_layers[1][6].m_flPlaybackRate);
float delta3 = abs(previous_layers[6].m_flPlaybackRate - resolver_layers[2][6].m_flPlaybackRate);
if (delta1 < delta3 || delta2 <= delta3 || (int)(float)(delta3 * 1000.0f)) {
if (delta1 >= delta2 && delta3 > delta2 && !(int)(float)(delta2 * 1000.0f))
{
ResolverIndex = 1;
}
}
else
{
ResolverIndex = -1;
}
if (delta2 > 0 || delta3 > 0)
{
float delta2 = fabsf(previous_layers[6].m_flPlaybackRate - resolver_layers[1][6].m_flPlaybackRate); // left
float delta3 = fabsf(previous_layers[6].m_flPlaybackRate - resolver_layers[2][6].m_flPlaybackRate); // right
if (delta2 < delta2 && delta3 >= delta3)
{
ResolverIndex = -1; // Left
}
else if (delta3 < delta2 || delta3 < delta2)
{
ResolverIndex = 1; // Right
}
}
}
}
}
if (!player->IsDormant())
{
if (ResolverIndex >= -1)
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 58;
else
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 58;
for (; animstate->m_flGoalFeetYaw > 180.0f; animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 360);
for (; animstate->m_flGoalFeetYaw < -180.0f; animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 360);
}
else
{
if (ResolverIndex <= 1)
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 58;
else
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 58;
for (; animstate->m_flGoalFeetYaw > 180.0f; animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 360);
for (; animstate->m_flGoalFeetYaw < -180.0f; animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 360);
}
Код:
auto animState = player->get_animation_state();
auto resolverInfo = player->EntIndex();
Vector velocity = player->m_vecVelocity();
float spd = velocity.LengthSqr();
if (spd > std::powf(1.2f * 260.0f, 2.f))
{
Vector velocity_normalized = velocity.Normalized();
velocity = velocity_normalized * (1.2f * 260.0f);
}
float v25 = math::clamp(player->m_flDuckAmount() + animState->m_fLandingDuckAdditiveSomething, 0.0f, 1.0f);
float v26 = animState->m_fDuckAmount;
float v27 = animstate->m_flLastClientSideAnimationUpdateTime * 6.0f;
float v28;
if ((v25 - v26) <= v27)
{
if (-v27 <= (v25 - v26))
v28 = v25;
else
v28 = v26 - v27;
}
else
{
v28 = v26 + v27;
}
float flDuckAmount = math::clamp(v28, 0.0f, 1.0f);
Vector animationVelocity = player->m_vecVelocity();
float speed = std::fminf(animationVelocity.Length(), 260.0f);
auto weapon = (weapon_info_t*)player->m_hActiveWeapon().Get();
float flMaxMovementSpeed = 260.0f;
if (weapon)
{
flMaxMovementSpeed = std::fmaxf(weapon->flMaxPlayerSpeed, 0.001f);
}
float flRunningSpeed = speed / (flMaxMovementSpeed * 0.520f);
float flDuckingSpeed = speed / (flMaxMovementSpeed * 0.340f);
flRunningSpeed = math::clamp(flRunningSpeed, 0.0f, 1.0f);
float stop_to_full_running_fraction = 0.f;
float flYawModifier = (((stop_to_full_running_fraction * -0.3f) - 0.2f) * flRunningSpeed) + 1.0f;
if (flDuckAmount > 0.0f)
{
float flDuckingSpeed = math::clamp(flDuckingSpeed, 0.0f, 1.0f);
flYawModifier += (flDuckAmount * flDuckingSpeed) * (0.5f - flYawModifier);
}
float flMaxBodyYaw = *reinterpret_cast<float*>(&animState->pad10[512]);
float flMinBodyYaw = *reinterpret_cast<float*>(&animState->pad10[516]);
float flEyeYaw = player->m_angEyeAngles().y;
float flEyeDiff = std::remainderf(flEyeYaw - animState->m_flGoalFeetYaw, 360.f);
if (flEyeDiff <= flMaxBodyYaw)
{
if (flMinBodyYaw > flEyeDiff)
animState->m_flGoalFeetYaw = fabs(flMinBodyYaw) + flEyeYaw;
}
else
{
animState->m_flGoalFeetYaw = flEyeYaw - fabs(flMaxBodyYaw);
}
animState->m_flGoalFeetYaw = std::remainderf(animState->m_flGoalFeetYaw, 360.f);
if (speed > 0.1f || fabs(velocity.z) > 100.0f)
{
animState->m_flGoalFeetYaw = math::ApproachAngle(flEyeYaw, animState->m_flGoalFeetYaw, ((stop_to_full_running_fraction * 20.0f) + 30.0f) * animState->m_flLastClientSideAnimationUpdateTime);
}
else
{
animState->m_flGoalFeetYaw = math::ApproachAngle(player->m_flLowerBodyYawTarget(), animState->m_flGoalFeetYaw, animState->m_flLastClientSideAnimationUpdateTime * 100.0f);
}
float Left = flEyeYaw - flMinBodyYaw;
float Right = flEyeYaw + flMaxBodyYaw;
float resolveYaw;
float brute_yaw = animState->m_flGoalFeetYaw;
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 3)
{
case 0:
player->get_animation_state()->m_flGoalFeetYaw = Left * ResolverIndex;
break;
case 1:
player->get_animation_state()->m_flGoalFeetYaw = brute_yaw * ResolverIndex;
break;
case 2:
player->get_animation_state()->m_flGoalFeetYaw = Right * ResolverIndex;
break;
default:
break;
}
Последнее редактирование: