summaryrefslogtreecommitdiff
path: root/cheat
diff options
context:
space:
mode:
Diffstat (limited to 'cheat')
-rw-r--r--cheat/internal_rewrite/context.cpp4
-rw-r--r--cheat/internal_rewrite/context.hpp1
-rw-r--r--cheat/internal_rewrite/draw_model_execute.cpp85
-rw-r--r--cheat/internal_rewrite/lag_mgr.cpp18
-rw-r--r--cheat/internal_rewrite/lag_mgr.hpp4
-rw-r--r--cheat/internal_rewrite/math.hpp31
-rw-r--r--cheat/internal_rewrite/movement.cpp10
-rw-r--r--cheat/internal_rewrite/ragebot_lagcomp.cpp2
-rw-r--r--cheat/internal_rewrite/ragebot_resolver.cpp12
9 files changed, 141 insertions, 26 deletions
diff --git a/cheat/internal_rewrite/context.cpp b/cheat/internal_rewrite/context.cpp
index cf25cab..cec25ba 100644
--- a/cheat/internal_rewrite/context.cpp
+++ b/cheat/internal_rewrite/context.cpp
@@ -120,6 +120,10 @@ void c_context::on_cmove_end( user_cmd_t* cmd ) {
if( std::abs( m_last_shot - m_last_shot_ack ) >= 10 )
reset_shot_queue( );
+ m_past_origins.push_front( m_last_origin );
+ while( m_past_origins.size( ) > TIME_TO_TICKS( 1.f ) )
+ m_past_origins.pop_back( );
+
*get_last_cmd( ) = *cmd;
}
diff --git a/cheat/internal_rewrite/context.hpp b/cheat/internal_rewrite/context.hpp
index 27f1a42..a1a3dfb 100644
--- a/cheat/internal_rewrite/context.hpp
+++ b/cheat/internal_rewrite/context.hpp
@@ -75,6 +75,7 @@ public:
int m_last_shot;
std::array< shot_data_t, 128 > m_shot_data;
+ std::deque< vec3_t > m_past_origins;
std::vector< int > m_cmd_numbers;
private:
std::deque< user_cmd_t > m_snapshot;
diff --git a/cheat/internal_rewrite/draw_model_execute.cpp b/cheat/internal_rewrite/draw_model_execute.cpp
index 49825f6..54ef673 100644
--- a/cheat/internal_rewrite/draw_model_execute.cpp
+++ b/cheat/internal_rewrite/draw_model_execute.cpp
@@ -27,12 +27,80 @@ void __fastcall hooks::draw_model_execute( IVModelRender* ecx_, void* edx_,
//printf( "model: %s\n", model_name );
if( strstr( model_name, xors( "models/player" ) ) && info.m_entity_index == local_index ) {
- if( g_settings.misc.thirdperson( ) && g_ctx.m_local && g_ctx.m_local->is_valid( )
- && g_ctx.m_local->m_bIsScoped( ) ) {
- float clr[ ] = { 1.0f, 1.0f, 1.0f };
- g_csgo.m_render_view( )->SetColorModulation( clr );
- g_csgo.m_render_view( )->SetBlend( 0.3f );
- return dme_o( ecx_, edx_, render_ctx, state, info, bone_to_world );
+ if( g_settings.misc.thirdperson( ) && g_ctx.m_local && g_ctx.m_local->is_valid( ) ) {
+ if( g_settings.rage.anti_aim ) {
+ static bool was_peeking = false;
+ static float peek_time = 0.f;
+ bool is_peeking = g_cheat.m_lagmgr.m_is_peeking;
+
+ if( is_peeking ) {
+ if( !was_peeking ) {
+ peek_time = g_csgo.m_globals->m_curtime;
+ }
+
+ auto matrix = g_cheat.m_lagmgr.m_peek_matrix;
+ clr_t col( 225, 225, 225, g_ctx.m_local->m_bIsScoped( ) ? 9 : 25 );
+
+ float totaltime = TICKS_TO_TIME( g_settings.rage.fakelag.ticks - 1 );
+
+ float end_time = peek_time + totaltime;
+ float delta = ( end_time - g_csgo.m_globals->m_curtime ) / totaltime;
+ delta = std::clamp( delta, 0.f, 1.f );
+
+ float progress = math::ease_in( 0.f, 1.f, delta );
+
+ float alpha = 0.f;
+ if( progress < 0.5f ) {
+ alpha = progress * 2.f;
+ } else {
+ alpha = 1.f - ( 0.5f - progress ) * 2.f;
+ }
+
+ col.a( ) *= alpha;
+
+ float backup_blend;
+ float backup_modulation[ 3 ];
+
+ if( g_ctx.m_local->m_bIsScoped( ) ) {
+ backup_blend = 0.3f;
+ backup_modulation[ 0 ] = backup_modulation[ 1 ] = backup_modulation[ 2 ] == 1.f;
+ }
+
+ backup_blend = g_csgo.m_render_view( )->GetBlend( );
+ g_csgo.m_render_view( )->GetColorModulation( backup_modulation );
+
+ bool wanted_ignorez = g_settings.visuals.chams.ignore_z( ) && g_settings.visuals.chams.friendlies( );
+ bool backup = false;
+
+ fclr_t clr_hid = g_settings.visuals.chams.color_hidden_friendly( ).to_fclr( );
+ if( backup_modulation[ 0 ] == clr_hid.r( ) && backup_modulation[ 1 ] == clr_hid.g( ) && backup_modulation[ 2 ] == clr_hid.b( )
+ && backup_blend == clr_hid.a( ) ) {
+ backup = true;
+ }
+
+ if( backup == wanted_ignorez || ( !backup && !g_settings.visuals.chams.clear_occlusion( ) ) || !g_settings.visuals.chams.enabled( )
+ || g_ctx.m_local->m_bIsScoped( ) ) {
+ g_cheat.m_chams.m_materials.m_chams_flat.m_mat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, false );
+ g_cheat.m_chams.m_materials.force_material( g_cheat.m_chams.m_materials.m_chams_flat, col.to_fclr( ) );
+ dme_o( ecx_, edx_, render_ctx, state, info, matrix );
+ g_cheat.m_chams.m_materials.m_chams_flat.m_mat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, backup );
+
+ g_csgo.m_render_view( )->SetBlend( backup_blend );
+ g_csgo.m_render_view( )->SetColorModulation( backup_modulation );
+ g_csgo.m_model_render( )->ForcedMaterialOverride( g_settings.visuals.chams.enabled( ) &&
+ g_settings.visuals.chams.friendlies( ) && !g_ctx.m_local->m_bIsScoped( ) ? mat : nullptr );
+ }
+ }
+
+ was_peeking = is_peeking;
+ }
+
+ if( g_ctx.m_local->m_bIsScoped( ) ) {
+ float clr[ ] = { 1.0f, 1.0f, 1.0f };
+ g_csgo.m_render_view( )->SetColorModulation( clr );
+ g_csgo.m_render_view( )->SetBlend( 0.3f );
+ return dme_o( ecx_, edx_, render_ctx, state, info, bone_to_world );
+ }
}
}
@@ -90,11 +158,6 @@ void __fastcall hooks::draw_model_execute( IVModelRender* ecx_, void* edx_,
g_csgo.m_render_view( )->SetColorModulation( backup_modulation );
g_csgo.m_model_render( )->ForcedMaterialOverride( g_settings.visuals.chams.enabled( ) &&
( team != local_team || g_settings.visuals.chams.friendlies( ) ) ? mat : nullptr );
-
- if( draw ) {
- //dme_o( ecx_, edx_, render_ctx, state, info, bone_to_world );
- //draw = false;
- }
}
}
}
diff --git a/cheat/internal_rewrite/lag_mgr.cpp b/cheat/internal_rewrite/lag_mgr.cpp
index 0233e4a..610a0af 100644
--- a/cheat/internal_rewrite/lag_mgr.cpp
+++ b/cheat/internal_rewrite/lag_mgr.cpp
@@ -126,16 +126,28 @@ namespace features
bool peeking = predict_position( 20.f + g_ctx.m_local->m_vecVelocity( ) * TICK_INTERVAL( ) * 2.f );
bool predicted = predict_position( 20.f );
- if( !peeking && predicted ) {
- choke_ticks = 0;
+ if( !peeking && predicted && !choke_ticks ) {
send = true;
}
- else if( !predicted )
+ else if( !predicted ) {
choke_ticks = settings.ticks;
+ if( get_choked( ) > 1 )
+ send = true;
+ }
if( choke_ticks ) {
send = !choke_ticks--;
+ if( !m_is_peeking )
+ memcpy( m_peek_matrix, g_ctx.m_local->m_CachedBoneData( ).GetElements( ), sizeof( m_peek_matrix ) );
+
+ m_is_peeking = true;
}
+ else {
+ m_is_peeking = false;
+ }
+ }
+ else {
+ m_is_peeking = false;
}
if( settings.in_air && !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) {
diff --git a/cheat/internal_rewrite/lag_mgr.hpp b/cheat/internal_rewrite/lag_mgr.hpp
index d495210..c3a6faa 100644
--- a/cheat/internal_rewrite/lag_mgr.hpp
+++ b/cheat/internal_rewrite/lag_mgr.hpp
@@ -61,5 +61,9 @@ namespace features
int m_held_ticks{ };
bool m_breaking_lc{ };
bool m_has_fired{ };
+
+ public:
+ bool m_is_peeking;
+ matrix3x4 m_peek_matrix[ 128 ];
};
} \ No newline at end of file
diff --git a/cheat/internal_rewrite/math.hpp b/cheat/internal_rewrite/math.hpp
index b965600..188bafd 100644
--- a/cheat/internal_rewrite/math.hpp
+++ b/cheat/internal_rewrite/math.hpp
@@ -23,34 +23,55 @@ NAMESPACE_REGION( math )
#undef min
#undef max
-template < typename t >
+template < typename t > __forceinline
t min( const t& t1, const t& t2 ) {
return t1 < t2 ? t1 : t2;
}
-template < typename t, typename... ts_ >
+template < typename t, typename... ts_ > __forceinline
t min( const t& t1, const t& t2, ts_&&... ts ) {
return t1 < t2 ?
min( t1, std::forward< ts_ >( ts )... ) :
min( t2, std::forward< ts_ >( ts )... );
}
-template < typename t >
+template < typename t > __forceinline
t max( const t& t1, const t& t2 ) {
return t1 > t2 ? t1 : t2;
}
-template < typename t, typename... ts_ >
+template < typename t, typename... ts_ > __forceinline
t max( const t& t1, const t& t2, ts_&&... ts ) {
return t1 > t2 ?
max( t1, std::forward< ts_ >( ts )... ) :
max( t2, std::forward< ts_ >( ts )... );
}
-template < typename t >
+template < typename t > __forceinline
t lerp( const t& t1, const t& t2, float progress ) {
return t1 + ( t2 - t1 ) * progress;
}
+//don't code on acid
+template < typename t > __forceinline
+t ease_in( const t& t1, const t& t2, float progress ) {
+ progress = progress * progress;
+
+ return t1 + ( t2 - t1 ) * progress;
+}
+
+template < typename t > __forceinline
+t ease_out( const t& t1, const t& t2, float progress ) {
+ progress = progress * ( 2 - progress );
+
+ return t1 + ( t2 - t1 ) * progress;
+}
+
+template < typename t > __forceinline
+t ease_inout( const t& t1, const t& t2, float progress ) {
+ progress = progress < 0.5f ? 2 * progress * progress : -1 + ( 4 - 2 * progress ) * progress;
+
+ return t1 + ( t2 - t1 ) * progress;
+}
// todo - dex; make 2 random generator funcs here, this one only works for floats normally
diff --git a/cheat/internal_rewrite/movement.cpp b/cheat/internal_rewrite/movement.cpp
index 3793e1b..0097027 100644
--- a/cheat/internal_rewrite/movement.cpp
+++ b/cheat/internal_rewrite/movement.cpp
@@ -61,13 +61,13 @@ void c_movement::auto_strafer( ) {
if( !cmd->m_mousedx ) {
float ideal_rotation = std::min( RAD2DEG( std::asinf( 30.f / std::max( speed, FLT_EPSILON ) ) ) * 0.5f, 45.f );
- if( ( cmd->m_cmd_nr % 2 ) )
- ideal_rotation *= -1;
+ float sign = cmd->m_cmd_nr % 2 ? 1.f : -1.f;
- cmd->m_sidemove = ( cmd->m_cmd_nr % 2 ) ? 450.f : -450.f;
- cmd->m_forwardmove = 0;
- rotate_movement( cmd, ideal_rotation );
+ cmd->m_sidemove = 0.f;
+ cmd->m_forwardmove = 450.f;
+
+ rotate_movement( cmd, ( ideal_rotation - 90.f ) * sign );
}
else {
cmd->m_sidemove = m_ucmd->m_mousedx < 0.f ? -450.f : 450.f;
diff --git a/cheat/internal_rewrite/ragebot_lagcomp.cpp b/cheat/internal_rewrite/ragebot_lagcomp.cpp
index ba1cc43..e73eda4 100644
--- a/cheat/internal_rewrite/ragebot_lagcomp.cpp
+++ b/cheat/internal_rewrite/ragebot_lagcomp.cpp
@@ -286,7 +286,7 @@ namespace features
//EASE OUT BY NAVEWINDRE DO NOT STEAL
if( lerptime > 0.075f )
- delta = 1 + pow( delta - 1, 3 );
+ delta = math::ease_out( 0.f, 1.f, delta );
vec3_t next = ( it + 1 ) == data.rend( ) ? ent->m_vecOrigin( ) : ( it + 1 )->m_origin;
vec3_t lerp = math::lerp( it->m_origin, next, delta );
diff --git a/cheat/internal_rewrite/ragebot_resolver.cpp b/cheat/internal_rewrite/ragebot_resolver.cpp
index 78a6718..e562dd6 100644
--- a/cheat/internal_rewrite/ragebot_resolver.cpp
+++ b/cheat/internal_rewrite/ragebot_resolver.cpp
@@ -49,15 +49,25 @@ namespace features
if( !( ent->m_fFlags( ) & FL_ONGROUND ) || ( ent->get_anim_velocity( ).length2d( ) > 0.1f && !ent->is_fakewalking( ) ) )
return -1;
+ if( g_ctx.m_past_origins.empty( ) )
+ return -1; // sanity check
+
int ret_dir = -1;
float cur_damage = 0.f;
vec3_t enemy_pos = ent->m_vecOrigin( );
enemy_pos.z = ent->get_hitbox_pos( 0 ).z;
+ auto nci = g_csgo.m_engine( )->GetNetChannelInfo( );
+ float out_latency = nci->GetLatency( 0 );
+ auto enemy_ping = ent->get_ping( ) * 0.001f;
+
+ auto delay_ticks = std::clamp< int >( TIME_TO_TICKS( enemy_ping + out_latency ), 0, g_ctx.m_past_origins.size( ) - 1 );
+ vec3_t delayed_pos = g_ctx.m_past_origins.at( delay_ticks );
+
vec3_t local_pos = g_ctx.m_local->get_eye_pos( );
local_pos -= g_ctx.m_local->m_vecOrigin( );
- local_pos += g_ctx.m_last_origin;
+ local_pos += delayed_pos;
vec3_t aim_angle = math::vector_angles(
enemy_pos,