fixes B2B

This commit is contained in:
2025-03-28 21:45:50 +01:00
parent f883bd5bab
commit df7c9bd211
2 changed files with 16 additions and 9 deletions

View File

@@ -290,17 +290,21 @@ void Game::lockPiece() {
LineClear clear = this->board.lockPiece(); LineClear clear = this->board.lockPiece();
this->parameters.lockedPiece(clear); this->parameters.lockedPiece(clear);
bool B2BConditionsAreMet = ((clear.lines > B2B_MIN_LINE_NUMBER) || clear.isSpin || clear.isMiniSpin);
if (clear.lines > 0) { if (clear.lines > 0) {
bool B2BConditionsAreMet = ((clear.lines >= B2B_MIN_LINE_NUMBER) || clear.isSpin || clear.isMiniSpin);
/* clearing one more line is worth 2x more /* clearing one more line is worth 2x more
clearing with a spin is worth as much as clearing 2x more lines */ clearing with a spin is worth as much as clearing 2x more lines */
long int clearScore = LINE_CLEAR_BASE_SCORE; long int clearScore = LINE_CLEAR_BASE_SCORE;
clearScore = clearScore << (clear.lines << (clear.isSpin)); clearScore = clearScore << (clear.lines << (clear.isSpin));
if (this->B2BChain && B2BConditionsAreMet) clearScore *= B2B_SCORE_MULTIPLIER; if (this->B2BChain && B2BConditionsAreMet) {
this->score += clearScore; clearScore *= B2B_SCORE_MULTIPLIER;
} }
this->score += clearScore;
this->B2BChain = B2BConditionsAreMet; this->B2BChain = B2BConditionsAreMet;
}
if (!this->hasWon()) { if (!this->hasWon()) {
this->leftARETime = this->parameters.getARE(); this->leftARETime = this->parameters.getARE();

View File

@@ -235,11 +235,14 @@ void GamePlayingAppMenu::drawFrame() const {
this->placeText(text, {}, getGamemodeName(this->settings->getGamemode()), 1.f, 3.f, {}); this->placeText(text, {}, getGamemodeName(this->settings->getGamemode()), 1.f, 3.f, {});
this->placeText(text, {}, getGamemodeGoal(this->settings->getGamemode()), 1.f, 6.f, {}); this->placeText(text, {}, getGamemodeGoal(this->settings->getGamemode()), 1.f, 6.f, {});
this->placeText(text, {}, "LINES:" + std::to_string(this->game.getClearedLines()), 1.f, 25.f, {}); if (this->game.isOnB2BChain()) {
this->placeText(text, {}, "LEVEL:" + std::to_string(this->game.getLevel()), 1.f, 30.f, {}); this->placeText(text, {}, "B2B", 1.f, 22.f, {});
this->placeText(text, {}, "SCORE:" + std::to_string(this->game.getScore()), 1.f, 35.f, {}); }
this->placeText(text, {}, "GRADE:" + std::to_string(this->game.getGrade()), 1.f, 40.f, {}); this->placeText(text, {}, "LINES:" + std::to_string(this->game.getClearedLines()), 1.f, 27.f, {});
this->placeText(text, {}, showedTime, 1.f, 45.f, {}); this->placeText(text, {}, "LEVEL:" + std::to_string(this->game.getLevel()), 1.f, 32.f, {});
this->placeText(text, {}, "SCORE:" + std::to_string(this->game.getScore()), 1.f, 37.f, {});
this->placeText(text, {}, "GRADE:" + std::to_string(this->game.getGrade()), 1.f, 42.f, {});
this->placeText(text, {}, showedTime, 1.f, 47.f, {});
// game state // game state
text.setOutlineColor(sf::Color(255, 255, 255)); text.setOutlineColor(sf::Color(255, 255, 255));