2626using System . IO ;
2727using System . Linq ;
2828using Microsoft . Xna . Framework ;
29+ using Orts . Simulation . Simulation . RollingStocks . SubSystems . PowerSupplies ;
30+ using static Orts . Simulation . Simulation . RollingStocks . SubSystems . PowerSupplies . SteamEngine ;
31+ using Orts . Common ;
2932
3033namespace Orts . Viewer3D . Popups
3134{
@@ -116,9 +119,14 @@ private static class Symbols
116119 [ Viewer . Catalog . GetString ( "AI Fireman" ) ] = Viewer . Catalog . GetString ( "AIFR" ) ,
117120 [ Viewer . Catalog . GetString ( "Autopilot" ) ] = Viewer . Catalog . GetString ( "AUTO" ) ,
118121 [ Viewer . Catalog . GetString ( "Battery switch" ) ] = Viewer . Catalog . GetString ( "BATT" ) ,
122+ [ Viewer . Catalog . GetString ( "Blowndown valve" ) ] = Viewer . Catalog . GetString ( "BLWV" ) ,
119123 [ Viewer . Catalog . GetString ( "Boiler pressure" ) ] = Viewer . Catalog . GetString ( "PRES" ) ,
120124 [ Viewer . Catalog . GetString ( "Boiler water glass" ) ] = Viewer . Catalog . GetString ( "WATR" ) ,
121125 [ Viewer . Catalog . GetString ( "Boiler water level" ) ] = Viewer . Catalog . GetString ( "LEVL" ) ,
126+ [ Viewer . Catalog . GetString ( "Booster air valve" ) ] = Viewer . Catalog . GetString ( "BAIR" ) ,
127+ [ Viewer . Catalog . GetString ( "Booster idle valve" ) ] = Viewer . Catalog . GetString ( "BIDL" ) ,
128+ [ Viewer . Catalog . GetString ( "Booster latch" ) ] = Viewer . Catalog . GetString ( "BLCH" ) ,
129+ [ Viewer . Catalog . GetString ( "Booster" ) ] = Viewer . Catalog . GetString ( "BOST" ) ,
122130 [ Viewer . Catalog . GetString ( "CCStatus" ) ] = Viewer . Catalog . GetString ( "CCST" ) ,
123131 [ Viewer . Catalog . GetString ( "Circuit breaker" ) ] = Viewer . Catalog . GetString ( "CIRC" ) ,
124132 [ Viewer . Catalog . GetString ( "Cylinder cocks" ) ] = Viewer . Catalog . GetString ( "CCOK" ) ,
@@ -191,6 +199,9 @@ private static class Symbols
191199 bool doorsLabelVisible = false ; // Doors label visible
192200 double clockDoorsTime ; // Doors hide timing
193201
202+ bool boosterLabelVisible = false ; // Booster label visible
203+ double clockBoosterTime ; // Booster hide timing
204+
194205 bool ResizeWindow = false ;
195206 bool UpdateDataEnded = false ;
196207 const int TextSize = 15 ;
@@ -205,6 +216,8 @@ private static class Symbols
205216 int WindowHeightMax = 0 ;
206217 int WindowWidthMin = 0 ;
207218 int WindowWidthMax = 0 ;
219+ bool BoosterLocked = false ;
220+ bool EnabledIdleValve = false ;
208221
209222 Label indicator ;
210223 LabelMono indicatorMono ;
@@ -774,6 +787,42 @@ void AddSeparator() => AddLabel(new ListLabel
774787 } ) ;
775788 }
776789
790+ // Booster engine label
791+ if ( locomotive is MSTSSteamLocomotive steamLocomotive4 )
792+ {
793+ string boosterEngineIndicator = "" , boosterEngineKey = "" ;
794+ if ( BoosterLocked )
795+ {
796+ boosterLabelVisible = true ;
797+ clockBoosterTime = Owner . Viewer . Simulator . ClockTime ;
798+
799+ boosterEngineIndicator = Viewer . Catalog . GetString ( "Engaged" ) + ColorCode [ Color . Cyan ] ;
800+ boosterEngineKey = Symbols . ArrowToRight + ColorCode [ Color . Yellow ] ;
801+ }
802+ else
803+ { // delay to hide the booster label
804+ if ( boosterLabelVisible && clockBoosterTime + 3 < Owner . Viewer . Simulator . ClockTime )
805+ boosterLabelVisible = false ;
806+
807+ if ( boosterLabelVisible )
808+ {
809+ boosterEngineIndicator = Viewer . Catalog . GetString ( "Disengaged" ) + ColorCode [ Color . Orange ] ;
810+ boosterEngineKey = "" ;
811+ BoosterLocked = false ;
812+ }
813+ }
814+ if ( boosterLabelVisible )
815+ {
816+ AddLabel ( new ListLabel
817+ {
818+ FirstCol = Viewer . Catalog . GetString ( "Booster" ) ,
819+ LastCol = boosterEngineIndicator ,
820+ KeyPressed = boosterEngineKey ,
821+ SymbolCol = ""
822+ } ) ;
823+ }
824+ }
825+
777826 // Sander
778827 if ( locomotive . GetSanderOn ( ) )
779828 {
@@ -1106,7 +1155,138 @@ void AddSeparator() => AddLabel(new ListLabel
11061155 }
11071156 }
11081157
1109- AddSeparator ( ) ;
1158+ // Blowdown valve
1159+ if ( locomotive is MSTSSteamLocomotive steamLocomotive5 )
1160+ {
1161+ string blownDownValveIndicator , blownDownValveKey ;
1162+ if ( steamLocomotive5 . BlowdownValveOpen )
1163+ {
1164+ blownDownValveIndicator = Viewer . Catalog . GetString ( "Open" ) + ColorCode [ Color . Orange ] ;
1165+ blownDownValveKey = Symbols . ArrowToRight + ColorCode [ Color . Yellow ] ;
1166+ }
1167+ else
1168+ {
1169+ blownDownValveIndicator = Viewer . Catalog . GetString ( "Closed" ) + ColorCode [ Color . White ] ;
1170+ blownDownValveKey = "" ;
1171+ }
1172+ AddLabel ( new ListLabel
1173+ {
1174+ FirstCol = Viewer . Catalog . GetString ( "Blowndown valve" ) ,
1175+ LastCol = blownDownValveIndicator ,
1176+ KeyPressed = blownDownValveKey ,
1177+ SymbolCol = ""
1178+ } ) ;
1179+ AddSeparator ( ) ;
1180+ }
1181+
1182+ // Booster air valve
1183+ if ( locomotive is MSTSSteamLocomotive )
1184+ {
1185+ MSTSSteamLocomotive steamLocomotive6 = ( MSTSSteamLocomotive ) locomotive ;
1186+ var HasBooster = false ;
1187+ if ( steamLocomotive6 != null && steamLocomotive6 . SteamEngines . Count > 0 )
1188+ {
1189+ foreach ( var engine in steamLocomotive6 . SteamEngines )
1190+ {
1191+ if ( engine . AuxiliarySteamEngineType == SteamEngine . AuxiliarySteamEngineTypes . Booster )
1192+ HasBooster = true ;
1193+ }
1194+ }
1195+ if ( HasBooster )
1196+ {
1197+ string boosterAirValveIndicator = "-" , boosterAirValveKey = "" ;
1198+ string boosterIdleValveIndicator = "-" , boosterIdleValveKey = "" ;
1199+ string boosterLatchOnIndicator = "-" , boosterLatchOnKey = "" ;
1200+ var cutOffLess65 = train . MUReverserPercent < 65.0f ;
1201+ bool moving = Math . Abs ( trainCar . SpeedMpS ) > 1 ;
1202+ var currentTrainInfo = train . GetTrainInfo ( ) ;
1203+ var trainStopping = currentTrainInfo . projectedSpeedMpS < 1 ;
1204+
1205+ // Disengages booster if speed is more than 34 km/h or cutOff less than 65%
1206+ if ( steamLocomotive6 . SteamBoosterLatchOn && ( steamLocomotive6 . SpeedMpS > 9.4444 || ( cutOffLess65 && moving ) || locomotive . Direction == Direction . Reverse ) )
1207+ {
1208+ steamLocomotive6 . ToggleSteamBoosterLatch ( ) ; // Disengages booster
1209+ }
1210+ // Engages booster if train is moving forward less than 19 km/h and cutoff value more than 65%
1211+ else if ( ! steamLocomotive6 . SteamBoosterLatchOn && ! trainStopping && steamLocomotive6 . SpeedMpS < 5.27778 && ! cutOffLess65 && moving && locomotive . Direction == Direction . Forward )
1212+ {
1213+ steamLocomotive6 . ToggleSteamBoosterLatch ( ) ; // Engages booster
1214+ }
1215+ // Disengages booster if projectedSpeedMpS < 1
1216+ else if ( steamLocomotive6 . SteamBoosterLatchOn && trainStopping )
1217+ {
1218+ steamLocomotive6 . ToggleSteamBoosterLatch ( ) ; // Disengages booster
1219+ }
1220+
1221+ // Booster warm up
1222+ if ( ! EnabledIdleValve && steamLocomotive6 . SteamBoosterAirOpen && steamLocomotive6 . BoosterIdleHeatingTimerS >= 120 && steamLocomotive6 . BoosterGearEngageTimePeriodS > 5.5 && steamLocomotive6 . BoosterGearEngageTimePeriodS < 6 )
1223+ {
1224+ EnabledIdleValve = true ;
1225+ }
1226+
1227+ // SteamBoosterAirValve Ctrl+D...close/open
1228+ if ( ! steamLocomotive6 . SteamBoosterAirOpen )
1229+ {
1230+ boosterAirValveIndicator = Viewer . Catalog . GetString ( "Closed" ) + ColorCode [ Color . White ] ;
1231+ boosterAirValveKey = "" ;
1232+ }
1233+ if ( steamLocomotive6 . SteamBoosterAirOpen )
1234+ {
1235+ // While warm up two red symbols are flashing in the Booster air valve label
1236+ var smallDiamond = ( int ) steamLocomotive6 . BoosterIdleHeatingTimerS % 2 == 0 ? $ "{ Symbols . SmallDiamond } { ColorCode [ Color . OrangeRed ] } " : $ "{ Symbols . SmallDiamond } { ColorCode [ Color . Black ] } ";
1237+ boosterAirValveIndicator = Viewer . Catalog . GetString ( "Open" ) + ColorCode [ EnabledIdleValve ? Color . Cyan : Color . Orange ] ;
1238+ boosterAirValveKey = EnabledIdleValve ? Symbols . ArrowToRight + ColorCode [ Color . Yellow ] : smallDiamond ;
1239+ }
1240+ AddLabel ( new ListLabel
1241+ {
1242+ FirstCol = Viewer . Catalog . GetString ( "Booster air valve" ) ,
1243+ LastCol = boosterAirValveIndicator ,
1244+ KeyPressed = boosterAirValveKey ,
1245+ SymbolCol = ""
1246+ } ) ;
1247+
1248+ // SteamBoosterIdleValve..Ctrl+B...idle/run
1249+ if ( ! steamLocomotive6 . SteamBoosterIdle )
1250+ {
1251+ boosterIdleValveIndicator = Viewer . Catalog . GetString ( "Idle" ) + ColorCode [ Color . White ] ;
1252+ boosterIdleValveKey = "" ;
1253+ }
1254+ if ( steamLocomotive6 . SteamBoosterIdle && EnabledIdleValve )
1255+ {
1256+ boosterIdleValveIndicator = Viewer . Catalog . GetString ( "Run" ) + ColorCode [ EnabledIdleValve ? Color . Cyan : Color . Orange ] ;
1257+ boosterIdleValveKey = Symbols . ArrowToRight + ColorCode [ Color . Yellow ] ;
1258+ }
1259+ AddLabel ( new ListLabel
1260+ {
1261+ FirstCol = Viewer . Catalog . GetString ( "Booster idle valve" ) + ColorCode [ EnabledIdleValve ? Color . White : Color . Orange ] ,
1262+ LastCol = boosterIdleValveIndicator ,
1263+ KeyPressed = boosterIdleValveKey ,
1264+ SymbolCol = ""
1265+ } ) ;
1266+
1267+ // SteamBoosterLatchOnValve..Ctrl+K...opened/locked
1268+ if ( steamLocomotive6 . SteamBoosterLatchOn && steamLocomotive6 . SteamBoosterIdle && EnabledIdleValve )
1269+ {
1270+ boosterLatchOnIndicator = Viewer . Catalog . GetString ( "Locked" ) + ColorCode [ EnabledIdleValve ? Color . Cyan : Color . Orange ] ;
1271+ boosterLatchOnKey = Symbols . ArrowToRight + ColorCode [ Color . Yellow ] ;
1272+ BoosterLocked = true ;
1273+ }
1274+ if ( ! steamLocomotive6 . SteamBoosterLatchOn )
1275+ {
1276+ boosterLatchOnIndicator = Viewer . Catalog . GetString ( "Opened" ) + ColorCode [ Color . White ] ;
1277+ boosterLatchOnKey = "" ;
1278+ BoosterLocked = false ;
1279+ }
1280+ AddLabel ( new ListLabel
1281+ {
1282+ FirstCol = Viewer . Catalog . GetString ( "Booster latch" ) + ColorCode [ EnabledIdleValve ? Color . White : Color . Orange ] ,
1283+ LastCol = boosterLatchOnIndicator ,
1284+ KeyPressed = boosterLatchOnKey ,
1285+ SymbolCol = ""
1286+ } ) ;
1287+ AddSeparator ( ) ;
1288+ }
1289+ }
11101290
11111291 // Cruise Control
11121292 if ( ( Owner . Viewer . PlayerLocomotive as MSTSLocomotive ) . CruiseControl != null )
@@ -1137,7 +1317,6 @@ void AddSeparator() => AddLabel(new ListLabel
11371317 }
11381318
11391319 // EOT
1140-
11411320 if ( locomotive . Train . EOT != null )
11421321 {
11431322 AddLabel ( new ListLabel
@@ -1149,7 +1328,6 @@ void AddSeparator() => AddLabel(new ListLabel
11491328 }
11501329
11511330 // Distributed Power
1152-
11531331 if ( locomotive is MSTSDieselLocomotive && multipleUnitsConfiguration != null )
11541332 {
11551333 AddLabel ( new ListLabel
@@ -1250,7 +1428,6 @@ void AddSeparator() => AddLabel(new ListLabel
12501428 }
12511429 }
12521430
1253-
12541431 // Wheel
12551432 if ( train . IsWheelSlip || train . IsWheelSlipWarninq || train . IsBrakeSkid )
12561433 {
@@ -1347,7 +1524,6 @@ void AddSeparator() => AddLabel(new ListLabel
13471524 LastCol = $ "{ Viewer . Catalog . GetString ( "Warning" ) } { carIDerailCoeff } " + ColorCode [ Color . Yellow ] ,
13481525 } ) ;
13491526 }
1350-
13511527 else
13521528 {
13531529 // delay to hide the derailcoeff label if normal
@@ -1364,7 +1540,6 @@ void AddSeparator() => AddLabel(new ListLabel
13641540 }
13651541 }
13661542
1367-
13681543 // Doors
13691544 var wagon = ( MSTSWagon ) locomotive ;
13701545 bool flipped = locomotive . Flipped ^ locomotive . GetCabFlipped ( ) ;
0 commit comments