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. --- CONTEXT.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'CONTEXT.md') diff --git a/CONTEXT.md b/CONTEXT.md index acdab2f..839d340 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -232,7 +232,11 @@ vocabulary / decisions. (>1e7). A point on the view axis (e.g. directly below the player's feet) can make `IVDebugOverlay::ScreenPosition` return NaN/huge values; casting those to int corrupted the ISurface clip state and made the whole overlay - disappear for that frame. + disappear for that frame. If the overlay reports "behind" for a point whose + view-space depth is actually positive, a local projection is used instead. +- NPC boxes are built from several vertical samples, so a target whose feet + are behind the near plane (standing over it) still gets a box from the + visible span instead of being dropped. - Projectile radius rings are drawn independently of the centre marker, so a grenade behind the camera/off-screen still shows its blast circle when any part of the ring projects. @@ -606,10 +610,14 @@ vocabulary / decisions. - A world weapon whose type is already in the local player's inventory is reclassified as ammo (`SMG ammo`, `AR2 ammo`, ...). Owner handles are unreliable on this client (`m_hOwnerEntity`/`m_hOwner` resolve to -1), so - the inventory mask is accumulated from every weapon type the player has - held (client `m_hActiveWeapon`, with the server handle as fallback) since - the current local entity appeared. NPC-held weapons are therefore ignored. - Weapons the player does not own stay under the Weapons category. + the inventory is read directly from the local `m_hMyWeapons[48]` handle + array (and remembered active types as a fallback). NPC-held weapons are + therefore ignored. Weapons the player does not own stay under the Weapons + category. +- Ammo pickups also honour "Only if usable": the reserve count from + `m_iAmmo[type]` is compared with the `sk_max_*` cvar (stock caps as fallback, + e.g. RPG rockets = 3). Full ammo hides the pickup; if either value cannot + be read the item stays visible. - Scans the client entity list every 100 ms and tags health, ammo, armor/suit, world weapon pickups, the two supply-crate models and generic items. - Each tag is a colored marker with a name and optional distance, filtered by -- cgit v1.2.3