diff --git a/CLAUDE.md b/CLAUDE.md index aba39787..af664e3f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1317,6 +1317,28 @@ tuple meanings, runtime offsets, legacy J&J formats, or BMP comparison rules fro intact/damaged states on physical MFD and Radar displays. Linux validation proves source/data equality and image alignment, not runtime hardware behavior. +## ✅ STEP 14: High Explosive MechLab firing repaired (2026-08-08) + +High Explosives (weapon ID 87) could be installed in MechLab but never fired. They are ordinary +one-shot weapons activated through their assigned weapon group (group 3 by default), **not** by +ejecting. Put multiple charges in the same group and use Group Fire to detonate all of them in one +trigger cycle; Chain Fire activates only one at a time. Each fired charge independently creates a +100-damage blast in a 30 m radius and applies 200 center-torso damage to its own mech. + +Three legacy defects made the feature unusable: +- `HighExplosive.data` used the unregistered key `MaxAmmoCount=1`; the weapon model registers + `MaxAmmo`, so the charge had no valid conventional ammo capacity. +- MechLab computes initial ammo as `MaxAmmo / (3 * TotalSlotsTaken)`. Even with the corrected key, + `1 / (3 * 2)` truncated to zero. `Weapon.cpp` now clamps starting ammo and ammo-per-pack to one + only when the weapon declares a positive maximum; zero-capacity weapons remain unchanged. +- `MechBay/weapons.script` applied High Explosive UI handling to stale ID 84 (NARC) instead of 87. + +Linux validation confirmed High Explosive now constructs with one round, zero-capacity weapons +still produce zero ammo packs, edited files retain their original CRLF/legacy encodings, and the +focused diagnostics/diff checks are clean. Still required: rebuild `MW4.exe` on the Windows VC6 +machine, repack `props.mw4`, deploy both, then remove/reinstall the charge in existing saved variants +that may retain serialized zero ammo. + ## Next steps (proposed) - [ ] (Parked, diagnostics-only, cannot affect a real pod) Two gaps found while testing `-tident` on a **single-monitor VM** (2026-08-05). Both only occur when one physical monitor is exposed as diff --git a/Gameleap/code/mw4/Code/MW4/Weapon.cpp b/Gameleap/code/mw4/Code/MW4/Weapon.cpp index b8a9f070..5a0aec05 100644 --- a/Gameleap/code/mw4/Code/MW4/Weapon.cpp +++ b/Gameleap/code/mw4/Code/MW4/Weapon.cpp @@ -906,8 +906,10 @@ void if(model->maxAmmoCount > 0) { Verify(model->totalSlotsTaken != 0); - create_message->ammoCount = model->maxAmmoCount / (3 * model->totalSlotsTaken); - create_message->initialAmmoCount = model->maxAmmoCount / (3 * model->totalSlotsTaken); + int ammo_count = model->maxAmmoCount / (3 * model->totalSlotsTaken); + Min_Clamp(ammo_count, 1); + create_message->ammoCount = ammo_count; + create_message->initialAmmoCount = ammo_count; } else { @@ -1064,7 +1066,8 @@ int Verify(model->totalSlotsTaken != 0); int value = model->maxAmmoCount / (3 * model->totalSlotsTaken); - Min_Clamp(value, 0); + if(model->maxAmmoCount > 0) + Min_Clamp(value, 1); return value; } diff --git a/Gameleap/mw4/Content/ShellScripts/MechBay/weapons.script b/Gameleap/mw4/Content/ShellScripts/MechBay/weapons.script index 018fb6a2..1475eb81 100644 --- a/Gameleap/mw4/Content/ShellScripts/MechBay/weapons.script +++ b/Gameleap/mw4/Content/ShellScripts/MechBay/weapons.script @@ -1701,7 +1701,7 @@ s_weapon_slot render_posy += getheight(slots[k].weapon_pic) - if slot_value[k] == 84 + if slot_value[k] == 87 { slots[k].highexplosive = true } diff --git a/Gameleap/mw4/Content/WeaponSubsystems/HighExplosiveWeaponSubsystem/HighExplosive.data b/Gameleap/mw4/Content/WeaponSubsystems/HighExplosiveWeaponSubsystem/HighExplosive.data index 6f604ba1..4d9d6746 100644 --- a/Gameleap/mw4/Content/WeaponSubsystems/HighExplosiveWeaponSubsystem/HighExplosive.data +++ b/Gameleap/mw4/Content/WeaponSubsystems/HighExplosiveWeaponSubsystem/HighExplosive.data @@ -12,7 +12,7 @@ DamageAmount=100 Tonage=2.0 NumFire=1.0 fireRate=0.15 -MaxAmmoCount=1 +MaxAmmo=1 InitialLinearVelocity=0.0 0.0 0.0 InitialLinearAcceleration=0.0 0.0 0.0 SplashRadius=30.0