diff options
Diffstat (limited to '')
| -rw-r--r-- | src/esp.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/esp.cpp b/src/esp.cpp index 0117d27..ae08258 100644 --- a/src/esp.cpp +++ b/src/esp.cpp | |||
| @@ -1057,6 +1057,7 @@ static bool g_spread_ready = false; | |||
| 1057 | static int g_spread_seed1 = 0; | 1057 | static int g_spread_seed1 = 0; |
| 1058 | static int g_spread_seed8 = 0; // first pellet exact, 7 spread | 1058 | static int g_spread_seed8 = 0; // first pellet exact, 7 spread |
| 1059 | static int g_spread_seed12 = 0; // all 12 spread | 1059 | static int g_spread_seed12 = 0; // all 12 spread |
| 1060 | int g_spread_pellets = 1; | ||
| 1060 | 1061 | ||
| 1061 | static void spread_compute() { | 1062 | static void spread_compute() { |
| 1062 | using SeedFn = void (*)(int); | 1063 | using SeedFn = void (*)(int); |
| @@ -1163,9 +1164,11 @@ bool spread_control_apply(CUserCmd *cmd, void *local_ent) { | |||
| 1163 | return false; | 1164 | return false; |
| 1164 | 1165 | ||
| 1165 | bool shotgun = active_weapon_is_shotgun(local_ent); | 1166 | bool shotgun = active_weapon_is_shotgun(local_ent); |
| 1166 | int seed = g_spread_seed1; | 1167 | int pellets = 1; |
| 1167 | if (shotgun) | 1168 | if (shotgun) |
| 1168 | seed = (cmd->buttons & IN_ATTACK2) ? g_spread_seed12 : g_spread_seed8; | 1169 | pellets = (cmd->buttons & IN_ATTACK2) ? 12 : 8; |
| 1170 | g_spread_pellets = pellets; | ||
| 1171 | int seed = spread_best_seed(pellets); | ||
| 1169 | if (cmd->random_seed == seed) | 1172 | if (cmd->random_seed == seed) |
| 1170 | return false; | 1173 | return false; |
| 1171 | cmd->random_seed = seed; | 1174 | cmd->random_seed = seed; |
| @@ -1173,11 +1176,21 @@ bool spread_control_apply(CUserCmd *cmd, void *local_ent) { | |||
| 1173 | static int logs = 0; | 1176 | static int logs = 0; |
| 1174 | if (logs < 10) { | 1177 | if (logs < 10) { |
| 1175 | logs++; | 1178 | logs++; |
| 1176 | logf("spread: seed=%d (%s)", seed, shotgun ? "shotgun" : "single"); | 1179 | logf("spread: seed=%d pellets=%d", seed, pellets); |
| 1177 | } | 1180 | } |
| 1178 | return true; | 1181 | return true; |
| 1179 | } | 1182 | } |
| 1180 | 1183 | ||
| 1184 | int spread_best_seed(int pellets) { | ||
| 1185 | if (!g_spread_ready) | ||
| 1186 | return 33; | ||
| 1187 | if (pellets >= 12) | ||
| 1188 | return g_spread_seed12; | ||
| 1189 | if (pellets >= 8) | ||
| 1190 | return g_spread_seed8; | ||
| 1191 | return g_spread_seed1; | ||
| 1192 | } | ||
| 1193 | |||
| 1181 | bool triggerbot_apply(CUserCmd *cmd) { | 1194 | bool triggerbot_apply(CUserCmd *cmd) { |
| 1182 | if (!g_iface.enginetrace || !g_iface.entitylist) | 1195 | if (!g_iface.enginetrace || !g_iface.entitylist) |
| 1183 | return false; | 1196 | return false; |
