typo
This commit is contained in:
@@ -192,6 +192,10 @@ void Game::nextFrame(const std::set<Action>& playerActions) {
|
|||||||
// no need to apply gravity and lock delay if the piece was hard dropped
|
// no need to apply gravity and lock delay if the piece was hard dropped
|
||||||
else {
|
else {
|
||||||
/* GRAVITY */
|
/* GRAVITY */
|
||||||
|
if (this->parameters.getLevel() >= 20) {
|
||||||
|
while (this->board.moveDown());
|
||||||
|
}
|
||||||
|
else {
|
||||||
// parameters.getGravity() gives the gravity for an assumed 20-line high board
|
// 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);
|
int appliedGravity = this->parameters.getGravity() * std::max((double) this->board.getBoard().getBaseHeight() / 20.0, 1.0);
|
||||||
|
|
||||||
@@ -200,6 +204,7 @@ void Game::nextFrame(const std::set<Action>& playerActions) {
|
|||||||
this->subVerticalPosition -= SUBPX_PER_ROW;
|
this->subVerticalPosition -= SUBPX_PER_ROW;
|
||||||
this->board.moveDown();
|
this->board.moveDown();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* LOCK DELAY */
|
/* LOCK DELAY */
|
||||||
if (this->board.touchesGround()) {
|
if (this->board.touchesGround()) {
|
||||||
@@ -304,11 +309,13 @@ void Game::lockPiece() {
|
|||||||
this->totalForcedLockDelay = 0;
|
this->totalForcedLockDelay = 0;
|
||||||
this->heldARR = 0;
|
this->heldARR = 0;
|
||||||
|
|
||||||
|
if (!this->hasWon()) {
|
||||||
this->leftARETime = this->parameters.getARE();
|
this->leftARETime = this->parameters.getARE();
|
||||||
if (this->leftARETime == 0) {
|
if (this->leftARETime == 0) {
|
||||||
this->lost = this->board.spawnNextPiece();
|
this->lost = this->board.spawnNextPiece();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Game::hasWon() const {
|
bool Game::hasWon() const {
|
||||||
return this->parameters.hasWon(this->framesPassed);
|
return this->parameters.hasWon(this->framesPassed);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void GameParameters::updateStats() {
|
|||||||
/* GRAVITY */
|
/* GRAVITY */
|
||||||
// get gravity for an assumed 20-rows board
|
// get gravity for an assumed 20-rows board
|
||||||
static const int gravityPerLevel[] = {
|
static const int gravityPerLevel[] = {
|
||||||
0, // LVL0
|
0, // lvl0 = no gravity
|
||||||
1, // 60f/line, 20s total
|
1, // 60f/line, 20s total
|
||||||
2, // 30f/line, 10s total
|
2, // 30f/line, 10s total
|
||||||
3, // 20f/line, 6.66s total
|
3, // 20f/line, 6.66s total
|
||||||
@@ -113,7 +113,8 @@ void GameParameters::updateStats() {
|
|||||||
40, // 1.5f/line, 30f total
|
40, // 1.5f/line, 30f total
|
||||||
1 * 60, // 1line/f, 20f total
|
1 * 60, // 1line/f, 20f total
|
||||||
2 * 60, // 2line/f, 10f total
|
2 * 60, // 2line/f, 10f total
|
||||||
4 * 60 // 4line/f, 5f total
|
4 * 60, // 4line/f, 5f total
|
||||||
|
20 * 60 // lvl20 = instant gravity
|
||||||
};
|
};
|
||||||
if (this->level < 0) {
|
if (this->level < 0) {
|
||||||
this->gravity = gravityPerLevel[0];
|
this->gravity = gravityPerLevel[0];
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ static const int FRAMES_PER_INPUT = FRAMES_PER_SECOND / 2;
|
|||||||
static const int MAXIMUM_PIECE_SIZE = 10;
|
static const int MAXIMUM_PIECE_SIZE = 10;
|
||||||
static const int DEFAULT_PIECE_SIZE = 4;
|
static const int DEFAULT_PIECE_SIZE = 4;
|
||||||
static const int MAXIMUM_BOARD_WIDTH = 30;
|
static const int MAXIMUM_BOARD_WIDTH = 30;
|
||||||
static const int MAXIMYM_BOARD_HEIGHT = 40;
|
static const int MAXIMUM_BOARD_HEIGHT = 40;
|
||||||
static const Gamemode DEFAULT_GAMEMODE = SPRINT;
|
static const Gamemode DEFAULT_GAMEMODE = SPRINT;
|
||||||
|
|
||||||
|
|
||||||
@@ -103,12 +103,12 @@ void TextApp::chooseBoardSize() {
|
|||||||
}
|
}
|
||||||
catch (std::exception ignored) {}
|
catch (std::exception ignored) {}
|
||||||
|
|
||||||
std::cout << "Choose the height of the board (from 1 to " << MAXIMYM_BOARD_HEIGHT << ")." << std::endl;
|
std::cout << "Choose the height of the board (from 1 to " << MAXIMUM_BOARD_HEIGHT << ")." << std::endl;
|
||||||
std::cout << "Choice: ";
|
std::cout << "Choice: ";
|
||||||
std::getline(std::cin, answer);
|
std::getline(std::cin, answer);
|
||||||
try {
|
try {
|
||||||
int selectedSize = std::stoi(answer);
|
int selectedSize = std::stoi(answer);
|
||||||
if (selectedSize >= 1 && selectedSize <= MAXIMYM_BOARD_HEIGHT) {
|
if (selectedSize >= 1 && selectedSize <= MAXIMUM_BOARD_HEIGHT) {
|
||||||
this->gameMenu.setBoardHeight(selectedSize);
|
this->gameMenu.setBoardHeight(selectedSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user