mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 200701. additional coupler sounds, ep brake state exposed to uart interface, line breaker state cab indicator variant
This commit is contained in:
184
DynObj.cpp
184
DynObj.cpp
@@ -4625,25 +4625,38 @@ void TDynamicObject::RenderSounds() {
|
||||
.play( sound_flags::exclusive );
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: dedicated sound for each connection type
|
||||
// until then, play legacy placeholders:
|
||||
if( ( coupler.sounds & ( sound::attachcoupler | sound::attachcontrol | sound::attachgangway ) ) != 0 ) {
|
||||
m_couplersounds[ couplerindex ].dsbCouplerAttach.play();
|
||||
// attach/detach sounds
|
||||
if( ( coupler.sounds & sound::attachcoupler ) != 0 ) {
|
||||
couplersounds.attach_coupler.play();
|
||||
}
|
||||
if( ( coupler.sounds & ( sound::attachbrakehose | sound::attachmainhose | sound::attachheating ) ) != 0 ) {
|
||||
m_couplersounds[ couplerindex ].dsbCouplerDetach.play();
|
||||
if( ( coupler.sounds & sound::attachbrakehose ) != 0 ) {
|
||||
couplersounds.attach_brakehose.play();
|
||||
}
|
||||
if( ( coupler.sounds & sound::attachmainhose ) != 0 ) {
|
||||
couplersounds.attach_mainhose.play();
|
||||
}
|
||||
if( ( coupler.sounds & sound::attachcontrol ) != 0 ) {
|
||||
couplersounds.attach_control.play();
|
||||
}
|
||||
if( ( coupler.sounds & sound::attachgangway ) != 0 ) {
|
||||
couplersounds.attach_gangway.play();
|
||||
}
|
||||
if( ( coupler.sounds & sound::attachheating ) != 0 ) {
|
||||
couplersounds.attach_heating.play();
|
||||
}
|
||||
if( true == TestFlag( coupler.sounds, sound::detachall ) ) {
|
||||
// TODO: dedicated disconnect sounds
|
||||
m_couplersounds[ couplerindex ].dsbCouplerAttach.play();
|
||||
m_couplersounds[ couplerindex ].dsbCouplerDetach.play();
|
||||
couplersounds.detach_coupler.play();
|
||||
couplersounds.detach_brakehose.play();
|
||||
couplersounds.detach_mainhose.play();
|
||||
couplersounds.detach_control.play();
|
||||
couplersounds.detach_gangway.play();
|
||||
couplersounds.detach_heating.play();
|
||||
}
|
||||
if( true == TestFlag( coupler.sounds, sound::attachadapter ) ) {
|
||||
m_couplersounds[ couplerindex ].dsbAdapterAttach.play();
|
||||
couplersounds.dsbAdapterAttach.play();
|
||||
}
|
||||
if( true == TestFlag( coupler.sounds, sound::removeadapter ) ) {
|
||||
m_couplersounds[ couplerindex ].dsbAdapterRemove.play();
|
||||
couplersounds.dsbAdapterRemove.play();
|
||||
}
|
||||
|
||||
++couplerindex;
|
||||
@@ -5999,21 +6012,110 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
}
|
||||
// coupler sounds
|
||||
else if( token == "couplerattach:" ) {
|
||||
// laczenie:
|
||||
sound_source couplerattach { sound_placement::external };
|
||||
couplerattach.deserialize( parser, sound_type::single );
|
||||
couplerattach.owner( this );
|
||||
sound_source soundtemplate { sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.dsbCouplerAttach = couplerattach;
|
||||
couplersounds.attach_coupler = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "brakehoseattach:" ) {
|
||||
// laczenie:
|
||||
sound_source soundtemplate { sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.attach_brakehose = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "mainhoseattach:" ) {
|
||||
// laczenie:
|
||||
sound_source soundtemplate{ sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.attach_mainhose = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "controlattach:" ) {
|
||||
// laczenie:
|
||||
sound_source soundtemplate{ sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.attach_control = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "gangwayattach:" ) {
|
||||
// laczenie:
|
||||
sound_source soundtemplate{ sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.attach_gangway = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "heatingattach:" ) {
|
||||
// laczenie:
|
||||
sound_source soundtemplate{ sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.attach_heating = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "couplerdetach:" ) {
|
||||
// rozlaczanie:
|
||||
sound_source couplerdetach { sound_placement::external };
|
||||
couplerdetach.deserialize( parser, sound_type::single );
|
||||
couplerdetach.owner( this );
|
||||
sound_source soundtemplate { sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.dsbCouplerDetach = couplerdetach;
|
||||
couplersounds.detach_coupler = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "brakehosedetach:" ) {
|
||||
// rozlaczanie:
|
||||
sound_source soundtemplate { sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.detach_brakehose = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "mainhosedetach:" ) {
|
||||
// rozlaczanie:
|
||||
sound_source soundtemplate{ sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.detach_mainhose = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "controldetach:" ) {
|
||||
// rozlaczanie:
|
||||
sound_source soundtemplate{ sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.detach_control = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "gangwaydetach:" ) {
|
||||
// rozlaczanie:
|
||||
sound_source soundtemplate{ sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.detach_gangway = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "heatingdetach:" ) {
|
||||
// rozlaczanie:
|
||||
sound_source soundtemplate{ sound_placement::external };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
couplersounds.detach_heating = soundtemplate;
|
||||
}
|
||||
}
|
||||
else if( token == "couplerstretch:" ) {
|
||||
@@ -6182,13 +6284,13 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
}
|
||||
// couplers
|
||||
for( auto &couplersounds : m_couplersounds ) {
|
||||
if( true == couplersounds.dsbCouplerAttach.empty() ) {
|
||||
couplersounds.dsbCouplerAttach.deserialize( "couplerattach_default", sound_type::single );
|
||||
couplersounds.dsbCouplerAttach.owner( this );
|
||||
if( true == couplersounds.attach_coupler.empty() ) {
|
||||
couplersounds.attach_coupler.deserialize( "couplerattach_default", sound_type::single );
|
||||
couplersounds.attach_coupler.owner( this );
|
||||
}
|
||||
if( true == couplersounds.dsbCouplerDetach.empty() ) {
|
||||
couplersounds.dsbCouplerDetach.deserialize( "couplerdetach_default", sound_type::single );
|
||||
couplersounds.dsbCouplerDetach.owner( this );
|
||||
if( true == couplersounds.detach_coupler.empty() ) {
|
||||
couplersounds.detach_coupler.deserialize( "couplerdetach_default", sound_type::single );
|
||||
couplersounds.detach_coupler.owner( this );
|
||||
}
|
||||
if( true == couplersounds.dsbCouplerStretch.empty() ) {
|
||||
couplersounds.dsbCouplerStretch.deserialize( "couplerstretch_default", sound_type::single );
|
||||
@@ -6261,8 +6363,18 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
}
|
||||
// couplers
|
||||
auto const frontcoupleroffset { glm::vec3{ 0.f, 1.f, MoverParameters->Dim.L * 0.5f } };
|
||||
m_couplersounds[ end::front ].dsbCouplerAttach.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].dsbCouplerDetach.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].attach_coupler.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].attach_brakehose.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].attach_mainhose.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].attach_control.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].attach_gangway.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].attach_heating.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].detach_coupler.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].detach_brakehose.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].detach_mainhose.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].detach_control.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].detach_gangway.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].detach_heating.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].dsbCouplerStretch.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].dsbCouplerStretch_loud.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].dsbBufferClamp.offset( frontcoupleroffset );
|
||||
@@ -6270,8 +6382,18 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
m_couplersounds[ end::front ].dsbAdapterAttach.offset( frontcoupleroffset );
|
||||
m_couplersounds[ end::front ].dsbAdapterRemove.offset( frontcoupleroffset );
|
||||
auto const rearcoupleroffset { glm::vec3{ 0.f, 1.f, MoverParameters->Dim.L * -0.5f } };
|
||||
m_couplersounds[ end::rear ].dsbCouplerAttach.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].dsbCouplerDetach.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].attach_coupler.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].attach_brakehose.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].attach_mainhose.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].attach_control.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].attach_gangway.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].attach_heating.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].detach_coupler.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].detach_brakehose.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].detach_mainhose.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].detach_control.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].detach_gangway.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].detach_heating.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].dsbCouplerStretch.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].dsbCouplerStretch_loud.offset( rearcoupleroffset );
|
||||
m_couplersounds[ end::rear ].dsbBufferClamp.offset( rearcoupleroffset );
|
||||
|
||||
15
DynObj.h
15
DynObj.h
@@ -312,8 +312,19 @@ private:
|
||||
};
|
||||
|
||||
struct coupler_sounds {
|
||||
sound_source dsbCouplerAttach { sound_placement::external }; // moved from cab
|
||||
sound_source dsbCouplerDetach { sound_placement::external }; // moved from cab
|
||||
// TBD: change to an array with index-based access for easier initialization?
|
||||
sound_source attach_coupler { sound_placement::external };
|
||||
sound_source attach_brakehose { sound_placement::external };
|
||||
sound_source attach_mainhose { sound_placement::external };
|
||||
sound_source attach_control { sound_placement::external };
|
||||
sound_source attach_gangway { sound_placement::external };
|
||||
sound_source attach_heating { sound_placement::external };
|
||||
sound_source detach_coupler { sound_placement::external };
|
||||
sound_source detach_brakehose { sound_placement::external };
|
||||
sound_source detach_mainhose { sound_placement::external };
|
||||
sound_source detach_control { sound_placement::external };
|
||||
sound_source detach_gangway { sound_placement::external };
|
||||
sound_source detach_heating { sound_placement::external };
|
||||
sound_source dsbCouplerStretch { sound_placement::external }; // moved from cab
|
||||
sound_source dsbCouplerStretch_loud { sound_placement::external };
|
||||
sound_source dsbBufferClamp { sound_placement::external }; // moved from cab
|
||||
|
||||
@@ -1492,7 +1492,9 @@ void TMoverParameters::MainsCheck( double const Deltatime ) {
|
||||
|
||||
if( true == maincircuitpowersupply ) {
|
||||
// all is well
|
||||
if( MainsInitTimeCountdown > 0.0 ) {
|
||||
if( MainsInitTimeCountdown >= 0.0 ) {
|
||||
// NOTE: we ensure main circuit readiness meets condition MainsInitTimeCountdown < 0
|
||||
// this allows for simpler rejection of cases where MainsInitTime == 0
|
||||
MainsInitTimeCountdown -= Deltatime;
|
||||
}
|
||||
}
|
||||
|
||||
14
Train.cpp
14
Train.cpp
@@ -735,8 +735,9 @@ TTrain::get_state() const {
|
||||
{ fHCurrent[ ( mvControlled->TrainType & dt_EZT ) ? 0 : 1 ], fHCurrent[ 2 ], fHCurrent[ 3 ] },
|
||||
ggLVoltage.GetValue(),
|
||||
mvOccupied->DistCounter,
|
||||
RadioChannel(),
|
||||
btLampkaSpringBrakeActive.GetValue()
|
||||
static_cast<std::uint8_t>( RadioChannel() ),
|
||||
btLampkaSpringBrakeActive.GetValue(),
|
||||
btLampkaNapNastHam.GetValue(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6457,6 +6458,12 @@ bool TTrain::Update( double const Deltatime )
|
||||
|| ( true == mvControlled->Mains ) ) ?
|
||||
false :
|
||||
true ) );
|
||||
btLampkaMainBreakerBlinkingIfReady.Turn(
|
||||
( ( (m_linebreakerstate == 2)
|
||||
|| (true == mvControlled->Mains)
|
||||
|| ( ( mvControlled->MainsInitTimeCountdown < 0.0 ) && ( simulation::Time.data().wMilliseconds > 500 ) ) ) ?
|
||||
true :
|
||||
false ) );
|
||||
|
||||
btLampkaPrzetw.Turn( mvOccupied->Power110vIsAvailable );
|
||||
btLampkaPrzetwOff.Turn( false == mvOccupied->Power110vIsAvailable );
|
||||
@@ -6618,6 +6625,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
btLampkaWylSzybki.Turn( false );
|
||||
btLampkaWylSzybkiOff.Turn( false );
|
||||
btLampkaMainBreakerReady.Turn( false );
|
||||
btLampkaMainBreakerBlinkingIfReady.Turn( false );
|
||||
btLampkaWysRozr.Turn( false );
|
||||
btLampkaOpory.Turn( false );
|
||||
btLampkaStyczn.Turn( false );
|
||||
@@ -8395,6 +8403,7 @@ void TTrain::clear_cab_controls()
|
||||
btLampkaWylSzybkiB.Clear();
|
||||
btLampkaWylSzybkiBOff.Clear();
|
||||
btLampkaMainBreakerReady.Clear();
|
||||
btLampkaMainBreakerBlinkingIfReady.Clear();
|
||||
btLampkaBezoporowa.Clear();
|
||||
btLampkaBezoporowaB.Clear();
|
||||
btLampkaMaxSila.Clear();
|
||||
@@ -8821,6 +8830,7 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
||||
{ "i-mainbreakeroff:", btLampkaWylSzybkiOff },
|
||||
{ "i-mainbreakerboff:", btLampkaWylSzybkiBOff },
|
||||
{ "i-mainbreakerready:", btLampkaMainBreakerReady },
|
||||
{ "i-mainbreakerblinking:", btLampkaMainBreakerBlinkingIfReady },
|
||||
{ "i-vent_ovld:", btLampkaNadmWent },
|
||||
{ "i-comp_ovld:", btLampkaNadmSpr },
|
||||
{ "i-resistors:", btLampkaOpory },
|
||||
|
||||
6
Train.h
6
Train.h
@@ -107,8 +107,9 @@ class TTrain {
|
||||
std::array<float, 3> hv_current;
|
||||
float lv_voltage;
|
||||
double distance;
|
||||
int radio_channel;
|
||||
bool springbrake_active;
|
||||
std::uint8_t radio_channel;
|
||||
std::uint8_t springbrake_active;
|
||||
std::uint8_t epbrake_enabled;
|
||||
};
|
||||
|
||||
struct screen_entry {
|
||||
@@ -611,6 +612,7 @@ public: // reszta może by?publiczna
|
||||
TButton btLampkaWylSzybki;
|
||||
TButton btLampkaWylSzybkiOff;
|
||||
TButton btLampkaMainBreakerReady;
|
||||
TButton btLampkaMainBreakerBlinkingIfReady;
|
||||
TButton btLampkaNadmWent;
|
||||
TButton btLampkaNadmSpr; // TODO: implement
|
||||
// yB: drugie lampki dla EP05 i ET42
|
||||
|
||||
3
uart.cpp
3
uart.cpp
@@ -354,7 +354,8 @@ void uart_input::poll()
|
||||
SPLIT_INT16(tacho),
|
||||
//byte 2
|
||||
(uint8_t)(
|
||||
trainstate.ventilator_overload << 1
|
||||
trainstate.epbrake_enabled << 0
|
||||
| trainstate.ventilator_overload << 1
|
||||
| trainstate.motor_overload_threshold << 2),
|
||||
//byte 3
|
||||
(uint8_t)(
|
||||
|
||||
Reference in New Issue
Block a user