13
13
using Orts . Simulation . RollingStocks ;
14
14
using Orts . Simulation . Signalling ;
15
15
using Orts . Simulation . Timetables ;
16
+ using Orts . Viewer3D . Map ;
16
17
using Orts . Viewer3D . Popups ;
17
18
using ORTS . Common ;
18
19
using Color = System . Drawing . Color ;
19
20
20
21
namespace Orts . Viewer3D . Debugging
21
22
{
22
- public partial class DispatchViewerBeta : Form
23
+ public partial class MapViewer : Form
23
24
{
24
25
#region Variables
25
26
/// <summary>
@@ -45,8 +46,6 @@ public partial class DispatchViewerBeta : Form
45
46
public float xScale = 1 ; // pixels / metre
46
47
public float yScale = 1 ; // pixels / metre
47
48
48
- readonly string name = "" ;
49
-
50
49
public List < SwitchWidget > switchItemsDrawn ;
51
50
public List < SignalWidget > signalItemsDrawn ;
52
51
public SwitchWidget switchPickedItem ;
@@ -104,7 +103,7 @@ public partial class DispatchViewerBeta : Form
104
103
private bool MapCustomizationVisible = false ;
105
104
#endregion
106
105
107
- public DispatchViewerBeta ( Simulator simulator , Viewer viewer )
106
+ public MapViewer ( Simulator simulator , Viewer viewer )
108
107
{
109
108
InitializeComponent ( ) ;
110
109
@@ -496,7 +495,7 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
496
495
497
496
selectedTrainList . Clear ( ) ;
498
497
499
- if ( simulator . TimetableMode )
498
+ /* if (simulator.TimetableMode)
500
499
{
501
500
// Add the player's train...
502
501
if (simulator.PlayerLocomotive.Train is AITrain)
@@ -507,10 +506,10 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
507
506
selectedTrainList.Add(train);
508
507
}
509
508
else
510
- {
511
- foreach ( var train in simulator . Trains )
512
- selectedTrainList . Add ( train ) ;
513
- }
509
+ {*/
510
+ foreach ( var train in simulator . Trains )
511
+ selectedTrainList . Add ( train ) ;
512
+ /*}*/
514
513
515
514
foreach ( var train in selectedTrainList )
516
515
{
@@ -532,7 +531,7 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
532
531
533
532
// Skip trains with no loco
534
533
if ( locoCar == null )
535
- continue ;
534
+ locoCar = train . Cars [ 0 ] ;
536
535
}
537
536
else
538
537
continue ;
@@ -543,8 +542,7 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
543
542
float y = mapCanvas . Height - ( ( ( loc . TileZ * 2048 ) + loc . Location . Z - subY ) * yScale ) ;
544
543
545
544
// If train out of view then skip it.
546
- if ( x < - margin2
547
- || y < - margin2 )
545
+ if ( x < - margin2 || y < - margin2 )
548
546
continue ;
549
547
550
548
DrawTrainPath ( train , subX , subY , pathPen , g , scaledA , scaledB , pDist , mDist ) ;
@@ -573,7 +571,7 @@ private void DrawTrains(Graphics g, PointF scaledA, PointF scaledB)
573
571
Y = - 25 + mapCanvas . Height - ( ( ( worldPos . TileZ * 2048 ) - subY + worldPos . Location . Z ) * yScale )
574
572
} ;
575
573
if ( showTrainLabelsCheckbox . Checked )
576
- DrawTrainLabels ( g , train , trainName , locoCar , scaledTrain ) ;
574
+ DrawTrainLabels ( g , train , trainName , scaledTrain ) ;
577
575
}
578
576
}
579
577
@@ -602,7 +600,7 @@ private void DrawCar(Graphics g, Train train, TrainCar car, TrainCar locoCar, fl
602
600
if ( x < - margin || y < - margin )
603
601
return ;
604
602
605
- t . Move ( - car . CarLengthM + ( 1 / xScale ) ) ; // Move from front of car to rear less 1 pixel to create a visible gap
603
+ t . Move ( - car . CarLengthM + ( 2 / xScale ) ) ; // Move from front of car to rear less 1 pixel to create a visible gap // TODO: investigate `(1 / xScale)` ==> `(2 / xScale)` car gap consequences
606
604
scaledTrain . X = x ; scaledTrain . Y = y ;
607
605
}
608
606
else // Draw the train as 2 boxes of fixed size
@@ -659,32 +657,27 @@ private void SetTrainColor(Train t, TrainCar locoCar, TrainCar car)
659
657
// inactive loco: RGB 153,128,0
660
658
// active car: RGB 0,204,0
661
659
// inactive car: RGB 0,153,0
662
- if ( MapDataProvider . IsActiveTrain ( t as AITrain ) )
663
- {
664
- trainPen . Color = car is MSTSLocomotive
660
+ trainPen . Color = MapDataProvider . IsActiveTrain ( t as AITrain )
661
+ ? car is MSTSLocomotive
665
662
? ( car == locoCar ) ? Color . FromArgb ( 204 , 170 , 0 ) : Color . FromArgb ( 153 , 128 , 0 )
666
- : Color . FromArgb ( 0 , 204 , 0 ) ;
667
- }
668
- else
669
- {
670
- trainPen . Color = car is MSTSLocomotive ? Color . FromArgb ( 153 , 128 , 0 ) : Color . FromArgb ( 0 , 153 , 0 ) ;
671
- }
663
+ : Color . FromArgb ( 0 , 204 , 0 )
664
+ : car is MSTSLocomotive ? Color . FromArgb ( 153 , 128 , 0 ) : Color . FromArgb ( 0 , 153 , 0 ) ;
672
665
673
666
if ( t . TrainType == Train . TRAINTYPE . STATIC || ( t . TrainType == Train . TRAINTYPE . AI && t . GetAIMovementState ( ) == AITrain . AI_MOVEMENT_STATE . AI_STATIC ) )
674
667
{
675
- trainPen . Color = Color . FromArgb ( 83 , 237 , 214 ) ;
668
+ trainPen . Color = car is MSTSLocomotive ? Color . FromArgb ( 19 , 185 , 160 ) : Color . FromArgb ( 83 , 237 , 214 ) ;
676
669
}
677
670
678
671
// Draw player train with loco in red
679
672
if ( t . TrainType == Train . TRAINTYPE . PLAYER && car == locoCar )
680
673
trainPen . Color = Color . Red ;
681
674
}
682
675
683
- private void DrawTrainLabels ( Graphics g , Train t , string trainName , TrainCar firstCar , PointF scaledTrain )
676
+ private void DrawTrainLabels ( Graphics g , Train t , string trainName , PointF scaledTrain )
684
677
{
685
- WorldPosition worldPos = firstCar . WorldPosition ;
678
+ /* WorldPosition worldPos = firstCar.WorldPosition;
686
679
scaledTrain.X = ((worldPos.TileX * 2048) - subX + worldPos.Location.X) * xScale;
687
- scaledTrain . Y = - 25 + mapCanvas . Height - ( ( ( worldPos . TileZ * 2048 ) - subY + worldPos . Location . Z ) * yScale ) ;
680
+ scaledTrain.Y = -25 + mapCanvas.Height - (((worldPos.TileZ * 2048) - subY + worldPos.Location.Z) * yScale);*/
688
681
if ( showActiveTrainsRadio . Checked )
689
682
{
690
683
if ( t is AITrain && MapDataProvider . IsActiveTrain ( t as AITrain ) )
0 commit comments