16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 17:29:18 +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:
tmj-fstate
2017-04-16 17:22:56 +02:00
parent 57c213fd1d
commit 2fd7bc5a93
18 changed files with 927 additions and 586 deletions

View File

@@ -10,6 +10,7 @@ http://mozilla.org/MPL/2.0/.
#include "stdafx.h" #include "stdafx.h"
#include "Button.h" #include "Button.h"
#include "Console.h" #include "Console.h"
#include "logs.h"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -57,6 +58,8 @@ void TButton::Load(cParser &Parser, TModel3d *pModel1, TModel3d *pModel2)
{ {
pModelOn = NULL; pModelOn = NULL;
pModelOff = NULL; pModelOff = NULL;
ErrorLog( "Failed to locate sub-model \"" + token + "\" in 3d model \"" + pModel1->NameGet() + "\"" );
} }
}; };

View File

@@ -798,7 +798,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
btnOn = true; btnOn = true;
} }
// else btCPass2.TurnOff(); // else btCPass2.TurnOff();
if (MoverParameters->Battery) if( ( true == MoverParameters->Battery ) || ( true == MoverParameters->ConverterFlag ) )
{ // sygnaly konca pociagu { // sygnaly konca pociagu
if (btEndSignals1.Active()) if (btEndSignals1.Active())
{ {
@@ -900,10 +900,9 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
// Ra: przechyłkę załatwiamy na etapie przesuwania modelu // Ra: przechyłkę załatwiamy na etapie przesuwania modelu
// if (ObjSqrDist<80000) ABuModelRoll(); //przechyłki od 400m // if (ObjSqrDist<80000) ABuModelRoll(); //przechyłki od 400m
} }
if (MoverParameters->Battery) if( ( true == MoverParameters->Battery ) || ( true == MoverParameters->ConverterFlag ) ) {
{ // sygnały czoła pociagu //Ra: wyświetlamy bez // sygnały czoła pociagu
// ograniczeń odległości, by były widoczne z //Ra: wyświetlamy bez ograniczeń odległości, by były widoczne z daleka
// daleka
if (TestFlag(iLights[0], 1)) if (TestFlag(iLights[0], 1))
{ {
btHeadSignals11.TurnOn(); btHeadSignals11.TurnOn();
@@ -986,11 +985,8 @@ TDynamicObject * TDynamicObject::ABuFindNearestObject(TTrack *Track, TDynamicObj
return nullptr; return nullptr;
} }
TDynamicObject * TDynamicObject::ABuScanNearestObject(TTrack *Track, double ScanDir, TDynamicObject * TDynamicObject::ABuScanNearestObject(TTrack *Track, double ScanDir, double ScanDist, int &CouplNr)
double ScanDist, int &CouplNr) { // skanowanie toru w poszukiwaniu obiektu najblizszego kamerze
{ // skanowanie toru w poszukiwaniu obiektu najblizszego
// kamerze
// double MyScanDir=ScanDir; //Moja orientacja na torze. //Ra: nie używane
if (ABuGetDirection() < 0) if (ABuGetDirection() < 0)
ScanDir = -ScanDir; ScanDir = -ScanDir;
TDynamicObject *FoundedObj; TDynamicObject *FoundedObj;
@@ -2914,11 +2910,12 @@ bool TDynamicObject::Update(double dt, double dt1)
// fragment "z EXE Kursa" // fragment "z EXE Kursa"
if (MoverParameters->Mains) // nie wchodzić w funkcję bez potrzeby if (MoverParameters->Mains) // nie wchodzić w funkcję bez potrzeby
if ((!MoverParameters->Battery) && (Controller == Humandriver) && if ( ( false == MoverParameters->Battery)
(MoverParameters->EngineType != DieselEngine) && && ( false == MoverParameters->ConverterFlag ) // added alternative power source. TODO: more generic power check
(MoverParameters->EngineType != WheelsDriven)) && ( Controller == Humandriver)
{ // jeśli bateria wyłączona, a nie diesel ani drezyna && ( MoverParameters->EngineType != DieselEngine )
// reczna && ( MoverParameters->EngineType != WheelsDriven ) )
{ // jeśli bateria wyłączona, a nie diesel ani drezyna reczna
if (MoverParameters->MainSwitch(false)) // wyłączyć zasilanie if (MoverParameters->MainSwitch(false)) // wyłączyć zasilanie
MoverParameters->EventFlag = true; MoverParameters->EventFlag = true;
} }

View File

@@ -15,9 +15,10 @@ http://mozilla.org/MPL/2.0/.
#include "stdafx.h" #include "stdafx.h"
#include "Gauge.h" #include "Gauge.h"
#include "Timer.h"
#include "parser.h" #include "parser.h"
#include "Model3d.h" #include "Model3d.h"
#include "Timer.h"
#include "logs.h"
TGauge::TGauge() TGauge::TGauge()
{ {
@@ -90,6 +91,10 @@ bool TGauge::Load(cParser &Parser, TModel3d *md1, TModel3d *md2, double mul)
md2 = NULL; // informacja, że znaleziony md2 = NULL; // informacja, że znaleziony
else if (md2) // a jest podany drugi model (np. zewnętrzny) 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 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") if (str2 == "mov")
Init(sm, gt_Move, val3, val4, val5); Init(sm, gt_Move, val3, val4, val5);
else if (str2 == "wip") else if (str2 == "wip")

View File

@@ -107,6 +107,7 @@ int Global::iHiddenEvents = 1; // czy łączyć eventy z torami poprzez nazwę t
// parametry użytkowe (jak komu pasuje) // parametry użytkowe (jak komu pasuje)
int Global::Keys[MaxKeys]; int Global::Keys[MaxKeys];
bool Global::RealisticControlMode{ false };
int Global::iWindowWidth = 800; int Global::iWindowWidth = 800;
int Global::iWindowHeight = 600; int Global::iWindowHeight = 600;
float Global::fDistanceFactor = Global::ScreenHeight / 768.0; // baza do przeliczania odległości dla LoD float Global::fDistanceFactor = Global::ScreenHeight / 768.0; // baza do przeliczania odległości dla LoD

View File

@@ -166,6 +166,7 @@ class Global
public: public:
// double Global::tSinceStart; // double Global::tSinceStart;
static int Keys[MaxKeys]; 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 Math3D::vector3 pCameraPosition; // pozycja kamery w świecie
static double static double
pCameraRotation; // kierunek bezwzględny kamery w świecie: 0=północ, 90°=zachód (-azymut) 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 std::string asHumanCtrlVehicle;
static void LoadIniFile(std::string asFileName); static void LoadIniFile(std::string asFileName);
static void InitKeys(); static void InitKeys();
inline static Math3D::vector3 GetCameraPosition() inline static Math3D::vector3 GetCameraPosition() { return pCameraPosition; };
{
return pCameraPosition;
};
static void SetCameraPosition(Math3D::vector3 pNewCameraPosition); static void SetCameraPosition(Math3D::vector3 pNewCameraPosition);
static void SetCameraRotation(double Yaw); static void SetCameraRotation(double Yaw);
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko

View File

@@ -4956,48 +4956,37 @@ bool TMoverParameters::AutoRelayCheck(void)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160713 // Q: 20160713
// Podnosi / opuszcza przedni pantograf // Podnosi / opuszcza przedni pantograf. Returns: state of the pantograph after the operation
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::PantFront(bool State) bool TMoverParameters::PantFront(bool State)
{ {
double pf1 = 0; if( ( true == Battery )
bool PF = false; || ( true == ConverterFlag ) ) {
if ((Battery == if( PantFrontUp != State ) {
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)
{
PantFrontUp = State; PantFrontUp = State;
if (State == true) if( State == true ) {
{
PantFrontStart = 0; PantFrontStart = 0;
SendCtrlToNext("PantFront", 1, CabNo); SendCtrlToNext( "PantFront", 1, CabNo );
} }
else else {
{
PF = false;
PantFrontStart = 1; PantFrontStart = 1;
SendCtrlToNext("PantFront", 0, CabNo); 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);
// }
//}
} }
} }
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) bool TMoverParameters::PantRear(bool State)
{ {
double pf1; if( ( true == Battery )
bool PR = false; || ( true == ConverterFlag ) ) {
if (Battery == true) if( PantRearUp != State ) {
{
PR = true;
if (State == true)
pf1 = 1;
else
pf1 = 0;
if (PantRearUp != State)
{
PantRearUp = State; PantRearUp = State;
if (State == true) if( State == true ) {
{
PantRearStart = 0; PantRearStart = 0;
SendCtrlToNext("PantRear", 1, CabNo); SendCtrlToNext( "PantRear", 1, CabNo );
} }
else else {
{
PR = false;
PantRearStart = 1; 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;
} }
// ************************************************************************************************* // *************************************************************************************************

View File

@@ -45,7 +45,6 @@ static int const bdelay_G = 1; //G
static int const bdelay_P = 2; //P static int const bdelay_P = 2; //P
static int const bdelay_R = 4; //R static int const bdelay_R = 4; //R
static int const bdelay_M = 8; //Mg static int const bdelay_M = 8; //Mg
static int const bdelay_GR = 128; //G-R
/*stan hamulca*/ /*stan hamulca*/

View File

@@ -1649,15 +1649,21 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
LoadFromBinFile(asBinary, dynamic); LoadFromBinFile(asBinary, dynamic);
asBinary = ""; // wyłączenie zapisu asBinary = ""; // wyłączenie zapisu
Init(); Init();
} // cache the file name, in case someone wants it later
m_filename = name + ".e3d";
}
else else
{ {
if (FileExists(name + ".t3d")) if (FileExists(name + ".t3d"))
{ {
LoadFromTextFile(FileName, dynamic); // wczytanie tekstowego LoadFromTextFile(FileName, dynamic); // wczytanie tekstowego
if (!dynamic) // pojazdy dopiero po ustawieniu animacji if( !dynamic ) {
Init(); // generowanie siatek i zapis E3D // 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 = bool const result =
Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem

View File

@@ -342,6 +342,7 @@ private:
int *iModel; // zawartość pliku binarnego int *iModel; // zawartość pliku binarnego
int iSubModelsCount; // Ra: używane do tworzenia binarnych int iSubModelsCount; // Ra: używane do tworzenia binarnych
std::string asBinary; // nazwa pod którą zapisać model binarny std::string asBinary; // nazwa pod którą zapisać model binarny
std::string m_filename;
public: public:
inline TSubModel * GetSMRoot() inline TSubModel * GetSMRoot()
{ {
@@ -382,7 +383,8 @@ public:
void Init(); void Init();
std::string NameGet() std::string NameGet()
{ {
return Root ? Root->pName : NULL; // return Root ? Root->pName : NULL;
return m_filename;
}; };
int TerrainCount(); int TerrainCount();
TSubModel * TerrainSquare(int n); TSubModel * TerrainSquare(int n);

View File

@@ -15,12 +15,12 @@ namespace Timer
{ {
double DeltaTime, DeltaRenderTime; double DeltaTime, DeltaRenderTime;
double fFPS = 0.0f; double fFPS{ 0.0f };
double fLastTime = 0.0f; double fLastTime{ 0.0f };
DWORD dwFrames = 0L; DWORD dwFrames{ 0 };
double fSimulationTime = 0; double fSimulationTime{ 0.0 };
double fSoundTimer = 0; double fSoundTimer{ 0.0 };
double fSinceStart = 0; double fSinceStart{ 0.0 };
double GetTime() double GetTime()
{ {
@@ -69,15 +69,10 @@ double GetFPS()
void ResetTimers() void ResetTimers()
{ {
// double CurrentTime= UpdateTimers( Global::iPause != 0 );
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
::GetTickCount64();
#else
::GetTickCount();
#endif
DeltaTime = 0.1; DeltaTime = 0.1;
DeltaRenderTime = 0; DeltaRenderTime = 0.0;
fSoundTimer = 0; fSoundTimer = 0.0;
}; };
LONGLONG fr, count, oldCount; LONGLONG fr, count, oldCount;
@@ -92,17 +87,17 @@ void UpdateTimers(bool pause)
DeltaTime = Global::fTimeSpeed * DeltaRenderTime; DeltaTime = Global::fTimeSpeed * DeltaRenderTime;
fSoundTimer += DeltaTime; fSoundTimer += DeltaTime;
if (fSoundTimer > 0.1) if (fSoundTimer > 0.1)
fSoundTimer = 0; fSoundTimer = 0.0;
/* /*
double CurrentTime= double(count)/double(fr);//GetTickCount(); double CurrentTime= double(count)/double(fr);//GetTickCount();
DeltaTime= (CurrentTime-OldTime); DeltaTime= (CurrentTime-OldTime);
OldTime= CurrentTime; OldTime= CurrentTime;
*/ */
if (DeltaTime > 1) if (DeltaTime > 1.0)
DeltaTime = 1; DeltaTime = 1.0;
} }
else else
DeltaTime = 0; // wszystko stoi, bo czas nie płynie DeltaTime = 0.0; // wszystko stoi, bo czas nie płynie
oldCount = count; oldCount = count;
// Keep track of the time lapse and frame count // Keep track of the time lapse and frame count

721
Train.cpp

File diff suppressed because it is too large Load Diff

View File

@@ -119,6 +119,7 @@ class TTrain
static void OnCommand_secondcontrollerincreasefast( TTrain *Train, command_data const &Command ); static void OnCommand_secondcontrollerincreasefast( TTrain *Train, command_data const &Command );
static void OnCommand_secondcontrollerdecrease( 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_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_independentbrakeincrease( TTrain *Train, command_data const &Command );
static void OnCommand_independentbrakeincreasefast( 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 ); 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_trainbrakeservice( TTrain *Train, command_data const &Command );
static void OnCommand_trainbrakefullservice( 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_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_reverserincrease( TTrain *Train, command_data const &Command );
static void OnCommand_reverserdecrease( 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_alerteracknowledge( TTrain *Train, command_data const &Command );
static void OnCommand_batterytoggle( 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_pantographtogglefront( TTrain *Train, command_data const &Command );
static void OnCommand_pantographtogglerear( 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_linebreakertoggle( TTrain *Train, command_data const &Command );
static void OnCommand_convertertoggle( 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_compressortoggle( TTrain *Train, command_data const &Command );
static void OnCommand_motoroverloadrelaythresholdtoggle( 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_headlighttoggleleft( TTrain *Train, command_data const &Command );
static void OnCommand_headlighttoggleright( 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 ); 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_redmarkertogglerearright( TTrain *Train, command_data const &Command );
static void OnCommand_doortoggleleft( 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_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 // members
TDynamicObject *DynamicObject; // przestawia zmiana pojazdu [F5] TDynamicObject *DynamicObject; // przestawia zmiana pojazdu [F5]
@@ -258,6 +266,7 @@ public: // reszta może by?publiczna
TGauge ggPantFrontButton; TGauge ggPantFrontButton;
TGauge ggPantRearButton; TGauge ggPantRearButton;
TGauge ggPantFrontButtonOff; // EZT TGauge ggPantFrontButtonOff; // EZT
TGauge ggPantRearButtonOff;
TGauge ggPantAllDownButton; TGauge ggPantAllDownButton;
// Winger 020304 - wlacznik ogrzewania // Winger 020304 - wlacznik ogrzewania
TGauge ggTrainHeatingButton; TGauge ggTrainHeatingButton;

View File

@@ -17,6 +17,116 @@ http://mozilla.org/MPL/2.0/.
namespace simulation { namespace simulation {
command_queue Commands; 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; 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 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 { 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 ); auto const &command = simulation::Commands_descriptions[ static_cast<std::size_t>( Command ) ];
if( lookup == m_targets.end() ) { if( ( command.target == command_target::vehicle )
// shouldn't be really needed but, eh
return;
}
if( ( lookup->second == command_target::vehicle )
&& ( true == FreeFlyModeFlag ) && ( true == FreeFlyModeFlag )
&& ( false == DebugModeFlag ) ) { && ( ( false == DebugModeFlag )
// don't pass vehicle commands if the user isn't in one, unless we're in debug mode && ( 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; return;
} }
@@ -296,20 +179,19 @@ command_relay::post( user_command const Command, std::uint64_t const Param1, std
Param1, Param1,
Param2, Param2,
Timer::GetDeltaTime() }, Timer::GetDeltaTime() },
static_cast<std::size_t>( lookup->second ) | Recipient ); static_cast<std::size_t>( command.target ) | Recipient );
#ifdef _DEBUG #ifdef _DEBUG
if( Action != GLFW_RELEASE ) { if( Action != GLFW_RELEASE ) {
// key was pressed or is still held // key was pressed or is still held
auto const &commandname = m_commandnames.at( static_cast<std::size_t>( Command ) ); if( false == command.name.empty() ) {
if( false == commandname.empty() ) { WriteLog( "Command issued: " + command.name );
WriteLog( "Command issued: " + commandname );
} }
} }
/* /*
else { else {
// key was released (but we don't log this) // 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 #endif

View File

@@ -48,11 +48,10 @@ const int k_Fuse = 26;
convertertoggle, convertertoggle,
compressortoggle, compressortoggle,
motoroverloadrelaythresholdtoggle, motoroverloadrelaythresholdtoggle,
/* notchingrelaytoggle,
const int k_MaxCurrent = 29; epbrakecontroltoggle,
const int k_CurrentAutoRelay = 30; brakeactingspeedincrease,
const int k_BrakeProfile = 31; brakeactingspeeddecrease,
*/
alerteracknowledge, alerteracknowledge,
/* /*
const int k_Horn = 33; const int k_Horn = 33;
@@ -84,13 +83,13 @@ const int k_ProgramHelp = 48;
*/ */
doortoggleleft, doortoggleleft,
doortoggleright, doortoggleright,
/* departureannounce,
const int k_DepartureSignal = 53; doorlocktoggle,
*/
pantographtogglefront, pantographtogglefront,
pantographtogglerear, pantographtogglerear,
pantographlowerall,
heatingtoggle,
/* /*
const int k_Heating = 58;
// const int k_FreeFlyMode= 59; // const int k_FreeFlyMode= 59;
*/ */
headlighttoggleleft, headlighttoggleleft,
@@ -103,7 +102,7 @@ const int k_Heating = 58;
headlighttogglerearupper, headlighttogglerearupper,
redmarkertogglerearleft, redmarkertogglerearleft,
redmarkertogglerearright, redmarkertogglerearright,
/* /*
const int k_SmallCompressor = 63; const int k_SmallCompressor = 63;
const int k_StLinOff = 64; const int k_StLinOff = 64;
const int k_CurrentNext = 65; const int k_CurrentNext = 65;
@@ -137,6 +136,14 @@ enum class command_target {
entity = 0x40000 entity = 0x40000
}; };
struct command_description {
std::string name;
command_target target;
};
typedef std::vector<command_description> commanddescription_sequence;
struct command_data { struct command_data {
user_command command; user_command command;
@@ -175,6 +182,8 @@ private:
namespace simulation { namespace simulation {
extern command_queue Commands; 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: public:
// constructors // constructors
command_relay();
// methods // methods
// posts specified command for the specified recipient // posts specified command for the specified recipient
// TODO: replace uint16_t with recipient handle, based on item id // 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; 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: private:
// types // types
typedef std::unordered_map<user_command, command_target> commandtarget_map;
// members // members
commandtarget_map m_targets;
#ifdef _DEBUG
std::vector<std::string> m_commandnames;
#endif
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -92,65 +92,113 @@ void
keyboard_input::default_bindings() { keyboard_input::default_bindings() {
m_commands = { m_commands = {
//"mastercontrollerincrease"
{ "mastercontrollerincrease", command_target::vehicle, GLFW_KEY_KP_ADD }, { GLFW_KEY_KP_ADD },
{ "mastercontrollerincreasefast", command_target::vehicle, GLFW_KEY_KP_ADD | keymodifier::shift }, //"mastercontrollerincreasefast"
{ "mastercontrollerdecrease", command_target::vehicle, GLFW_KEY_KP_SUBTRACT }, { GLFW_KEY_KP_ADD | keymodifier::shift },
{ "mastercontrollerdecreasefast", command_target::vehicle, GLFW_KEY_KP_SUBTRACT | keymodifier::shift }, // "mastercontrollerdecrease"
{ "secondcontrollerincrease", command_target::vehicle, GLFW_KEY_KP_DIVIDE }, { GLFW_KEY_KP_SUBTRACT },
{ "secondcontrollerincreasefast", command_target::vehicle, GLFW_KEY_KP_DIVIDE | keymodifier::shift }, // "mastercontrollerdecreasefast"
{ "secondcontrollerdecrease", command_target::vehicle, GLFW_KEY_KP_MULTIPLY }, { GLFW_KEY_KP_SUBTRACT | keymodifier::shift },
{ "secondcontrollerdecreasefast", command_target::vehicle, GLFW_KEY_KP_MULTIPLY | keymodifier::shift }, // "secondcontrollerincrease"
{ "independentbrakeincrease", command_target::vehicle, GLFW_KEY_KP_1 }, { GLFW_KEY_KP_DIVIDE },
{ "independentbrakeincreasefast", command_target::vehicle, GLFW_KEY_KP_1 | keymodifier::shift }, // "secondcontrollerincreasefast"
{ "independentbrakedecrease", command_target::vehicle, GLFW_KEY_KP_7 }, { GLFW_KEY_KP_DIVIDE | keymodifier::shift },
{ "independentbrakedecreasefast", command_target::vehicle, GLFW_KEY_KP_7 | keymodifier::shift }, // "secondcontrollerdecrease"
{ "independentbrakebailoff", command_target::vehicle, GLFW_KEY_KP_4 }, { GLFW_KEY_KP_MULTIPLY },
{ "trainbrakeincrease", command_target::vehicle, GLFW_KEY_KP_3 }, // "secondcontrollerdecreasefast"
{ "trainbrakedecrease", command_target::vehicle, GLFW_KEY_KP_9 }, { GLFW_KEY_KP_MULTIPLY | keymodifier::shift },
{ "trainbrakecharging", command_target::vehicle, GLFW_KEY_KP_DECIMAL }, // "independentbrakeincrease"
{ "trainbrakerelease", command_target::vehicle, GLFW_KEY_KP_6 }, { GLFW_KEY_KP_1 },
{ "trainbrakefirstservice", command_target::vehicle, GLFW_KEY_KP_8 }, // "independentbrakeincreasefast"
{ "trainbrakeservice", command_target::vehicle, GLFW_KEY_KP_5 }, { GLFW_KEY_KP_1 | keymodifier::shift },
{ "trainbrakefullservice", command_target::vehicle, GLFW_KEY_KP_2 }, // "independentbrakedecrease"
{ "trainbrakeemergency", command_target::vehicle, GLFW_KEY_KP_0 }, { 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_AntiSlipping = 21;
const int k_Sand = 22; const int k_Sand = 22;
*/ */
{ "reverserincrease", command_target::vehicle, GLFW_KEY_D }, // "reverserincrease"
{ "reverserdecrease", command_target::vehicle, GLFW_KEY_R }, { GLFW_KEY_D },
{ "linebreakertoggle", command_target::vehicle, GLFW_KEY_M }, // "reverserdecrease"
{ GLFW_KEY_R },
// "linebreakertoggle"
{ GLFW_KEY_M },
/* /*
const int k_Fuse = 26; const int k_Fuse = 26;
*/ */
{ "convertertoggle", command_target::vehicle, GLFW_KEY_X }, // "convertertoggle"
{ "compressortoggle", command_target::vehicle, GLFW_KEY_C }, { GLFW_KEY_X },
{ "motoroverloadrelaythresholdtoggle", command_target::vehicle, GLFW_KEY_F }, // "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; const int k_BrakeProfile = 31;
*/ */
{ "alerteracknowledge", command_target::vehicle, GLFW_KEY_SPACE }, // "alerteracknowledge"
{ GLFW_KEY_SPACE },
/* /*
const int k_Horn = 33; const int k_Horn = 33;
const int k_Horn2 = 34; const int k_Horn2 = 34;
const int k_FailedEngineCutOff = 35; const int k_FailedEngineCutOff = 35;
*/ */
{ "viewturn", command_target::entity, -1 }, // "viewturn"
{ "movevector", command_target::entity, -1 }, { -1 },
{ "moveleft", command_target::entity, GLFW_KEY_LEFT }, // "movevector"
{ "moveright", command_target::entity, GLFW_KEY_RIGHT }, { -1 },
{ "moveforward", command_target::entity, GLFW_KEY_UP }, // "moveleft"
{ "moveback", command_target::entity, GLFW_KEY_DOWN }, { GLFW_KEY_LEFT },
{ "moveup", command_target::entity, GLFW_KEY_PAGE_UP }, // "moveright"
{ "movedown", command_target::entity, GLFW_KEY_PAGE_DOWN }, { GLFW_KEY_RIGHT },
{ "moveleftfast", command_target::entity, -1 }, // "moveforward"
{ "moverightfast", command_target::entity, -1 }, { GLFW_KEY_UP },
{ "moveforwardfast", command_target::entity, -1 }, // "moveback"
{ "movebackfast", command_target::entity, -1 }, { GLFW_KEY_DOWN },
{ "moveupfast", command_target::entity, -1 }, // "moveup"
{ "movedownfast", command_target::entity, -1 }, { 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_CabForward = 42;
const int k_CabBackward = 43; const int k_CabBackward = 43;
@@ -160,27 +208,45 @@ const int k_ProgramQuit = 46;
// const int k_ProgramPause= 47; // const int k_ProgramPause= 47;
const int k_ProgramHelp = 48; const int k_ProgramHelp = 48;
*/ */
{ "doortoggleleft", command_target::vehicle, GLFW_KEY_COMMA }, // "doortoggleleft"
{ "doortoggleright", command_target::vehicle, GLFW_KEY_PERIOD }, { 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; // const int k_FreeFlyMode= 59;
*/ */
{ "headlighttoggleleft", command_target::vehicle, GLFW_KEY_Y }, // "headlighttoggleleft"
{ "headlighttoggleright", command_target::vehicle, GLFW_KEY_I }, { GLFW_KEY_Y },
{ "headlighttoggleupper", command_target::vehicle, GLFW_KEY_U }, // "headlighttoggleright"
{ "redmarkertoggleleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::shift }, { GLFW_KEY_I },
{ "redmarkertoggleright", command_target::vehicle, GLFW_KEY_I | keymodifier::shift }, // "headlighttoggleupper"
{ "headlighttogglerearleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::control }, { GLFW_KEY_U },
{ "headlighttogglerearright", command_target::vehicle, GLFW_KEY_I | keymodifier::control }, // "redmarkertoggleleft"
{ "headlighttogglerearupper", command_target::vehicle, GLFW_KEY_U | keymodifier::control }, { GLFW_KEY_Y | keymodifier::shift },
{ "redmarkertogglerearleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::control | keymodifier::shift }, // "redmarkertoggleright"
{ "redmarkertogglerearright", command_target::vehicle, GLFW_KEY_I | keymodifier::control | keymodifier::shift }, { 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_SmallCompressor = 63;
const int k_StLinOff = 64; const int k_StLinOff = 64;
@@ -192,7 +258,8 @@ const int k_Univ4 = 69;
const int k_EndSign = 70; const int k_EndSign = 70;
const int k_Active = 71; const int k_Active = 71;
*/ */
{ "batterytoggle", command_target::vehicle, GLFW_KEY_J } // "batterytoggle"
{ GLFW_KEY_J }
/* /*
const int k_WalkMode = 73; const int k_WalkMode = 73;
int const k_DimHeadlights = 74; int const k_DimHeadlights = 74;

View File

@@ -37,8 +37,6 @@ private:
struct command_setup { struct command_setup {
std::string name;
command_target target;
int binding; int binding;
}; };

View File

@@ -57,8 +57,8 @@ light_array::update() {
light.direction.z = -light.direction.z; light.direction.z = -light.direction.z;
} }
// determine intensity of this light set // determine intensity of this light set
if( true == light.owner->MoverParameters->Battery ) { if( ( true == light.owner->MoverParameters->Battery ) || ( true == light.owner->MoverParameters->ConverterFlag ) ) {
// with battery on, the intensity depends on the state of activated switches // with power on, the intensity depends on the state of activated switches
auto const &lightbits = light.owner->iLights[ light.index ]; auto const &lightbits = light.owner->iLights[ light.index ];
light.count = 0 + light.count = 0 +
( ( lightbits & 1 ) ? 1 : 0 ) + ( ( lightbits & 1 ) ? 1 : 0 ) +

View File

@@ -213,14 +213,14 @@
<ClCompile Include="moon.cpp"> <ClCompile Include="moon.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="command.cpp"> <ClCompile Include="gamepadinput.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\input</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="keyboardinput.cpp"> <ClCompile Include="keyboardinput.cpp">
<Filter>Source Files\input</Filter> <Filter>Source Files\input</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="gamepadinput.cpp"> <ClCompile Include="command.cpp">
<Filter>Source Files\input</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>