mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-24 07:39:17 +02:00
build 210508. spring brake sound support, internaldata sounds update fix, minor bug fixes
This commit is contained in:
@@ -2709,10 +2709,11 @@ bool TController::PrepareEngine()
|
|||||||
cue_action( locale::string::driver_hint_pantographcompressoroff ); // sprężarkę pantografów można już wyłączyć
|
cue_action( locale::string::driver_hint_pantographcompressoroff ); // sprężarkę pantografów można już wyłączyć
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: make pantograph setup a part of control_pantographs() and call it here instead
|
||||||
if( ( fOverhead2 == -1.0 ) && ( iOverheadDown == 0 ) ) {
|
if( ( fOverhead2 == -1.0 ) && ( iOverheadDown == 0 ) ) {
|
||||||
cue_action( locale::string::driver_hint_pantographsvalveon );
|
cue_action( locale::string::driver_hint_pantographsvalveon );
|
||||||
cue_action( locale::string::driver_hint_frontpantographvalveon );
|
cue_action( locale::string::driver_hint_frontpantographvalveon, ( iDirection >= 0 ? 5 : 0 ) );
|
||||||
cue_action( locale::string::driver_hint_rearpantographvalveon );
|
cue_action( locale::string::driver_hint_rearpantographvalveon, ( iDirection >= 0 ? 0 : 5 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
DynObj.cpp
24
DynObj.cpp
@@ -4209,7 +4209,7 @@ void TDynamicObject::RenderSounds() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dzwiek odluzniacza
|
// Dzwiek odluzniacza
|
||||||
if( MoverParameters->Hamulec->GetStatus() & b_rls ) {
|
if( MoverParameters->Hamulec->Releaser() ) {
|
||||||
sReleaser
|
sReleaser
|
||||||
.gain(
|
.gain(
|
||||||
clamp<float>(
|
clamp<float>(
|
||||||
@@ -4294,6 +4294,19 @@ void TDynamicObject::RenderSounds() {
|
|||||||
rsPisk.stop();
|
rsPisk.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// spring brake
|
||||||
|
if( m_springbrakesounds.state != MoverParameters->SpringBrake.Activate ) {
|
||||||
|
m_springbrakesounds.state = MoverParameters->SpringBrake.Activate;
|
||||||
|
if( m_springbrakesounds.state ) {
|
||||||
|
m_springbrakesounds.activate.play( sound_flags::exclusive );
|
||||||
|
m_springbrakesounds.release.stop();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_springbrakesounds.activate.stop();
|
||||||
|
m_springbrakesounds.release.play( sound_flags::exclusive );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// other sounds
|
// other sounds
|
||||||
// load exchange
|
// load exchange
|
||||||
if( MoverParameters->LoadStatus & 1 ) {
|
if( MoverParameters->LoadStatus & 1 ) {
|
||||||
@@ -5702,6 +5715,15 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
|||||||
rsUnbrake.deserialize( parser, sound_type::single, sound_parameters::range );
|
rsUnbrake.deserialize( parser, sound_type::single, sound_parameters::range );
|
||||||
rsUnbrake.owner( this );
|
rsUnbrake.owner( this );
|
||||||
}
|
}
|
||||||
|
// spring brake sounds
|
||||||
|
else if( token == "springbrake:" ) {
|
||||||
|
m_springbrakesounds.activate.deserialize( parser, sound_type::single );
|
||||||
|
m_springbrakesounds.activate.owner( this );
|
||||||
|
}
|
||||||
|
else if( token == "springbrakeoff:" ) {
|
||||||
|
m_springbrakesounds.release.deserialize( parser, sound_type::single );
|
||||||
|
m_springbrakesounds.release.owner( this );
|
||||||
|
}
|
||||||
|
|
||||||
else if( token == "derail:" ) {
|
else if( token == "derail:" ) {
|
||||||
// dzwiek przy wykolejeniu
|
// dzwiek przy wykolejeniu
|
||||||
|
|||||||
7
DynObj.h
7
DynObj.h
@@ -421,6 +421,12 @@ private:
|
|||||||
sound_source announcement;
|
sound_source announcement;
|
||||||
std::deque<sound_source> announcement_queue; // fifo queue
|
std::deque<sound_source> announcement_queue; // fifo queue
|
||||||
};
|
};
|
||||||
|
struct springbrake_sounds {
|
||||||
|
sound_source activate { sound_placement::external };
|
||||||
|
sound_source release { sound_placement::external };
|
||||||
|
bool state { false };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void ABuLittleUpdate(double ObjSqrDist);
|
void ABuLittleUpdate(double ObjSqrDist);
|
||||||
@@ -496,6 +502,7 @@ private:
|
|||||||
sound_source m_emergencybrake { sound_placement::engine };
|
sound_source m_emergencybrake { sound_placement::engine };
|
||||||
double m_emergencybrakeflow{ 0.f };
|
double m_emergencybrakeflow{ 0.f };
|
||||||
sound_source sReleaser { sound_placement::external };
|
sound_source sReleaser { sound_placement::external };
|
||||||
|
springbrake_sounds m_springbrakesounds;
|
||||||
sound_source rsSlippery { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // moved from cab
|
sound_source rsSlippery { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // moved from cab
|
||||||
sound_source sSand { sound_placement::external };
|
sound_source sSand { sound_placement::external };
|
||||||
// moving part and other external sounds
|
// moving part and other external sounds
|
||||||
|
|||||||
41
Gauge.cpp
41
Gauge.cpp
@@ -286,25 +286,25 @@ TGauge::Load_mapping( cParser &Input, TGauge::scratch_data &Scratchpad ) {
|
|||||||
return true; // return value marks a key: value pair was extracted, nothing about whether it's recognized
|
return true; // return value marks a key: value pair was extracted, nothing about whether it's recognized
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
TGauge::UpdateValue( float fNewDesired ) {
|
|
||||||
|
|
||||||
return UpdateValue( fNewDesired, nullptr );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TGauge::UpdateValue( float fNewDesired, sound_source &Fallbacksound ) {
|
|
||||||
|
|
||||||
return UpdateValue( fNewDesired, &Fallbacksound );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ustawienie wartości docelowej. plays provided fallback sound, if no sound was defined in the control itself
|
// ustawienie wartości docelowej. plays provided fallback sound, if no sound was defined in the control itself
|
||||||
void
|
bool
|
||||||
TGauge::UpdateValue( float fNewDesired, sound_source *Fallbacksound ) {
|
TGauge::UpdateValue( float fNewDesired, std::optional<sound_source> &Fallbacksound ) {
|
||||||
|
|
||||||
|
if( false == UpdateValue( fNewDesired ) ) {
|
||||||
|
if( Fallbacksound ) {
|
||||||
|
Fallbacksound->play( m_soundtype );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TGauge::UpdateValue( float fNewDesired ) {
|
||||||
|
|
||||||
auto const desiredtimes100 = static_cast<int>( std::round( 100.0 * fNewDesired ) );
|
auto const desiredtimes100 = static_cast<int>( std::round( 100.0 * fNewDesired ) );
|
||||||
if( desiredtimes100 == static_cast<int>( std::round( 100.0 * m_targetvalue ) ) ) {
|
if( desiredtimes100 == static_cast<int>( std::round( 100.0 * m_targetvalue ) ) ) {
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
m_targetvalue = fNewDesired;
|
m_targetvalue = fNewDesired;
|
||||||
// if there's any sound associated with new requested value, play it
|
// if there's any sound associated with new requested value, play it
|
||||||
@@ -315,7 +315,7 @@ TGauge::UpdateValue( float fNewDesired, sound_source *Fallbacksound ) {
|
|||||||
auto const lookup = m_soundfxvalues.find( desiredtimes100 / 100 );
|
auto const lookup = m_soundfxvalues.find( desiredtimes100 / 100 );
|
||||||
if( lookup != m_soundfxvalues.end() ) {
|
if( lookup != m_soundfxvalues.end() ) {
|
||||||
lookup->second.play();
|
lookup->second.play();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -329,20 +329,17 @@ TGauge::UpdateValue( float fNewDesired, sound_source *Fallbacksound ) {
|
|||||||
// shift up
|
// shift up
|
||||||
if( false == m_soundfxincrease.empty() ) {
|
if( false == m_soundfxincrease.empty() ) {
|
||||||
m_soundfxincrease.play( m_soundtype );
|
m_soundfxincrease.play( m_soundtype );
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( currentvalue > fNewDesired ) {
|
else if( currentvalue > fNewDesired ) {
|
||||||
// shift down
|
// shift down
|
||||||
if( false == m_soundfxdecrease.empty() ) {
|
if( false == m_soundfxdecrease.empty() ) {
|
||||||
m_soundfxdecrease.play( m_soundtype );
|
m_soundfxdecrease.play( m_soundtype );
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( Fallbacksound != nullptr ) {
|
return false; // no suitable sound was found
|
||||||
// ...and if that fails too, try the provided fallback sound from legacy system
|
|
||||||
Fallbacksound->play( m_soundtype );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void TGauge::PutValue(float fNewDesired)
|
void TGauge::PutValue(float fNewDesired)
|
||||||
|
|||||||
6
Gauge.h
6
Gauge.h
@@ -43,8 +43,8 @@ public:
|
|||||||
*this = TGauge(); }
|
*this = TGauge(); }
|
||||||
void Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Type, float Scale = 1, float Offset = 0, float Friction = 0, float Value = 0, float const Endvalue = -1.0, float const Endscale = -1.0, bool const Interpolate = false );
|
void Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Type, float Scale = 1, float Offset = 0, float Friction = 0, float Value = 0, float const Endvalue = -1.0, float const Endscale = -1.0, bool const Interpolate = false );
|
||||||
void Load(cParser &Parser, TDynamicObject const *Owner, double const mul = 1.0);
|
void Load(cParser &Parser, TDynamicObject const *Owner, double const mul = 1.0);
|
||||||
void UpdateValue( float fNewDesired );
|
bool UpdateValue( float fNewDesired );
|
||||||
void UpdateValue( float fNewDesired, sound_source &Fallbacksound );
|
bool UpdateValue( float fNewDesired, std::optional<sound_source> &Fallbacksound );
|
||||||
void PutValue(float fNewDesired);
|
void PutValue(float fNewDesired);
|
||||||
float GetValue() const;
|
float GetValue() const;
|
||||||
float GetDesiredValue() const;
|
float GetDesiredValue() const;
|
||||||
@@ -79,8 +79,6 @@ private:
|
|||||||
// imports member data pair from the config file
|
// imports member data pair from the config file
|
||||||
bool
|
bool
|
||||||
Load_mapping( cParser &Input, TGauge::scratch_data &Scratchpad );
|
Load_mapping( cParser &Input, TGauge::scratch_data &Scratchpad );
|
||||||
void
|
|
||||||
UpdateValue( float fNewDesired, sound_source *Fallbacksound );
|
|
||||||
float
|
float
|
||||||
GetScaledValue() const;
|
GetScaledValue() const;
|
||||||
void
|
void
|
||||||
|
|||||||
52
Train.h
52
Train.h
@@ -728,35 +728,33 @@ public: // reszta może by?publiczna
|
|||||||
TButton btHaslerBrakes; // ciśnienie w cylindrach
|
TButton btHaslerBrakes; // ciśnienie w cylindrach
|
||||||
TButton btHaslerCurrent; // prąd na silnikach
|
TButton btHaslerCurrent; // prąd na silnikach
|
||||||
|
|
||||||
sound_source dsbReverserKey { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // hunter-121211
|
std::optional<sound_source>
|
||||||
sound_source dsbNastawnikJazdy { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
dsbNastawnikJazdy,
|
||||||
sound_source dsbNastawnikBocz { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // hunter-081211
|
dsbNastawnikBocz,
|
||||||
sound_source dsbSwitch { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
dsbReverserKey,
|
||||||
sound_source dsbPneumaticSwitch { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
dsbBuzzer,
|
||||||
|
m_radiostop,
|
||||||
sound_source rsHiss { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // upuszczanie
|
dsbSlipAlarm,
|
||||||
sound_source rsHissU { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // napelnianie
|
m_distancecounterclear,
|
||||||
sound_source rsHissE { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // nagle
|
dsbHasler,
|
||||||
sound_source rsHissX { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // fala
|
dsbSwitch,
|
||||||
sound_source rsHissT { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // czasowy
|
dsbPneumaticSwitch,
|
||||||
sound_source rsSBHiss { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // local
|
rsHiss,
|
||||||
sound_source rsSBHissU { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // local, engage brakes
|
rsHissU,
|
||||||
float m_lastlocalbrakepressure { -1.f }; // helper, cached level of pressure in local brake cylinder
|
rsHissE,
|
||||||
float m_localbrakepressurechange { 0.f }; // recent change of pressure in local brake cylinder
|
rsHissX,
|
||||||
sound_source rsBrake { sound_placement::internal, -1 };
|
rsHissT,
|
||||||
|
rsSBHiss,
|
||||||
sound_source rsFadeSound { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
rsSBHissU,
|
||||||
sound_source rsRunningNoise{ sound_placement::internal, EU07_SOUND_GLOBALRANGE };
|
rsBrake,
|
||||||
sound_source rsHuntingNoise{ sound_placement::internal, EU07_SOUND_GLOBALRANGE };
|
rsFadeSound,
|
||||||
sound_source m_rainsound { sound_placement::internal, -1 };
|
rsRunningNoise,
|
||||||
|
rsHuntingNoise,
|
||||||
sound_source dsbHasler { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
m_rainsound;
|
||||||
sound_source dsbBuzzer { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
|
||||||
sound_source dsbSlipAlarm { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // Bombardier 011010: alarm przy poslizgu dla 181/182
|
|
||||||
sound_source m_radiosound { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // cached template for radio messages
|
sound_source m_radiosound { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // cached template for radio messages
|
||||||
std::vector<std::pair<int, std::shared_ptr<sound_source>>> m_radiomessages; // list of currently played radio messages
|
std::vector<std::pair<int, std::shared_ptr<sound_source>>> m_radiomessages; // list of currently played radio messages
|
||||||
sound_source m_radiostop { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
float m_lastlocalbrakepressure { -1.f }; // helper, cached level of pressure in local brake cylinder
|
||||||
sound_source m_distancecounterclear { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // distance meter 'good to go' alert
|
float m_localbrakepressurechange { 0.f }; // recent change of pressure in local brake cylinder
|
||||||
/*
|
/*
|
||||||
int iCabLightFlag; // McZapkie:120503: oswietlenie kabiny (0: wyl, 1: przyciemnione, 2: pelne)
|
int iCabLightFlag; // McZapkie:120503: oswietlenie kabiny (0: wyl, 1: przyciemnione, 2: pelne)
|
||||||
bool bCabLight; // hunter-091012: czy swiatlo jest zapalone?
|
bool bCabLight; // hunter-091012: czy swiatlo jest zapalone?
|
||||||
|
|||||||
Reference in New Issue
Block a user