-
Notifications
You must be signed in to change notification settings - Fork 68
/
clientmode.cpp
67 lines (49 loc) · 2.1 KB
/
clientmode.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
#include "includes.h"
bool Hooks::ShouldDrawParticles( ) {
return g_hooks.m_client_mode.GetOldMethod< ShouldDrawParticles_t >( IClientMode::SHOULDDRAWPARTICLES )( this );
}
bool Hooks::ShouldDrawFog( ) {
// remove fog.
if( g_menu.main.visuals.nofog.get( ) )
return false;
return g_hooks.m_client_mode.GetOldMethod< ShouldDrawFog_t >( IClientMode::SHOULDDRAWFOG )( this );
}
void Hooks::OverrideView( CViewSetup* view ) {
// damn son.
g_cl.m_local = g_csgo.m_entlist->GetClientEntity< Player* >( g_csgo.m_engine->GetLocalPlayer( ) );
// g_grenades.think( );
g_visuals.ThirdpersonThink( );
// call original.
g_hooks.m_client_mode.GetOldMethod< OverrideView_t >( IClientMode::OVERRIDEVIEW )( this, view );
// remove scope edge blur.
if( g_menu.main.visuals.noscope.get( ) ) {
if( g_cl.m_local && g_cl.m_local->m_bIsScoped( ) )
view->m_edge_blur = 0;
}
}
bool Hooks::CreateMove( float time, CUserCmd* cmd ) {
Stack stack;
bool ret;
// let original run first.
ret = g_hooks.m_client_mode.GetOldMethod< CreateMove_t >( IClientMode::CREATEMOVE )( this, time, cmd );
// called from CInput::ExtraMouseSample -> return original.
if( !cmd->m_command_number )
return ret;
// if we arrived here, called from -> CInput::CreateMove
// call EngineClient::SetViewAngles according to what the original returns.
if( ret )
g_csgo.m_engine->SetViewAngles( cmd->m_view_angles );
// random_seed isn't generated in ClientMode::CreateMove yet, we must set generate it ourselves.
cmd->m_random_seed = g_csgo.MD5_PseudoRandom( cmd->m_command_number ) & 0x7fffffff;
// get bSendPacket off the stack.
g_cl.m_packet = stack.next( ).local( 0x1c ).as< bool* >( );
// get bFinalTick off the stack.
g_cl.m_final_packet = stack.next( ).local( 0x1b ).as< bool* >( );
// invoke move function.
g_cl.OnTick( cmd );
return false;
}
bool Hooks::DoPostScreenSpaceEffects( CViewSetup* setup ) {
g_visuals.RenderGlow( );
return g_hooks.m_client_mode.GetOldMethod< DoPostScreenSpaceEffects_t >( IClientMode::DOPOSTSPACESCREENEFFECTS )( this, setup );
}