diff --git a/source/enter_name.cpp b/source/enter_name.cpp index 4e642e5..7c35461 100644 --- a/source/enter_name.cpp +++ b/source/enter_name.cpp @@ -22,7 +22,7 @@ void EnterName::init() // Pone la lista de indices para que refleje el nombre updateCharacterIndex(); - // Actualiza el nombre para que ocupe 8 espacios + // Actualiza el nombre para que ocupe todos los espacios updateName(); } @@ -30,7 +30,7 @@ void EnterName::init() void EnterName::incPosition() { position_++; - position_ = std::min(position_, NAME_LENGHT - 1); + position_ = std::min(position_, NAME_LENGHT); checkIfPositionHasBeenUsed(); } @@ -118,7 +118,9 @@ void EnterName::checkIfPositionHasBeenUsed() auto used = position_has_been_used_[position_]; if (!used && position_ > 0) + { character_index_[position_] = character_index_[position_ - 1]; + } position_has_been_used_[position_] = true; updateName(); diff --git a/source/game.cpp b/source/game.cpp index abcac4f..4dfda33 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1635,7 +1635,7 @@ void Game::handlePlayerContinue(const std::shared_ptr &player) input_->checkInput(InputType::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, options.controllers[controllerIndex].type, options.controllers[controllerIndex].index) || input_->checkInput(InputType::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controllers[controllerIndex].type, options.controllers[controllerIndex].index)) { - if (player->getContinueCounter() < 8) + if (player->getContinueCounter() < 7) { player->decContinueCounter(); } diff --git a/source/manage_hiscore_table.cpp b/source/manage_hiscore_table.cpp index d421b3d..9a58714 100644 --- a/source/manage_hiscore_table.cpp +++ b/source/manage_hiscore_table.cpp @@ -12,7 +12,7 @@ void ManageHiScoreTable::clear() table_.clear(); // Añade 10 entradas predefinidas - table_.push_back(HiScoreEntry("BRY", 1000000)); + table_.push_back(HiScoreEntry("BRIBON", 1000000)); table_.push_back(HiScoreEntry("USUFON", 500000)); table_.push_back(HiScoreEntry("GLUCAS", 100000)); table_.push_back(HiScoreEntry("PDLGAT", 50000)); diff --git a/source/manage_hiscore_table.h b/source/manage_hiscore_table.h index d339b32..26eaf0b 100644 --- a/source/manage_hiscore_table.h +++ b/source/manage_hiscore_table.h @@ -20,7 +20,7 @@ struct HiScoreEntry // Constructor explicit HiScoreEntry(const std::string &n = "", int s = 0, bool occ = false) - : name(n.substr(0, 5)), score(s), one_credit_complete(occ) {} + : name(n.substr(0, 6)), score(s), one_credit_complete(occ) {} }; // Clase ManageHiScoreTable diff --git a/source/player.h b/source/player.h index 9436468..78e568b 100644 --- a/source/player.h +++ b/source/player.h @@ -226,7 +226,7 @@ public: int getPosX() const { return static_cast(pos_x_); } int getPosY() const { return pos_y_; } int getPowerUpCounter() const { return power_up_counter_; } - std::string getRecordName() const { return enter_name_->getName(); } + std::string getRecordName() const { return enter_name_->getName().substr(0, getRecordNamePos()); } int getScore() const { return score_; } int getScoreBoardPanel() const { return scoreboard_panel_; } int getWidth() const { return WIDTH_; } diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index ab5d8c0..a020738 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -86,11 +86,11 @@ Scoreboard::~Scoreboard() } } -// Transforma un valor numérico en una cadena de 6 cifras +// Transforma un valor numérico en una cadena de 7 cifras std::string Scoreboard::updateScoreText(int num) { std::ostringstream oss; - oss << std::setw(8) << std::setfill('0') << num; + oss << std::setw(7) << std::setfill('0') << num; return oss.str(); } @@ -150,7 +150,7 @@ void Scoreboard::fillPanelTextures() // Guarda a donde apunta actualmente el renderizador auto temp = SDL_GetRenderTarget(renderer_); - // Genera el contenidoi de cada panel_ + // Genera el contenido de cada panel_ for (size_t i = 0; i < SCOREBOARD_MAX_PANELS; ++i) { // Cambia el destino del renderizador @@ -253,17 +253,30 @@ void Scoreboard::fillPanelTextures() text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i])); // ENTER NAME - text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText(106)); - SDL_Rect rect = {enter_name_pos_.x, enter_name_pos_.y, 5, 7}; - SDL_SetRenderDrawColor(renderer_, 0xFF, 0xFF, 0xEB, 255); - for (size_t j = 0; j < record_name_[i].size(); ++j) { - if (j != selector_pos_[i] || counter_ % 3 == 0) + text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText(106)); + SDL_Rect rect = {enter_name_pos_.x, enter_name_pos_.y, 5, 7}; + + // Recorre el nombre + for (size_t j = 0; j < record_name_[i].size(); ++j) { - SDL_RenderDrawLine(renderer_, rect.x, rect.y + rect.h, rect.x + rect.w, rect.y + rect.h); - text_scoreboard_->write(rect.x, rect.y, record_name_[i].substr(j, 1)); + // Selecciona el color + const Color color = j < selector_pos_[i] ? orange_soft_color.lighten() : Color(0xFF, 0xFF, 0xEB); + + if (j != selector_pos_[i] || counter_ % 3 == 0) + { + // Dibuja la linea + if (j >= selector_pos_[i]) + { + SDL_SetRenderDrawColor(renderer_, color.r, color.g, color.b, 255); + SDL_RenderDrawLine(renderer_, rect.x, rect.y + rect.h, rect.x + rect.w, rect.y + rect.h); + } + + // Dibuja la letra + text_scoreboard_->writeColored(rect.x, rect.y, record_name_[i].substr(j, 1), color); + } + rect.x += 7; } - rect.x += 7; } break; } diff --git a/source/scoreboard.h b/source/scoreboard.h index 6372bba..06de45e 100644 --- a/source/scoreboard.h +++ b/source/scoreboard.h @@ -81,7 +81,7 @@ private: // Recalcula las anclas de los elementos void recalculateAnchors(); - // Transforma un valor numérico en una cadena de 6 cifras + // Transforma un valor numérico en una cadena de 7 cifras std::string updateScoreText(int num); // Crea la textura de fondo