Skip to content

Commit

Permalink
Automatic merge of T1.5.1-791-gffaeec028 and 14 pull requests
Browse files Browse the repository at this point in the history
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder
- Pull request #882 at a055bca: Blueprint/train car operations UI window
- Pull request #885 at d9ce84b: feat: Add notifications to Menu
- Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 0a9d939: feat: Improved system information collection
- Pull request #899 at 234b167: Duplex steam engines - Booster Engine addition
- Pull request #903 at d5b3639: Downloading route content from Github
- Pull request #906 at 0e0aa8b: Bug fix for https://bugs.launchpad.net/or/+bug/2047299 Crash loading a 3Dcab-only loco
- Pull request #907 at 9b0b04f: Bug fix for https://bugs.launchpad.net/or/+bug/2047300 Dynamic tracks disappear after long tunnel
  • Loading branch information
openrails-bot committed Dec 25, 2023
Show file tree
Hide file tree
Showing 17 changed files with 2,686 additions and 1,191 deletions.
5 changes: 3 additions & 2 deletions Source/ORTS.Common/Input/UserCommand.cs
Expand Up @@ -196,8 +196,9 @@ public enum UserCommand
[GetString("Control Blower Decrease")] ControlBlowerDecrease,
[GetString("Control Steam Heat Increase")] ControlSteamHeatIncrease,
[GetString("Control Steam Heat Decrease")] ControlSteamHeatDecrease,
[GetString("Control Steam Booster Increase")] ControlSteamBoosterIncrease,
[GetString("Control Steam Booster Decrease")] ControlSteamBoosterDecrease,
[GetString("Control Steam Booster Air Valve")] ControlSteamBoosterAirValve,
[GetString("Control Steam Booster Idle Valve")] ControlSteamBoosterIdleValve,
[GetString("Control Steam Booster Latch")] ControlSteamBoosterLatch,
[GetString("Control Damper Increase")] ControlDamperIncrease,
[GetString("Control Damper Decrease")] ControlDamperDecrease,
[GetString("Control Firebox Open")] ControlFireboxOpen,
Expand Down
5 changes: 3 additions & 2 deletions Source/ORTS.Settings/InputSettings.cs
Expand Up @@ -356,8 +356,9 @@ static void InitializeCommands(UserCommandInput[] Commands)
Commands[(int)UserCommand.ControlBlowerIncrease] = new UserCommandKeyInput(0x31);
Commands[(int)UserCommand.ControlSteamHeatDecrease] = new UserCommandKeyInput(0x20, KeyModifiers.Alt);
Commands[(int)UserCommand.ControlSteamHeatIncrease] = new UserCommandKeyInput(0x16, KeyModifiers.Alt);
Commands[(int)UserCommand.ControlSteamBoosterDecrease] = new UserCommandKeyInput(0x11, KeyModifiers.Shift);
Commands[(int)UserCommand.ControlSteamBoosterIncrease] = new UserCommandKeyInput(0x11, KeyModifiers.Alt);
Commands[(int)UserCommand.ControlSteamBoosterAirValve] = new UserCommandKeyInput(0x11, KeyModifiers.Alt);
Commands[(int)UserCommand.ControlSteamBoosterIdleValve] = new UserCommandKeyInput(0x25, KeyModifiers.Alt);
Commands[(int)UserCommand.ControlSteamBoosterLatch] = new UserCommandKeyInput(0x25, KeyModifiers.Control);
Commands[(int)UserCommand.ControlBrakeHoseConnect] = new UserCommandKeyInput(0x2B);
Commands[(int)UserCommand.ControlBrakeHoseDisconnect] = new UserCommandKeyInput(0x2B, KeyModifiers.Shift);
Commands[(int)UserCommand.ControlCabRadio] = new UserCommandKeyInput(0x13, KeyModifiers.Alt);
Expand Down
4 changes: 3 additions & 1 deletion Source/Orts.Formats.Msts/CabViewFile.cs
Expand Up @@ -130,7 +130,9 @@ public enum CABViewControlTypes
DAMPERS_FRONT,
DAMPERS_BACK,
STEAM_HEAT,
STEAM_BOOSTER,
STEAM_BOOSTER_AIR,
STEAM_BOOSTER_IDLE,
STEAM_BOOSTER_LATCH,
WATER_INJECTOR1,
WATER_INJECTOR2,
SMALL_EJECTOR,
Expand Down
13 changes: 11 additions & 2 deletions Source/Orts.Formats.Msts/SoundManagmentFile.cs
Expand Up @@ -198,7 +198,7 @@ public struct CurvePoint

public class VolumeCurve
{
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable2Controlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled };
public enum Controls { None, DistanceControlled, SpeedControlled, Variable1Controlled, Variable2_1Controlled, Variable3_1Controlled, Variable4_1Controlled, Variable2Controlled, Variable3Controlled, BrakeCylControlled, CurveForceControlled };

public Controls Control = Controls.None;
public float Granularity = 1.0f;
Expand All @@ -214,6 +214,9 @@ public VolumeCurve(STFReader stf)
case "distancecontrolled": Control = Controls.DistanceControlled; break;
case "speedcontrolled": Control = Controls.SpeedControlled; break;
case "variable1controlled": Control = Controls.Variable1Controlled; break;
case "variable2_1controlled": Control = Controls.Variable2_1Controlled; break;
case "variable3_1controlled": Control = Controls.Variable3_1Controlled; break;
case "variable4_1controlled": Control = Controls.Variable4_1Controlled; break;
case "variable2controlled": Control = Controls.Variable2Controlled; break;
case "variable3controlled": Control = Controls.Variable3Controlled; break;
case "brakecylcontrolled": Control = Controls.BrakeCylControlled; break;
Expand Down Expand Up @@ -339,7 +342,7 @@ public Discrete_Trigger(STFReader f)
public class Variable_Trigger : Trigger
{
public enum Events { Speed_Inc_Past, Speed_Dec_Past, Distance_Inc_Past, Distance_Dec_Past,
Variable1_Inc_Past, Variable1_Dec_Past, Variable2_Inc_Past, Variable2_Dec_Past, Variable3_Inc_Past, Variable3_Dec_Past, BrakeCyl_Inc_Past, BrakeCyl_Dec_Past, CurveForce_Inc_Past, CurveForce_Dec_Past
Variable1_Inc_Past, Variable2_1_Inc_Past, Variable3_1_Inc_Past, Variable4_1_Inc_Past, Variable1_Dec_Past, Variable2_1_Dec_Past, Variable3_1_Dec_Past, Variable4_1_Dec_Past, Variable2_Inc_Past, Variable2_Dec_Past, Variable3_Inc_Past, Variable3_Dec_Past, BrakeCyl_Inc_Past, BrakeCyl_Dec_Past, CurveForce_Inc_Past, CurveForce_Dec_Past
};

public Events Event;
Expand Down Expand Up @@ -370,7 +373,13 @@ public Variable_Trigger(STFReader f)
break;
}
case "variable1_inc_past": Event = Events.Variable1_Inc_Past; break;
case "variable2_1_inc_past": Event = Events.Variable2_1_Inc_Past; break;
case "variable3_1_inc_past": Event = Events.Variable3_1_Inc_Past; break;
case "variable4_1_inc_past": Event = Events.Variable4_1_Inc_Past; break;
case "variable1_dec_past": Event = Events.Variable1_Dec_Past; break;
case "variable2_1_dec_past": Event = Events.Variable2_1_Dec_Past; break;
case "variable3_1_dec_past": Event = Events.Variable3_1_Dec_Past; break;
case "variable4_1_dec_past": Event = Events.Variable4_1_Dec_Past; break;
case "variable2_inc_past": Event = Events.Variable2_Inc_Past; break;
case "variable2_dec_past": Event = Events.Variable2_Dec_Past; break;
case "variable3_inc_past": Event = Events.Variable3_Inc_Past; break;
Expand Down
51 changes: 47 additions & 4 deletions Source/Orts.Simulation/Common/Commands.cs
Expand Up @@ -1599,21 +1599,64 @@ public override void Redo()
// Steam controls

// Steam booster command

[Serializable()]
public sealed class ContinuousSteamBoosterCommand : ContinuousCommand
public sealed class ToggleSteamBoosterAirCommand : Command
{
public static MSTSSteamLocomotive Receiver { get; set; }

public ContinuousSteamBoosterCommand(CommandLog log, int injector, bool toState, float? target, double startTime)
: base(log, toState, target, startTime)
public ToggleSteamBoosterAirCommand(CommandLog log)
: base(log)
{
Redo();
}

public override void Redo()
{
if (Receiver == null) return;
Receiver.ToggleSteamBoosterAir();
// Report();
}
}

// Steam Booster Idle Valve

[Serializable()]
public sealed class ToggleSteamBoosterIdleCommand : Command
{
public static MSTSSteamLocomotive Receiver { get; set; }

public ToggleSteamBoosterIdleCommand(CommandLog log)
: base(log)
{
Redo();
}

public override void Redo()
{
if (Receiver == null) return;
Receiver.ToggleSteamBoosterIdle();
// Report();
}
}

// Steam Booster Latch

[Serializable()]
public sealed class ToggleSteamBoosterLatchCommand : Command
{
public static MSTSSteamLocomotive Receiver { get; set; }

public ToggleSteamBoosterLatchCommand(CommandLog log)
: base(log)
{
Redo();
}

public override void Redo()
{
if (Receiver == null) return;
Receiver.SteamBoosterChangeTo(ToState, Target);
Receiver.ToggleSteamBoosterLatch();
// Report();
}
}
Expand Down
8 changes: 6 additions & 2 deletions Source/Orts.Simulation/Simulation/Confirmer.cs
Expand Up @@ -66,7 +66,9 @@ public enum CabControl {
, FiringIsManual
, FireShovelfull
, CylinderCocks
, SteamBooster
, SteamBoosterAir
, SteamBoosterIdle
, SteamBoosterLatch
, CylinderCompound
, LargeEjector
, SmallEjector
Expand Down Expand Up @@ -217,7 +219,9 @@ public Confirmer(Simulator simulator, double defaultDurationS)
, new string [] { GetString("Manual Firing"), GetString("off"), null, GetString("on") }
, new string [] { GetString("Fire"), null, null, GetString("add shovel-full") }
, new string [] { GetString("Cylinder Cocks"), GetString("close"), null, GetString("open") }
, new string [] { GetString("SteamBooster"), null, null, null, GetString("decrease"), GetString("increase") }
, new string [] { GetString("Steam Booster Air Valve"), GetString("close"), null, GetString("open") }
, new string [] { GetString("Steam Booster Idle Valve"), GetString("idle"), null, GetString("run") }
, new string [] { GetString("Steam Booster Latch"), GetString("opened"), null, GetString("locked") }
, new string [] { GetString("Cylinder Compound"), GetString("close"), null, GetString("open") }
, new string [] { GetString("LargeEjector"), null, null, null, GetString("decrease"), GetString("increase") }
, new string [] { GetString("SmallEjector"), null, null, null, GetString("decrease"), GetString("increase") }
Expand Down
Expand Up @@ -760,7 +760,7 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
DieselEngines.HandleEvent(PowerSupplyEvent.StopEngine);
}

ApplyDirectionToTractiveForce();
ApplyDirectionToTractiveForce(ref TractiveForceN);

// Calculate the total tractive force for the locomotive - ie Traction + Dynamic Braking force.
// Note typically only one of the above will only ever be non-zero at the one time.
Expand Down
Expand Up @@ -2011,7 +2011,10 @@ public override void Update(float elapsedClockSeconds)
}

// TODO this is a wild simplification for electric and diesel electric
if (EngineType == EngineTypes.Diesel || EngineType == EngineTypes.Electric)
{
UpdateTractiveForce(elapsedClockSeconds, ThrottlePercent / 100f, AbsSpeedMpS, AbsWheelSpeedMpS);
}

foreach (MultiPositionController mpc in MultiPositionControllers)
{
Expand Down Expand Up @@ -2398,7 +2401,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds, float t, f
AverageForceN = w * AverageForceN + (1 - w) * TractiveForceN;
}

ApplyDirectionToTractiveForce();
ApplyDirectionToTractiveForce(ref TractiveForceN);

// Calculate the total tractive force for the locomotive - ie Traction + Dynamic Braking force.
// Note typically only one of the above will only ever be non-zero at the one time.
Expand Down Expand Up @@ -2453,21 +2456,21 @@ protected virtual void UpdateAxleDriveForce()
/// <summary>
/// This function applies a sign to the motive force as a function of the direction of the train.
/// </summary>
protected virtual void ApplyDirectionToTractiveForce()
protected virtual void ApplyDirectionToTractiveForce(ref float tractiveForceN)
{
if (Train.IsPlayerDriven)
{
switch (Direction)
{
case Direction.Forward:
//MotiveForceN *= 1; //Not necessary
//tractiveForceN *= 1; //Not necessary
break;
case Direction.Reverse:
TractiveForceN *= -1;
tractiveForceN *= -1;
break;
case Direction.N:
default:
TractiveForceN *= 0;
tractiveForceN *= 0;
break;
}
}
Expand All @@ -2476,7 +2479,7 @@ protected virtual void ApplyDirectionToTractiveForce()
switch (Direction)
{
case Direction.Reverse:
TractiveForceN *= -1;
tractiveForceN *= -1;
break;
default:
break;
Expand Down

0 comments on commit b909926

Please sign in to comment.