summaryrefslogtreecommitdiffstats
path: root/src/core/Pad.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-08-16 17:41:17 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-08-16 17:41:17 +0200
commitcc66df18acfa458d4e3b82c4bb677a4b218c599d (patch)
tree2b210f1318adf58db51e432eefcd188280b4c8ef /src/core/Pad.cpp
parentCarCtrl finished, minor Script things (diff)
parent2 new opcodes (diff)
downloadre3-cc66df18acfa458d4e3b82c4bb677a4b218c599d.tar
re3-cc66df18acfa458d4e3b82c4bb677a4b218c599d.tar.gz
re3-cc66df18acfa458d4e3b82c4bb677a4b218c599d.tar.bz2
re3-cc66df18acfa458d4e3b82c4bb677a4b218c599d.tar.lz
re3-cc66df18acfa458d4e3b82c4bb677a4b218c599d.tar.xz
re3-cc66df18acfa458d4e3b82c4bb677a4b218c599d.tar.zst
re3-cc66df18acfa458d4e3b82c4bb677a4b218c599d.zip
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)