blob: 243d76095a0058e3ad12c402bb8dfff5125cebea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include "hooks.hpp"
#include "context.hpp"
#include "base_cheat.hpp"
void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) {
static bool first_update = true;
auto old_func = update_clientside_animation_o;
if( ecx_ != g_ctx.m_local )
return old_func( ecx_, 0 );
auto ent = ( c_base_player* )( ecx_ );
static float last_update;
static float last_spawntime = 0.f;
// Arbitrary number much.
if( !g_settings.rage.anti_aim || !g_ctx.m_local->is_valid( ) || std::abs( last_update - g_csgo.m_globals->m_curtime ) > TICKS_TO_TIME( 20 ) || last_spawntime != ent->m_flSpawnTime( ) ) {
last_update = g_csgo.m_globals->m_curtime;
first_update = true;
if( last_spawntime != ent->m_flSpawnTime( ) )
last_spawntime = ent->m_flSpawnTime( );
return old_func( ecx_, edx_ );
}
last_update = g_csgo.m_globals->m_curtime;
ent->get_animstate( )->m_iLastClientSideAnimationUpdateFramecount = g_csgo.m_globals->m_framecount;
float backup_time = ent->get_animstate( )->m_flLastClientSideAnimationUpdateTime;
ent->get_animstate( )->m_flLastClientSideAnimationUpdateTime = g_csgo.m_globals->m_curtime;
old_func( ecx_, edx_ );
ent->get_animstate( )->m_flLastClientSideAnimationUpdateTime = backup_time;
if( !first_update ) {
g_ctx.m_local->restore_anim_data( true );
ent->set_abs_angles( vec3_t( 0, g_ctx.m_absyaw, 0 ) );
//ent->get_animstate( )->m_bOnGround = false;
ent->invalidate_bone_cache( );
auto model = ent->ce( )->GetModel( );
auto hdr = g_csgo.m_model_info( )->GetStudiomodel( model );
auto set = hdr->pHitboxSet( ent->m_nHitboxSet( ) );
if( hdr && set ) {
for( size_t i{ }; i < hdr->numbones; i++ ) {
auto bone = hdr->GetBone( i );
bone->proctype &= ~5;
}
}
byte backup = ent->get< byte >( 0x274 );
ent->get< byte >( 0x274 ) = 0;
ent->ce( )->SetupBones( nullptr, 128, BONE_USED_BY_ANYTHING, 0.f );
ent->get< byte >( 0x274 ) = backup;
}
first_update = false;
}
|