diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 16:11:28 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 16:11:28 +0100 |
| commit | 4019880cf113a2a13460ec8ea5bb30a5c8ed50f3 (patch) | |
| tree | 5c13148671afd7d294273cff431c0ef373d862a3 /src/netvars.cpp | |
| parent | Clip transition and radius lines at the near plane (diff) | |
| download | hl2h-4019880cf113a2a13460ec8ea5bb30a5c8ed50f3.tar.gz hl2h-4019880cf113a2a13460ec8ea5bb30a5c8ed50f3.zip | |
Items: hide full ammo pickups; robust close-target projection
- Resolve m_iAmmo and m_hMyWeapons arrays from the client recv tables.
- "Only if usable" now compares m_iAmmo[type] against sk_max_* (stock caps as
fallback: RPG rockets 3, AR2 60, ...). Full ammo hides the pickup, including
RPG rockets and fallen weapons converted to ammo.
- Inventory now comes from m_hMyWeapons directly, so fallen weapons are ammo
before the player equips the matching weapon.
- Projection: fall back to local math when ScreenPosition claims "behind" for
a point with positive view depth, and build NPC boxes from vertical samples
so feet behind the near plane no longer drop the whole target. Log the first
8 near-target projection failures for diagnosis.
Diffstat (limited to '')
| -rw-r--r-- | src/netvars.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/netvars.cpp b/src/netvars.cpp index ef564cd..2747c29 100644 --- a/src/netvars.cpp +++ b/src/netvars.cpp | |||
| @@ -112,6 +112,15 @@ static void collect_netvars(uintptr_t table, uintptr_t base_off, int depth) { | |||
| 112 | int off = (int)(base_off + (uint32_t)poff); | 112 | int off = (int)(base_off + (uint32_t)poff); |
| 113 | if (off >= 0x20 && off <= 0x2000) | 113 | if (off >= 0x20 && off <= 0x2000) |
| 114 | g_net.dmg_radius = off; | 114 | g_net.dmg_radius = off; |
| 115 | } else if (strcmp(pname2, "m_hMyWeapons") == 0 && | ||
| 116 | g_net.my_weapons < 0) { | ||
| 117 | int off = (int)(base_off + (uint32_t)poff); | ||
| 118 | if (off >= 0x20 && off <= 0x2000) | ||
| 119 | g_net.my_weapons = off; | ||
| 120 | } else if (strcmp(pname2, "m_iAmmo") == 0 && g_net.ammo < 0) { | ||
| 121 | int off = (int)(base_off + (uint32_t)poff); | ||
| 122 | if (off >= 0x20 && off <= 0x2000) | ||
| 123 | g_net.ammo = off; | ||
| 115 | } else if (strcmp(pname2, "m_iTeamNum") == 0 && g_net.teamnum < 0) { | 124 | } else if (strcmp(pname2, "m_iTeamNum") == 0 && g_net.teamnum < 0) { |
| 116 | g_net.teamnum = (int)(base_off + (uint32_t)poff); | 125 | g_net.teamnum = (int)(base_off + (uint32_t)poff); |
| 117 | } else if (strcmp(pname2, "m_vecOrigin") == 0 && g_net.origin < 0) { | 126 | } else if (strcmp(pname2, "m_vecOrigin") == 0 && g_net.origin < 0) { |
| @@ -294,11 +303,11 @@ void resolve_netvars() { | |||
| 294 | "teamnum=%d origin=%d viewoffset=%d mins=%d maxs=%d lifeste=%d " | 303 | "teamnum=%d origin=%d viewoffset=%d mins=%d maxs=%d lifeste=%d " |
| 295 | "modelindex=%d absvelocity=%d activeweapon=%d owner=%d " | 304 | "modelindex=%d absvelocity=%d activeweapon=%d owner=%d " |
| 296 | "weapon_owner=%d clr_render=%d punch=%d default_fov=%d " | 305 | "weapon_owner=%d clr_render=%d punch=%d default_fov=%d " |
| 297 | "dmg_radius=%d", | 306 | "dmg_radius=%d my_weapons=%d ammo=%d", |
| 298 | g_net.flags, g_net.velocity, g_net.movetype, g_net.health, | 307 | g_net.flags, g_net.velocity, g_net.movetype, g_net.health, |
| 299 | g_net.maxhealth, g_net.teamnum, g_net.origin, g_net.viewoffset, | 308 | g_net.maxhealth, g_net.teamnum, g_net.origin, g_net.viewoffset, |
| 300 | g_net.mins, g_net.maxs, g_net.lifestate, g_net.modelindex, | 309 | g_net.mins, g_net.maxs, g_net.lifestate, g_net.modelindex, |
| 301 | g_net.absvelocity, g_net.activeweapon, g_net.owner, | 310 | g_net.absvelocity, g_net.activeweapon, g_net.owner, |
| 302 | g_net.weapon_owner, g_net.clr_render, g_net.punch, | 311 | g_net.weapon_owner, g_net.clr_render, g_net.punch, |
| 303 | g_net.default_fov, g_net.dmg_radius); | 312 | g_net.default_fov, g_net.dmg_radius, g_net.my_weapons, g_net.ammo); |
| 304 | } | 313 | } |
