diff --git a/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs b/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs index 6459b5a9d0..e290373968 100644 --- a/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs +++ b/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs @@ -52,6 +52,7 @@ namespace BizHawk.Client.Common syncSettings.Player2Present = input[i++] is not 0; syncSettings.Player3Present = input[i++] is not 0; syncSettings.Player4Present = input[i++] is not 0; + syncSettings.TurningResolution = DSDA.TurningResolution.Shorttics; Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(syncSettings); var doomController1 = new DoomController(1); diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ControllerDeck.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ControllerDeck.cs index acc7c87bae..90521e63ec 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ControllerDeck.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ControllerDeck.cs @@ -7,14 +7,14 @@ namespace BizHawk.Emulation.Cores.Computers.Doom { public class DoomControllerDeck { - public DoomControllerDeck(DoomControllerTypes controllerType, bool player1Present, bool player2Present, bool player3Present, bool player4Present) + public DoomControllerDeck(DoomControllerTypes controllerType, bool player1Present, bool player2Present, bool player3Present, bool player4Present, bool longtics) { Definition = new("Doom Demo LMP 1.9 Input Format") { }; - if (player1Present) Port1 = ControllerCtors[controllerType](1); - if (player2Present) Port2 = ControllerCtors[controllerType](2); - if (player3Present) Port3 = ControllerCtors[controllerType](3); - if (player4Present) Port4 = ControllerCtors[controllerType](4); + if (player1Present) Port1 = ControllerCtors[controllerType](1, longtics); + if (player2Present) Port2 = ControllerCtors[controllerType](2, longtics); + if (player3Present) Port3 = ControllerCtors[controllerType](3, longtics); + if (player4Present) Port4 = ControllerCtors[controllerType](4, longtics); if (player1Present) Definition.BoolButtons.AddRange(Port1.Definition.BoolButtons.ToList()); if (player2Present) Definition.BoolButtons.AddRange(Port2.Definition.BoolButtons.ToList()); @@ -60,14 +60,14 @@ namespace BizHawk.Emulation.Cores.Computers.Doom private readonly IPort Port3; private readonly IPort Port4; - private static IReadOnlyDictionary> _controllerCtors; + private static IReadOnlyDictionary> _controllerCtors; - public static IReadOnlyDictionary> ControllerCtors => _controllerCtors - ??= new Dictionary> + public static IReadOnlyDictionary> ControllerCtors => _controllerCtors + ??= new Dictionary> { - [DoomControllerTypes.Doom] = portNum => new DoomController(portNum), - [DoomControllerTypes.Heretic] = portNum => new HereticController(portNum), - [DoomControllerTypes.Hexen] = portNum => new HexenController(portNum), + [DoomControllerTypes.Doom] = (portNum, longtics) => new DoomController(portNum, longtics), + [DoomControllerTypes.Heretic] = (portNum, longtics) => new HereticController(portNum, longtics), + [DoomControllerTypes.Hexen] = (portNum, longtics) => new HexenController(portNum, longtics), }; } } diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs index 7d56a6af05..d50d6df20f 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs @@ -81,10 +81,15 @@ namespace BizHawk.Emulation.Cores.Computers.Doom players[i]._RunSpeed = players[i]._RunSpeed.Clamp(-_runSpeeds[1], _runSpeeds[1]); // mouse-driven turning - players[i]._TurningSpeed -= (int)(potReaders[i](controller, 5) * _syncSettings.MouseTurnSensitivity / 300.0); - if (_syncSettings.TurningResolution == TurningResolution.Shorttics) + players[i]._TurningSpeed -= potReaders[i](controller, 5) * _syncSettings.MouseTurnSensitivity; + // todo: check how the core calculates these + if (_syncSettings.TurningResolution == TurningResolution.Longtics) { - players[i]._TurningSpeed >>= 8; + players[i]._TurningSpeed = (int) (players[i]._TurningSpeed / 256.0); + } + else + { + players[i]._TurningSpeed = (int) (players[i]._TurningSpeed / 10.0); } // bool buttons diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs index 32ccdbb5c6..593f5f0821 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs @@ -26,7 +26,13 @@ namespace BizHawk.Emulation.Cores.Computers.Doom ServiceProvider = ser; _finalSyncSettings = _syncSettings = lp.SyncSettings ?? new DoomSyncSettings(); _settings = lp.Settings ?? new DoomSettings(); - _controllerDeck = new DoomControllerDeck(_syncSettings.InputFormat, _syncSettings.Player1Present, _syncSettings.Player2Present, _syncSettings.Player3Present, _syncSettings.Player4Present); + _controllerDeck = new DoomControllerDeck( + _syncSettings.InputFormat, + _syncSettings.Player1Present, + _syncSettings.Player2Present, + _syncSettings.Player3Present, + _syncSettings.Player4Present, + _syncSettings.TurningResolution == TurningResolution.Longtics); _loadCallback = LoadCallback; // Gathering information for the rest of the wads diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDAControllers.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDAControllers.cs index 64d22ff18e..b6831e8a76 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDAControllers.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDAControllers.cs @@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom public class DoomController : IPort { - public DoomController(int portNum) + public DoomController(int portNum, bool longtics) { PortNum = portNum; Definition = new ControllerDefinition("Doom Input Format") @@ -38,7 +38,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom .AddAxis($"P{PortNum} Turning Speed", (-128).RangeTo(127), 0) .AddAxis($"P{PortNum} Weapon Select", (0).RangeTo(7), 0) .AddAxis($"P{PortNum} Mouse Running", (-128).RangeTo(127), 0) - .AddAxis($"P{PortNum} Mouse Turning", (-32768).RangeTo(32767), 0) + .AddAxis($"P{PortNum} Mouse Turning", (longtics ? -32768 : -128).RangeTo(longtics ? 32767 : 127), 0) .MakeImmutable(); } @@ -102,7 +102,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom public class HereticController : IPort { - public HereticController(int portNum) + public HereticController(int portNum, bool longtics) { PortNum = portNum; Definition = new ControllerDefinition("Heretic Input Format") @@ -221,7 +221,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom public class HexenController : IPort { - public HexenController(int portNum) + public HexenController(int portNum, bool longtics) { PortNum = portNum; Definition = new ControllerDefinition("Hexen Input Format")