From 009f264c3d98f742bec9aaeaafe86d66ad5116a5 Mon Sep 17 00:00:00 2001 From: navewindre Date: Tue, 4 Dec 2018 19:56:23 +0100 Subject: dadffsad --- cheat/internal_rewrite/draw_model_execute.cpp | 85 +++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 11 deletions(-) (limited to 'cheat/internal_rewrite/draw_model_execute.cpp') 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; - } } } } -- cgit v1.2.3