Torso twist / weapon-elevation subsystem. Named tuning members (rates/limits in radians, button-accel) + twist/elevation dynamics pad; ctor chains PowerWatcher, copies tuning (RAD_PER_DEG), skips skeleton-joint resolution (deferred to the live Mech link). statics/dtor/test real; TorsoSimulation/TorsoCopySimulation staged. Cockpit leaf trio complete (Gyroscope/HUD/Torso). BT: 30 ok. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
116 lines
2.9 KiB
C++
116 lines
2.9 KiB
C++
//===========================================================================//
|
|
// File: torso.cpp //
|
|
// Project: BattleTech Brick: Mech subsystems //
|
|
// Contents: Torso -- torso twist / weapon elevation //
|
|
//---------------------------------------------------------------------------//
|
|
// 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(TORSO_HPP)
|
|
# include <torso.hpp>
|
|
#endif
|
|
|
|
#if !defined(MECH_HPP)
|
|
# include <mech.hpp>
|
|
#endif
|
|
|
|
Derivation
|
|
Torso::ClassDerivations(
|
|
PowerWatcher::ClassDerivations,
|
|
"Torso"
|
|
);
|
|
|
|
Torso::SharedData
|
|
Torso::DefaultData(
|
|
Torso::ClassDerivations,
|
|
Subsystem::MessageHandlers,
|
|
Subsystem::AttributeIndex,
|
|
Subsystem::StateCount
|
|
);
|
|
|
|
Torso::Torso(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *r,
|
|
SharedData &shared_data
|
|
):
|
|
PowerWatcher(owner, subsystem_ID, r, shared_data)
|
|
{
|
|
Check(owner);
|
|
Check_Pointer(r);
|
|
|
|
isDamagedCopy = (owner->GetInstance() == Entity::ReplicantInstance);
|
|
|
|
statusFlags = 0;
|
|
buttonAccelerationPerSecond = r->buttonAccelerationPerSecond;
|
|
buttonAccelerationStart = r->buttonAccelerationStartValue;
|
|
|
|
baseTwistRate = r->horizontalRotationPerSecond * RAD_PER_DEG;
|
|
baseElevationRate = r->verticalRotationPerSecond * RAD_PER_DEG;
|
|
horizontalLimitRight= r->horizontalLimitRight * RAD_PER_DEG;
|
|
horizontalLimitLeft = r->horizontalLimitLeft * RAD_PER_DEG;
|
|
verticalLimitTop = r->verticalLimitTop * RAD_PER_DEG;
|
|
verticalLimitBottom = r->verticalLimitBottom * RAD_PER_DEG;
|
|
|
|
twistCenterHigh = verticalLimitTop;
|
|
twistCenterLow = verticalLimitBottom;
|
|
elevationCenter = verticalLimitTop;
|
|
elevationHalfBottom = verticalLimitBottom * 0.5f;
|
|
|
|
buttonRampActive = 0;
|
|
buttonRamp = 0.0f;
|
|
horizontalEnabled = r->torsoHorizontalEnabled;
|
|
|
|
//
|
|
// The named skeleton joints are resolved once the Mech skeleton link is
|
|
// live (per-frame sim / phase-4 wiring); leave the handles null here.
|
|
//
|
|
horizontalJointNode = NULL;
|
|
horizontalShadowJointNode = NULL;
|
|
|
|
currentTwist = 0.0f;
|
|
currentElevation = 0.0f;
|
|
for (int i = 0; i < 24; ++i)
|
|
{
|
|
dynamicsState[i] = 0.0f;
|
|
}
|
|
|
|
Check_Fpu();
|
|
}
|
|
|
|
Torso::~Torso()
|
|
{
|
|
}
|
|
|
|
Logical
|
|
Torso::TestClass(Mech &)
|
|
{
|
|
return True;
|
|
}
|
|
|
|
Logical
|
|
Torso::TestInstance() const
|
|
{
|
|
return IsDerivedFrom(ClassDerivations);
|
|
}
|
|
|
|
//
|
|
// Per-frame torso twist / elevation integration. Not yet reconstructed.
|
|
//
|
|
void
|
|
Torso::TorsoSimulation(Scalar)
|
|
{
|
|
Fail("Torso::TorsoSimulation -- torso.cpp not yet reconstructed");
|
|
}
|
|
|
|
void
|
|
Torso::TorsoCopySimulation(Scalar)
|
|
{
|
|
Fail("Torso::TorsoCopySimulation -- torso.cpp not yet reconstructed");
|
|
}
|