diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-26 17:30:29 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-26 17:30:29 +0100 |
| commit | 92d388116cc19ef728d66ac67eaa4f584e63d895 (patch) | |
| tree | 5b9438cf8c2f1b4f01eef3eec4a6d91b42ac1acb /src/menu.cpp | |
| parent | Triggerbot: crosshair entity trace, hostile-only (diff) | |
| download | hl2h-92d388116cc19ef728d66ac67eaa4f584e63d895.tar.gz hl2h-92d388116cc19ef728d66ac67eaa4f584e63d895.zip | |
Silent aim: exact usercmd angle + fire, restore rendered view
- new top-level Silent aim feature (Active + Bind, default Mouse3)
- reuses the shared aim-target selection (bone checklist, nearest selected
point, world-only MASK_VISIBLE vischeck)
- writes the exact target angle into cmd->viewangles, sets IN_ATTACK for the
shot, then immediately restores engine view angles to the player's input
view (g_cam_view) so the camera stays where it was
- shares the vischeck/bone selection with the aimbot; independent of the
aimbot/triggerbot binds
- config [silentaim] active/bind
Diffstat (limited to 'src/menu.cpp')
| -rw-r--r-- | src/menu.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/menu.cpp b/src/menu.cpp index 585695c..11ed222 100644 --- a/src/menu.cpp +++ b/src/menu.cpp | |||
| @@ -62,6 +62,7 @@ static FeatureState g_abh{true, 0}; | |||
| 62 | static FeatureState g_esp{true, 0}; | 62 | static FeatureState g_esp{true, 0}; |
| 63 | static FeatureState g_aimbot{true, 604}; // default Mouse5, rebindable in menu | 63 | static FeatureState g_aimbot{true, 604}; // default Mouse5, rebindable in menu |
| 64 | static FeatureState g_triggerbot{true, 603}; // default Mouse4 | 64 | static FeatureState g_triggerbot{true, 603}; // default Mouse4 |
| 65 | static FeatureState g_silentaim{true, 602}; // default Mouse3 | ||
| 65 | 66 | ||
| 66 | // Aimbot bone checklist. Head defaults on (v1 behaviour). | 67 | // Aimbot bone checklist. Head defaults on (v1 behaviour). |
| 67 | enum { | 68 | enum { |
| @@ -117,6 +118,9 @@ static MenuNode g_aimbot_smooth_node{NODE_VALUE, "Smoothness", false, 0, {}, nul | |||
| 117 | static MenuNode g_triggerbot_feat{NODE_FEATURE, "Triggerbot", false, 1, {}, nullptr, nullptr, nullptr}; | 118 | static MenuNode g_triggerbot_feat{NODE_FEATURE, "Triggerbot", false, 1, {}, nullptr, nullptr, nullptr}; |
| 118 | static MenuNode g_triggerbot_active{NODE_TOGGLE, "Active", false, 0, {}, &g_triggerbot.active, nullptr, nullptr}; | 119 | static MenuNode g_triggerbot_active{NODE_TOGGLE, "Active", false, 0, {}, &g_triggerbot.active, nullptr, nullptr}; |
| 119 | static MenuNode g_triggerbot_bind{NODE_BIND, "Bind", false, 0, {}, nullptr, &g_triggerbot.bind, nullptr}; | 120 | static MenuNode g_triggerbot_bind{NODE_BIND, "Bind", false, 0, {}, nullptr, &g_triggerbot.bind, nullptr}; |
| 121 | static MenuNode g_silentaim_feat{NODE_FEATURE, "Silent aim", false, 1, {}, nullptr, nullptr, nullptr}; | ||
| 122 | static MenuNode g_silentaim_active{NODE_TOGGLE, "Active", false, 0, {}, &g_silentaim.active, nullptr, nullptr}; | ||
| 123 | static MenuNode g_silentaim_bind{NODE_BIND, "Bind", false, 0, {}, nullptr, &g_silentaim.bind, nullptr}; | ||
| 120 | 124 | ||
| 121 | static MenuNode *g_visible[32]; // flattened visible nodes for arrow navigation | 125 | static MenuNode *g_visible[32]; // flattened visible nodes for arrow navigation |
| 122 | static int g_visible_count = 0; | 126 | static int g_visible_count = 0; |
| @@ -142,6 +146,9 @@ static void build_tree() { | |||
| 142 | g_triggerbot_feat.children[0] = &g_triggerbot_active; | 146 | g_triggerbot_feat.children[0] = &g_triggerbot_active; |
| 143 | g_triggerbot_feat.children[1] = &g_triggerbot_bind; | 147 | g_triggerbot_feat.children[1] = &g_triggerbot_bind; |
| 144 | g_triggerbot_feat.child_count = 2; | 148 | g_triggerbot_feat.child_count = 2; |
| 149 | g_silentaim_feat.children[0] = &g_silentaim_active; | ||
| 150 | g_silentaim_feat.children[1] = &g_silentaim_bind; | ||
| 151 | g_silentaim_feat.child_count = 2; | ||
| 145 | for (int i = 0; i < ESP_OPT_COUNT; i++) | 152 | for (int i = 0; i < ESP_OPT_COUNT; i++) |
| 146 | g_esp_feat.children[i + 1] = &g_esp_opt_nodes[i]; | 153 | g_esp_feat.children[i + 1] = &g_esp_opt_nodes[i]; |
| 147 | g_esp_feat.child_count = ESP_OPT_COUNT + 1; | 154 | g_esp_feat.child_count = ESP_OPT_COUNT + 1; |
| @@ -150,7 +157,8 @@ static void build_tree() { | |||
| 150 | g_root.children[2] = &g_esp_feat; | 157 | g_root.children[2] = &g_esp_feat; |
| 151 | g_root.children[3] = &g_aimbot_feat; | 158 | g_root.children[3] = &g_aimbot_feat; |
| 152 | g_root.children[4] = &g_triggerbot_feat; | 159 | g_root.children[4] = &g_triggerbot_feat; |
| 153 | g_root.child_count = 5; | 160 | g_root.children[5] = &g_silentaim_feat; |
| 161 | g_root.child_count = 6; | ||
| 154 | } | 162 | } |
| 155 | 163 | ||
| 156 | static int g_depth[32]; // depth of each visible row (for indentation) | 164 | static int g_depth[32]; // depth of each visible row (for indentation) |
| @@ -224,6 +232,8 @@ static void config_save() { | |||
| 224 | g_aim_bones[AIM_BONE_LLEG], g_aim_bones[AIM_BONE_RLEG]); | 232 | g_aim_bones[AIM_BONE_LLEG], g_aim_bones[AIM_BONE_RLEG]); |
| 225 | fprintf(f, "[triggerbot]\nactive=%d\nbind=%d\n", g_triggerbot.active, | 233 | fprintf(f, "[triggerbot]\nactive=%d\nbind=%d\n", g_triggerbot.active, |
| 226 | g_triggerbot.bind); | 234 | g_triggerbot.bind); |
| 235 | fprintf(f, "[silentaim]\nactive=%d\nbind=%d\n", g_silentaim.active, | ||
| 236 | g_silentaim.bind); | ||
| 227 | fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n" | 237 | fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n" |
| 228 | "healthnum=%d\nname=%d\nskeleton=%d\nbox=%d\n", | 238 | "healthnum=%d\nname=%d\nskeleton=%d\nbox=%d\n", |
| 229 | g_esp.active, g_esp.bind, g_esp_opt[ESP_OPT_SHOW_NEUTRAL], | 239 | g_esp.active, g_esp.bind, g_esp_opt[ESP_OPT_SHOW_NEUTRAL], |
| @@ -253,6 +263,8 @@ static void config_load() { | |||
| 253 | cur = &g_aimbot; | 263 | cur = &g_aimbot; |
| 254 | else if (strstr(line, "[triggerbot]")) | 264 | else if (strstr(line, "[triggerbot]")) |
| 255 | cur = &g_triggerbot; | 265 | cur = &g_triggerbot; |
| 266 | else if (strstr(line, "[silentaim]")) | ||
| 267 | cur = &g_silentaim; | ||
| 256 | else | 268 | else |
| 257 | cur = nullptr; | 269 | cur = nullptr; |
| 258 | in_esp = (cur == &g_esp); | 270 | in_esp = (cur == &g_esp); |
| @@ -413,9 +425,10 @@ static bool key_pressed(int sc) { | |||
| 413 | // feature gate queried from hl2h.cpp do_move(): feature must be Active AND | 425 | // feature gate queried from hl2h.cpp do_move(): feature must be Active AND |
| 414 | // its bind key held (always-on when unbound). | 426 | // its bind key held (always-on when unbound). |
| 415 | bool feature_active(int feature) { | 427 | bool feature_active(int feature) { |
| 416 | static FeatureState *feats[5] = {&g_bhop, &g_abh, &g_esp, &g_aimbot, | 428 | static FeatureState *feats[6] = {&g_bhop, &g_abh, &g_esp, |
| 417 | &g_triggerbot}; | 429 | &g_aimbot, &g_triggerbot, |
| 418 | if (feature < 0 || feature > 4) | 430 | &g_silentaim}; |
| 431 | if (feature < 0 || feature > 5) | ||
| 419 | return false; | 432 | return false; |
| 420 | FeatureState *f = feats[feature]; | 433 | FeatureState *f = feats[feature]; |
| 421 | if (!f->active) | 434 | if (!f->active) |
| @@ -492,7 +505,8 @@ static void menu_handle_input() { | |||
| 492 | MenuNode *n = g_visible[g_selected]; | 505 | MenuNode *n = g_visible[g_selected]; |
| 493 | if (n->bind_ptr) { | 506 | if (n->bind_ptr) { |
| 494 | // clear same bind from other features | 507 | // clear same bind from other features |
| 495 | FeatureState *features[] = {&g_bhop, &g_abh, &g_aimbot, &g_triggerbot}; | 508 | FeatureState *features[] = {&g_bhop, &g_abh, &g_aimbot, &g_triggerbot, |
| 509 | &g_silentaim}; | ||
| 496 | for (auto *f : features) | 510 | for (auto *f : features) |
| 497 | if (&f->bind != n->bind_ptr && f->bind == i) | 511 | if (&f->bind != n->bind_ptr && f->bind == i) |
| 498 | f->bind = 0; | 512 | f->bind = 0; |
| @@ -707,11 +721,11 @@ void outer_draw() { | |||
| 707 | draw_text(270, 10 + i * 20, "[press key]"); | 721 | draw_text(270, 10 + i * 20, "[press key]"); |
| 708 | else { | 722 | else { |
| 709 | /* stable name for current bind */ | 723 | /* stable name for current bind */ |
| 710 | static char bn[4][32]; | 724 | static char bn[5][32]; |
| 711 | static FeatureState *feats[] = {&g_bhop, &g_abh, &g_aimbot, | 725 | static FeatureState *feats[] = {&g_bhop, &g_abh, &g_aimbot, |
| 712 | &g_triggerbot}; | 726 | &g_triggerbot, &g_silentaim}; |
| 713 | int fi = 0; | 727 | int fi = 0; |
| 714 | for (int k = 0; k < 4; k++) | 728 | for (int k = 0; k < 5; k++) |
| 715 | if (n->bind_ptr == &feats[k]->bind) | 729 | if (n->bind_ptr == &feats[k]->bind) |
| 716 | fi = k; | 730 | fi = k; |
| 717 | snprintf(bn[fi], 32, "[%s]", scancode_name(*n->bind_ptr)); | 731 | snprintf(bn[fi], 32, "[%s]", scancode_name(*n->bind_ptr)); |
