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>
152 lines
4.8 KiB
C++
152 lines
4.8 KiB
C++
//===========================================================================//
|
|
// File: missile.hpp //
|
|
// Project: BattleTech //
|
|
// Contents: Implementation details for missiles //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
//
|
|
// STAGED header -- no missile.hpp survives (only the MISSILE.TCP fragment).
|
|
// Interface reconstructed from the binary (ctor @004bf5b4, integrator
|
|
// @004bef78, vtable @00512f2c, 0x368 bytes) and the surviving SEEKER.HPP /
|
|
// MISTHRST.HPP that name the two hosted subsystems. See MISSILE.NOTES.md.
|
|
//
|
|
|
|
#if !defined(MISSILE_HPP)
|
|
# define MISSILE_HPP
|
|
|
|
# if !defined(PROJTILE_HPP)
|
|
# include <projtile.hpp>
|
|
# endif
|
|
|
|
# if !defined(DAMAGE_HPP)
|
|
# include <damage.hpp>
|
|
# endif
|
|
|
|
//##################### Forward Class Declarations #######################
|
|
class Mech;
|
|
class Seeker;
|
|
class MissileThruster;
|
|
|
|
//###########################################################################
|
|
//############################## Missile ################################
|
|
//###########################################################################
|
|
|
|
class Missile:
|
|
public Projectile
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data Support
|
|
//
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Subsystem roster (ctor build order @004bf5b4: Seeker first,
|
|
// MissileThruster second -- MISSILE.TCP's GetSubsystem indices).
|
|
//
|
|
public:
|
|
enum {
|
|
SeekerSubsystem = 0,
|
|
MissileThrusterSubsystem = 1,
|
|
SubsystemCount = 2 // binary this[0x49] == 2
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Model Support
|
|
//
|
|
public:
|
|
typedef void
|
|
(Missile::*Performance)(Scalar time_slice);
|
|
|
|
//
|
|
// @004bef78 -- the per-frame integrate-guidance-and-collide pass:
|
|
// age the round, re-lead the target (Seeker), bleed the thruster
|
|
// burn, steer + integrate, then the proximity fuse / lifetime
|
|
// retire.
|
|
//
|
|
void
|
|
MoveAndCollide(Scalar time_slice);
|
|
|
|
void
|
|
SetPerformance(Performance performance)
|
|
{
|
|
Check(this);
|
|
activePerformance = (Simulation::Performance)performance;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction and Destruction
|
|
//
|
|
public:
|
|
typedef Projectile::MakeMessage MakeMessage;
|
|
|
|
static Missile*
|
|
Make(MakeMessage *creation_message);
|
|
|
|
Missile(
|
|
MakeMessage *creation_message,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
~Missile();
|
|
|
|
//
|
|
// Flight seed, called by the launcher right after construction: the
|
|
// launcher link (the inflictor carried into the hit), the homing
|
|
// target, the salvo-split cluster damage record, and the launch
|
|
// speed. Builds the Seeker/MissileThruster roster (the binary's
|
|
// spawn descriptor carried these into the ctor; our MakeMessage
|
|
// doesn't, so the roster waits for the target).
|
|
//
|
|
void
|
|
Launch(
|
|
Mech *launcher,
|
|
Entity *target,
|
|
Damage &damage,
|
|
Scalar launch_speed
|
|
);
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Resource creation
|
|
//
|
|
public:
|
|
static ResourceDescription::ResourceID
|
|
CreateModelResource(
|
|
ResourceFile *resource_file,
|
|
const char *model_name,
|
|
NotationFile *model_file,
|
|
const ResourceDirectories *directories
|
|
);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Local Data (binary offsets past the Projectile base: 0x340..0x364)
|
|
//
|
|
protected:
|
|
Scalar lifetime; // @0x340 max time-of-flight
|
|
Scalar ageFraction; // @0x344 age/lifetime, clamped 1.0
|
|
Scalar age; // @0x35c accumulated flight time
|
|
int detonationFlag; // @0x364 proximity/contact mode
|
|
|
|
//
|
|
// Staged flight state (the binary keeps these in the Entity motion
|
|
// block; named members until the raw-offset motion wave).
|
|
//
|
|
Vector3D flightVelocity;
|
|
Scalar fuseRadius;
|
|
EntityID launcherEntityID;
|
|
Damage damageData;
|
|
int telemetryCountdown;
|
|
};
|
|
|
|
#endif
|