The full circuit, workflow-researched (5 parallel dossiers over BT411 + the engine) and adversarially reviewed (3 lenses) before landing: Mech side: the once-per-death transition in Simulate (freeze, motion kill, DeathShutdown sweep, MASTER-only VehicleDead(-1) to the player link); Mech::Reset @0049fb74 (reposition + heal every hull zone + the roster DeathReset sweep + PreRun -- the reset-based respawn that REUSES the entity); dead-owner terms in both weapon hard gates (wrecks fall silent). Player side: the VehicleDead(-1) branch (deathPending dedup, deathCount bump+stamp, scenario-role life debit, +5s re-post -> the engine drop-zone hunt) and the DropZoneReply respawn branch (reset the dead mech at the replied drop zone; probes on a live mech are moot). Subsystem side: the engine base virtual DeathReset implemented across the family -- MechSubsystem (zone heal + DestroyedState clear), MechWeapon (full powered/thermal restore + fresh Loading cycle), AmmoBin (restock from the ctor-cached count), HeatSink/HeatWatcher/PowerWatcher/Generator/Sensor/ MissileLauncher. Review catches fixed before commit: AmmoBin restocked through the FREED padBuffer pointer (use-after-free -> initialAmmoCount; MechSubsystem:: resource is now documented as never-deref-post-ctor); died-hot weapons respawned at FailureHeat (now full thermal re-init); Generator tap counts desynced across reset (preserved); Sensor skipped the base heal; PowerWatcher inherited a statically-bound reset; cooling toggle + connect mode restored. Verified: kill -> wreck (0 shots while dead) -> +5s -> drop-zone hunt -> HEALED + placed at a real drop zone -> 134 shots after respawn incl. 12 SRM (restock proof); unowned enemy wreck settles silently; fight/smoke/novice regressions green, zero faults. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
203 lines
6.0 KiB
C++
203 lines
6.0 KiB
C++
//===========================================================================//
|
|
// File: mechsub.hpp //
|
|
// Project: BattleTech //
|
|
// Contents: Implementation details for mech subsystems //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#if !defined(MECHSUB_HPP)
|
|
# define MECHSUB_HPP
|
|
|
|
# if !defined(SUBSYSTM_HPP)
|
|
# include <subsystm.hpp>
|
|
# endif
|
|
|
|
# if !defined(ALARM_HPP)
|
|
# include <alarm.hpp>
|
|
# endif
|
|
|
|
//##################### Forward Class Declarations #######################
|
|
class Mech;
|
|
class Damage;
|
|
|
|
//###########################################################################
|
|
//#################### MechSubsystem Model Resource #####################
|
|
//###########################################################################
|
|
|
|
struct MechSubsystem__SubsystemResource:
|
|
public Subsystem::SubsystemResource
|
|
{
|
|
Scalar armorByFacing[5];
|
|
Scalar structureReference;
|
|
int vitalSubsystemIndex;
|
|
char videoObjectName[128];
|
|
ResourceDescription::ResourceID
|
|
alarmModel;
|
|
int alarmModelReserved[2];
|
|
int printSimulationState;
|
|
Scalar collisionCriticalHitWeight;
|
|
Scalar criticalReference;
|
|
};
|
|
|
|
//###########################################################################
|
|
//########################## MechSubsystem ##############################
|
|
//###########################################################################
|
|
|
|
class MechSubsystem:
|
|
public Subsystem
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data Support
|
|
//
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Status model
|
|
//
|
|
public:
|
|
enum TechStatusType {
|
|
Destroyed = 0,
|
|
Damaged = 1,
|
|
CoolantLeaking = 2,
|
|
Overheating = 3,
|
|
AmmoBurning = 4,
|
|
Jammed = 5,
|
|
BadPower = 6,
|
|
TechStatusTypeCount
|
|
};
|
|
|
|
//
|
|
// The subsystem SIMULATION states (binary PrintState @4ac8c0 string
|
|
// pool: "Destroyed" @0050df7f, "Exploding" @0050df8c). DestroyedState
|
|
// (1) is the hard-failure gate every weapon simulation checks
|
|
// (`GetSimulationState() == 1` -- emitter @4baab9, ballistic @4bbd36).
|
|
//
|
|
enum {
|
|
DestroyedState = Simulation::DefaultState + 1,
|
|
ExplodingState,
|
|
MechSubsystemStateCount
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Test Class Support
|
|
//
|
|
public:
|
|
static Logical
|
|
TestClass(Mech &);
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction and Destruction
|
|
//
|
|
public:
|
|
typedef MechSubsystem__SubsystemResource SubsystemResource;
|
|
|
|
MechSubsystem(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
const char *subsystem_name,
|
|
RegisteredClass::ClassID class_id,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
|
|
MechSubsystem(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
|
|
~MechSubsystem();
|
|
|
|
static int
|
|
CreateStreamedSubsystem(
|
|
NotationFile *model_file,
|
|
const char *model_name,
|
|
const char *subsystem_name,
|
|
SubsystemResource *subsystem_resource,
|
|
NotationFile *subsystem_file,
|
|
const ResourceDirectories *directories,
|
|
int passes = 1
|
|
);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Damage support
|
|
//
|
|
public:
|
|
virtual void
|
|
TakeDamage(Damage &damage);
|
|
|
|
Scalar
|
|
GetSubsystemDamageLevel() const;
|
|
void
|
|
SetSubsystemDamageLevel(Scalar level);
|
|
void
|
|
ForceCriticalFailure();
|
|
|
|
//
|
|
// Critical-hit application (binary @4ac07c): run the damage through
|
|
// TakeDamage and return how much the subsystem's own zone level
|
|
// actually moved (the crit accountant charges it against the entry's
|
|
// damagePercentage allotment).
|
|
//
|
|
Scalar
|
|
ApplyDamageAndMeasure(Damage &damage);
|
|
|
|
Logical
|
|
IsVitalSubsystem() const { Check(this); return vitalSubsystem; }
|
|
|
|
//
|
|
// The respawn restore (engine base virtual, SUBSYSTM.HPP:184 -- the
|
|
// pair with DeathShutdown). Mech::Reset sweeps every roster slot;
|
|
// the base heals the subsystem's private zone and clears the
|
|
// Destroyed simulation state (the weapon hard gate). full_reset is
|
|
// the binary's reset_command (every recovered override ignores it).
|
|
//
|
|
virtual void
|
|
DeathReset(Logical full_reset);
|
|
|
|
//
|
|
// The NOVICE-experience lockout predicate (binary @4ac9c8): a novice
|
|
// pilot's advanced cockpit controls (condenser valves, coolant flush,
|
|
// cooling toggles) are locked out. Owner mech -> playerLink ->
|
|
// experience level == novice. Unlinked mechs read UNLOCKED.
|
|
//
|
|
Logical
|
|
NoviceLockout();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Local Data
|
|
//
|
|
protected:
|
|
Mech
|
|
*owner;
|
|
AlarmIndicator
|
|
statusAlarm;
|
|
Logical
|
|
vitalSubsystem;
|
|
ResourceDescription::ResourceID
|
|
alarmModel;
|
|
Scalar
|
|
criticalReference;
|
|
Scalar
|
|
collisionCriticalHitWeight;
|
|
Logical
|
|
printSimulationState;
|
|
int
|
|
configureActivePress;
|
|
SubsystemResource
|
|
*resource;
|
|
};
|
|
|
|
#endif
|