Under the documented rig (launch_pod.ps1 with the GL bridge up) the 'couldn't load object' count went to ZERO. .BGF loading was never a reconstruction problem, only a missing bridge. What blocks now is a series of authored AttributeWatchers: BTL4.RES binds them BY NAME and the engine Fails outright on any that does not resolve, so each is a name our subsystems must publish. Five rungs climbed, each run-verified: UnstablePercentage, SpeedEffect (Myomers table), AnimationState + CollisionState/CollisionNormal + ReduceButton (Mech), and the full Torso table (all six authentic names mapped onto existing members). The method that makes this cheap is banked: the shipped binary's string pool carries each class's attribute names CONTIGUOUSLY in ID ORDER after the class name, and in every case so far our member declarations sit in the same order -- which confirms the layout and lets ids be pinned rather than guessed. Intersecting those names with BTL4.RES gives the exact work list. A THIRD miswired SharedData found on the way: Myomers carried Subsystem's tables where it derives from PoweredSubsystem, the same defect as MissileLauncher (5.3.33). Worth a sweep across every subsystem. Staged member TYPES are provisional and documented as such: AttributeWatcherOf reads *(T*)attributePointer and the instantiation comes from the resource, which the string pool does not reveal. Nothing drives them yet, so settle the types with the models that write them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
138 lines
3.8 KiB
C++
138 lines
3.8 KiB
C++
//===========================================================================//
|
|
// File: myomers.cpp //
|
|
// Project: BattleTech Brick: Mech subsystems //
|
|
// Contents: Myomers -- artificial-muscle locomotion power //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#include <bt.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(MYOMERS_HPP)
|
|
# include <myomers.hpp>
|
|
#endif
|
|
|
|
#if !defined(MECH_HPP)
|
|
# include <mech.hpp>
|
|
#endif
|
|
|
|
Derivation
|
|
Myomers::ClassDerivations(
|
|
PoweredSubsystem::ClassDerivations,
|
|
"Myomers"
|
|
);
|
|
|
|
const Myomers::IndexEntry
|
|
Myomers::AttributePointers[]=
|
|
{
|
|
ATTRIBUTE_ENTRY(Myomers, SpeedEffect, speedEffect),
|
|
ATTRIBUTE_ENTRY(Myomers, CurrentSeekVoltageIndex, currentSeekVoltageIndex),
|
|
ATTRIBUTE_ENTRY(Myomers, RecommendedSeekVoltageIndex,
|
|
recommendedSeekVoltageIndex),
|
|
ATTRIBUTE_ENTRY(Myomers, MinSeekVoltageIndex, minSeekVoltageIndex),
|
|
ATTRIBUTE_ENTRY(Myomers, MaxSeekVoltageIndex, maxSeekVoltageIndex),
|
|
{ (int)Myomers::SeekVoltageAttributeID, "SeekVoltage",
|
|
(Simulation::AttributePointer)&Myomers::seekVoltage }
|
|
};
|
|
|
|
Myomers::AttributeIndexSet
|
|
Myomers::AttributeIndex(
|
|
ELEMENTS(Myomers::AttributePointers),
|
|
Myomers::AttributePointers,
|
|
PoweredSubsystem::AttributeIndex
|
|
);
|
|
|
|
//
|
|
// The shared data must carry the POWERED tables, not Subsystem's -- the
|
|
// same miswiring found on MissileLauncher (5.3.33). Myomers derives from
|
|
// PoweredSubsystem, so wiring it to Subsystem's dropped every powered
|
|
// attribute AND the powered message handlers (ToggleSeekVoltage and the
|
|
// generator-select family) on the way past.
|
|
//
|
|
Myomers::SharedData
|
|
Myomers::DefaultData(
|
|
Myomers::ClassDerivations,
|
|
PoweredSubsystem::MessageHandlers,
|
|
Myomers::AttributeIndex,
|
|
Subsystem::StateCount
|
|
);
|
|
|
|
Myomers::Myomers(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *resource,
|
|
SharedData &shared_data
|
|
):
|
|
PoweredSubsystem(owner, subsystem_ID, resource, shared_data)
|
|
{
|
|
Check(owner);
|
|
Check_Pointer(resource);
|
|
|
|
speedEffect = 1.0f;
|
|
heatRange = failureTemperature - degradationTemperature;
|
|
heatRangeSquared = heatRange * heatRange;
|
|
velocityEfficiency = resource->velocityEfficiency;
|
|
accelerationEfficiency = resource->accelerationEfficiency;
|
|
|
|
//
|
|
// Build the seek-voltage drive table: each resource fraction scaled by the
|
|
// powering generator's rated voltage. The voltage source is resolved once
|
|
// AttachToVoltageSource runs (phase-4 wiring); until then it is null and the
|
|
// table scales to zero.
|
|
//
|
|
Generator *source = (Generator *)ResolveVoltageSource();
|
|
Scalar srcRated = (source != NULL) ? source->ratedVoltage : 0.0f;
|
|
|
|
maxSeekVoltageIndex = -1;
|
|
int count = 0;
|
|
while (count < 5)
|
|
{
|
|
if (resource->seekVoltage[count] == -1.0f)
|
|
{
|
|
maxSeekVoltageIndex = count - 1;
|
|
break;
|
|
}
|
|
seekVoltage[count] = resource->seekVoltage[count] * srcRated;
|
|
++count;
|
|
}
|
|
if (maxSeekVoltageIndex < 0)
|
|
{
|
|
maxSeekVoltageIndex = count - 1;
|
|
}
|
|
|
|
minSeekVoltageIndex = 0;
|
|
recommendedSeekVoltageIndex = resource->seekVoltageRecommendedIndex;
|
|
currentSeekVoltageIndex = recommendedSeekVoltageIndex;
|
|
|
|
Check_Fpu();
|
|
}
|
|
|
|
Myomers::~Myomers()
|
|
{
|
|
}
|
|
|
|
Logical
|
|
Myomers::TestClass(Mech &)
|
|
{
|
|
return True;
|
|
}
|
|
|
|
Logical
|
|
Myomers::TestInstance() const
|
|
{
|
|
return IsDerivedFrom(ClassDerivations);
|
|
}
|
|
|
|
//
|
|
// Per-frame: convert seek voltage into locomotion speed/acceleration effect.
|
|
// Not yet reconstructed.
|
|
//
|
|
void
|
|
Myomers::MyomersSimulation(Scalar)
|
|
{
|
|
Fail("Myomers::MyomersSimulation -- myomers.cpp not yet reconstructed");
|
|
}
|