From 66dcb4cdcdb0d3efce0ba74c0c5ad79bc7c51111 Mon Sep 17 00:00:00 2001 From: navewindre Date: Fri, 28 Sep 2018 19:59:15 +0200 Subject: a --- internal_rewrite/begin_lock.cpp | 12 + internal_rewrite/c_base_player.cpp | 10 +- internal_rewrite/c_base_player.hpp | 2 +- internal_rewrite/create_move.cpp | 3 +- internal_rewrite/d3d.cpp | 754 +++++++++++------------ internal_rewrite/factory.hpp | 2 +- internal_rewrite/lag_mgr.cpp | 26 +- internal_rewrite/ragebot.cpp | 15 +- internal_rewrite/ragebot.hpp | 2 +- internal_rewrite/ragebot_antiaim.cpp | 3 +- internal_rewrite/settings.hpp | 13 +- internal_rewrite/ui.h | 13 +- internal_rewrite/ui_draw.h | 22 +- internal_rewrite/ui_dropdown_item.h | 1 + internal_rewrite/update_clientside_animation.cpp | 1 + internal_rewrite/visual_local.cpp | 4 +- internal_rewrite/visual_player.cpp | 2 +- 17 files changed, 465 insertions(+), 420 deletions(-) diff --git a/internal_rewrite/begin_lock.cpp b/internal_rewrite/begin_lock.cpp index 0417654..b7e310e 100644 --- a/internal_rewrite/begin_lock.cpp +++ b/internal_rewrite/begin_lock.cpp @@ -15,6 +15,18 @@ 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( ); + if( g_settings.rage.anti_aim && g_ctx.run_frame( ) ) { + auto& anims = g_ctx.m_local->get_animdata( ).m_animlayers; + + for( size_t i{ }; i < 13; ++i ) { + auto& layer = g_ctx.m_local->m_AnimOverlay( ).GetElements( )[ i ]; + + if( layer.m_flWeight != anims.at( i ).m_flWeight || layer.m_flCycle != anims.at( i ).m_flCycle ) { + g_ctx.m_local->cache_anim_data( ); + break; + } + } + } //g_con->game_console_print( "net postdataupdate start\n" ); // FRAME_NET_UPDATE_POSTDATAUPDATE_START diff --git a/internal_rewrite/c_base_player.cpp b/internal_rewrite/c_base_player.cpp index 07a90be..0124e22 100644 --- a/internal_rewrite/c_base_player.cpp +++ b/internal_rewrite/c_base_player.cpp @@ -504,7 +504,7 @@ void c_base_player::calculate_duckamount( bool reset ) { original_duckamt[ idx ] = cur_duck; } -void c_base_player::cache_anim_data( ) { +void c_base_player::cache_anim_data( bool layers ) { int idx = ce( )->GetIndex( ); auto& animdata = sm_animdata[ idx ]; @@ -512,9 +512,11 @@ void c_base_player::cache_anim_data( ) { m_flPoseParameter( ), sizeof( float ) * 24 ); - memcpy( &animdata.m_animlayers, - m_AnimOverlay( ).GetElements( ), - sizeof( C_AnimationLayer ) * 13 ); + if( layers ) { + memcpy( &animdata.m_animlayers, + m_AnimOverlay( ).GetElements( ), + sizeof( C_AnimationLayer ) * 13 ); + } memcpy( animdata.m_bones, m_CachedBoneData( ).GetElements( ), diff --git a/internal_rewrite/c_base_player.hpp b/internal_rewrite/c_base_player.hpp index d41fe82..b1999b7 100644 --- a/internal_rewrite/c_base_player.hpp +++ b/internal_rewrite/c_base_player.hpp @@ -456,7 +456,7 @@ public: void validate_animation_layers( ); void compute_move_cycle( bool reset, bool moving ); void calculate_duckamount( bool reset ); - void cache_anim_data( ); + void cache_anim_data( bool layers = true ); void restore_anim_data( bool layers = false ); void handle_taser_animation( ); void calc_anim_velocity( bool reset ); diff --git a/internal_rewrite/create_move.cpp b/internal_rewrite/create_move.cpp index e9bb5ea..1301aac 100644 --- a/internal_rewrite/create_move.cpp +++ b/internal_rewrite/create_move.cpp @@ -72,7 +72,8 @@ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_f g_cheat.m_movement( ucmd ); //SUPER SECRET EXPLOIT DO NOT LEAK - //ucmd->m_buttons |= IN_BULLRUSH; + if( g_settings.misc.no_crouch_cooldown ) + ucmd->m_buttons |= IN_BULLRUSH; // This should account for the majority of FPS related bugs. diff --git a/internal_rewrite/d3d.cpp b/internal_rewrite/d3d.cpp index 194ac5e..e807776 100644 --- a/internal_rewrite/d3d.cpp +++ b/internal_rewrite/d3d.cpp @@ -1,387 +1,387 @@ -#include "d3d.hpp" -#include "interface.hpp" -#include "math.hpp" -#include "d3d_sprite.hpp" - -d3d::c_renderer g_d3d; -d3d::d3d_fonts_t d3d::fonts; - - -//theres shit still left to add like drawrect etc but thats really simple -//this is the base and it works so thats ok -//love -// - nave - -// note - dex; probably better idea to batch all calls up into one DrawPrimitive / DrawIndexedPrimitive call each (if you want to have index buffers too) -// DrawPrimitiveUP for each object will slow stuff down eventually -// dont know much about DrawIndexedPrimitive myself but msdn suggests to use strips over anything else - -namespace d3d -{ - void d3d_fonts_t::release( ) { - if( f_12 ) f_12->Release( ); - if( f_esp_small ) f_esp_small->Release( ); - if( f_16 ) f_16->Release( ); - if( f_18 ) f_18->Release( ); - if( f_menu ) f_menu->Release( ); - if( f_con ) f_con->Release( ); - - f_12 = f_esp_small = f_16 = f_18 = f_menu = f_con = nullptr; - } - - void d3d_fonts_t::create( IDirect3DDevice9* device ) { - auto create_font = [ & ]( ID3DXFont** font, const char* font_name, int width, int size, int weight ) { - //auto wide_str = util::ascii_to_unicode( std::string( font_name ) ); - - auto code = D3DXCreateFontA( device, size, width, weight, 0, false, DEFAULT_CHARSET, - OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, font_name, font ); - - if( code < 0 ) throw xors( "fuck d3d" ); - }; - +#include "d3d.hpp" +#include "interface.hpp" +#include "math.hpp" +#include "d3d_sprite.hpp" + +d3d::c_renderer g_d3d; +d3d::d3d_fonts_t d3d::fonts; + + +//theres shit still left to add like drawrect etc but thats really simple +//this is the base and it works so thats ok +//love +// - nave + +// note - dex; probably better idea to batch all calls up into one DrawPrimitive / DrawIndexedPrimitive call each (if you want to have index buffers too) +// DrawPrimitiveUP for each object will slow stuff down eventually +// dont know much about DrawIndexedPrimitive myself but msdn suggests to use strips over anything else + +namespace d3d +{ + void d3d_fonts_t::release( ) { + if( f_12 ) f_12->Release( ); + if( f_esp_small ) f_esp_small->Release( ); + if( f_16 ) f_16->Release( ); + if( f_18 ) f_18->Release( ); + if( f_menu ) f_menu->Release( ); + if( f_con ) f_con->Release( ); + + f_12 = f_esp_small = f_16 = f_18 = f_menu = f_con = nullptr; + } + + void d3d_fonts_t::create( IDirect3DDevice9* device ) { + auto create_font = [ & ]( ID3DXFont** font, const char* font_name, int width, int size, int weight ) { + //auto wide_str = util::ascii_to_unicode( std::string( font_name ) ); + + auto code = D3DXCreateFontA( device, size, width, weight, 0, false, DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, font_name, font ); + + if( code < 0 ) throw xors( "fuck d3d" ); + }; + create_font( &f_12, #ifndef COMIC_SANS xors( "Tahoma" ) #else xors( "Comic Sans MS" ) -#endif - , 0, 12, 0 ); //change this idc - create_font( &f_esp_small, xors( "Tahoma" ), 0, 11, 500 ); - create_font( &f_16, xors( "Verdana" ), 0, 16, 0 ); - create_font( &f_18, xors( "Verdana" ), 0, 24, 700 ); - create_font( &f_menu, +#endif + , 0, 12, 0 ); //change this idc + create_font( &f_esp_small, xors( "Tahoma" ), 0, 11, 500 ); + create_font( &f_16, xors( "Verdana" ), 0, 16, 0 ); + create_font( &f_18, xors( "Verdana" ), 0, 24, 700 ); + create_font( &f_menu, #ifndef COMIC_SANS xors( "Tahoma" ) #else xors( "Comic Sans MS" ) -#endif - , 0, 12, -#ifndef COMIC_SANS - 300 -#else - 600 -#endif - ); - create_font( &f_con, xors( "Consolas" ), 6, 12, 300 ); - } - - - c_renderer::c_renderer( IDirect3DDevice9* device ) : m_device( device ) { - create_objects( ); - } - - bool c_renderer::run_frame( IDirect3DDevice9* device ) { - if( g_csgo.m_panic ) { - return false; - } - - if( !m_device ) { - m_device = device; - create_objects( ); - return false; - } - - return true; - } - - c_renderer::~c_renderer( ) { - if( !m_device ) - return; - - invalidate_objects( ); - } - - void c_renderer::on_device_lost( ) { - if( !m_device ) - return; - - invalidate_objects( ); - } - - void c_renderer::on_device_reset( ) { - if( !m_device ) - return; - - create_objects( ); - } - - void c_renderer::invalidate_objects( ) { - if( m_block ) m_block->Release( ); - fonts.release( ); - //m_buffer->Release( ); - //m_sil_txt->Release( ); - //m_surface->Release( ); - } - - void c_renderer::create_objects( ) { - D3DVIEWPORT9 viewport; - - if( !m_device ) return; - - if( m_device->GetViewport( &viewport ) < 0 ) { - return; - } - - if( m_device->CreateStateBlock( D3DSBT_ALL, &m_block ) < 0 ) { - return; - } - - if( !m_block ) { - return; - } - - // get display size. - m_width = viewport.Width; - m_height = viewport.Height; - - fonts.create( m_device ); - - /*IDirect3DSurface9* backbuffer; - D3DSURFACE_DESC desc; - - m_device->GetRenderTarget( 0, &backbuffer ); - backbuffer->GetDesc( &desc ); - backbuffer->Release( ); - - m_device->CreateTexture( desc.Width, desc.Height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_sil_txt, 0 ); - m_sil_txt->GetSurfaceLevel( 0, &m_surface ); - - m_device->CreateVertexBuffer( 4 * 24, 0, D3DFVF_XYZRHW | D3DFVF_TEX1, D3DPOOL_MANAGED, &m_buffer, nullptr );*/ - } - - void c_renderer::begin( ) { - if( !m_device ) return; - - D3DVIEWPORT9 vp{ 0, 0, m_width, m_height, 0.f, 1.f }; - - m_device->SetViewport( &vp ); - - //m_sil_txt->GetSurfaceLevel( 0, &m_surface ); - - m_block->Capture( ); - - // set vertex stream declaration. - m_device->SetVertexShader( nullptr ); - m_device->SetPixelShader( nullptr ); - m_device->SetFVF( D3DFVF_XYZRHW | D3DFVF_DIFFUSE ); - - m_device->SetRenderState( D3DRS_LIGHTING, false ); - m_device->SetRenderState( D3DRS_FOGENABLE, false ); - m_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); - m_device->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID ); - - m_device->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE ); - m_device->SetRenderState( D3DRS_SCISSORTESTENABLE, true ); - m_device->SetRenderState( D3DRS_ZWRITEENABLE, false ); - m_device->SetRenderState( D3DRS_STENCILENABLE, false ); - - m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, false ); - m_device->SetRenderState( D3DRS_ANTIALIASEDLINEENABLE, true ); - - m_device->SetRenderState( D3DRS_ALPHABLENDENABLE, true ); - m_device->SetRenderState( D3DRS_ALPHATESTENABLE, false ); - m_device->SetRenderState( D3DRS_SEPARATEALPHABLENDENABLE, true ); - - m_device->SetTexture( 0, nullptr ); - m_device->SetTexture( 1, nullptr ); - m_device->SetTexture( 2, nullptr ); - m_device->SetTexture( 3, nullptr ); - - m_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); - m_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - m_device->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - m_device->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - m_device->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - m_device->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - m_device->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 ); - m_device->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE ); - m_device->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); - m_device->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); - - m_device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); - m_device->SetRenderState( D3DRS_SRCBLENDALPHA, D3DBLEND_INVDESTALPHA ); - m_device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); - m_device->SetRenderState( D3DRS_DESTBLENDALPHA, D3DBLEND_ONE ); - m_device->SetRenderState( D3DRS_BLENDOP, D3DBLENDOP_ADD ); - - m_device->SetRenderState( D3DRS_SRGBWRITEENABLE, false ); - m_device->SetRenderState( D3DRS_COLORWRITEENABLE, 0xffffffff ); - /* commented out until further notice */ - //m_device->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR ); - //m_device->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR ); - // todo - dex; if we use textures, need to set those rendering states too - } - - void c_renderer::end( ) { - //m_device->SetTexture( 0, nullptr ); - //m_device->SetTexture( 1, nullptr ); - //m_device->SetTexture( 2, nullptr ); - //m_device->SetTexture( 3, nullptr ); - m_block->Apply( ); - //m_block->Release( ); - } - - void c_renderer::draw_line( clr_t color, int x0, int y0, int x1, int y1 ) { - d3d_vertex_t v[ 2 ] = { - d3d_vertex_t( float( x0 ), float( y0 ), 1.0f, color ), //because fuck you thats why - d3d_vertex_t( float( x1 ), float( y1 ), 1.0f, color ) - }; //edit: do we wanna use z for shit? i mean we could for like menu stuff - //so it renders above other stuff - - m_device->DrawPrimitiveUP( D3DPT_LINELIST, 1, v, VERTEX_SIZE ); - } - - void c_renderer::draw_rect( clr_t color, int x, int y, int w, int h ) { - d3d_vertex_t v[ 5 ] = { - d3d_vertex_t( float( x ), float( y ), 1.0f, color ), - d3d_vertex_t( float( x + w ), float( y ), 1.0f, color ), - d3d_vertex_t( float( x + w ), float( y + h ), 1.0f, color ), - d3d_vertex_t( float( x ), float( y + h ), 1.0f, color ), - d3d_vertex_t( float( x ), float( y ), 1.0f, color ) - }; - - m_device->DrawPrimitiveUP( D3DPT_LINESTRIP, 4, v, VERTEX_SIZE ); - } - - void c_renderer::draw_filled_rect( clr_t color, int x, int y, int w, int h ) { - d3d_vertex_t v[ 6 ] = { - d3d_vertex_t( float( x + w ), float( y ), 1.0f, color ), - d3d_vertex_t( float( x ), float( y + h ), 1.0f, color ), - d3d_vertex_t( float( x + w ), float( y + h ), 1.0f, color ), - d3d_vertex_t( float( x ), float( y ), 1.0f, color ), - d3d_vertex_t( float( x ), float( y + h ), 1.0f, color ), - d3d_vertex_t( float( x + w ), float( y ), 1.0f, color ) - }; - - m_device->DrawPrimitiveUP( D3DPT_TRIANGLELIST, 2, v, VERTEX_SIZE ); - } - - void c_renderer::draw_gradient( clr_t start, clr_t end, int x, int y, int w, int h, GradientType_t type ) { - d3d_vertex_t v[ 4 ]; - - switch( type ) { - case GRADIENT_VERTICAL: - v[ 0 ] = { float( x ), float( y ), 1.0f, start }; - v[ 1 ] = { float( x + w ), float( y ), 1.0f, start }; - v[ 2 ] = { float( x ), float( y + h ), 1.0f, end }; - v[ 3 ] = { float( x + w ), float( y + h ), 1.0f, end }; - break; - case GRADIENT_HORIZONTAL: - v[ 0 ] = { float( x ), float( y ), 1.0f, start }; - v[ 1 ] = { float( x + w ), float( y ), 1.0f, end }; - v[ 2 ] = { float( x ), float( y + h ), 1.0f, start }; - v[ 3 ] = { float( x + w ), float( y + h ), 1.0f, end }; - break; - } - - //m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, true ); - m_device->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, &v, VERTEX_SIZE ); - //m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, false ); - } - - void c_renderer::draw_circle( clr_t color, int x, int y, int r, int res ) { - constexpr float PI = 3.1415926f; - const float step = PI * 2.0f / float( res ); - - int point_x = x + r, - point_y = y - r, - point_x_o{ }, - point_y_o{ }; - - m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, true ); - for( int i{ }; i <= res; i++ ) { - float theta = float( i ) * step; - - point_x = x + ( int )( r * cos( theta ) ); - point_y = y - ( int )( r * sin( theta ) ); - if( i ) draw_line( color, point_x, point_y, point_x_o, point_y_o ); - point_x_o = point_x; - point_y_o = point_y; - } - m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, false ); - } - - void c_renderer::draw_filled_circle( clr_t color, int x, int y, int r, int res ) { - d3d_vertex_t* v = ( d3d_vertex_t* )_alloca( VERTEX_SIZE * res ); - const float step = M_PI * 2.0f / res; - - for( size_t i{ }; i < res; ++i ) { - float theta = i * step; - float x_off = r * cos( theta ); - float y_off = r * sin( theta ); - - v[ i ] = { float( x + x_off ), float( y + y_off ), 1.0f, color }; - } - - m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, true ); - m_device->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, res, v, VERTEX_SIZE ); - m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, false ); - } - - void c_renderer::draw_text( ID3DXFont* font, clr_t color, - int x, int y, FontAlign_t align, long font_flags, const char* msg ) { - if( !msg ) return; - if( !font ) return; - - auto d3d_black = D3DCOLOR_RGBA( 0, 0, 0, color.a( ) ); - auto d3d_color = D3DCOLOR_RGBA( color.r( ), color.g( ), color.b( ), color.a( ) ); - auto buf = msg; - - if( align == ALIGN_CENTER ) x -= get_text_width( font, font_flags, msg ) / 2; - if( align == ALIGN_RIGHT ) x -= get_text_width( font, font_flags, msg ); - RECT rect{ x, y, 1000, 100 }; - - ulong_t flags = DT_NOCLIP | DT_LEFT | DT_TOP; - - if( font_flags & D3DFONTFLAG_DROPSHADOW ) { - RECT r{ rect }; - r.left++; - r.top++; - font->DrawTextA( 0, buf, -1, &r, flags, d3d_black ); - } - - if( font_flags & D3DFONTFLAG_OUTLINE ) { - for( int i = -1; i < 2; i++ ) { - if( !i ) continue; - RECT r{ rect }; - r.left += i; - r.top += i; - font->DrawTextA( 0, buf, -1, &r, flags, d3d_black ); - } - } - - font->DrawTextA( 0, buf, -1, &rect, flags, d3d_color ); - } - - int c_renderer::get_text_width( ID3DXFont* font, long flags, const char* msg, ... ) { - char* buffer = ( char* )_alloca( 2048 ); - va_list list{ }; - - memset( buffer, 0, 2048 ); - - __crt_va_start( list, msg ); - vsprintf_s( buffer, 2048, msg, list ); - __crt_va_end( list ); - - RECT temp{ }; - font->DrawTextA( 0, buffer, -1, &temp, DT_CALCRECT, 0x0 ); - - return ( temp.right - temp.left ); - } - - int c_renderer::get_text_height( ID3DXFont* font, long flags, const char* msg, ... ) { - char* buffer = ( char* )_alloca( 2048 ); - va_list list{ }; - - memset( buffer, 0, 2048 ); - - __crt_va_start( list, msg ); - vsprintf_s( buffer, 2048, msg, list ); - __crt_va_end( list ); - - RECT temp{ }; - font->DrawTextA( 0, buffer, -1, &temp, DT_CALCRECT, 0x0 ); - - return ( temp.bottom - temp.top ); - } +#endif + , 0, 12, +#ifndef COMIC_SANS + 300 +#else + 600 +#endif + ); + create_font( &f_con, xors( "Consolas" ), 6, 12, 300 ); + } + + + c_renderer::c_renderer( IDirect3DDevice9* device ) : m_device( device ) { + create_objects( ); + } + + bool c_renderer::run_frame( IDirect3DDevice9* device ) { + if( g_csgo.m_panic ) { + return false; + } + + if( !m_device ) { + m_device = device; + create_objects( ); + return false; + } + + return true; + } + + c_renderer::~c_renderer( ) { + if( !m_device ) + return; + + invalidate_objects( ); + } + + void c_renderer::on_device_lost( ) { + if( !m_device ) + return; + + invalidate_objects( ); + } + + void c_renderer::on_device_reset( ) { + if( !m_device ) + return; + + create_objects( ); + } + + void c_renderer::invalidate_objects( ) { + if( m_block ) m_block->Release( ); + fonts.release( ); + //m_buffer->Release( ); + //m_sil_txt->Release( ); + //m_surface->Release( ); + } + + void c_renderer::create_objects( ) { + D3DVIEWPORT9 viewport; + + if( !m_device ) return; + + if( m_device->GetViewport( &viewport ) < 0 ) { + return; + } + + if( m_device->CreateStateBlock( D3DSBT_ALL, &m_block ) < 0 ) { + return; + } + + if( !m_block ) { + return; + } + + // get display size. + m_width = viewport.Width; + m_height = viewport.Height; + + fonts.create( m_device ); + + /*IDirect3DSurface9* backbuffer; + D3DSURFACE_DESC desc; + + m_device->GetRenderTarget( 0, &backbuffer ); + backbuffer->GetDesc( &desc ); + backbuffer->Release( ); + + m_device->CreateTexture( desc.Width, desc.Height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_sil_txt, 0 ); + m_sil_txt->GetSurfaceLevel( 0, &m_surface ); + + m_device->CreateVertexBuffer( 4 * 24, 0, D3DFVF_XYZRHW | D3DFVF_TEX1, D3DPOOL_MANAGED, &m_buffer, nullptr );*/ + } + + void c_renderer::begin( ) { + if( !m_device ) return; + + D3DVIEWPORT9 vp{ 0, 0, m_width, m_height, 0.f, 1.f }; + + m_device->SetViewport( &vp ); + + //m_sil_txt->GetSurfaceLevel( 0, &m_surface ); + + m_block->Capture( ); + + // set vertex stream declaration. + m_device->SetVertexShader( nullptr ); + m_device->SetPixelShader( nullptr ); + m_device->SetFVF( D3DFVF_XYZRHW | D3DFVF_DIFFUSE ); + + m_device->SetRenderState( D3DRS_LIGHTING, false ); + m_device->SetRenderState( D3DRS_FOGENABLE, false ); + m_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); + m_device->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID ); + + m_device->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE ); + m_device->SetRenderState( D3DRS_SCISSORTESTENABLE, true ); + m_device->SetRenderState( D3DRS_ZWRITEENABLE, false ); + m_device->SetRenderState( D3DRS_STENCILENABLE, false ); + + m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, false ); + m_device->SetRenderState( D3DRS_ANTIALIASEDLINEENABLE, true ); + + m_device->SetRenderState( D3DRS_ALPHABLENDENABLE, true ); + m_device->SetRenderState( D3DRS_ALPHATESTENABLE, false ); + m_device->SetRenderState( D3DRS_SEPARATEALPHABLENDENABLE, true ); + + m_device->SetTexture( 0, nullptr ); + m_device->SetTexture( 1, nullptr ); + m_device->SetTexture( 2, nullptr ); + m_device->SetTexture( 3, nullptr ); + + m_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); + m_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + m_device->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + m_device->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + m_device->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + m_device->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + m_device->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 ); + m_device->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE ); + m_device->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); + m_device->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); + + m_device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); + m_device->SetRenderState( D3DRS_SRCBLENDALPHA, D3DBLEND_INVDESTALPHA ); + m_device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); + m_device->SetRenderState( D3DRS_DESTBLENDALPHA, D3DBLEND_ONE ); + m_device->SetRenderState( D3DRS_BLENDOP, D3DBLENDOP_ADD ); + + m_device->SetRenderState( D3DRS_SRGBWRITEENABLE, false ); + m_device->SetRenderState( D3DRS_COLORWRITEENABLE, 0xffffffff ); + /* commented out until further notice */ + //m_device->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR ); + //m_device->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR ); + // todo - dex; if we use textures, need to set those rendering states too + } + + void c_renderer::end( ) { + //m_device->SetTexture( 0, nullptr ); + //m_device->SetTexture( 1, nullptr ); + //m_device->SetTexture( 2, nullptr ); + //m_device->SetTexture( 3, nullptr ); + m_block->Apply( ); + //m_block->Release( ); + } + + void c_renderer::draw_line( clr_t color, int x0, int y0, int x1, int y1 ) { + d3d_vertex_t v[ 2 ] = { + d3d_vertex_t( float( x0 ), float( y0 ), 1.0f, color ), //because fuck you thats why + d3d_vertex_t( float( x1 ), float( y1 ), 1.0f, color ) + }; //edit: do we wanna use z for shit? i mean we could for like menu stuff + //so it renders above other stuff + + m_device->DrawPrimitiveUP( D3DPT_LINELIST, 1, v, VERTEX_SIZE ); + } + + void c_renderer::draw_rect( clr_t color, int x, int y, int w, int h ) { + d3d_vertex_t v[ 5 ] = { + d3d_vertex_t( float( x ), float( y ), 1.0f, color ), + d3d_vertex_t( float( x + w ), float( y ), 1.0f, color ), + d3d_vertex_t( float( x + w ), float( y + h ), 1.0f, color ), + d3d_vertex_t( float( x ), float( y + h ), 1.0f, color ), + d3d_vertex_t( float( x ), float( y ), 1.0f, color ) + }; + + m_device->DrawPrimitiveUP( D3DPT_LINESTRIP, 4, v, VERTEX_SIZE ); + } + + void c_renderer::draw_filled_rect( clr_t color, int x, int y, int w, int h ) { + d3d_vertex_t v[ 6 ] = { + d3d_vertex_t( float( x + w ), float( y ), 1.0f, color ), + d3d_vertex_t( float( x ), float( y + h ), 1.0f, color ), + d3d_vertex_t( float( x + w ), float( y + h ), 1.0f, color ), + d3d_vertex_t( float( x ), float( y ), 1.0f, color ), + d3d_vertex_t( float( x ), float( y + h ), 1.0f, color ), + d3d_vertex_t( float( x + w ), float( y ), 1.0f, color ) + }; + + m_device->DrawPrimitiveUP( D3DPT_TRIANGLELIST, 2, v, VERTEX_SIZE ); + } + + void c_renderer::draw_gradient( clr_t start, clr_t end, int x, int y, int w, int h, GradientType_t type ) { + d3d_vertex_t v[ 4 ]; + + switch( type ) { + case GRADIENT_VERTICAL: + v[ 0 ] = { float( x ), float( y ), 1.0f, start }; + v[ 1 ] = { float( x + w ), float( y ), 1.0f, start }; + v[ 2 ] = { float( x ), float( y + h ), 1.0f, end }; + v[ 3 ] = { float( x + w ), float( y + h ), 1.0f, end }; + break; + case GRADIENT_HORIZONTAL: + v[ 0 ] = { float( x ), float( y ), 1.0f, start }; + v[ 1 ] = { float( x + w ), float( y ), 1.0f, end }; + v[ 2 ] = { float( x ), float( y + h ), 1.0f, start }; + v[ 3 ] = { float( x + w ), float( y + h ), 1.0f, end }; + break; + } + + //m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, true ); + m_device->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, &v, VERTEX_SIZE ); + //m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, false ); + } + + void c_renderer::draw_circle( clr_t color, int x, int y, int r, int res ) { + constexpr float PI = 3.1415926f; + const float step = PI * 2.0f / float( res ); + + int point_x = x + r, + point_y = y - r, + point_x_o{ }, + point_y_o{ }; + + m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, true ); + for( int i{ }; i <= res; i++ ) { + float theta = float( i ) * step; + + point_x = x + ( int )( r * cos( theta ) ); + point_y = y - ( int )( r * sin( theta ) ); + if( i ) draw_line( color, point_x, point_y, point_x_o, point_y_o ); + point_x_o = point_x; + point_y_o = point_y; + } + m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, false ); + } + + void c_renderer::draw_filled_circle( clr_t color, int x, int y, int r, int res ) { + d3d_vertex_t* v = ( d3d_vertex_t* )_alloca( VERTEX_SIZE * res ); + const float step = M_PI * 2.0f / res; + + for( size_t i{ }; i < res; ++i ) { + float theta = i * step; + float x_off = r * cos( theta ); + float y_off = r * sin( theta ); + + v[ i ] = { float( x + x_off ), float( y + y_off ), 1.0f, color }; + } + + m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, true ); + m_device->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, res, v, VERTEX_SIZE ); + m_device->SetRenderState( D3DRS_MULTISAMPLEANTIALIAS, false ); + } + + void c_renderer::draw_text( ID3DXFont* font, clr_t color, + int x, int y, FontAlign_t align, long font_flags, const char* msg ) { + if( !msg ) return; + if( !font ) return; + + auto d3d_black = D3DCOLOR_RGBA( 0, 0, 0, color.a( ) ); + auto d3d_color = D3DCOLOR_RGBA( color.r( ), color.g( ), color.b( ), color.a( ) ); + auto buf = msg; + + if( align == ALIGN_CENTER ) x -= get_text_width( font, font_flags, msg ) / 2; + if( align == ALIGN_RIGHT ) x -= get_text_width( font, font_flags, msg ); + RECT rect{ x, y, 1000, 100 }; + + ulong_t flags = DT_NOCLIP | DT_LEFT | DT_TOP; + + if( font_flags & D3DFONTFLAG_DROPSHADOW ) { + RECT r{ rect }; + r.left++; + r.top++; + font->DrawTextA( 0, buf, -1, &r, flags, d3d_black ); + } + + if( font_flags & D3DFONTFLAG_OUTLINE ) { + for( int i = -1; i < 2; i++ ) { + if( !i ) continue; + RECT r{ rect }; + r.left += i; + r.top += i; + font->DrawTextA( 0, buf, -1, &r, flags, d3d_black ); + } + } + + font->DrawTextA( 0, buf, -1, &rect, flags, d3d_color ); + } + + int c_renderer::get_text_width( ID3DXFont* font, long flags, const char* msg, ... ) { + char* buffer = ( char* )_alloca( 2048 ); + va_list list{ }; + + memset( buffer, 0, 2048 ); + + __crt_va_start( list, msg ); + vsprintf_s( buffer, 2048, msg, list ); + __crt_va_end( list ); + + RECT temp{ }; + font->DrawTextA( 0, buffer, -1, &temp, DT_CALCRECT, 0x0 ); + + return ( temp.right - temp.left ); + } + + int c_renderer::get_text_height( ID3DXFont* font, long flags, const char* msg, ... ) { + char* buffer = ( char* )_alloca( 2048 ); + va_list list{ }; + + memset( buffer, 0, 2048 ); + + __crt_va_start( list, msg ); + vsprintf_s( buffer, 2048, msg, list ); + __crt_va_end( list ); + + RECT temp{ }; + font->DrawTextA( 0, buffer, -1, &temp, DT_CALCRECT, 0x0 ); + + return ( temp.bottom - temp.top ); + } } \ No newline at end of file diff --git a/internal_rewrite/factory.hpp b/internal_rewrite/factory.hpp index d197951..c81c79b 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/lag_mgr.cpp b/internal_rewrite/lag_mgr.cpp index 66ccd52..9189345 100644 --- a/internal_rewrite/lag_mgr.cpp +++ b/internal_rewrite/lag_mgr.cpp @@ -63,11 +63,12 @@ namespace features auto weapon = g_ctx.m_local->get_weapon( ); - if( g_ctx.m_local->m_vecVelocity( ).length( ) < 0.1f || - g_cheat.m_ragebot.m_antiaim->is_fakewalking( ) ) { + if( g_cheat.m_ragebot.m_antiaim->is_fakewalking( ) ) { return; } + bool moving = g_ctx.m_local->m_vecVelocity( ).length2d( ) > 0.f; + vec3_t delta = g_ctx.m_last_origin - g_ctx.m_local->m_vecOrigin( ); int max_ticks = g_settings.rage.fakelag.ticks( ); if( settings.fluctuate ) @@ -103,11 +104,11 @@ namespace features bool send = true; static bool was_onground{ }; - if( settings.in_move && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) && g_ctx.m_local->m_vecVelocity( ).length2d( ) > 0.1f ) { + if( settings.in_move && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) && moving ) { send = false; } - if( settings.on_peek ) { + if( settings.on_peek && moving ) { static int choke_ticks = 0; bool peeking = predict_position( 20.f + g_ctx.m_local->m_vecVelocity( ) * TICK_INTERVAL( ) * 2.f ); @@ -155,6 +156,23 @@ namespace features was_onground = ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ); + if( settings.on_duck && ( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + float amt = g_ctx.m_local->m_flDuckAmount( ); + if( m_cmd->m_buttons & IN_DUCK ) { + if( amt < 1.0f ) + send = false; + } else if( amt > 0.f ) + send = false; + } + + static int wep_choke = 0; + if( m_cmd->m_weaponselect && settings.on_select ) { + wep_choke = max_ticks; + } + + if( wep_choke ) + send = !--wep_choke; + if( ( m_cmd->m_buttons & IN_ATTACK ) && g_ctx.m_local->can_attack( ) && !settings.in_attack ) { if( !weapon->is_grenade( ) || ( weapon->is_grenade( ) && weapon->m_fThrowTime( ) < TICK_INTERVAL( ) ) ) { diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp index 6aefbd1..71f5980 100644 --- a/internal_rewrite/ragebot.cpp +++ b/internal_rewrite/ragebot.cpp @@ -679,7 +679,7 @@ namespace features return -1; } - bool c_ragebot::can_hit_target( int it, aim_target_t* ret, bool zeus ) { + bool c_ragebot::can_hit_target( int it, aim_target_t* ret, bool zeus, bool hitchance ) { vec3_t aim_ang; vec3_t aim_pos; vec3_t local_pos = g_ctx.m_local->get_eye_pos( ); @@ -823,11 +823,14 @@ namespace features } - if( !util::hitchance( it, aim_ang, - g_settings.rage.active->m_hitchance, hitbox ) ) { + if( hitchance && !util::hitchance( it, aim_ang, + g_settings.rage.active->m_hitchance, hitbox ) ) { if( g_settings.rage.active->m_auto_stop( ) == 1 || g_settings.rage.active->m_auto_stop( ) == 4 ) quick_stop( m_cmd ); + if( g_settings.rage.active->m_auto_stop( ) == 5 ) + m_cmd->m_buttons |= IN_DUCK; + if( g_settings.rage.active->m_auto_stop( ) == 4 && g_cheat.m_lagmgr.get_choked( ) < 10 && !m_antiaim->is_fakewalking( ) ) g_cheat.m_lagmgr.set_state( false ); @@ -1086,10 +1089,12 @@ namespace features bool is_zeus = wep->m_iItemDefinitionIndex( ) == WEAPON_TASER; if( m_target != -1 && !m_antiaim->is_fakewalking( ) ) - if( g_settings.rage.active->m_auto_stop == 2 && can_hit_target( m_target, &t, is_zeus ) ) { + if( ( g_settings.rage.active->m_auto_stop == 2 || g_settings.rage.active->m_auto_stop == 5 ) && can_hit_target( m_target, &t, is_zeus, false ) ) { quick_stop( m_cmd ); + if( g_settings.rage.active->m_auto_stop == 5 ) + m_cmd->m_buttons |= IN_DUCK; } - else if( g_settings.rage.active->m_auto_stop == 3 && can_hit_target( m_target, &t, is_zeus ) ) { + else if( g_settings.rage.active->m_auto_stop == 3 && can_hit_target( m_target, &t, is_zeus, false ) ) { m_antiaim->run_fakewalk( ); //if( !g_cheat.m_lagmgr.get_choked( ) || g_cheat.m_lagmgr.get_state( ) ) m_cmd->m_viewangles.y = m_antiaim->get_yaw( ); diff --git a/internal_rewrite/ragebot.hpp b/internal_rewrite/ragebot.hpp index 1c4e7ed..2616ecf 100644 --- a/internal_rewrite/ragebot.hpp +++ b/internal_rewrite/ragebot.hpp @@ -70,7 +70,7 @@ namespace features std::array< int, 65 > get_sorted_targets( ); aim_target_t find_best_target( ); - bool can_hit_target( int, aim_target_t* target, bool zeus ); + bool can_hit_target( int, aim_target_t* target, bool zeus, bool hitchance = true ); int hitscan( c_base_player* ent, bool baim, vec3_t& out_pos, float& out_dmg ); void set_angles( const vec3_t& viewangles ); bool should_baim_entity( c_base_player* ent, bool backtracked = false ); diff --git a/internal_rewrite/ragebot_antiaim.cpp b/internal_rewrite/ragebot_antiaim.cpp index 91aac42..a3fa292 100644 --- a/internal_rewrite/ragebot_antiaim.cpp +++ b/internal_rewrite/ragebot_antiaim.cpp @@ -116,7 +116,7 @@ namespace features if( target != -1 ) { auto t = g_csgo.m_entlist( )->GetClientEntity( target ); - pitch = math::vector_angles( g_ctx.m_local->m_vecOrigin( ), t->m_vecOrigin( ) ).x; + pitch = math::vector_angles( g_ctx.m_local->get_eye_pos( ), t->get_hitbox_pos( 0 ) ).x; } else pitch = -10.f; @@ -126,6 +126,7 @@ namespace features g_ctx.m_local->get_animstate( )->m_iLastClientSideAnimationUpdateFramecount -= 1; g_ctx.m_local->get_animstate( )->update( real_angle.y, real_angle.x ); + g_ctx.m_local->cache_anim_data( false ); g_csgo.m_globals->m_curtime = backup_curtime; g_csgo.m_globals->m_frametime = backup_frametime; diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp index d8cc15e..e2d0c34 100644 --- a/internal_rewrite/settings.hpp +++ b/internal_rewrite/settings.hpp @@ -235,10 +235,12 @@ namespace data con_var< int > fluctuate{ &holder_, fnv( "fakelag_fluctuate" ), 0 }; con_var< bool > in_air{ &holder_, fnv( "fakelag_in_air" ), false }; con_var< bool > on_peek{ &holder_, fnv( "fakelag_on_peek" ), false }; + con_var< bool > on_select{ &holder_, fnv( "fakelag_on_select" ), false }; con_var< bool > in_move{ &holder_, fnv( "fakelag_in_move" ), false }; con_var< bool > in_attack{ &holder_, fnv( "fakelag_in_attack" ), false }; con_var< bool > avoid_ground{ &holder_, fnv( "fakelag_avoid_ground" ), false }; con_var< bool > jump_reset{ &holder_, fnv( "fakelag_jump_reset" ), false }; + con_var< bool > on_duck{ &holder_, fnv( "fakelag_on_duck" ), false }; } fakelag; con_var< bool > anti_aim{ &holder_, fnv( "rage_anti_aim" ), false }; @@ -353,6 +355,7 @@ namespace data con_var< bool > draw_spread{ &holder_, fnv( "visual_draw_spread" ), false }; con_var< bool > snipers_crosshair{ &holder_, fnv( "visuals_sniper_crosshair" ), false }; con_var< bool > grenade_prediction{ &holder_, fnv( "visuals_grenade_prediction" ), false }; + con_var< clr_t > grenade_pred_clr{ &holder_, fnv( "visuals_grenade_pred_clr" ), clr_t( 84, 173, 247 ) }; con_var< int > weapon_esp{ &holder_, fnv( "visuals_weapon_esp" ), 0 }; con_var< int > grenade_esp{ &holder_, fnv( "visuals_grenade_esp" ), 0 }; @@ -424,7 +427,7 @@ namespace data con_var< int > recording_start_key{ &holder_, fnv( "recording_start_key" ), 0 }; con_var< int > recording_stop_key{ &holder_, fnv( "recording_stop_key" ), 0 }; con_var< int > recording_show_angles{ &holder_, fnv( "recording_show_angles" ), 0 }; - + con_var< bool > no_crouch_cooldown{ &holder_, fnv("no_crouch_cooldown") }; con_var< bool > money_talk { &holder_, fnv( "misc_money_talk" ), false }; struct { @@ -439,13 +442,7 @@ namespace data } misc; struct { - con_var< uint8_t > menu_color_1r{ &holder_, fnv( "menu_color_1r" ), 231 }; - con_var< uint8_t > menu_color_1g{ &holder_, fnv( "menu_color_1g" ), 105 }; - con_var< uint8_t > menu_color_1b{ &holder_, fnv( "menu_color_1b" ), 105 }; - - con_var< uint8_t > menu_color_2r{ &holder_, fnv( "menu_color_2r" ), 0xf4 }; - con_var< uint8_t > menu_color_2g{ &holder_, fnv( "menu_color_2g" ), 0x7c }; - con_var< uint8_t > menu_color_2b{ &holder_, fnv( "menu_color_2b" ), 0xa8 }; + con_var< clr_t > menu_color{ &holder_, fnv( "menu_color" ), clr_t( 231, 105, 105 ) }; bool anti_untrusted = true; bool open = false; diff --git a/internal_rewrite/ui.h b/internal_rewrite/ui.h index 3df7e23..c763c74 100644 --- a/internal_rewrite/ui.h +++ b/internal_rewrite/ui.h @@ -460,6 +460,8 @@ namespace ui flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "in air" ), &g_settings.rage.fakelag.in_air ) ); flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "on move" ), &g_settings.rage.fakelag.in_move ) ); flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "on peek" ), &g_settings.rage.fakelag.on_peek ) ); + flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "on duck" ), &g_settings.rage.fakelag.on_duck ) ); + flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "on weapon select" ), &g_settings.rage.fakelag.on_select ) ); flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "while shooting" ), &g_settings.rage.fakelag.in_attack ) ); flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid ground" ), &g_settings.rage.fakelag.avoid_ground ) ); flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "reset on jump" ), &g_settings.rage.fakelag.jump_reset ) ); @@ -618,7 +620,10 @@ namespace ui local_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "recoil crosshair" ), &g_settings.visuals.recoil_crosshair( ) ) ); local_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "draw spread" ), &g_settings.visuals.draw_spread ) ); local_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "autowall crosshair" ), &g_settings.visuals.autowall_crosshair( ) ) ); - local_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "grenade prediction" ), &g_settings.visuals.grenade_prediction( ) ) ); + local_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "grenade prediction" ), &g_settings.visuals.grenade_prediction( ) ) )->add_item( + std::make_shared< ui::c_color_picker >( 180, 4, 15, &g_settings.visuals.grenade_pred_clr ) + ); + local_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "snipers crosshair" ), &g_settings.visuals.snipers_crosshair( ) ) ); } @@ -672,6 +677,7 @@ namespace ui auto circle_box = movement_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "circle strafe" ), &g_settings.misc.circle_strafe ) ); circle_box->add_item( std::make_shared< ui::c_key_picker_small >( 195, 1, &g_settings.misc.circle_strafe_key ) ); circle_box->set_cond( [ ]( ) { return g_settings.misc.bunny_hop && g_settings.misc.auto_strafe; } ); + movement_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "no duck cooldown" ), &g_settings.misc.no_crouch_cooldown ) ); movement_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "air duck" ), &g_settings.misc.air_duck ) ); @@ -797,12 +803,15 @@ namespace ui auto tab_config = std::make_shared< ui::c_tab_sheet >( xors( "config" ), &icons::sprite_config ); { - auto cfg_form = std::make_shared< ui::c_form >( 0, 10, 200, 93, xors( "config" ) ); + auto cfg_form = std::make_shared< ui::c_form >( 0, 10, 200, 113, xors( "config" ) ); cfg_form->add_item( std::make_shared< ui::c_dropdown< > >( 0, 0, 180, xors( "setting" ), &g_settings.menu.cur_setting, &dropdowns::configs ) ); cfg_form->add_item( std::make_shared< ui::c_button >( 0, 0, 85, 20, xors( "save" ), []( ) { g_settings.save( ); } ) ); cfg_form->add_item( std::make_shared< ui::c_button >( 95, -25, 85, 20, xors( "load" ), []( ) { g_settings.load( ); } ) ); //cfg_form->add_item( std::make_shared< ui::c_button >( 0, -25, 85, 20, xors( "to clipboard" ), [ ]( ) { g_settings.copy_to_clipboard( ); } ) ); //cfg_form->add_item( std::make_shared< ui::c_button >( 95, -50, 85, 20, xors( "from clipboard" ), [ ]( ) { g_settings.load_from_clipboard( ); } ) ); + auto label = cfg_form->add_item( std::make_shared< ui::c_label >( 0, -25, xors( "menu color" ) ) ); + label->add_item( std::make_shared< ui::c_color_picker >( 165, 4, 15, &g_settings.menu.menu_color ) ); + cfg_form->add_item( std::make_shared< ui::c_checkbox >( 0, -25, xors( "anti-untrusted" ), &g_settings.menu.anti_untrusted ) ); tab_config->add_item( cfg_form ); diff --git a/internal_rewrite/ui_draw.h b/internal_rewrite/ui_draw.h index 26a1c27..62a0068 100644 --- a/internal_rewrite/ui_draw.h +++ b/internal_rewrite/ui_draw.h @@ -41,20 +41,18 @@ namespace ui } __forceinline clr_t ui_get_accent_col( ) { - clr_t col_start = { - g_settings.menu.menu_color_1r, - g_settings.menu.menu_color_1g, - g_settings.menu.menu_color_1b - }; - - clr_t col_end = { - g_settings.menu.menu_color_2r, - g_settings.menu.menu_color_2g, - g_settings.menu.menu_color_2b - }; + clr_t col_start = g_settings.menu.menu_color; - clr_t col = clr_t::blend( col_start, col_end, anim_time ); + float brightness = col_start.brightness( ) / 255.f; + float saturation = col_start.saturation( ); + + float new_brightness = brightness > .5f ? brightness - 0.35f : brightness + 0.35f; + float new_saturation = saturation > .5f ? saturation - 0.3f : saturation + 0.3f; + clr_t col_end = clr_t::from_hsb( col_start.hue( ), new_saturation, new_brightness ); + col_end.a( ) = col_start.a( ); + + clr_t col = clr_t::blend( col_start, col_end, anim_time ); return col; } diff --git a/internal_rewrite/ui_dropdown_item.h b/internal_rewrite/ui_dropdown_item.h index f959f71..2774013 100644 --- a/internal_rewrite/ui_dropdown_item.h +++ b/internal_rewrite/ui_dropdown_item.h @@ -71,6 +71,7 @@ namespace ui { xors( "none" ), 0 }, { xors( "hitchance" ), 1 }, { xors( "hitchance + lag" ), 4 }, + { xors( "duck" ), 5 }, { xors( "slide" ), 3 }, { xors( "full" ), 2 } }; diff --git a/internal_rewrite/update_clientside_animation.cpp b/internal_rewrite/update_clientside_animation.cpp index 5e99e95..69f8607 100644 --- a/internal_rewrite/update_clientside_animation.cpp +++ b/internal_rewrite/update_clientside_animation.cpp @@ -32,6 +32,7 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { old_func( ecx_, 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 ) ); bool backup = ent->get_animstate( )->m_bOnGround; diff --git a/internal_rewrite/visual_local.cpp b/internal_rewrite/visual_local.cpp index c519b6f..e77a128 100644 --- a/internal_rewrite/visual_local.cpp +++ b/internal_rewrite/visual_local.cpp @@ -299,7 +299,7 @@ namespace features throw_pos = vec3_t( ); end_pos = trace.endpos; - draw_3d_line( src, end_pos, clr_t( 66, 143, 244 ) ); + draw_3d_line( src, end_pos, g_settings.visuals.grenade_pred_clr ); if( trace.fraction != 1.f ) { float surf_elasticity = 1.f; @@ -322,7 +322,7 @@ namespace features ray.Init( end_pos, end, vec3_t( -2.f, -2.f, -2.f ), vec3_t( 2.f, 2.f, 2.f ) ); g_csgo.m_trace( )->TraceRay( ray, CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTER | CONTENTS_CURRENT_90, &filter, &trace ); - draw_3d_line( end_pos, end, clr_t( 66, 143, 244 ), true ); + draw_3d_line( end_pos, end, g_settings.visuals.grenade_pred_clr, true ); end_pos = trace.endpos; throw_pos = throw_pos2; } diff --git a/internal_rewrite/visual_player.cpp b/internal_rewrite/visual_player.cpp index a117bd3..5d62cfa 100644 --- a/internal_rewrite/visual_player.cpp +++ b/internal_rewrite/visual_player.cpp @@ -58,7 +58,7 @@ namespace features float delta = ( g_csgo.m_globals->m_curtime - m_last_hit ) * 1.5f; if( std::abs( delta ) > 1.0f ) return; - clr_t col = clr_t( 221, 221, 221, 255 ); + clr_t col = g_settings.menu.menu_color; if( delta > 0.75f ) { col.a( ) = 255 * ( 1.0f - delta ) * 4.f; } -- cgit v1.2.3