Mech phase 3: named member layout + embedded-member construction
Replaced MECH.HPP reserved[331] with the named Mech-own members: cached subsystem pointers (sensor/gyro/sinkSource/hud) + messageManager + weaponCount, the 5 capability chains (ChainOf<Subsystem*>), and the embedded status/animation state (4 AlarmIndicators, Reticle, 3 StateIndicators, 2 SequenceControllers, NameFilter, telemetryFilter[5]=AverageOf<Scalar>, 3 CStrings) + a reservedState pad for the phase-5 per-frame fields. The subsystem ROSTER (subsystemArray/subsystemCount) lives in the base Entity (GetSubsystem/GetSubsystemCount), so the Mech only caches back-pointers. The Mech ctor now CONSTRUCTS all embedded members (alarms Initialize'd, reticle armed, state indicators sized, telemetry filters sized, sequence controllers Init'd) -- compile-verified -- then halts at the segment walk (the remaining piece). BT: 42 ok; tree links clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -61,9 +61,67 @@ Mech::Mech(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &shared_data
|
||||
):
|
||||
JointedMover(creation_message, shared_data)
|
||||
JointedMover(creation_message, shared_data),
|
||||
controllableSubsystems(this),
|
||||
watchedSubsystems(this),
|
||||
heatableSubsystems(this),
|
||||
weaponRoster(this),
|
||||
damageableSubsystems(this)
|
||||
{
|
||||
Fail("Mech::Mech -- mech.cpp not yet reconstructed");
|
||||
Check_Pointer(creation_message);
|
||||
|
||||
//
|
||||
// Cached subsystem back-pointers -- filled by the segment walk below.
|
||||
//
|
||||
sensorSubsystem = NULL;
|
||||
gyroSubsystem = NULL;
|
||||
sinkSourceSubsystem = NULL;
|
||||
hudSubsystem = NULL;
|
||||
messageManager = NULL;
|
||||
weaponCount = 0;
|
||||
|
||||
//
|
||||
// Embedded status / animation / naming state.
|
||||
//
|
||||
mechNameFilter.Initialize();
|
||||
masterAlarm.Initialize(0x21);
|
||||
heatAlarm.Initialize(3);
|
||||
stabilityAlarm.Initialize(2);
|
||||
statusAlarm.Initialize(0x21);
|
||||
|
||||
targetReticle.reticleState = Reticle::ReticleOn;
|
||||
targetReticle.pickPointingOn = True;
|
||||
targetReticle.reticleElementMask = Reticle::AllEnabledGroup;
|
||||
|
||||
animationState = StateIndicator(0x21);
|
||||
animationState.SetState(0);
|
||||
replicantAnimationState = StateIndicator(0x21);
|
||||
replicantAnimationState.SetState(0);
|
||||
collisionState = StateIndicator(4);
|
||||
collisionState.SetState(0);
|
||||
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
telemetryFilter[i].SetSize(15, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
legAnimation.Init(this);
|
||||
bodyAnimation.Init(this);
|
||||
|
||||
{
|
||||
for (int i = 0; i < 220; ++i)
|
||||
{
|
||||
reservedState[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// The segment-table walk (subsystem instantiation + capability-chain
|
||||
// wiring) is not yet reconstructed. See MECHSUB.NOTES.md for the blueprint.
|
||||
//
|
||||
Fail("Mech::Mech -- segment walk not yet reconstructed");
|
||||
}
|
||||
|
||||
Mech::~Mech()
|
||||
|
||||
@@ -23,9 +23,38 @@
|
||||
# include <reticle.hpp>
|
||||
# endif
|
||||
|
||||
# if !defined(ALARM_HPP)
|
||||
# include <alarm.hpp>
|
||||
# endif
|
||||
|
||||
# if !defined(STATE_HPP)
|
||||
# include <state.hpp>
|
||||
# endif
|
||||
|
||||
# if !defined(CHAIN_HPP)
|
||||
# include <chain.hpp>
|
||||
# endif
|
||||
|
||||
# if !defined(AVERAGE_HPP)
|
||||
# include <average.hpp>
|
||||
# endif
|
||||
|
||||
# if !defined(CSTR_HPP)
|
||||
# include <cstr.hpp>
|
||||
# endif
|
||||
|
||||
# if !defined(SEQCTL_HPP)
|
||||
# include <seqctl.hpp>
|
||||
# endif
|
||||
|
||||
# if !defined(NAMEFILT_HPP)
|
||||
# include <namefilt.hpp>
|
||||
# endif
|
||||
|
||||
//##################### Forward Class Declarations #######################
|
||||
class Mech;
|
||||
class Subsystem;
|
||||
class SubsystemMessageManager;
|
||||
class ControlsMapping;
|
||||
class PlatformTool;
|
||||
class MechControlsMapper;
|
||||
@@ -225,11 +254,69 @@
|
||||
PlatformTool *current_tool
|
||||
);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Subsystem roster accessors (the roster itself -- subsystemArray /
|
||||
// subsystemCount -- lives in the base Entity)
|
||||
//
|
||||
public:
|
||||
Subsystem*
|
||||
GetGyroSubsystem() { Check(this); return gyroSubsystem; }
|
||||
Subsystem*
|
||||
GetTorsoSubsystem() { Check(this); return sinkSourceSubsystem; }
|
||||
Subsystem*
|
||||
GetHudSubsystem() { Check(this); return hudSubsystem; }
|
||||
Subsystem*
|
||||
GetSensorSubsystem() { Check(this); return sensorSubsystem; }
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Local Data
|
||||
//
|
||||
protected:
|
||||
int reserved[331];
|
||||
//
|
||||
// Cached subsystem back-pointers (also held in the base roster).
|
||||
//
|
||||
Subsystem *sensorSubsystem;
|
||||
Subsystem *gyroSubsystem;
|
||||
Subsystem *sinkSourceSubsystem; // the real Torso
|
||||
Subsystem *hudSubsystem;
|
||||
SubsystemMessageManager *messageManager;
|
||||
int weaponCount;
|
||||
|
||||
//
|
||||
// Capability sub-rosters (Socket views onto the subsystem roster;
|
||||
// populated per-frame -- phase 5).
|
||||
//
|
||||
ChainOf<Subsystem*> controllableSubsystems;
|
||||
ChainOf<Subsystem*> watchedSubsystems;
|
||||
ChainOf<Subsystem*> heatableSubsystems;
|
||||
ChainOf<Subsystem*> weaponRoster;
|
||||
ChainOf<Subsystem*> damageableSubsystems;
|
||||
|
||||
//
|
||||
// Embedded status / animation / naming state.
|
||||
//
|
||||
NameFilter mechNameFilter;
|
||||
AlarmIndicator masterAlarm;
|
||||
AlarmIndicator heatAlarm;
|
||||
AlarmIndicator stabilityAlarm;
|
||||
AlarmIndicator statusAlarm;
|
||||
Reticle targetReticle;
|
||||
StateIndicator animationState;
|
||||
StateIndicator replicantAnimationState;
|
||||
StateIndicator collisionState;
|
||||
SequenceController legAnimation;
|
||||
SequenceController bodyAnimation;
|
||||
AverageOf<Scalar> telemetryFilter[5];
|
||||
CString resourceNameA;
|
||||
CString resourceNameB;
|
||||
CString resourceNameC;
|
||||
|
||||
//
|
||||
// Per-frame locomotion / targeting / animation state, advanced by the
|
||||
// mech2/mech3/mech4 simulation. Reserved until that path (phase 5) is
|
||||
// reconstructed with named fields.
|
||||
//
|
||||
int reservedState[220];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user