summaryrefslogtreecommitdiffstats
path: root/src/core/Pad.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-05-29 21:05:33 +0200
committereray orçunus <erayorcunus@gmail.com>2020-05-29 21:05:33 +0200
commit529cec565380b3c6689641ea427a1bf973014e02 (patch)
tree6caafab9dece0f1233f7ac9899d57b83ff421cce /src/core/Pad.cpp
parentMerge pull request #603 from Fire-Head/miami (diff)
downloadre3-529cec565380b3c6689641ea427a1bf973014e02.tar
re3-529cec565380b3c6689641ea427a1bf973014e02.tar.gz
re3-529cec565380b3c6689641ea427a1bf973014e02.tar.bz2
re3-529cec565380b3c6689641ea427a1bf973014e02.tar.lz
re3-529cec565380b3c6689641ea427a1bf973014e02.tar.xz
re3-529cec565380b3c6689641ea427a1bf973014e02.tar.zst
re3-529cec565380b3c6689641ea427a1bf973014e02.zip
Diffstat (limited to '')
-rw-r--r--src/core/Pad.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index c52c7c36..89b3f053 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -378,15 +378,13 @@ void AltDodoCheat(void)
}
#endif
-#ifdef DETECT_PAD_INPUT_SWITCH
bool
-CControllerState::IsAnyButtonPressed(void)
+CControllerState::CheckForInput(void)
{
return !!LeftStickX || !!LeftStickY || !!RightStickX || !!RightStickY || !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2 ||
- !!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight || !!Start || !!Select || !!Square || !!Triangle || !!Cross || !!Circle || !!LeftShock ||
- !!RightShock || !!NetworkTalk;
+ !!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight || !!Start || !!Select || !!Square || !!Triangle || !!Cross || !!Circle || !!LeftShock ||
+ !!RightShock;
}
-#endif
void
CControllerState::Clear(void)
@@ -484,6 +482,11 @@ void CPad::Clear(bool bResetPlayerControls)
AverageEntries = 0;
}
+uint32 CPad::InputHowLongAgo()
+{
+ return CTimer::GetTimeInMilliseconds() - LastTimeTouched;
+}
+
void CPad::ClearMouseHistory()
{
PCTempMouseControllerState.Clear();
@@ -1155,7 +1158,7 @@ void CPad::UpdatePads(void)
CapturePad(0);
#endif
#ifdef DETECT_PAD_INPUT_SWITCH
- if (GetPad(0)->PCTempJoyState.IsAnyButtonPressed())
+ if (GetPad(0)->PCTempJoyState.CheckForInput())
IsAffectedByController = true;
else {
#endif
@@ -1165,11 +1168,11 @@ void CPad::UpdatePads(void)
#ifdef DETECT_PAD_INPUT_SWITCH
}
- if (IsAffectedByController && (GetPad(0)->PCTempKeyState.IsAnyButtonPressed() || GetPad(0)->PCTempMouseState.IsAnyButtonPressed()))
+ if (IsAffectedByController && (GetPad(0)->PCTempKeyState.CheckForInput() || GetPad(0)->PCTempMouseState.CheckForInput()))
IsAffectedByController = false;
#endif
- if ( CReplay::IsPlayingBackFromFile() )
+ if ( CReplay::IsPlayingBackFromFile() && !FrontEndMenuManager.m_bMenuActive )
bUpdate = false;
if ( bUpdate )
@@ -1209,6 +1212,9 @@ void CPad::Update(int16 unk)
PCTempMouseState.Clear();
ProcessPCSpecificStuff();
+
+ if (NewState.CheckForInput())
+ LastTimeTouched = CTimer::GetTimeInMilliseconds();
if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
iCurrHornHistory = 0;