diff options
| author | navewindre <boneyaard@gmail.com> | 2018-09-05 23:19:33 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2018-09-05 23:19:33 +0200 |
| commit | 80d9845607058a85c5250aebca1280324b811285 (patch) | |
| tree | cbea9ccbdd0a4be8e8d8dbd8a0e8171ffe7612e9 /internal_rewrite/util.cpp | |
| parent | cf4d2ec1a220d70bcfb6490a1a4e23dc8d90886b (diff) | |
whole bunch of shit
Diffstat (limited to 'internal_rewrite/util.cpp')
| -rw-r--r-- | internal_rewrite/util.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/internal_rewrite/util.cpp b/internal_rewrite/util.cpp index 9bc315f..a4df63d 100644 --- a/internal_rewrite/util.cpp +++ b/internal_rewrite/util.cpp @@ -210,7 +210,7 @@ bool __vectorcall util::intersects_hitbox( vec3_t eye_pos, vec3_t end_pos, vec3_ }
// Note: abuse this as much as you can to achieve the full potential it offers.
-bool util::hitchance( int target, const vec3_t& angles, int percentage ) {
+bool util::hitchance( int target, const vec3_t& angles, int percentage, int hitbox ) {
if( g_settings.rage.compensate_spread )
return true;
@@ -276,16 +276,32 @@ bool util::hitchance( int target, const vec3_t& angles, int percentage ) { if( !hdr ) return false;
matrix3x4 bone_matrix[ 128 ];
- if( !ent->ce()->SetupBones( bone_matrix, 128, 0x100, g_csgo.m_globals->m_curtime ) ) {
- return false;
- }
+ memcpy( bone_matrix,
+ ent->m_CachedBoneData( ).GetElements( ),
+ ent->m_CachedBoneData( ).GetSize( ) * sizeof( matrix3x4 ) );
auto set = hdr->pHitboxSet( ent->m_nHitboxSet( ) );
if( !set ) return false;
- for( int hitbox{ }; hitbox < set->numhitboxes; ++hitbox ) {
+ if( hitbox == -1 ) {
+ for( int hitbox{ }; hitbox < set->numhitboxes; ++hitbox ) {
+ auto box = set->pHitbox( hitbox );
+ if( !box ) continue;
+
+ auto min = math::vector_transform( box->bbmin, bone_matrix[ box->bone ] );
+ auto max = math::vector_transform( box->bbmax, bone_matrix[ box->bone ] );
+ auto radius = box->m_flRadius;
+
+ if( radius == -1.f ) {
+ radius = min.dist_to( max );
+ }
+
+ m_hitbox_data.push_back( hitbox_data_t( min, max, radius ) );
+ }
+ }
+ else {
auto box = set->pHitbox( hitbox );
- if( !box ) continue;
+ if( !box ) return false;
auto min = math::vector_transform( box->bbmin, bone_matrix[ box->bone ] );
auto max = math::vector_transform( box->bbmax, bone_matrix[ box->bone ] );
|
