From 4019880cf113a2a13460ec8ea5bb30a5c8ed50f3 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 16:11:28 +0100 Subject: 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. --- src/netvars.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/netvars.cpp') 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) { int off = (int)(base_off + (uint32_t)poff); if (off >= 0x20 && off <= 0x2000) g_net.dmg_radius = off; + } else if (strcmp(pname2, "m_hMyWeapons") == 0 && + g_net.my_weapons < 0) { + int off = (int)(base_off + (uint32_t)poff); + if (off >= 0x20 && off <= 0x2000) + g_net.my_weapons = off; + } else if (strcmp(pname2, "m_iAmmo") == 0 && g_net.ammo < 0) { + int off = (int)(base_off + (uint32_t)poff); + if (off >= 0x20 && off <= 0x2000) + g_net.ammo = off; } else if (strcmp(pname2, "m_iTeamNum") == 0 && g_net.teamnum < 0) { g_net.teamnum = (int)(base_off + (uint32_t)poff); } else if (strcmp(pname2, "m_vecOrigin") == 0 && g_net.origin < 0) { @@ -294,11 +303,11 @@ void resolve_netvars() { "teamnum=%d origin=%d viewoffset=%d mins=%d maxs=%d lifeste=%d " "modelindex=%d absvelocity=%d activeweapon=%d owner=%d " "weapon_owner=%d clr_render=%d punch=%d default_fov=%d " - "dmg_radius=%d", + "dmg_radius=%d my_weapons=%d ammo=%d", g_net.flags, g_net.velocity, g_net.movetype, g_net.health, g_net.maxhealth, g_net.teamnum, g_net.origin, g_net.viewoffset, g_net.mins, g_net.maxs, g_net.lifestate, g_net.modelindex, g_net.absvelocity, g_net.activeweapon, g_net.owner, g_net.weapon_owner, g_net.clr_render, g_net.punch, - g_net.default_fov, g_net.dmg_radius); + g_net.default_fov, g_net.dmg_radius, g_net.my_weapons, g_net.ammo); } -- cgit v1.2.3