summaryrefslogtreecommitdiffstats
path: root/src/hl2h.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-26 15:33:02 +0100
committersalmonik <salmonik@tuta.io>2026-10-26 15:33:02 +0100
commitd7edcc9d9e3d90e1c53885870461e046389dee96 (patch)
treed4e80c026f65cbff9804c80184293d0c1b63afa8 /src/hl2h.cpp
parentDefault map d1_town_01 (intro-less, enemies spawned) (diff)
downloadhl2h-d7edcc9d9e3d90e1c53885870461e046389dee96.tar.gz
hl2h-d7edcc9d9e3d90e1c53885870461e046389dee96.zip
ESP working: NPC detection + authoritative server-side health
- entitylist slot 6 (GetHighestEntityIndex); class name via GetClientNetworkable -> GetClientClass (replaces the unsafe slot-2 call) - HL2 SP NPCs: class CAI_BaseNPC + m_lifeState, since NPC m_iHealth is not networked; model names from VModelInfoClient006 for labels/friend-foe - real HP/HP-max from the listen-server entity (IVEngineServer021 -> PEntityOfEntIndex -> edict->m_pUnk -> GetBaseEntity) using offsets scanned from server.so's datamap; validated against the client model index - world_to_screen via IVDebugOverlay003::ScreenPosition (fixes box drift) - maxs sanity clamp, NPC-only debug logging, neutral colour for wildlife - build.sh: restore -o libhl2hake.so and add server.cpp
Diffstat (limited to '')
-rw-r--r--src/hl2h.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/hl2h.cpp b/src/hl2h.cpp
index 01fdb0f..a451a18 100644
--- a/src/hl2h.cpp
+++ b/src/hl2h.cpp
@@ -29,7 +29,7 @@ void logf(const char *fmt, ...) {
29// globals 29// globals
30// --------------------------------------------------------------------------- 30// ---------------------------------------------------------------------------
31 31
32Module g_client, g_engine; 32Module g_client, g_engine, g_server;
33GameInterfaces g_iface; 33GameInterfaces g_iface;
34NetVars g_net; 34NetVars g_net;
35Vector g_cam_eye{0, 0, 0}; 35Vector g_cam_eye{0, 0, 0};
@@ -335,6 +335,13 @@ static void *setup_thread(void *) {
335 "VEngineClient014=%p", 335 "VEngineClient014=%p",
336 g_iface.client, g_iface.entitylist, g_iface.engine); 336 g_iface.client, g_iface.entitylist, g_iface.engine);
337 337
338 g_iface.modelinfo = ef("VModelInfoClient006", nullptr);
339 g_iface.engineserver = ef("VEngineServer021", nullptr);
340 g_iface.debugoverlay = ef("VDebugOverlay003", nullptr);
341 logf("modelinfo: %p (VModelInfoClient006)", g_iface.modelinfo);
342 logf("engineserver: %p (VEngineServer021), debugoverlay: %p",
343 g_iface.engineserver, g_iface.debugoverlay);
344
338 resolve_netvars(); 345 resolve_netvars();
339 if (!find_input_global()) 346 if (!find_input_global())
340 return nullptr; 347 return nullptr;