Skip to content

Commit 09480a3

Browse files
committed
Automatic merge of T1.5.1-976-g502cbbef0 and 15 pull requests
- Pull request #799 at dfc715e: Consolidated wind simulation - 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 b3f83ed: Blueprint/train car operations UI window - Pull request #891 at 9a1d6b2: Auto save - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #900 at c27f32d: DMI updates - Pull request #903 at 3e390b8: Downloading route content (Github, zip) - Pull request #912 at cda1d74: New Triple Valve Features Vol. 2 - Pull request #922 at abe2e52: Autopilot for timetable mode - Pull request #943 at fb1f454: Dynamic Brakes Behavior & Display Improvements - Pull request #945 at f5872fd: Display tractive force instead of compensated out force - Pull request #946 at 47fcd1c: Advanced track sounds - Pull request #948 at a687981: Fix Cycling Lights
17 parents 1060ba4 + 502cbbe + dfc715e + d00beb9 + f92de76 + b3f83ed + 9a1d6b2 + 1f5ba4c + 5866028 + c27f32d + 3e390b8 + cda1d74 + abe2e52 + fb1f454 + f5872fd + 47fcd1c + a687981 commit 09480a3

File tree

7 files changed

+8
-303
lines changed

7 files changed

+8
-303
lines changed

Source/Documentation/Manual/driving.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,8 @@ printable version of the command set as described in paragraph
8181
immediately get the scrollable F1 Information Window as shown and
8282
described :ref:`below <driving-help>`.
8383

84-
Alternatively, you can operate the cabview controls by left mouse click
85-
(buttons) and left mouse button drag (levers and rotary switches). For 2D cabs
86-
instead of dragging you can also use the mouse scroll wheel.
87-
The Display Control Rectangle command ``<Ctrl+F5>`` shows the rectangles in which
88-
a control is mouse sensitive.
84+
Alternatively, you can operate the cabview controls by mouse click
85+
(buttons) and mouse drag (levers and rotary switches).
8986

9087
Throttle Control
9188
----------------

Source/ORTS.Common/Input/UserCommand.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
1-
// COPYRIGHT 2024 by the Open Rails project.
2-
//
3-
// This file is part of Open Rails.
4-
//
5-
// Open Rails is free software: you can redistribute it and/or modify
6-
// it under the terms of the GNU General Public License as published by
7-
// the Free Software Foundation, either version 3 of the License, or
8-
// (at your option) any later version.
9-
//
10-
// Open Rails is distributed in the hope that it will be useful,
11-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
// GNU General Public License for more details.
14-
//
15-
// You should have received a copy of the GNU General Public License
16-
// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
17-
//
18-
19-
namespace ORTS.Common.Input
1+
namespace ORTS.Common.Input
202
{
213
/// <summary>
224
/// Specifies game commands.
@@ -68,7 +50,6 @@ public enum UserCommand
6850
[GetString("Display Compass Window")] DisplayCompassWindow,
6951
[GetString("Display Train List Window")] DisplayTrainListWindow,
7052
[GetString("Display EOT List Window")] DisplayEOTListWindow,
71-
[GetString("Display Control Rectangles")] DisplayControlRectangle,
7253

7354
[GetString("Debug Speed Up")] DebugSpeedUp,
7455
[GetString("Debug Speed Down")] DebugSpeedDown,

Source/ORTS.Settings/InputSettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ static void InitializeCommands(UserCommandInput[] Commands)
516516
Commands[(int)UserCommand.DisplayTrainOperationsWindow] = new UserCommandKeyInput(0x43);
517517
Commands[(int)UserCommand.DisplayTrainDpuWindow] = new UserCommandKeyInput(0x43, KeyModifiers.Shift);
518518
Commands[(int)UserCommand.DisplayEOTListWindow] = new UserCommandKeyInput(0x43, KeyModifiers.Control);
519-
Commands[(int)UserCommand.DisplayControlRectangle] = new UserCommandKeyInput(0x3F, KeyModifiers.Control);
520519

521520
Commands[(int)UserCommand.GameAutopilotMode] = new UserCommandKeyInput(0x1E, KeyModifiers.Alt);
522521
Commands[(int)UserCommand.GameChangeCab] = new UserCommandKeyInput(0x12, KeyModifiers.Control);

Source/RunActivity/Viewer3D/Popups/ControlRectangle.cs

Lines changed: 0 additions & 140 deletions
This file was deleted.

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 2 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ public class MSTSLocomotiveViewer : MSTSWagonViewer
5959
public bool lemergencybuttonpressed = false;
6060
CruiseControlViewer CruiseControlViewer;
6161

62-
public Dictionary<CABViewControlTypes, UserCommand[]> UserCommandControlTypes = new Dictionary<CABViewControlTypes, UserCommand[]>();
63-
64-
private bool IsMouseWheelChanged;
65-
private DateTime MouseWheelChangedTime;
66-
private int MouseWheelClicks;
67-
private UserCommand MouseWheelCommand;
68-
6962
public MSTSLocomotiveViewer(Viewer viewer, MSTSLocomotive car)
7063
: base(viewer, car)
7164
{
@@ -149,34 +142,19 @@ public override void InitializeUserInputCommands()
149142
// Steam locomotives handle these differently, and might have set them already
150143
if (!UserInputCommands.ContainsKey(UserCommand.ControlForwards))
151144
UserInputCommands.Add(UserCommand.ControlForwards, new Action[] { Noop, () => ReverserControlForwards() });
152-
153145
if (!UserInputCommands.ContainsKey(UserCommand.ControlBackwards))
154-
{
155146
UserInputCommands.Add(UserCommand.ControlBackwards, new Action[] { Noop, () => ReverserControlBackwards() });
156-
UserCommandControlTypes.Add(CABViewControlTypes.DIRECTION, new UserCommand[] { UserCommand.ControlForwards, UserCommand.ControlBackwards });
157-
}
158147

159148
UserInputCommands.Add(UserCommand.ControlThrottleIncrease, new Action[] { () => Locomotive.StopThrottleIncrease(), () => Locomotive.StartThrottleIncrease() });
160149
UserInputCommands.Add(UserCommand.ControlThrottleDecrease, new Action[] { () => Locomotive.StopThrottleDecrease(), () => Locomotive.StartThrottleDecrease() });
161-
UserCommandControlTypes.Add(CABViewControlTypes.THROTTLE, new UserCommand[] { UserCommand.ControlThrottleIncrease, UserCommand.ControlThrottleDecrease});
162-
UserCommandControlTypes.Add(CABViewControlTypes.CP_HANDLE, new UserCommand[] { UserCommand.ControlThrottleIncrease, UserCommand.ControlThrottleDecrease });
163-
164150
UserInputCommands.Add(UserCommand.ControlThrottleZero, new Action[] { Noop, () => Locomotive.ThrottleToZero() });
165-
166151
UserInputCommands.Add(UserCommand.ControlGearUp, new Action[] { () => StopGearBoxIncrease(), () => StartGearBoxIncrease() });
167152
UserInputCommands.Add(UserCommand.ControlGearDown, new Action[] { () => StopGearBoxDecrease(), () => StartGearBoxDecrease() });
168-
UserCommandControlTypes.Add(CABViewControlTypes.GEARS, new UserCommand[] { UserCommand.ControlGearUp, UserCommand.ControlGearDown });
169-
170153
UserInputCommands.Add(UserCommand.ControlTrainBrakeIncrease, new Action[] { () => Locomotive.StopTrainBrakeIncrease(), () => Locomotive.StartTrainBrakeIncrease(null) });
171154
UserInputCommands.Add(UserCommand.ControlTrainBrakeDecrease, new Action[] { () => Locomotive.StopTrainBrakeDecrease(), () => Locomotive.StartTrainBrakeDecrease(null) });
172-
UserCommandControlTypes.Add(CABViewControlTypes.TRAIN_BRAKE, new UserCommand[] { UserCommand.ControlTrainBrakeIncrease, UserCommand.ControlTrainBrakeDecrease});
173-
174155
UserInputCommands.Add(UserCommand.ControlTrainBrakeZero, new Action[] { Noop, () => Locomotive.StartTrainBrakeDecrease(0, true) });
175-
176156
UserInputCommands.Add(UserCommand.ControlEngineBrakeIncrease, new Action[] { () => Locomotive.StopEngineBrakeIncrease(), () => Locomotive.StartEngineBrakeIncrease(null) });
177157
UserInputCommands.Add(UserCommand.ControlEngineBrakeDecrease, new Action[] { () => Locomotive.StopEngineBrakeDecrease(), () => Locomotive.StartEngineBrakeDecrease(null) });
178-
UserCommandControlTypes.Add(CABViewControlTypes.ENGINE_BRAKE, new UserCommand[] { UserCommand.ControlEngineBrakeIncrease, UserCommand.ControlEngineBrakeDecrease });
179-
180158
UserInputCommands.Add(UserCommand.ControlBrakemanBrakeIncrease, new Action[] { () => Locomotive.StopBrakemanBrakeIncrease(), () => Locomotive.StartBrakemanBrakeIncrease(null) });
181159
UserInputCommands.Add(UserCommand.ControlBrakemanBrakeDecrease, new Action[] { () => Locomotive.StopBrakemanBrakeDecrease(), () => Locomotive.StartBrakemanBrakeDecrease(null) });
182160
UserInputCommands.Add(UserCommand.ControlDynamicBrakeIncrease, new Action[] { () => Locomotive.StopDynamicBrakeIncrease(), () => Locomotive.StartDynamicBrakeIncrease(null) });
@@ -335,7 +313,7 @@ public override void HandleUserInput(ElapsedTime elapsedTime)
335313

336314
foreach (var command in UserInputCommands.Keys)
337315
{
338-
if (UserInput.IsPressed(command) || IsMouseWheelRotated(command))
316+
if (UserInput.IsPressed(command))
339317
{
340318
UserInputCommands[command][1]();
341319
//Debrief eval
@@ -354,59 +332,7 @@ public override void HandleUserInput(ElapsedTime elapsedTime)
354332
//Debrief eval
355333
if (lemergencybuttonpressed && !Locomotive.EmergencyButtonPressed) lemergencybuttonpressed = false;
356334
}
357-
else if (IsMouseWheelChanged && (DateTime.Now.Subtract(MouseWheelChangedTime).TotalMilliseconds > (500 * MouseWheelClicks)) && (command == MouseWheelCommand))
358-
{
359-
UserInputCommands[command][0]();
360-
//Debrief eval
361-
if (lemergencybuttonpressed && !Locomotive.EmergencyButtonPressed) lemergencybuttonpressed = false;
362-
IsMouseWheelChanged = false;
363-
}
364-
}
365-
}
366-
367-
bool IsMouseWheelRotated(UserCommand command)
368-
{
369-
if (UserInput.IsMouseWheelChanged)
370-
{
371-
if (Viewer.Camera is CabCamera && (this as MSTSLocomotiveViewer)._hasCabRenderer)
372-
{
373-
var cabRenderer = (this as MSTSLocomotiveViewer)._CabRenderer;
374-
foreach (var controlRenderer in cabRenderer.ControlMap.Values)
375-
{
376-
if ((Viewer.Camera as CabCamera).SideLocation == controlRenderer.Control.CabViewpoint && controlRenderer is ICabViewMouseControlRenderer mouseRenderer)
377-
{
378-
if (mouseRenderer.IsMouseWithin())
379-
{
380-
UserCommand [] userCommands;
381-
UserCommandControlTypes.TryGetValue(controlRenderer.Control.ControlType.Type, out userCommands);
382-
if (userCommands != null)
383-
{
384-
// check if user command (e.g. ControlThrottleIncrease) equals control type (e.g. THROTTLE)
385-
if (((command == userCommands[0]) && (UserInput.MouseWheelChange > 0)) ||
386-
((command == userCommands[1]) && (UserInput.MouseWheelChange < 0)))
387-
{
388-
if (!IsMouseWheelChanged)
389-
{
390-
IsMouseWheelChanged = true;
391-
MouseWheelChangedTime = DateTime.Now;
392-
MouseWheelClicks = 1;
393-
MouseWheelCommand = command;
394-
}
395-
else
396-
{
397-
MouseWheelClicks += 1;
398-
}
399-
return true;
400-
}
401-
}
402-
break;
403-
}
404-
}
405-
}
406-
}
407335
}
408-
409-
return false;
410336
}
411337

412338
/// <summary>
@@ -1773,8 +1699,6 @@ public interface ICabViewMouseControlRenderer
17731699
void HandleUserInput();
17741700
string GetControlName();
17751701
string ControlLabel { get; }
1776-
Rectangle DestinationRectangleGet();
1777-
bool isMouseControl();
17781702
}
17791703

17801704
/// <summary>
@@ -2110,24 +2034,11 @@ public CabViewDiscreteRenderer(Viewer viewer, MSTSLocomotive locomotive, CVCWith
21102034
ChangedValue = (value) =>
21112035
{
21122036
IntermediateValue %= 0.5f;
2113-
if (UserInput.IsMouseLeftButtonDown)
2114-
{
21152037
IntermediateValue += NormalizedMouseMovement();
2116-
}
2117-
else
2118-
{
2119-
// mousewheel
2120-
IntermediateValue += (float)UserInput.MouseWheelChange / 700;
2121-
}
21222038
return IntermediateValue > 0.5f ? 1 : IntermediateValue < -0.5f ? -1 : 0;
21232039
};
21242040
break;
2125-
default:
2126-
ChangedValue = (value) =>
2127-
{
2128-
return value + NormalizedMouseMovement();
2129-
};
2130-
break;
2041+
default: ChangedValue = (value) => value + NormalizedMouseMovement(); break;
21312042
}
21322043
// Determine the cab view control index shown when combined control is at the split position
21332044
// Find the index of the next value LARGER than the split value
@@ -2422,22 +2333,11 @@ public virtual int GetDrawIndex()
24222333
/// </summary>
24232334
float NormalizedMouseMovement()
24242335
{
2425-
if (UserInput.IsMouseLeftButtonDown)
2426-
{
24272336
return (ControlDiscrete.Orientation > 0
24282337
? (float)UserInput.MouseMoveY / (float)Control.Height
24292338
: (float)UserInput.MouseMoveX / (float)Control.Width)
24302339
* (ControlDiscrete.Direction > 0 ? -1 : 1);
24312340
}
2432-
else
2433-
{
2434-
// mousewheel
2435-
return (ControlDiscrete.Orientation > 0
2436-
? (float)UserInput.MouseWheelChange / (float)1500
2437-
: (float)UserInput.MouseWheelChange / (float)1500)
2438-
* (ControlDiscrete.Direction > 0 ? -1 : 1);
2439-
}
2440-
}
24412341

24422342
public bool IsMouseWithin()
24432343
{
@@ -2955,16 +2855,6 @@ protected int PercentToIndex(float percent)
29552855

29562856
return index;
29572857
}
2958-
2959-
public Rectangle DestinationRectangleGet()
2960-
{
2961-
return DestinationRectangle;
2962-
}
2963-
2964-
public bool isMouseControl()
2965-
{
2966-
return ControlDiscrete.MouseControl;
2967-
}
29682858
}
29692859

29702860
/// <summary>

0 commit comments

Comments
 (0)