This commit is contained in:
2025-03-03 00:26:05 +01:00
parent 1033f3a64c
commit 47d3d929db
3 changed files with 24 additions and 16 deletions

View File

@@ -192,15 +192,20 @@ void Game::nextFrame(const std::set<Action>& playerActions) {
// no need to apply gravity and lock delay if the piece was hard dropped
else {
/* GRAVITY */
// parameters.getGravity() gives the gravity for an assumed 20-line high board
int appliedGravity = this->parameters.getGravity() * std::max((double) this->board.getBoard().getBaseHeight() / 20.0, 1.0);
this->subVerticalPosition += appliedGravity;
while (this->subVerticalPosition >= SUBPX_PER_ROW) {
this->subVerticalPosition -= SUBPX_PER_ROW;
this->board.moveDown();
if (this->parameters.getLevel() >= 20) {
while (this->board.moveDown());
}
else {
// parameters.getGravity() gives the gravity for an assumed 20-line high board
int appliedGravity = this->parameters.getGravity() * std::max((double) this->board.getBoard().getBaseHeight() / 20.0, 1.0);
this->subVerticalPosition += appliedGravity;
while (this->subVerticalPosition >= SUBPX_PER_ROW) {
this->subVerticalPosition -= SUBPX_PER_ROW;
this->board.moveDown();
}
}
/* LOCK DELAY */
if (this->board.touchesGround()) {
this->totalLockDelay++;
@@ -304,10 +309,12 @@ void Game::lockPiece() {
this->totalForcedLockDelay = 0;
this->heldARR = 0;
this->leftARETime = this->parameters.getARE();
if (this->leftARETime == 0) {
this->lost = this->board.spawnNextPiece();
}
if (!this->hasWon()) {
this->leftARETime = this->parameters.getARE();
if (this->leftARETime == 0) {
this->lost = this->board.spawnNextPiece();
}
}
}
bool Game::hasWon() const {