The player-experience system now gates the entire heat/jam economy, verified in BOTH directions with a one-token egg edit (TESTNOV.EGG, experience=novice): NOVICE = 212 fire cycles all pinned at T=77, zero jams, zero shutdowns (the heat model authentically absent); EXPERT = the full economy (duty cycles, 119 shutdowns + 2 authentic jams under forced fire). Zero Fail in both. - BTPLAYER: the flag block renamed to its TRUE semantics (simLive @0x25c, heatModelOn @0x260 -- the FUN_004ad7d4 master switch, advancedDamageOn pair, levelFlag26c/270, experienceLevel); the ctor rows were already binary-accurate (nov 0000 / std 1011 / vet 1111 / exp 1101); accessors + [exp] sentinel. - HeatSink::HeatModelActive() + ProjectileWeapon::LiveFireEnabled(): owner mech -> Entity::GetPlayerLink() -> the BTPlayer flags, NULL-permissive. Gates: both HeatSinkSimulation phases, every weapon fire-heat dump, and CheckForJam is now the AUTHENTIC form (LiveFireEnabled + heatLoad<=0 early-outs + the minJamChance floor; the interim heat-degraded gate retired). - THE LOAD-BEARING FIX: Mech ctor SetValidFlag(). Every 1995 entity ctor tail marks itself valid; ours didn't -- Entity::Dispatch routes messages to an INVALID entity into the deferred event queue, so the PlayerLink bind (and every directly-dispatched mech message) silently never landed and the gates read a NULL player forever. - THE COOLANT SYSTEM (authentic bodies, byte-verified constants: HeatLoadScale 0.002 -> heatLoad now in [0,1]; equalize eps 1e-4; draw floor/ON 0.0025/0.003): UpdateCoolant (damage-scaled draw -- an undamaged mech leaks nothing), BalanceCoolant (full clamp chain from ConductHeat), DrawCoolant base=0 with the RESERVOIR override as THE SOURCE; Reservoir reconstructed (capacity overlays thermalCapacity, CoolantSimulation + the full InjectCoolant flush distribution, BT_FORCE_FLUSH dev hook); Condenser RefrigerationSimulation (massScale = (1-damage)*refrigerationFactor >= 1 -- the heat pump that chills the bank; valveState inits 1; digit-suffix number fix). Deferred: AggregateHeatSink family, cockpit-button handlers (MoveValve/ToggleCooling/InjectCoolant), TrackSeekVoltage charge model. Research driven by a 4-agent workflow dossier over the BT411 RE (verbatim bodies for every function above + the egg experience plumbing). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
142 lines
3.8 KiB
C++
142 lines
3.8 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);
|
|
}
|
|
|
|
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;
|
|
}
|