summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/esp.cpp')
-rw-r--r--src/esp.cpp46
1 files changed, 39 insertions, 7 deletions
diff --git a/src/esp.cpp b/src/esp.cpp
index bda6232..ca7bae0 100644
--- a/src/esp.cpp
+++ b/src/esp.cpp
@@ -2,6 +2,7 @@
2#include "hl2h.h" 2#include "hl2h.h"
3#include <cmath> 3#include <cmath>
4#include <cstring> 4#include <cstring>
5#include <strings.h>
5#include <cstddef> 6#include <cstddef>
6#include <cstdlib> 7#include <cstdlib>
7#include <ctime> 8#include <ctime>
@@ -1131,18 +1132,49 @@ static void spread_compute() {
1131 g_spread_ready = true; 1132 g_spread_ready = true;
1132} 1133}
1133 1134
1135static bool icontains(const char *hay, const char *needle) {
1136 if (!hay || !needle || !*needle)
1137 return false;
1138 size_t n = strlen(needle);
1139 for (const char *p = hay; *p; p++)
1140 if (strncasecmp(p, needle, n) == 0)
1141 return true;
1142 return false;
1143}
1144
1134bool entity_is_physics_prop(int idx) { 1145bool entity_is_physics_prop(int idx) {
1135 if (idx <= 0 || idx > 4096) 1146 if (idx <= 0 || idx > 4096)
1136 return false; 1147 return false;
1148 void *ent = entitylist_get(idx);
1149 if (!ent)
1150 return false;
1151 int mt = -1;
1152 // The reliable signal: physics objects use MOVETYPE_VPHYSICS. The client
1153 // class is CPhysicsProp / CPhysBox, not the server's prop_physics name.
1154 if (g_net.movetype >= 0) {
1155 mt = *(int *)((uintptr_t)ent + g_net.movetype);
1156 if (mt == MOVETYPE_VPHYSICS)
1157 return true;
1158 }
1137 void *net = entity_networkable(idx); 1159 void *net = entity_networkable(idx);
1138 const char *cls = net ? entity_class_name(net, nullptr) : nullptr; 1160 const char *cls = net ? entity_class_name(net, nullptr) : nullptr;
1139 void *ent = entitylist_get(idx); 1161 const char *model = entity_model_name(ent);
1140 const char *model = ent ? entity_model_name(ent) : nullptr; 1162 bool is_prop = icontains(cls, "physicsprop") || icontains(cls, "physbox") ||
1141 if (cls && (strstr(cls, "prop_physics") || strstr(cls, "physbox"))) 1163 icontains(cls, "prop_physics") ||
1142 return true; 1164 icontains(model, "props_junk") ||
1143 if (model && (strstr(model, "props_junk") || strstr(model, "props_physics"))) 1165 icontains(model, "props_physics") ||
1144 return true; 1166 icontains(model, "props_c17") ||
1145 return false; 1167 icontains(model, "props_interiors") ||
1168 icontains(model, "props_lab");
1169 if (!is_prop) {
1170 static int miss_logs = 0;
1171 if (miss_logs < 6) {
1172 miss_logs++;
1173 logf("stucklaunch prop? idx=%d movetype=%d cls=%s model=%s", idx, mt,
1174 cls ? cls : "?", model ? model : "?");
1175 }
1176 }
1177 return is_prop;
1146} 1178}
1147 1179
1148bool active_weapon_is_gravity_gun(void *local_ent) { 1180bool active_weapon_is_gravity_gun(void *local_ent) {