mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-04-28 13:07:59 +03:00
Modified CPad::DuckJustDown
to use a frame counter for a 1-second delay.
This commit is contained in:
parent
24114d9a07
commit
f7d23f3bb3
1 changed files with 36 additions and 23 deletions
|
@ -3881,36 +3881,49 @@ bool CPad::CollectPickupJustDown(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CPad::DuckJustDown(void)
|
||||
bool CPad::DuckJustDown(void)
|
||||
{
|
||||
if (ArePlayerControlsDisabled())
|
||||
if (ArePlayerControlsDisabled()) {
|
||||
duckFrameCounter = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef RW_DC
|
||||
switch (CPad::GetPad(0)->Mode)
|
||||
{
|
||||
case 0: //Xbox Mode
|
||||
if (CPad::GetPad(0)->IsDualAnalog)
|
||||
{
|
||||
return !!(NewState.X&& !OldState.X);
|
||||
}
|
||||
else
|
||||
{
|
||||
return !!(NewState.X&& !OldState.X);
|
||||
}
|
||||
case 1: //PS2 Mode
|
||||
if (CPad::GetPad(0)->IsDualAnalog)
|
||||
{
|
||||
return !!(NewState.X&& !OldState.X);
|
||||
}
|
||||
else
|
||||
{
|
||||
return !!(NewState.X&& !OldState.X);
|
||||
}
|
||||
bool buttonPressed = false;
|
||||
switch (CPad::GetPad(0)->Mode) {
|
||||
case 0: // Xbox Mode
|
||||
buttonPressed = NewState.X;
|
||||
break;
|
||||
case 1: // PS2 Mode
|
||||
buttonPressed = NewState.X;
|
||||
break;
|
||||
}
|
||||
|
||||
if (buttonPressed) {
|
||||
duckFrameCounter++;
|
||||
if (duckFrameCounter >= DUCK_DELAY_FRAMES && !isDucking) {
|
||||
isDucking = true;
|
||||
return true; // Trigger ducking after delay
|
||||
}
|
||||
} else {
|
||||
duckFrameCounter = 0;
|
||||
isDucking = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
#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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue