push me to the edge
-
Автор темы
- #1
Правильный брутфорс резольвер, юзайте
хотел написать с обьяснениями, но т.к югейм не дает мне сделать много одинаковых бб кодов то сами додумайте что и почему или посмотрите обьяснения на другом всем известном форуме
C++:
void Resolver( C_CSPlayer* player ) {
auto animState = player->m_PlayerAnimState( );
auto& resolverInfo = g_ResolverData[ player->EntIndex( ) ];
// Rebuild setup velocity to receive flMinBodyYaw and flMaxBodyYaw
Vector velocity = player->m_vecVelocity( );
float spd = velocity.LengthSquared( );
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 = m_flChokedTime * 6.0f;
float v28;
// clamp
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 = GetSmoothedVelocity( m_flChokedTime * 2000.0f, velocity, animState->m_vecVelocity );
float speed = std::fminf( animationVelocity.Length( ), 260.0f );
auto weapon = ( C_WeaponCSBaseGun* ) player->m_hActiveWeapon( ).Get( );
float flMaxMovementSpeed = 260.0f;
if ( weapon ) {
flMaxMovementSpeed = std::fmaxf( weapon->GetMaxSpeed( ), 0.001f );
}
float flRunningSpeed = speed / ( flMaxMovementSpeed * 0.520f );
float flDuckingSpeed = speed / ( flMaxMovementSpeed * 0.340f );
flRunningSpeed = Math::Clamp( flRunningSpeed, 0.0f, 1.0f );
float flYawModifier = ( ( ( animState->m_flGroundFraction * -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 flMinBodyYaw = std::fabsf( animState->m_flMinBodyYaw * flYawModifier );
float flMaxBodyYaw = std::fabsf( animState->m_flMaxBodyYaw * flYawModifier );
float flEyeYaw = player->m_angEyeAngles( ).yaw;
float flEyeDiff = std::remainderf( flEyeYaw - resolverInfo.m_flFakeGoalFeetYaw, 360.f );
if ( flEyeDiff <= flMaxBodyYaw ) {
if ( flMinBodyYaw > flEyeDiff )
resolverInfo.m_flFakeGoalFeetYaw = fabs( flMinBodyYaw ) + flEyeYaw;
} else {
resolverInfo.m_flFakeGoalFeetYaw = flEyeYaw - fabs( flMaxBodyYaw );
}
resolverInfo.m_flFakeGoalFeetYaw = std::remainderf( resolverInfo.m_flFakeGoalFeetYaw, 360.f );
if ( speed > 0.1f || fabs( velocity.z ) > 100.0f ) {
resolverInfo.m_flFakeGoalFeetYaw = ApproachAngle(
flEyeYaw,
resolverInfo.m_flFakeGoalFeetYaw,
( ( animState->m_flGroundFraction * 20.0f ) + 30.0f )
* m_flChokedTime );
} else {
resolverInfo.m_flFakeGoalFeetYaw = ApproachAngle(
player->GetLowerBodyYaw( ),
resolverInfo.m_flFakeGoalFeetYaw,
m_flChokedTime * 100.0f );
}
float Left = flEyeYaw - flMinBodyYaw;
float Right = flEyeYaw + flMaxBodyYaw;
float resolveYaw;
switch ( resolverInfo.m_iMissedShots % 3 ) {
case 0: // brute left side
resolveYaw = Left;
break;
case 1: // brute fake side
resolveYaw = resolverInfo.m_flFakeGoalFeetYaw;
break;
case 2: // brute right side
resolveYaw = Right;
break;
default:
break;
}
animState->m_flAbsRotation = resolveYaw;
}