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/autowall.cpp | 50 +++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'internal_rewrite/autowall.cpp') 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; -- cgit v1.2.3