Mech::DamageZone::TakeDamage is the full binary cascade (@0049c690): LOD artifact router with same-attacker clustering (@0049c40c, hysteresis 0.33), artifact parent level = mean of children, Energy-hit generator shorts through the crit plug binding (novice-exempt), weighted CriticalHit (@0049ccc4), zone-death allotment push (SendSubsystemDamage @0049c9a8) and the segment-table destruction descent (RecurseSegmentTable @0049cad4 -- SIBS + DESCEND via the engine EntitySegment iterators). Supporting bricks: Mech's OWN handler table with the TakeDamage override (latches lastInflictingID @0x43c; gyro feed staged; cylinder table deferred); friend class Mech__DamageZone (authentic); subsystem private zones ARMED (structureReference + armorByFacing[5] normalized -- crits are measurable); ApplyDamageAndMeasure; ForceCriticalFailure sets DestroyedState so the weapon FSMs' GetSimulationState()==1 hard gate went live; Generator::ForceShort + PoweredSubsystem::ForceShortRecovery. Fight-verified (mutual BT_SPAWN_ENEMY + BT_FORCE_ZONE=8 concentrated fire): arm zone to 1.0 -> sibling searchlight zone dies (Searchlight2/ThermalSight crits destroyed, HUD degrading) -> DESCEND kills the gun zone -> PPC_2 + ERMLaser_2 + Condenser6 DESTROYED and FALL SILENT (0 shots after death; undamaged PPC_1 keeps firing); vital-zone hit = MECH KILL; PPC hit shorted GeneratorD. This art has zero artifact zones (redirect=0 across all 20 -- router verified dormant-correct). Smoke + novice regressions clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
193 lines
5.4 KiB
C++
193 lines
5.4 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 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
|