-
Notifications
You must be signed in to change notification settings - Fork 6
/
clientdll.cpp
111 lines (84 loc) · 2.83 KB
/
clientdll.cpp
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include "includes.h"
void Hooks::LevelInitPreEntity( const char* map ) {
float rate{ 1.f / g_csgo.m_globals->m_interval };
// set rates when joining a server.
g_csgo.cl_updaterate->SetValue( rate );
g_csgo.cl_cmdrate->SetValue( rate );
g_aimbot.reset( );
g_visuals.m_hit_start = g_visuals.m_hit_end = g_visuals.m_hit_duration = 0.f;
// invoke original method.
g_hooks.m_client.GetOldMethod< LevelInitPreEntity_t >( CHLClient::LEVELINITPREENTITY )( this, map );
}
void Hooks::LevelInitPostEntity( ) {
g_cl.OnMapload( );
// invoke original method.
g_hooks.m_client.GetOldMethod< LevelInitPostEntity_t >( CHLClient::LEVELINITPOSTENTITY )( this );
}
void Hooks::LevelShutdown( ) {
g_aimbot.reset( );
g_cl.m_local = nullptr;
g_cl.m_weapon = nullptr;
g_cl.m_processing = false;
g_cl.m_weapon_info = nullptr;
g_cl.m_round_end = false;
g_cl.m_sequences.clear( );
// invoke original method.
g_hooks.m_client.GetOldMethod< LevelShutdown_t >( CHLClient::LEVELSHUTDOWN )( this );
}
/*int Hooks::IN_KeyEvent( int evt, int key, const char* bind ) {
// see if this key event was fired for the drop bind.
/*if( bind && FNV1a::get( bind ) == HASH( "drop" ) ) {
// down.
if( evt ) {
g_cl.m_drop = true;
g_cl.m_drop_query = 2;
g_cl.print( "drop\n" );
}
// up.
else
g_cl.m_drop = false;
// ignore the event.
return 0;
}
return g_hooks.m_client.GetOldMethod< IN_KeyEvent_t >( CHLClient::INKEYEVENT )( this, evt, key, bind );
}*/
void Hooks::FrameStageNotify( Stage_t stage ) {
// save stage.
if( stage != FRAME_START )
g_cl.m_stage = stage;
// damn son.
g_cl.m_local = g_csgo.m_entlist->GetClientEntity< Player* >( g_csgo.m_engine->GetLocalPlayer( ) );
if( stage == FRAME_RENDER_START ) {
// apply local player animated angles.
g_cl.SetAngles( );
// apply local player animation fix.
g_cl.UpdateAnimations( );
// draw our custom beams.
g_visuals.DrawBeams( );
}
// call og.
g_hooks.m_client.GetOldMethod< FrameStageNotify_t >( CHLClient::FRAMESTAGENOTIFY )( this, stage );
if( stage == FRAME_RENDER_START ) {
// ...
}
else if( stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START ) {
// restore non-compressed netvars.
// g_netdata.apply( );
g_skins.think( );
}
else if( stage == FRAME_NET_UPDATE_POSTDATAUPDATE_END ) {
g_visuals.NoSmoke( );
}
else if( stage == FRAME_NET_UPDATE_END ) {
// restore non-compressed netvars.
g_netdata.apply( );
// update all players.
for( int i{ 1 }; i <= g_csgo.m_globals->m_max_clients; ++i ) {
Player* player = g_csgo.m_entlist->GetClientEntity< Player* >( i );
if( !player || player->m_bIsLocalPlayer( ) )
continue;
AimPlayer* data = &g_aimbot.m_players[ i - 1 ];
data->OnNetUpdate( player );
}
}
}