mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 23:19:19 +02:00
control for e-p brake system, brake acting speed, departure signal, heating, door lock. Support for rear pantograph lowering button, all pantographs lowering button. Increased recognition of converter as a valid low voltage power source.
This commit is contained in:
@@ -10,6 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "stdafx.h"
|
||||
#include "Button.h"
|
||||
#include "Console.h"
|
||||
#include "logs.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -57,6 +58,8 @@ void TButton::Load(cParser &Parser, TModel3d *pModel1, TModel3d *pModel2)
|
||||
{
|
||||
pModelOn = NULL;
|
||||
pModelOff = NULL;
|
||||
|
||||
ErrorLog( "Failed to locate sub-model \"" + token + "\" in 3d model \"" + pModel1->NameGet() + "\"" );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
27
DynObj.cpp
27
DynObj.cpp
@@ -798,7 +798,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
btnOn = true;
|
||||
}
|
||||
// else btCPass2.TurnOff();
|
||||
if (MoverParameters->Battery)
|
||||
if( ( true == MoverParameters->Battery ) || ( true == MoverParameters->ConverterFlag ) )
|
||||
{ // sygnaly konca pociagu
|
||||
if (btEndSignals1.Active())
|
||||
{
|
||||
@@ -900,10 +900,9 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
// Ra: przechyłkę załatwiamy na etapie przesuwania modelu
|
||||
// if (ObjSqrDist<80000) ABuModelRoll(); //przechyłki od 400m
|
||||
}
|
||||
if (MoverParameters->Battery)
|
||||
{ // sygnały czoła pociagu //Ra: wyświetlamy bez
|
||||
// ograniczeń odległości, by były widoczne z
|
||||
// daleka
|
||||
if( ( true == MoverParameters->Battery ) || ( true == MoverParameters->ConverterFlag ) ) {
|
||||
// sygnały czoła pociagu
|
||||
//Ra: wyświetlamy bez ograniczeń odległości, by były widoczne z daleka
|
||||
if (TestFlag(iLights[0], 1))
|
||||
{
|
||||
btHeadSignals11.TurnOn();
|
||||
@@ -986,11 +985,8 @@ TDynamicObject * TDynamicObject::ABuFindNearestObject(TTrack *Track, TDynamicObj
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TDynamicObject * TDynamicObject::ABuScanNearestObject(TTrack *Track, double ScanDir,
|
||||
double ScanDist, int &CouplNr)
|
||||
{ // skanowanie toru w poszukiwaniu obiektu najblizszego
|
||||
// kamerze
|
||||
// double MyScanDir=ScanDir; //Moja orientacja na torze. //Ra: nie używane
|
||||
TDynamicObject * TDynamicObject::ABuScanNearestObject(TTrack *Track, double ScanDir, double ScanDist, int &CouplNr)
|
||||
{ // skanowanie toru w poszukiwaniu obiektu najblizszego kamerze
|
||||
if (ABuGetDirection() < 0)
|
||||
ScanDir = -ScanDir;
|
||||
TDynamicObject *FoundedObj;
|
||||
@@ -2914,11 +2910,12 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
|
||||
// fragment "z EXE Kursa"
|
||||
if (MoverParameters->Mains) // nie wchodzić w funkcję bez potrzeby
|
||||
if ((!MoverParameters->Battery) && (Controller == Humandriver) &&
|
||||
(MoverParameters->EngineType != DieselEngine) &&
|
||||
(MoverParameters->EngineType != WheelsDriven))
|
||||
{ // jeśli bateria wyłączona, a nie diesel ani drezyna
|
||||
// reczna
|
||||
if ( ( false == MoverParameters->Battery)
|
||||
&& ( false == MoverParameters->ConverterFlag ) // added alternative power source. TODO: more generic power check
|
||||
&& ( Controller == Humandriver)
|
||||
&& ( MoverParameters->EngineType != DieselEngine )
|
||||
&& ( MoverParameters->EngineType != WheelsDriven ) )
|
||||
{ // jeśli bateria wyłączona, a nie diesel ani drezyna reczna
|
||||
if (MoverParameters->MainSwitch(false)) // wyłączyć zasilanie
|
||||
MoverParameters->EventFlag = true;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,10 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Gauge.h"
|
||||
#include "Timer.h"
|
||||
#include "parser.h"
|
||||
#include "Model3d.h"
|
||||
#include "Timer.h"
|
||||
#include "logs.h"
|
||||
|
||||
TGauge::TGauge()
|
||||
{
|
||||
@@ -90,6 +91,10 @@ bool TGauge::Load(cParser &Parser, TModel3d *md1, TModel3d *md2, double mul)
|
||||
md2 = NULL; // informacja, że znaleziony
|
||||
else if (md2) // a jest podany drugi model (np. zewnętrzny)
|
||||
sm = md2->GetFromName(str1.c_str()); // to może tam będzie, co za różnica gdzie
|
||||
if( sm == nullptr ) {
|
||||
ErrorLog( "Failed to locate sub-model \"" + str1 + "\" in 3d model \"" + md1->NameGet() + "\"" );
|
||||
}
|
||||
|
||||
if (str2 == "mov")
|
||||
Init(sm, gt_Move, val3, val4, val5);
|
||||
else if (str2 == "wip")
|
||||
|
||||
@@ -107,6 +107,7 @@ int Global::iHiddenEvents = 1; // czy łączyć eventy z torami poprzez nazwę t
|
||||
|
||||
// parametry użytkowe (jak komu pasuje)
|
||||
int Global::Keys[MaxKeys];
|
||||
bool Global::RealisticControlMode{ false };
|
||||
int Global::iWindowWidth = 800;
|
||||
int Global::iWindowHeight = 600;
|
||||
float Global::fDistanceFactor = Global::ScreenHeight / 768.0; // baza do przeliczania odległości dla LoD
|
||||
|
||||
@@ -166,6 +166,7 @@ class Global
|
||||
public:
|
||||
// double Global::tSinceStart;
|
||||
static int Keys[MaxKeys];
|
||||
static bool RealisticControlMode; // controls ability to steer the vehicle from outside views
|
||||
static Math3D::vector3 pCameraPosition; // pozycja kamery w świecie
|
||||
static double
|
||||
pCameraRotation; // kierunek bezwzględny kamery w świecie: 0=północ, 90°=zachód (-azymut)
|
||||
@@ -207,10 +208,7 @@ class Global
|
||||
static std::string asHumanCtrlVehicle;
|
||||
static void LoadIniFile(std::string asFileName);
|
||||
static void InitKeys();
|
||||
inline static Math3D::vector3 GetCameraPosition()
|
||||
{
|
||||
return pCameraPosition;
|
||||
};
|
||||
inline static Math3D::vector3 GetCameraPosition() { return pCameraPosition; };
|
||||
static void SetCameraPosition(Math3D::vector3 pNewCameraPosition);
|
||||
static void SetCameraRotation(double Yaw);
|
||||
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
||||
|
||||
@@ -4956,48 +4956,37 @@ bool TMoverParameters::AutoRelayCheck(void)
|
||||
|
||||
// *************************************************************************************************
|
||||
// Q: 20160713
|
||||
// Podnosi / opuszcza przedni pantograf
|
||||
// Podnosi / opuszcza przedni pantograf. Returns: state of the pantograph after the operation
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::PantFront(bool State)
|
||||
{
|
||||
double pf1 = 0;
|
||||
bool PF = false;
|
||||
if( ( true == Battery )
|
||||
|| ( true == ConverterFlag ) ) {
|
||||
|
||||
if ((Battery ==
|
||||
true) /* and ((TrainType<>dt_ET40)or ((TrainType=dt_ET40) and (EnginePowerSource.CollectorsNo>1)))*/)
|
||||
{
|
||||
PF = true;
|
||||
if (State == true)
|
||||
pf1 = 1;
|
||||
else
|
||||
pf1 = 0;
|
||||
if (PantFrontUp != State)
|
||||
{
|
||||
if( PantFrontUp != State ) {
|
||||
PantFrontUp = State;
|
||||
if (State == true)
|
||||
{
|
||||
if( State == true ) {
|
||||
PantFrontStart = 0;
|
||||
SendCtrlToNext("PantFront", 1, CabNo);
|
||||
SendCtrlToNext( "PantFront", 1, CabNo );
|
||||
}
|
||||
else
|
||||
{
|
||||
PF = false;
|
||||
else {
|
||||
PantFrontStart = 1;
|
||||
SendCtrlToNext("PantFront", 0, CabNo);
|
||||
//{Ra: nie ma potrzeby opuszczać obydwu na raz, jak mozemy każdy osobno
|
||||
// if (TrainType == dt_EZT) && (ActiveCab == 1)
|
||||
// {
|
||||
// PantRearUp = false;
|
||||
// PantRearStart = 1;
|
||||
// SendCtrlToNext("PantRear", 0, CabNo);
|
||||
// }
|
||||
//}
|
||||
SendCtrlToNext( "PantFront", 0, CabNo );
|
||||
}
|
||||
}
|
||||
else
|
||||
SendCtrlToNext("PantFront", pf1, CabNo);
|
||||
}
|
||||
return PF;
|
||||
else {
|
||||
// no power, drop the pantograph
|
||||
// NOTE: this is a simplification as it should just drop on its own with loss of pressure without resupply from (dead) compressor
|
||||
PantFrontStart = (
|
||||
PantFrontUp ?
|
||||
1 :
|
||||
0 );
|
||||
PantFrontUp = false;
|
||||
SendCtrlToNext( "PantFront", 0, CabNo );
|
||||
}
|
||||
|
||||
return PantFrontUp;
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
@@ -5006,35 +4995,33 @@ bool TMoverParameters::PantFront(bool State)
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::PantRear(bool State)
|
||||
{
|
||||
double pf1;
|
||||
bool PR = false;
|
||||
if( ( true == Battery )
|
||||
|| ( true == ConverterFlag ) ) {
|
||||
|
||||
if (Battery == true)
|
||||
{
|
||||
PR = true;
|
||||
if (State == true)
|
||||
pf1 = 1;
|
||||
else
|
||||
pf1 = 0;
|
||||
if (PantRearUp != State)
|
||||
{
|
||||
if( PantRearUp != State ) {
|
||||
PantRearUp = State;
|
||||
if (State == true)
|
||||
{
|
||||
if( State == true ) {
|
||||
PantRearStart = 0;
|
||||
SendCtrlToNext("PantRear", 1, CabNo);
|
||||
SendCtrlToNext( "PantRear", 1, CabNo );
|
||||
}
|
||||
else
|
||||
{
|
||||
PR = false;
|
||||
else {
|
||||
PantRearStart = 1;
|
||||
SendCtrlToNext("PantRear", 0, CabNo);
|
||||
SendCtrlToNext( "PantRear", 0, CabNo );
|
||||
}
|
||||
}
|
||||
else
|
||||
SendCtrlToNext("PantRear", pf1, CabNo);
|
||||
}
|
||||
return PR;
|
||||
else {
|
||||
// no power, drop the pantograph
|
||||
// NOTE: this is a simplification as it should just drop on its own with loss of pressure without resupply from (dead) compressor
|
||||
PantRearStart = (
|
||||
PantRearUp ?
|
||||
1 :
|
||||
0 );
|
||||
PantRearUp = false;
|
||||
SendCtrlToNext( "PantRear", 0, CabNo );
|
||||
}
|
||||
|
||||
return PantRearUp;
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
@@ -45,7 +45,6 @@ static int const bdelay_G = 1; //G
|
||||
static int const bdelay_P = 2; //P
|
||||
static int const bdelay_R = 4; //R
|
||||
static int const bdelay_M = 8; //Mg
|
||||
static int const bdelay_GR = 128; //G-R
|
||||
|
||||
|
||||
/*stan hamulca*/
|
||||
|
||||
14
Model3d.cpp
14
Model3d.cpp
@@ -1649,15 +1649,21 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
|
||||
LoadFromBinFile(asBinary, dynamic);
|
||||
asBinary = ""; // wyłączenie zapisu
|
||||
Init();
|
||||
}
|
||||
// cache the file name, in case someone wants it later
|
||||
m_filename = name + ".e3d";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FileExists(name + ".t3d"))
|
||||
{
|
||||
LoadFromTextFile(FileName, dynamic); // wczytanie tekstowego
|
||||
if (!dynamic) // pojazdy dopiero po ustawieniu animacji
|
||||
Init(); // generowanie siatek i zapis E3D
|
||||
}
|
||||
if( !dynamic ) {
|
||||
// pojazdy dopiero po ustawieniu animacji
|
||||
Init(); // generowanie siatek i zapis E3D
|
||||
}
|
||||
// cache the file name, in case someone wants it later
|
||||
m_filename = name + ".t3d";
|
||||
}
|
||||
}
|
||||
bool const result =
|
||||
Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem
|
||||
|
||||
@@ -342,6 +342,7 @@ private:
|
||||
int *iModel; // zawartość pliku binarnego
|
||||
int iSubModelsCount; // Ra: używane do tworzenia binarnych
|
||||
std::string asBinary; // nazwa pod którą zapisać model binarny
|
||||
std::string m_filename;
|
||||
public:
|
||||
inline TSubModel * GetSMRoot()
|
||||
{
|
||||
@@ -382,7 +383,8 @@ public:
|
||||
void Init();
|
||||
std::string NameGet()
|
||||
{
|
||||
return Root ? Root->pName : NULL;
|
||||
// return Root ? Root->pName : NULL;
|
||||
return m_filename;
|
||||
};
|
||||
int TerrainCount();
|
||||
TSubModel * TerrainSquare(int n);
|
||||
|
||||
31
Timer.cpp
31
Timer.cpp
@@ -15,12 +15,12 @@ namespace Timer
|
||||
{
|
||||
|
||||
double DeltaTime, DeltaRenderTime;
|
||||
double fFPS = 0.0f;
|
||||
double fLastTime = 0.0f;
|
||||
DWORD dwFrames = 0L;
|
||||
double fSimulationTime = 0;
|
||||
double fSoundTimer = 0;
|
||||
double fSinceStart = 0;
|
||||
double fFPS{ 0.0f };
|
||||
double fLastTime{ 0.0f };
|
||||
DWORD dwFrames{ 0 };
|
||||
double fSimulationTime{ 0.0 };
|
||||
double fSoundTimer{ 0.0 };
|
||||
double fSinceStart{ 0.0 };
|
||||
|
||||
double GetTime()
|
||||
{
|
||||
@@ -69,15 +69,10 @@ double GetFPS()
|
||||
|
||||
void ResetTimers()
|
||||
{
|
||||
// double CurrentTime=
|
||||
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
::GetTickCount64();
|
||||
#else
|
||||
::GetTickCount();
|
||||
#endif
|
||||
UpdateTimers( Global::iPause != 0 );
|
||||
DeltaTime = 0.1;
|
||||
DeltaRenderTime = 0;
|
||||
fSoundTimer = 0;
|
||||
DeltaRenderTime = 0.0;
|
||||
fSoundTimer = 0.0;
|
||||
};
|
||||
|
||||
LONGLONG fr, count, oldCount;
|
||||
@@ -92,17 +87,17 @@ void UpdateTimers(bool pause)
|
||||
DeltaTime = Global::fTimeSpeed * DeltaRenderTime;
|
||||
fSoundTimer += DeltaTime;
|
||||
if (fSoundTimer > 0.1)
|
||||
fSoundTimer = 0;
|
||||
fSoundTimer = 0.0;
|
||||
/*
|
||||
double CurrentTime= double(count)/double(fr);//GetTickCount();
|
||||
DeltaTime= (CurrentTime-OldTime);
|
||||
OldTime= CurrentTime;
|
||||
*/
|
||||
if (DeltaTime > 1)
|
||||
DeltaTime = 1;
|
||||
if (DeltaTime > 1.0)
|
||||
DeltaTime = 1.0;
|
||||
}
|
||||
else
|
||||
DeltaTime = 0; // wszystko stoi, bo czas nie płynie
|
||||
DeltaTime = 0.0; // wszystko stoi, bo czas nie płynie
|
||||
oldCount = count;
|
||||
|
||||
// Keep track of the time lapse and frame count
|
||||
|
||||
9
Train.h
9
Train.h
@@ -119,6 +119,7 @@ class TTrain
|
||||
static void OnCommand_secondcontrollerincreasefast( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_secondcontrollerdecrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_notchingrelaytoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_independentbrakeincrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_independentbrakeincreasefast( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_independentbrakedecrease( TTrain *Train, command_data const &Command );
|
||||
@@ -132,16 +133,21 @@ class TTrain
|
||||
static void OnCommand_trainbrakeservice( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_trainbrakefullservice( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_trainbrakeemergency( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_brakeactingspeedincrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_brakeactingspeeddecrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_reverserincrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_reverserdecrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_alerteracknowledge( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_batterytoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_pantographtogglefront( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_pantographtogglerear( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_pantographlowerall( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_linebreakertoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_convertertoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_compressortoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_heatingtoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_headlighttoggleleft( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_headlighttoggleright( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_headlighttoggleupper( TTrain *Train, command_data const &Command );
|
||||
@@ -154,6 +160,8 @@ class TTrain
|
||||
static void OnCommand_redmarkertogglerearright( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_doortoggleleft( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_doortoggleright( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_departureannounce( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_doorlocktoggle( TTrain *Train, command_data const &Command );
|
||||
|
||||
// members
|
||||
TDynamicObject *DynamicObject; // przestawia zmiana pojazdu [F5]
|
||||
@@ -258,6 +266,7 @@ public: // reszta może by?publiczna
|
||||
TGauge ggPantFrontButton;
|
||||
TGauge ggPantRearButton;
|
||||
TGauge ggPantFrontButtonOff; // EZT
|
||||
TGauge ggPantRearButtonOff;
|
||||
TGauge ggPantAllDownButton;
|
||||
// Winger 020304 - wlacznik ogrzewania
|
||||
TGauge ggTrainHeatingButton;
|
||||
|
||||
356
command.cpp
356
command.cpp
@@ -17,6 +17,116 @@ http://mozilla.org/MPL/2.0/.
|
||||
namespace simulation {
|
||||
|
||||
command_queue Commands;
|
||||
commanddescription_sequence Commands_descriptions = {
|
||||
|
||||
{ "mastercontrollerincrease", command_target::vehicle },
|
||||
{ "mastercontrollerincreasefast", command_target::vehicle },
|
||||
{ "mastercontrollerdecrease", command_target::vehicle },
|
||||
{ "mastercontrollerdecreasefast", command_target::vehicle },
|
||||
{ "secondcontrollerincrease", command_target::vehicle },
|
||||
{ "secondcontrollerincreasefast", command_target::vehicle },
|
||||
{ "secondcontrollerdecrease", command_target::vehicle },
|
||||
{ "secondcontrollerdecreasefast", command_target::vehicle },
|
||||
{ "independentbrakeincrease", command_target::vehicle },
|
||||
{ "independentbrakeincreasefast", command_target::vehicle },
|
||||
{ "independentbrakedecrease", command_target::vehicle },
|
||||
{ "independentbrakedecreasefast", command_target::vehicle },
|
||||
{ "independentbrakebailoff", command_target::vehicle },
|
||||
{ "trainbrakeincrease", command_target::vehicle },
|
||||
{ "trainbrakedecrease", command_target::vehicle },
|
||||
{ "trainbrakecharging", command_target::vehicle },
|
||||
{ "trainbrakerelease", command_target::vehicle },
|
||||
{ "trainbrakefirstservice", command_target::vehicle },
|
||||
{ "trainbrakeservice", command_target::vehicle },
|
||||
{ "trainbrakefullservice", command_target::vehicle },
|
||||
{ "trainbrakeemergency", command_target::vehicle },
|
||||
/*
|
||||
const int k_AntiSlipping = 21;
|
||||
const int k_Sand = 22;
|
||||
*/
|
||||
{ "reverserincrease", command_target::vehicle },
|
||||
{ "reverserdecrease", command_target::vehicle },
|
||||
{ "linebreakertoggle", command_target::vehicle },
|
||||
/*
|
||||
const int k_Fuse = 26;
|
||||
*/
|
||||
{ "convertertoggle", command_target::vehicle },
|
||||
{ "compressortoggle", command_target::vehicle },
|
||||
{ "motoroverloadrelaythresholdtoggle", command_target::vehicle },
|
||||
{ "notchingrelaytoggle", command_target::vehicle },
|
||||
{ "epbrakecontroltoggle", command_target::vehicle },
|
||||
{ "brakeactingspeedincrease", command_target::vehicle },
|
||||
{ "brakeactingspeeddecrease", command_target::vehicle },
|
||||
/*
|
||||
const int k_BrakeProfile = 31;
|
||||
*/
|
||||
{ "alerteracknowledge", command_target::vehicle },
|
||||
/*
|
||||
const int k_Horn = 33;
|
||||
const int k_Horn2 = 34;
|
||||
const int k_FailedEngineCutOff = 35;
|
||||
*/
|
||||
{ "viewturn", command_target::entity },
|
||||
{ "movevector", command_target::entity },
|
||||
{ "moveleft", command_target::entity },
|
||||
{ "moveright", command_target::entity },
|
||||
{ "moveforward", command_target::entity },
|
||||
{ "moveback", command_target::entity },
|
||||
{ "moveup", command_target::entity },
|
||||
{ "movedown", command_target::entity },
|
||||
{ "moveleftfast", command_target::entity },
|
||||
{ "moverightfast", command_target::entity },
|
||||
{ "moveforwardfast", command_target::entity },
|
||||
{ "movebackfast", command_target::entity },
|
||||
{ "moveupfast", command_target::entity },
|
||||
{ "movedownfast", command_target::entity },
|
||||
/*
|
||||
const int k_CabForward = 42;
|
||||
const int k_CabBackward = 43;
|
||||
const int k_Couple = 44;
|
||||
const int k_DeCouple = 45;
|
||||
const int k_ProgramQuit = 46;
|
||||
// const int k_ProgramPause= 47;
|
||||
const int k_ProgramHelp = 48;
|
||||
*/
|
||||
{ "doortoggleleft", command_target::vehicle },
|
||||
{ "doortoggleright", command_target::vehicle },
|
||||
{ "departureannounce", command_target::vehicle },
|
||||
{ "doorlocktoggle", command_target::vehicle },
|
||||
{ "pantographtogglefront", command_target::vehicle },
|
||||
{ "pantographtogglerear", command_target::vehicle },
|
||||
{ "pantographlowerall", command_target::vehicle },
|
||||
{ "heatingtoggle", command_target::vehicle },
|
||||
/*
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
{ "headlighttoggleleft", command_target::vehicle },
|
||||
{ "headlighttoggleright", command_target::vehicle },
|
||||
{ "headlighttoggleupper", command_target::vehicle },
|
||||
{ "redmarkertoggleleft", command_target::vehicle },
|
||||
{ "redmarkertoggleright", command_target::vehicle },
|
||||
{ "headlighttogglerearleft", command_target::vehicle },
|
||||
{ "headlighttogglerearright", command_target::vehicle },
|
||||
{ "headlighttogglerearupper", command_target::vehicle },
|
||||
{ "redmarkertogglerearleft", command_target::vehicle },
|
||||
{ "redmarkertogglerearright", command_target::vehicle },
|
||||
/*
|
||||
const int k_SmallCompressor = 63;
|
||||
const int k_StLinOff = 64;
|
||||
const int k_CurrentNext = 65;
|
||||
const int k_Univ1 = 66;
|
||||
const int k_Univ2 = 67;
|
||||
const int k_Univ3 = 68;
|
||||
const int k_Univ4 = 69;
|
||||
const int k_EndSign = 70;
|
||||
const int k_Active = 71;
|
||||
*/
|
||||
{ "batterytoggle", command_target::vehicle }
|
||||
/*
|
||||
const int k_WalkMode = 73;
|
||||
int const k_DimHeadlights = 74;
|
||||
*/
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -50,242 +160,15 @@ command_queue::pop( command_data &Command, std::size_t const Recipient ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
command_relay::command_relay() {
|
||||
|
||||
m_targets = commandtarget_map{
|
||||
|
||||
{ user_command::mastercontrollerincrease, command_target::vehicle },
|
||||
{ user_command::mastercontrollerincreasefast, command_target::vehicle },
|
||||
{ user_command::mastercontrollerdecrease, command_target::vehicle },
|
||||
{ user_command::mastercontrollerdecreasefast, command_target::vehicle },
|
||||
{ user_command::secondcontrollerincrease, command_target::vehicle },
|
||||
{ user_command::secondcontrollerincreasefast, command_target::vehicle },
|
||||
{ user_command::secondcontrollerdecrease, command_target::vehicle },
|
||||
{ user_command::secondcontrollerdecreasefast, command_target::vehicle },
|
||||
{ user_command::independentbrakeincrease, command_target::vehicle },
|
||||
{ user_command::independentbrakeincreasefast, command_target::vehicle },
|
||||
{ user_command::independentbrakedecrease, command_target::vehicle },
|
||||
{ user_command::independentbrakedecreasefast, command_target::vehicle },
|
||||
{ user_command::independentbrakebailoff, command_target::vehicle },
|
||||
{ user_command::trainbrakeincrease, command_target::vehicle },
|
||||
{ user_command::trainbrakedecrease, command_target::vehicle },
|
||||
{ user_command::trainbrakecharging, command_target::vehicle },
|
||||
{ user_command::trainbrakerelease, command_target::vehicle },
|
||||
{ user_command::trainbrakefirstservice, command_target::vehicle },
|
||||
{ user_command::trainbrakeservice, command_target::vehicle },
|
||||
{ user_command::trainbrakefullservice, command_target::vehicle },
|
||||
{ user_command::trainbrakeemergency, command_target::vehicle },
|
||||
/*
|
||||
const int k_AntiSlipping = 21;
|
||||
const int k_Sand = 22;
|
||||
*/
|
||||
{ user_command::reverserincrease, command_target::vehicle },
|
||||
{ user_command::reverserdecrease, command_target::vehicle },
|
||||
{ user_command::linebreakertoggle, command_target::vehicle },
|
||||
/*
|
||||
const int k_Fuse = 26;
|
||||
*/
|
||||
{ user_command::convertertoggle, command_target::vehicle },
|
||||
{ user_command::compressortoggle, command_target::vehicle },
|
||||
{ user_command::motoroverloadrelaythresholdtoggle, command_target::vehicle },
|
||||
/*
|
||||
const int k_CurrentAutoRelay = 30;
|
||||
const int k_BrakeProfile = 31;
|
||||
*/
|
||||
{ user_command::alerteracknowledge, command_target::vehicle },
|
||||
/*
|
||||
const int k_Czuwak = 32;
|
||||
const int k_Horn = 33;
|
||||
const int k_Horn2 = 34;
|
||||
const int k_FailedEngineCutOff = 35;
|
||||
*/
|
||||
{ user_command::viewturn, command_target::entity },
|
||||
{ user_command::movevector, command_target::entity },
|
||||
{ user_command::moveleft, command_target::entity },
|
||||
{ user_command::moveright, command_target::entity },
|
||||
{ user_command::moveforward, command_target::entity },
|
||||
{ user_command::moveback, command_target::entity },
|
||||
{ user_command::moveup, command_target::entity },
|
||||
{ user_command::movedown, command_target::entity },
|
||||
{ user_command::moveleftfast, command_target::entity },
|
||||
{ user_command::moverightfast, command_target::entity },
|
||||
{ user_command::moveforwardfast, command_target::entity },
|
||||
{ user_command::movebackfast, command_target::entity },
|
||||
{ user_command::moveupfast, command_target::entity },
|
||||
{ user_command::movedownfast, command_target::entity },
|
||||
/*
|
||||
const int k_CabForward = 42;
|
||||
const int k_CabBackward = 43;
|
||||
const int k_Couple = 44;
|
||||
const int k_DeCouple = 45;
|
||||
const int k_ProgramQuit = 46;
|
||||
// const int k_ProgramPause= 47;
|
||||
const int k_ProgramHelp = 48;
|
||||
*/
|
||||
{ user_command::doortoggleleft, command_target::vehicle },
|
||||
{ user_command::doortoggleright, command_target::vehicle },
|
||||
/*
|
||||
const int k_DepartureSignal = 53;
|
||||
*/
|
||||
{ user_command::pantographtogglefront, command_target::vehicle },
|
||||
{ user_command::pantographtogglerear, command_target::vehicle },
|
||||
/*
|
||||
const int k_Heating = 58;
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
{ user_command::headlighttoggleleft, command_target::vehicle },
|
||||
{ user_command::headlighttoggleright, command_target::vehicle },
|
||||
{ user_command::headlighttoggleupper, command_target::vehicle },
|
||||
{ user_command::redmarkertoggleleft, command_target::vehicle },
|
||||
{ user_command::redmarkertoggleright, command_target::vehicle },
|
||||
{ user_command::headlighttogglerearleft, command_target::vehicle },
|
||||
{ user_command::headlighttogglerearright, command_target::vehicle },
|
||||
{ user_command::headlighttogglerearupper, command_target::vehicle },
|
||||
{ user_command::redmarkertogglerearleft, command_target::vehicle },
|
||||
{ user_command::redmarkertogglerearright, command_target::vehicle },
|
||||
/*
|
||||
const int k_SmallCompressor = 63;
|
||||
const int k_StLinOff = 64;
|
||||
const int k_CurrentNext = 65;
|
||||
const int k_Univ1 = 66;
|
||||
const int k_Univ2 = 67;
|
||||
const int k_Univ3 = 68;
|
||||
const int k_Univ4 = 69;
|
||||
const int k_EndSign = 70;
|
||||
const int k_Active = 71;
|
||||
*/
|
||||
{ user_command::batterytoggle, command_target::vehicle }
|
||||
/*
|
||||
const int k_WalkMode = 73;
|
||||
int const k_DimHeadlights = 74;
|
||||
*/
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
m_commandnames = {
|
||||
|
||||
"mastercontrollerincrease",
|
||||
"mastercontrollerincreasefast",
|
||||
"mastercontrollerdecrease",
|
||||
"mastercontrollerdecreasefast",
|
||||
"secondcontrollerincrease",
|
||||
"secondcontrollerincreasefast",
|
||||
"secondcontrollerdecrease",
|
||||
"secondcontrollerdecreasefast",
|
||||
"independentbrakeincrease",
|
||||
"independentbrakeincreasefast",
|
||||
"independentbrakedecrease",
|
||||
"independentbrakedecreasefast",
|
||||
"independentbrakebailoff",
|
||||
"trainbrakeincrease",
|
||||
"trainbrakedecrease",
|
||||
"trainbrakecharging",
|
||||
"trainbrakerelease",
|
||||
"trainbrakefirstservice",
|
||||
"trainbrakeservice",
|
||||
"trainbrakefullservice",
|
||||
"trainbrakeemergency",
|
||||
/*
|
||||
const int k_AntiSlipping = 21;
|
||||
const int k_Sand = 22;
|
||||
*/
|
||||
"reverserincrease",
|
||||
"reverserdecrease",
|
||||
"linebreakertoggle",
|
||||
/*
|
||||
const int k_Fuse = 26;
|
||||
*/
|
||||
"convertertoggle",
|
||||
"compressortoggle",
|
||||
"motoroverloadrelaythresholdtoggle",
|
||||
/*
|
||||
const int k_MaxCurrent = 29;
|
||||
const int k_CurrentAutoRelay = 30;
|
||||
const int k_BrakeProfile = 31;
|
||||
*/
|
||||
"alerteracknowledge",
|
||||
/*
|
||||
const int k_Czuwak = 32;
|
||||
const int k_Horn = 33;
|
||||
const int k_Horn2 = 34;
|
||||
const int k_FailedEngineCutOff = 35;
|
||||
*/
|
||||
"", //"viewturn",
|
||||
"", //"movevector",
|
||||
"", //"moveleft",
|
||||
"", //"moveright",
|
||||
"", //"moveforward",
|
||||
"", //"moveback",
|
||||
"", //"moveup",
|
||||
"", //"movedown",
|
||||
"", //"moveleftfast",
|
||||
"", //"moverightfast",
|
||||
"", //"moveforwardfast",
|
||||
"", //"movebackfast",
|
||||
"", //"moveupfast",
|
||||
"", //"movedownfast"
|
||||
/*
|
||||
const int k_CabForward = 42;
|
||||
const int k_CabBackward = 43;
|
||||
const int k_Couple = 44;
|
||||
const int k_DeCouple = 45;
|
||||
const int k_ProgramQuit = 46;
|
||||
// const int k_ProgramPause= 47;
|
||||
const int k_ProgramHelp = 48;
|
||||
*/
|
||||
"doortoggleleft",
|
||||
"doortoggleright",
|
||||
/*
|
||||
const int k_DepartureSignal = 53;
|
||||
*/
|
||||
"pantographtogglefront",
|
||||
"pantographtogglerear",
|
||||
/*
|
||||
const int k_Heating = 58;
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
"headlighttoggleleft",
|
||||
"headlighttoggleright",
|
||||
"headlighttoggleupper",
|
||||
"redmarkertoggleleft",
|
||||
"redmarkertoggleright",
|
||||
"headlighttogglerearleft",
|
||||
"headlighttogglerearright",
|
||||
"headlighttogglerearupper",
|
||||
"redmarkertogglerearleft",
|
||||
"redmarkertogglerearright",
|
||||
/*
|
||||
const int k_SmallCompressor = 63;
|
||||
const int k_StLinOff = 64;
|
||||
const int k_CurrentNext = 65;
|
||||
const int k_Univ1 = 66;
|
||||
const int k_Univ2 = 67;
|
||||
const int k_Univ3 = 68;
|
||||
const int k_Univ4 = 69;
|
||||
const int k_EndSign = 70;
|
||||
const int k_Active = 71;
|
||||
*/
|
||||
"batterytoggle"
|
||||
/*
|
||||
const int k_WalkMode = 73;
|
||||
int const k_DimHeadlights = 74;
|
||||
*/
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
command_relay::post( user_command const Command, std::uint64_t const Param1, std::uint64_t const Param2, int const Action, std::uint16_t const Recipient ) const {
|
||||
|
||||
auto const &lookup = m_targets.find( Command );
|
||||
if( lookup == m_targets.end() ) {
|
||||
// shouldn't be really needed but, eh
|
||||
return;
|
||||
}
|
||||
if( ( lookup->second == command_target::vehicle )
|
||||
auto const &command = simulation::Commands_descriptions[ static_cast<std::size_t>( Command ) ];
|
||||
if( ( command.target == command_target::vehicle )
|
||||
&& ( true == FreeFlyModeFlag )
|
||||
&& ( false == DebugModeFlag ) ) {
|
||||
// don't pass vehicle commands if the user isn't in one, unless we're in debug mode
|
||||
&& ( ( false == DebugModeFlag )
|
||||
&& ( true == Global::RealisticControlMode ) ) ) {
|
||||
// in realistic control mode don't pass vehicle commands if the user isn't in one, unless we're in debug mode
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -296,20 +179,19 @@ command_relay::post( user_command const Command, std::uint64_t const Param1, std
|
||||
Param1,
|
||||
Param2,
|
||||
Timer::GetDeltaTime() },
|
||||
static_cast<std::size_t>( lookup->second ) | Recipient );
|
||||
static_cast<std::size_t>( command.target ) | Recipient );
|
||||
|
||||
#ifdef _DEBUG
|
||||
if( Action != GLFW_RELEASE ) {
|
||||
// key was pressed or is still held
|
||||
auto const &commandname = m_commandnames.at( static_cast<std::size_t>( Command ) );
|
||||
if( false == commandname.empty() ) {
|
||||
WriteLog( "Command issued: " + commandname );
|
||||
if( false == command.name.empty() ) {
|
||||
WriteLog( "Command issued: " + command.name );
|
||||
}
|
||||
}
|
||||
/*
|
||||
else {
|
||||
// key was released (but we don't log this)
|
||||
WriteLog( "Key released: " + m_commandnames.at( static_cast<std::size_t>( Command ) ) );
|
||||
WriteLog( "Key released: " + m_command.name );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
35
command.h
35
command.h
@@ -48,11 +48,10 @@ const int k_Fuse = 26;
|
||||
convertertoggle,
|
||||
compressortoggle,
|
||||
motoroverloadrelaythresholdtoggle,
|
||||
/*
|
||||
const int k_MaxCurrent = 29;
|
||||
const int k_CurrentAutoRelay = 30;
|
||||
const int k_BrakeProfile = 31;
|
||||
*/
|
||||
notchingrelaytoggle,
|
||||
epbrakecontroltoggle,
|
||||
brakeactingspeedincrease,
|
||||
brakeactingspeeddecrease,
|
||||
alerteracknowledge,
|
||||
/*
|
||||
const int k_Horn = 33;
|
||||
@@ -84,13 +83,13 @@ const int k_ProgramHelp = 48;
|
||||
*/
|
||||
doortoggleleft,
|
||||
doortoggleright,
|
||||
/*
|
||||
const int k_DepartureSignal = 53;
|
||||
*/
|
||||
departureannounce,
|
||||
doorlocktoggle,
|
||||
pantographtogglefront,
|
||||
pantographtogglerear,
|
||||
pantographlowerall,
|
||||
heatingtoggle,
|
||||
/*
|
||||
const int k_Heating = 58;
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
headlighttoggleleft,
|
||||
@@ -103,7 +102,7 @@ const int k_Heating = 58;
|
||||
headlighttogglerearupper,
|
||||
redmarkertogglerearleft,
|
||||
redmarkertogglerearright,
|
||||
/*
|
||||
/*
|
||||
const int k_SmallCompressor = 63;
|
||||
const int k_StLinOff = 64;
|
||||
const int k_CurrentNext = 65;
|
||||
@@ -137,6 +136,14 @@ enum class command_target {
|
||||
entity = 0x40000
|
||||
};
|
||||
|
||||
struct command_description {
|
||||
|
||||
std::string name;
|
||||
command_target target;
|
||||
};
|
||||
|
||||
typedef std::vector<command_description> commanddescription_sequence;
|
||||
|
||||
struct command_data {
|
||||
|
||||
user_command command;
|
||||
@@ -175,6 +182,8 @@ private:
|
||||
namespace simulation {
|
||||
|
||||
extern command_queue Commands;
|
||||
// TODO: add name to command map, and wrap these two into helper object
|
||||
extern commanddescription_sequence Commands_descriptions;
|
||||
|
||||
}
|
||||
|
||||
@@ -184,7 +193,6 @@ class command_relay {
|
||||
|
||||
public:
|
||||
// constructors
|
||||
command_relay();
|
||||
// methods
|
||||
// posts specified command for the specified recipient
|
||||
// TODO: replace uint16_t with recipient handle, based on item id
|
||||
@@ -192,12 +200,7 @@ public:
|
||||
post( user_command const Command, std::uint64_t const Param1, std::uint64_t const Param2, int const Action, std::uint16_t const Recipient ) const;
|
||||
private:
|
||||
// types
|
||||
typedef std::unordered_map<user_command, command_target> commandtarget_map;
|
||||
// members
|
||||
commandtarget_map m_targets;
|
||||
#ifdef _DEBUG
|
||||
std::vector<std::string> m_commandnames;
|
||||
#endif
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -92,65 +92,113 @@ void
|
||||
keyboard_input::default_bindings() {
|
||||
|
||||
m_commands = {
|
||||
|
||||
{ "mastercontrollerincrease", command_target::vehicle, GLFW_KEY_KP_ADD },
|
||||
{ "mastercontrollerincreasefast", command_target::vehicle, GLFW_KEY_KP_ADD | keymodifier::shift },
|
||||
{ "mastercontrollerdecrease", command_target::vehicle, GLFW_KEY_KP_SUBTRACT },
|
||||
{ "mastercontrollerdecreasefast", command_target::vehicle, GLFW_KEY_KP_SUBTRACT | keymodifier::shift },
|
||||
{ "secondcontrollerincrease", command_target::vehicle, GLFW_KEY_KP_DIVIDE },
|
||||
{ "secondcontrollerincreasefast", command_target::vehicle, GLFW_KEY_KP_DIVIDE | keymodifier::shift },
|
||||
{ "secondcontrollerdecrease", command_target::vehicle, GLFW_KEY_KP_MULTIPLY },
|
||||
{ "secondcontrollerdecreasefast", command_target::vehicle, GLFW_KEY_KP_MULTIPLY | keymodifier::shift },
|
||||
{ "independentbrakeincrease", command_target::vehicle, GLFW_KEY_KP_1 },
|
||||
{ "independentbrakeincreasefast", command_target::vehicle, GLFW_KEY_KP_1 | keymodifier::shift },
|
||||
{ "independentbrakedecrease", command_target::vehicle, GLFW_KEY_KP_7 },
|
||||
{ "independentbrakedecreasefast", command_target::vehicle, GLFW_KEY_KP_7 | keymodifier::shift },
|
||||
{ "independentbrakebailoff", command_target::vehicle, GLFW_KEY_KP_4 },
|
||||
{ "trainbrakeincrease", command_target::vehicle, GLFW_KEY_KP_3 },
|
||||
{ "trainbrakedecrease", command_target::vehicle, GLFW_KEY_KP_9 },
|
||||
{ "trainbrakecharging", command_target::vehicle, GLFW_KEY_KP_DECIMAL },
|
||||
{ "trainbrakerelease", command_target::vehicle, GLFW_KEY_KP_6 },
|
||||
{ "trainbrakefirstservice", command_target::vehicle, GLFW_KEY_KP_8 },
|
||||
{ "trainbrakeservice", command_target::vehicle, GLFW_KEY_KP_5 },
|
||||
{ "trainbrakefullservice", command_target::vehicle, GLFW_KEY_KP_2 },
|
||||
{ "trainbrakeemergency", command_target::vehicle, GLFW_KEY_KP_0 },
|
||||
//"mastercontrollerincrease"
|
||||
{ GLFW_KEY_KP_ADD },
|
||||
//"mastercontrollerincreasefast"
|
||||
{ GLFW_KEY_KP_ADD | keymodifier::shift },
|
||||
// "mastercontrollerdecrease"
|
||||
{ GLFW_KEY_KP_SUBTRACT },
|
||||
// "mastercontrollerdecreasefast"
|
||||
{ GLFW_KEY_KP_SUBTRACT | keymodifier::shift },
|
||||
// "secondcontrollerincrease"
|
||||
{ GLFW_KEY_KP_DIVIDE },
|
||||
// "secondcontrollerincreasefast"
|
||||
{ GLFW_KEY_KP_DIVIDE | keymodifier::shift },
|
||||
// "secondcontrollerdecrease"
|
||||
{ GLFW_KEY_KP_MULTIPLY },
|
||||
// "secondcontrollerdecreasefast"
|
||||
{ GLFW_KEY_KP_MULTIPLY | keymodifier::shift },
|
||||
// "independentbrakeincrease"
|
||||
{ GLFW_KEY_KP_1 },
|
||||
// "independentbrakeincreasefast"
|
||||
{ GLFW_KEY_KP_1 | keymodifier::shift },
|
||||
// "independentbrakedecrease"
|
||||
{ GLFW_KEY_KP_7 },
|
||||
// "independentbrakedecreasefast"
|
||||
{ GLFW_KEY_KP_7 | keymodifier::shift },
|
||||
// "independentbrakebailoff"
|
||||
{ GLFW_KEY_KP_4 },
|
||||
// "trainbrakeincrease"
|
||||
{ GLFW_KEY_KP_3 },
|
||||
// "trainbrakedecrease"
|
||||
{ GLFW_KEY_KP_9 },
|
||||
// "trainbrakecharging"
|
||||
{ GLFW_KEY_KP_DECIMAL },
|
||||
// "trainbrakerelease"
|
||||
{ GLFW_KEY_KP_6 },
|
||||
// "trainbrakefirstservice"
|
||||
{ GLFW_KEY_KP_8 },
|
||||
// "trainbrakeservice"
|
||||
{ GLFW_KEY_KP_5 },
|
||||
// "trainbrakefullservice"
|
||||
{ GLFW_KEY_KP_2 },
|
||||
// "trainbrakeemergency"
|
||||
{ GLFW_KEY_KP_0 },
|
||||
/*
|
||||
const int k_AntiSlipping = 21;
|
||||
const int k_Sand = 22;
|
||||
*/
|
||||
{ "reverserincrease", command_target::vehicle, GLFW_KEY_D },
|
||||
{ "reverserdecrease", command_target::vehicle, GLFW_KEY_R },
|
||||
{ "linebreakertoggle", command_target::vehicle, GLFW_KEY_M },
|
||||
// "reverserincrease"
|
||||
{ GLFW_KEY_D },
|
||||
// "reverserdecrease"
|
||||
{ GLFW_KEY_R },
|
||||
// "linebreakertoggle"
|
||||
{ GLFW_KEY_M },
|
||||
/*
|
||||
const int k_Fuse = 26;
|
||||
*/
|
||||
{ "convertertoggle", command_target::vehicle, GLFW_KEY_X },
|
||||
{ "compressortoggle", command_target::vehicle, GLFW_KEY_C },
|
||||
{ "motoroverloadrelaythresholdtoggle", command_target::vehicle, GLFW_KEY_F },
|
||||
// "convertertoggle"
|
||||
{ GLFW_KEY_X },
|
||||
// "compressortoggle"
|
||||
{ GLFW_KEY_C },
|
||||
// "motoroverloadrelaythresholdtoggle"
|
||||
{ GLFW_KEY_F },
|
||||
// "notchingrelaytoggle"
|
||||
{ GLFW_KEY_G },
|
||||
// "epbrakecontroltoggle"
|
||||
{ GLFW_KEY_Z | keymodifier::control },
|
||||
// "brakeactingspeedincrease"
|
||||
{ GLFW_KEY_B | keymodifier::shift },
|
||||
// "brakeactingspeeddecrease"
|
||||
{ GLFW_KEY_B },
|
||||
/*
|
||||
const int k_CurrentAutoRelay = 30;
|
||||
const int k_BrakeProfile = 31;
|
||||
*/
|
||||
{ "alerteracknowledge", command_target::vehicle, GLFW_KEY_SPACE },
|
||||
// "alerteracknowledge"
|
||||
{ GLFW_KEY_SPACE },
|
||||
/*
|
||||
const int k_Horn = 33;
|
||||
const int k_Horn2 = 34;
|
||||
const int k_FailedEngineCutOff = 35;
|
||||
*/
|
||||
{ "viewturn", command_target::entity, -1 },
|
||||
{ "movevector", command_target::entity, -1 },
|
||||
{ "moveleft", command_target::entity, GLFW_KEY_LEFT },
|
||||
{ "moveright", command_target::entity, GLFW_KEY_RIGHT },
|
||||
{ "moveforward", command_target::entity, GLFW_KEY_UP },
|
||||
{ "moveback", command_target::entity, GLFW_KEY_DOWN },
|
||||
{ "moveup", command_target::entity, GLFW_KEY_PAGE_UP },
|
||||
{ "movedown", command_target::entity, GLFW_KEY_PAGE_DOWN },
|
||||
{ "moveleftfast", command_target::entity, -1 },
|
||||
{ "moverightfast", command_target::entity, -1 },
|
||||
{ "moveforwardfast", command_target::entity, -1 },
|
||||
{ "movebackfast", command_target::entity, -1 },
|
||||
{ "moveupfast", command_target::entity, -1 },
|
||||
{ "movedownfast", command_target::entity, -1 },
|
||||
// "viewturn"
|
||||
{ -1 },
|
||||
// "movevector"
|
||||
{ -1 },
|
||||
// "moveleft"
|
||||
{ GLFW_KEY_LEFT },
|
||||
// "moveright"
|
||||
{ GLFW_KEY_RIGHT },
|
||||
// "moveforward"
|
||||
{ GLFW_KEY_UP },
|
||||
// "moveback"
|
||||
{ GLFW_KEY_DOWN },
|
||||
// "moveup"
|
||||
{ GLFW_KEY_PAGE_UP },
|
||||
// "movedown"
|
||||
{ GLFW_KEY_PAGE_DOWN },
|
||||
// "moveleftfast"
|
||||
{ -1 },
|
||||
// "moverightfast"
|
||||
{ -1 },
|
||||
// "moveforwardfast"
|
||||
{ -1 },
|
||||
// "movebackfast"
|
||||
{ -1 },
|
||||
// "moveupfast"
|
||||
{ -1 },
|
||||
// "movedownfast"
|
||||
{ -1 },
|
||||
/*
|
||||
const int k_CabForward = 42;
|
||||
const int k_CabBackward = 43;
|
||||
@@ -160,27 +208,45 @@ const int k_ProgramQuit = 46;
|
||||
// const int k_ProgramPause= 47;
|
||||
const int k_ProgramHelp = 48;
|
||||
*/
|
||||
{ "doortoggleleft", command_target::vehicle, GLFW_KEY_COMMA },
|
||||
{ "doortoggleright", command_target::vehicle, GLFW_KEY_PERIOD },
|
||||
// "doortoggleleft"
|
||||
{ GLFW_KEY_COMMA },
|
||||
// "doortoggleright"
|
||||
{ GLFW_KEY_PERIOD },
|
||||
// "departureannounce"
|
||||
{ GLFW_KEY_SLASH },
|
||||
// "doorlocktoggle"
|
||||
{ GLFW_KEY_S | keymodifier::shift },
|
||||
// "pantographtogglefront"
|
||||
{ GLFW_KEY_P },
|
||||
// "pantographtogglerear"
|
||||
{ GLFW_KEY_O },
|
||||
// "pantographlowerall"
|
||||
{ GLFW_KEY_P | keymodifier::control },
|
||||
// "heatingtoggle"
|
||||
{ GLFW_KEY_H },
|
||||
/*
|
||||
const int k_DepartureSignal = 53;
|
||||
*/
|
||||
{ "pantographtogglefront", command_target::vehicle, GLFW_KEY_P },
|
||||
{ "pantographtogglerear", command_target::vehicle, GLFW_KEY_O },
|
||||
/*
|
||||
const int k_Heating = 58;
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
{ "headlighttoggleleft", command_target::vehicle, GLFW_KEY_Y },
|
||||
{ "headlighttoggleright", command_target::vehicle, GLFW_KEY_I },
|
||||
{ "headlighttoggleupper", command_target::vehicle, GLFW_KEY_U },
|
||||
{ "redmarkertoggleleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::shift },
|
||||
{ "redmarkertoggleright", command_target::vehicle, GLFW_KEY_I | keymodifier::shift },
|
||||
{ "headlighttogglerearleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::control },
|
||||
{ "headlighttogglerearright", command_target::vehicle, GLFW_KEY_I | keymodifier::control },
|
||||
{ "headlighttogglerearupper", command_target::vehicle, GLFW_KEY_U | keymodifier::control },
|
||||
{ "redmarkertogglerearleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::control | keymodifier::shift },
|
||||
{ "redmarkertogglerearright", command_target::vehicle, GLFW_KEY_I | keymodifier::control | keymodifier::shift },
|
||||
// "headlighttoggleleft"
|
||||
{ GLFW_KEY_Y },
|
||||
// "headlighttoggleright"
|
||||
{ GLFW_KEY_I },
|
||||
// "headlighttoggleupper"
|
||||
{ GLFW_KEY_U },
|
||||
// "redmarkertoggleleft"
|
||||
{ GLFW_KEY_Y | keymodifier::shift },
|
||||
// "redmarkertoggleright"
|
||||
{ GLFW_KEY_I | keymodifier::shift },
|
||||
// "headlighttogglerearleft"
|
||||
{ GLFW_KEY_Y | keymodifier::control },
|
||||
// "headlighttogglerearright"
|
||||
{ GLFW_KEY_I | keymodifier::control },
|
||||
// "headlighttogglerearupper"
|
||||
{ GLFW_KEY_U | keymodifier::control },
|
||||
// "redmarkertogglerearleft"
|
||||
{ GLFW_KEY_Y | keymodifier::control | keymodifier::shift },
|
||||
// "redmarkertogglerearright"
|
||||
{ GLFW_KEY_I | keymodifier::control | keymodifier::shift },
|
||||
/*
|
||||
const int k_SmallCompressor = 63;
|
||||
const int k_StLinOff = 64;
|
||||
@@ -192,7 +258,8 @@ const int k_Univ4 = 69;
|
||||
const int k_EndSign = 70;
|
||||
const int k_Active = 71;
|
||||
*/
|
||||
{ "batterytoggle", command_target::vehicle, GLFW_KEY_J }
|
||||
// "batterytoggle"
|
||||
{ GLFW_KEY_J }
|
||||
/*
|
||||
const int k_WalkMode = 73;
|
||||
int const k_DimHeadlights = 74;
|
||||
|
||||
@@ -37,8 +37,6 @@ private:
|
||||
|
||||
struct command_setup {
|
||||
|
||||
std::string name;
|
||||
command_target target;
|
||||
int binding;
|
||||
};
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ light_array::update() {
|
||||
light.direction.z = -light.direction.z;
|
||||
}
|
||||
// determine intensity of this light set
|
||||
if( true == light.owner->MoverParameters->Battery ) {
|
||||
// with battery on, the intensity depends on the state of activated switches
|
||||
if( ( true == light.owner->MoverParameters->Battery ) || ( true == light.owner->MoverParameters->ConverterFlag ) ) {
|
||||
// with power on, the intensity depends on the state of activated switches
|
||||
auto const &lightbits = light.owner->iLights[ light.index ];
|
||||
light.count = 0 +
|
||||
( ( lightbits & 1 ) ? 1 : 0 ) +
|
||||
|
||||
@@ -213,14 +213,14 @@
|
||||
<ClCompile Include="moon.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="command.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
<ClCompile Include="gamepadinput.cpp">
|
||||
<Filter>Source Files\input</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="keyboardinput.cpp">
|
||||
<Filter>Source Files\input</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="gamepadinput.cpp">
|
||||
<Filter>Source Files\input</Filter>
|
||||
<ClCompile Include="command.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user