dsda: make strafe50 possible
in vanilla doom, turn key + strafe key = strafe in the direction of the turning key. but if directional strafe key is added to the mix, both strafe speeds are ADDED TOGETHER. on top of that, max strafe speed is max vertical movement speed (50), NOT the speed you get if you strafe while holding the run key (40). all of this makes strafe50 possible in vanilla, and turning is impossible at that time (because strafe key turns turning into strafing).
This commit is contained in:
parent
ffb1af4902
commit
f58644cb5a
|
@ -839,6 +839,7 @@ namespace BizHawk.Emulation.Common
|
|||
["Forward"] = '^',
|
||||
["Jump"] = 'J',
|
||||
["Run"] = 'R',
|
||||
["Strafe"] = 'S',
|
||||
["Strafe Left"] = '<',
|
||||
["Strafe Right"] = '>',
|
||||
["Turn Left"] = '{',
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
{
|
||||
if ((playersPresent & (1 << i)) is not 0)
|
||||
{
|
||||
bool strafe = controller.IsPressed($"P{i + 1} Strafe");
|
||||
int speedIndex = Convert.ToInt32(controller.IsPressed($"P{i + 1} Run")
|
||||
|| _syncSettings.AlwaysRun);
|
||||
|
||||
|
@ -65,18 +66,29 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
}
|
||||
|
||||
// initial axis read
|
||||
players[i].RunSpeed = axisReaders[i](controller, (int)AxisType.RunSpeed);
|
||||
players[i].RunSpeed = axisReaders[i](controller, (int)AxisType.RunSpeed);
|
||||
players[i].StrafingSpeed = axisReaders[i](controller, (int)AxisType.StrafingSpeed);
|
||||
players[i].TurningSpeed = axisReaders[i](controller, (int)AxisType.TurningSpeed);
|
||||
players[i].WeaponSelect = axisReaders[i](controller, (int)AxisType.WeaponSelect);
|
||||
players[i].TurningSpeed = axisReaders[i](controller, (int)AxisType.TurningSpeed);
|
||||
players[i].WeaponSelect = axisReaders[i](controller, (int)AxisType.WeaponSelect);
|
||||
|
||||
// override axis based on movement buttons (turning is reversed upstream)
|
||||
if (controller.IsPressed($"P{i + 1} Forward")) players[i].RunSpeed = _runSpeeds[speedIndex];
|
||||
if (controller.IsPressed($"P{i + 1} Backward")) players[i].RunSpeed = -_runSpeeds[speedIndex];
|
||||
if (controller.IsPressed($"P{i + 1} Strafe Right")) players[i].StrafingSpeed = _strafeSpeeds[speedIndex];
|
||||
if (controller.IsPressed($"P{i + 1} Strafe Left")) players[i].StrafingSpeed = -_strafeSpeeds[speedIndex];
|
||||
if (controller.IsPressed($"P{i + 1} Turn Right")) players[i].TurningSpeed = -turnSpeed;
|
||||
if (controller.IsPressed($"P{i + 1} Turn Left")) players[i].TurningSpeed = turnSpeed;
|
||||
if (controller.IsPressed($"P{i + 1} Forward")) players[i].RunSpeed = _runSpeeds [speedIndex];
|
||||
if (controller.IsPressed($"P{i + 1} Backward")) players[i].RunSpeed = -_runSpeeds [speedIndex];
|
||||
if (controller.IsPressed($"P{i + 1} Strafe Right")) players[i].StrafingSpeed = _strafeSpeeds[speedIndex];
|
||||
if (controller.IsPressed($"P{i + 1} Strafe Left")) players[i].StrafingSpeed = -_strafeSpeeds[speedIndex];
|
||||
if (strafe)
|
||||
{
|
||||
// strafe50 needs this speed to be ADDED to whatever we got from directional strafe buttons
|
||||
if (controller.IsPressed($"P{i + 1} Turn Right")) players[i].StrafingSpeed += _strafeSpeeds[speedIndex];
|
||||
if (controller.IsPressed($"P{i + 1} Turn Left")) players[i].StrafingSpeed -= _strafeSpeeds[speedIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (controller.IsPressed($"P{i + 1} Turn Right")) players[i].TurningSpeed -= turnSpeed;
|
||||
if (controller.IsPressed($"P{i + 1} Turn Left")) players[i].TurningSpeed += turnSpeed;
|
||||
}
|
||||
// ultimately strafe speed is limited to max run speed, NOT max strafe speed
|
||||
players[i].StrafingSpeed = players[i].StrafingSpeed.Clamp<int>(-_runSpeeds[1], _runSpeeds[1]);
|
||||
|
||||
// mouse-driven running
|
||||
// divider matches the core
|
||||
|
@ -109,7 +121,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
players[i].ArtifactUse = axisReaders[i](controller, (int)AxisType.UseArtifact);
|
||||
if (_syncSettings.InputFormat is DoomControllerTypes.Hexen)
|
||||
{
|
||||
players[i].Jump = (actionsBitfield & 0b01000) >> 3;
|
||||
players[i].Jump = (actionsBitfield & 0b01000) >> 3;
|
||||
players[i].EndPlayer = (actionsBitfield & 0b10000) >> 4;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
.Select(b => $"P{PortNum} " + b)
|
||||
.ToList()
|
||||
}.AddAxis($"P{PortNum} Run Speed", (-50).RangeTo(50), 0)
|
||||
.AddAxis($"P{PortNum} Strafing Speed", (-128).RangeTo(127), 0)
|
||||
.AddAxis($"P{PortNum} Strafing Speed", (-50).RangeTo(50), 0)
|
||||
.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)
|
||||
|
|
Loading…
Reference in New Issue