-
Notifications
You must be signed in to change notification settings - Fork 42
/
autowall.h
133 lines (117 loc) · 3.13 KB
/
autowall.h
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
#pragma once
class c_fire_bullet_params
{
public:
vec3 m_src;
c_game_trace m_enter_tr;
vec3 m_dir;
c_trace_filter m_filter;
float m_range;
float m_len;
float m_remaining_len;
float m_dmg;
int m_pen_count;
c_base_entity* m_target;
c_base_entity* m_shooter;
weapon_info_t* m_weapon_info;
bool m_simulated_shot;
};
class c_auto_wall
{
void scale_damage(int hitgroup, c_base_entity* ent, float armor_rat, float& out_dmg) const
{
auto has_armor = [](c_base_entity* player, int armor, int hitgroup)
{
bool result = false;
if (armor > 0)
{
switch (hitgroup)
{
case HITGROUP_GENERIC:
case HITGROUP_CHEST:
case HITGROUP_STOMACH:
case HITGROUP_LEFTARM:
case HITGROUP_RIGHTARM:
result = (armor > 0);
break;
case HITGROUP_HEAD:
result = player->has_helmet();
break;
}
}
return result;
};
auto get_dmg = [](int hitgroup)
{
switch (hitgroup)
{
case HITGROUP_HEAD:
return 4.0f;
case HITGROUP_CHEST:
case HITGROUP_GEAR:
case HITGROUP_GENERIC:
return 1.0f;
case HITGROUP_STOMACH:
return 1.5f;
case HITGROUP_LEFTARM:
case HITGROUP_RIGHTARM:
return 1.0f;
case HITGROUP_LEFTLEG:
case HITGROUP_RIGHTLEG:
return 0.75f;
default:
return 1.0f;
break;
}
};
auto armor = ent->armor();
switch (hitgroup)
{
case HITGROUP_HEAD:
out_dmg *= 4.f;
break;
case HITGROUP_STOMACH:
out_dmg *= 1.25f;
break;
case HITGROUP_LEFTLEG:
case HITGROUP_RIGHTLEG:
out_dmg *= 0.75f;
break;
}
if (has_armor(ent, armor, hitgroup))
{
auto v47 = 1.f, armor_bonus_ratio = 0.5f, armor_ratio = armor_rat * 0.5f;
auto dmg = out_dmg * armor_ratio;
if (((out_dmg - (out_dmg * armor_ratio)) * (v47 * armor_bonus_ratio)) > armor)
dmg = out_dmg - (armor / armor_bonus_ratio);
out_dmg = dmg;
}
}
bool fire_bullet(c_fire_bullet_params& params) const;
bool handle_bullet_penetration(c_fire_bullet_params& params) const;
bool trace_to_exit(vec3 src, vec3 dir, vec3& out_end, const c_game_trace& enter, c_game_trace& exit) const;
public:
static bool is_visible( const vec3& start, const vec3& end, c_base_entity* start_ent = nullptr, c_base_entity* end_ent = nullptr );
float get_damage( c_base_entity* shooter, c_base_entity* target, const vec3& point, weapon_info_t* custom_weapon = nullptr, const vec3* start = nullptr ) const;
void clip_trace_to_players( const vec3& start, const vec3& end, int mask, c_game_trace* old_trace, c_base_entity* ent ) const;
static weapon_info_t* get_big_fucking_gun( )
{
static weapon_info_t big_fucking_gun{ };
big_fucking_gun.damage = 200;
big_fucking_gun.range_modifier = 1.0f;
big_fucking_gun.penetration = 6.0f;
big_fucking_gun.armor_ratio = 2.0f;
big_fucking_gun.range = 8192.f;
return &big_fucking_gun;
}
static weapon_info_t* get_awp( )
{
static weapon_info_t awp{ };
awp.damage = 115;
awp.range_modifier = 0.99f;
awp.penetration = 2.5f;
awp.armor_ratio = 1.95f; //awp 1.95
awp.range = 8192.f;
return &awp;
}
}; extern c_auto_wall g_auto_wall;