Skip to content
2 changes: 1 addition & 1 deletion source/LibRender2/BaseRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ public void SetCursor(OpenTK.MouseCursor newCursor)

/// <summary>Sets the window state</summary>
/// <param name="windowState">The new window state</param>
public void SetWindowState(OpenTK.WindowState windowState)
public void SetWindowState(WindowState windowState)
{
GameWindow.WindowState = windowState;
if (windowState == WindowState.Fullscreen)
Expand Down
6 changes: 3 additions & 3 deletions source/LibRender2/Menu/AbstractMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ public void PopMenu()
}

/// <summary>Processes a scroll wheel event</summary>
/// <param name="Scroll">The delta</param>
public virtual void ProcessMouseScroll(int Scroll)
/// <param name="scrollDelta">The delta</param>
public virtual void ProcessMouseScroll(int scrollDelta)
{
if (Menus.Length == 0)
{
return;
}
// Load the current menu
Menus[CurrMenu].ProcessScroll(Scroll, visibleItems);
Menus[CurrMenu].ProcessScroll(scrollDelta, visibleItems);
}

/// <summary>Processes a mouse move event</summary>
Expand Down
978 changes: 489 additions & 489 deletions source/ObjectViewer/FunctionScripts.cs

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions source/ObjectViewer/Game/Menu.SingleMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using OpenBveApi.Textures;
using System;
using System.IO;
using OpenBveApi.Math;
using Path = OpenBveApi.Path;

namespace ObjectViewer
Expand All @@ -15,9 +14,9 @@ public sealed partial class GameMenu
/// <summary>Provides implementation for a single menu of the menu stack.</summary>
/// <remarks>The class is private to Menu, but all its fields are public to allow 'quick-and-dirty'
/// access from Menu itself.</remarks>
private class SingleMenu : MenuBase
private sealed class SingleMenu : MenuBase
{
public SingleMenu(AbstractMenu menu, MenuType menuType, int data = 0, double MaxWidth = 0) : base(menuType)
public SingleMenu(AbstractMenu menu, MenuType menuType, int data = 0, double maxWidth = 0) : base(menuType)
{
//Vector2 size;
Align = TextAlignment.TopMiddle;
Expand Down Expand Up @@ -165,7 +164,7 @@ public SingleMenu(AbstractMenu menu, MenuType menuType, int data = 0, double Max
break;
}

ComputeExtent(menuType, Game.Menu.MenuFont, MaxWidth);
ComputeExtent(menuType, Game.Menu.MenuFont, maxWidth);
Height = Items.Length * Game.Menu.lineHeight;
TopItem = 0;

Expand Down
18 changes: 9 additions & 9 deletions source/ObjectViewer/Game/Menu.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using LibRender2.Menu;
using LibRender2.Primitives;
Expand All @@ -17,8 +17,8 @@ namespace ObjectViewer
public sealed partial class GameMenu: AbstractMenu
{

internal Picturebox filePictureBox;
internal Textbox fileTextBox;
private Picturebox filePictureBox;
private Textbox fileTextBox;
private double lastTimeElapsed;
private static string SearchDirectory;
private static string currentFile;
Expand Down Expand Up @@ -266,10 +266,10 @@ public override bool ProcessMouseMove(int x, int y)
return false;
}

public override void Draw(double RealTimeElapsed)
public override void Draw(double realTimeElapsed)
{
double TimeElapsed = RealTimeElapsed - lastTimeElapsed;
lastTimeElapsed = RealTimeElapsed;
double timeElapsed = realTimeElapsed - lastTimeElapsed;
lastTimeElapsed = realTimeElapsed;
int i;

if (CurrMenu < 0 || CurrMenu >= Menus.Length)
Expand Down Expand Up @@ -358,14 +358,14 @@ public override void Draw(double RealTimeElapsed)
}

// draw the text
Renderer.OpenGlString.Draw(MenuFont, menu.Items[i].DisplayText(TimeElapsed), new Vector2(itemX, itemY),
Renderer.OpenGlString.Draw(MenuFont, menu.Items[i].DisplayText(timeElapsed), new Vector2(itemX, itemY),
menu.Align, ColourHighlight, false);
}
else if (menu.Items[i] is MenuCaption)
Renderer.OpenGlString.Draw(MenuFont, menu.Items[i].DisplayText(TimeElapsed), new Vector2(itemX, itemY),
Renderer.OpenGlString.Draw(MenuFont, menu.Items[i].DisplayText(timeElapsed), new Vector2(itemX, itemY),
menu.Align, ColourCaption, false);
else
Renderer.OpenGlString.Draw(MenuFont, menu.Items[i].DisplayText(TimeElapsed), new Vector2(itemX, itemY),
Renderer.OpenGlString.Draw(MenuFont, menu.Items[i].DisplayText(timeElapsed), new Vector2(itemX, itemY),
menu.Align, ColourNormal, false);
if (menu.Items[i] is MenuOption opt)
{
Expand Down
10 changes: 5 additions & 5 deletions source/ObjectViewer/Graphics/NewRendererS.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
Expand Down Expand Up @@ -427,11 +427,11 @@ private void RenderOverlays(double timeElapsed)
PopMatrix(MatrixMode.Modelview);
}

public NewRenderer(HostInterface CurrentHost, BaseOptions CurrentOptions, FileSystem FileSystem) : base(CurrentHost, CurrentOptions, FileSystem)
public NewRenderer(HostInterface currentHost, BaseOptions currentOptions, FileSystem fileSystem) : base(currentHost, currentOptions, fileSystem)
{
Screen.Width = CurrentOptions.WindowWidth;
Screen.Height = CurrentOptions.WindowHeight;
CameraTrackFollower = new TrackFollower(CurrentHost);
Screen.Width = currentOptions.WindowWidth;
Screen.Height = currentOptions.WindowHeight;
CameraTrackFollower = new TrackFollower(currentHost);
}
}
}
4 changes: 2 additions & 2 deletions source/ObjectViewer/InterfaceS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ internal static class Interface {

internal static readonly List<LogMessage> LogMessages = new List<LogMessage>();

internal static void AddMessage(MessageType Type, bool FileNotFound, string Text) {
LogMessages.Add(new LogMessage(Type, FileNotFound, Text));
internal static void AddMessage(MessageType messageType, bool fileNotFound, string messageText) {
LogMessages.Add(new LogMessage(messageType, fileNotFound, messageText));
}

/// <summary>The current options in use</summary>
Expand Down
6 changes: 3 additions & 3 deletions source/ObjectViewer/ObjectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ internal static class ObjectManager
internal static WorldObject[] AnimatedWorldObjects = new WorldObject[4];
internal static int AnimatedWorldObjectsUsed = 0;

internal static void UpdateAnimatedWorldObjects(double TimeElapsed, bool ForceUpdate)
internal static void UpdateAnimatedWorldObjects(double timeElapsed, bool forceUpdate)
{
for (int i = 0; i < AnimatedWorldObjectsUsed; i++)
{
AbstractTrain train = null;
bool visible = AnimatedWorldObjects[i].IsVisible(Program.Renderer.Camera.Alignment.Position, Program.CurrentRoute.CurrentBackground.BackgroundImageDistance, Program.Renderer.Camera.ExtraViewingDistance);
if (visible | ForceUpdate)
if (visible | forceUpdate)
{
train = Program.CurrentHost.ClosestTrain(AnimatedWorldObjects[i].RelativeTrackPosition);
}
AnimatedWorldObjects[i].Update(train, TimeElapsed, ForceUpdate, visible);
AnimatedWorldObjects[i].Update(train, timeElapsed, forceUpdate, visible);
}
}
}
Expand Down
23 changes: 11 additions & 12 deletions source/ObjectViewer/ProgramS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
using OpenBveApi.Hosts;
using OpenBveApi.Interface;
using OpenBveApi.Objects;
using OpenBveApi.Routes;
using OpenBveApi.Trains;
using OpenTK;
using OpenTK.Graphics;
Expand Down Expand Up @@ -237,7 +236,7 @@ internal static void MouseEvent(object sender, MouseButtonEventArgs e)
{
MouseButton = e.Mouse.RightButton == ButtonState.Pressed ? 3 : 0;
}
previousMouseState = Mouse.GetState();
PreviousMouseState = Mouse.GetState();
break;
}

Expand All @@ -256,46 +255,46 @@ internal static void DragFile(object sender, FileDropEventArgs e)
Renderer.ApplyBackgroundColor();
}

internal static MouseState currentMouseState;
internal static MouseState previousMouseState;
internal static MouseState CurrentMouseState;
internal static MouseState PreviousMouseState;

internal static void MouseMovement()
{
if (MouseButton == 0 || Program.Renderer.CurrentInterface != InterfaceType.Normal) return;
currentMouseState = Mouse.GetState();
if (currentMouseState != previousMouseState)
CurrentMouseState = Mouse.GetState();
if (CurrentMouseState != PreviousMouseState)
{
if (MouseButton == 1)
{
Renderer.Camera.AbsoluteDirection = MouseCameraDirection;
Renderer.Camera.AbsoluteUp = MouseCameraUp;
Renderer.Camera.AbsoluteSide = MouseCameraSide;
{
double dx = 0.0025 * (previousMouseState.X - currentMouseState.X);
double dx = 0.0025 * (PreviousMouseState.X - CurrentMouseState.X);
Renderer.Camera.AbsoluteDirection.Rotate(Vector3.Down, dx);
Renderer.Camera.AbsoluteUp.Rotate(Vector3.Down, dx);
Renderer.Camera.AbsoluteSide.Rotate(Vector3.Down, dx);
}
{
double dy = 0.0025 * (previousMouseState.Y - currentMouseState.Y);
double dy = 0.0025 * (PreviousMouseState.Y - CurrentMouseState.Y);
Renderer.Camera.AbsoluteDirection.Rotate(Renderer.Camera.AbsoluteSide, dy);
Renderer.Camera.AbsoluteUp.Rotate(Renderer.Camera.AbsoluteSide, dy);
}
}
else if(MouseButton == 2)
{
Renderer.Camera.AbsolutePosition = MouseCameraPosition;
double dx = -0.025 * (currentMouseState.X - previousMouseState.X);
double dx = -0.025 * (CurrentMouseState.X - PreviousMouseState.X);
Renderer.Camera.AbsolutePosition += dx * Renderer.Camera.AbsoluteSide;
double dy = 0.025 * (currentMouseState.Y - previousMouseState.Y);
double dy = 0.025 * (CurrentMouseState.Y - PreviousMouseState.Y);
Renderer.Camera.AbsolutePosition += dy * Renderer.Camera.AbsoluteUp;
}
else
{
Renderer.Camera.AbsolutePosition = MouseCameraPosition;
double dx = -0.025 * (currentMouseState.X - previousMouseState.X);
double dx = -0.025 * (CurrentMouseState.X - PreviousMouseState.X);
Renderer.Camera.AbsolutePosition += dx * Renderer.Camera.AbsoluteSide;
double dz = -0.025 * (currentMouseState.Y - previousMouseState.Y);
double dz = -0.025 * (CurrentMouseState.Y - PreviousMouseState.Y);
Renderer.Camera.AbsolutePosition += dz * Renderer.Camera.AbsoluteDirection;
}
}
Expand Down
10 changes: 5 additions & 5 deletions source/ObjectViewer/Trains/NearestTrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ private static TrainBase CreateDummyTrain()

train.Cars[i].Specs.IsMotorCar = true;
//At the minute, Object Viewer uses dummy brake systems
train.Cars[i].CarBrake.mainReservoir = new MainReservoir(Status.MainReservoirPressure * 1000.0);
train.Cars[i].CarBrake.equalizingReservoir = new EqualizingReservoir(Status.EqualizingReservoirPressure * 1000.0);
train.Cars[i].CarBrake.brakePipe = new BrakePipe(Status.BrakePipePressure * 1000.0);
train.Cars[i].CarBrake.brakeCylinder = new BrakeCylinder(Status.BrakeCylinderPressure * 1000.0);
train.Cars[i].CarBrake.straightAirPipe = new StraightAirPipe(Status.StraightAirPipePressure * 1000.0);
train.Cars[i].CarBrake.MainReservoir = new MainReservoir(Status.MainReservoirPressure * 1000.0);
train.Cars[i].CarBrake.EqualizingReservoir = new EqualizingReservoir(Status.EqualizingReservoirPressure * 1000.0);
train.Cars[i].CarBrake.BrakePipe = new BrakePipe(Status.BrakePipePressure * 1000.0);
train.Cars[i].CarBrake.BrakeCylinder = new BrakeCylinder(Status.BrakeCylinderPressure * 1000.0);
train.Cars[i].CarBrake.StraightAirPipe = new StraightAirPipe(Status.StraightAirPipePressure * 1000.0);

train.Cars[i].Coupler = new Coupler(0.9 * 0.3, 1.1 * 0.3, train.Cars[i], i < train.Cars.Length - 1 ? train.Cars[i + 1] : null, train);

Expand Down
11 changes: 5 additions & 6 deletions source/ObjectViewer/Trains/NearestTrainStatus.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Linq;
using OpenBveApi.Runtime;
using TrainManager.Car;
using TrainManager.Handles;
using TrainManager.Trains;
Expand Down Expand Up @@ -58,11 +57,11 @@ internal void Apply(TrainBase train)

if (!NearestTrain.IsExtensionsCfg)
{
car.CarBrake.mainReservoir.CurrentPressure = MainReservoirPressure * 1000.0;
car.CarBrake.equalizingReservoir.CurrentPressure = EqualizingReservoirPressure * 1000.0;
car.CarBrake.brakePipe.CurrentPressure = BrakePipePressure * 1000.0;
car.CarBrake.brakeCylinder.CurrentPressure = BrakeCylinderPressure * 1000.0;
car.CarBrake.straightAirPipe.CurrentPressure = StraightAirPipePressure * 1000.0;
car.CarBrake.MainReservoir.CurrentPressure = MainReservoirPressure * 1000.0;
car.CarBrake.EqualizingReservoir.CurrentPressure = EqualizingReservoirPressure * 1000.0;
car.CarBrake.BrakePipe.CurrentPressure = BrakePipePressure * 1000.0;
car.CarBrake.BrakeCylinder.CurrentPressure = BrakeCylinderPressure * 1000.0;
car.CarBrake.StraightAirPipe.CurrentPressure = StraightAirPipePressure * 1000.0;
}

car.Doors[0].State = LeftDoorState;
Expand Down
3 changes: 2 additions & 1 deletion source/ObjectViewer/formOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Windows.Forms;
using ObjectViewer.Graphics;
using OpenBveApi;
Expand Down Expand Up @@ -106,6 +106,7 @@ private void CloseButton_Click(object sender, EventArgs e)
Program.Renderer.SetWindowSize((int)width.Value, (int)height.Value);
Program.Renderer.UpdateViewport();
}
Program.Renderer.UpdateViewport();
}

XParsers xParser = (XParsers)comboBoxNewXParser.SelectedIndex;
Expand Down
2 changes: 1 addition & 1 deletion source/OpenBVE/Audio/Sounds.Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ protected override void UpdateInverseModel(double timeElapsed)
toBePlayed[i].Gain += clampFactor * toBePlayed[i].Distance * toBePlayed[i].Distance;
}
double desiredLogClampFactor;
int index = Math.Min(systemMaxSounds, Interface.CurrentOptions.SoundNumber);
int index = Math.Min(SystemMaxSounds, Interface.CurrentOptions.SoundNumber);
if (toBePlayed.Count <= index) {
desiredLogClampFactor = MinLogClampFactor;
} else {
Expand Down
12 changes: 6 additions & 6 deletions source/OpenBVE/Game/AI/AI.SimpleHuman.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ private void PerformDefault()
Train.Handles.Power.ApplyState(-1, true);
if (Train.Handles.Brake is AirBrakeHandle)
{
if (Train.StationDepartureTime - Program.CurrentRoute.SecondsSinceMidnight > 10 || Train.Cars[Train.DriverCar].CarBrake.brakeCylinder.CurrentPressure < 0.3 * Train.Cars[Train.DriverCar].CarBrake.brakeCylinder.ServiceMaximumPressure)
if (Train.StationDepartureTime - Program.CurrentRoute.SecondsSinceMidnight > 10 || Train.Cars[Train.DriverCar].CarBrake.BrakeCylinder.CurrentPressure < 0.3 * Train.Cars[Train.DriverCar].CarBrake.BrakeCylinder.ServiceMaximumPressure)
{
Train.Handles.Brake.ApplyState(AirBrakeHandleState.Service);
}
else if (Train.Cars[Train.DriverCar].CarBrake.brakeCylinder.CurrentPressure > 0.9 * Train.Cars[Train.DriverCar].CarBrake.brakeCylinder.EmergencyMaximumPressure)
else if (Train.Cars[Train.DriverCar].CarBrake.BrakeCylinder.CurrentPressure > 0.9 * Train.Cars[Train.DriverCar].CarBrake.BrakeCylinder.EmergencyMaximumPressure)
{
Train.Handles.Brake.ApplyState(AirBrakeHandleState.Release);
}
Expand Down Expand Up @@ -417,9 +417,9 @@ private void PerformDefault()
{
if (Train.Cars[i].Specs.IsMotorCar)
{
if (Train.Cars[Train.DriverCar].CarBrake.motorDeceleration != 0 && Train.Cars[Train.DriverCar].CarBrake.motorDeceleration < BrakeDeceleration)
if (Train.Cars[Train.DriverCar].CarBrake.MotorDeceleration != 0 && Train.Cars[Train.DriverCar].CarBrake.MotorDeceleration < BrakeDeceleration)
{
BrakeDeceleration = Train.Cars[Train.DriverCar].CarBrake.motorDeceleration;
BrakeDeceleration = Train.Cars[Train.DriverCar].CarBrake.MotorDeceleration;
}
break;
}
Expand Down Expand Up @@ -681,14 +681,14 @@ private void PerformDefault()
{
if (wiperTimer < 0)
{
if (Train.Cars[Train.DriverCar].Windscreen.currentDrops < Train.Cars[Train.DriverCar].Windscreen.RainDrops.Length / 4)
if (Train.Cars[Train.DriverCar].Windscreen.CurrentDrops < Train.Cars[Train.DriverCar].Windscreen.RainDrops.Length / 4)
{
if(Train.Cars[Train.DriverCar].Windscreen.Wipers.CurrentSpeed != WiperSpeed.Off)
{
Train.Cars[Train.DriverCar].Windscreen.Wipers.ChangeSpeed(Translations.Command.WiperSpeedDown);
}
}
else if (Train.Cars[Train.DriverCar].Windscreen.currentDrops > Train.Cars[Train.DriverCar].Windscreen.RainDrops.Length / 4 && Train.Cars[Train.DriverCar].Windscreen.currentDrops < Train.Cars[Train.DriverCar].Windscreen.RainDrops.Length / 2)
else if (Train.Cars[Train.DriverCar].Windscreen.CurrentDrops > Train.Cars[Train.DriverCar].Windscreen.RainDrops.Length / 4 && Train.Cars[Train.DriverCar].Windscreen.CurrentDrops < Train.Cars[Train.DriverCar].Windscreen.RainDrops.Length / 2)
{
switch (Train.Cars[Train.DriverCar].Windscreen.Wipers.CurrentSpeed)
{
Expand Down
6 changes: 3 additions & 3 deletions source/OpenBVE/Game/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ internal static partial class Game
internal static bool MinimalisticSimulation = false;

/// <summary>Call this function to reset the game</summary>
/// <param name="ResetLogs">Whether the logs should be reset</param>
internal static void Reset(bool ResetLogs) {
/// <param name="resetLogs">Whether the logs should be reset</param>
internal static void Reset(bool resetLogs) {
// track manager
for (int i = 0; i < Program.CurrentRoute.Tracks.Count; i++)
{
Expand Down Expand Up @@ -59,7 +59,7 @@ internal static void Reset(bool ResetLogs) {
Program.CurrentRoute.PreviousFog = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 0.0);
Program.CurrentRoute.CurrentFog = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 0.5);
Program.CurrentRoute.NextFog = new Fog(Program.CurrentRoute.NoFogStart, Program.CurrentRoute.NoFogEnd, Color24.Grey, 1.0);
if (ResetLogs) {
if (resetLogs) {
LogRouteName = "";
LogTrainName = "";
LogDateTime = DateTime.Now;
Expand Down
4 changes: 2 additions & 2 deletions source/OpenBVE/Game/Information.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ internal static partial class Game
/// <summary>The in-game menu system</summary>
internal static readonly GameMenu Menu = GameMenu.Instance;
/// <summary>The in-game overlay with route info drawings</summary>
internal static readonly RouteInfoOverlay routeInfoOverlay = new RouteInfoOverlay();
internal static readonly RouteInfoOverlay RouteInfoOverlay = new RouteInfoOverlay();

internal static readonly SwitchChangeDialog switchChangeDialog = new SwitchChangeDialog();
internal static readonly SwitchChangeDialog SwitchChangeDialog = new SwitchChangeDialog();
}
}
Loading