From ee88bdeca83ebf6aff4b2bebf2c1f93eb2bf9541 Mon Sep 17 00:00:00 2001 From: navewindre Date: Sun, 18 Nov 2018 20:06:19 +0100 Subject: d --- gmod/factory.hpp | 2 +- internal_rewrite/Valve/dt_common.h | 91 +++++------------------------------- internal_rewrite/c_base_player.cpp | 8 ++-- internal_rewrite/factory.hpp | 2 +- internal_rewrite/proxies.cpp | 15 +++--- internal_rewrite/ragebot.cpp | 2 +- internal_rewrite/ragebot_lagcomp.cpp | 20 ++++---- internal_rewrite/settings.hpp | 1 - internal_rewrite/ui.h | 4 -- 9 files changed, 35 insertions(+), 110 deletions(-) diff --git a/gmod/factory.hpp b/gmod/factory.hpp index 5427fd5..a3565e0 100644 --- a/gmod/factory.hpp +++ b/gmod/factory.hpp @@ -10,7 +10,7 @@ //IFACE_DLLMAIN - interfaces are passed through dllmain and below code doesnt need to be ran #ifndef _DEBUG -#define IFACE_DLLMAIN +//#define IFACE_DLLMAIN #endif #ifdef IFACE_DLLMAIN diff --git a/internal_rewrite/Valve/dt_common.h b/internal_rewrite/Valve/dt_common.h index e936587..ff0f7b7 100644 --- a/internal_rewrite/Valve/dt_common.h +++ b/internal_rewrite/Valve/dt_common.h @@ -129,86 +129,17 @@ typedef enum } SendPropType; -class DVariant -{ -public: - DVariant() - { - m_Type = DPT_Float; - } - DVariant( float val ) - { - m_Type = DPT_Float; m_Float = val; - } - - const char *ToString() - { - static char text[ 128 ]; - - switch( m_Type ) - { - case DPT_Int: - sprintf( text, "%i", m_Int ); - break; - case DPT_Float: - sprintf( text, "%.3f", m_Float ); - break; - case DPT_Vector: - sprintf( text, "(%.3f,%.3f,%.3f)", - m_Vector[ 0 ], m_Vector[ 1 ], m_Vector[ 2 ] ); - break; - case DPT_VectorXY: - sprintf( text, "(%.3f,%.3f)", - m_Vector[ 0 ], m_Vector[ 1 ] ); - break; -#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! - case DPT_Quaternion: - snprintf( text, sizeof( text ), "(%.3f,%.3f,%.3f %.3f)", - m_Vector[ 0 ], m_Vector[ 1 ], m_Vector[ 2 ], m_Vector[ 3 ] ); - break; -#endif - case DPT_String: - if( m_pString ) - return m_pString; - else - return "NULL"; - break; - case DPT_Array: - sprintf( text, "Array" ); - break; - case DPT_DataTable: - sprintf( text, "DataTable" ); - break; -#ifdef SUPPORTS_INT64 - case DPT_Int64: - snprintf( text, sizeof( text ), "%I64d", m_Int64 ); - break; -#endif - default: - sprintf( text, "DVariant type %i unknown", m_Type ); - break; - } - - return text; - } - - union - { - float m_Float; - int m_Int; - const char *m_pString; - void *m_pData; // For DataTables. -#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! - float m_Vector[ 4 ]; -#else - float m_Vector[ 3 ]; -#endif - -#ifdef SUPPORTS_INT64 - int64 m_Int64; -#endif - }; - SendPropType m_Type; +struct DVariant { + union { + float m_Float; + long m_Int; + char* m_pString; + void* m_pData; + float m_Vector[ 3 ]; + __int64 m_Int64; + }; + + int m_Type; }; diff --git a/internal_rewrite/c_base_player.cpp b/internal_rewrite/c_base_player.cpp index 0124e22..957aa2a 100644 --- a/internal_rewrite/c_base_player.cpp +++ b/internal_rewrite/c_base_player.cpp @@ -52,6 +52,9 @@ void CCSGOPlayerAnimState::update( float yaw, float pitch ) { if( !alloc ) return; + if( !this->pBaseEntity ) + return; + //bool* b = &c_base_player::s_bInvalidateBoneCache( ); //char backup = *b; @@ -944,11 +947,6 @@ void c_base_player::fix_animations( bool reset, bool resolver_change ) { bool moving = sm_animdata[ idx ].m_anim_velocity.length( ) > 0.1f; //compute_move_cycle( reset, moving ); - - if( is_fakewalking( ) && !reset ) { - //sm_animdata[ idx ].m_last_velocity = vec3_t( ); - //sm_animdata[ idx ].m_anim_velocity = vec3_t( ); - } get_animdata( ).m_anim_flags = m_fFlags( ); diff --git a/internal_rewrite/factory.hpp b/internal_rewrite/factory.hpp index c81c79b..d197951 100644 --- a/internal_rewrite/factory.hpp +++ b/internal_rewrite/factory.hpp @@ -11,7 +11,7 @@ //IFACE_DLLMAIN - interfaces are passed through dllmain and below code doesnt need to be ran #ifndef _DEBUG //#define IFACE_DLLMAIN -#define HEADER_MODULE +//#define HEADER_MODULE #endif #ifdef IFACE_DLLMAIN diff --git a/internal_rewrite/proxies.cpp b/internal_rewrite/proxies.cpp index cb4a872..9ec6a48 100644 --- a/internal_rewrite/proxies.cpp +++ b/internal_rewrite/proxies.cpp @@ -107,15 +107,12 @@ void __cdecl hooks::simtime_proxy_fn( const CRecvProxyData* proxy_data_const, vo auto ent = ( c_base_player* )( entity ); if( ent && ent->is_valid( ) && ent->has_valid_anim( ) && ( ent->m_iTeamNum( ) != g_ctx.m_local->m_iTeamNum( ) || g_settings.rage.friendlies( ) ) && ent != g_ctx.m_local ) { - //float prev_simtime = ent->m_flSimulationTime( ); - - old_fn( proxy_data_const, entity, output ); - - //float simtime = ent->m_flSimulationTime( ); + if( !proxy_data_const->m_Value.m_Int ) { + return; + } - //if( std::abs( simtime - prev_simtime ) < TICK_INTERVAL( ) ) - // simtime = prev_simtime; + //aaaaaaaaaaaaa } - else - old_fn( proxy_data_const, entity, output ); + + old_fn( proxy_data_const, entity, output ); } \ No newline at end of file diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp index ed1b5c3..2f99b29 100644 --- a/internal_rewrite/ragebot.cpp +++ b/internal_rewrite/ragebot.cpp @@ -358,7 +358,7 @@ namespace features bool a_head = !( a.hitbox == HITBOX_HEAD || a.hitbox == HITBOX_NECK ); bool b_head = !( b.hitbox == HITBOX_HEAD || b.hitbox == HITBOX_NECK ); - if( a.dmg != b.dmg && g_settings.rage.active->m_baim_lethal ) { + if( a.dmg != b.dmg ) { if( a.dmg > ( float )( hp + 10 ) && ( float )( b.dmg > hp + 10 ) ) { if( a_head != b_head ) { return a_head > b_head; diff --git a/internal_rewrite/ragebot_lagcomp.cpp b/internal_rewrite/ragebot_lagcomp.cpp index e8d9db6..62f588c 100644 --- a/internal_rewrite/ragebot_lagcomp.cpp +++ b/internal_rewrite/ragebot_lagcomp.cpp @@ -202,7 +202,7 @@ namespace features continue; } - if( !!std::abs( last_simtime[ i ] - ent->m_flSimulationTime( ) ) && ent->has_valid_anim( ) ) { + if( std::abs( last_simtime[ i ] - ent->m_flSimulationTime( ) ) && ent->has_valid_anim( ) ) { render_record_t new_record; new_record.m_simtime = ent->m_flSimulationTime( ) + util::get_lerptime( ); new_record.m_origin = ent->m_vecOrigin( ); @@ -215,6 +215,8 @@ namespace features else new_record.m_globaltime -= TICK_INTERVAL( ); + new_record.m_validtime = 0.f; + if( ent->ce( )->SetupBones( new_record.m_matrix, 128, BONE_USED_BY_ANYTHING, 0.f ) ) { data.push_front( new_record ); } @@ -250,14 +252,16 @@ namespace features }; for( auto it = data.rbegin( ); it != data.rend( ); it++ ) { - if( is_time_valid( it->m_globaltime ) || ( it + 1 ) == data.rend( ) ) { + if( ( it + 1 ) == data.rend( ) || is_time_valid( it->m_simtime ) || ( it + 1 )->m_simtime == ent->m_flSimulationTime( ) + util::get_lerptime( ) ) { if( it->m_origin.dist_to( ent->m_vecOrigin( ) ) < 1.f ) return false; if( ent->is_breaking_lc( ) ) return false; - if( std::abs( it->m_simtime - ent->m_flSimulationTime( ) ) > TIME_TO_TICKS( 15 ) ) + auto next_record = ( it + 1 ); + + if( std::abs( it->m_simtime - ent->m_flSimulationTime( ) ) > TIME_TO_TICKS( 16 ) ) break; if( !it->m_validtime ) @@ -268,16 +272,16 @@ namespace features float correct = latency + util::get_lerptime( ); float choke = ent->m_flSimulationTime( ) - ent->m_flOldSimulationTime( ); - float lerptime = std::max( choke + TICK_INTERVAL( ), 0.2f ); + float lerptime = next_record == data.rend( ) ? choke : next_record->m_simtime - it->m_simtime; - float deadtime = it->m_globaltime + correct + lerptime; - float totaltime = deadtime - it->m_validtime; + lerptime = std::max( lerptime, TICK_INTERVAL( ) ); float curtime = g_csgo.m_globals->m_curtime; - float delta = ( lerptime + correct - ( curtime - it->m_globaltime ) ) / totaltime; + + float delta = ( curtime - it->m_validtime ) / lerptime; vec3_t next = ( it + 1 ) == data.rend( ) ? ent->m_vecOrigin( ) : ( it + 1 )->m_origin; - vec3_t lerp = math::lerp( it->m_origin, next, std::clamp( 1.f - delta, 0.f, 1.f ) ); + vec3_t lerp = math::lerp( it->m_origin, next, std::clamp( delta, 0.f, 1.f ) ); matrix3x4 ret[ 128 ]; diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp index 58d0382..19ab9b4 100644 --- a/internal_rewrite/settings.hpp +++ b/internal_rewrite/settings.hpp @@ -49,7 +49,6 @@ namespace data con_var< int > m_hitchance{ this, fnv( "hitchance" ), 0 }; con_var< bool > m_baim_air{ this, fnv( "baim_air" ), 0 }; con_var< bool > m_baim_fake{ this, fnv( "baim_fake" ), 0 }; - con_var< bool > m_baim_lethal{ this, fnv( "baim_lethal" ), 0 }; con_var< int > m_baim_shots{ this, fnv( "baim_shots" ), 5 }; con_var< int > m_baim_health{ this, fnv( "baim_health" ), 50 }; con_var< int > m_delay{ this, fnv( "delay" ), 0 }; diff --git a/internal_rewrite/ui.h b/internal_rewrite/ui.h index 4a05e8d..39233c7 100644 --- a/internal_rewrite/ui.h +++ b/internal_rewrite/ui.h @@ -261,7 +261,6 @@ namespace ui general_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid head in air" ), &g_settings.rage.general.m_baim_air ) ); general_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid head on fake angles" ), &g_settings.rage.general.m_baim_fake ) ); - general_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "body aim if lethal" ), &g_settings.rage.general.m_baim_lethal ) ); general_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 20, xors( "body aim after" ), &g_settings.rage.general.m_baim_shots, xors( "shots" ) ) ); general_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 100, xors( "body aim under" ), &g_settings.rage.general.m_baim_health, xors( "hp" ) ) ); } @@ -289,7 +288,6 @@ namespace ui pistols_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid head in air" ), &g_settings.rage.heavy_pistols.m_baim_air ) ); pistols_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid head on fake angles" ), &g_settings.rage.heavy_pistols.m_baim_fake ) ); - pistols_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "body aim if lethal" ), &g_settings.rage.heavy_pistols.m_baim_lethal ) ); pistols_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 20, xors( "body aim after" ), &g_settings.rage.heavy_pistols.m_baim_shots, xors( "shots" ) ) ); pistols_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 100, xors( "body aim under" ), &g_settings.rage.heavy_pistols.m_baim_health, xors( "hp" ) ) ); } @@ -317,7 +315,6 @@ namespace ui snipers_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid head in air" ), &g_settings.rage.snipers.m_baim_air ) ); snipers_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid head on fake angles" ), &g_settings.rage.snipers.m_baim_fake ) ); - snipers_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "body aim if lethal" ), &g_settings.rage.snipers.m_baim_lethal ) ); snipers_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 20, xors( "body aim after" ), &g_settings.rage.snipers.m_baim_shots, xors( "shots" ) ) ); snipers_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 100, xors( "body aim under" ), &g_settings.rage.snipers.m_baim_health, xors( "hp" ) ) ); } @@ -345,7 +342,6 @@ namespace ui auto_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid head in air" ), &g_settings.rage.auto_snipers.m_baim_air ) ); auto_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid head on fake angles" ), &g_settings.rage.auto_snipers.m_baim_fake ) ); - auto_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "body aim if lethal" ), &g_settings.rage.auto_snipers.m_baim_lethal ) ); auto_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 20, xors( "body aim after" ), &g_settings.rage.auto_snipers.m_baim_shots, xors( "shots" ) ) ); auto_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 100, xors( "body aim under" ), &g_settings.rage.auto_snipers.m_baim_health, xors( "hp" ) ) ); } -- cgit v1.2.3