BT411 task-#62 truth: the arcade fires ONE cluster Missile per salvo and its zone damage lands EXACTLY ONCE (burstCount feeds only the gyro bounce + splash falloff, never the zone armor formula). The 5.3.16 per-missile delivery loop was ~6x too lethal. MISLANCH now sends a single salvo-split damage message (verified 1:1 FIRED-to-damage in the mutual fight; zero exceptions). The cluster splash joins the Missile entity wave. Also: BT_FORCE_ZONE=n dev hook (pin every hit -- the cascade verification knob) landed with 5.3.17's runs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
159 lines
4.5 KiB
C++
159 lines
4.5 KiB
C++
//===========================================================================//
|
|
// File: mislanch.cpp //
|
|
// Project: BattleTech Brick: Mech weapons //
|
|
// Contents: MissileLauncher -- a projectile weapon that fires missile salvos //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#include <bt.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(MISLANCH_HPP)
|
|
# include <mislanch.hpp>
|
|
#endif
|
|
|
|
#if !defined(MECH_HPP)
|
|
# include <mech.hpp>
|
|
#endif
|
|
|
|
Derivation
|
|
MissileLauncher::ClassDerivations(
|
|
ProjectileWeapon::ClassDerivations,
|
|
"MissileLauncher"
|
|
);
|
|
|
|
MissileLauncher::SharedData
|
|
MissileLauncher::DefaultData(
|
|
MissileLauncher::ClassDerivations,
|
|
Subsystem::MessageHandlers,
|
|
Subsystem::AttributeIndex,
|
|
Subsystem::StateCount
|
|
);
|
|
|
|
MissileLauncher::MissileLauncher(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &default_data
|
|
):
|
|
ProjectileWeapon(owner, subsystem_ID, subsystem_resource, default_data)
|
|
{
|
|
Check(owner);
|
|
Check_Pointer(subsystem_resource);
|
|
|
|
missileCount = subsystem_resource->missileCount;
|
|
|
|
//
|
|
// A salvo delivers missileCount missiles; split the per-shot damage across
|
|
// the salvo. (The per-missile launch mechanics live in FireWeapon, staged.)
|
|
//
|
|
if (missileCount > 0)
|
|
{
|
|
damageData.burstCount = missileCount;
|
|
damageData.damageAmount = damageData.damageAmount / (Scalar)missileCount;
|
|
}
|
|
|
|
Check_Fpu();
|
|
}
|
|
|
|
MissileLauncher::~MissileLauncher()
|
|
{
|
|
}
|
|
|
|
Logical
|
|
MissileLauncher::TestInstance() const
|
|
{
|
|
return IsDerivedFrom(ClassDerivations);
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// Damage / death.
|
|
//#############################################################################
|
|
//
|
|
void
|
|
MissileLauncher::TakeDamage(Damage &damage)
|
|
{
|
|
Check(this);
|
|
ProjectileWeapon::TakeDamage(damage);
|
|
}
|
|
|
|
void
|
|
MissileLauncher::DeathReset(Logical /*full_reset*/)
|
|
{
|
|
Check(this);
|
|
}
|
|
|
|
//
|
|
// The missile-salvo discharge. Not yet reconstructed.
|
|
//
|
|
void
|
|
MissileLauncher::FireWeapon()
|
|
{
|
|
Check(this);
|
|
|
|
//
|
|
// PARTIAL (binary @004bcc60): the authentic body launches missileCount
|
|
// Missile entities toward the owner's target (each carrying the salvo-split
|
|
// damageData) and dumps the firing heat. The Missile entity spawn needs
|
|
// the entity-spawn + targeting waves; the view/target gate, ammo pull and
|
|
// recoil all live in the CALLER (ProjectileWeaponSimulation's Loaded case).
|
|
//
|
|
// Ballistic heatCostToFire is stored 1e7-unit-NATIVE in the stream (SRM6
|
|
// reads 5.06e7 = +641K on its own sink -- the same design magnitude as the
|
|
// PPC's +632K); dump it raw, under the heat-model experience gate (novice /
|
|
// standard fire generates no heat -- authentic). (The EMITTER's authored
|
|
// value is small and its 1e7 comes from the energy algebra.)
|
|
if (HeatModelActive())
|
|
{
|
|
AddPendingHeat(heatCostToFire);
|
|
}
|
|
|
|
//
|
|
// The salvo delivery (CORRECTED to the arcade economy, BT411 task #62):
|
|
// the binary fires ONE cluster Missile per trigger and its zone damage
|
|
// lands EXACTLY ONCE -- damageData carries the ctor's salvo-split
|
|
// per-missile amount with burstCount = missileCount, and the zone armor
|
|
// formula ignores burstCount (it feeds only the gyro bounce + the splash
|
|
// falloff). A per-round delivery loop was ~missileCount-times too
|
|
// lethal (the port's "2-shot kill" regression). INTERIM instant-hit --
|
|
// the Missile entity flight / seeker / proximity fuse / cluster SPLASH
|
|
// is the missile wave.
|
|
//
|
|
if (targetWithinRange && owner != NULL
|
|
&& owner->GetTargetEntity() != NULL)
|
|
{
|
|
SendDamage(owner->GetTargetEntity(), damageData);
|
|
}
|
|
|
|
if (getenv("BT_MECH_LOG"))
|
|
{
|
|
DEBUG_STREAM << "[fire] '" << GetName()
|
|
<< "' FIRED (salvo of " << missileCount
|
|
<< ", recharge=" << rechargeRate
|
|
<< "s heat+=" << heatCostToFire << ")" << endl << flush;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Model-load-time construction. Not yet reconstructed.
|
|
//
|
|
Logical
|
|
MissileLauncher::CreateStreamedSubsystem(
|
|
ResourceFile *,
|
|
NotationFile *,
|
|
const char *,
|
|
const char *,
|
|
SubsystemResource *,
|
|
NotationFile *,
|
|
const ResourceDirectories *,
|
|
int
|
|
)
|
|
{
|
|
Fail("MissileLauncher::CreateStreamedSubsystem -- mislanch.cpp not yet reconstructed");
|
|
return False;
|
|
}
|