Skip to content

Commit 42f4d56

Browse files
committed
Automatic merge of T1.5.1-1692-g8b2dd97c0 and 16 pull requests
- Pull request #900 at 4629736: DMI in 3D cab + two more dials - Pull request #1030 at d3ae4a2: Refactor settings, in prep for settings exporter - Pull request #1045 at cc4d53c: Bugfix: Empty Start Time for Explore, and other issues loading from Menu Selection and Content Routes - Pull request #1052 at 5bbc476: Content Manager: Add axle count, and lowest derail force - Pull request #1062 at 3b18c48: Train Forces popup Window. - Pull request #1064 at 9b3415e: Add Train Info tab to Help window (F1) - Pull request #1066 at 62c89c1: Log derailment, using TraceInformation. - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #1000 at d8d9709: Locomotive operation from control car - Pull request #1029 at 92c74ef: Superelevation Follow Up Fixes - Pull request #1057 at 50c3789: Switchable brake system - Pull request #1065 at 409064d: Fix for PantographToggle sound event - Pull request #1069 at 3f153f0: Mouse wheel control only with Alt – Followup for #1051 - Pull request #1055 at f6bf9fa: Route Based TTrack Sounds - Pull request #896 at f1681df: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #1049 at 4dd8c4f: Re-organise document storage and access
18 parents ed639ad + 8b2dd97 + 4629736 + d3ae4a2 + cc4d53c + 5bbc476 + 3b18c48 + 9b3415e + 62c89c1 + 1f5ba4c + d8d9709 + 92c74ef + 50c3789 + 409064d + 3f153f0 + f6bf9fa + f1681df + 4dd8c4f commit 42f4d56

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Source/Orts.Formats.Msts/SoundManagmentFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public struct CurvePoint
243243

244244
public class VolumeCurve
245245
{
246-
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable1_2Controlled, Variable1_3Controlled, Variable1_4Controlled, Variable2Controlled, Variable2BoosterControlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled, AngleofAttackControlled, CarFrictionControlled, WheelRpMControlled };
246+
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable1_2Controlled, Variable1_3Controlled, Variable1_4Controlled, Variable2Controlled, Variable2BoosterControlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled, AngleofAttackControlled, CarFrictionControlled, WheelRpMControlled, CarDistanceTrackControlled };
247247

248248
public Controls Control = Controls.None;
249249
public float Granularity = 1.0f;
@@ -270,6 +270,7 @@ public VolumeCurve(STFReader stf)
270270
case "angleofattackcontrolled": Control = Controls.AngleofAttackControlled; break;
271271
case "carfrictioncontrolled": Control = Controls.CarFrictionControlled; break;
272272
case "wheelrpmcontrolled": Control = Controls.WheelRpMControlled; break;
273+
case "distancetrackcontrolled": Control = Controls.CarDistanceTrackControlled; break;
273274
default: STFException.TraceWarning(stf, "Crash expected: Skipped unknown VolumeCurve/Frequencycurve type " + type); stf.SkipRestOfBlock(); return;
274275
}
275276
stf.ParseBlock(new STFReader.TokenProcessor[] {

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ public Direction Direction
616616
float jointTriggerDelayedS = 0.1f; // Set delay to 0.1 seconds
617617
float jointSpeedMpS;
618618
public float SoundAxleCount;
619+
public float CarTrackControlledDistanceM = 0;
619620

620621
// Track sound effects - switch / crossover
621622
public float TrackSwitchSoundTriggered;

Source/RunActivity/Viewer3D/Sound.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,13 @@ public void UpdateTType(bool stateChange)
330330
Car.TrackSoundLocation = new WorldLocation(Car.WorldPosition.WorldLocation);
331331
_prevTType = _curTType;
332332
}
333+
334+
if (SharedSMSFileManager.PlayDefaultTrackSoundsContinuous)
335+
{
336+
// Calculate the distance from the car to the camera position. Used for track based sounds
337+
Car.CarTrackControlledDistanceM = (float)Math.Sqrt(WorldLocation.GetDistanceSquared(Car.WorldPosition.WorldLocation, Viewer.Camera.CameraWorldLocation));
338+
}
339+
333340
}
334341
}
335342

@@ -1538,6 +1545,7 @@ private float ReadValue(Orts.Formats.Msts.VolumeCurve.Controls control, MSTSWago
15381545
case Orts.Formats.Msts.VolumeCurve.Controls.AngleofAttackControlled: return car.CurveSquealAoAmRadFiltered;
15391546
case Orts.Formats.Msts.VolumeCurve.Controls.CarFrictionControlled: return car.Train.WagonCoefficientFriction;
15401547
case Orts.Formats.Msts.VolumeCurve.Controls.WheelRpMControlled: var wheelRpM = pS.TopM((float)(car.AbsSpeedMpS / (2 * Math.PI * car.WheelRadiusM))); return wheelRpM;
1548+
case Orts.Formats.Msts.VolumeCurve.Controls.CarDistanceTrackControlled: return car.CarTrackControlledDistanceM;
15411549
default: return 0;
15421550
}
15431551
}

0 commit comments

Comments
 (0)