mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-08-30 10:00:07 +02:00
Merge branch 'Pgta/Duck-Button-Modification' into 'main'
Some checks failed
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Has been cancelled
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
Some checks failed
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Has been cancelled
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Has been cancelled
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Has been cancelled
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Has been cancelled
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Has been cancelled
Adding long press for Duck. See merge request skmp/dca3-game!92
This commit is contained in:
@@ -3881,36 +3881,49 @@ bool CPad::CollectPickupJustDown(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPad::DuckJustDown(void)
|
bool CPad::DuckJustDown(void)
|
||||||
{
|
{
|
||||||
if (ArePlayerControlsDisabled())
|
if (ArePlayerControlsDisabled()) {
|
||||||
|
duckFrameCounter = 0;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef RW_DC
|
#ifdef RW_DC
|
||||||
switch (CPad::GetPad(0)->Mode)
|
bool buttonPressed = false;
|
||||||
{
|
switch (CPad::GetPad(0)->Mode) {
|
||||||
case 0: //Xbox Mode
|
case 0: // Xbox Mode
|
||||||
if (CPad::GetPad(0)->IsDualAnalog)
|
buttonPressed = NewState.X;
|
||||||
{
|
break;
|
||||||
return !!(NewState.X&& !OldState.X);
|
case 1: // PS2 Mode
|
||||||
}
|
buttonPressed = NewState.X;
|
||||||
else
|
break;
|
||||||
{
|
}
|
||||||
return !!(NewState.X&& !OldState.X);
|
|
||||||
}
|
if (buttonPressed) {
|
||||||
case 1: //PS2 Mode
|
duckFrameCounter++;
|
||||||
if (CPad::GetPad(0)->IsDualAnalog)
|
if (duckFrameCounter >= DUCK_DELAY_FRAMES && !isDucking) {
|
||||||
{
|
isDucking = true;
|
||||||
return !!(NewState.X&& !OldState.X);
|
return true; // Trigger ducking after delay
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
duckFrameCounter = 0;
|
||||||
return !!(NewState.X&& !OldState.X);
|
isDucking = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
return !!(NewState.LeftShock && !OldState.LeftShock);
|
bool buttonPressed = NewState.Square;
|
||||||
|
if (buttonPressed) {
|
||||||
|
duckFrameCounter++;
|
||||||
|
if (duckFrameCounter >= DUCK_DELAY_FRAMES && !isDucking) {
|
||||||
|
isDucking = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
duckFrameCounter = 0;
|
||||||
|
isDucking = false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -173,11 +173,26 @@ public:
|
|||||||
uint32 CameraJustUpTime;
|
uint32 CameraJustUpTime;
|
||||||
uint32 CameraLastPressed;
|
uint32 CameraLastPressed;
|
||||||
bool CameraIsDoublePressed;
|
bool CameraIsDoublePressed;
|
||||||
|
static const int DUCK_DELAY_FRAMES = 30; // 1 second at 30 FPS
|
||||||
|
int duckFrameCounter; // Frames the duck button has been held
|
||||||
|
bool isDucking; // Tracks if duck action is active
|
||||||
|
|
||||||
#ifdef DETECT_PAD_INPUT_SWITCH
|
#ifdef DETECT_PAD_INPUT_SWITCH
|
||||||
static bool IsAffectedByController;
|
static bool IsAffectedByController;
|
||||||
#endif
|
#endif
|
||||||
CPad() { }
|
|
||||||
|
CPad() : duckFrameCounter(0), isDucking(false), // New variables initialized
|
||||||
|
SteeringLeftRightBuffer{0}, DrunkDrivingBufferUsed(0), Phase(0), Mode(0),
|
||||||
|
ShakeDur(0), DisablePlayerControls(0), ShakeFreq(0), iCurrHornHistory(0),
|
||||||
|
JustOutOfFrontend(0), bApplyBrakes(0), LastTimeTouched(0), AverageWeapon(0),
|
||||||
|
AverageEntries(0), IsKeyboardMouse(false), IsDualAnalog(false),
|
||||||
|
CameraJustDown(false), CameraJustUp(false), CameraJustUpTime(0),
|
||||||
|
CameraLastPressed(0), CameraIsDoublePressed(false) {
|
||||||
|
Clear(false);
|
||||||
|
memset(bHornHistory, 0, sizeof(bHornHistory));
|
||||||
|
memset(CheatString, 0, sizeof(CheatString));
|
||||||
|
}
|
||||||
|
|
||||||
~CPad() { }
|
~CPad() { }
|
||||||
|
|
||||||
static bool bDisplayNoControllerMessage;
|
static bool bDisplayNoControllerMessage;
|
||||||
|
Reference in New Issue
Block a user