mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 22:09:19 +02:00
Added signal light for receiving radio message
This commit is contained in:
@@ -159,3 +159,9 @@ TButton::play() {
|
|||||||
if( m_state == true ) { m_soundfxincrease.play(); }
|
if( m_state == true ) { m_soundfxincrease.play(); }
|
||||||
else { m_soundfxdecrease.play(); }
|
else { m_soundfxdecrease.play(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TButton::gain(float new_volume) {
|
||||||
|
m_soundfxincrease.gain(new_volume);
|
||||||
|
m_soundfxdecrease.gain(new_volume);
|
||||||
|
}
|
||||||
|
|||||||
2
Button.h
2
Button.h
@@ -36,7 +36,7 @@ public:
|
|||||||
void AssignBool(bool const *bValue);
|
void AssignBool(bool const *bValue);
|
||||||
// returns offset of submodel associated with the button from the model centre
|
// returns offset of submodel associated with the button from the model centre
|
||||||
glm::vec3 model_offset() const;
|
glm::vec3 model_offset() const;
|
||||||
|
void gain(float new_volume);
|
||||||
private:
|
private:
|
||||||
// methods
|
// methods
|
||||||
// imports member data pair from the config file
|
// imports member data pair from the config file
|
||||||
|
|||||||
11
Train.cpp
11
Train.cpp
@@ -7171,6 +7171,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
btLampkaMaxSila.Turn(abs(mvControlled->Im) >= 350);
|
btLampkaMaxSila.Turn(abs(mvControlled->Im) >= 350);
|
||||||
btLampkaPrzekrMaxSila.Turn(abs(mvControlled->Im) >= 450);
|
btLampkaPrzekrMaxSila.Turn(abs(mvControlled->Im) >= 450);
|
||||||
btLampkaRadio.Turn(mvOccupied->Radio);
|
btLampkaRadio.Turn(mvOccupied->Radio);
|
||||||
|
btLampkaRadioMessage.Turn(radio_message_played);
|
||||||
btLampkaRadioStop.Turn( mvOccupied->Radio && mvOccupied->RadioStopFlag );
|
btLampkaRadioStop.Turn( mvOccupied->Radio && mvOccupied->RadioStopFlag );
|
||||||
btLampkaHamulecReczny.Turn(mvOccupied->ManualBrakePos > 0);
|
btLampkaHamulecReczny.Turn(mvOccupied->ManualBrakePos > 0);
|
||||||
// NBMX wrzesien 2003 - drzwi oraz sygnał odjazdu
|
// NBMX wrzesien 2003 - drzwi oraz sygnał odjazdu
|
||||||
@@ -7247,6 +7248,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
btLampkaMaxSila.Turn( false );
|
btLampkaMaxSila.Turn( false );
|
||||||
btLampkaPrzekrMaxSila.Turn( false );
|
btLampkaPrzekrMaxSila.Turn( false );
|
||||||
btLampkaRadio.Turn( false );
|
btLampkaRadio.Turn( false );
|
||||||
|
btLampkaRadioMessage.Turn( false );
|
||||||
btLampkaRadioStop.Turn( false );
|
btLampkaRadioStop.Turn( false );
|
||||||
btLampkaHamulecReczny.Turn( false );
|
btLampkaHamulecReczny.Turn( false );
|
||||||
btLampkaDoorLeft.Turn( false );
|
btLampkaDoorLeft.Turn( false );
|
||||||
@@ -8133,6 +8135,7 @@ void TTrain::update_sounds_runningnoise( sound_source &Sound ) {
|
|||||||
|
|
||||||
void TTrain::update_sounds_radio() {
|
void TTrain::update_sounds_radio() {
|
||||||
|
|
||||||
|
radio_message_played = false;
|
||||||
if( false == m_radiomessages.empty() ) {
|
if( false == m_radiomessages.empty() ) {
|
||||||
// erase completed radio messages from the list
|
// erase completed radio messages from the list
|
||||||
m_radiomessages.erase(
|
m_radiomessages.erase(
|
||||||
@@ -8152,17 +8155,23 @@ void TTrain::update_sounds_radio() {
|
|||||||
Global.RadioVolume :
|
Global.RadioVolume :
|
||||||
0.0 };
|
0.0 };
|
||||||
message.second->gain( volume );
|
message.second->gain( volume );
|
||||||
|
radio_message_played |= (true == radioenabled) && (Dynamic()->Mechanik != nullptr) && (message.first == RadioChannel());
|
||||||
}
|
}
|
||||||
// radiostop
|
// radiostop
|
||||||
if( m_radiostop ) {
|
if( m_radiostop ) {
|
||||||
if( ( true == radioenabled )
|
if( ( true == radioenabled )
|
||||||
&& ( true == mvOccupied->RadioStopFlag ) ) {
|
&& ( true == mvOccupied->RadioStopFlag ) ) {
|
||||||
m_radiostop->play( sound_flags::exclusive | sound_flags::looping );
|
m_radiostop->play( sound_flags::exclusive | sound_flags::looping );
|
||||||
|
radio_message_played |= true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_radiostop->stop();
|
m_radiostop->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (radio_message_played)
|
||||||
|
{
|
||||||
|
btLampkaRadioMessage.gain(Global.RadioVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::add_distance( double const Distance ) {
|
void TTrain::add_distance( double const Distance ) {
|
||||||
@@ -9065,6 +9074,7 @@ void TTrain::clear_cab_controls()
|
|||||||
btLampkaMaxSila.Clear();
|
btLampkaMaxSila.Clear();
|
||||||
btLampkaPrzekrMaxSila.Clear();
|
btLampkaPrzekrMaxSila.Clear();
|
||||||
btLampkaRadio.Clear();
|
btLampkaRadio.Clear();
|
||||||
|
btLampkaRadioMessage.Clear();
|
||||||
btLampkaRadioStop.Clear();
|
btLampkaRadioStop.Clear();
|
||||||
btLampkaHamulecReczny.Clear();
|
btLampkaHamulecReczny.Clear();
|
||||||
btLampkaBlokadaDrzwi.Clear();
|
btLampkaBlokadaDrzwi.Clear();
|
||||||
@@ -9507,6 +9517,7 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
|||||||
{ "i-maxft:", btLampkaMaxSila },
|
{ "i-maxft:", btLampkaMaxSila },
|
||||||
{ "i-maxftt:", btLampkaPrzekrMaxSila },
|
{ "i-maxftt:", btLampkaPrzekrMaxSila },
|
||||||
{ "i-radio:", btLampkaRadio },
|
{ "i-radio:", btLampkaRadio },
|
||||||
|
{ "i-radiomessage:", btLampkaRadioMessage },
|
||||||
{ "i-radiostop:", btLampkaRadioStop },
|
{ "i-radiostop:", btLampkaRadioStop },
|
||||||
{ "i-manual_brake:", btLampkaHamulecReczny },
|
{ "i-manual_brake:", btLampkaHamulecReczny },
|
||||||
{ "i-door_blocked:", btLampkaBlokadaDrzwi },
|
{ "i-door_blocked:", btLampkaBlokadaDrzwi },
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -677,6 +677,7 @@ public: // reszta może by?publiczna
|
|||||||
TButton btLampkaUkrotnienie;
|
TButton btLampkaUkrotnienie;
|
||||||
TButton btLampkaHamPosp;
|
TButton btLampkaHamPosp;
|
||||||
TButton btLampkaRadio;
|
TButton btLampkaRadio;
|
||||||
|
TButton btLampkaRadioMessage;
|
||||||
TButton btLampkaRadioStop;
|
TButton btLampkaRadioStop;
|
||||||
TButton btLampkaHamowanie1zes;
|
TButton btLampkaHamowanie1zes;
|
||||||
TButton btLampkaHamowanie2zes;
|
TButton btLampkaHamowanie2zes;
|
||||||
@@ -855,6 +856,7 @@ private:
|
|||||||
float fEIMParams[9][10]; // parametry dla silnikow asynchronicznych
|
float fEIMParams[9][10]; // parametry dla silnikow asynchronicznych
|
||||||
float fDieselParams[9][10]; // parametry dla silnikow asynchronicznych
|
float fDieselParams[9][10]; // parametry dla silnikow asynchronicznych
|
||||||
// plays provided sound from position of the radio
|
// plays provided sound from position of the radio
|
||||||
|
bool radio_message_played;
|
||||||
void radio_message( sound_source *Message, int const Channel );
|
void radio_message( sound_source *Message, int const Channel );
|
||||||
inline auto const RadioChannel() const { return ( Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1 ); }
|
inline auto const RadioChannel() const { return ( Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1 ); }
|
||||||
inline auto &RadioChannel() { return Dynamic()->Mechanik->iRadioChannel; }
|
inline auto &RadioChannel() { return Dynamic()->Mechanik->iRadioChannel; }
|
||||||
|
|||||||
Reference in New Issue
Block a user