summaryrefslogtreecommitdiffstats
path: root/src/menu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/menu.cpp')
-rw-r--r--src/menu.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/menu.cpp b/src/menu.cpp
index 6474d69..269174d 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -56,6 +56,7 @@ static bool g_bhop_autostrafe = true;
56 56
57static FeatureState g_abh{true, 0}; 57static FeatureState g_abh{true, 0};
58static FeatureState g_esp{true, 0}; 58static FeatureState g_esp{true, 0};
59static FeatureState g_aimbot{true, 604}; // default Mouse5, rebindable in menu
59 60
60// ESP sub-options (menu "ESP" children). Defaults match the pre-option 61// ESP sub-options (menu "ESP" children). Defaults match the pre-option
61// behaviour: everything on. 62// behaviour: everything on.
@@ -77,6 +78,9 @@ static MenuNode g_esp_opt_nodes[ESP_OPT_COUNT] = {
77 {NODE_TOGGLE, "Show name", false, 0, {}, &g_esp_opt[ESP_OPT_SHOW_NAME], nullptr, nullptr}, 78 {NODE_TOGGLE, "Show name", false, 0, {}, &g_esp_opt[ESP_OPT_SHOW_NAME], nullptr, nullptr},
78 {NODE_TOGGLE, "Show skeleton", false, 0, {}, &g_esp_opt[ESP_OPT_SHOW_SKELETON], nullptr, nullptr}, 79 {NODE_TOGGLE, "Show skeleton", false, 0, {}, &g_esp_opt[ESP_OPT_SHOW_SKELETON], nullptr, nullptr},
79}; 80};
81static MenuNode g_aimbot_feat{NODE_FEATURE, "Aimbot", false, 1, {}, nullptr, nullptr, nullptr};
82static MenuNode g_aimbot_active{NODE_TOGGLE, "Active", false, 0, {}, &g_aimbot.active, nullptr, nullptr};
83static MenuNode g_aimbot_bind{NODE_BIND, "Bind", false, 0, {}, nullptr, &g_aimbot.bind, nullptr};
80 84
81static MenuNode *g_visible[32]; // flattened visible nodes for arrow navigation 85static MenuNode *g_visible[32]; // flattened visible nodes for arrow navigation
82static int g_visible_count = 0; 86static int g_visible_count = 0;
@@ -90,13 +94,17 @@ static void build_tree() {
90 g_bhop_feat.child_count = 2; 94 g_bhop_feat.child_count = 2;
91 g_abh_feat.children[0] = &g_abh_active; 95 g_abh_feat.children[0] = &g_abh_active;
92 g_esp_feat.children[0] = &g_esp_active; 96 g_esp_feat.children[0] = &g_esp_active;
97 g_aimbot_feat.children[0] = &g_aimbot_active;
98 g_aimbot_feat.children[1] = &g_aimbot_bind;
99 g_aimbot_feat.child_count = 2;
93 for (int i = 0; i < ESP_OPT_COUNT; i++) 100 for (int i = 0; i < ESP_OPT_COUNT; i++)
94 g_esp_feat.children[i + 1] = &g_esp_opt_nodes[i]; 101 g_esp_feat.children[i + 1] = &g_esp_opt_nodes[i];
95 g_esp_feat.child_count = ESP_OPT_COUNT + 1; 102 g_esp_feat.child_count = ESP_OPT_COUNT + 1;
96 g_root.children[0] = &g_bhop_feat; 103 g_root.children[0] = &g_bhop_feat;
97 g_root.children[1] = &g_abh_feat; 104 g_root.children[1] = &g_abh_feat;
98 g_root.children[2] = &g_esp_feat; 105 g_root.children[2] = &g_esp_feat;
99 g_root.child_count = 3; 106 g_root.children[3] = &g_aimbot_feat;
107 g_root.child_count = 4;
100} 108}
101 109
102static int g_depth[32]; // depth of each visible row (for indentation) 110static int g_depth[32]; // depth of each visible row (for indentation)
@@ -159,6 +167,8 @@ static void config_save() {
159 fprintf(f, "[bhop]\nactive=%d\nbind=%d\nautostrafe=%d\n", g_bhop.active, 167 fprintf(f, "[bhop]\nactive=%d\nbind=%d\nautostrafe=%d\n", g_bhop.active,
160 g_bhop.bind, g_bhop_autostrafe); 168 g_bhop.bind, g_bhop_autostrafe);
161 fprintf(f, "[abh]\nactive=%d\nbind=%d\n", g_abh.active, g_abh.bind); 169 fprintf(f, "[abh]\nactive=%d\nbind=%d\n", g_abh.active, g_abh.bind);
170 fprintf(f, "[aimbot]\nactive=%d\nbind=%d\n", g_aimbot.active,
171 g_aimbot.bind);
162 fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n" 172 fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n"
163 "healthnum=%d\nname=%d\nskeleton=%d\n", 173 "healthnum=%d\nname=%d\nskeleton=%d\n",
164 g_esp.active, g_esp.bind, g_esp_opt[ESP_OPT_SHOW_NEUTRAL], 174 g_esp.active, g_esp.bind, g_esp_opt[ESP_OPT_SHOW_NEUTRAL],
@@ -184,6 +194,8 @@ static void config_load() {
184 cur = &g_abh; 194 cur = &g_abh;
185 else if (strstr(line, "[esp]")) 195 else if (strstr(line, "[esp]"))
186 cur = &g_esp; 196 cur = &g_esp;
197 else if (strstr(line, "[aimbot]"))
198 cur = &g_aimbot;
187 else 199 else
188 cur = nullptr; 200 cur = nullptr;
189 in_esp = (cur == &g_esp); 201 in_esp = (cur == &g_esp);
@@ -319,8 +331,8 @@ static bool key_pressed(int sc) {
319// feature gate queried from hl2h.cpp do_move(): feature must be Active AND 331// feature gate queried from hl2h.cpp do_move(): feature must be Active AND
320// its bind key held (always-on when unbound). 332// its bind key held (always-on when unbound).
321bool feature_active(int feature) { 333bool feature_active(int feature) {
322 static FeatureState *feats[3] = {&g_bhop, &g_abh, &g_esp}; 334 static FeatureState *feats[4] = {&g_bhop, &g_abh, &g_esp, &g_aimbot};
323 if (feature < 0 || feature > 2) 335 if (feature < 0 || feature > 3)
324 return false; 336 return false;
325 FeatureState *f = feats[feature]; 337 FeatureState *f = feats[feature];
326 if (!f->active) 338 if (!f->active)
@@ -376,7 +388,7 @@ static void menu_handle_input() {
376 MenuNode *n = g_visible[g_selected]; 388 MenuNode *n = g_visible[g_selected];
377 if (n->bind_ptr) { 389 if (n->bind_ptr) {
378 // clear same bind from other features 390 // clear same bind from other features
379 FeatureState *features[] = {&g_bhop, &g_abh}; 391 FeatureState *features[] = {&g_bhop, &g_abh, &g_aimbot};
380 for (auto *f : features) 392 for (auto *f : features)
381 if (&f->bind != n->bind_ptr && f->bind == i) 393 if (&f->bind != n->bind_ptr && f->bind == i)
382 f->bind = 0; 394 f->bind = 0;
@@ -578,10 +590,10 @@ void outer_draw() {
578 draw_text(270, 10 + i * 20, "[press key]"); 590 draw_text(270, 10 + i * 20, "[press key]");
579 else { 591 else {
580 /* stable name for current bind */ 592 /* stable name for current bind */
581 static char bn[2][32]; 593 static char bn[3][32];
582 static FeatureState *feats[] = {&g_bhop, &g_abh}; 594 static FeatureState *feats[] = {&g_bhop, &g_abh, &g_aimbot};
583 int fi = 0; 595 int fi = 0;
584 for (int k = 0; k < 2; k++) 596 for (int k = 0; k < 3; k++)
585 if (n->bind_ptr == &feats[k]->bind) 597 if (n->bind_ptr == &feats[k]->bind)
586 fi = k; 598 fi = k;
587 snprintf(bn[fi], 32, "[%s]", scancode_name(*n->bind_ptr)); 599 snprintf(bn[fi], 32, "[%s]", scancode_name(*n->bind_ptr));