summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/esp.cpp')
-rw-r--r--src/esp.cpp41
1 files changed, 10 insertions, 31 deletions
diff --git a/src/esp.cpp b/src/esp.cpp
index a12cf9c..b50dd87 100644
--- a/src/esp.cpp
+++ b/src/esp.cpp
@@ -163,6 +163,16 @@ static bool is_npc_class(const char *name) {
163 strstr(name, "BaseHelicopter") != nullptr; 163 strstr(name, "BaseHelicopter") != nullptr;
164} 164}
165 165
166// Used by the chams hook to decide whether a model-render entity is an NPC.
167bool esp_is_npc_index(int idx) {
168 if (!g_iface.entitylist || idx <= 0 || idx > 8192)
169 return false;
170 void *net = entity_networkable(idx);
171 if (!net)
172 return false;
173 return is_npc_class(entity_class_name(net, nullptr));
174}
175
166static bool model_is_friendly(const char *m) { 176static bool model_is_friendly(const char *m) {
167 static const char *patterns[] = { 177 static const char *patterns[] = {
168 "citizen", "humans/", "male_", "female_", "barney", "alyx", 178 "citizen", "humans/", "male_", "female_", "barney", "alyx",
@@ -2796,23 +2806,6 @@ void esp_draw_items() {
2796 if (g_item_usable) 2806 if (g_item_usable)
2797 local_vitals(vit_hp, vit_max, vit_armor); 2807 local_vitals(vit_hp, vit_max, vit_armor);
2798 2808
2799 static bool ammo_logged = false;
2800 if (!ammo_logged) {
2801 ammo_logged = true;
2802 void *le = entitylist_get(local);
2803 char buf[512] = {};
2804 int used = 0;
2805 for (int t = 0; t < 12 && used < (int)sizeof(buf) - 24; t++) {
2806 int w = snprintf(buf + used, sizeof(buf) - (size_t)used, "%d=%d/%d ", t,
2807 local_ammo(le, t), ammo_max(t));
2808 if (w < 0)
2809 break;
2810 used += w;
2811 }
2812 logf("items: ammo current/max %s(usable=%d my_weapons=%d ammo=%d)", buf,
2813 (int)g_item_usable, g_net.my_weapons, g_net.ammo);
2814 }
2815
2816 for (int i = 0; i < g_nitems; i++) { 2809 for (int i = 0; i < g_nitems; i++) {
2817 const ItemTarget &t = g_item_targets[i]; 2810 const ItemTarget &t = g_item_targets[i];
2818 if (!item_kind_enabled(t.kind)) 2811 if (!item_kind_enabled(t.kind))
@@ -2830,12 +2823,6 @@ void esp_draw_items() {
2830 if (t.kind == IK_AMMO && t.ammo_type >= 0) { 2823 if (t.kind == IK_AMMO && t.ammo_type >= 0) {
2831 int maxa = ammo_max(t.ammo_type); 2824 int maxa = ammo_max(t.ammo_type);
2832 int cura = local_ammo(entitylist_get(local), t.ammo_type); 2825 int cura = local_ammo(entitylist_get(local), t.ammo_type);
2833 static int flt_logs = 0;
2834 if (flt_logs < 24) {
2835 flt_logs++;
2836 logf("items: ammo %s type=%d cur=%d max=%d", t.label, t.ammo_type,
2837 cura, maxa);
2838 }
2839 if (maxa > 0 && cura >= 0 && cura >= maxa) 2826 if (maxa > 0 && cura >= 0 && cura >= maxa)
2840 continue; 2827 continue;
2841 } 2828 }
@@ -3021,14 +3008,6 @@ static void projs_collect(int local_idx) {
3021 p.fuse = -1.0f; 3008 p.fuse = -1.0f;
3022 } 3009 }
3023 } 3010 }
3024 static int logs = 0;
3025 if (logs < 8) {
3026 logs++;
3027 logf("projectile: idx=%d cls=%s model=%s kind=%s det=%.2f cur=%.2f "
3028 "fuse=%.2f radius=%.0f",
3029 idx, cls ? cls : "?", model, proj_name(kind), det, curtime, p.fuse,
3030 p.radius);
3031 }
3032 } 3011 }
3033} 3012}
3034 3013