diff --git a/Driver.cpp b/Driver.cpp index cc82fa2b..be287014 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -7622,7 +7622,7 @@ void TController::control_tractive_force() { auto const velocity { DirectionalVel() }; // jeśli przyspieszenie pojazdu jest mniejsze niż żądane oraz... if( ( AccDesired > EU07_AI_NOACCELERATION ) // don't add power if not asked for actual speed-up - && ( AccDesired - AbsAccS > 0.05 ) + && ( AbsAccS < AccDesired /* - 0.05 */ ) && ( false == TestFlag( iDrivigFlags, movePress ) ) ) { // ...jeśli prędkość w kierunku czoła jest mniejsza od dozwolonej o margines... if( velocity < ( @@ -7652,7 +7652,7 @@ void TController::control_tractive_force() { else if( ( velocity > VelDesired + SpeedCtrlMargin) || ( fAccGravity < -0.01 ? AccDesired < 0.0 : - (AbsAccS > AccDesired + 0.05) ) + ( AbsAccS > AccDesired + 0.05 ) ) || ( IsAnyCouplerStretched ) ) { // jak za bardzo przyspiesza albo prędkość przekroczona // dodany wyjatek na "pelna w przod" @@ -7817,11 +7817,12 @@ void TController::control_releaser() { if( mvOccupied->BrakeSystem != TBrakeSystem::Pneumatic ) { return; } auto const hasreleaser { - ( mvOccupied->BrakeHandle == TBrakeHandle::FV4a ) - || ( mvOccupied->BrakeHandle == TBrakeHandle::MHZ_6P ) - || ( mvOccupied->BrakeHandle == TBrakeHandle::MHZ_K5P ) - || ( mvOccupied->BrakeHandle == TBrakeHandle::MHZ_K8P ) - || ( mvOccupied->BrakeHandle == TBrakeHandle::M394 ) }; + ( false == ( is_dmu() || is_emu() ) ) // TODO: a more refined test than rejecting these types wholesale + && ( ( mvOccupied->BrakeHandle == TBrakeHandle::FV4a ) + || ( mvOccupied->BrakeHandle == TBrakeHandle::MHZ_6P ) + || ( mvOccupied->BrakeHandle == TBrakeHandle::MHZ_K5P ) + || ( mvOccupied->BrakeHandle == TBrakeHandle::MHZ_K8P ) + || ( mvOccupied->BrakeHandle == TBrakeHandle::M394 ) ) }; if( false == hasreleaser ) { return; } diff --git a/DynObj.cpp b/DynObj.cpp index af41a8f1..ca094e5c 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -4109,17 +4109,20 @@ void TDynamicObject::RenderSounds() { } // heater sound - if( ( true == MoverParameters->Heating ) - && ( std::abs( MoverParameters->enrot ) > 0.01 ) ) { - // TBD: check whether heating should depend on 'engine rotations' for electric vehicles - sHeater - .pitch( true == sHeater.is_combined() ? + { + auto const isdieselenginepowered { ( MoverParameters->EngineType == TEngineType::DieselElectric ) || ( MoverParameters->EngineType == TEngineType::DieselEngine ) }; + if( ( true == MoverParameters->Heating ) + && ( ( false == isdieselenginepowered ) + || ( std::abs( MoverParameters->enrot ) > 0.01 ) ) ) { + sHeater + .pitch( true == sHeater.is_combined() ? std::abs( MoverParameters->enrot ) * 60.f * 0.01f : 1.f ) - .play( sound_flags::exclusive | sound_flags::looping ); - } - else { - sHeater.stop(); + .play( sound_flags::exclusive | sound_flags::looping ); + } + else { + sHeater.stop(); + } } // battery sound @@ -4338,6 +4341,11 @@ void TDynamicObject::RenderSounds() { m_pasystem.announcement = m_pasystem.announcement_queue.front(); m_pasystem.announcement.owner( this ); m_pasystem.announcement.range( 0.5 * MoverParameters->Dim.L * -1 ); + if( m_pasystem.soundproofing ) { + if( !m_pasystem.announcement.soundproofing() ) { + m_pasystem.announcement.soundproofing() = m_pasystem.soundproofing; + } + } m_pasystem.announcement.play(); m_pasystem.announcement_queue.pop_front(); } @@ -5958,7 +5966,6 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co // announcement sounds // content provided as "key: value" pairs together enclosed in "{}" // value can be optionally set of values enclosed in "[]" in which case one value will be picked randomly - std::array( announcement_t::end )> announcementsounds; std::unordered_map const announcements = { { "near_stop:", announcement_t::approaching }, { "stop:", announcement_t::current }, @@ -5968,23 +5975,50 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co while( ( ( token = parser.getToken() ) != "" ) && ( token != "}" ) ) { if( token.back() == ':' ) { + + if( token == "soundproofing:" ) { + // custom soundproofing in format [ p1, p2, p3, p4, p5, p6 ] + parser.getTokens( 6, false, "\n\r\t ,;[]" ); + std::array soundproofing; + parser + >> soundproofing[ 0 ] + >> soundproofing[ 1 ] + >> soundproofing[ 2 ] + >> soundproofing[ 3 ] + >> soundproofing[ 4 ] + >> soundproofing[ 5 ]; + m_pasystem.soundproofing = soundproofing; + continue; + } + auto const lookup { announcements.find( token ) }; auto const announcementtype { ( lookup != announcements.end() ? lookup->second : announcement_t::idle ) }; // NOTE: we retrieve key value for all keys, not just recognized ones - auto announcementsound{ deserialize_random_set( parser ) }; - replace_slashes( announcementsound ); if( announcementtype == announcement_t::idle ) { + token = parser.getToken(); continue; } +/* + auto announcementsound { deserialize_random_set( parser ) }; + replace_slashes( announcementsound ); +*/ sound_source soundtemplate { sound_placement::engine }; // NOTE: sound range gets filled by pa system - soundtemplate.deserialize( announcementsound, sound_type::single ); + soundtemplate.deserialize( parser, sound_type::single ); soundtemplate.owner( this ); m_pasystem.announcements[ static_cast( announcementtype ) ] = soundtemplate; } } + // set provided custom soundproofing to assigned sounds (for sounds without their own custom soundproofing) + if( m_pasystem.soundproofing ) { + for( auto &announcement : m_pasystem.announcements ) { + if( !announcement.soundproofing() ) { + announcement.soundproofing() = m_pasystem.soundproofing; + } + } + } } } while( ( token != "" ) diff --git a/DynObj.h b/DynObj.h index cf614561..aa60fb21 100644 --- a/DynObj.h +++ b/DynObj.h @@ -417,6 +417,7 @@ private: // single source per vehicle struct pasystem_sounds { std::array( announcement_t::end )> announcements; + std::optional< std::array > soundproofing; sound_source announcement; std::deque announcement_queue; // fifo queue }; diff --git a/driverhints.cpp b/driverhints.cpp index 90c5f92f..fb0af11d 100644 --- a/driverhints.cpp +++ b/driverhints.cpp @@ -938,7 +938,7 @@ TController::cue_action( locale::string const Action, float const Actionparamete hint( Action, [this](float const Parameter) -> bool { - return ( ( mvControlling->Sand == 0 ) || ( mvControlling->SandDose == true ) ); } ); + return ( ( mvControlling->Sand == 0 ) || ( mvControlling->SandDose == true ) || ( mvControlling->SlippingWheels == false ) ); } ); break; } case locale::string::driver_hint_sandingoff: { diff --git a/version.h b/version.h index c7002bc9..db807e11 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 21 -#define VERSION_MINOR 424 +#define VERSION_MINOR 426 #define VERSION_REVISION 0