Skip to content

Commit 29ed427

Browse files
committed
1 parent 35b9498 commit 29ed427

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
@@ -1022,6 +1022,80 @@ Gauges may have Style POINTER or SOLID.
10221022

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

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

10261100
3D cabs
10271101
=======

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
}
@@ -366,6 +370,11 @@ public override string ToString()
366370
public class CabViewControls : List<CabViewControl>
367371
{
368372
public CabViewControls(STFReader stf, string basepath)
373+
{
374+
AddCabviewControls(stf, basepath);
375+
}
376+
377+
public void AddCabviewControls(STFReader stf, string basepath)
369378
{
370379
stf.MustMatch("(");
371380
int count = stf.ReadInt(null);
@@ -761,6 +770,7 @@ public CVCFirebox(STFReader stf, string basepath)
761770
new STFReader.TokenProcessor("position", ()=>{ ParsePosition(stf); }),
762771
new STFReader.TokenProcessor("graphic", ()=>{ ParseFireACEFile(stf, basepath); }),
763772
new STFReader.TokenProcessor("fuelcoal", ()=>{ ParseGraphic(stf, basepath); }),
773+
new STFReader.TokenProcessor("ortscabviewpoint", ()=>{ParseCabViewpoint(stf); }),
764774
});
765775

766776
Direction = 1;

0 commit comments

Comments
 (0)