#95: REVERT the salvo-damage hack; deliver the cluster the way the binary does

Supersedes the mislanch change in efc3e9f, which multiplied the lead round by
missileCount.  That produced roughly the right average total but as ONE lump on
ONE zone, with no scatter and no variance -- not what the arcade does.

WHAT THE BINARY DOES (all byte-verified):
  * MissileLauncher ctor @004bcff0:  burstCount = missileCount;
                                     damageAmount /= missileCount
  * FireWeapon @004bcc60 spawns exactly ONE Missile -- no loop, missileCount is
    never read there.  The salvo IS one cluster round.
  * Missile::Perform rolls how many of the cluster connect right before it
    dispatches (part_013.c:10082):  b = Random(n) + n/4, clamped to n
    -- i.e. between a quarter of the salvo and all of it.
  * It then dispatches DIRECTLY at the struck entity (FUN_004be078:
    param_2->Dispatch(&msg)) -- NOT through the shooter's message manager.
  * Mech::TakeDamageMessageHandler @0x4a0439-0x4a04d8 applies the hit
    burstCount times, RE-ROLLING the struck zone per burst.

Our handler already implements that loop faithfully (mech.cpp, task #80) -- I
wrongly believed it was missing, because the KB asserts as [T1] that "burstCount
is cosmetic for zone damage".  That is half right: DamageZone::TakeDamage really
does ignore burstCount (verified @0041e4e0), but the HANDLER honours it by
calling that function repeatedly.  KB corrected separately.

The actual defect was that the projectile impact path hardcoded burstCount = 1,
and -- worse -- routed damage through the SubsystemMessageManager, whose
consolidation rebuilds the record from a stream carrying only {damageType,
damageAmount, subsystemID}.  DamageInformation has no burstCount field, so the
cluster count was DROPPED in transit no matter what the round carried.

So: dispatch projectile damage directly, as the binary does, carrying the rolled
burst.  This also retires the #84 double explosion architecturally -- the second
blast came from the manager's bundled explosion, and projectiles no longer go
through the manager at all.  The MarkRoundDetonated suppression added in efc3e9f
is therefore dead and is removed.

ALL-WEAPON-CLASS AUDIT (scratchpad/night8/allweap.{sh,py}), one run, all classes
firing at once:
  EXPLOSIVE (missile)  38 zone applications, bursts spread 1x2,2x6,3x9,4x4,5x5,
                       6x12 across ELEVEN zones -- the [n/4..n] roll plus the
                       per-burst zone re-roll, i.e. the cluster scattering
  ENERGY    (beam)      8 applications, burst 1  -- unchanged, no regression
  type4                 8 applications, burst 1  -- unchanged
  COLLISION             0 applications reached armour -- divert intact
Explosions: 10 projectile impacts produce no bundled blast; direct-fire still
queues its own (11 made).

NOT yet verified: cross-pod delivery.  Dispatch reroutes to a replicant on its
own (and the binary relies on exactly that), but the manager routing is gone, so
MP damage should get a two-node run before this ships.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joe DiPrima
2026-08-01 04:42:15 -05:00
co-authored by Claude Opus 5
parent efc3e9ff1a
commit 3b7c19c232
6 changed files with 144 additions and 119 deletions
+9 -14
View File
@@ -334,21 +334,16 @@ void MissileLauncher::FireWeapon()
// carries the missile's damageAmount + the cluster splash; the rest are
// VISUAL (damage 0) -- the ripple of tracers, no extra damage.
//
// ...but it must carry the WHOLE SALVO's damage (issue #95). The ctor
// above does what the binary's MissileLauncher ctor does:
// damageData.burstCount = missileCount; // @0x3d4
// damageData.damageAmount /= missileCount; // @0x3ac
// i.e. the record holds PER-MISSILE amount plus the count, and the arcade
// reconstitutes the total as amount x burstCount when it applies the hit.
// Our application (DamageZone::TakeDamage) applies `amount * scale` ONCE
// and drops burstCount -- so handing the lead round the already-divided
// amount delivered amount/missileCount, i.e. 1/N of the authored salvo.
// Two individually-correct changes composed into a silent N-fold shortfall:
// players measured an LRM 15 landing ~3 points instead of 50.
// Multiply the count back in here, where the port collapses the cluster to
// one damaging round, so the salvo delivers exactly its authored total.
// The lead round carries the PER-MISSILE amount, exactly as the binary's
// ctor prepared it (damageAmount /= missileCount, burstCount = missileCount).
// The salvo total is reconstituted at IMPACT, where the round hands the
// handler a burstCount and the handler applies the hit that many times
// (Mech::TakeDamageMessageHandler @0x4a0423-0x4a04d8, mech.cpp) -- see the
// cluster-burst note at the impact site in mech4.cpp. Do NOT pre-multiply
// here: that would deliver the salvo as one lump on one zone, losing both
// the per-burst zone re-roll and the arcade's hit-count variance.
BTPushProjectile(muzzle, o, target, targetPos, speed,
(i == 0) ? damageData.damageAmount * (Scalar)nmiss : 0.0f,
(i == 0) ? damageData.damageAmount : 0.0f,
&launchVelocity, 1,
subsystemID /*messmgr explosion bundling at impact (task #7)*/,
(i == 0) ? nmiss : 0 /*salvo-lead: cluster splash baseBurst*/,