mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 06:55:02 +01:00
Direction relay sounds
This commit is contained in:
17
DynObj.cpp
17
DynObj.cpp
@@ -6790,6 +6790,23 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
m_powertrainsounds.dsbWejscie_na_bezoporow.deserialize( parser, sound_type::single );
|
||||
m_powertrainsounds.dsbWejscie_na_bezoporow.owner( this );
|
||||
}
|
||||
// przekazniki od kierunku jazdy
|
||||
else if (token == "directionrelay_d:") {
|
||||
// przekaznik od kierunku jazdy do przodu
|
||||
sDirectionRelayD.deserialize(parser, sound_type::single);
|
||||
sDirectionRelayD.owner(this);
|
||||
}
|
||||
else if (token == "directionrelay_r:") {
|
||||
// przekaznik od kierunku jazdy do tylu
|
||||
sDirectionRelayR.deserialize(parser, sound_type::single);
|
||||
sDirectionRelayR.owner(this);
|
||||
}
|
||||
else if (token == "directionrelay_n:")
|
||||
{
|
||||
// przekaznik od kierunku jazdy do tylu
|
||||
sDirectionRelayN.deserialize(parser, sound_type::single);
|
||||
sDirectionRelayN.owner(this);
|
||||
}
|
||||
else if( token == "wejscie_na_drugi_uklad:" ) {
|
||||
m_powertrainsounds.motor_parallel.deserialize( parser, sound_type::single );
|
||||
m_powertrainsounds.motor_parallel.owner( this );
|
||||
|
||||
3
DynObj.h
3
DynObj.h
@@ -516,6 +516,9 @@ private:
|
||||
std::vector<axle_sounds> m_axlesounds;
|
||||
// engine sounds
|
||||
powertrain_sounds m_powertrainsounds;
|
||||
sound_source sDirectionRelayD { sound_placement::engine }; // przekaznik kierunkowy do przodu
|
||||
sound_source sDirectionRelayN { sound_placement::engine }; // przekaznik kierunkowy neutral
|
||||
sound_source sDirectionRelayR { sound_placement::engine }; // przekaznik kierunkowy wstecz
|
||||
sound_source sConverter { sound_placement::engine };
|
||||
sound_source sBRVent {sound_placement::engine};
|
||||
sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003
|
||||
|
||||
33
Train.cpp
33
Train.cpp
@@ -8476,12 +8476,45 @@ bool TTrain::Update( double const Deltatime )
|
||||
if (!FreeFlyModeFlag && simulation::Train == this) // don't bother if we're outside
|
||||
update_screens(Deltatime);
|
||||
|
||||
// update direction relay
|
||||
if (prevBatState != mvOccupied->Power24vIsAvailable)
|
||||
SetupDirectionRelays();
|
||||
if (prevDirection != mvOccupied->DirActive)
|
||||
UpdateDirectionRelays();
|
||||
|
||||
prevBatState = mvOccupied->Power24vIsAvailable;
|
||||
prevDirection = mvOccupied->DirActive;
|
||||
|
||||
|
||||
|
||||
|
||||
// sounds
|
||||
update_sounds( Deltatime );
|
||||
|
||||
return true; //(DynamicObject->Update(dt));
|
||||
} // koniec update
|
||||
|
||||
void TTrain::UpdateDirectionRelays() {
|
||||
if (mvOccupied->DirActive < 0 && mvOccupied->Power24vIsAvailable) // wstecz
|
||||
Dynamic()->sDirectionRelayR.play();
|
||||
if (mvOccupied->DirActive == 0 && mvOccupied->Power24vIsAvailable) // neutral
|
||||
Dynamic()->sDirectionRelayN.play();
|
||||
if (mvOccupied->DirActive > 0 && mvOccupied->Power24vIsAvailable) // przod
|
||||
Dynamic()->sDirectionRelayD.play();
|
||||
}
|
||||
|
||||
void TTrain::SetupDirectionRelays() {
|
||||
if (mvOccupied->Power24vIsAvailable)
|
||||
{
|
||||
if (mvOccupied->DirActive < 0 && mvOccupied->Power24vIsAvailable) // wstecz
|
||||
Dynamic()->sDirectionRelayR.play();
|
||||
if (mvOccupied->DirActive > 0 && mvOccupied->Power24vIsAvailable) // przod
|
||||
Dynamic()->sDirectionRelayD.play();
|
||||
}
|
||||
else if (mvOccupied->DirActive != 0) // neutral
|
||||
Dynamic()->sDirectionRelayN.play();
|
||||
}
|
||||
|
||||
void
|
||||
TTrain::update_sounds( double const Deltatime ) {
|
||||
|
||||
|
||||
4
Train.h
4
Train.h
@@ -164,6 +164,10 @@ class TTrain {
|
||||
return m_controlmapper.find( Control ); }
|
||||
void UpdateCab();
|
||||
bool Update( double const Deltatime );
|
||||
void UpdateDirectionRelays();
|
||||
void SetupDirectionRelays();
|
||||
bool prevBatState = false;
|
||||
int prevDirection = 0;
|
||||
void add_distance( double const Distance );
|
||||
// McZapkie-310302: ladowanie parametrow z pliku
|
||||
bool LoadMMediaFile(std::string const &asFileName);
|
||||
|
||||
Reference in New Issue
Block a user