Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
71 lines
1.1 KiB
C++
71 lines
1.1 KiB
C++
|
|
#include "MW4Headers.hpp"
|
|
|
|
#include "InputTrainer.hpp"
|
|
#include "VehicleInterface.hpp"
|
|
#include "Torso.hpp"
|
|
|
|
|
|
|
|
using namespace MechWarrior4;
|
|
|
|
InputTrainer* InputTrainer::m_Instance = 0;
|
|
|
|
InputTrainer* InputTrainer::GetInstance()
|
|
{
|
|
return (m_Instance);
|
|
}
|
|
|
|
InputTrainer::InputTrainer()
|
|
: m_Flags(ALL)
|
|
{
|
|
Verify(m_Instance == 0);
|
|
m_Instance = this;
|
|
}
|
|
|
|
InputTrainer::~InputTrainer()
|
|
{
|
|
Verify(m_Instance == this);
|
|
m_Instance = 0;
|
|
}
|
|
|
|
bool InputTrainer::GetEnabled(InputType t) const
|
|
{
|
|
return ((m_Flags & t) != 0);
|
|
}
|
|
|
|
void InputTrainer::SetEnabled(InputType t, bool enabled)
|
|
{
|
|
if (enabled == true)
|
|
{
|
|
m_Flags |= t;
|
|
}
|
|
else
|
|
{
|
|
m_Flags &= ~t;
|
|
}
|
|
|
|
if ((VehicleInterface::GetInstance() != 0) &&
|
|
(VehicleInterface::GetInstance()->vehicle != 0))
|
|
{
|
|
Vehicle* v = VehicleInterface::GetInstance()->vehicle;
|
|
|
|
if (GetEnabled(THROTTLE) == false)
|
|
{
|
|
v->speedDemand = 0.0f;
|
|
}
|
|
|
|
if ((GetEnabled(TORSO) == false) &&
|
|
(v->GetTorso() != 0))
|
|
{
|
|
v->GetTorso()->pitchDemand = 0.0f;
|
|
v->GetTorso()->yawDemand = 0.0f;
|
|
}
|
|
|
|
if (GetEnabled(TURN) == false)
|
|
{
|
|
v->yawDemand = 0.0f;
|
|
}
|
|
}
|
|
}
|