Skip to content

Commit 254c39d

Browse files
committed
View OR freight animations in 3D cabs only if specific flag seg
1 parent a55289c commit 254c39d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/FreightAnimations.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ public enum Type
308308
public float ZOffset = 0;
309309
public float FreightWeight = 0;
310310
public bool Flipped = false;
311+
public bool Cab3DFreightAnim = false;
311312

312313
// additions to manage consequences of variable weight on friction and brake forces
313314
public float FullStaticORTSDavis_A = -9999;
@@ -343,6 +344,7 @@ public FreightAnimationStatic(STFReader stf)
343344
stf.MustMatch(")");
344345
}),
345346
new STFReader.TokenProcessor("flip", ()=>{ Flipped = stf.ReadBoolBlock(true);}),
347+
new STFReader.TokenProcessor("cab3dfreightanim", ()=>{ Cab3DFreightAnim = stf.ReadBoolBlock(true);}),
346348
// additions to manage consequences of variable weight on friction and brake forces
347349
new STFReader.TokenProcessor("fullortsdavis_a", ()=>{ FullStaticORTSDavis_A = stf.ReadFloatBlock(STFReader.UNITS.Force, -1); }),
348350
new STFReader.TokenProcessor("fullortsdavis_b", ()=>{ FullStaticORTSDavis_B = stf.ReadFloatBlock(STFReader.UNITS.Resistance, -1); }),
@@ -364,6 +366,7 @@ public FreightAnimationStatic(FreightAnimationStatic freightAnimStatic)
364366
YOffset = freightAnimStatic.YOffset;
365367
ZOffset = freightAnimStatic.ZOffset;
366368
Flipped = freightAnimStatic.Flipped;
369+
Cab3DFreightAnim = freightAnimStatic.Cab3DFreightAnim;
367370
FreightWeight = freightAnimStatic.FreightWeight;
368371

369372
// additions to manage consequences of variable weight on friction and brake forces

Source/RunActivity/Viewer3D/RollingStock/MSTSWagonViewer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ private void UpdateAnimation(RenderFrame frame, ElapsedTime elapsedTime)
598598
// It appears that only one MSTS type FA can be used per vehicle (to be confirmed?)
599599
// For coal load variation, C should be absent (set to 1 when read in WAG file) or >0 - sets FreightAnimFlag; and A > B
600600
// To disable coal load variation and insert a static (crew) shape on the tender breech, one of the conditions indicated above
601-
if (FreightShape != null)
601+
if (FreightShape != null && !(Viewer.Camera.AttachedCar == this.MSTSWagon && Viewer.Camera.Style == Camera.Styles.ThreeDimCab))
602602
{
603603
// Define default position of shape
604604
FreightShape.Location.XNAMatrix = Car.WorldPosition.XNAMatrix;
@@ -655,6 +655,9 @@ private void UpdateAnimation(RenderFrame frame, ElapsedTime elapsedTime)
655655
{
656656
foreach (var freightAnim in FreightAnimations.Animations)
657657
{
658+
if (freightAnim.Animation is FreightAnimationStatic)
659+
if ((freightAnim.Animation as FreightAnimationStatic).Cab3DFreightAnim ^
660+
(Viewer.Camera.AttachedCar == this.MSTSWagon && Viewer.Camera.Style == Camera.Styles.ThreeDimCab)) continue;
658661
if (freightAnim.FreightShape != null && !((freightAnim.Animation is FreightAnimationContinuous) && (freightAnim.Animation as FreightAnimationContinuous).LoadPerCent == 0))
659662
{
660663
freightAnim.FreightShape.Location.XNAMatrix = Car.WorldPosition.XNAMatrix;

0 commit comments

Comments
 (0)