mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 15:09:19 +02:00
shuntfield sound for vehicles with diesel-electric engine, sound positioning support for cab controls, minor AI tweaks and bug fixes
This commit is contained in:
@@ -75,9 +75,14 @@ void TButton::Load( cParser &Parser, TDynamicObject const *Owner, TModel3d *pMod
|
||||
}
|
||||
|
||||
// pass submodel location to defined sounds
|
||||
auto const nulloffset { glm::vec3{} };
|
||||
auto const offset { model_offset() };
|
||||
if( m_soundfxincrease.offset() == nulloffset ) {
|
||||
m_soundfxincrease.offset( offset );
|
||||
}
|
||||
if( m_soundfxdecrease.offset() == nulloffset ) {
|
||||
m_soundfxdecrease.offset( offset );
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
29
Driver.cpp
29
Driver.cpp
@@ -1327,7 +1327,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
fNext = v; // istotna jest prędkość na końcu tego odcinka
|
||||
fDist = d; // dlugość odcinka
|
||||
}
|
||||
else if ((fAcc > 0) && (v > 0) && (v <= fNext)) {
|
||||
else if ((fAcc > 0) && (v >= 0) && (v <= fNext)) {
|
||||
// jeśli nie ma wskazań do hamowania, można podać drogę i prędkość na jej końcu
|
||||
fNext = v; // istotna jest prędkość na końcu tego odcinka
|
||||
fDist = d; // dlugość odcinka (kolejne pozycje mogą wydłużać drogę, jeśli prędkość jest stała)
|
||||
@@ -4614,7 +4614,7 @@ TController::UpdateSituation(double dt) {
|
||||
// w Connect nie, bo moveStopHere odnosi się do stanu po połączeniu
|
||||
if( ( iDrivigFlags & moveStopHere )
|
||||
&& ( vel == 0.0 )
|
||||
&& ( VelNext == 0.0 ) ) {
|
||||
&& ( VelSignal == 0.0 ) ) {
|
||||
// jeśli ma czekać na wolną drogę, stoi a wyjazdu nie ma, to ma stać
|
||||
VelDesired = 0.0;
|
||||
}
|
||||
@@ -4651,15 +4651,11 @@ TController::UpdateSituation(double dt) {
|
||||
VelDesired,
|
||||
TrainParams->TTVmax );
|
||||
}
|
||||
if (VelDesired > 0.0)
|
||||
if( ( ( iDrivigFlags & moveStopHere ) == 0 )
|
||||
|| ( ( SemNextIndex != -1 )
|
||||
&& ( SemNextIndex < sSpeedTable.size() ) // BUG: index can point at non-existing slot. investigate reason(s)
|
||||
&& ( sSpeedTable[SemNextIndex].fVelNext != 0.0 ) ) ) {
|
||||
// jeśli można jechać, to odpalić dźwięk kierownika oraz zamknąć drzwi w
|
||||
// składzie, jeśli nie mamy czekać na sygnał też trzeba odpalić
|
||||
if (iDrivigFlags & moveGuardSignal)
|
||||
{ // komunikat od kierownika tu, bo musi być wolna droga i odczekany czas stania
|
||||
|
||||
if( ( VelDesired > 0.0 )
|
||||
&& ( iDrivigFlags & moveGuardSignal )
|
||||
&& ( OrderCurrentGet() & Obey_train ) ) {
|
||||
// komunikat od kierownika tu, bo musi być wolna droga i odczekany czas stania
|
||||
iDrivigFlags &= ~moveGuardSignal; // tylko raz nadać
|
||||
if( false == tsGuardSignal.empty() ) {
|
||||
tsGuardSignal.stop();
|
||||
@@ -4688,7 +4684,15 @@ TController::UpdateSituation(double dt) {
|
||||
tsGuardSignal.play( sound_flags::exclusive );
|
||||
}
|
||||
}
|
||||
/*
|
||||
if( ( ( iDrivigFlags & moveStopHere ) == 0 )
|
||||
|| ( ( SemNextIndex != -1 )
|
||||
&& ( SemNextIndex < sSpeedTable.size() ) // BUG: index can point at non-existing slot. investigate reason(s)
|
||||
&& ( sSpeedTable[SemNextIndex].fVelNext != 0.0 ) ) ) {
|
||||
// jeśli można jechać, to odpalić dźwięk kierownika oraz zamknąć drzwi w
|
||||
// składzie, jeśli nie mamy czekać na sygnał też trzeba odpalić
|
||||
}
|
||||
*/
|
||||
}
|
||||
if( mvOccupied->V == 0.0 ) {
|
||||
// Ra 2014-03: jesli skład stoi, to działa na niego składowa styczna grawitacji
|
||||
@@ -4769,6 +4773,8 @@ TController::UpdateSituation(double dt) {
|
||||
}
|
||||
else {
|
||||
// przy dużej różnicy wysoki stopień (1,00 potrzebnego opoznienia)
|
||||
if( ( std::max( 75.0, fMaxProximityDist ) + fBrakeDist * braking_distance_multiplier( VelNext ) ) >= ( ActualProximityDist - fMaxProximityDist ) ) {
|
||||
// don't slow down prematurely; as long as we have room to come to a full stop at a safe distance, we're good
|
||||
// ensure some minimal coasting speed, otherwise a vehicle entering this zone at very low speed will be crawling forever
|
||||
auto const brakingpointoffset = VelNext * braking_distance_multiplier( VelNext );
|
||||
AccDesired = std::min(
|
||||
@@ -4782,6 +4788,7 @@ TController::UpdateSituation(double dt) {
|
||||
brakingpointoffset ) )
|
||||
+ 0.1 ) ); // najpierw hamuje mocniej, potem zluzuje
|
||||
}
|
||||
}
|
||||
AccDesired = std::min( AccDesired, AccPreferred );
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -61,12 +61,19 @@ void TGauge::Init(TSubModel *Submodel, TGaugeType Type, float Scale, float Offse
|
||||
else // a banan może być z optymalizacją?
|
||||
Submodel->WillBeAnimated(); // wyłączenie ignowania jedynkowego transformu
|
||||
// pass submodel location to defined sounds
|
||||
auto const nulloffset { glm::vec3{} };
|
||||
auto const offset{ model_offset() };
|
||||
if( m_soundfxincrease.offset() == nulloffset ) {
|
||||
m_soundfxincrease.offset( offset );
|
||||
}
|
||||
if( m_soundfxdecrease.offset() == nulloffset ) {
|
||||
m_soundfxdecrease.offset( offset );
|
||||
}
|
||||
for( auto &soundfxrecord : m_soundfxvalues ) {
|
||||
if( soundfxrecord.second.offset() == nulloffset ) {
|
||||
soundfxrecord.second.offset( offset );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool TGauge::Load( cParser &Parser, TDynamicObject const *Owner, TModel3d *md1, TModel3d *md2, double mul ) {
|
||||
|
||||
@@ -4850,6 +4850,8 @@ double TMoverParameters::TractionForce( double dt ) {
|
||||
else {
|
||||
if( AutoRelayFlag ) {
|
||||
|
||||
auto const shuntfieldstate { ScndCtrlPos };
|
||||
|
||||
switch( RelayType ) {
|
||||
|
||||
case 0: {
|
||||
@@ -4995,6 +4997,10 @@ double TMoverParameters::TractionForce( double dt ) {
|
||||
break;
|
||||
}
|
||||
} // switch RelayType
|
||||
|
||||
if( ScndCtrlPos != shuntfieldstate ) {
|
||||
SetFlag( SoundFlag, ( sound::relay | sound::shuntfield ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user