Skip to content

Commit bf32411

Browse files
committed
Merge remote-tracking branch 'upstream/master' into docs-move-online
2 parents f3b41bb + 273f2ef commit bf32411

18 files changed

+660
-477
lines changed

Source/Documentation/Manual/appendices.rst

+13
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,19 @@ The value speed is the required speed value in dimension as set by the relevant
678678
Inclusion of speed definition is optional and need not be set if only approach control position functions
679679
are used.
680680

681+
Signal light parameters
682+
-----------------------
683+
684+
.. index::
685+
single: ORTSSignalLightTex
686+
687+
It is possible to have different light textures in the same signal, by inserting
688+
the following parameter in the signal light definition::
689+
690+
ORTSSignalLightTex ( "name" )
691+
692+
Where **name** is the name of the texture to be used for the signal light.
693+
681694
Signal aspect parameters
682695
------------------------
683696
The following parameters can be included in signal aspect definitions.

Source/Orts.Formats.Msts/SignalConfigurationFile.cs

+5
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,8 @@ public class SignalLight
889889
public float Radius { get; private set; }
890890
/// <summary>is the SIGLIGHT flag SEMAPHORE_CHANGE set?</summary>
891891
public bool SemaphoreChange { get; private set; }
892+
/// <summary> The name of the texture to use for this light, overriding signal's default </summary>
893+
public string LightTextureName { get; private set; } = String.Empty;
892894

893895
/// <summary>
894896
/// Default constructor used during file parsing.
@@ -917,6 +919,9 @@ public SignalLight(STFReader stf)
917919
default: stf.StepBackOneItem(); STFException.TraceInformation(stf, "Skipped unknown SignalLight flag " + stf.ReadString()); break;
918920
}
919921
}),
922+
new STFReader.TokenProcessor("ortssignallighttex", ()=>{
923+
LightTextureName = stf.ReadStringBlock("").ToLowerInvariant();
924+
}),
920925
});
921926
}
922927

Source/Orts.Simulation/Simulation/Physics/Train.cs

+7-9
Original file line numberDiff line numberDiff line change
@@ -1522,13 +1522,11 @@ public void ReverseCars()
15221522
// Reverse brake hose connections and angle cocks
15231523
for (var i = 0; i < Cars.Count; i++)
15241524
{
1525-
var ac = Cars[i].BrakeSystem.AngleCockAOpen;
1526-
Cars[i].BrakeSystem.AngleCockAOpen = Cars[i].BrakeSystem.AngleCockBOpen;
1527-
Cars[i].BrakeSystem.AngleCockBOpen = ac;
1528-
if (i == Cars.Count - 1)
1529-
Cars[i].BrakeSystem.FrontBrakeHoseConnected = false;
1530-
else
1531-
Cars[i].BrakeSystem.FrontBrakeHoseConnected = Cars[i + 1].BrakeSystem.FrontBrakeHoseConnected;
1525+
var bs = Cars[i].BrakeSystem;
1526+
(bs.AngleCockBOpen, bs.AngleCockAOpen) = (bs.AngleCockAOpen, bs.AngleCockBOpen);
1527+
(bs.AngleCockBOpenAmount, bs.AngleCockAOpenAmount) = (bs.AngleCockAOpenAmount, bs.AngleCockBOpenAmount);
1528+
(bs.AngleCockBOpenTime, bs.AngleCockAOpenTime) = (bs.AngleCockAOpenTime, bs.AngleCockBOpenTime);
1529+
(bs.RearBrakeHoseConnected, bs.FrontBrakeHoseConnected) = (bs.FrontBrakeHoseConnected, bs.RearBrakeHoseConnected);
15321530
}
15331531
// Reverse the actual order of the cars in the train.
15341532
Cars.Reverse();
@@ -21666,7 +21664,7 @@ public void UpdateRemoteTrainPos(float elapsedClockSeconds)
2166621664
{
2166721665
car.SpeedMpS = SpeedMpS;
2166821666
if (car.Flipped) car.SpeedMpS = -car.SpeedMpS;
21669-
car.AbsSpeedMpS = car.AbsSpeedMpS * (1 - elapsedClockSeconds ) + targetSpeedMpS * elapsedClockSeconds;
21667+
car.AbsSpeedMpS = car.AbsSpeedMpS * (1 - elapsedClockSeconds ) + Math.Abs(targetSpeedMpS) * elapsedClockSeconds;
2167021668
if (car.IsDriveable && car is MSTSWagon)
2167121669
{
2167221670
(car as MSTSWagon).WheelSpeedMpS = SpeedMpS;
@@ -21685,7 +21683,7 @@ public void UpdateRemoteTrainPos(float elapsedClockSeconds)
2168521683
else if (car is MSTSSteamLocomotive)
2168621684
{
2168721685
(car as MSTSSteamLocomotive).Variable1 = car.AbsSpeedMpS / car.DriverWheelRadiusM / MathHelper.Pi * 5;
21688-
(car as MSTSSteamLocomotive).Variable2 = 0.7f;
21686+
(car as MSTSSteamLocomotive).Variable2 = 70f;
2168921687
}
2169021688
}
2169121689
else if (car is MSTSLocomotive)

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/ManualBraking.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public override void Update(float elapsedClockSeconds)
128128
SteamBrakeCompensation = 1.0f;
129129

130130
// Process manual braking on all cars
131-
if (lead != null)
131+
if (lead != null && lead.BrakemanBrakeController != null)
132132
{
133133
BrakemanBrakeSettingValue = lead.BrakemanBrakeController.CurrentValue;
134134
}
Loading
Loading

Source/RunActivity/Viewer3D/Cameras.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
using Orts.Simulation.Physics;
3030
using Orts.Simulation.RollingStocks;
3131
using Orts.Simulation.Signalling;
32+
using Orts.Viewer3D.Popups;
3233
using ORTS.Common;
3334
using ORTS.Common.Input;
3435
using ORTS.Settings;
@@ -129,7 +130,10 @@ public virtual void Reset()
129130
public void Activate()
130131
{
131132
ScreenChanged();
132-
OnActivate(Viewer.Camera == this);
133+
if (!Viewer.IsFormationReversed)// Avoids flickering
134+
{
135+
OnActivate(Viewer.Camera == this);
136+
}
133137
Viewer.Camera = this;
134138
Viewer.Simulator.PlayerIsInCab = Style == Styles.Cab || Style == Styles.ThreeDimCab;
135139
Update(ElapsedTime.Zero);
@@ -266,7 +270,7 @@ protected void ZoomByMouseWheel(float speed)
266270
{
267271
// Will not zoom-in-out when help windows is up.
268272
// TODO: Property input processing through WindowManager.
269-
if (UserInput.IsMouseWheelChanged && !Viewer.HelpWindow.Visible)
273+
if (UserInput.IsMouseWheelChanged && !Viewer.HelpWindow.Visible && !Viewer.RenderProcess.IsMouseVisible)
270274
{
271275
var fieldOfView = MathHelper.Clamp(FieldOfView - speed * UserInput.MouseWheelChange / 10, 1, 135);
272276
new FieldOfViewCommand(Viewer.Log, fieldOfView);
@@ -1076,7 +1080,7 @@ protected override void OnActivate(bool sameCamera)
10761080
}
10771081
else
10781082
{
1079-
isVisibleTrainCarViewerOrWebpage = Viewer.TrainCarOperationsViewerWindow.Visible || (Viewer.TrainCarOperationsWebpage.Connections > 0 && Viewer.TrainCarOperationsWebpage.TrainCarSelected);
1083+
isVisibleTrainCarViewerOrWebpage = (Viewer.TrainCarOperationsWindow.Visible && !Viewer.TrainCarOperationsViewerWindow.Visible) || Viewer.TrainCarOperationsViewerWindow.Visible || (Viewer.TrainCarOperationsWebpage?.Connections > 0 && Viewer.TrainCarOperationsWebpage.TrainCarSelected);
10801084
}
10811085

10821086
if (attachedCar == null || attachedCar.Train != Viewer.SelectedTrain || carPosition != oldCarPosition)

Source/RunActivity/Viewer3D/Popups/OSDCars.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,17 @@ public override void PrepareFrame(RenderFrame frame, ORTS.Common.ElapsedTime ela
7878
var newLabels = new Dictionary<TrainCar, LabelPrimitive>(labels.Count);
7979
var cars = Owner.Viewer.World.Trains.Cars;
8080
var cameraLocation = Owner.Viewer.Camera.CameraWorldLocation;
81-
var carID = Owner.Viewer.TrainCarOperationsViewerWindow.CurrentCarID;
81+
8282
//data from Webpage
8383
var trainCarWebpage = Owner.Viewer.TrainCarOperationsWebpage;
84+
var trainCarWebpageActive = trainCarWebpage != null && trainCarWebpage.Connections > 0 && trainCarWebpage.TrainCarSelected;
8485
var carIDWebpage = trainCarWebpage != null && trainCarWebpage.Connections > 0 ? trainCarWebpage.CurrentCarID : "";
85-
bool isVisibleTrainCarViewerOrWebpage = Owner.Viewer.TrainCarOperationsViewerWindow.Visible || (trainCarWebpage != null && trainCarWebpage.Connections > 0 && Owner.Viewer.TrainCarOperationsWebpage.TrainCarSelected);
86+
87+
//shows only one CarID label when traincaroperationsviewer is not visible
88+
var trainCarOperationsViewer = Owner.Viewer.TrainCarOperationsViewerWindow;
89+
var carID = Owner.Viewer.TrainCarOperationsViewerWindow.Visible ? trainCarOperationsViewer.CurrentCarID : trainCarWebpageActive ? trainCarWebpage.CurrentCarID : Owner.Viewer.TrainCarOperationsViewerWindow.CurrentCarID;
90+
91+
bool isVisibleTrainCarViewerOrWebpage = (Owner.Viewer.TrainCarOperationsWindow.Visible && !trainCarOperationsViewer.Visible) || trainCarOperationsViewer.Visible || trainCarWebpageActive;
8692
foreach (var car in cars.Keys)
8793
{
8894
// Calculates distance between camera and platform label.

0 commit comments

Comments
 (0)