diff --git a/gamePlay.cpp b/gamePlay.cpp index 1c161b8..6734268 100644 --- a/gamePlay.cpp +++ b/gamePlay.cpp @@ -34,6 +34,7 @@ void gamePlay::startGame() { oldbpmCount=0; autoaway=true; position=0; + lockdown=false; for (int i=0; i<10; i++) oldbpm[i]=0; setComboTimer(); @@ -105,9 +106,14 @@ void gamePlay::mDown() { if (possible()) { draw(); dclock.restart(); + lockdown=false; } - else + else { piece.mup(); + if (!lockdown) + lockDownTime=keyclock.getElapsedTime()+sf::milliseconds(400); + lockdown=true; + } } void gamePlay::hd() { @@ -269,13 +275,13 @@ void gamePlay::delayCheck() { piece.mdown(); if (possible()) { draw(); + lockdown=false; } else { piece.mup(); - addPiece(); - sendLines(field.clearlines()); - makeNewPiece(); - draw(); + if (!lockdown) + lockDownTime=keyclock.getElapsedTime()+sf::milliseconds(400); + lockdown=true; } dclock.restart(); } @@ -302,6 +308,21 @@ void gamePlay::delayCheck() { dKeyTime+=options.repeatSpeedDown; } + if (lockdown && keyclock.getElapsedTime() > lockDownTime) { + piece.mdown(); + if (!possible()) { + piece.mup(); + addPiece(); + sendLines(field.clearlines()); + makeNewPiece(); + draw(); + } + else { + piece.mup(); + lockdown=false; + } + } + if (keyclock.getElapsedTime() > comboStart+comboTime && comboCount!=0) { sf::Uint16 comboLinesSent = comboCount * pow(1.1, comboCount); @@ -505,9 +526,9 @@ void gamePlay::pushGarbage() { if (!possible()) { piece.mup(); - addPiece(); - sendLines(field.clearlines()); - makeNewPiece(); + if (!lockdown) + lockDownTime=keyclock.getElapsedTime()+sf::milliseconds(400); + lockdown=true; } } diff --git a/gamePlay.h b/gamePlay.h index 7adac9e..0d29f61 100644 --- a/gamePlay.h +++ b/gamePlay.h @@ -45,6 +45,8 @@ class gamePlay { sendgameover=false; winner=false; + lockdown=false; + rKey=false; lKey=false; dKey=false; @@ -105,6 +107,9 @@ class gamePlay { sf::Time countDownTime; short countDowncount; + sf::Time lockDownTime; + bool lockdown; + sf::Uint16 linesSent; sf::Uint16 linesRecieved; short comboCount;