mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 08:09:19 +02:00
FS#124 Added sound entry for engine shutdown event.
This commit is contained in:
17
DynObj.cpp
17
DynObj.cpp
@@ -5677,6 +5677,9 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
|||||||
// odpalanie silnika
|
// odpalanie silnika
|
||||||
m_powertrainsounds.engine_ignition.deserialize( parser, sound_type::single );
|
m_powertrainsounds.engine_ignition.deserialize( parser, sound_type::single );
|
||||||
m_powertrainsounds.engine_ignition.owner( this );
|
m_powertrainsounds.engine_ignition.owner( this );
|
||||||
|
} else if (token == "shutdown:") {
|
||||||
|
m_powertrainsounds.engine_shutdown.deserialize(parser, sound_type::single);
|
||||||
|
m_powertrainsounds.engine_shutdown.owner(this);
|
||||||
}
|
}
|
||||||
else if( token == "engageslippery:" ) {
|
else if( token == "engageslippery:" ) {
|
||||||
// tarcie tarcz sprzegla:
|
// tarcie tarcz sprzegla:
|
||||||
@@ -6383,7 +6386,7 @@ TDynamicObject::powertrain_sounds::position( glm::vec3 const Location ) {
|
|||||||
std::vector<sound_source *> enginesounds = {
|
std::vector<sound_source *> enginesounds = {
|
||||||
&inverter,
|
&inverter,
|
||||||
&motor_relay, &dsbWejscie_na_bezoporow, &motor_parallel, &motor_shuntfield, &rsWentylator,
|
&motor_relay, &dsbWejscie_na_bezoporow, &motor_parallel, &motor_shuntfield, &rsWentylator,
|
||||||
&engine, &engine_ignition, &engine_revving, &engine_turbo, &oil_pump, &radiator_fan, &radiator_fan_aux,
|
&engine, &engine_ignition, &engine_shutdown, &engine_revving, &engine_turbo, &oil_pump, &radiator_fan, &radiator_fan_aux,
|
||||||
&transmission, &rsEngageSlippery
|
&transmission, &rsEngageSlippery
|
||||||
};
|
};
|
||||||
for( auto sound : enginesounds ) {
|
for( auto sound : enginesounds ) {
|
||||||
@@ -6414,19 +6417,21 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
|
|||||||
|
|
||||||
// engine sounds
|
// engine sounds
|
||||||
// ignition
|
// ignition
|
||||||
if( engine_state_last != Vehicle.Mains ) {
|
if (engine_state_last != Vehicle.Mains) {
|
||||||
|
if (Vehicle.Mains) {
|
||||||
if( true == Vehicle.Mains ) {
|
|
||||||
// main circuit/engine activation
|
// main circuit/engine activation
|
||||||
// TODO: separate engine and main circuit
|
// TODO: separate engine and main circuit
|
||||||
|
engine_shutdown.stop();
|
||||||
engine_ignition
|
engine_ignition
|
||||||
.pitch( engine_ignition.m_frequencyoffset + engine_ignition.m_frequencyfactor * 1.f )
|
.pitch( engine_ignition.m_frequencyoffset + engine_ignition.m_frequencyfactor * 1.f )
|
||||||
.gain( engine_ignition.m_amplitudeoffset + engine_ignition.m_amplitudefactor * 1.f )
|
.gain( engine_ignition.m_amplitudeoffset + engine_ignition.m_amplitudefactor * 1.f )
|
||||||
.play( sound_flags::exclusive );
|
.play( sound_flags::exclusive );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// main circuit/engine deactivation
|
// main circuit/engine deactivation
|
||||||
engine_ignition.stop();
|
engine_ignition.stop();
|
||||||
|
engine_shutdown.pitch( engine_shutdown.m_frequencyoffset + engine_shutdown.m_frequencyfactor * 1.f )
|
||||||
|
.gain( engine_shutdown.m_amplitudeoffset + engine_shutdown.m_amplitudefactor * 1.f )
|
||||||
|
.play( sound_flags::exclusive );
|
||||||
}
|
}
|
||||||
engine_state_last = Vehicle.Mains;
|
engine_state_last = Vehicle.Mains;
|
||||||
}
|
}
|
||||||
|
|||||||
1
DynObj.h
1
DynObj.h
@@ -335,6 +335,7 @@ private:
|
|||||||
sound_source rsWentylator { sound_placement::engine }; // McZapkie-030302
|
sound_source rsWentylator { sound_placement::engine }; // McZapkie-030302
|
||||||
sound_source engine { sound_placement::engine }; // generally diesel engine
|
sound_source engine { sound_placement::engine }; // generally diesel engine
|
||||||
sound_source engine_ignition { sound_placement::engine }; // moved from cab
|
sound_source engine_ignition { sound_placement::engine }; // moved from cab
|
||||||
|
sound_source engine_shutdown { sound_placement::engine };
|
||||||
bool engine_state_last { false }; // helper, cached previous state of the engine
|
bool engine_state_last { false }; // helper, cached previous state of the engine
|
||||||
double engine_volume { 0.0 }; // MC: pomocnicze zeby gladziej silnik buczal
|
double engine_volume { 0.0 }; // MC: pomocnicze zeby gladziej silnik buczal
|
||||||
sound_source engine_revving { sound_placement::engine }; // youBy
|
sound_source engine_revving { sound_placement::engine }; // youBy
|
||||||
|
|||||||
Reference in New Issue
Block a user