summaryrefslogtreecommitdiff
path: root/internal_rewrite/proxies.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'internal_rewrite/proxies.cpp')
-rw-r--r--internal_rewrite/proxies.cpp103
1 files changed, 103 insertions, 0 deletions
diff --git a/internal_rewrite/proxies.cpp b/internal_rewrite/proxies.cpp
new file mode 100644
index 0000000..13466b4
--- /dev/null
+++ b/internal_rewrite/proxies.cpp
@@ -0,0 +1,103 @@
+#include "hooks.hpp"
+#include "context.hpp"
+#include "base_cheat.hpp"
+
+void __cdecl hooks::lby_proxy_fn( const CRecvProxyData* proxy_data_const, void* entity, void* output ) {
+ lby_proxy.get_old_function( )( proxy_data_const, entity, output );
+
+ if( !g_csgo.m_panic ) {
+ auto player = ( c_base_player* )( entity );
+ if( player && player == g_ctx.m_local ) {
+ g_cheat.m_ragebot.m_antiaim->on_lby_proxy( );
+ }
+ }
+}
+
+void __cdecl hooks::last_shot_proxy_fn( const CRecvProxyData* proxy_data_const, void* entity, void* output ) {
+ last_shot_proxy.get_old_function( )( proxy_data_const, entity, output );
+ if( !g_csgo.m_panic && proxy_data_const && g_settings.rage.enabled( ) && g_settings.rage.resolver( ) ) {
+ auto wep = ( c_base_weapon* )( entity );
+ if( wep && !wep->is_knife( ) && !wep->is_grenade( ) ) {
+ auto owner = g_csgo.m_entlist( )->GetClientEntityFromHandle( wep->m_hOwner( ) );
+ if( owner && owner->is_valid( ) && owner != g_ctx.m_local && g_ctx.m_local->is_valid( ) && owner->has_valid_anim( ) ) {
+ if( owner->m_iTeamNum( ) == g_ctx.m_local->m_iTeamNum( ) && !g_settings.rage.friendlies )
+ return;
+
+ static float last_time = 0.f;
+ float time = wep->m_fLastShotTime( );
+
+ if( !time )
+ return;
+
+ float anim_time = owner->m_flOldSimulationTime( ) + TICK_INTERVAL( );
+ auto record = g_cheat.m_ragebot.m_lagcomp->get_newest_record( owner->ce( )->GetIndex( ) );
+ float& last_update = g_cheat.m_ragebot.m_lagcomp->get_last_updated_simtime( owner->ce( )->GetIndex( ) );
+
+ if( time == owner->m_flSimulationTime( ) && owner->has_valid_anim( ) && owner->m_flSimulationTime( ) != last_update ) {
+ last_update = owner->m_flSimulationTime( );
+
+ vec3_t local_pos = g_ctx.m_local->m_vecOrigin( );
+ vec3_t enemy_pos = owner->m_vecOrigin( );
+ vec3_t ang = math::vector_angles( enemy_pos, local_pos );
+
+ owner->m_angEyeAngles( ).y = ang.y;
+ owner->fix_animations( );
+
+ features::c_ragebot::lag_record_t record( owner );
+ record.m_shot = true;
+
+ g_cheat.m_ragebot.m_lagcomp->store_record( owner->ce( )->GetIndex( ), RECORD_NORMAL, record );
+ last_time = time;
+ }
+ else if( owner->has_valid_anim( ) && time != last_time ) {
+ auto lby_records = g_cheat.m_ragebot.m_lagcomp->get_records( owner->ce( )->GetIndex( ), RECORD_LBY );
+ auto sim_records = g_cheat.m_ragebot.m_lagcomp->get_records( owner->ce( )->GetIndex( ), RECORD_NORMAL );
+
+ features::c_ragebot::lag_record_t* prev_record = nullptr;
+ float min_delta = FLT_MAX;
+
+ if( lby_records->size( ) ) {
+ for( auto& it : *lby_records ) {
+ float delta = std::abs( it.m_flSimulationTime - time );
+ if( delta > TICKS_TO_TIME( 15 ) )
+ break;
+
+ if( delta < g_csgo.m_globals->m_interval_per_tick )
+ break;
+
+ if( delta < min_delta ) {
+ prev_record = &it;
+ min_delta = delta;
+ }
+ }
+ }
+
+ if( sim_records->size( ) ) {
+ for( auto& it : *sim_records ) {
+ if( it.m_shot )
+ continue;
+
+ float delta = std::abs( it.m_flSimulationTime - time );
+ if( delta > TICKS_TO_TIME( 15 ) )
+ break;
+
+ if( delta < g_csgo.m_globals->m_interval_per_tick )
+ break;
+
+ if( delta < min_delta ) {
+ prev_record = &it;
+ min_delta = delta;
+ }
+ }
+ }
+
+ if( prev_record && !prev_record->m_shot ) {
+ owner->m_angEyeAngles( ).x = prev_record->m_vecAngles.x;
+ }
+
+ last_time = time;
+ }
+ }
+ }
+ }
+} \ No newline at end of file