diff options
author | eray orçunus <erayorcunus@gmail.com> | 2020-08-16 16:10:59 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2020-08-16 16:10:59 +0200 |
commit | 980dd1b5a17440e9a272b7b47ad3553cd1ce11ff (patch) | |
tree | f0bc6cfc1030f3eaf25c53b4e22db3717fc49074 /src/core/Pad.cpp | |
parent | Merge branch 'master' into miami (diff) | |
download | re3-980dd1b5a17440e9a272b7b47ad3553cd1ce11ff.tar re3-980dd1b5a17440e9a272b7b47ad3553cd1ce11ff.tar.gz re3-980dd1b5a17440e9a272b7b47ad3553cd1ce11ff.tar.bz2 re3-980dd1b5a17440e9a272b7b47ad3553cd1ce11ff.tar.lz re3-980dd1b5a17440e9a272b7b47ad3553cd1ce11ff.tar.xz re3-980dd1b5a17440e9a272b7b47ad3553cd1ce11ff.tar.zst re3-980dd1b5a17440e9a272b7b47ad3553cd1ce11ff.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/Pad.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 6d6c30e4..222fe349 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -631,6 +631,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; @@ -1806,6 +1811,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; @@ -1899,6 +1907,7 @@ int16 CPad::GetSteeringLeftRight(void) if ( ArePlayerControlsDisabled() ) return 0; + int16 value; switch (CURMODE) { case 0: @@ -1908,9 +1917,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; } @@ -1918,13 +1930,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) |