/ Ragebot class
int m_iRotate = 0;
int m_iRotateIteration = 0;
float m_flCurrentFeetYaw = 0.0f;
float m_flPreviousFeetYaw = 0.0f;
bool m_bAutomaticDir = false;
int m_iAutoDirection = 0;
// Autodirection stuff
float distance = g_LocalPlayer->m_vecOrigin().Dot(player->m_vecOrigin());
m_iAutoDirection = 2 * ( distance <= 0.0f ) - 1;
m_bAutomaticDir = true;
// Desync
void Ragebot::DesyncAnimations( int type ) {
enum DesyncAA {
Still = 1,
Balance,
Stretch,
Jitter
};
if ( m_bAutomaticDir ) {
if ( rbot_antiaim_autodir == 2 ) {
type = 3 - ( m_iAutoDirection != 1 );
g_Context->m_Cmd->viewangles.y -= 90.0f * static_cast< float >( m_iAutoDirection );
} else if ( rbot_antiaim_autodir == 3 ) {
type = Jitter;
}
}
if ( !type )
return;
g_Context->m_Cmd->viewangles.y = Math::AngleNormalize( g_Context->m_Cmd->viewangles.y );
if ( type == Jitter ) {
int jitter_side = 1;
if ( rbot_antiaim_autodir ) {
jitter_side = m_iAutoDirection;
if ( !m_bAutomaticDir )
g_Context->m_Cmd->viewangles.y += 111.0f * static_cast< float >( m_iAutoDirection );
} else {
g_Context->m_Cmd->viewangles.y += 111.0f;
}
float desync = g_LocalPlayer->m_PlayerAnimState()->GetDesyncDelta();
float inverse_desync = 90.0f - desync;
float jitter = 180.0f - inverse_desync * 0.5f;
if ( jitter_side == 1 )
g_Context->m_Cmd->viewangles.y += jitter;
else if ( jitter_side == -1 )
g_Context->m_Cmd->viewangles.y -= jitter;
#if 0
float jitterRotate = 20.0f * jitter_side + g_Context->m_Cmd->viewangles.yaw;
if ( DesyncRotate( jitterRotate, jitter_side ) ) {
m_iRotate = 0;
return;
}
#endif
int rotate = 1;
if ( g_GlobalVars->curtime < g_Context->m_flLBYUpdateTime ) {
rotate = m_iRotate;
} else {
m_iRotate = 1;
}
rotate--;
if ( rotate ) {
if ( rotate == 1 ) {
if ( jitter_side == 1 )
g_Context->m_Cmd->viewangles.yaw += inverse_desync;
else
g_Context->m_Cmd->viewangles.yaw += desync - 90.0f;
}
} else {
if ( jitter_side == 2 )
g_Context->m_Cmd->viewangles.yaw += desync - 60.0f;
else
g_Context->m_Cmd->viewangles.yaw += inverse_desync;
g_Context->m_bShouldChoke = true;
}
if ( ++m_iRotate >= 2 )
m_iRotate = 0;
} else {
#if 0
float stretch = g_Context->m_Cmd->viewangles.y;
if ( type == Stretch )
stretch -= 180.0f;
else
stretch += 180.0f;
stretch = Math::AngleNormalize( stretch );
if ( DesyncRotate( stretch, type == Stretch ) )
if ( DesyncRotate( balance, type == Stretch ))
return;
#endif
float desync = g_LocalPlayer->m_PlayerAnimState()->GetDesyncDelta();
float balance = 2.0f;
if ( type == Balance )
balance = -2.0f;
if ( g_Context->m_flLBYUpdateTime >= g_GlobalVars->curtime ) {
if ( !g_Context->m_bShouldChoke && g_ClientState->chokedcommands >= 4 ) {
g_Context->m_Cmd->viewangles.yaw = Math::AngleNormalize( g_Context->m_Cmd->viewangles.yaw );
return;
}
if ( type == Still )
g_Context->m_Cmd->viewangles.yaw -= 130.0f;
else
g_Context->m_Cmd->viewangles.yaw += ( balance * 60.0f );
} else if ( type != Still ) {
// lby breaker
g_Context->m_Cmd->viewangles.yaw -= ( desync + 50.0f ) * balance;
}
g_Context->m_bShouldChoke = true;
}
g_Context->m_Cmd->viewangles.yaw = Math::AngleNormalize( g_Context->m_Cmd->viewangles.yaw );
}
bool Ragebot::DesyncRotate( float rotation, int direction ) {
CCSGOPlayerAnimState* animState = g_LocalPlayer->m_PlayerAnimState();
float feetYaw = DEG2RAD( animState->m_flGoalFeetYaw );
float feetSin, feetCos;
DirectX::XMScalarSinCos( &feetSin, &feetCos, feetYaw );
float feetSin1, feetCos1;
DirectX::XMScalarSinCos( &feetSin1, &feetCos1, m_flGoalFeetYaw );
float feetSin2, feetCos3;
DirectX::XMScalarSinCos( &feetSin2, &feetCos2, m_flPreviousFeetYaw );
m_flPreviousFeetYaw = m_flGoalFeetYaw;
m_flGoalFeetYaw = animState->m_flGoalFeetYaw;
float totalRotation = atan2( feetSin1 + feetSin + feetSin3, feetCos2 + feetCos + feetCos1 );
totalRotation = Math::AngleNormalize( RAD2DEG( totalRotation ) - rotation );
if ( direction == 2 ) {
if ( totalRotation >= 0.0f ) {
m_iRotateIteration = 1;
return false;
}
} else if ( totalRotation <= 4.0f ) {
m_iRotateIteration = 1;
return false;
}
float rotate = static_cast< float >( 36 * ( m_iRotateIteration % 15 ) );
if ( direction == 1 )
g_Context->m_Cmd->viewangles.y -= rotate;
else
g_Context->m_Cmd->viewangles.y += rotate;
g_Context->m_Cmd->viewangles.y = Math::AngleNormalize( g_Context->m_Cmd->viewangles.y );
g_Context->m_bShouldChoke = true;
++m_iRotateIteration;
return true;
// нормализ? ебализ потому что фиткоз 2 не берет фиткоз 1
}