mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-08-30 01:50:04 +02:00
Modified CPad::DuckJustDown
to use a frame counter for a 1-second delay.
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user