dsda: pass turning resolution to controller ctor
this allows to properly set available range which makes demos sync again (aside from weapon switching that I broke) when importing demos we now force shorttics (even tho some source ports can record demos with longtics depending on compatibility level but importing those is for the later time)
This commit is contained in:
parent
ae4af29849
commit
4cf20df155
|
@ -52,6 +52,7 @@ namespace BizHawk.Client.Common
|
||||||
syncSettings.Player2Present = input[i++] is not 0;
|
syncSettings.Player2Present = input[i++] is not 0;
|
||||||
syncSettings.Player3Present = input[i++] is not 0;
|
syncSettings.Player3Present = input[i++] is not 0;
|
||||||
syncSettings.Player4Present = input[i++] is not 0;
|
syncSettings.Player4Present = input[i++] is not 0;
|
||||||
|
syncSettings.TurningResolution = DSDA.TurningResolution.Shorttics;
|
||||||
Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(syncSettings);
|
Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(syncSettings);
|
||||||
|
|
||||||
var doomController1 = new DoomController(1);
|
var doomController1 = new DoomController(1);
|
||||||
|
|
|
@ -7,14 +7,14 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
||||||
{
|
{
|
||||||
public class DoomControllerDeck
|
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") { };
|
Definition = new("Doom Demo LMP 1.9 Input Format") { };
|
||||||
|
|
||||||
if (player1Present) Port1 = ControllerCtors[controllerType](1);
|
if (player1Present) Port1 = ControllerCtors[controllerType](1, longtics);
|
||||||
if (player2Present) Port2 = ControllerCtors[controllerType](2);
|
if (player2Present) Port2 = ControllerCtors[controllerType](2, longtics);
|
||||||
if (player3Present) Port3 = ControllerCtors[controllerType](3);
|
if (player3Present) Port3 = ControllerCtors[controllerType](3, longtics);
|
||||||
if (player4Present) Port4 = ControllerCtors[controllerType](4);
|
if (player4Present) Port4 = ControllerCtors[controllerType](4, longtics);
|
||||||
|
|
||||||
if (player1Present) Definition.BoolButtons.AddRange(Port1.Definition.BoolButtons.ToList());
|
if (player1Present) Definition.BoolButtons.AddRange(Port1.Definition.BoolButtons.ToList());
|
||||||
if (player2Present) Definition.BoolButtons.AddRange(Port2.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 Port3;
|
||||||
private readonly IPort Port4;
|
private readonly IPort Port4;
|
||||||
|
|
||||||
private static IReadOnlyDictionary<DoomControllerTypes, Func<int, IPort>> _controllerCtors;
|
private static IReadOnlyDictionary<DoomControllerTypes, Func<int, bool, IPort>> _controllerCtors;
|
||||||
|
|
||||||
public static IReadOnlyDictionary<DoomControllerTypes, Func<int, IPort>> ControllerCtors => _controllerCtors
|
public static IReadOnlyDictionary<DoomControllerTypes, Func<int, bool, IPort>> ControllerCtors => _controllerCtors
|
||||||
??= new Dictionary<DoomControllerTypes, Func<int, IPort>>
|
??= new Dictionary<DoomControllerTypes, Func<int, bool, IPort>>
|
||||||
{
|
{
|
||||||
[DoomControllerTypes.Doom] = portNum => new DoomController(portNum),
|
[DoomControllerTypes.Doom] = (portNum, longtics) => new DoomController(portNum, longtics),
|
||||||
[DoomControllerTypes.Heretic] = portNum => new HereticController(portNum),
|
[DoomControllerTypes.Heretic] = (portNum, longtics) => new HereticController(portNum, longtics),
|
||||||
[DoomControllerTypes.Hexen] = portNum => new HexenController(portNum),
|
[DoomControllerTypes.Hexen] = (portNum, longtics) => new HexenController(portNum, longtics),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,10 +81,15 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
||||||
players[i]._RunSpeed = players[i]._RunSpeed.Clamp<int>(-_runSpeeds[1], _runSpeeds[1]);
|
players[i]._RunSpeed = players[i]._RunSpeed.Clamp<int>(-_runSpeeds[1], _runSpeeds[1]);
|
||||||
|
|
||||||
// mouse-driven turning
|
// mouse-driven turning
|
||||||
players[i]._TurningSpeed -= (int)(potReaders[i](controller, 5) * _syncSettings.MouseTurnSensitivity / 300.0);
|
players[i]._TurningSpeed -= potReaders[i](controller, 5) * _syncSettings.MouseTurnSensitivity;
|
||||||
if (_syncSettings.TurningResolution == TurningResolution.Shorttics)
|
// 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
|
// bool buttons
|
||||||
|
|
|
@ -26,7 +26,13 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
||||||
ServiceProvider = ser;
|
ServiceProvider = ser;
|
||||||
_finalSyncSettings = _syncSettings = lp.SyncSettings ?? new DoomSyncSettings();
|
_finalSyncSettings = _syncSettings = lp.SyncSettings ?? new DoomSyncSettings();
|
||||||
_settings = lp.Settings ?? new DoomSettings();
|
_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;
|
_loadCallback = LoadCallback;
|
||||||
|
|
||||||
// Gathering information for the rest of the wads
|
// Gathering information for the rest of the wads
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
||||||
|
|
||||||
public class DoomController : IPort
|
public class DoomController : IPort
|
||||||
{
|
{
|
||||||
public DoomController(int portNum)
|
public DoomController(int portNum, bool longtics)
|
||||||
{
|
{
|
||||||
PortNum = portNum;
|
PortNum = portNum;
|
||||||
Definition = new ControllerDefinition("Doom Input Format")
|
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} Turning Speed", (-128).RangeTo(127), 0)
|
||||||
.AddAxis($"P{PortNum} Weapon Select", (0).RangeTo(7), 0)
|
.AddAxis($"P{PortNum} Weapon Select", (0).RangeTo(7), 0)
|
||||||
.AddAxis($"P{PortNum} Mouse Running", (-128).RangeTo(127), 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();
|
.MakeImmutable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
||||||
|
|
||||||
public class HereticController : IPort
|
public class HereticController : IPort
|
||||||
{
|
{
|
||||||
public HereticController(int portNum)
|
public HereticController(int portNum, bool longtics)
|
||||||
{
|
{
|
||||||
PortNum = portNum;
|
PortNum = portNum;
|
||||||
Definition = new ControllerDefinition("Heretic Input Format")
|
Definition = new ControllerDefinition("Heretic Input Format")
|
||||||
|
@ -221,7 +221,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
||||||
|
|
||||||
public class HexenController : IPort
|
public class HexenController : IPort
|
||||||
{
|
{
|
||||||
public HexenController(int portNum)
|
public HexenController(int portNum, bool longtics)
|
||||||
{
|
{
|
||||||
PortNum = portNum;
|
PortNum = portNum;
|
||||||
Definition = new ControllerDefinition("Hexen Input Format")
|
Definition = new ControllerDefinition("Hexen Input Format")
|
||||||
|
|
Loading…
Reference in New Issue