BT410 Phase 5.3.18: flying missiles -- spawn/home/detonate LIVE, teardown open
The Missile entity family is reconstructed: Projectile : Mover gets a real make-path ctor; Missile hosts the Seeker + MissleThruster roster (the AUTHENTIC surviving SEEKER.HPP / MISTHRST.HPP interfaces -- the 1995 misspelling included) and flies the binary's guided integrator (@004bef78): age/lifetime, seeker re-lead with the decoded loft constants (200/50/300/0.1), thruster burn, steering (gain 4.0, deadband 1e-4), and the proximity fuse delivering the cluster damage ONCE with the launcher as inflictor. Live-verified end-to-end: LAUNCH -> flight telemetry (thruster visibly accelerating) -> DETONATE on the target ~0.9s out. OPEN: the first ~Missile off the death row completes, then the frame page-faults with EIP in the heap -- the first entity/subsystem teardown the reconstructed sim has ever run. The spawn path is therefore OPT-IN (BT_MISSILE_FLIGHT=1); default SRM delivery stays the 5.3.18a instant-hit cluster (verified 1:1, zero exceptions). Forensics + engine truths (SearchList crashes on non-directory ids; MakeMessages need FAMILY resource ids; explosionModelFile is a model-list INDEX) in MISSILE.NOTES.md. Also fixed on the way: the Subsystem NAME ctor left damageZone UNINITIALIZED (latent garbage for every name-built subsystem). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
//===========================================================================//
|
||||
// File: misthrst.cpp //
|
||||
// Project: BattleTech Brick: Mech weapons //
|
||||
// Contents: MissileThruster -- the missile's propulsion subsystem //
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
||||
// All Rights reserved worldwide //
|
||||
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
||||
//===========================================================================//
|
||||
//
|
||||
// The class interface is the AUTHENTIC surviving CODE/BT/BT/MISTHRST.HPP.
|
||||
// Bodies reconstructed via the BT411 decomp (ctor @004be7c4). The Subsystem
|
||||
// base chain is the NAME ctor with the shipped string "MissleThruster"
|
||||
// @00512e25 (the 1995 misspelling is AUTHENTIC -- keep it). No streamed
|
||||
// resource in the pod content: the flight envelope defaults below are
|
||||
// STAGED until the missile GameModel record decode (see MISSILE.NOTES.md).
|
||||
//
|
||||
|
||||
#include <bt.hpp>
|
||||
#pragma hdrstop
|
||||
|
||||
#if !defined(MISTHRST_HPP)
|
||||
# include <misthrst.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(MISSILE_HPP)
|
||||
# include <missile.hpp>
|
||||
#endif
|
||||
|
||||
//
|
||||
// STAGED-DEFAULT burn envelope (a believable SRM: short hard burn).
|
||||
//
|
||||
static const Scalar DefaultBurnTime = 2.0f;
|
||||
static const Scalar DefaultThrusterAcceleration = 120.0f; // u/s^2
|
||||
static const Scalar DefaultThrusterClimb = 0.0f;
|
||||
|
||||
Derivation
|
||||
MissileThruster::ClassDerivations(
|
||||
Subsystem::ClassDerivations,
|
||||
"MissileThruster"
|
||||
);
|
||||
|
||||
const MissileThruster::IndexEntry
|
||||
MissileThruster::AttributePointers[] =
|
||||
{
|
||||
ATTRIBUTE_ENTRY(MissileThruster, BurnTimeRemaining, burnTimeRemaining),
|
||||
ATTRIBUTE_ENTRY(MissileThruster, MaxThrusterRotationRate, maxThrusterRotationRate),
|
||||
ATTRIBUTE_ENTRY(MissileThruster, ThrusterAcceleration, thrusterAcceleration)
|
||||
};
|
||||
|
||||
MissileThruster::AttributeIndexSet
|
||||
MissileThruster::AttributeIndex(
|
||||
ELEMENTS(MissileThruster::AttributePointers),
|
||||
MissileThruster::AttributePointers,
|
||||
Subsystem::AttributeIndex
|
||||
);
|
||||
|
||||
MissileThruster::SharedData
|
||||
MissileThruster::DefaultData(
|
||||
MissileThruster::ClassDerivations,
|
||||
Subsystem::MessageHandlers,
|
||||
MissileThruster::AttributeIndex,
|
||||
MissileThruster::StateCount
|
||||
);
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// Construction (binary @004be7c4). The const burn/thrust envelope streams
|
||||
// from the missile resource in the binary; staged defaults here.
|
||||
//#############################################################################
|
||||
//
|
||||
MissileThruster::MissileThruster(
|
||||
Missile *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *subsystem_resource
|
||||
):
|
||||
Subsystem(
|
||||
owner,
|
||||
subsystem_ID,
|
||||
"MissleThruster",
|
||||
(RegisteredClass::ClassID)ThrusterClassID,
|
||||
DefaultData
|
||||
),
|
||||
thrusterAcceleration(
|
||||
(subsystem_resource != NULL)
|
||||
? subsystem_resource->thrusterAcceleration
|
||||
: DefaultThrusterAcceleration
|
||||
),
|
||||
thrusterClimb(
|
||||
(subsystem_resource != NULL)
|
||||
? subsystem_resource->thrusterClimb
|
||||
: DefaultThrusterClimb
|
||||
)
|
||||
{
|
||||
Check(owner);
|
||||
|
||||
burnTimeRemaining = (subsystem_resource != NULL)
|
||||
? subsystem_resource->burnTime
|
||||
: DefaultBurnTime;
|
||||
maxThrusterRotationRate = 0.0f;
|
||||
|
||||
Check_Fpu();
|
||||
}
|
||||
|
||||
MissileThruster::~MissileThruster()
|
||||
{
|
||||
}
|
||||
|
||||
Logical
|
||||
MissileThruster::TestInstance() const
|
||||
{
|
||||
return IsDerivedFrom(ClassDerivations);
|
||||
}
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// MissileThrusterSimulation -- bleed the burn. (Driven from the Missile's
|
||||
// MoveAndCollide integrator, not a roster Performance -- the binary folds
|
||||
// the thruster work into the integrate pass.)
|
||||
//#############################################################################
|
||||
//
|
||||
void
|
||||
MissileThruster::MissileThrusterSimulation(Scalar time_slice)
|
||||
{
|
||||
Check(this);
|
||||
|
||||
if (burnTimeRemaining > 0.0f)
|
||||
{
|
||||
burnTimeRemaining -= time_slice;
|
||||
if (burnTimeRemaining < 0.0f)
|
||||
{
|
||||
burnTimeRemaining = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user