mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 180419. radiator fan sounds, radiator shutters submodels, minor enhancements and bug fixes
This commit is contained in:
17
Driver.cpp
17
Driver.cpp
@@ -2341,16 +2341,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;
|
||||
}
|
||||
|
||||
134
DynObj.cpp
134
DynObj.cpp
@@ -584,18 +584,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!
|
||||
@@ -658,11 +655,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
}
|
||||
btnOn = true;
|
||||
}
|
||||
// else
|
||||
//{
|
||||
// btCPneumatic1.TurnOff();
|
||||
// btCPneumatic1r.TurnOff();
|
||||
//}
|
||||
|
||||
if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_pneumatic))
|
||||
{
|
||||
@@ -683,11 +675,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))
|
||||
@@ -709,11 +696,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
}
|
||||
btnOn = true;
|
||||
}
|
||||
// else
|
||||
//{
|
||||
// btPneumatic1.TurnOff();
|
||||
// btPneumatic1r.TurnOff();
|
||||
//}
|
||||
|
||||
if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_scndpneumatic))
|
||||
{
|
||||
@@ -734,11 +716,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
}
|
||||
btnOn = true;
|
||||
}
|
||||
// else
|
||||
//{
|
||||
// btPneumatic2.TurnOff();
|
||||
// btPneumatic2r.TurnOff();
|
||||
//}
|
||||
}
|
||||
//*********************************************************************************/
|
||||
else // po staremu ABu'oewmu
|
||||
@@ -753,11 +730,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
btCPneumatic1r.TurnOn();
|
||||
btnOn = true;
|
||||
}
|
||||
// else
|
||||
//{
|
||||
// btCPneumatic1.TurnOff();
|
||||
// btCPneumatic1r.TurnOff();
|
||||
//}
|
||||
|
||||
if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_pneumatic))
|
||||
{
|
||||
@@ -767,11 +739,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'
|
||||
@@ -784,11 +751,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
btPneumatic1r.TurnOn();
|
||||
btnOn = true;
|
||||
}
|
||||
// else
|
||||
//{
|
||||
// btPneumatic1.TurnOff();
|
||||
// btPneumatic1r.TurnOff();
|
||||
//}
|
||||
|
||||
if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_scndpneumatic))
|
||||
{
|
||||
@@ -798,11 +760,6 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
btPneumatic2r.TurnOn();
|
||||
btnOn = true;
|
||||
}
|
||||
// else
|
||||
//{
|
||||
// btPneumatic2.TurnOff();
|
||||
// btPneumatic2r.TurnOff();
|
||||
//}
|
||||
}
|
||||
//*************************************************************/// koniec
|
||||
// wezykow
|
||||
@@ -817,7 +774,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
if (dist < 0)
|
||||
smBuforPrawy[i]->SetTranslate( Math3D::vector3(dist, 0, 0));
|
||||
}
|
||||
}
|
||||
} // vehicle within 50m
|
||||
|
||||
// Winger 160204 - podnoszenie pantografow
|
||||
|
||||
@@ -917,6 +874,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 ) ) {
|
||||
@@ -927,7 +897,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
|
||||
@@ -992,6 +964,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
sectionchunk = sectionchunk->NextGet();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// ABu 29.01.05 koniec przeklejenia *************************************
|
||||
|
||||
@@ -2102,6 +2075,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 ) {
|
||||
@@ -3740,6 +3719,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
|
||||
@@ -3768,7 +3749,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 );
|
||||
@@ -4963,6 +4944,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
|
||||
@@ -5958,8 +5951,9 @@ TDynamicObject::powertrain_sounds::position( glm::vec3 const Location ) {
|
||||
|
||||
auto const nullvector { glm::vec3() };
|
||||
std::vector<sound_source *> 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 ) {
|
||||
@@ -6185,7 +6179,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 ) {
|
||||
@@ -6279,7 +6272,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 )
|
||||
@@ -6302,6 +6295,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 ) ) {
|
||||
|
||||
4
DynObj.h
4
DynObj.h
@@ -322,6 +322,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
|
||||
|
||||
@@ -371,6 +373,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<axle_sounds> m_axlesounds;
|
||||
|
||||
@@ -7800,8 +7800,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, "" );
|
||||
|
||||
@@ -759,7 +759,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 {
|
||||
@@ -820,7 +820,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 );
|
||||
@@ -7045,6 +7045,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
|
||||
{
|
||||
|
||||
@@ -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 } },
|
||||
|
||||
@@ -20,6 +20,7 @@ std::string
|
||||
static std::unordered_map<std::string, std::string> m_cabcontrols = {
|
||||
{ "mainctrl:", "master controller" },
|
||||
{ "scndctrl:", "second controller" },
|
||||
{ "shuntmodepower:", "shunt mode power" },
|
||||
{ "dirkey:" , "reverser" },
|
||||
{ "brakectrl:", "train brake" },
|
||||
{ "localbrake:", "independent brake" },
|
||||
|
||||
Reference in New Issue
Block a user