Skip to content

Commit 3f1e747

Browse files
authored
Merge pull request #825 from Csantucci/controls-in-side-views-of-2D-cabs
2D Cabview controls for side viewpoints https://blueprints.launchpad.net/or/+spec/2dcabview-controls-for-side-views
2 parents d493ede + 29ed427 commit 3f1e747

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

Source/Documentation/Manual/cabs.rst

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,80 @@ Gauges may have Style POINTER or SOLID.
10231023

10241024
Rotation may be applied, with the same syntax, also to DigitalClock cab controls.
10251025

1026+
Display and animation of cabview controls in side views of 2D cabs
1027+
------------------------------------------------------------------
1028+
1029+
This is possible adding after the CabViewControls ( ) compound block an
1030+
ORTSCabviewControls ( ) compound block, that has the same format as the
1031+
CabViewControls ( ) block. The selection of the CabviewPoint where the control
1032+
is displayed/animated is performed by a line::
1033+
1034+
ORTSCabviewPoint ( n )
1035+
1036+
where n is the ordinal position of the cabview point in the header of the .cvf file.
1037+
1038+
Here an example::
1039+
1040+
Tr_CabViewFile (
1041+
1042+
CabViewType ( 1 )
1043+
1044+
CabViewFile ( CV_Front.ace )
1045+
CabViewWindow ( 0 0 1024 768 )
1046+
CabViewWindowFile ( "" )
1047+
Position ( -0.517699 2.78 8.63 )
1048+
Direction ( 0 0 0 )
1049+
1050+
CabViewFile ( CV_Left.ace )
1051+
CabViewWindow ( 0 0 1024 768 )
1052+
CabViewWindowFile ( "" )
1053+
Position ( -0.517699 2.78 8.63 )
1054+
Direction ( 0 -48 0 )
1055+
1056+
CabViewFile ( CV_Right.ace )
1057+
CabViewWindow ( 0 0 1024 768 )
1058+
CabViewWindowFile ( "" )
1059+
Position ( -0.517699 2.78 8.63 )
1060+
Direction ( 0 71.5 0 )
1061+
1062+
EngineData ( BStE-ET_169a_Jm )
1063+
1064+
CabViewControls ( 10
1065+
Dial (
1066+
Type ( MAIN_RES DIAL )
1067+
Position ( 163 32 8 30 )
1068+
Graphic ( CV_Pointer.ace )
1069+
Style ( POINTER )
1070+
ScaleRange ( 0 10 )
1071+
ScalePos ( 227 152 )
1072+
Units ( BAR )
1073+
Pivot ( 20 )
1074+
DirIncrease ( 0 )
1075+
)
1076+
1077+
...
1078+
1079+
)
1080+
1081+
ORTSCabviewControls ( 12
1082+
TwoState ( Comment( Wiperswitch in right cabviewpoint )
1083+
Type ( WIPERS TWO_STATE )
1084+
Position ( 500 165 13 24 )
1085+
Graphic ( CV_WIPERSSwitch.ace )
1086+
NumFrames ( 2 2 1 )
1087+
Style ( ONOFF )
1088+
MouseControl ( 1 )
1089+
ORTSCabviewPoint ( 2 )
1090+
)
1091+
1092+
...
1093+
)
1094+
1095+
1096+
In this example ORTSCabviewPoint refers to the 3rd viewpoint ( 0 refers to the main-central viewpoint ) defined
1097+
in the .cvf header, that is the right side viewpoint.
1098+
1099+
Note that in Open Rails you may have more than three cabviewpoints defined for 2D cabs.
10261100

10271101
3D cabs
10281102
=======

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public CabViewFile(string filePath, string basePath)
6161
LightViews.Add(Path.Combine(path, Path.Combine("CABLIGHT", name)));
6262
}),
6363
new STFReader.TokenProcessor("cabviewcontrols", ()=>{ CabViewControls = new CabViewControls(stf, basePath); }),
64+
new STFReader.TokenProcessor("ortscabviewcontrols", ()=>{
65+
if (CabViewControls == null) CabViewControls = new CabViewControls(stf, basePath);
66+
else CabViewControls.AddCabviewControls(stf, basePath);
67+
}),
6468
});}),
6569
});
6670
}
@@ -371,6 +375,11 @@ public override string ToString()
371375
public class CabViewControls : List<CabViewControl>
372376
{
373377
public CabViewControls(STFReader stf, string basepath)
378+
{
379+
AddCabviewControls(stf, basepath);
380+
}
381+
382+
public void AddCabviewControls(STFReader stf, string basepath)
374383
{
375384
stf.MustMatch("(");
376385
int count = stf.ReadInt(null);
@@ -766,6 +775,7 @@ public CVCFirebox(STFReader stf, string basepath)
766775
new STFReader.TokenProcessor("position", ()=>{ ParsePosition(stf); }),
767776
new STFReader.TokenProcessor("graphic", ()=>{ ParseFireACEFile(stf, basepath); }),
768777
new STFReader.TokenProcessor("fuelcoal", ()=>{ ParseGraphic(stf, basepath); }),
778+
new STFReader.TokenProcessor("ortscabviewpoint", ()=>{ParseCabViewpoint(stf); }),
769779
});
770780

771781
Direction = 1;

0 commit comments

Comments
 (0)