Myomers (: PoweredSubsystem) -- locomotion muscle: seek-voltage drive table (scaled by the generator's rated voltage via ResolveVoltageSource), efficiency + heat-range members; MyomersSimulation staged. Condenser (: HeatSink) -- active refrigeration in a coolant loop; valveState/refrigerationFactor/condenserNumber. Both ctors chain their parents + init from resource; statics/dtor/test real. Heat/power subsystem family now COMPLETE (11 classes): MechSubsystem, HeatableSubsystem, HeatSink, PoweredSubsystem, Generator, Condenser, Sensor, Myomers, HeatWatcher, PowerWatcher, Gyroscope, HUD, Torso. BT: 31 ok. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
111 lines
2.8 KiB
C++
111 lines
2.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"
|
|
);
|
|
|
|
Myomers::SharedData
|
|
Myomers::DefaultData(
|
|
Myomers::ClassDerivations,
|
|
Subsystem::MessageHandlers,
|
|
Subsystem::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");
|
|
}
|