Skip to content

Commit 3be6354

Browse files
committed
Merge branch 'master' into Multiple-screens-official and resolve conflicts
2 parents 97fed6b + 6a56c0d commit 3be6354

File tree

18 files changed

+213
-31
lines changed

18 files changed

+213
-31
lines changed

Source/Documentation/Manual/cabs.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,36 @@ and the mirrors.
534534
The control blocks are like the one shown for the cab light. The Type strings
535535
are ORTS_LEFTDOOR, ORTS_RIGHTDOOR and ORTS_MIRRORS.
536536

537+
.. _cabs-generic-items:
538+
539+
Cab controls for generic items
540+
------------------------------
541+
542+
OR supports the cabview controls for two generic two-state items.
543+
The cabview controls aree called ``<ORTS_GENERIC_ITEM1>`` and
544+
``<ORTS_GENERIC_ITEM2>``. Their state can be toggled also by respectively
545+
clicking keys ``<Shift+.>`` and ``<Shift+,>``.
546+
547+
Sound events are associated, that is::
548+
549+
240: GenericItem1On
550+
241: GenericItem1Off
551+
242: GenericItem2On
552+
243: GenericItem2Off
553+
554+
Animations within the .s file of the locomotive, either stopped/moving or
555+
two-state can be associated to the item state. Linked stopped/moving (wiper type)
556+
animations are named ``<ORTSITEM1CONTINUOUS>`` and ``<ORTSITEM2CONTINUOUS>``.
557+
Linked two-state animations (doors type) are named ``<ORTSITEM1TWOSTATE>`` and
558+
``<ORTSITEM2TWOSTATE>``.
559+
The default animation speed for stopped/moving type animations is 8 FPS.
560+
It may be modified with following parameter in the .sd file::
561+
562+
ESD_CustomAnimationSpeed ( 8 )
563+
564+
Examples of use are fan control, open/close of aerodynamic coverages of couplers
565+
in high speed trains, menu pages switching.
566+
537567

538568
High-resolution Cab Backgrounds and Controls
539569
--------------------------------------------

Source/Documentation/Manual/sound.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,18 @@ Trigger Function
391391
235 AirConditioningOff
392392
========= =====================================
393393

394+
Triggers from 240 to 243 associated to the two generic items
395+
(see :ref:`here <cabs-generic-items>`) :
396+
397+
========= =====================================
398+
Trigger Function
399+
========= =====================================
400+
240 GenericItem1On
401+
241 GenericItem1Off
402+
242 GenericItem2On
403+
243 GenericItem2Off
404+
========= =====================================
405+
394406
Variable Triggers
395407
-----------------
396408

Source/Documentation/Manual/timetable.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,9 @@ Special Rows
303303
will read that path. If not, it will read the 'normal' path, and will then
304304
store this as binary for future use. Binary paths are stored in a subdirectory
305305
named ``OpenRails`` which must be created in the Paths directory of the route.
306-
307-
**Important:**
308306

309-
- If a path is edited, the binary version must be deleted manually, otherwise the program will still use this older version.
310-
- If a route is edited, such that the .tdb might have been changed, all binary paths must be deleted.
307+
Note: If a path or the route is edited, then the binary data will be out of date.
308+
If so, it is deleted and re-created automatically when the user starts the route.
311309

312310
- ``#consist`` row
313311

Source/ORTS.Common/Input/UserCommand.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,10 @@ public enum UserCommand
205205
[GetString("Control ImmediateRefill")] ControlImmediateRefill,
206206
[GetString("Control Turntable Clockwise")] ControlTurntableClockwise,
207207
[GetString("Control Turntable Counterclockwise")] ControlTurntableCounterclockwise,
208-
[GetString("Control Generic 1")] ControlGeneric1,
209-
[GetString("Control Generic 2")] ControlGeneric2,
208+
[GetString("Control Generic Item 1")] ControlGenericItem1,
209+
[GetString("Control Generic Item 2")] ControlGenericItem2,
210+
[GetString("Control TCS Generic 1")] ControlTCSGeneric1,
211+
[GetString("Control TCS Generic 2")] ControlTCSGeneric2,
210212
[GetString("Control Cab Radio")] ControlCabRadio,
211213
[GetString("Control AI Fire On")] ControlAIFireOn,
212214
[GetString("Control AI Fire Off")] ControlAIFireOff,

Source/ORTS.Settings/InputSettings.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,10 @@ static void InitializeCommands(UserCommandInput[] Commands)
388388
Commands[(int)UserCommand.ControlForwards] = new UserCommandKeyInput(0x11);
389389
Commands[(int)UserCommand.ControlGearDown] = new UserCommandKeyInput(0x12, KeyModifiers.Shift);
390390
Commands[(int)UserCommand.ControlGearUp] = new UserCommandKeyInput(0x12);
391-
Commands[(int)UserCommand.ControlGeneric1] = new UserCommandKeyInput(0x33, KeyModifiers.Control);
392-
Commands[(int)UserCommand.ControlGeneric2] = new UserCommandKeyInput(0x34, KeyModifiers.Control);
391+
Commands[(int)UserCommand.ControlGenericItem1] = new UserCommandKeyInput(0x33, KeyModifiers.Shift);
392+
Commands[(int)UserCommand.ControlGenericItem2] = new UserCommandKeyInput(0x34, KeyModifiers.Shift);
393+
Commands[(int)UserCommand.ControlTCSGeneric1] = new UserCommandKeyInput(0x33, KeyModifiers.Control);
394+
Commands[(int)UserCommand.ControlTCSGeneric2] = new UserCommandKeyInput(0x34, KeyModifiers.Control);
393395
Commands[(int)UserCommand.ControlHandbrakeFull] = new UserCommandKeyInput(0x28, KeyModifiers.Shift);
394396
Commands[(int)UserCommand.ControlHandbrakeNone] = new UserCommandKeyInput(0x27, KeyModifiers.Shift);
395397
Commands[(int)UserCommand.ControlHeadlightDecrease] = new UserCommandKeyInput(0x23, KeyModifiers.Shift);

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ public enum CABViewControlTypes
202202
ORTS_ELECTRIC_TRAIN_SUPPLY_COMMAND_SWITCH,
203203
ORTS_ELECTRIC_TRAIN_SUPPLY_ON,
204204
ORTS_2DEXTERNALWIPERS,
205+
ORTS_GENERIC_ITEM1,
206+
ORTS_GENERIC_ITEM2,
205207
ORTS_SCREEN_SELECT,
206208
ORTS_STATIC_DISPLAY,
207209

Source/Orts.Formats.Msts/ShapeDescriptorFile.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public SDShape(STFReader stf)
6464
ESD_Bounding_Box = null;
6565
}),
6666
new STFReader.TokenProcessor("esd_ortssoundfilename", ()=>{ ESD_SoundFileName = stf.ReadStringBlock(null); }),
67-
new STFReader.TokenProcessor("esd_ortsbellanimationfps", ()=>{ ESD_BellAnimationFPS = stf.ReadFloatBlock(STFReader.UNITS.Frequency, null); }),
67+
new STFReader.TokenProcessor("esd_ortsbellanimationfps", ()=>{ ESD_CustomAnimationFPS = stf.ReadFloatBlock(STFReader.UNITS.Frequency, null); }),
68+
new STFReader.TokenProcessor("esd_ortscustomanimationfps", ()=>{ ESD_CustomAnimationFPS = stf.ReadFloatBlock(STFReader.UNITS.Frequency, null); }),
6869
});
6970
// TODO - some objects have no bounding box - ie JP2BillboardTree1.sd
7071
//if (ESD_Bounding_Box == null) throw new STFException(stf, "Missing ESD_Bound_Box statement");
@@ -76,7 +77,7 @@ public SDShape(STFReader stf)
7677
public bool ESD_Snapable;
7778
public bool ESD_SubObj;
7879
public string ESD_SoundFileName = "";
79-
public float ESD_BellAnimationFPS = 8;
80+
public float ESD_CustomAnimationFPS = 8;
8081
}
8182

8283
public class ESD_Bounding_Box

Source/Orts.Formats.Msts/TrackDatabaseFile.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public class TrackDatabaseFile
3939
/// </summary>
4040
public TrackDB TrackDB { get; set; }
4141

42+
/// <summary>
43+
/// The .tdb file last modified time is stored for being able to validate derived files such as binary paths.
44+
/// </summary>
45+
public DateTime LastWriteTime { get; }
46+
4247
/// <summary>
4348
/// Constructor from file
4449
/// </summary>
@@ -49,6 +54,8 @@ public TrackDatabaseFile(string filenamewithpath)
4954
stf.ParseFile(new STFReader.TokenProcessor[] {
5055
new STFReader.TokenProcessor("trackdb", ()=>{ TrackDB = new TrackDB(stf); }),
5156
});
57+
58+
LastWriteTime = File.GetLastWriteTime(filenamewithpath);
5259
}
5360

5461
/// <summary>

Source/Orts.Simulation/Common/Commands.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,4 +1999,47 @@ public override string ToString()
19991999
}
20002000
}
20012001

2002+
[Serializable()]
2003+
public sealed class ToggleGenericItem1Command : Command
2004+
{
2005+
public static MSTSLocomotive Receiver { get; set; }
2006+
2007+
public ToggleGenericItem1Command(CommandLog log)
2008+
: base(log)
2009+
{
2010+
Redo();
2011+
}
2012+
2013+
public override void Redo()
2014+
{
2015+
Receiver.GenericItem1Toggle();
2016+
}
2017+
2018+
public override string ToString()
2019+
{
2020+
return base.ToString();
2021+
}
2022+
}
2023+
2024+
[Serializable()]
2025+
public sealed class ToggleGenericItem2Command : Command
2026+
{
2027+
public static MSTSLocomotive Receiver { get; set; }
2028+
2029+
public ToggleGenericItem2Command(CommandLog log)
2030+
: base(log)
2031+
{
2032+
Redo();
2033+
}
2034+
2035+
public override void Redo()
2036+
{
2037+
Receiver.GenericItem2Toggle();
2038+
}
2039+
2040+
public override string ToString()
2041+
{
2042+
return base.ToString();
2043+
}
2044+
}
20022045
}

Source/Orts.Simulation/Common/Events.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ public enum Event
9292
GenericEvent6,
9393
GenericEvent7,
9494
GenericEvent8,
95+
GenericItem1On,
96+
GenericItem1Off,
97+
GenericItem2On,
98+
GenericItem2Off,
9599
HornOff,
96100
HornOn,
97101
LightSwitchToggle,
@@ -500,6 +504,11 @@ public static Event From(bool mstsBinEnabled, Source source, int eventID)
500504
case 234: return Event.AirConditioningOn;
501505
case 235: return Event.AirConditioningOff;
502506

507+
case 240: return Event.GenericItem1On;
508+
case 241: return Event.GenericItem1Off;
509+
case 242: return Event.GenericItem2On;
510+
case 243: return Event.GenericItem2Off;
511+
503512
case 250: return Event.OverchargeBrakingOn;
504513
case 251: return Event.OverchargeBrakingOff;
505514

0 commit comments

Comments
 (0)