mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 20:19:18 +02:00
build 190902. vehicle derailment, oil pressure change tweak, inverter sound tweak, car braking logic tweak, flashing alerter ui indicator, departure signal sources reduction, additional train state data exposed to uart interface, additional train state data for python scripts, wind simulation tweak, coupler animation fix
This commit is contained in:
71
DynObj.cpp
71
DynObj.cpp
@@ -849,15 +849,18 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
//*************************************************************/// koniec
|
||||
// wezykow
|
||||
// uginanie zderzakow
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
double dist = MoverParameters->Couplers[i].Dist / 2.0;
|
||||
if (smBuforLewy[i])
|
||||
if (dist < 0)
|
||||
smBuforLewy[i]->SetTranslate( Math3D::vector3(dist, 0, 0));
|
||||
if (smBuforPrawy[i])
|
||||
if (dist < 0)
|
||||
smBuforPrawy[i]->SetTranslate( Math3D::vector3(dist, 0, 0));
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
|
||||
auto const dist { clamp( MoverParameters->Couplers[ i ].Dist / 2.0, -MoverParameters->Couplers[ i ].DmaxB, 0.0 ) };
|
||||
|
||||
if( dist >= 0.0 ) { continue; }
|
||||
|
||||
if( smBuforLewy[ i ] ) {
|
||||
smBuforLewy[ i ]->SetTranslate( Math3D::vector3( dist, 0, 0 ) );
|
||||
}
|
||||
if( smBuforPrawy[ i ] ) {
|
||||
smBuforPrawy[ i ]->SetTranslate( Math3D::vector3( dist, 0, 0 ) );
|
||||
}
|
||||
}
|
||||
} // vehicle within 50m
|
||||
|
||||
@@ -2204,12 +2207,9 @@ void TDynamicObject::Move(double fDistance)
|
||||
// Ra 2F1J: to nie jest stabilne (powoduje rzucanie taborem) i wymaga
|
||||
// dopracowania
|
||||
fAdjustment = vFront.Length() - fAxleDist; // na łuku będzie ujemny
|
||||
// if (fabs(fAdjustment)>0.02) //jeśli jest zbyt dużo, to rozłożyć na kilka
|
||||
// przeliczeń
|
||||
// (wygasza drgania?)
|
||||
// if (fabs(fAdjustment)>0.02) //jeśli jest zbyt dużo, to rozłożyć na kilka przeliczeń (wygasza drgania?)
|
||||
//{//parę centymetrów trzeba by już skorygować; te błędy mogą się też
|
||||
// generować na ostrych
|
||||
//łukach
|
||||
// generować na ostrych łukach
|
||||
// fAdjustment*=0.5; //w jednym kroku korygowany jest ułamek błędu
|
||||
//}
|
||||
// else
|
||||
@@ -2784,8 +2784,8 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
auto Frj { 0.0 };
|
||||
auto osie { 0 };
|
||||
// 0a. ustal aktualna nastawe zadania sily napedowej i hamowania
|
||||
if (MoverParameters->Power < 1)
|
||||
{
|
||||
if( ( MoverParameters->Power < 1 )
|
||||
&& ( ctOwner != nullptr ) ) {
|
||||
MoverParameters->MainCtrlPos = ctOwner->Controlling()->MainCtrlPos*MoverParameters->MainCtrlPosNo / std::max(1, ctOwner->Controlling()->MainCtrlPosNo);
|
||||
MoverParameters->ScndCtrlActualPos = ctOwner->Controlling()->ScndCtrlActualPos;
|
||||
}
|
||||
@@ -3126,7 +3126,10 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
-vPosition.x,
|
||||
vPosition.z,
|
||||
vPosition.y };
|
||||
TRotation r { 0.0, 0.0, 0.0 };
|
||||
TRotation const r {
|
||||
0.0,
|
||||
0.0,
|
||||
modelRot.z };
|
||||
// McZapkie-260202 - dMoveLen przyda sie przy stukocie kol
|
||||
dDOMoveLen = GetdMoveLen() + MoverParameters->ComputeMovement(dt, dt1, ts, tp, tmpTraction, l, r);
|
||||
if( Mechanik )
|
||||
@@ -3620,7 +3623,10 @@ bool TDynamicObject::FastUpdate(double dt)
|
||||
-vPosition.x,
|
||||
vPosition.z,
|
||||
vPosition.y };
|
||||
TRotation r { 0.0, 0.0, 0.0 };
|
||||
TRotation const r {
|
||||
0.0,
|
||||
0.0,
|
||||
modelRot.z };
|
||||
// McZapkie: parametry powinny byc pobierane z toru
|
||||
// ts.R=MyTrack->fRadius;
|
||||
// ts.Len= Max0R(MoverParameters->BDist,MoverParameters->ADist);
|
||||
@@ -3904,7 +3910,7 @@ void TDynamicObject::RenderSounds() {
|
||||
}
|
||||
// NBMX sygnal odjazdu
|
||||
if( MoverParameters->Doors.has_warning ) {
|
||||
for( auto &door : m_doorsounds ) {
|
||||
for( auto &departuresignalsound : m_departuresignalsounds ) {
|
||||
// TBD, TODO: per-location door state triggers?
|
||||
if( ( MoverParameters->DepartureSignal )
|
||||
/*
|
||||
@@ -3915,10 +3921,10 @@ void TDynamicObject::RenderSounds() {
|
||||
) {
|
||||
// for the autonomous doors play the warning automatically whenever a door is closing
|
||||
// MC: pod warunkiem ze jest zdefiniowane w chk
|
||||
door.sDepartureSignal.play( sound_flags::exclusive | sound_flags::looping );
|
||||
departuresignalsound.play( sound_flags::exclusive | sound_flags::looping );
|
||||
}
|
||||
else {
|
||||
door.sDepartureSignal.stop();
|
||||
departuresignalsound.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4227,12 +4233,7 @@ void TDynamicObject::RenderSounds() {
|
||||
if( MoverParameters->EventFlag ) {
|
||||
// McZapkie: w razie wykolejenia
|
||||
if( true == TestFlag( MoverParameters->DamageFlag, dtrain_out ) ) {
|
||||
if( GetVelocity() > 0 ) {
|
||||
rsDerailment.play();
|
||||
}
|
||||
else {
|
||||
rsDerailment.stop();
|
||||
}
|
||||
rsDerailment.play( sound_flags::exclusive );
|
||||
}
|
||||
|
||||
MoverParameters->EventFlag = false;
|
||||
@@ -5233,11 +5234,11 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
sound_source soundtemplate { sound_placement::general, 25.f };
|
||||
soundtemplate.deserialize( parser, sound_type::multipart, sound_parameters::range );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &door : m_doorsounds ) {
|
||||
for( auto &departuresignalsound : m_departuresignalsounds ) {
|
||||
// apply configuration to all defined doors, but preserve their individual offsets
|
||||
auto const dooroffset { door.lock.offset() };
|
||||
door.sDepartureSignal = soundtemplate;
|
||||
door.sDepartureSignal.offset( dooroffset );
|
||||
auto const soundoffset { departuresignalsound.offset() };
|
||||
departuresignalsound = soundtemplate;
|
||||
departuresignalsound.offset( soundoffset );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5391,7 +5392,6 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
// left...
|
||||
auto const location { glm::vec3 { MoverParameters->Dim.W * 0.5f, MoverParameters->Dim.H * 0.5f, offset } };
|
||||
door.placement = side::left;
|
||||
door.sDepartureSignal.offset( location );
|
||||
door.rsDoorClose.offset( location );
|
||||
door.rsDoorOpen.offset( location );
|
||||
door.lock.offset( location );
|
||||
@@ -5403,9 +5403,8 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
if( ( sides == "both" )
|
||||
|| ( sides == "right" ) ) {
|
||||
// ...and right
|
||||
auto const location { glm::vec3 { MoverParameters->Dim.W * -0.5f, MoverParameters->Dim.H * 0.5f, offset } };
|
||||
auto const location { glm::vec3 { MoverParameters->Dim.W * -0.5f, 2.f, offset } };
|
||||
door.placement = side::right;
|
||||
door.sDepartureSignal.offset( location );
|
||||
door.rsDoorClose.offset( location );
|
||||
door.rsDoorOpen.offset( location );
|
||||
door.lock.offset( location );
|
||||
@@ -5414,6 +5413,10 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
door.step_open.offset( location );
|
||||
m_doorsounds.emplace_back( door );
|
||||
}
|
||||
// potential departure sound, one per door (pair) on vehicle centreline
|
||||
sound_source departuresignalsound { sound_placement::general, 25.f };
|
||||
departuresignalsound.offset( glm::vec3{ 0.f, 3.f, offset } );
|
||||
m_departuresignalsounds.emplace_back( departuresignalsound );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user