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
204
205
206
207
|
#include <algorithm>
#include "visuals.hpp"
#include "ctx.hpp"
#include "base_cheat.h"
#include "renderer.hpp"
#include "input_system.hpp"
#include "math.h"
#include "settings.h"
#include "interfaces.h"
namespace features
{
void c_visuals::draw_local( ) {
int screen_w, screen_h;
cl.m_engine( )->GetScreenSize( screen_w, screen_h );
int cur_pos{ };
if( g_settings.misc.no_scope( ) &&
g_ctx.m_local->m_bIsScoped( ) ) {
int w, h;
cl.m_engine( )->GetScreenSize( w, h );
draw_line( 0, h / 2, w, h / 2, clr_t( 0, 0, 0 ) );
draw_line( w / 2, 0, w / 2, h, clr_t( 0, 0, 0 ) );
}
spectator_list( );
//throwable_prediction( ); -- sometime when i can be fucked
}
void c_visuals::spectator_list( ) {
if( !g_settings.visuals.spec_list )
return;
std::vector< std::string > spec_list;
for( size_t i{ }; i < 65; ++i ) {
auto ent = cl.m_entlist( )->get_client_entity< c_base_player >( i );
if( ent && ent->is_player( ) && !ent->ce( )->is_dormant( ) ) {
auto spec_handle = ent->m_hObserverTarget( );
auto spec_ent = cl.m_entlist( )->get_entity_from_handle< c_base_player >( spec_handle );
if( spec_ent == g_ctx.m_local ) {
char player_name[ 32 ];
ent->get_name_safe( player_name );
spec_list.push_back( player_name );
}
}
}
int screen_w, screen_h;
cl.m_engine( )->GetScreenSize( screen_w, screen_h );
int cur_pos{ };
if( g_settings.misc.watermark ) {
cur_pos = 20;
}
for( auto& it : spec_list ) {
draw_string( screen_w - 3, cur_pos, ALIGN_RIGHT, true, clr_t( 255, 255, 255 ), it.c_str( ) );
cur_pos += 10;
}
}
//i wanna do this
/*
void c_visuals::throwable_prediction( ) {
static auto sv_gravity = cl.m_cvar( )->FindVar( xors( "sv_gravity" ) );
if( !g_settings.visuals.grenade_prediction )
return;
/*
auto get_detonate_time = [ ]( int defindex ) {
switch( defindex ) {
case WEAPON_FLASHBANG:
case WEAPON_HEGRENADE:
return 1.5f;
case WEAPON_INCGRENADE:
case WEAPON_MOLOTOV:
return molotov_detonate_time->get_float( );
case WEAPON_DECOY:
return 5.f;
default: return 3.f;
}
};
auto draw_3d_line = [ this ]( const vec3_t& start, const vec3_t& end, clr_t col, bool circle = false ) {
vec2_t start_w2s = util::screen_transform( start );
vec2_t end_w2s = util::screen_transform( end );
draw_line( start_w2s, end_w2s, col );
if( circle )
draw_rect( end_w2s.x - 1, end_w2s.y - 1, 2, 2, clr_t( 230, 230, 230 ) );
};
auto clip_velocity = [ ]( const vec3_t& in, const vec3_t& normal, vec3_t& out, float overbounce ) {
int blocked = 0;
float angle = normal[ 2 ];
if( angle > 0.f )
blocked |= 1;
if( !angle )
blocked |= 2;
float backoff = in.dot( normal ) * overbounce;
for( int i{ }; i < 3; ++i ) {
out[ i ] = in[ i ] - ( normal[ i ] * backoff );
if( out[ i ] > -0.1f && out[ i ] < 0.1f ) {
out[ i ] = 0.f;
}
}
return blocked;
};
auto weapon = g_ctx.m_local->get_active_weapon( );
if( !weapon ) return;
int def_index = weapon->m_iItemDefinitionIndex( );
if( weapon->has_trajectory( ) )
return;
auto wpn_info = weapon->get_wpn_info( );
vec3_t throw_ang, forward;
cl.m_engine( )->GetViewAngles( throw_ang );
throw_ang.x -= ( 90.f - abs( throw_ang.x ) ) * 0.11111111f;
throw_ang.x = std::remainderf( throw_ang.x, 360.f );
forward = math::angle_vectors( throw_ang );
float throw_strength = weapon->m_flThrowStrength( );
float throw_velocity = std::min( std::max( wpn_info->throw_velocity * 0.9f, 15.f ), 750.f );
float throw_height = ( throw_strength * 12.f ) - 12.f;
float v68 = throw_velocity * ( ( 0.7f * throw_strength ) + 0.3f );
vec3_t start_pos = g_ctx.m_local->get_eye_pos( ) + vec3_t( 0, 0, throw_height );
vec3_t end_pos = start_pos + ( forward * 22.f );
CTraceFilter filter;
filter.pSkip = g_ctx.m_local;
CGameTrace trace;
Ray_t ray;
ray.Init( start_pos, end_pos, vec3_t( -2.f, -2.f, -2.f ), vec3_t( 2.f, 2.f, 2.f ) );
cl.m_trace( )->trace_ray( ray, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_MOVEABLE | CONTENTS_CURRENT_90, &filter, &trace );
end_pos = trace.endpos - forward * 6.f;
vec3_t throw_pos = g_ctx.m_local->m_vecVelocity( ) * 1.25f + forward * v68;
//draw_3d_line( start_pos, end_pos, clr_t( 255, 255, 255 ) );
float gravity = sv_gravity->get_float( ) * 0.4f;
player_info_t info{ };
for( int ticks = TIME_TO_TICKS( get_detonate_time( def_index ) ); ticks >= 0; --ticks ) {
auto throw_dir = vec3_t( throw_pos.x, throw_pos.y, ( throw_pos.z + ( throw_pos.z - ( gravity * TICK_INTERVAL( ) ) ) ) * 0.5f );
auto temp = throw_dir * TICK_INTERVAL( );
throw_pos.z -= gravity * TICK_INTERVAL( );
vec3_t src = end_pos, end = end_pos + temp;
Ray_t ray;
ray.Init( src, end, vec3_t( -2.f, -2.f, -2.f ), vec3_t( 2.f, 2.f, 2.f ) );
cl.m_trace( )->trace_ray( ray, CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTER | CONTENTS_CURRENT_90, &filter, &trace );
if( trace.allsolid )
throw_pos = vec3_t( );
end_pos = trace.endpos;
draw_3d_line( src, end_pos, clr_t( 66, 143, 244 ) );
if( trace.fraction != 1.f ) {
float surf_elasticity = 1.f;
vec3_t throw_pos2{ };
clip_velocity( throw_pos, trace.plane.normal, throw_pos2, 2.f );
if( trace.m_pEnt && cl.m_engine( )->GetPlayerInfo( trace.m_pEnt->index( ), &info ) ) {
surf_elasticity = 0.3f;
}
throw_pos2 *= std::clamp( surf_elasticity * 0.45f, 0.f, 0.9f );
end = end_pos + throw_pos2 * ( ( 1.f - trace.fraction ) * TICK_INTERVAL( ) );
if( def_index == WEAPON_MOLOTOV || def_index == WEAPON_INCGRENADE ) {
if( trace.plane.normal.z >= cos( DEG2RAD( molotov_detonate_slope->get_float( ) ) ) ) {
return;
}
}
ray.Init( end_pos, end, vec3_t( -2.f, -2.f, -2.f ), vec3_t( 2.f, 2.f, 2.f ) );
cl.m_trace( )->trace_ray( ray, CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTER | CONTENTS_CURRENT_90, &filter, &trace );
draw_3d_line( end_pos, end, clr_t( 66, 143, 244 ), true );
end_pos = trace.endpos;
throw_pos = throw_pos2;
}
}
}*/
}
|