Skip to content

Commit 68f4736

Browse files
authored
Merge pull request #612 from Csantucci/DP-display-3Dcab
https://blueprints.launchpad.net/or/+spec/distributed-power-display-for-3d-cabs
2 parents f42899a + eb72a02 commit 68f4736

File tree

6 files changed

+499
-12
lines changed

6 files changed

+499
-12
lines changed

Source/Documentation/Manual/cabs.rst

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,11 @@ Load field. Default is AMPS in a metric environment and KILO_LBS in
478478
the other cases. Selectable LoadUnits are AMPS, NEWTONS, KILO_NEWTONS,
479479
LBS and KILO_KBS.
480480

481-
The screen display can be rotated adding parameter
481+
The screen display can be rotated in 2D cabs adding parameter
482482
ORTSAngle ( number ) in the ScreenDisplay block. The angle is in degrees.
483483

484+
Info specific for 3D cabs can be found :ref:`here <cabs-distributed-power-3d>` .
485+
484486
For every keyboard command related to Distributed Power, a cabview control
485487
is also available. Here's a list of the cabview controls::
486488

@@ -1013,6 +1015,41 @@ Here below is an example of an entry for a 3D cab::
10131015
Units ( LBS )
10141016
)
10151017

1018+
1019+
.. _cabs-distributed-power-3d:
1020+
1021+
Distributed power display
1022+
-------------------------
1023+
1024+
Following info applies to the creation of a distributed power display in 2D cabs, in
1025+
addition to what is described :ref:`here <cabs-distributed-power>` for 2D cabs.
1026+
1027+
In the 3Dcab .s file an ORTS_DISTRIBUTED_POWER object must be defined, with the same
1028+
syntax rules of the digitals, so e.g. ORTS_DISTRIBUTED_POWER:0:8:DPI ,
1029+
where 8 is the selected character font size and DPI is the DPI.ace texture associated.
1030+
1031+
In the folder where the 3D cab files are located (usually CABVIEW3D) such file DPI.ace
1032+
must be present. A sample file for that can be found in
1033+
``Documentation\SampleFiles\Manual\DPI.zip`` . Here is how such file looks like
1034+
1035+
.. image:: images/cabs-dpi-ace.png
1036+
:align: center
1037+
:scale: 80%
1038+
1039+
Customizations for such file are possible following these rules:
1040+
1041+
1. Horizontal/vertical ratio must be kept
1042+
2. The first four lines must have the characters centered in their rectangle.
1043+
3. From the 5th line on characters may be also spaced in a thicker way (as is for
1044+
the ``Idle`` string in the above picture)
1045+
4. From the 5th line on strings may be replaced bo strings in other national languages,
1046+
provided that the new strings aren't wider than the original ones.
1047+
5. It should be possible to have a transparent background if preferred.
1048+
1049+
1050+
Except for the first column, fields
1051+
in the 3D distributed power display are always with center alignment.
1052+
10161053
Alignment for digital controls
10171054
------------------------------
10181055

Loading
6.01 KB
Binary file not shown.

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ public string GetDpuStatus(bool dataDpu, CABViewControlUnits loadUnits = CABView
10631063

10641064
var status = new StringBuilder();
10651065
// ID
1066-
status.AppendFormat("{0}({1})\t", CarID, DPUnitID);
1066+
status.AppendFormat("{0}({1})\t", CarID.Replace(" ", ""), DPUnitID);
10671067
// Throttle
10681068
status.AppendFormat("{0}\t", throttle);
10691069

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2863,6 +2863,7 @@ public class ThreeDimentionCabViewer : TrainCarViewer
28632863
Dictionary<int, AnimatedPart> OnDemandAnimateParts = null; //like external wipers, and other parts that will be switched on by mouse in the future
28642864
//Dictionary<int, DigitalDisplay> DigitParts = null;
28652865
Dictionary<int, ThreeDimCabDigit> DigitParts3D = null;
2866+
Dictionary<int, ThreeDimCabDPI> DPIDisplays3D = null;
28662867
AnimatedPart ExternalWipers = null; // setting to zero to prevent a warning. Probably this will be used later. TODO
28672868
protected MSTSLocomotive MSTSLocomotive { get { return (MSTSLocomotive)Car; } }
28682869
MSTSLocomotiveViewer LocoViewer;
@@ -2883,9 +2884,9 @@ public ThreeDimentionCabViewer(Viewer viewer, MSTSLocomotive car, MSTSLocomotive
28832884
else locoViewer.ThreeDimentionCabRenderer = locoViewer._CabRenderer;
28842885

28852886
AnimateParts = new Dictionary<int, AnimatedPartMultiState>();
2886-
//DigitParts = new Dictionary<int, DigitalDisplay>();
28872887
DigitParts3D = new Dictionary<int, ThreeDimCabDigit>();
28882888
Gauges = new Dictionary<int, ThreeDimCabGaugeNative>();
2889+
DPIDisplays3D = new Dictionary<int, ThreeDimCabDPI>();
28892890
OnDemandAnimateParts = new Dictionary<int, AnimatedPart>();
28902891

28912892
// Find the animated parts
@@ -2977,6 +2978,10 @@ public ThreeDimentionCabViewer(Viewer viewer, MSTSLocomotive car, MSTSLocomotive
29772978
tmpPart.AddMatrix(iMatrix); //tmpPart.SetPosition(false);
29782979
}
29792980
}
2981+
else if (style != null && style is DistributedPowerInterfaceRenderer)
2982+
{
2983+
DPIDisplays3D.Add(key, new ThreeDimCabDPI(viewer, iMatrix, parameter1, parameter2, this.TrainCarShape, locoViewer.ThreeDimentionCabRenderer.ControlMap[key]));
2984+
}
29802985
else
29812986
{
29822987
//if there is a part already, will insert this into it, otherwise, create a new
@@ -3100,6 +3105,23 @@ public override void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
31003105
}
31013106
p.Value.PrepareFrame(frame, elapsedTime);
31023107
}
3108+
foreach (var p in DPIDisplays3D)
3109+
{
3110+
var dpdisplay = p.Value.CVFR.Control;
3111+
if (dpdisplay.Screens != null && dpdisplay.Screens[0] != "all")
3112+
{
3113+
foreach (var screen in dpdisplay.Screens)
3114+
{
3115+
if (LocoViewer.ThreeDimentionCabRenderer.ActiveScreen[dpdisplay.Display] == screen)
3116+
{
3117+
p.Value.PrepareFrame(frame, elapsedTime);
3118+
break;
3119+
}
3120+
}
3121+
continue;
3122+
}
3123+
p.Value.PrepareFrame(frame, elapsedTime);
3124+
}
31033125
foreach (var p in Gauges)
31043126
{
31053127
var gauge = p.Value.CVFR.Control;
@@ -3136,6 +3158,10 @@ internal override void Mark()
31363158
{
31373159
threeDimCabDigit.Mark();
31383160
}
3161+
foreach (ThreeDimCabDPI threeDimCabDPI in DPIDisplays3D.Values)
3162+
{
3163+
threeDimCabDPI.Mark();
3164+
}
31393165
}
31403166
}
31413167

0 commit comments

Comments
 (0)