diff --git a/Driver.cpp b/Driver.cpp index c9f0b9d1..b137c622 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -2340,16 +2340,19 @@ bool TController::PrepareEngine() else OK = false; - OK = OK && ( mvOccupied->ActiveDir != 0 ) && ( mvControlling->ScndPipePress > 4.5 ) && ( workingtemperature ); - if (OK) - { - if (eStopReason == stopSleep) // jeśli dotychczas spał - eStopReason = stopNone; // teraz nie ma powodu do stania + if( ( true == OK ) + && ( mvOccupied->ActiveDir != 0 ) + && ( true == workingtemperature ) + && ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) ) ) { + + if( eStopReason == stopSleep ) { + // jeśli dotychczas spał teraz nie ma powodu do stania + eStopReason = stopNone; + } iEngineActive = 1; return true; } - else - { + else { iEngineActive = 0; return false; } diff --git a/DynObj.cpp b/DynObj.cpp index 97fb3431..d876e636 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -586,18 +586,15 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) if (vFloor.z > 0.0) mdLoad->GetSMRoot()->SetTranslate(modelShake + vFloor); - if (ObjSqrDist < 160000) // gdy bliżej niż 400m + if (ObjSqrDist < ( 400 * 400 ) ) // gdy bliżej niż 400m { for (int i = 0; i < iAnimations; ++i) // wykonanie kolejnych animacji - if (ObjSqrDist < pAnimations[i].fMaxDist) - if (pAnimations[i].yUpdate) // jeśli zdefiniowana funkcja - pAnimations[ i ].yUpdate( &pAnimations[i] ); // aktualizacja animacji (położenia submodeli -/* - pAnimations[i].yUpdate(pAnimations + - i); // aktualizacja animacji (położenia submodeli -*/ + if (ObjSqrDist < pAnimations[ i ].fMaxDist) + if (pAnimations[ i ].yUpdate) // jeśli zdefiniowana funkcja + pAnimations[ i ].yUpdate( &pAnimations[ i ] ); // aktualizacja animacji (położenia submodeli + if( ( mdModel != nullptr ) - && ( ObjSqrDist < 2500 ) ) { + && ( ObjSqrDist < ( 50 * 50 ) ) ) { // gdy bliżej niż 50m // ABu290105: rzucanie pudlem // te animacje wymagają bananów w modelach! @@ -660,11 +657,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) } btnOn = true; } - // else - //{ - // btCPneumatic1.TurnOff(); - // btCPneumatic1r.TurnOff(); - //} if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_pneumatic)) { @@ -685,11 +677,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) } btnOn = true; } - // else - //{ - // btCPneumatic2.TurnOff(); - // btCPneumatic2r.TurnOff(); - //} // przewody zasilajace, j.w. (yB) if (TestFlag(MoverParameters->Couplers[0].CouplingFlag, ctrain_scndpneumatic)) @@ -711,11 +698,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) } btnOn = true; } - // else - //{ - // btPneumatic1.TurnOff(); - // btPneumatic1r.TurnOff(); - //} if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_scndpneumatic)) { @@ -736,11 +718,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) } btnOn = true; } - // else - //{ - // btPneumatic2.TurnOff(); - // btPneumatic2r.TurnOff(); - //} } //*********************************************************************************/ else // po staremu ABu'oewmu @@ -755,11 +732,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) btCPneumatic1r.TurnOn(); btnOn = true; } - // else - //{ - // btCPneumatic1.TurnOff(); - // btCPneumatic1r.TurnOff(); - //} if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_pneumatic)) { @@ -769,11 +741,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) btCPneumatic2r.TurnOn(); btnOn = true; } - // else - //{ - // btCPneumatic2.TurnOff(); - // btCPneumatic2r.TurnOff(); - //} // przewody powietrzne j.w., ABu: decyzja czy rysowac tylko na podstawie // 'render' @@ -786,11 +753,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) btPneumatic1r.TurnOn(); btnOn = true; } - // else - //{ - // btPneumatic1.TurnOff(); - // btPneumatic1r.TurnOff(); - //} if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_scndpneumatic)) { @@ -800,11 +762,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) btPneumatic2r.TurnOn(); btnOn = true; } - // else - //{ - // btPneumatic2.TurnOff(); - // btPneumatic2r.TurnOff(); - //} } //*************************************************************/// koniec // wezykow @@ -819,7 +776,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) if (dist < 0) smBuforPrawy[i]->SetTranslate( Math3D::vector3(dist, 0, 0)); } - } + } // vehicle within 50m // Winger 160204 - podnoszenie pantografow @@ -919,6 +876,19 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) if (smWahacze[i]) smWahacze[i]->SetRotate(float3(1, 0, 0), fWahaczeAmp * cos(MoverParameters->eAngle)); + + // cooling shutters + // NOTE: shutters display _on state when they're closed, _off otherwise + if( ( true == MoverParameters->dizel_heat.water.config.shutters ) + && ( false == MoverParameters->dizel_heat.zaluzje1 ) ) { + btShutters1.Turn( true ); + btnOn = true; + } + if( ( true == MoverParameters->dizel_heat.water_aux.config.shutters ) + && ( false == MoverParameters->dizel_heat.zaluzje2 ) ) { + btShutters2.Turn( true ); + btnOn = true; + } if( ( Mechanik != nullptr ) && ( Mechanik->GetAction() != actSleep ) ) { @@ -929,7 +899,9 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) btnOn = true; } } - } + + } // vehicle within 400m + if( MoverParameters->Battery || MoverParameters->ConverterFlag ) { // sygnały czoła pociagu //Ra: wyświetlamy bez // ograniczeń odległości, by były widoczne z @@ -994,6 +966,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) sectionchunk = sectionchunk->NextGet(); } } + } // ABu 29.01.05 koniec przeklejenia ************************************* @@ -2103,6 +2076,12 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424" iInventory[ side::rear ] |= btHeadSignals23.Active() ? light::headlight_right : 0; btMechanik1.Init( "mechanik1", mdLowPolyInt, false); btMechanik2.Init( "mechanik2", mdLowPolyInt, false); + if( MoverParameters->dizel_heat.water.config.shutters ) { + btShutters1.Init( "shutters1", mdModel, false ); + } + if( MoverParameters->dizel_heat.water_aux.config.shutters ) { + btShutters1.Init( "shutters2", mdModel, false ); + } TurnOff(); // resetowanie zmiennych submodeli if( mdLowPolyInt != nullptr ) { @@ -3741,6 +3720,8 @@ void TDynamicObject::TurnOff() btHeadSignals23.Turn( false ); btMechanik1.Turn( false ); btMechanik2.Turn( false ); + btShutters1.Turn( false ); + btShutters2.Turn( false ); }; // przeliczanie dźwięków, bo będzie słychać bez wyświetlania sektora z pojazdem @@ -3769,7 +3750,7 @@ void TDynamicObject::RenderSounds() { sConverter.stop(); } - if( MoverParameters->VeselVolume > 0 ) { + if( MoverParameters->CompressorSpeed > 0.0 ) { // McZapkie! - dzwiek compressor.wav tylko gdy dziala sprezarka if( MoverParameters->CompressorFlag ) { sCompressor.play( sound_flags::exclusive | sound_flags::looping ); @@ -4966,6 +4947,18 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName, m_powertrainsounds.rsWentylator.m_frequencyfactor /= MoverParameters->RVentnmax; } + else if( token == "radiatorfan1:" ) { + // primary circuit radiator fan + m_powertrainsounds.radiator_fan.deserialize( parser, sound_type::single ); + m_powertrainsounds.radiator_fan.owner( this ); + } + + else if( token == "radiatorfan2" ) { + // auxiliary circuit radiator fan + m_powertrainsounds.radiator_fan.deserialize( parser, sound_type::single ); + m_powertrainsounds.radiator_fan.owner( this ); + } + else if( token == "transmission:" ) { // plik z dzwiekiem, mnozniki i ofsety amp. i czest. // NOTE, fixed default parameters, legacy system leftover @@ -5962,8 +5955,9 @@ TDynamicObject::powertrain_sounds::position( glm::vec3 const Location ) { auto const nullvector { glm::vec3() }; std::vector enginesounds = { - &motor_relay, &dsbWejscie_na_bezoporow, &motor_parallel, &rsWentylator, - &engine, &engine_ignition, &engine_revving, &engine_turbo, + &inverter, + &motor_relay, &dsbWejscie_na_bezoporow, &motor_parallel, &motor_shuntfield, &rsWentylator, + &engine, &engine_ignition, &engine_revving, &engine_turbo, &oil_pump, &radiator_fan, &radiator_fan_aux, &transmission, &rsEngageSlippery }; for( auto sound : enginesounds ) { @@ -6189,7 +6183,6 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub // motor sounds volume = 0.0; if( ( true == Vehicle.Mains ) - && ( false == Vehicle.dizel_ignition ) && ( false == motors.empty() ) ) { if( std::fabs( Vehicle.enrot ) > 0.01 ) { @@ -6283,7 +6276,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub if( Vehicle.EngineType == ElectricInductionMotor ) { if( Vehicle.InverterFrequency > 0.1 ) { - volume = inverter.m_amplitudeoffset + inverter.m_amplitudefactor * std::sqrt( std::fabs( Vehicle.dizel_fill ) ); + volume = inverter.m_amplitudeoffset + inverter.m_amplitudefactor * std::sqrt( std::abs( Vehicle.dizel_fill ) ); inverter .pitch( inverter.m_frequencyoffset + inverter.m_frequencyfactor * Vehicle.InverterFrequency ) @@ -6306,6 +6299,35 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub // ...otherwise shut down the sound rsWentylator.stop(); } + // radiator fan sounds + if( ( Vehicle.EngineType == DieselEngine ) + || ( Vehicle.EngineType == DieselElectric ) ) { + + if( Vehicle.dizel_heat.rpmw > 0.1 ) { + // NOTE: fan speed tends to max out at ~100 rpm; by default we try to get pitch range of 0.5-1.5 and volume range of 0.5-1.0 + radiator_fan + .pitch( 0.5 + radiator_fan.m_frequencyoffset + radiator_fan.m_frequencyfactor * Vehicle.dizel_heat.rpmw * 0.01 ) + .gain( 0.5 + radiator_fan.m_amplitudeoffset + 0.5 * radiator_fan.m_amplitudefactor * Vehicle.dizel_heat.rpmw * 0.01 ) + .play( sound_flags::exclusive | sound_flags::looping ); + } + else { + // ...otherwise shut down the sound + radiator_fan.stop(); + } + + if( Vehicle.dizel_heat.rpmw2 > 0.1 ) { + // NOTE: fan speed tends to max out at ~100 rpm; by default we try to get pitch range of 0.5-1.5 and volume range of 0.5-1.0 + radiator_fan_aux + .pitch( 0.5 + radiator_fan_aux.m_frequencyoffset + radiator_fan_aux.m_frequencyfactor * Vehicle.dizel_heat.rpmw2 * 0.01 ) + .gain( 0.5 + radiator_fan_aux.m_amplitudeoffset + 0.5 * radiator_fan_aux.m_amplitudefactor * Vehicle.dizel_heat.rpmw2 * 0.01 ) + .play( sound_flags::exclusive | sound_flags::looping ); + } + else { + // ...otherwise shut down the sound + radiator_fan_aux.stop(); + } + } + // relay sounds auto const soundflags { Vehicle.SoundFlag }; if( TestFlag( soundflags, sound::relay ) ) { diff --git a/DynObj.h b/DynObj.h index 0a8b42ff..42df8119 100644 --- a/DynObj.h +++ b/DynObj.h @@ -323,6 +323,8 @@ private: sound_source engine_turbo { sound_placement::engine }; double engine_turbo_pitch { 1.0 }; sound_source oil_pump { sound_placement::engine }; + sound_source radiator_fan { sound_placement::engine }; + sound_source radiator_fan_aux { sound_placement::engine }; sound_source transmission { sound_placement::engine }; sound_source rsEngageSlippery { sound_placement::engine }; // moved from cab @@ -372,6 +374,8 @@ private: TButton btHeadSignals23; TButton btMechanik1; TButton btMechanik2; + TButton btShutters1; // cooling shutters for primary water circuit + TButton btShutters2; // cooling shutters for auxiliary water circuit double dRailLength { 0.0 }; std::vector m_axlesounds; diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 091ffad7..ca568c19 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -7798,8 +7798,9 @@ void TMoverParameters::LoadFIZ_Brake( std::string const &line ) { DeltaPipePress = HighPipePress - LowPipePress; extract_value( VeselVolume, "Vv", line, "" ); +/* if( VeselVolume == 0.0 ) { VeselVolume = 0.01; } - +*/ extract_value( MinCompressor, "MinCP", line, "" ); extract_value( MaxCompressor, "MaxCP", line, "" ); extract_value( CompressorSpeed, "CompressorSpeed", line, "" ); diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp index f5ee450a..db2d8d68 100644 --- a/McZapkie/hamulce.cpp +++ b/McZapkie/hamulce.cpp @@ -22,7 +22,7 @@ Copyright (C) 2007-2014 Maciej Cierniak static double const DPL = 0.25; double const TFV4aM::pos_table[11] = {-2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0}; -double const TMHZ_EN57::pos_table[11] = {-2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0}; +double const TMHZ_EN57::pos_table[11] = {-1, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0}; double const TM394::pos_table[11] = {-1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0}; double const TH14K1::BPT_K[6][2] = {{10, 0}, {4, 1}, {0, 1}, {4, 0}, {4, -1}, {15, -1}}; double const TH14K1::pos_table[11] = {-1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0}; diff --git a/Train.cpp b/Train.cpp index 4c8b1fda..69e2cecc 100644 --- a/Train.cpp +++ b/Train.cpp @@ -764,7 +764,7 @@ void TTrain::OnCommand_secondcontrollerincrease( TTrain *Train, command_data con // on press or hold if( Train->mvControlled->ShuntMode ) { Train->mvControlled->AnPos = clamp( - Train->mvControlled->AnPos + ( Command.time_delta * 2.0 ), + Train->mvControlled->AnPos + 0.025, 0.0, 1.0 ); } else { @@ -825,7 +825,7 @@ void TTrain::OnCommand_secondcontrollerdecrease( TTrain *Train, command_data con // on press or hold if( Train->mvControlled->ShuntMode ) { Train->mvControlled->AnPos = clamp( - Train->mvControlled->AnPos - ( Command.time_delta * 2.0 ), + Train->mvControlled->AnPos - 0.025, 0.0, 1.0 ); } Train->mvControlled->DecScndCtrl( 1 ); @@ -7051,6 +7051,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con auto &gauge = Cabine[Cabindex].Gauge(-1); // pierwsza wolna gałka gauge.Load(Parser, DynamicObject, DynamicObject->mdKabina); gauge.AssignDouble(&mvControlled->AnPos); + m_controlmapper.insert( gauge, "shuntmodepower:" ); } else { diff --git a/mouseinput.cpp b/mouseinput.cpp index 75327a69..6724031e 100644 --- a/mouseinput.cpp +++ b/mouseinput.cpp @@ -215,6 +215,9 @@ mouse_input::default_bindings() { { "scndctrl:", { user_command::secondcontrollerincrease, user_command::secondcontrollerdecrease } }, + { "shuntmodepower:", { + user_command::secondcontrollerincrease, + user_command::secondcontrollerdecrease } }, { "dirkey:", { user_command::reverserincrease, user_command::reverserdecrease } }, diff --git a/translation.h b/translation.h index d60c3fef..d48cd8ce 100644 --- a/translation.h +++ b/translation.h @@ -20,6 +20,7 @@ std::string static std::unordered_map m_cabcontrols = { { "mainctrl:", "master controller" }, { "scndctrl:", "second controller" }, + { "shuntmodepower:", "shunt mode power" }, { "dirkey:" , "reverser" }, { "brakectrl:", "train brake" }, { "localbrake:", "independent brake" }, diff --git a/version.h b/version.h index 3b4816b8..4b60e57b 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define VERSION_INFO "M7 19.04.2018, based on tmj 430ab99" +#define VERSION_INFO "M7 19.04.2018/v2, based on tmj 6349a13"