Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- / 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 += 90.0f * static_cast< float >( m_iAutoDirection );
- } else {
- g_Context->m_Cmd->viewangles.y += 90.0f;
- }
- float desync = g_LocalPlayer->m_PlayerAnimState()->GetDesyncDelta();
- float inverse_desync = 190.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 = 90.0f * jitter_side + g_Context->m_Cmd->viewangles.yaw;
- if ( DesyncRotate( jitterRotate, jitter_side ) ) {
- m_iRotate = 0;
- return;
- }
- #endif
- int rotate = 0;
- if ( g_GlobalVars->curtime < g_Context->m_flLBYUpdateTime ) {
- rotate = m_iRotate;
- } else {
- m_iRotate = 0;
- }
- 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 - 190.0f;
- }
- } else {
- if ( jitter_side == 1 )
- g_Context->m_Cmd->viewangles.yaw += desync - 190.0f;
- else
- g_Context->m_Cmd->viewangles.yaw += inverse_desync;
- g_Context->m_bShouldChoke = true;
- }
- if ( ++m_iRotate >= 3 )
- m_iRotate = 0;
- } else {
- #if 0
- float stretch = g_Context->m_Cmd->viewangles.y;
- if ( type == Stretch )
- stretch -= 90.0f;
- else
- stretch += 90.0f;
- stretch = Math::AngleNormalize( stretch );
- if ( DesyncRotate( stretch, type == Stretch ) )
- return;
- #endif
- float desync = g_LocalPlayer->m_PlayerAnimState()->GetDesyncDelta();
- float balance = 1.0f;
- if ( type == Balance )
- balance = -1.0f;
- if ( g_Context->m_flLBYUpdateTime >= g_GlobalVars->curtime ) {
- if ( !g_Context->m_bShouldChoke && g_ClientState->chokedcommands >= 2 ) {
- g_Context->m_Cmd->viewangles.yaw = Math::AngleNormalize( g_Context->m_Cmd->viewangles.yaw );
- return;
- }
- if ( type == Still )
- g_Context->m_Cmd->viewangles.yaw -= 100.0f;
- else
- g_Context->m_Cmd->viewangles.yaw += ( balance * 120.0f );
- } else if ( type != Still ) {
- // lby breaker
- g_Context->m_Cmd->viewangles.yaw -= ( desync + 30.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, feetCos2;
- DirectX::XMScalarSinCos( &feetSin2, &feetCos2, m_flPreviousFeetYaw );
- m_flPreviousFeetYaw = m_flGoalFeetYaw;
- m_flGoalFeetYaw = animState->m_flGoalFeetYaw;
- float totalRotation = atan2( feetSin1 + feetSin + feetSin2, feetCos1 + feetCos + feetCos2 );
- totalRotation = Math::AngleNormalize( RAD2DEG( totalRotation ) - rotation );
- if ( direction == 1 ) {
- if ( totalRotation >= 0.0f ) {
- m_iRotateIteration = 1;
- return false;
- }
- } else if ( totalRotation <= 0.0f ) {
- m_iRotateIteration = 1;
- return false;
- }
- float rotate = static_cast< float >( 30 * ( m_iRotateIteration % 12 ) );
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement