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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
#include "hooks.hpp"
#include "base_cheat.hpp"
#include "context.hpp"
#include "util.hpp"
#include "settings.hpp"
//this is so ugly dont even look at it
//gets called once per frame for every entity
void __fastcall hooks::draw_model_execute( IVModelRender* ecx_, void* edx_,
void* render_ctx, const DrawModelState_t& state,
const ModelRenderInfo_t& info, matrix3x4* bone_to_world ) {
static auto dme_o = draw_model_execute_o;
if( g_csgo.m_panic || g_ctx.m_drawing_postscreenspace || g_settings.misc.hide_from_obs )
return dme_o( ecx_, edx_, render_ctx, state, info, bone_to_world );
bool draw = true;
IMaterial* mat = g_settings.visuals.chams.flat( ) ? g_cheat.m_chams.m_materials.m_chams_flat : g_cheat.m_chams.m_materials.m_chams;
auto model_name = g_csgo.m_model_info( )->GetModelName( info.m_model );
auto local_index = g_csgo.m_engine( )->GetLocalPlayer( );
int local_team = 0;
if( g_ctx.m_local )
local_team = g_ctx.m_local->m_iTeamNum( );
int team = 0;
bool is_player = false;
//printf( "model: %s\n", model_name );
if( strstr( model_name, xors( "models/player" ) ) && info.m_entity_index == local_index ) {
if( g_settings.misc.thirdperson( ) && g_ctx.m_local && g_ctx.m_local->is_valid( ) ) {
if( g_settings.rage.anti_aim ) {
static bool was_peeking = false;
static float peek_time = 0.f;
bool is_peeking = g_cheat.m_lagmgr.m_is_peeking;
if( is_peeking ) {
if( !was_peeking ) {
peek_time = g_csgo.m_globals->m_curtime;
}
auto matrix = g_cheat.m_lagmgr.m_peek_matrix;
clr_t col( 225, 225, 225, g_ctx.m_local->m_bIsScoped( ) ? 9 : 25 );
float totaltime = TICKS_TO_TIME( g_settings.rage.fakelag.ticks - 1 );
float end_time = peek_time + totaltime;
float delta = ( end_time - g_csgo.m_globals->m_curtime ) / totaltime;
delta = std::clamp( delta, 0.f, 1.f );
float progress = math::ease_in( 0.f, 1.f, delta );
float alpha = 0.f;
if( progress < 0.5f ) {
alpha = progress * 2.f;
} else {
alpha = 1.f - ( 0.5f - progress ) * 2.f;
}
col.a( ) *= alpha;
float backup_blend;
float backup_modulation[ 3 ];
if( g_ctx.m_local->m_bIsScoped( ) ) {
backup_blend = 0.3f;
backup_modulation[ 0 ] = backup_modulation[ 1 ] = backup_modulation[ 2 ] == 1.f;
}
backup_blend = g_csgo.m_render_view( )->GetBlend( );
g_csgo.m_render_view( )->GetColorModulation( backup_modulation );
bool wanted_ignorez = g_settings.visuals.chams.ignore_z( ) && g_settings.visuals.chams.friendlies( );
bool backup = false;
fclr_t clr_hid = g_settings.visuals.chams.color_hidden_friendly( ).to_fclr( );
if( backup_modulation[ 0 ] == clr_hid.r( ) && backup_modulation[ 1 ] == clr_hid.g( ) && backup_modulation[ 2 ] == clr_hid.b( )
&& backup_blend == clr_hid.a( ) ) {
backup = true;
}
if( backup == wanted_ignorez || ( !backup && !g_settings.visuals.chams.clear_occlusion( ) ) || !g_settings.visuals.chams.enabled( )
|| g_ctx.m_local->m_bIsScoped( ) ) {
g_cheat.m_chams.m_materials.m_chams_flat.m_mat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, false );
g_cheat.m_chams.m_materials.force_material( g_cheat.m_chams.m_materials.m_chams_flat, col.to_fclr( ) );
dme_o( ecx_, edx_, render_ctx, state, info, matrix );
g_cheat.m_chams.m_materials.m_chams_flat.m_mat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, backup );
g_csgo.m_render_view( )->SetBlend( backup_blend );
g_csgo.m_render_view( )->SetColorModulation( backup_modulation );
g_csgo.m_model_render( )->ForcedMaterialOverride( g_settings.visuals.chams.enabled( ) &&
g_settings.visuals.chams.friendlies( ) && !g_ctx.m_local->m_bIsScoped( ) ? mat : nullptr );
}
}
was_peeking = is_peeking;
}
if( g_ctx.m_local->m_bIsScoped( ) ) {
float clr[ ] = { 1.0f, 1.0f, 1.0f };
g_csgo.m_render_view( )->SetColorModulation( clr );
g_csgo.m_render_view( )->SetBlend( 0.3f );
return dme_o( ecx_, edx_, render_ctx, state, info, bone_to_world );
}
}
}
if( strstr( model_name, xors( "models/player" ) ) && info.m_entity_index ) {
auto player = g_csgo.m_entlist( )->GetClientEntity< >( info.m_entity_index );
if( player && player->is_valid( ) && !player->m_bGunGameImmunity( ) ) {
is_player = true;
team = player->m_iTeamNum( );
if( g_settings.rage.active && ( team != local_team || g_settings.rage.friendlies ) && !player->has_valid_anim( ) )
return;
if( is_player ) {
bool should_draw = false;
if( g_settings.rage.enabled( ) && g_settings.rage.resolver( ) && g_settings.rage.bt_visualize( ) && ( team != local_team || g_settings.rage.friendlies( ) ) )
should_draw = true;
if( g_settings.legit.enabled( ) && g_settings.legit.backtracking_visualize( ) && ( team != local_team || g_settings.rage.friendlies( ) ) )
should_draw = true;
if( should_draw ) {
matrix3x4 render_matrix[ 128 ];
if( g_cheat.m_ragebot.m_lagcomp->get_render_record( info.m_entity_index, render_matrix ) ) {
fclr_t clr_hid = team != local_team ? g_settings.visuals.chams.color_hidden_enemy( ).to_fclr( ) : g_settings.visuals.chams.color_hidden_friendly( ).to_fclr( );
float backup_modulation[ 3 ]{ };
bool backup_ignorez = false;
bool wanted_ignorez = g_settings.visuals.chams.ignore_z( );
float backup_blend = 1.0f;
backup_blend = g_csgo.m_render_view( )->GetBlend( );
g_csgo.m_render_view( )->GetColorModulation( backup_modulation );
//BIG ROFL
if( backup_modulation[ 0 ] == clr_hid.r( ) && backup_modulation[ 1 ] == clr_hid.g( ) && backup_modulation[ 2 ] == clr_hid.b( )
&& backup_blend == clr_hid.a( ) ) {
backup_ignorez = true;
}
if( backup_ignorez == wanted_ignorez || ( !backup_ignorez && !g_settings.visuals.chams.clear_occlusion( ) ) || !g_settings.visuals.chams.enabled( ) ) {
auto flat_mat = g_cheat.m_chams.m_materials.m_chams_flat.m_mat;
flat_mat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, g_settings.visuals.chams.ignore_z && g_settings.visuals.chams.enabled );
clr_t bt_col = g_settings.legit.enabled( ) ? g_settings.legit.backtracking_col( ) : g_settings.rage.bt_col( );
g_cheat.m_chams.m_materials.force_material( g_cheat.m_chams.m_materials.m_chams_flat, bt_col );
dme_o( ecx_, edx_, render_ctx, state, info, render_matrix );
flat_mat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, backup_ignorez );
}
g_csgo.m_render_view( )->SetBlend( backup_blend );
g_csgo.m_render_view( )->SetColorModulation( backup_modulation );
g_csgo.m_model_render( )->ForcedMaterialOverride( g_settings.visuals.chams.enabled( ) &&
( team != local_team || g_settings.visuals.chams.friendlies( ) ) ? mat : nullptr );
}
}
}
if( g_settings.visuals.chams.enabled ) {
if( g_settings.visuals.chams.ignore_z && !g_ctx.m_drawing_screneend && ( team != local_team || g_settings.visuals.chams.friendlies( ) ) && g_settings.visuals.chams.clear_occlusion )
draw = false;
else if( ( !g_settings.visuals.chams.ignore_z || !g_settings.visuals.chams.clear_occlusion ) && ( team != local_team || g_settings.visuals.chams.friendlies( ) ) ) {
fclr_t clr = team != local_team ? g_settings.visuals.chams.color_visible_enemy( ) : g_settings.visuals.chams.color_visible_friendly( );
if( g_settings.visuals.chams.ignore_z ) {
fclr_t clr = team != local_team ? g_settings.visuals.chams.color_hidden_enemy( ) : g_settings.visuals.chams.color_hidden_friendly( );
mat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, true );
g_cheat.m_chams.m_materials.force_material( mat, clr );
dme_o( ecx_, 0, render_ctx, state, info, bone_to_world );
}
mat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, false );
g_cheat.m_chams.m_materials.force_material( mat, clr );
dme_o( ecx_, 0, render_ctx, state, info, bone_to_world );
g_csgo.m_model_render( )->ForcedMaterialOverride( nullptr );
g_csgo.m_render_view( )->SetBlend( 1.0f );
draw = false;
}
}
}
}
if( g_settings.misc.transparent_vm && strstr( model_name, xors( "weapon" ) ) ) {
if( strstr( model_name, xors( "arms" ) ) ) {
g_csgo.m_render_view( )->SetBlend( 0.6f );
}
}
if( draw ) {
dme_o( ecx_, 0, render_ctx, state, info, bone_to_world );
}
g_csgo.m_model_render( )->ForcedMaterialOverride( nullptr );
}
|