diff --git a/source/director.cpp b/source/director.cpp index 21ee3a7..ae26494 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -48,11 +48,12 @@ Director::Director(int argc, const char *argv[]) section::name = section::Name::GAME; section::options = section::Options::GAME_PLAY_1P; #elif DEBUG - section::name = section::Name::INTRO; + section::name = section::Name::GAME; + section::options = section::Options::GAME_PLAY_1P; #else // NORMAL GAME section::name = section::Name::LOGO; -#endif section::options = section::Options::NONE; +#endif section::attract_mode = section::AttractMode::TITLE_TO_DEMO; // Establece el nivel de prioridad de la categoría de registro diff --git a/source/enter_name.cpp b/source/enter_name.cpp index 69e9738..7ab6a35 100644 --- a/source/enter_name.cpp +++ b/source/enter_name.cpp @@ -4,7 +4,7 @@ // Constructor EnterName::EnterName() - : character_list_(" ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-+-*/=?¿<>!\"#$%&/()"), + : character_list_(" ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789."), character_index_{0} {} // Inicializa el objeto @@ -22,7 +22,7 @@ void EnterName::init(const std::string &name) { name_ = name; position_ = name_.length(); - position_overflow_ = position_ >= MAX_NAME_LENGHT ? true : false; + position_overflow_ = position_ >= NAME_SIZE ? true : false; } // Inicializa el vector de indices con el nombre y espacios @@ -40,10 +40,10 @@ void EnterName::incPosition() ++position_; - if (position_ >= MAX_NAME_LENGHT) + if (position_ >= NAME_SIZE) { - position_ = MAX_NAME_LENGHT; // Mantenemos en el índice máximo válido. - position_overflow_ = true; // Activamos el flag de overflow. + position_ = NAME_SIZE; // Mantenemos en el índice máximo válido. + position_overflow_ = true; // Activamos el flag de overflow. } else if (position_ > 0) // No es necesario verificar position_ < MAX_NAME_LENGHT { @@ -59,7 +59,6 @@ void EnterName::incPosition() updateNameFromCharacterIndex(); } - // Decrementa la posición void EnterName::decPosition() { @@ -67,7 +66,7 @@ void EnterName::decPosition() { // Si estaba en overflow, lo desactivamos y mantenemos position_ en el máximo. position_overflow_ = false; - position_ = MAX_NAME_LENGHT - 1; + position_ = NAME_SIZE - 1; } else { @@ -76,7 +75,7 @@ void EnterName::decPosition() --position_; // Limpiamos el carácter siguiente si el índice es válido. - if (position_ + 1 < MAX_NAME_LENGHT) + if (position_ + 1 < NAME_SIZE) { character_index_[position_ + 1] = 0; } @@ -89,7 +88,7 @@ void EnterName::decPosition() } // Si position_ es menor que NAME_LENGHT, aseguramos que el overflow esté desactivado. - if (position_ < MAX_NAME_LENGHT) + if (position_ < NAME_SIZE) { position_overflow_ = false; } @@ -134,7 +133,7 @@ void EnterName::decIndex() void EnterName::updateNameFromCharacterIndex() { name_.clear(); - for (int i = 0; i < MAX_NAME_LENGHT; ++i) + for (int i = 0; i < NAME_SIZE; ++i) { name_.push_back(character_list_[character_index_[i]]); } @@ -145,13 +144,13 @@ void EnterName::updateNameFromCharacterIndex() void EnterName::initCharacterIndex(const std::string &name) { // Rellena de espacios - for (size_t i = 0; i < MAX_NAME_LENGHT; ++i) + for (size_t i = 0; i < NAME_SIZE; ++i) { character_index_[i] = 0; } // Coloca los índices en función de los caracteres que forman el nombre - for (size_t i = 0; i < name.substr(0, MAX_NAME_LENGHT).size(); ++i) + for (size_t i = 0; i < name.substr(0, NAME_SIZE).size(); ++i) { character_index_[i] = findIndex(name.at(i)); } diff --git a/source/enter_name.h b/source/enter_name.h index ac48daa..5bdb454 100644 --- a/source/enter_name.h +++ b/source/enter_name.h @@ -4,7 +4,7 @@ #include #include "utils.h" -constexpr int MAX_NAME_LENGHT = 6; +constexpr size_t NAME_SIZE = 3; /* Un array, "characterList", contiene la lista de caracteres @@ -22,7 +22,7 @@ private: std::string name_; // Nombre introducido int position_ = 0; // Posición a editar del nombre bool position_overflow_ = false; // Indica si hemos incrementado la posición más allá del límite - std::array character_index_; // Indice de la lista para cada uno de los caracteres que forman el nombre + std::array character_index_; // Indice de la lista para cada uno de los caracteres que forman el nombre // Actualiza el nombre a partir de la lista de índices void updateNameFromCharacterIndex(); diff --git a/source/game.cpp b/source/game.cpp index 375dfbf..b1a7753 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -54,7 +54,7 @@ Game::Game(int player_id, int current_stage, bool demo) // Otras variables section::name = section::Name::GAME; - section::options = section::Options::GAME_PLAY_1P; + section::options = section::Options::NONE; Stage::init(); Stage::number = current_stage; diff --git a/source/manage_hiscore_table.cpp b/source/manage_hiscore_table.cpp index e49e27c..66cdb72 100644 --- a/source/manage_hiscore_table.cpp +++ b/source/manage_hiscore_table.cpp @@ -14,15 +14,15 @@ void ManageHiScoreTable::clear() // Añade 10 entradas predefinidas table_.push_back(HiScoreEntry("BRY", 1000000)); - table_.push_back(HiScoreEntry("USUFON", 500000)); - table_.push_back(HiScoreEntry("GLUCAS", 100000)); - table_.push_back(HiScoreEntry("PDLGAT", 50000)); - table_.push_back(HiScoreEntry("PARRAB", 10000)); - table_.push_back(HiScoreEntry("PELECH", 5000)); - table_.push_back(HiScoreEntry("SAHUQU", 1000)); - table_.push_back(HiScoreEntry("BACTER", 500)); - table_.push_back(HiScoreEntry("PEPE", 200)); - table_.push_back(HiScoreEntry("ROSITA", 100)); + table_.push_back(HiScoreEntry("USU", 500000)); + table_.push_back(HiScoreEntry("FON", 100000)); + table_.push_back(HiScoreEntry("DOG", 50000)); + table_.push_back(HiScoreEntry("LUC", 10000)); + table_.push_back(HiScoreEntry("ASP", 5000)); + table_.push_back(HiScoreEntry("ARR", 1000)); + table_.push_back(HiScoreEntry("ABA", 500)); + table_.push_back(HiScoreEntry("LER", 200)); + table_.push_back(HiScoreEntry("AXX", 100)); sort(); } diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index a9f0f1d..6ec75de 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -266,7 +266,7 @@ void Scoreboard::fillPanelTextures() SDL_FRect rect = {enter_name_pos_.x, enter_name_pos_.y, 5.0f, 7.0f}; // Recorre todos los slots de letras del nombre - for (size_t j = 0; j < MAX_NAME_LENGHT; ++j) + for (size_t j = 0; j < NAME_SIZE; ++j) { // Selecciona el color const Color color = j < selector_pos_[i] ? ORANGE_SOFT_COLOR.lighten() : Color(0xFF, 0xFF, 0xEB); @@ -387,7 +387,7 @@ void Scoreboard::recalculateAnchors() slot4_4_ = {COL, ROW4}; // Primer cuadrado para poner el nombre de record - const int enter_name_lenght = text_scoreboard_->lenght(std::string(MAX_NAME_LENGHT, 'A')); + const int enter_name_lenght = text_scoreboard_->lenght(std::string(NAME_SIZE, 'A')); enter_name_pos_.x = COL - (enter_name_lenght / 2); enter_name_pos_.y = ROW4;