16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 22:59:19 +02:00

build 170715. custom sounds for cab lights, optional fallback on legacy sounds for controls without their own sound definitions

This commit is contained in:
tmj-fstate
2017-07-16 01:57:22 +02:00
parent 3a67219e30
commit d51a4ea985
7 changed files with 338 additions and 231 deletions

View File

@@ -9,11 +9,11 @@ http://mozilla.org/MPL/2.0/.
#include "stdafx.h" #include "stdafx.h"
#include "Button.h" #include "Button.h"
#include "parser.h"
#include "Model3d.h"
#include "Console.h" #include "Console.h"
#include "logs.h" #include "logs.h"
//---------------------------------------------------------------------------
TButton::TButton() TButton::TButton()
{ {
iFeedbackBit = 0; iFeedbackBit = 0;
@@ -21,13 +21,11 @@ TButton::TButton()
Clear(); Clear();
}; };
TButton::~TButton(){};
void TButton::Clear(int i) void TButton::Clear(int i)
{ {
pModelOn = NULL; pModelOn = nullptr;
pModelOff = NULL; pModelOff = nullptr;
bOn = false; m_state = false;
if (i >= 0) if (i >= 0)
FeedbackBitSet(i); FeedbackBitSet(i);
Update(); // kasowanie bitu Feedback, o ile jakiś ustawiony Update(); // kasowanie bitu Feedback, o ile jakiś ustawiony
@@ -35,52 +33,134 @@ void TButton::Clear(int i)
void TButton::Init(std::string const &asName, TModel3d *pModel, bool bNewOn) void TButton::Init(std::string const &asName, TModel3d *pModel, bool bNewOn)
{ {
if (!pModel) if( pModel == nullptr ) { return; }
return; // nie ma w czym szukać
pModelOn = pModel->GetFromName( (asName + "_on").c_str() ); pModelOn = pModel->GetFromName( (asName + "_on").c_str() );
pModelOff = pModel->GetFromName( (asName + "_off").c_str() ); pModelOff = pModel->GetFromName( (asName + "_off").c_str() );
bOn = bNewOn; m_state = bNewOn;
Update(); Update();
}; };
void TButton::Load(cParser &Parser, TModel3d *pModel1, TModel3d *pModel2) void TButton::Load(cParser &Parser, TModel3d *pModel1, TModel3d *pModel2) {
{
std::string const token = Parser.getToken<std::string>();
if (pModel1)
{ // poszukiwanie submodeli w modelu
Init(token, pModel1, false);
if (pModel2)
if (!pModelOn && !pModelOff)
Init(token, pModel2, false); // może w drugim będzie (jak nie w kabinie,
// to w zewnętrznym)
}
else
{
pModelOn = NULL;
pModelOff = NULL;
ErrorLog( "Failed to locate sub-model \"" + token + "\" in 3d model \"" + pModel1->NameGet() + "\"" ); std::string submodelname;
Parser.getTokens();
if( Parser.peek() != "{" ) {
// old fixed size config
Parser >> submodelname;
} }
else {
// new, block type config
// TODO: rework the base part into yaml-compatible flow style mapping
cParser mappingparser( Parser.getToken<std::string>( false, "}" ) );
submodelname = mappingparser.getToken<std::string>( false );
// new, variable length section
while( true == Load_mapping( mappingparser ) ) {
; // all work done by while()
}
}
if( pModel1 ) {
// poszukiwanie submodeli w modelu
Init( submodelname, pModel1, false );
if( ( pModelOn != nullptr ) || ( pModelOff != nullptr ) ) {
// we got our models, bail out
return;
}
}
if( pModel2 ) {
// poszukiwanie submodeli w modelu
Init( submodelname, pModel2, false );
if( ( pModelOn != nullptr ) || ( pModelOff != nullptr ) ) {
// we got our models, bail out
return;
}
}
// if we failed to locate even one state submodel, cry
ErrorLog( "Failed to locate sub-model \"" + submodelname + "\" in 3d model \"" + pModel1->NameGet() + "\"" );
}; };
void TButton::Update() bool
{ TButton::Load_mapping( cParser &Input ) {
if (bData != NULL)
bOn = (*bData); if( false == Input.getTokens( 2, true, ", " ) ) {
if (pModelOn) return false;
pModelOn->iVisible = bOn; }
if (pModelOff)
pModelOff->iVisible = !bOn; std::string key, value;
if (iFeedbackBit) // jeżeli generuje informację zwrotną Input
{ >> key
if (bOn) // zapalenie >> value;
if( key == "soundinc:" ) {
m_soundfxincrease = (
value != "none" ?
TSoundsManager::GetFromName( value, true ) :
nullptr );
}
else if( key == "sounddec:" ) {
m_soundfxdecrease = (
value != "none" ?
TSoundsManager::GetFromName( value, true ) :
nullptr );
}
return true; // return value marks a key: value pair was extracted, nothing about whether it's recognized
}
void
TButton::Turn( bool const State ) {
if( State != m_state ) {
m_state = State;
play();
Update();
}
}
void TButton::Update() {
if( ( bData != nullptr )
&& ( *bData != m_state ) ) {
m_state = ( *bData );
play();
}
if( pModelOn != nullptr ) { pModelOn->iVisible = m_state; }
if( pModelOff != nullptr ) { pModelOff->iVisible = (!m_state); }
if (iFeedbackBit) {
// jeżeli generuje informację zwrotną
if (m_state) // zapalenie
Console::BitsSet(iFeedbackBit); Console::BitsSet(iFeedbackBit);
else else
Console::BitsClear(iFeedbackBit); Console::BitsClear(iFeedbackBit);
} }
}; };
void TButton::AssignBool(bool *bValue) void TButton::AssignBool(bool const *bValue) {
{
bData = bValue; bData = bValue;
} }
void
TButton::play() {
play(
m_state == true ?
m_soundfxincrease :
m_soundfxdecrease );
}
void
TButton::play( PSound Sound ) {
if( Sound == nullptr ) { return; }
Sound->SetCurrentPosition( 0 );
Sound->SetVolume( DSBVOLUME_MAX );
Sound->Play( 0, 0, 0 );
return;
}

View File

@@ -7,59 +7,52 @@ obtain one at
http://mozilla.org/MPL/2.0/. http://mozilla.org/MPL/2.0/.
*/ */
#ifndef ButtonH #pragma once
#define ButtonH
#include <string> #include "Classes.h"
#include "Model3d.h" #include "sound.h"
#include "parser.h"
class TButton class TButton
{ // animacja dwustanowa, włącza jeden z dwóch submodeli (jednego { // animacja dwustanowa, włącza jeden z dwóch submodeli (jednego
// z nich może nie być) // z nich może nie być)
private: private:
TSubModel *pModelOn, *pModelOff; // submodel dla stanu załączonego i wyłączonego TSubModel
bool bOn; *pModelOn { nullptr },
bool *bData; *pModelOff { nullptr }; // submodel dla stanu załączonego i wyłączonego
int iFeedbackBit; // Ra: bit informacji zwrotnej, do wyprowadzenia na pulpit bool m_state { false };
bool const *bData { nullptr };
int iFeedbackBit { 0 }; // Ra: bit informacji zwrotnej, do wyprowadzenia na pulpit
PSound m_soundfxincrease { nullptr }; // sound associated with increasing control's value
PSound m_soundfxdecrease { nullptr }; // sound associated with decreasing control's value
// methods
// imports member data pair from the config file
bool
Load_mapping( cParser &Input );
// plays the sound associated with current state
void
play();
// plays specified sound
void
play( PSound Sound );
public: public:
TButton(); TButton();
~TButton(); void Clear(int const i = -1);
void Clear(int i = -1); inline void FeedbackBitSet(int const i) {
inline void FeedbackBitSet(int i) iFeedbackBit = 1 << i; };
{ void Turn( bool const State );
iFeedbackBit = 1 << i; inline void TurnOn() {
}; Turn( true ); };
inline void Turn(bool to) inline void TurnOff() {
{ Turn( false ); };
bOn = to; inline void Switch() {
Update(); Turn( !m_state ); };
}; inline bool Active() {
inline void TurnOn() return (pModelOn) || (pModelOff); };
{
bOn = true;
Update();
};
inline void TurnOff()
{
bOn = false;
Update();
};
inline void Switch()
{
bOn = !bOn;
Update();
};
inline bool Active()
{
return (pModelOn) || (pModelOff);
};
void Update(); void Update();
void Init(std::string const &asName, TModel3d *pModel, bool bNewOn = false); void Init(std::string const &asName, TModel3d *pModel, bool bNewOn = false);
void Load(cParser &Parser, TModel3d *pModel1, TModel3d *pModel2 = NULL); void Load(cParser &Parser, TModel3d *pModel1, TModel3d *pModel2 = NULL);
void AssignBool(bool *bValue); void AssignBool(bool const *bValue);
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#endif

View File

@@ -200,7 +200,7 @@ TGauge::UpdateValue( double fNewDesired, PSound Fallbacksound ) {
else if( ( currentvalue > fNewDesired ) && ( m_soundfxdecrease != nullptr ) ) { else if( ( currentvalue > fNewDesired ) && ( m_soundfxdecrease != nullptr ) ) {
play( m_soundfxdecrease ); play( m_soundfxdecrease );
} }
else { else if( Fallbacksound != nullptr ) {
// ...and if that fails too, try the provided fallback sound from legacy system // ...and if that fails too, try the provided fallback sound from legacy system
play( Fallbacksound ); play( Fallbacksound );
} }

View File

@@ -43,18 +43,19 @@ class TGauge {
PSound m_soundfxdecrease { nullptr }; // sound associated with decreasing control's value PSound m_soundfxdecrease { nullptr }; // sound associated with decreasing control's value
std::map<int, PSound> m_soundfxvalues; // sounds associated with specific values std::map<int, PSound> m_soundfxvalues; // sounds associated with specific values
// methods // methods
// imports member data pair from the config file
bool
Load_mapping( cParser &Input );
// plays specified sound // plays specified sound
void void
play( PSound Sound ); play( PSound Sound );
public: public:
TGauge() = default; TGauge() = default;
~TGauge() {}
inline inline
void Clear() { *this = TGauge(); } void Clear() { *this = TGauge(); }
void Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1, double fNewOffset = 0, double fNewFriction = 0, double fNewValue = 0); void Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1, double fNewOffset = 0, double fNewFriction = 0, double fNewValue = 0);
bool Load(cParser &Parser, TModel3d *md1, TModel3d *md2 = nullptr, double mul = 1.0); bool Load(cParser &Parser, TModel3d *md1, TModel3d *md2 = nullptr, double mul = 1.0);
bool Load_mapping( cParser &Input );
void PermIncValue(double fNewDesired); void PermIncValue(double fNewDesired);
void IncValue(double fNewDesired); void IncValue(double fNewDesired);
void DecValue(double fNewDesired); void DecValue(double fNewDesired);

323
Train.cpp
View File

@@ -704,7 +704,7 @@ void TTrain::OnCommand_mucurrentindicatorothersourceactivate( TTrain *Train, com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggNextCurrentButton.UpdateValue( 1.0 ); Train->ggNextCurrentButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else if( Command.action == GLFW_RELEASE ) { else if( Command.action == GLFW_RELEASE ) {
//turn off //turn off
@@ -716,7 +716,7 @@ void TTrain::OnCommand_mucurrentindicatorothersourceactivate( TTrain *Train, com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggNextCurrentButton.UpdateValue( 0.0 ); Train->ggNextCurrentButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
@@ -820,13 +820,13 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons
} }
#endif #endif
// visual feedback // visual feedback
Train->ggReleaserButton.UpdateValue( 1.0 ); Train->ggReleaserButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
// release // release
Train->mvOccupied->BrakeReleaser( 0 ); Train->mvOccupied->BrakeReleaser( 0 );
// visual feedback // visual feedback
Train->ggReleaserButton.UpdateValue( 0.0 ); Train->ggReleaserButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -1027,7 +1027,7 @@ void TTrain::OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const
} }
#endif #endif
// visual feedback // visual feedback
Train->ggAntiSlipButton.UpdateValue( 1.0 ); Train->ggAntiSlipButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
// release // release
@@ -1060,7 +1060,7 @@ void TTrain::OnCommand_sandboxactivate( TTrain *Train, command_data const &Comma
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
#endif #endif
// visual feedback // visual feedback
Train->ggSandButton.UpdateValue( 1.0 ); Train->ggSandButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else if( Command.action == GLFW_RELEASE) { else if( Command.action == GLFW_RELEASE) {
// release // release
@@ -1127,19 +1127,22 @@ void TTrain::OnCommand_brakeactingspeedincrease( TTrain *Train, command_data con
Train->ggBrakeProfileCtrl.UpdateValue( Train->ggBrakeProfileCtrl.UpdateValue(
( ( Train->mvOccupied->BrakeDelayFlag & bdelay_R ) != 0 ? ( ( Train->mvOccupied->BrakeDelayFlag & bdelay_R ) != 0 ?
2.0 : 2.0 :
Train->mvOccupied->BrakeDelayFlag - 1 ) ); Train->mvOccupied->BrakeDelayFlag - 1 ),
Train->dsbSwitch );
} }
if( Train->ggBrakeProfileG.SubModel != nullptr ) { if( Train->ggBrakeProfileG.SubModel != nullptr ) {
Train->ggBrakeProfileG.UpdateValue( Train->ggBrakeProfileG.UpdateValue(
Train->mvOccupied->BrakeDelayFlag == bdelay_G ? ( Train->mvOccupied->BrakeDelayFlag == bdelay_G ?
1.0 : 1.0 :
0.0 ); 0.0 ),
Train->dsbSwitch );
} }
if( Train->ggBrakeProfileR.SubModel != nullptr ) { if( Train->ggBrakeProfileR.SubModel != nullptr ) {
Train->ggBrakeProfileR.UpdateValue( Train->ggBrakeProfileR.UpdateValue(
( Train->mvOccupied->BrakeDelayFlag & bdelay_R ) != 0 ? ( ( Train->mvOccupied->BrakeDelayFlag & bdelay_R ) != 0 ?
1.0 : 1.0 :
0.0 ); 0.0 ),
Train->dsbSwitch );
} }
} }
} }
@@ -1169,19 +1172,22 @@ void TTrain::OnCommand_brakeactingspeeddecrease( TTrain *Train, command_data con
Train->ggBrakeProfileCtrl.UpdateValue( Train->ggBrakeProfileCtrl.UpdateValue(
( ( Train->mvOccupied->BrakeDelayFlag & bdelay_R ) != 0 ? ( ( Train->mvOccupied->BrakeDelayFlag & bdelay_R ) != 0 ?
2.0 : 2.0 :
Train->mvOccupied->BrakeDelayFlag - 1 ) ); Train->mvOccupied->BrakeDelayFlag - 1 ),
Train->dsbSwitch );
} }
if( Train->ggBrakeProfileG.SubModel != nullptr ) { if( Train->ggBrakeProfileG.SubModel != nullptr ) {
Train->ggBrakeProfileG.UpdateValue( Train->ggBrakeProfileG.UpdateValue(
Train->mvOccupied->BrakeDelayFlag == bdelay_G ? ( Train->mvOccupied->BrakeDelayFlag == bdelay_G ?
1.0 : 1.0 :
0.0 ); 0.0 ),
Train->dsbSwitch );
} }
if( Train->ggBrakeProfileR.SubModel != nullptr ) { if( Train->ggBrakeProfileR.SubModel != nullptr ) {
Train->ggBrakeProfileR.UpdateValue( Train->ggBrakeProfileR.UpdateValue(
( Train->mvOccupied->BrakeDelayFlag & bdelay_R ) != 0 ? ( ( Train->mvOccupied->BrakeDelayFlag & bdelay_R ) != 0 ?
1.0 : 1.0 :
0.0 ); 0.0 ),
Train->dsbSwitch );
} }
} }
} }
@@ -1212,7 +1218,7 @@ void TTrain::OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data con
} }
#endif #endif
// visual feedback // visual feedback
Train->ggSignallingButton.UpdateValue( 1.0 ); Train->ggSignallingButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
//turn off //turn off
@@ -1224,7 +1230,7 @@ void TTrain::OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data con
} }
#endif #endif
// visual feedback // visual feedback
Train->ggSignallingButton.UpdateValue( 0.0 ); Train->ggSignallingButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -1282,7 +1288,7 @@ void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Co
} }
} }
// visual feedback // visual feedback
Train->ggSecurityResetButton.UpdateValue( 1.0 ); Train->ggSecurityResetButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggSecurityResetButton.GetValue() < 0.05 ) { if( Train->ggSecurityResetButton.GetValue() < 0.05 ) {
@@ -1314,7 +1320,7 @@ void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command
if( Train->mvOccupied->BatterySwitch( true ) ) { if( Train->mvOccupied->BatterySwitch( true ) ) {
// bateria potrzebna np. do zapalenia świateł // bateria potrzebna np. do zapalenia świateł
if( Train->ggBatteryButton.SubModel ) { if( Train->ggBatteryButton.SubModel ) {
Train->ggBatteryButton.UpdateValue( 1 ); Train->ggBatteryButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// audio feedback // audio feedback
@@ -1336,7 +1342,7 @@ void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command
if( Train->mvOccupied->BatterySwitch( false ) ) { if( Train->mvOccupied->BatterySwitch( false ) ) {
// ewentualnie zablokować z FIZ, np. w samochodach się nie odłącza akumulatora // ewentualnie zablokować z FIZ, np. w samochodach się nie odłącza akumulatora
if( Train->ggBatteryButton.SubModel ) { if( Train->ggBatteryButton.SubModel ) {
Train->ggBatteryButton.UpdateValue( 0 ); Train->ggBatteryButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// audio feedback // audio feedback
@@ -1367,15 +1373,19 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
#endif #endif
// visual feedback // visual feedback
Train->ggPantFrontButton.UpdateValue( 1.0 ); if( Train->ggPantFrontButton.SubModel )
Train->ggPantFrontButton.UpdateValue( 1.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedButton.UpdateValue( 1.0 ); if( Train->ggPantSelectedButton.SubModel )
Train->ggPantSelectedButton.UpdateValue( 1.0, Train->dsbSwitch );
// pantograph control can have two-button setup // pantograph control can have two-button setup
Train->ggPantFrontButtonOff.UpdateValue( 0.0 ); if( Train->ggPantFrontButtonOff.SubModel )
Train->ggPantFrontButtonOff.UpdateValue( 0.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedDownButton.UpdateValue( 0.0 ); if( Train->ggPantSelectedDownButton.SubModel )
Train->ggPantSelectedDownButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -1399,15 +1409,19 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
#endif #endif
// visual feedback // visual feedback
Train->ggPantFrontButton.UpdateValue( 0.0 ); if( Train->ggPantFrontButton.SubModel )
Train->ggPantFrontButton.UpdateValue( 0.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedButton.UpdateValue( 0.0 ); if( Train->ggPantSelectedButton.SubModel )
Train->ggPantSelectedButton.UpdateValue( 0.0, Train->dsbSwitch );
// pantograph control can have two-button setup // pantograph control can have two-button setup
Train->ggPantFrontButtonOff.UpdateValue( 1.0 ); if( Train->ggPantFrontButtonOff.SubModel )
Train->ggPantFrontButtonOff.UpdateValue( 1.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedDownButton.UpdateValue( 1.0 ); if( Train->ggPantSelectedDownButton.SubModel )
Train->ggPantSelectedDownButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
} }
} }
@@ -1420,23 +1434,24 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
} }
#endif #endif
Train->ggPantFrontButton.UpdateValue( 0.0 ); if( Train->ggPantFrontButton.SubModel )
Train->ggPantFrontButton.UpdateValue( 0.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedButton.UpdateValue( 0.0 ); if( Train->ggPantSelectedButton.SubModel )
Train->ggPantSelectedButton.UpdateValue( 0.0, Train->dsbSwitch );
// also the switch off button, in cabs which have it // also the switch off button, in cabs which have it
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
if( Train->ggPantFrontButtonOff.GetValue() > 0.35 ) { if( Train->ggPantFrontButtonOff.GetValue() > 0.35 ) {
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
} }
#endif #endif
if( Train->ggPantFrontButtonOff.SubModel ) { if( Train->ggPantFrontButtonOff.SubModel )
Train->ggPantFrontButtonOff.UpdateValue( 0.0 ); Train->ggPantFrontButtonOff.UpdateValue( 0.0, Train->dsbSwitch );
}
if( Train->ggPantSelectedDownButton.SubModel ) { if( Train->ggPantSelectedDownButton.SubModel ) {
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedDownButton.UpdateValue( 0.0 ); Train->ggPantSelectedDownButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -1456,15 +1471,19 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
#endif #endif
// visual feedback // visual feedback
Train->ggPantRearButton.UpdateValue( 1.0 ); if( Train->ggPantRearButton.SubModel )
Train->ggPantRearButton.UpdateValue( 1.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedButton.UpdateValue( 1.0 ); if( Train->ggPantSelectedButton.SubModel )
Train->ggPantSelectedButton.UpdateValue( 1.0, Train->dsbSwitch );
// pantograph control can have two-button setup // pantograph control can have two-button setup
Train->ggPantRearButtonOff.UpdateValue( 0.0 ); if( Train->ggPantRearButtonOff.SubModel )
Train->ggPantRearButtonOff.UpdateValue( 0.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedDownButton.UpdateValue( 0.0 ); if( Train->ggPantSelectedDownButton.SubModel )
Train->ggPantSelectedDownButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -1488,15 +1507,19 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
#endif #endif
// visual feedback // visual feedback
Train->ggPantRearButton.UpdateValue( 0.0 ); if( Train->ggPantRearButton.SubModel )
Train->ggPantRearButton.UpdateValue( 0.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedButton.UpdateValue( 0.0 ); if( Train->ggPantSelectedButton.SubModel )
Train->ggPantSelectedButton.UpdateValue( 0.0, Train->dsbSwitch );
// pantograph control can have two-button setup // pantograph control can have two-button setup
Train->ggPantRearButtonOff.UpdateValue( 1.0 ); if( Train->ggPantRearButtonOff.SubModel )
Train->ggPantRearButtonOff.UpdateValue( 1.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedDownButton.UpdateValue( 1.0 ); if( Train->ggPantSelectedDownButton.SubModel )
Train->ggPantSelectedDownButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
} }
} }
@@ -1509,23 +1532,24 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
} }
#endif #endif
Train->ggPantRearButton.UpdateValue( 0.0 ); if( Train->ggPantRearButton.SubModel )
Train->ggPantRearButton.UpdateValue( 0.0, Train->dsbSwitch );
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedButton.UpdateValue( 0.0 ); if( Train->ggPantSelectedButton.SubModel )
Train->ggPantSelectedButton.UpdateValue( 0.0, Train->dsbSwitch );
// also the switch off button, in cabs which have it // also the switch off button, in cabs which have it
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
if( Train->ggPantRearButtonOff.GetValue() > 0.35 ) { if( Train->ggPantRearButtonOff.GetValue() > 0.35 ) {
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
} }
#endif #endif
if( Train->ggPantRearButtonOff.SubModel ) { if( Train->ggPantRearButtonOff.SubModel )
Train->ggPantRearButtonOff.UpdateValue( 0.0 ); Train->ggPantRearButtonOff.UpdateValue( 0.0, Train->dsbSwitch );
}
if( Train->ggPantSelectedDownButton.SubModel ) { if( Train->ggPantSelectedDownButton.SubModel ) {
// NOTE: currently we animate the selectable pantograph control based on standard key presses // NOTE: currently we animate the selectable pantograph control based on standard key presses
// TODO: implement actual selection control, and refactor handling this control setup in a separate method // TODO: implement actual selection control, and refactor handling this control setup in a separate method
Train->ggPantSelectedDownButton.UpdateValue( 0.0 ); Train->ggPantSelectedDownButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -1619,9 +1643,10 @@ void TTrain::OnCommand_pantographlowerall( TTrain *Train, command_data const &Co
} }
#endif #endif
// visual feedback // visual feedback
Train->ggPantAllDownButton.UpdateValue( 1.0 ); if( Train->ggPantAllDownButton.SubModel )
if( Train->ggPantSelectedDownButton.SubModel != nullptr ) { Train->ggPantAllDownButton.UpdateValue( 1.0, Train->dsbSwitch );
Train->ggPantSelectedDownButton.UpdateValue( 1.0 ); if( Train->ggPantSelectedDownButton.SubModel ) {
Train->ggPantSelectedDownButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
} }
else if( Command.action == GLFW_RELEASE ) { else if( Command.action == GLFW_RELEASE ) {
@@ -1637,8 +1662,9 @@ void TTrain::OnCommand_pantographlowerall( TTrain *Train, command_data const &Co
*/ */
#endif #endif
// visual feedback // visual feedback
Train->ggPantAllDownButton.UpdateValue( 0.0 ); if( Train->ggPantAllDownButton.SubModel )
if( Train->ggPantSelectedDownButton.SubModel != nullptr ) { Train->ggPantAllDownButton.UpdateValue( 0.0 );
if( Train->ggPantSelectedDownButton.SubModel ) {
Train->ggPantSelectedDownButton.UpdateValue( 0.0 ); Train->ggPantSelectedDownButton.UpdateValue( 0.0 );
} }
} }
@@ -1680,7 +1706,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggMainOnButton.UpdateValue( 1.0 ); Train->ggMainOnButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else if( Train->ggMainButton.SubModel != nullptr ) { else if( Train->ggMainButton.SubModel != nullptr ) {
// single two-state switch // single two-state switch
@@ -1691,7 +1717,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggMainButton.UpdateValue( 1.0 ); Train->ggMainButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
// keep track of period the button is held down, to determine when/if circuit closes // keep track of period the button is held down, to determine when/if circuit closes
if( ( ( ( Train->mvControlled->EngineType != ElectricSeriesMotor ) if( ( ( ( Train->mvControlled->EngineType != ElectricSeriesMotor )
@@ -1739,7 +1765,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggMainOffButton.UpdateValue( 1.0 ); Train->ggMainOffButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else if( Train->ggMainButton.SubModel != nullptr ) { else if( Train->ggMainButton.SubModel != nullptr ) {
// single two-state switch // single two-state switch
@@ -1765,7 +1791,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggMainButton.UpdateValue( 0.0 ); Train->ggMainButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -1788,7 +1814,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
// we don't exactly know which of the two buttons was used, so reset both // we don't exactly know which of the two buttons was used, so reset both
// for setup with two separate swiches // for setup with two separate swiches
if( Train->ggMainOnButton.SubModel != nullptr ) { if( Train->ggMainOnButton.SubModel != nullptr ) {
Train->ggMainOnButton.UpdateValue( 0.0 ); Train->ggMainOnButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// audio feedback // audio feedback
if( Train->ggMainOnButton.GetValue() > 0.5 ) { if( Train->ggMainOnButton.GetValue() > 0.5 ) {
@@ -1797,7 +1823,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
#endif #endif
} }
if( Train->ggMainOffButton.SubModel != nullptr ) { if( Train->ggMainOffButton.SubModel != nullptr ) {
Train->ggMainOffButton.UpdateValue( 0.0 ); Train->ggMainOffButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
// and the two-state switch too, for good measure // and the two-state switch too, for good measure
if( Train->ggMainButton.SubModel != nullptr ) { if( Train->ggMainButton.SubModel != nullptr ) {
@@ -1808,7 +1834,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggMainButton.UpdateValue( 0.0 ); Train->ggMainButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
// finalize the state of the line breaker // finalize the state of the line breaker
Train->m_linebreakerstate = 0; Train->m_linebreakerstate = 0;
@@ -1832,7 +1858,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
// visual feedback // visual feedback
if( Train->ggMainOnButton.SubModel != nullptr ) { if( Train->ggMainOnButton.SubModel != nullptr ) {
// setup with two separate switches // setup with two separate switches
Train->ggMainOnButton.UpdateValue( 0.0 ); Train->ggMainOnButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
// NOTE: we don't have switch type definition for the line breaker switch // NOTE: we don't have switch type definition for the line breaker switch
// so for the time being we have hard coded "impulse" switches for all EMUs // so for the time being we have hard coded "impulse" switches for all EMUs
@@ -1846,7 +1872,7 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggMainButton.UpdateValue( 0.0 ); Train->ggMainButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
// finalize the state of the line breaker // finalize the state of the line breaker
@@ -1876,7 +1902,7 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma
} }
#endif #endif
// visual feedback // visual feedback
Train->ggConverterButton.UpdateValue( 1.0 ); Train->ggConverterButton.UpdateValue( 1.0, Train->dsbSwitch );
/* /*
if( ( Train->mvControlled->EnginePowerSource.SourceType != CurrentCollector ) if( ( Train->mvControlled->EnginePowerSource.SourceType != CurrentCollector )
|| ( Train->mvControlled->PantRearVolt != 0.0 ) || ( Train->mvControlled->PantRearVolt != 0.0 )
@@ -1916,9 +1942,9 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma
} }
#endif #endif
// visual feedback // visual feedback
Train->ggConverterButton.UpdateValue( 0.0 ); Train->ggConverterButton.UpdateValue( 0.0, Train->dsbSwitch );
if( Train->ggConverterOffButton.SubModel != nullptr ) { if( Train->ggConverterOffButton.SubModel != nullptr ) {
Train->ggConverterOffButton.UpdateValue( 1.0 ); Train->ggConverterOffButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
if( true == Train->mvControlled->ConverterSwitch( false ) ) { if( true == Train->mvControlled->ConverterSwitch( false ) ) {
// side effects // side effects
@@ -1950,8 +1976,8 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma
Train->play_sound( Train->dsbSwitch ); Train->play_sound( Train->dsbSwitch );
} }
#endif #endif
Train->ggConverterButton.UpdateValue( 0.0 ); Train->ggConverterButton.UpdateValue( 0.0, Train->dsbSwitch );
Train->ggConverterOffButton.UpdateValue( 0.0 ); Train->ggConverterOffButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -1978,7 +2004,7 @@ void TTrain::OnCommand_convertertogglelocal( TTrain *Train, command_data const &
} }
#endif #endif
// visual feedback // visual feedback
Train->ggConverterLocalButton.UpdateValue( 1.0 ); Train->ggConverterLocalButton.UpdateValue( 1.0, Train->dsbSwitch );
// effect // effect
Train->mvOccupied->ConverterAllowLocal = true; Train->mvOccupied->ConverterAllowLocal = true;
/* /*
@@ -2001,7 +2027,7 @@ void TTrain::OnCommand_convertertogglelocal( TTrain *Train, command_data const &
} }
#endif #endif
// visual feedback // visual feedback
Train->ggConverterLocalButton.UpdateValue( 0.0 ); Train->ggConverterLocalButton.UpdateValue( 0.0, Train->dsbSwitch );
// effect // effect
Train->mvOccupied->ConverterAllowLocal = false; Train->mvOccupied->ConverterAllowLocal = false;
/* /*
@@ -2046,7 +2072,7 @@ void TTrain::OnCommand_converteroverloadrelayreset( TTrain *Train, command_data
} }
#endif #endif
// visual feedback // visual feedback
Train->ggConverterFuseButton.UpdateValue( 1.0 ); Train->ggConverterFuseButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else if( Command.action == GLFW_RELEASE ) { else if( Command.action == GLFW_RELEASE ) {
// release // release
@@ -2057,7 +2083,7 @@ void TTrain::OnCommand_converteroverloadrelayreset( TTrain *Train, command_data
} }
#endif #endif
// visual feedback // visual feedback
Train->ggConverterFuseButton.UpdateValue( 0.0 ); Train->ggConverterFuseButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
@@ -2072,7 +2098,7 @@ void TTrain::OnCommand_compressortoggle( TTrain *Train, command_data const &Comm
if( false == Train->mvControlled->CompressorAllow ) { if( false == Train->mvControlled->CompressorAllow ) {
// turn on // turn on
// visual feedback // visual feedback
Train->ggCompressorButton.UpdateValue( 1.0 ); Train->ggCompressorButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggCompressorButton.GetValue() < 0.5 ) { if( Train->ggCompressorButton.GetValue() < 0.5 ) {
@@ -2104,7 +2130,7 @@ void TTrain::OnCommand_compressortoggle( TTrain *Train, command_data const &Comm
// } // }
// else { // else {
// visual feedback // visual feedback
Train->ggCompressorButton.UpdateValue( 0.0 ); Train->ggCompressorButton.UpdateValue( 0.0, Train->dsbSwitch );
// } // }
} }
} }
@@ -2148,7 +2174,7 @@ void TTrain::OnCommand_compressortogglelocal( TTrain *Train, command_data const
} }
#endif #endif
// visual feedback // visual feedback
Train->ggCompressorLocalButton.UpdateValue( 1.0 ); Train->ggCompressorLocalButton.UpdateValue( 1.0, Train->dsbSwitch );
// effect // effect
Train->mvOccupied->CompressorAllowLocal = true; Train->mvOccupied->CompressorAllowLocal = true;
} }
@@ -2161,7 +2187,7 @@ void TTrain::OnCommand_compressortogglelocal( TTrain *Train, command_data const
} }
#endif #endif
// visual feedback // visual feedback
Train->ggCompressorLocalButton.UpdateValue( 0.0 ); Train->ggCompressorLocalButton.UpdateValue( 0.0, Train->dsbSwitch );
// effect // effect
Train->mvOccupied->CompressorAllowLocal = false; Train->mvOccupied->CompressorAllowLocal = false;
} }
@@ -2206,7 +2232,7 @@ void TTrain::OnCommand_motorconnectorsopen( TTrain *Train, command_data const &C
} }
#endif #endif
// visual feedback // visual feedback
Train->ggStLinOffButton.UpdateValue( 1.0 ); Train->ggStLinOffButton.UpdateValue( 1.0, Train->dsbSwitch );
// effect // effect
if( true == Train->mvControlled->StLinFlag ) { if( true == Train->mvControlled->StLinFlag ) {
Train->play_sound( Train->dsbRelay ); Train->play_sound( Train->dsbRelay );
@@ -2255,7 +2281,7 @@ void TTrain::OnCommand_motorconnectorsopen( TTrain *Train, command_data const &C
} }
#endif #endif
// visual feedback // visual feedback
Train->ggStLinOffButton.UpdateValue( 0.0 ); Train->ggStLinOffButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -2286,7 +2312,7 @@ void TTrain::OnCommand_motorconnectorsopen( TTrain *Train, command_data const &C
} }
#endif #endif
// visual feedback // visual feedback
Train->ggStLinOffButton.UpdateValue( 0.0 ); Train->ggStLinOffButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -2320,7 +2346,7 @@ void TTrain::OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command
// turn on // turn on
if( true == Train->mvControlled->CurrentSwitch( true ) ) { if( true == Train->mvControlled->CurrentSwitch( true ) ) {
// visual feedback // visual feedback
Train->ggMaxCurrentCtrl.UpdateValue( 1.0 ); Train->ggMaxCurrentCtrl.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggMaxCurrentCtrl.GetValue() < 0.5 ) { if( Train->ggMaxCurrentCtrl.GetValue() < 0.5 ) {
@@ -2333,7 +2359,7 @@ void TTrain::OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command
//turn off //turn off
if( true == Train->mvControlled->CurrentSwitch( false ) ) { if( true == Train->mvControlled->CurrentSwitch( false ) ) {
// visual feedback // visual feedback
Train->ggMaxCurrentCtrl.UpdateValue( 0.0 ); Train->ggMaxCurrentCtrl.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggMaxCurrentCtrl.GetValue() > 0.5 ) { if( Train->ggMaxCurrentCtrl.GetValue() > 0.5 ) {
@@ -2364,7 +2390,7 @@ void TTrain::OnCommand_motoroverloadrelayreset( TTrain *Train, command_data cons
} }
#endif #endif
// visual feedback // visual feedback
Train->ggFuseButton.UpdateValue( 1.0 ); Train->ggFuseButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else if( Command.action == GLFW_RELEASE ) { else if( Command.action == GLFW_RELEASE ) {
// release // release
@@ -2375,7 +2401,7 @@ void TTrain::OnCommand_motoroverloadrelayreset( TTrain *Train, command_data cons
} }
#endif #endif
// visual feedback // visual feedback
Train->ggFuseButton.UpdateValue( 0.0 ); Train->ggFuseButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
@@ -2397,7 +2423,7 @@ void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &C
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
// visual feedback // visual feedback
Train->ggLeftLightButton.UpdateValue( 1.0 ); Train->ggLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggLeftLightButton.GetValue() < 0.5 ) { if( Train->ggLeftLightButton.GetValue() < 0.5 ) {
@@ -2409,7 +2435,7 @@ void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &C
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
// visual feedback // visual feedback
Train->ggLeftLightButton.UpdateValue( 0.0 ); Train->ggLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggLeftLightButton.GetValue() > 0.5 ) { if( Train->ggLeftLightButton.GetValue() > 0.5 ) {
@@ -2438,7 +2464,7 @@ void TTrain::OnCommand_headlighttoggleright( TTrain *Train, command_data const &
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
// visual feedback // visual feedback
Train->ggRightLightButton.UpdateValue( 1.0 ); Train->ggRightLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRightLightButton.GetValue() < 0.5 ) { if( Train->ggRightLightButton.GetValue() < 0.5 ) {
@@ -2450,7 +2476,7 @@ void TTrain::OnCommand_headlighttoggleright( TTrain *Train, command_data const &
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
// visual feedback // visual feedback
Train->ggRightLightButton.UpdateValue( 0.0 ); Train->ggRightLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRightLightButton.GetValue() > 0.5 ) { if( Train->ggRightLightButton.GetValue() > 0.5 ) {
@@ -2479,7 +2505,7 @@ void TTrain::OnCommand_headlighttoggleupper( TTrain *Train, command_data const &
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
// visual feedback // visual feedback
Train->ggUpperLightButton.UpdateValue( 1.0 ); Train->ggUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggUpperLightButton.GetValue() < 0.5 ) { if( Train->ggUpperLightButton.GetValue() < 0.5 ) {
@@ -2491,7 +2517,7 @@ void TTrain::OnCommand_headlighttoggleupper( TTrain *Train, command_data const &
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
// visual feedback // visual feedback
Train->ggUpperLightButton.UpdateValue( 0.0 ); Train->ggUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggUpperLightButton.GetValue() > 0.5 ) { if( Train->ggUpperLightButton.GetValue() > 0.5 ) {
@@ -2520,7 +2546,7 @@ void TTrain::OnCommand_redmarkertoggleleft( TTrain *Train, command_data const &C
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
// visual feedback // visual feedback
Train->ggLeftEndLightButton.UpdateValue( 1.0 ); Train->ggLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggLeftEndLightButton.GetValue() < 0.5 ) { if( Train->ggLeftEndLightButton.GetValue() < 0.5 ) {
@@ -2532,7 +2558,7 @@ void TTrain::OnCommand_redmarkertoggleleft( TTrain *Train, command_data const &C
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
// visual feedback // visual feedback
Train->ggLeftEndLightButton.UpdateValue( 0.0 ); Train->ggLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggLeftEndLightButton.GetValue() > 0.5 ) { if( Train->ggLeftEndLightButton.GetValue() > 0.5 ) {
@@ -2561,7 +2587,7 @@ void TTrain::OnCommand_redmarkertoggleright( TTrain *Train, command_data const &
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
// visual feedback // visual feedback
Train->ggRightEndLightButton.UpdateValue( 1.0 ); Train->ggRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRightEndLightButton.GetValue() < 0.5 ) { if( Train->ggRightEndLightButton.GetValue() < 0.5 ) {
@@ -2573,7 +2599,7 @@ void TTrain::OnCommand_redmarkertoggleright( TTrain *Train, command_data const &
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
// visual feedback // visual feedback
Train->ggRightEndLightButton.UpdateValue( 0.0 ); Train->ggRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRightEndLightButton.GetValue() > 0.5 ) { if( Train->ggRightEndLightButton.GetValue() > 0.5 ) {
@@ -2603,7 +2629,7 @@ void TTrain::OnCommand_headlighttogglerearleft( TTrain *Train, command_data cons
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
// visual feedback // visual feedback
Train->ggRearLeftLightButton.UpdateValue( 1.0 ); Train->ggRearLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearLeftLightButton.GetValue() < 0.5 ) { if( Train->ggRearLeftLightButton.GetValue() < 0.5 ) {
@@ -2615,7 +2641,7 @@ void TTrain::OnCommand_headlighttogglerearleft( TTrain *Train, command_data cons
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
// visual feedback // visual feedback
Train->ggRearLeftLightButton.UpdateValue( 0.0 ); Train->ggRearLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearLeftLightButton.GetValue() > 0.5 ) { if( Train->ggRearLeftLightButton.GetValue() > 0.5 ) {
@@ -2645,7 +2671,7 @@ void TTrain::OnCommand_headlighttogglerearright( TTrain *Train, command_data con
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
// visual feedback // visual feedback
Train->ggRearRightLightButton.UpdateValue( 1.0 ); Train->ggRearRightLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearRightLightButton.GetValue() < 0.5 ) { if( Train->ggRearRightLightButton.GetValue() < 0.5 ) {
@@ -2657,7 +2683,7 @@ void TTrain::OnCommand_headlighttogglerearright( TTrain *Train, command_data con
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
// visual feedback // visual feedback
Train->ggRearRightLightButton.UpdateValue( 0.0 ); Train->ggRearRightLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearRightLightButton.GetValue() > 0.5 ) { if( Train->ggRearRightLightButton.GetValue() > 0.5 ) {
@@ -2686,7 +2712,7 @@ void TTrain::OnCommand_headlighttogglerearupper( TTrain *Train, command_data con
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
// visual feedback // visual feedback
Train->ggRearUpperLightButton.UpdateValue( 1.0 ); Train->ggRearUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearUpperLightButton.GetValue() < 0.5 ) { if( Train->ggRearUpperLightButton.GetValue() < 0.5 ) {
@@ -2698,7 +2724,7 @@ void TTrain::OnCommand_headlighttogglerearupper( TTrain *Train, command_data con
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
// visual feedback // visual feedback
Train->ggRearUpperLightButton.UpdateValue( 0.0 ); Train->ggRearUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearUpperLightButton.GetValue() > 0.5 ) { if( Train->ggRearUpperLightButton.GetValue() > 0.5 ) {
@@ -2728,7 +2754,7 @@ void TTrain::OnCommand_redmarkertogglerearleft( TTrain *Train, command_data cons
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
// visual feedback // visual feedback
Train->ggRearLeftEndLightButton.UpdateValue( 1.0 ); Train->ggRearLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearLeftEndLightButton.GetValue() < 0.5 ) { if( Train->ggRearLeftEndLightButton.GetValue() < 0.5 ) {
@@ -2740,7 +2766,7 @@ void TTrain::OnCommand_redmarkertogglerearleft( TTrain *Train, command_data cons
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
// visual feedback // visual feedback
Train->ggRearLeftEndLightButton.UpdateValue( 0.0 ); Train->ggRearLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearLeftEndLightButton.GetValue() > 0.5 ) { if( Train->ggRearLeftEndLightButton.GetValue() > 0.5 ) {
@@ -2770,7 +2796,7 @@ void TTrain::OnCommand_redmarkertogglerearright( TTrain *Train, command_data con
// turn on // turn on
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
// visual feedback // visual feedback
Train->ggRearRightEndLightButton.UpdateValue( 1.0 ); Train->ggRearRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearRightEndLightButton.GetValue() < 0.5 ) { if( Train->ggRearRightEndLightButton.GetValue() < 0.5 ) {
@@ -2782,7 +2808,7 @@ void TTrain::OnCommand_redmarkertogglerearright( TTrain *Train, command_data con
//turn off //turn off
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left; Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
// visual feedback // visual feedback
Train->ggRearRightEndLightButton.UpdateValue( 0.0 ); Train->ggRearRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggRearRightEndLightButton.GetValue() > 0.5 ) { if( Train->ggRearRightEndLightButton.GetValue() > 0.5 ) {
@@ -2816,7 +2842,7 @@ void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &C
} }
#endif #endif
// visual feedback // visual feedback
Train->ggDimHeadlightsButton.UpdateValue( 1.0 ); Train->ggDimHeadlightsButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
//turn off //turn off
@@ -2828,7 +2854,7 @@ void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &C
} }
#endif #endif
// visual feedback // visual feedback
Train->ggDimHeadlightsButton.UpdateValue( 0.0 ); Train->ggDimHeadlightsButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -2857,7 +2883,7 @@ void TTrain::OnCommand_interiorlighttoggle( TTrain *Train, command_data const &C
} }
#endif #endif
// visual feedback // visual feedback
Train->ggCabLightButton.UpdateValue( 1.0 ); Train->ggCabLightButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
//turn off //turn off
@@ -2870,7 +2896,7 @@ void TTrain::OnCommand_interiorlighttoggle( TTrain *Train, command_data const &C
} }
#endif #endif
// visual feedback // visual feedback
Train->ggCabLightButton.UpdateValue( 0.0 ); Train->ggCabLightButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -2897,7 +2923,7 @@ void TTrain::OnCommand_interiorlightdimtoggle( TTrain *Train, command_data const
} }
#endif #endif
// visual feedback // visual feedback
Train->ggCabLightDimButton.UpdateValue( 1.0 ); Train->ggCabLightDimButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
//turn off //turn off
@@ -2909,7 +2935,7 @@ void TTrain::OnCommand_interiorlightdimtoggle( TTrain *Train, command_data const
} }
#endif #endif
// visual feedback // visual feedback
Train->ggCabLightDimButton.UpdateValue( 0.0 ); Train->ggCabLightDimButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -2938,7 +2964,7 @@ void TTrain::OnCommand_instrumentlighttoggle( TTrain *Train, command_data const
} }
#endif #endif
// visual feedback // visual feedback
Train->ggInstrumentLightButton.UpdateValue( 1.0 ); Train->ggInstrumentLightButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
//turn off //turn off
@@ -2950,7 +2976,7 @@ void TTrain::OnCommand_instrumentlighttoggle( TTrain *Train, command_data const
} }
#endif #endif
// visual feedback // visual feedback
Train->ggInstrumentLightButton.UpdateValue( 0.0 ); Train->ggInstrumentLightButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -2976,7 +3002,7 @@ void TTrain::OnCommand_heatingtoggle( TTrain *Train, command_data const &Command
} }
#endif #endif
// visual feedback // visual feedback
Train->ggTrainHeatingButton.UpdateValue( 1.0 ); Train->ggTrainHeatingButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
//turn off //turn off
@@ -2988,7 +3014,7 @@ void TTrain::OnCommand_heatingtoggle( TTrain *Train, command_data const &Command
} }
#endif #endif
// visual feedback // visual feedback
Train->ggTrainHeatingButton.UpdateValue( 0.0 ); Train->ggTrainHeatingButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -3016,7 +3042,7 @@ void TTrain::OnCommand_generictoggle( TTrain *Train, command_data const &Command
} }
#endif #endif
// visual feedback // visual feedback
item.UpdateValue( 1.0 ); item.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
//turn off //turn off
@@ -3027,7 +3053,7 @@ void TTrain::OnCommand_generictoggle( TTrain *Train, command_data const &Command
} }
#endif #endif
// visual feedback // visual feedback
item.UpdateValue( 0.0 ); item.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -3055,7 +3081,7 @@ void TTrain::OnCommand_doorlocktoggle( TTrain *Train, command_data const &Comman
} }
#endif #endif
// visual feedback // visual feedback
Train->ggDoorSignallingButton.UpdateValue( 1.0 ); Train->ggDoorSignallingButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
// turn off // turn off
@@ -3069,7 +3095,7 @@ void TTrain::OnCommand_doorlocktoggle( TTrain *Train, command_data const &Comman
} }
#endif #endif
// visual feedback // visual feedback
Train->ggDoorSignallingButton.UpdateValue( 0.0 ); Train->ggDoorSignallingButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -3088,7 +3114,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
// open // open
if( Train->mvOccupied->ActiveCab == 1 ) { if( Train->mvOccupied->ActiveCab == 1 ) {
if( Train->mvOccupied->DoorLeft( true ) ) { if( Train->mvOccupied->DoorLeft( true ) ) {
Train->ggDoorLeftButton.UpdateValue( 1.0 ); Train->ggDoorLeftButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggDoorLeftButton.GetValue() < 0.5 ) { if( Train->ggDoorLeftButton.GetValue() < 0.5 ) {
@@ -3101,7 +3127,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
else { else {
// in the rear cab sides are reversed // in the rear cab sides are reversed
if( Train->mvOccupied->DoorRight( true ) ) { if( Train->mvOccupied->DoorRight( true ) ) {
Train->ggDoorRightButton.UpdateValue( 1.0 ); Train->ggDoorRightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggDoorRightButton.GetValue() < 0.5 ) { if( Train->ggDoorRightButton.GetValue() < 0.5 ) {
@@ -3116,7 +3142,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
// close // close
if( Train->mvOccupied->ActiveCab == 1 ) { if( Train->mvOccupied->ActiveCab == 1 ) {
if( Train->mvOccupied->DoorLeft( false ) ) { if( Train->mvOccupied->DoorLeft( false ) ) {
Train->ggDoorLeftButton.UpdateValue( 0.0 ); Train->ggDoorLeftButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggDoorLeftButton.GetValue() > 0.5 ) { if( Train->ggDoorLeftButton.GetValue() > 0.5 ) {
@@ -3129,7 +3155,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
else { else {
// in the rear cab sides are reversed // in the rear cab sides are reversed
if( Train->mvOccupied->DoorRight( false ) ) { if( Train->mvOccupied->DoorRight( false ) ) {
Train->ggDoorRightButton.UpdateValue( 0.0 ); Train->ggDoorRightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggDoorRightButton.GetValue() > 0.5 ) { if( Train->ggDoorRightButton.GetValue() > 0.5 ) {
@@ -3157,7 +3183,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
// open // open
if( Train->mvOccupied->ActiveCab == 1 ) { if( Train->mvOccupied->ActiveCab == 1 ) {
if( Train->mvOccupied->DoorRight( true ) ) { if( Train->mvOccupied->DoorRight( true ) ) {
Train->ggDoorRightButton.UpdateValue( 1.0 ); Train->ggDoorRightButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggDoorRightButton.GetValue() < 0.5 ) { if( Train->ggDoorRightButton.GetValue() < 0.5 ) {
@@ -3170,7 +3196,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
else { else {
// in the rear cab sides are reversed // in the rear cab sides are reversed
if( Train->mvOccupied->DoorLeft( true ) ) { if( Train->mvOccupied->DoorLeft( true ) ) {
Train->ggDoorLeftButton.UpdateValue( 1.0 ); Train->ggDoorLeftButton.UpdateValue( 1.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggDoorLeftButton.GetValue() < 0.5 ) { if( Train->ggDoorLeftButton.GetValue() < 0.5 ) {
@@ -3185,7 +3211,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
// close // close
if( Train->mvOccupied->ActiveCab == 1 ) { if( Train->mvOccupied->ActiveCab == 1 ) {
if( Train->mvOccupied->DoorRight( false ) ) { if( Train->mvOccupied->DoorRight( false ) ) {
Train->ggDoorRightButton.UpdateValue( 0.0 ); Train->ggDoorRightButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggDoorRightButton.GetValue() > 0.5 ) { if( Train->ggDoorRightButton.GetValue() > 0.5 ) {
@@ -3198,7 +3224,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
else { else {
// in the rear cab sides are reversed // in the rear cab sides are reversed
if( Train->mvOccupied->DoorLeft( false ) ) { if( Train->mvOccupied->DoorLeft( false ) ) {
Train->ggDoorLeftButton.UpdateValue( 0.0 ); Train->ggDoorLeftButton.UpdateValue( 0.0, Train->dsbSwitch );
#ifdef EU07_USE_OLD_CONTROLSOUNDS #ifdef EU07_USE_OLD_CONTROLSOUNDS
// sound feedback // sound feedback
if( Train->ggDoorLeftButton.GetValue() > 0.5 ) { if( Train->ggDoorLeftButton.GetValue() > 0.5 ) {
@@ -3233,7 +3259,7 @@ void TTrain::OnCommand_departureannounce( TTrain *Train, command_data const &Com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggDepartureSignalButton.UpdateValue( 1.0 ); Train->ggDepartureSignalButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
} }
else if( Command.action == GLFW_RELEASE ) { else if( Command.action == GLFW_RELEASE ) {
@@ -3246,7 +3272,7 @@ void TTrain::OnCommand_departureannounce( TTrain *Train, command_data const &Com
} }
#endif #endif
// visual feedback // visual feedback
Train->ggDepartureSignalButton.UpdateValue( 0.0 ); Train->ggDepartureSignalButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
@@ -3378,7 +3404,7 @@ void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command )
} }
#endif #endif
// visual feedback // visual feedback
Train->ggRadioButton.UpdateValue( 1.0 ); Train->ggRadioButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
// turn off // turn off
@@ -3390,7 +3416,7 @@ void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command )
} }
#endif #endif
// visual feedback // visual feedback
Train->ggRadioButton.UpdateValue( 0.0 ); Train->ggRadioButton.UpdateValue( 0.0, Train->dsbSwitch );
} }
} }
} }
@@ -5121,13 +5147,18 @@ bool TTrain::Update( double const Deltatime )
btLampkaED.TurnOff(); btLampkaED.TurnOff();
} }
// McZapkie-080602: obroty (albo translacje) regulatorow // McZapkie-080602: obroty (albo translacje) regulatorow
if (ggMainCtrl.SubModel) if (ggMainCtrl.SubModel) {
{
if (mvControlled->CoupledCtrl) if( mvControlled->CoupledCtrl ) {
ggMainCtrl.UpdateValue( ggMainCtrl.UpdateValue(
double(mvControlled->MainCtrlPos + mvControlled->ScndCtrlPos)); double( mvControlled->MainCtrlPos + mvControlled->ScndCtrlPos ),
else dsbNastawnikJazdy );
ggMainCtrl.UpdateValue(double(mvControlled->MainCtrlPos)); }
else {
ggMainCtrl.UpdateValue(
double( mvControlled->MainCtrlPos ),
dsbNastawnikJazdy );
}
ggMainCtrl.Update(); ggMainCtrl.Update();
} }
if (ggMainCtrlAct.SubModel) if (ggMainCtrlAct.SubModel)
@@ -5139,21 +5170,23 @@ bool TTrain::Update( double const Deltatime )
ggMainCtrlAct.UpdateValue(double(mvControlled->MainCtrlActualPos)); ggMainCtrlAct.UpdateValue(double(mvControlled->MainCtrlActualPos));
ggMainCtrlAct.Update(); ggMainCtrlAct.Update();
} }
if (ggScndCtrl.SubModel) if (ggScndCtrl.SubModel) {
{ // Ra: od byte odejmowane boolean i konwertowane // Ra: od byte odejmowane boolean i konwertowane potem na double?
// potem na double?
ggScndCtrl.UpdateValue( ggScndCtrl.UpdateValue(
double(mvControlled->ScndCtrlPos - double( mvControlled->ScndCtrlPos
((mvControlled->TrainType == dt_ET42) && mvControlled->DynamicBrakeFlag))); - ( ( mvControlled->TrainType == dt_ET42 ) && mvControlled->DynamicBrakeFlag ) ),
dsbNastawnikBocz );
ggScndCtrl.Update(); ggScndCtrl.Update();
} }
if (ggDirKey.SubModel) if (ggDirKey.SubModel) {
{
if (mvControlled->TrainType != dt_EZT) if (mvControlled->TrainType != dt_EZT)
ggDirKey.UpdateValue(double(mvControlled->ActiveDir)); ggDirKey.UpdateValue(
double(mvControlled->ActiveDir),
dsbReverserKey);
else else
ggDirKey.UpdateValue(double(mvControlled->ActiveDir) + ggDirKey.UpdateValue(
double(mvControlled->Imin == mvControlled->IminHi)); double(mvControlled->ActiveDir) + double(mvControlled->Imin == mvControlled->IminHi),
dsbReverserKey);
ggDirKey.Update(); ggDirKey.Update();
} }
if (ggBrakeCtrl.SubModel) if (ggBrakeCtrl.SubModel)

View File

@@ -346,12 +346,12 @@ opengl_renderer::Render_camera() {
break; break;
} }
case rendermode::shadows: { case rendermode::shadows: {
m_renderpass.camera.position() = Global::pCameraPosition - glm::dvec3{ Global::DayLight.direction * 750.0f }; m_renderpass.camera.position() = Global::pCameraPosition - glm::dvec3{ Global::DayLight.direction * 750.f };
m_renderpass.camera.position().y = std::max( 50.0, m_renderpass.camera.position().y ); // prevent shadow source from dipping too low m_renderpass.camera.position().y = std::max( 50.0, m_renderpass.camera.position().y ); // prevent shadow source from dipping too low
viewmatrix = glm::lookAt( viewmatrix = glm::lookAt(
m_renderpass.camera.position(), m_renderpass.camera.position(),
glm::dvec3{ Global::pCameraPosition.x, 0.0, Global::pCameraPosition.z }, glm::dvec3{ Global::pCameraPosition.x, 0.0, Global::pCameraPosition.z },
glm::dvec3{ 0.0f, 1.0f, 0.0f } ); glm::dvec3{ 0.f, 1.f, 0.f } );
break; break;
} }
default: { default: {

View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#define VERSION_MAJOR 17 #define VERSION_MAJOR 17
#define VERSION_MINOR 714 #define VERSION_MINOR 715
#define VERSION_REVISION 0 #define VERSION_REVISION 0