summaryrefslogtreecommitdiff
path: root/src/core/Pad.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-08-16 18:41:17 +0300
committerNikolay Korolev <nickvnuk@gmail.com>2020-08-16 18:41:17 +0300
commitcc66df18acfa458d4e3b82c4bb677a4b218c599d (patch)
tree2b210f1318adf58db51e432eefcd188280b4c8ef /src/core/Pad.cpp
parentd303c33c2e03edc4c4980a06afe81004f1ae430f (diff)
parent980dd1b5a17440e9a272b7b47ad3553cd1ce11ff (diff)
Merge remote-tracking branch 'upstream/miami' into miami
Diffstat (limited to 'src/core/Pad.cpp')
-rw-r--r--src/core/Pad.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 2c5c4c02..eb2b1e31 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -638,6 +638,11 @@ void CPad::Clear(bool bResetPlayerControls)
ShakeFreq = 0;
ShakeDur = 0;
+ for (int32 i = 0; i < DRUNK_STEERING_BUFFER_SIZE; i++)
+ SteeringLeftRightBuffer[i] = 0;
+
+ DrunkDrivingBufferUsed = 0;
+
if ( bResetPlayerControls )
DisablePlayerControls = PLAYERCONTROL_ENABLED;
@@ -1814,6 +1819,9 @@ void CPad::Update(int16 pad)
bHornHistory[iCurrHornHistory] = GetHorn();
+ for (int32 i = DRUNK_STEERING_BUFFER_SIZE - 2; i >= 0; i--) {
+ SteeringLeftRightBuffer[i + 1] = SteeringLeftRightBuffer[i];
+ }
if ( !bDisplayNoControllerMessage )
CGame::bDemoMode = false;
@@ -1907,6 +1915,7 @@ int16 CPad::GetSteeringLeftRight(void)
if ( ArePlayerControlsDisabled() )
return 0;
+ int16 value;
switch (CURMODE)
{
case 0:
@@ -1916,9 +1925,12 @@ int16 CPad::GetSteeringLeftRight(void)
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
if ( Abs(axis) > Abs(dpad) )
- return axis;
+ value = axis;
else
- return dpad;
+ value = dpad;
+
+ SteeringLeftRightBuffer[0] = value;
+ value = SteeringLeftRightBuffer[DrunkDrivingBufferUsed];
break;
}
@@ -1926,13 +1938,18 @@ int16 CPad::GetSteeringLeftRight(void)
case 1:
case 3:
{
- return NewState.LeftStickX;
-
+ SteeringLeftRightBuffer[0] = NewState.LeftStickX;
+ value = SteeringLeftRightBuffer[DrunkDrivingBufferUsed];
+ break;
+ }
+ default:
+ {
+ value = 0;
break;
}
}
- return 0;
+ return value;
}
int16 CPad::GetSteeringUpDown(void)