From 5e5b152f4b62432655cc4069c1d95be636749b7d Mon Sep 17 00:00:00 2001 From: navewindre Date: Tue, 13 Nov 2018 00:42:56 +0100 Subject: yo sick --- internal_rewrite/IMaterialSystem.hpp | 59 ++++++++++++++++++++++++ internal_rewrite/autowall.cpp | 50 ++++++++++++-------- internal_rewrite/begin_lock.cpp | 29 ++++++++---- internal_rewrite/chams.cpp | 34 +++++++++++--- internal_rewrite/context.hpp | 1 + internal_rewrite/create_move.cpp | 6 ++- internal_rewrite/lag_mgr.cpp | 18 ++++---- internal_rewrite/prediction.cpp | 4 +- internal_rewrite/ragebot.cpp | 2 + internal_rewrite/ragebot_antiaim.cpp | 7 +-- internal_rewrite/ragebot_lagcomp.cpp | 26 +++++++---- internal_rewrite/settings.hpp | 1 + internal_rewrite/ui.h | 36 ++++++--------- internal_rewrite/update_clientside_animation.cpp | 2 +- internal_rewrite/visual_local.cpp | 28 ++++++++--- internal_rewrite/visual_world.cpp | 53 ++++++++++++++++++++- 16 files changed, 268 insertions(+), 88 deletions(-) diff --git a/internal_rewrite/IMaterialSystem.hpp b/internal_rewrite/IMaterialSystem.hpp index c27bf24..7fc1bc1 100644 --- a/internal_rewrite/IMaterialSystem.hpp +++ b/internal_rewrite/IMaterialSystem.hpp @@ -100,6 +100,65 @@ struct IMaterialSystem_Config_t { char pad[ 0xC ]; }; +class IMaterialVar { +public: + virtual ITexture *GetTextureValue( void ) = 0; + + virtual char const * GetName( void ) const = 0; + virtual void* GetNameAsSymbol( ) const = 0; + + virtual void SetFloatValue( float val ) = 0; + + virtual void SetIntValue( int val ) = 0; + + virtual void SetStringValue( char const *val ) = 0; + virtual char const * GetStringValue( void ) const = 0; + + // Use FourCC values to pass app-defined data structures between + // the proxy and the shader. The shader should ignore the data if + // its FourCC type not correct. + virtual void SetFourCCValue( ) = 0; + virtual void GetFourCCValue( ) = 0; + + // Vec (dim 2-4) + virtual void SetVecValue( float const* val, int numcomps ) = 0; + virtual void SetVecValue( float x, float y ) = 0; + virtual void SetVecValue( float x, float y, float z ) = 0; + virtual void SetVecValue( float x, float y, float z, float w ) = 0; + virtual void GetLinearVecValue( float *val, int numcomps ) const = 0; + + // revisit: is this a good interface for textures? + virtual void SetTextureValue( ITexture * ) = 0; + + virtual IMaterial * GetMaterialValue( void ) = 0; + virtual void SetMaterialValue( IMaterial * ) = 0; + + virtual bool IsDefined( ) const = 0; + virtual void SetUndefined( ) = 0; + + // Matrix + virtual void SetMatrixValue( ) = 0; + virtual const void GetMatrixValue( ) = 0; + virtual bool MatrixIsIdentity( ) const = 0; + + // Copy.... + virtual void CopyFrom( IMaterialVar *pMaterialVar ) = 0; + + virtual void SetValueAutodetectType( char const *val ) = 0; + + virtual IMaterial * GetOwningMaterial( ) = 0; + + //set just 1 component + virtual void SetVecComponentValue( float fVal, int nComponent ) = 0; + +protected: + virtual int GetIntValueInternal( void ) const = 0; + virtual float GetFloatValueInternal( void ) const = 0; + virtual float const* GetVecValueInternal( ) const = 0; + virtual void GetVecValueInternal( float *val, int numcomps ) const = 0; + virtual int VectorSizeInternal( ) const = 0; +}; + class IMaterial { char pad[ 0x1C ]; public: diff --git a/internal_rewrite/autowall.cpp b/internal_rewrite/autowall.cpp index 732bc26..042c74c 100644 --- a/internal_rewrite/autowall.cpp +++ b/internal_rewrite/autowall.cpp @@ -83,8 +83,7 @@ namespace features bool breakable = is_breakable_fn( ent ); - if( !breakable ) - { + if( !breakable ) { auto ent_class = ent->GetClientClass( ); if( !ent_class ) @@ -107,27 +106,27 @@ namespace features Ray_t ray; - while ( dist <= 90.f ) - { + while( dist <= 90.f ) { dist += 4.0f; out_end = start + ( dir * dist ); - if ( !old_contents ) + if( !old_contents ) old_contents = g_csgo.m_trace( )->GetPointContents( out_end, MASK_SHOT_HULL | CONTENTS_HITBOX ); int contents = g_csgo.m_trace( )->GetPointContents( out_end, MASK_SHOT_HULL | CONTENTS_HITBOX ); - if ( contents & MASK_SHOT_HULL && ( !( contents & CONTENTS_HITBOX ) || old_contents == contents ) ) + + if( contents & MASK_SHOT_HULL && ( !( contents & CONTENTS_HITBOX ) || old_contents == contents ) ) continue; vec3_t end = out_end - ( dir * 4.0f ); + ray.Init( out_end, end ); g_csgo.m_trace( )->TraceRay( ray, MASK_SHOT_HULL | CONTENTS_HITBOX, nullptr, exit_trace ); - if ( exit_trace->startsolid && exit_trace->surface.flags & SURF_HITBOX ) - { + if( exit_trace->startsolid && exit_trace->surface.flags & SURF_HITBOX ) { CTraceFilter filter; filter.pSkip = exit_trace->m_pEnt; @@ -135,8 +134,7 @@ namespace features g_csgo.m_trace( )->TraceRay( ray, MASK_SHOT_HULL, &filter, exit_trace ); - if ( exit_trace->DidHit( ) && !exit_trace->startsolid ) - { + if( exit_trace->DidHit( ) && !exit_trace->startsolid ) { out_end = exit_trace->endpos; return true; } @@ -144,13 +142,29 @@ namespace features continue; } - if ( exit_trace->DidHit( ) && !exit_trace->startsolid ) - { - if ( is_breakable( tr.m_pEnt ) && is_breakable( exit_trace->m_pEnt ) ) + // maps/cs_office/glass/urban_glass + const char* surface_name = tr.surface.name; + + if( surface_name + && *( uint32_t* )( &surface_name[ 0 ] ) == 0x7370616d + && *( uint32_t* )( &surface_name[ 4 ] ) == 0x5f73632f + && *( uint32_t* )( &surface_name[ 8 ] ) == 0x6966666f + && *( uint32_t* )( &surface_name[ 12 ] ) == 0x672f6563 + && *( uint32_t* )( &surface_name[ 16 ] ) == 0x7373616c + && *( uint32_t* )( &surface_name[ 20 ] ) == 0x6272752f + && *( uint32_t* )( &surface_name[ 24 ] ) == 0x675f6e61 + && *( uint32_t* )( &surface_name[ 28 ] ) == 0x7373616c + ) { + *exit_trace = tr; + exit_trace->endpos = out_end + dir; + return true; + } + + if( exit_trace->DidHit( ) && !exit_trace->startsolid ) { + if( is_breakable( tr.m_pEnt ) && is_breakable( tr.m_pEnt ) ) return true; - if ( tr.surface.flags & SURF_NODRAW || !( exit_trace->surface.flags & SURF_NODRAW ) && ( exit_trace->plane.normal.dot( dir ) <= 1.f ) ) - { + if( tr.surface.flags & SURF_NODRAW || !( exit_trace->surface.flags & SURF_NODRAW ) && ( exit_trace->plane.normal.dot( dir ) <= 1.f ) ) { out_end -= dir * ( exit_trace->fraction * 4.f ); return true; } @@ -158,10 +172,8 @@ namespace features continue; } - if ( !exit_trace->DidHit( ) || exit_trace->startsolid ) - { - if ( tr.m_pEnt && tr.m_pEnt != g_csgo.m_entlist( )->GetClientEntity( 0 ) && is_breakable( exit_trace->m_pEnt ) ) - { + if( !exit_trace->DidHit( ) || exit_trace->startsolid ) { + if( tr.m_pEnt && tr.m_pEnt != g_csgo.m_entlist( )->GetClientEntity< void >( 0 ) && is_breakable( exit_trace->m_pEnt ) ) { *exit_trace = tr; exit_trace->endpos = out_end + dir; return true; diff --git a/internal_rewrite/begin_lock.cpp b/internal_rewrite/begin_lock.cpp index 0210417..5312eec 100644 --- a/internal_rewrite/begin_lock.cpp +++ b/internal_rewrite/begin_lock.cpp @@ -15,17 +15,14 @@ void __fastcall hooks::begin_lock( void* ecx, void* edx ) { // THIS IS PROLLY NO g_ctx.m_stage = FRAME_NET_UPDATE_POSTDATAUPDATE_START; g_cheat.m_visuals.world_modulate( ); + static float last_time = 0.f; - g_ctx.m_local->cache_anim_data( ); + if( g_ctx.run_frame( ) && g_ctx.m_local->is_valid( ) ) { + auto state = g_ctx.m_local->get_animstate( ); + auto& anims = g_ctx.m_local->get_animdata( ).m_animlayers; - /* - if( g_settings.rage.anti_aim && g_ctx.run_frame( ) ) { - static float last_time = 0.f; - - if( last_time != g_ctx.m_local->get_animstate( )->m_flLastClientSideAnimationUpdateTime ) { - auto& anims = g_ctx.m_local->get_animdata( ).m_animlayers; - + if( state && state->m_flLastClientSideAnimationUpdateTime != last_time ) { for( size_t i{ }; i < 13; ++i ) { auto& layer = g_ctx.m_local->m_AnimOverlay( ).GetElements( )[ i ]; @@ -34,13 +31,25 @@ void __fastcall hooks::begin_lock( void* ecx, void* edx ) { // THIS IS PROLLY NO g_ctx.m_local->m_AnimOverlay( ).GetElements( ), sizeof( C_AnimationLayer ) * 13 ); - last_time = g_ctx.m_local->get_animstate( )->m_flLastClientSideAnimationUpdateTime; + g_ctx.m_absyaw = state->m_flGoalFeetYaw; + + last_time = state->m_flLastClientSideAnimationUpdateTime; break; } } } } - */ + + + + /*if( g_settings.rage.anti_aim && g_ctx.run_frame( ) ) { + static float last_time = 0.f; + + if( last_time != g_ctx.m_local->get_animstate( )->m_flLastClientSideAnimationUpdateTime ) { + + } + }*/ + //g_con->game_console_print( "net postdataupdate start\n" ); diff --git a/internal_rewrite/chams.cpp b/internal_rewrite/chams.cpp index c50e40e..1d46bb2 100644 --- a/internal_rewrite/chams.cpp +++ b/internal_rewrite/chams.cpp @@ -18,13 +18,14 @@ static auto chams_mat = xors_raw( ( "$flat" "1" "$envmap" "env_cubemap" "$envmaptint" "[.3 .3 .3]" - "$envmapcontrast" ".4" + "$envmapcontrast" "1" "$envmapsaturation" "1.0" - "$phongexponent" "255.0" + "$phong" "1" + "$phongexponent" "15.0" "$normalmapalphaenvmask" "1" "$phongboost" "6.0" - "$phongfresnelranges" "[0 0.5 1]" - "$BasemapAlphaPhongMask" "1" + "$phongfresnelranges" "[.5 .5 1]" + "$BasemapAlphaPhongMask" "1" })" ) ); @@ -73,7 +74,7 @@ namespace features sprintf_s( buf, len - 1, chams_mat_flat.decrypt( ) ); break; case 2: - sprintf_s( buf, len - 1, chams_mat_shine.decrypt( ) ); + sprintf_s( buf, len - 1, chams_mat.decrypt( ) ); break; default: sprintf_s( buf, len - 1, chams_mat.decrypt( ) ); @@ -136,8 +137,10 @@ namespace features static float last_reflectivity{ }; static float last_shine{ }; + static float last_luminance{ }; static KeyValues* reflectivity; static KeyValues* shine; + static KeyValues* luminance; if( !reflectivity ) { for( auto it = m_chams.m_keyvalues->m_pSub; !!it; it = it->m_pPeer ) { @@ -155,6 +158,14 @@ namespace features } } + if( !luminance ) { + for( auto it = m_chams.m_keyvalues->m_pSub; !!it; it = it->m_pPeer ) { + if( it->m_flValue == 15.0f ) { + luminance = it; + } + } + } + if( reflectivity ) { if( last_reflectivity != g_settings.visuals.chams.reflectivity( ) ) { char buf[ 32 ]; @@ -171,11 +182,22 @@ namespace features if( shine ) { if( last_shine != g_settings.visuals.chams.shine( ) ) { - shine->m_flValue = g_settings.visuals.chams.shine( ) * 100.f; + shine->m_flValue = g_settings.visuals.chams.shine( ) * 3.f; m_chams.m_mat->Refresh( ); } last_shine = g_settings.visuals.chams.shine( ); } + + if( luminance ) { + if( last_luminance != g_settings.visuals.chams.luminance( ) ) { + if( g_settings.visuals.chams.luminance == 0.f ) + luminance->m_flValue = 0.f; + else + luminance->m_flValue = ( 1.05f - g_settings.visuals.chams.luminance( ) ) * 10.f; + m_chams.m_mat->Refresh( ); + } + last_luminance = g_settings.visuals.chams.luminance( ); + } } void c_chams::d3d_render_chams( c_base_player* ent, int type, int v_index, uint32_t min_index, uint32_t num_vert, uint32_t start_index, uint32_t prim_count ) { diff --git a/internal_rewrite/context.hpp b/internal_rewrite/context.hpp index bf28a11..8ed3845 100644 --- a/internal_rewrite/context.hpp +++ b/internal_rewrite/context.hpp @@ -60,6 +60,7 @@ public: bool m_has_fired_this_frame{ }; + float m_absyaw{ }; vec3_t m_last_realangle{ }; vec3_t m_last_fakeangle{ }; vec3_t m_thirdperson_angle{ }; diff --git a/internal_rewrite/create_move.cpp b/internal_rewrite/create_move.cpp index 1301aac..1defc78 100644 --- a/internal_rewrite/create_move.cpp +++ b/internal_rewrite/create_move.cpp @@ -101,7 +101,7 @@ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_f g_cheat.m_extra.rank_reveal( ucmd ); - if( g_cheat.m_lagmgr.get_choked( ) > 15 ) { + if( g_cheat.m_lagmgr.get_choked( ) > 16 ) { g_cheat.m_lagmgr.set_state( true ); } @@ -110,6 +110,10 @@ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_f g_cheat.m_lagmgr.on_cmove_end( ); g_ctx.on_cmove_end( ucmd ); + auto cl = g_csgo.m_global_state->get_client_state( ); + if( !g_cheat.m_lagmgr.get_state( ) ) + cl->m_last_acknowledged_cmd; + g_cheat.m_ragebot.m_antiaim->on_runcommand( ); } else { diff --git a/internal_rewrite/lag_mgr.cpp b/internal_rewrite/lag_mgr.cpp index 0c67a3c..0233e4a 100644 --- a/internal_rewrite/lag_mgr.cpp +++ b/internal_rewrite/lag_mgr.cpp @@ -74,21 +74,19 @@ namespace features if( settings.fluctuate ) max_ticks *= last_rand; -#ifdef _DEBUG + static bool changed = false; static auto cl_sendmove = pattern::first_code_match( g_csgo.m_engine.dll( ), xors( "55 8B EC A1 ? ? ? ? 81 EC ? ? ? ? B9 ? ? ? ? 53 8B 98" ), 0 ); - ulong_t old; - VirtualProtect( ( void* )( cl_sendmove + 0xbd ), 1, PAGE_EXECUTE_READWRITE, &old ); - *( uint8_t* )( cl_sendmove + 0xbd ) = 50; - VirtualProtect( ( void* )( cl_sendmove + 0xbd ), 1, old, nullptr ); -#endif + if( !changed ) { + ulong_t old; + VirtualProtect( ( void* )( cl_sendmove + 0xbd ), 1, PAGE_EXECUTE_READWRITE, &old ); + *( uint8_t* )( cl_sendmove + 0xbd ) = 50; + VirtualProtect( ( void* )( cl_sendmove + 0xbd ), 1, old, nullptr ); + } + changed = true; -#ifndef _DEBUG - max_ticks = math::min( max_ticks, 14 ); -#else max_ticks = math::min( max_ticks, 16 ); -#endif bool force_send = m_held_ticks >= max_ticks; if( settings.mode == 1 ) { diff --git a/internal_rewrite/prediction.cpp b/internal_rewrite/prediction.cpp index 28c4bc7..2f6f606 100644 --- a/internal_rewrite/prediction.cpp +++ b/internal_rewrite/prediction.cpp @@ -612,7 +612,9 @@ void c_prediction::run_command( user_cmd_t *ucmd ) { ucmd->m_sidemove = backup_sidemove; ucmd->m_buttons = backup_buttons; - if( auto wep = g_ctx.m_local->get_weapon( ) ) { + auto wep = g_ctx.m_local->get_weapon( ); + + if( wep ) { wep->update_accuracy_penalty( ); g_ctx.m_weapon_inaccuracy = wep->get_inaccuracy( ); g_ctx.m_weapon_spread = wep->get_spread( ); diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp index 452dc9b..ed1b5c3 100644 --- a/internal_rewrite/ragebot.cpp +++ b/internal_rewrite/ragebot.cpp @@ -691,6 +691,8 @@ namespace features return false; if( !entity->has_valid_anim( ) ) return false; + if( entity->m_iTeamNum( ) == g_ctx.m_local->m_iTeamNum( ) && !g_settings.rage.friendlies ) + return false; bool baim = false; bool should_baim = true; diff --git a/internal_rewrite/ragebot_antiaim.cpp b/internal_rewrite/ragebot_antiaim.cpp index c73ad54..efb225c 100644 --- a/internal_rewrite/ragebot_antiaim.cpp +++ b/internal_rewrite/ragebot_antiaim.cpp @@ -119,7 +119,7 @@ namespace features pitch = math::vector_angles( g_ctx.m_local->get_eye_pos( ), t->get_hitbox_pos( 0 ) ).x; } else - pitch = -10.f; + pitch = 0.f; real_angle.x = pitch; } @@ -586,10 +586,11 @@ namespace features float speed = velocity->length( ); if( speed >= 0.1f ) { - float friction = sv_friction->get_float( ); + //if it works, it works + float friction = sv_friction->get_float( ) * 1.12f; float stop_speed = std::max< float >( speed, sv_stopspeed->get_float( ) ); float time = std::max< float >( g_csgo.m_globals->m_interval_per_tick, g_csgo.m_globals->m_frametime ); - *velocity *= std::max< float >( 0.f, speed - friction * stop_speed * time / speed ); + *velocity *= std::max< float >( 0.f, speed - friction * stop_speed * time / speed ); } }; diff --git a/internal_rewrite/ragebot_lagcomp.cpp b/internal_rewrite/ragebot_lagcomp.cpp index 5c18735..f87b8fd 100644 --- a/internal_rewrite/ragebot_lagcomp.cpp +++ b/internal_rewrite/ragebot_lagcomp.cpp @@ -193,12 +193,16 @@ namespace features for( int i{ }; i < 65; ++i ) { auto ent = g_csgo.m_entlist( )->GetClientEntity< >( i ); auto& data = m_data_render[ i ]; - + if( ent == g_ctx.m_local ) continue; - if( ent && ent->is_valid( ) && !ent->m_bGunGameImmunity( ) && - !!std::abs( last_simtime[ i ] - ent->m_flSimulationTime( ) ) && ent->has_valid_anim( ) ) { + if( !ent || !ent->is_valid( ) || ent->m_bGunGameImmunity( ) ) { + data.clear( ); + continue; + } + + 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( ); @@ -242,14 +246,17 @@ namespace features return std::abs( delta ) <= 0.2f; }; - for( auto it = data.rbegin( ); it != data.rend( ) && ( it + 1 ) != data.rend( ); it++ ) { - if( is_time_valid( it->m_globaltime ) ) { + for( auto it = data.rbegin( ); it != data.rend( ); it++ ) { + if( is_time_valid( it->m_globaltime ) || ( it + 1 ) == data.rend( ) ) { 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 ) ) + break; + if( !it->m_validtime ) it->m_validtime = g_csgo.m_globals->m_curtime; @@ -257,13 +264,16 @@ namespace features float latency = util::get_total_latency( ); float correct = latency + util::get_lerptime( ); - float deadtime = it->m_globaltime + correct + 0.2f; + float choke = ent->m_flSimulationTime( ) - ent->m_flOldSimulationTime( ); + float lerptime = std::max( choke + TICK_INTERVAL( ), 0.2f ); + + float deadtime = it->m_globaltime + correct + lerptime; float totaltime = deadtime - it->m_validtime; float curtime = g_csgo.m_globals->m_curtime; - float delta = ( 0.2f + correct - ( curtime - it->m_globaltime ) ) / totaltime; + float delta = ( lerptime + correct - ( curtime - it->m_globaltime ) ) / totaltime; - vec3_t next = ( it + 1 )->m_origin; + 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 ) ); matrix3x4 ret[ 128 ]; diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp index decdfc9..58d0382 100644 --- a/internal_rewrite/settings.hpp +++ b/internal_rewrite/settings.hpp @@ -305,6 +305,7 @@ namespace data con_var< clr_t > color_hidden_friendly{ &holder_, fnv( "visuals_chams_color_h_friendly" ), clr_t( 0, 0, 255 ) }; con_var< clr_t > color_hidden_enemy{ &holder_, fnv( "visuals_chams_color_h_enemy" ), clr_t( 255, 0, 0 ) }; con_var< bool > clear_occlusion{ &holder_, fnv( "visuals_chams_clear_occlusion" ) }; + con_var< float > luminance{ &holder_, fnv( "visuals_chams_luminance" ), 1.f }; } chams; con_var< int > activation_type{ &holder_, fnv( "visuals_activation" ), false }; diff --git a/internal_rewrite/ui.h b/internal_rewrite/ui.h index 56f6c88..4a05e8d 100644 --- a/internal_rewrite/ui.h +++ b/internal_rewrite/ui.h @@ -40,7 +40,7 @@ namespace ui date_str = g_header.username; - menu = std::make_shared< ui::c_menu >( 10, 10, 580, 470, xors( "hit p hook" ), + menu = std::make_shared< ui::c_menu >( 10, 10, 580, 470, xors( "automated currency" ), //don't ask date_str.c_str( ) ); #else @@ -412,7 +412,7 @@ namespace ui yaw_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 0, 90, xors( "fake yaw jitter" ), &g_settings.rage.fake_yaw_jitter ) )->set_cond( [ ]( ) { return !!g_settings.rage.fake_yaw( ); } ); } - + auto edge_form = std::make_shared< ui::c_form >( 0, 0, 215, 110, xors( "edge detection" ), 110 ); { edge_form->add_item( std::make_shared< ui::c_dropdown< > >( 0, 0, 140, xors( "edge" ), &g_settings.rage.edge_dtc_normal, &dropdowns::antiaim_edge ) ); @@ -423,14 +423,14 @@ namespace ui edge_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 70, 300, &g_settings.rage.edge_dtc_moving ) )->set_cond( [ ]( ) { return !!g_settings.rage.edge_dtc_normal( ); } ); - edge_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "freestanding" ), + edge_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "freestanding" ), &g_settings.rage.edge_detection ) ); edge_form->add_item( std::make_shared< ui::c_dropdown< > >( 0, 0, 140, xors( "priority" ), &g_settings.rage.edge_dtc_priority, &dropdowns::edge_priority ) )->set_cond( [ ]( ) { return g_settings.rage.edge_dtc_normal( ) && g_settings.rage.edge_detection( ); } ); - edge_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "break lby when edging" ), &g_settings.rage.break_lby_edge( ) ) + edge_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "break lby when edging" ), &g_settings.rage.break_lby_edge( ) ) )->set_cond( [ ]( ) { return g_settings.rage.break_lby; } ); edge_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 0, 90, xors( "fake jitter" ), &g_settings.rage.edge_dtc_jitter ) ); @@ -447,24 +447,14 @@ namespace ui std::make_shared< ui::c_key_picker_small >( 195, 0, &g_settings.rage.fakewalk_key ) ); -#ifndef _DEBUG - lby_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 7, 14, &g_settings.rage.fakewalk_ticks ) )->set_cond( - [ ]( ) { return g_settings.rage.fakewalk; } ); - } -#else lby_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 7, 16 , &g_settings.rage.fakewalk_ticks ) )->set_cond( [ ]( ) { return g_settings.rage.fakewalk; } ); } -#endif auto fakelag_form = std::make_shared< ui::c_form >( 0, 0, 215, 165, xors( "fakelag" ), 165 ); { fakelag_form->add_item( std::make_shared< ui::c_dropdown< > >( 0, 0, 140, xors( "mode" ), &g_settings.rage.fakelag.mode, &dropdowns::fakelag_types ) ); -#ifndef _DEBUG - fakelag_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 2, 14, &g_settings.rage.fakelag.ticks ) ); -#else fakelag_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 2, 16, &g_settings.rage.fakelag.ticks ) ); -#endif fakelag_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 0, 50, xors( "variance" ), &g_settings.rage.fakelag.fluctuate ) ); auto flags_form = fakelag_form->add_item( std::make_shared< ui::c_form >( 0, 5, 139, 0, xors( "flags" ), 0, true ) ); @@ -576,10 +566,13 @@ namespace ui chams_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "friendlies" ), &g_settings.visuals.chams.friendlies( ) ) ); chams_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "flat" ), &g_settings.visuals.chams.flat( ) ) )->set_cond( [ ]( ) { return !g_settings.misc.hide_from_obs( ); } ); chams_form->add_item( std::make_shared< ui::c_slider< float > >( 0, 0, 120, 0.f, 1.f, xors( "reflectivity" ), &g_settings.visuals.chams.reflectivity ) - )->set_cond( [ ]( ) { return !g_settings.visuals.chams.flat && !g_settings.misc.hide_from_obs; } ); + )->set_cond( [ ]( ) { return !g_settings.visuals.chams.flat; } ); + + chams_form->add_item( std::make_shared< ui::c_slider< float > >( 0, 0, 120, 0.f, 1.f, xors( "luminance" ), &g_settings.visuals.chams.luminance ) + )->set_cond( [ ]( ) { return !g_settings.visuals.chams.flat; } ); chams_form->add_item( std::make_shared< ui::c_slider< float > >( 0, 0, 120, 0.f, 1.f, xors( "shine" ), &g_settings.visuals.chams.shine ) - )->set_cond( [ ]( ) { return !g_settings.visuals.chams.flat && !g_settings.misc.hide_from_obs; } ); + )->set_cond( [ ]( ) { return !g_settings.visuals.chams.flat; } ); chams_form->add_item( std::make_shared< ui::c_color_picker >( 0, 0, 120, xors( "friendlies visible" ), &g_settings.visuals.chams.color_visible_friendly( ) ) )->set_cond( [ ]( ) { return g_settings.visuals.chams.friendlies( ); } ); @@ -717,8 +710,8 @@ namespace ui &dropdowns::fake_ping_activation ) )->add_item( std::make_shared< ui::c_key_picker_small >( 195, 0, &g_settings.misc.net_fakeping_key ) )->set_cond( [ ]( ) { return g_settings.misc.net_fakelag == 1 || g_settings.misc.net_fakelag == 2; } ); - fake_ping->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, ( int )( sv_maxunlag->get_float( ) * 1000 ), xors( "amount" ), &g_settings.misc.net_fakeping_amount( ) ) - )->set_cond( [ ]( ) { return g_settings.misc.net_fakelag != 4; } ); + fake_ping->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 800, xors( "amount" ), &g_settings.misc.net_fakeping_amount( ) ) + )->set_cond( [ ]( ) { return g_settings.misc.net_fakelag; } ); } auto helpers_form = std::make_shared< ui::c_form >( 0, 0, 215, 0, xors( "helpers" ) ); { @@ -875,12 +868,11 @@ namespace ui static auto jitter_air = menu->find_item( xors( "in-air yaw jitter" ) ); jitter_air->set_text( g_settings.rage.air_yaw == 2 ? xors( "spin range" ) : xors( "in-air yaw jitter" ) ); - static auto sv_maxunlag = g_csgo.m_cvar( )->FindVar( "sv_maxunlag" ); - static auto fakeping_slider = ( c_slider< int >* )menu->find_item( xors( "amount" ) ).get( ); - + static auto fakeping_form = menu->find_item( xors( "fake latency" ) ); + auto game_rules = c_base_player::get_game_rules( ); if( game_rules ) { - fakeping_slider->set_max( *( bool* )( game_rules + 0x75 ) ? 0.f : 800.f ); + fakeping_form->set_visible( !*( bool* )( game_rules + 0x75 ) ); } render_item( menu.get( ) ); diff --git a/internal_rewrite/update_clientside_animation.cpp b/internal_rewrite/update_clientside_animation.cpp index 69f8607..201d100 100644 --- a/internal_rewrite/update_clientside_animation.cpp +++ b/internal_rewrite/update_clientside_animation.cpp @@ -34,7 +34,7 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { if( !first_update ) { g_ctx.m_local->restore_anim_data( true ); - ent->set_abs_angles( vec3_t( 0, ent->get_animstate( )->m_flGoalFeetYaw, 0 ) ); + ent->set_abs_angles( vec3_t( 0, g_ctx.m_absyaw, 0 ) ); bool backup = ent->get_animstate( )->m_bOnGround; ent->get_animstate( )->m_bOnGround = false; diff --git a/internal_rewrite/visual_local.cpp b/internal_rewrite/visual_local.cpp index dc311c0..88e9c60 100644 --- a/internal_rewrite/visual_local.cpp +++ b/internal_rewrite/visual_local.cpp @@ -122,11 +122,7 @@ namespace features int min_dist = 64; int max_ticks = g_settings.rage.fakelag.ticks; max_ticks += g_settings.rage.fakelag.fluctuate * max_ticks * 0.01f; -#ifdef _DEBUG max_ticks = std::min( max_ticks, 16 ); -#else - max_ticks = std::min( max_ticks, 14 ); -#endif float speed = g_ctx.m_local->m_vecVelocity( ).length2d( ); bool breaking = g_cheat.m_lagmgr.is_breaking_lc( ); @@ -142,9 +138,29 @@ namespace features g_ctx.m_local->m_bIsScoped( ) ) { int w, h; g_csgo.m_engine( )->GetScreenSize( w, h ); + + auto wep = g_ctx.m_local->get_weapon( ); + if( wep ) { + float inacc = g_ctx.m_weapon_inaccuracy; + + int pixels = inacc * 75; + + if( pixels < 2 ) { + draw_line( 0, h / 2, w, h / 2, clr_t( 0, 0, 0 ) ); + draw_line( w / 2, 0, w / 2, h, clr_t( 0, 0, 0 ) ); + } + else { + for( int i = -pixels; i < pixels; ++i ) { + float a = 1.f - ( float )( std::abs( i ) ) / ( float )( pixels ); - draw_line( 0, h / 2, w, h / 2, clr_t( 0, 0, 0 ) ); - draw_line( w / 2, 0, w / 2, h, clr_t( 0, 0, 0 ) ); + float inacc_alpha = 1.f - ( inacc * 3.f ); + inacc_alpha = std::clamp( inacc_alpha, 0.4f, 1.f ); + + draw_line( 0, h / 2 + i, w, h / 2 + i, clr_t( 0, 0, 0, 255 * a * inacc_alpha ) ); + draw_line( w / 2 + i, 0, w / 2 + i, h, clr_t( 0, 0, 0, 255 * a * inacc_alpha ) ); + } + } + } } draw_autowall( ); diff --git a/internal_rewrite/visual_world.cpp b/internal_rewrite/visual_world.cpp index 10b4c9f..ea3d31d 100644 --- a/internal_rewrite/visual_world.cpp +++ b/internal_rewrite/visual_world.cpp @@ -29,6 +29,7 @@ namespace features new_grenade.m_time = g_csgo.m_globals->m_curtime; new_grenade.m_ent = index; new_grenade.m_pos = pos; + m_firegrenades.emplace_back( new_grenade ); } @@ -227,6 +228,7 @@ namespace features } } } + void c_visuals::draw_firegrenade( ) { static auto life_span = g_csgo.m_cvar( )->FindVar( xors( "inferno_flame_lifetime" ) ); float time = g_csgo.m_globals->m_curtime; @@ -248,7 +250,56 @@ namespace features continue; clr_t col = g_settings.visuals.grenade_esp_clr; - auto w2s = util::screen_transform( it.m_pos ); + + vec3_t text_pos = it.m_pos; + text_pos.z += 5.f; + + auto w2s = util::screen_transform( text_pos ); + + float delta = g_csgo.m_globals->m_curtime - it.m_time; + + if( g_ctx.m_local->is_valid( ) && ( ent->m_iTeamNum( ) != g_ctx.m_local->m_iTeamNum( ) || ent == g_ctx.m_local ) ) { + vec3_t last_pos; + + const float fill = ( life_span->get_float( ) - delta ) / ( life_span->get_float( ) ) * 180.f; + + for( float rot = -fill; rot <= fill; rot += 3.f ) { + auto rotation = rot + delta * 90.f; + + while( rotation > 360.f ) + rotation -= 360.f; + + vec3_t rotated_pos = it.m_pos; + + rotated_pos.z -= 5.f; + + const auto radius = 50.f; + rotated_pos.x += cos( DEG2RAD( rotation ) ) * radius; + rotated_pos.y += sin( DEG2RAD( rotation ) ) * radius; + + if( rot != -fill ) { + auto w2s_new = util::screen_transform( rotated_pos ); + auto w2s_old = util::screen_transform( last_pos ); + auto alpha = 1.f - ( std::abs( rot ) / fill ); + + float threshold = life_span->get_float( ) * 0.2f; + + if( life_span->get_float( ) - delta < threshold ) { + float diff = ( life_span->get_float( ) - delta ) / ( life_span->get_float( ) ) * 5.f; + + alpha *= diff; + } + + clr_t col = g_settings.visuals.grenade_esp_clr; + + col.a( ) *= alpha; + + draw_line( w2s_old, w2s_new, col ); + } + + last_pos = rotated_pos; + } + } draw_string( w2s.x, w2s.y, ALIGN_CENTER, false, col, xors( "molotov" ) ); if( g_settings.visuals.grenade_owner ) -- cgit v1.2.3