summaryrefslogtreecommitdiffstats
path: root/CONTEXT.md
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-05 20:32:59 +0100
committersalmonik <salmonik@tuta.io>2026-11-05 20:32:59 +0100
commit57b53d579f32f094c1cdefad62a6224baf270e0d (patch)
tree67b335b8ac0933078628c0e7b746a4bb253533fd /CONTEXT.md
parentItems: keep health chargers visible, add charger diagnostics (diff)
downloadhl2h-57b53d579f32f094c1cdefad62a6224baf270e0d.tar.gz
hl2h-57b53d579f32f094c1cdefad62a6224baf270e0d.zip
Items: server ammo counts and frag-grenade type
- local_ammo now prefers the authoritative server m_iAmmo array (header skip) and only falls back to the client netvar array. The client offset can be off by an element, which made "full" checks flicker as other ammo was spent. - Frag grenade pickups were falling through to a generic "Ammo" label with ammo_type=-1, so the usable filter never ran. w_grenade/w_frag/ items/grenade/frag_grenade are now "Frag grenade" and map to m_iAmmo[11] (sk_max_grenade, stock 5); AR2/SMG1 grenade variants map to m_iAmmo[8].
Diffstat (limited to '')
-rw-r--r--CONTEXT.md17
1 files changed, 12 insertions, 5 deletions
diff --git a/CONTEXT.md b/CONTEXT.md
index 8ff833c..4508fe6 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -692,11 +692,18 @@ vocabulary / decisions.
692 `CBaseCombatCharacter::m_hMyWeapons[48]` array (client `m_hMyWeapons` and the 692 `CBaseCombatCharacter::m_hMyWeapons[48]` array (client `m_hMyWeapons` and the
693 remembered active weapon are fallbacks). NPC-held weapons are ignored. 693 remembered active weapon are fallbacks). NPC-held weapons are ignored.
694 Weapons the player does not own stay under the Weapons category. 694 Weapons the player does not own stay under the Weapons category.
695- Ammo pickups also honour "Only if usable": the reserve count from 695- Ammo pickups also honour "Only if usable": the reserve count from the
696 `m_iAmmo[type]` (client array when resolved, otherwise the server 696 authoritative server `CBaseCombatCharacter::m_iAmmo` array is compared with
697 `CBaseCombatCharacter::m_iAmmo` array) is compared with the `sk_max_*` cvar 697 the `sk_max_*` cvar (stock caps as fallback, e.g. RPG rockets = 3); the
698 (stock caps as fallback, e.g. RPG rockets = 3). Full ammo hides the pickup; 698 client array is only a fallback. Full ammo hides the pickup; if either value
699 if either value cannot be read the item stays visible. 699 cannot be read the item stays visible. Preferring the server array fixed
700 "full" counts flickering as other ammo was spent — the client `m_iAmmo`
701 netvar offset can be off by an element.
702- Frag grenade pickups were falling through to a generic "Ammo" label with
703 `ammo_type = -1`, so the usable filter never applied and they always showed.
704 `models/weapons/w_grenade`, `w_frag`, `items/grenade` and `frag_grenade` are
705 now labelled "Frag grenade" and mapped to `m_iAmmo[11]` (`sk_max_grenade`,
706 stock 5). AR2/SMG1 grenade variants map to `m_iAmmo[8]` (stock 3).
700- The datamap offset for `m_iAmmo`/`m_hMyWeapons` points at the 707- The datamap offset for `m_iAmmo`/`m_hMyWeapons` points at the
701 `CNetworkArray` length header; the actual elements start **4 bytes later**. 708 `CNetworkArray` length header; the actual elements start **4 bytes later**.
702 Reading at the raw offset shifted every count by one type (e.g. RPG read the 709 Reading at the raw offset shifted every count by one type (e.g. RPG read the