EnterName: amb el mando soles tries lletra, amb el primer botó la fixa, qualsevol altre boto la borra, pa saltar el nom quan ja etsà posat val qualsevol botó inclos el start

This commit is contained in:
2025-06-28 11:18:11 +02:00
parent 65ba55aa12
commit dce9f4305a
2 changed files with 26 additions and 13 deletions

View File

@@ -84,7 +84,7 @@ void EnterName::decPosition()
{
// Si position_ es 0, aseguramos que no vaya a ser negativo y limpiamos el carácter actual.
position_ = 0;
character_index_[position_] = 0;
//character_index_[position_] = 0;
}
// Si position_ es menor que NAME_LENGHT, aseguramos que el overflow esté desactivado.

View File

@@ -1550,9 +1550,7 @@ void Game::handlePlayerContinue(const std::shared_ptr<Player> &player)
void Game::handleNameInput(const std::shared_ptr<Player> &player)
{
const auto controllerIndex = player->getController();
if (input_->checkInput(InputAction::FIRE_LEFT, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index) ||
input_->checkInput(InputAction::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index) ||
input_->checkInput(InputAction::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index))
if (input_->checkInput(InputAction::FIRE_LEFT, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index))
{
if (player->isShowingName())
{
@@ -1569,6 +1567,18 @@ void Game::handleNameInput(const std::shared_ptr<Player> &player)
player->setInput(InputAction::RIGHT);
}
}
else if (input_->checkInput(InputAction::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index) ||
input_->checkInput(InputAction::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index))
{
if (player->isShowingName())
{
player->setPlayingState(PlayerState::CONTINUE);
}
else
{
player->setInput(InputAction::LEFT);
}
}
else if (input_->checkInput(InputAction::UP, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index))
{
player->setInput(InputAction::UP);
@@ -1577,17 +1587,20 @@ void Game::handleNameInput(const std::shared_ptr<Player> &player)
{
player->setInput(InputAction::DOWN);
}
else if (input_->checkInput(InputAction::LEFT, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index))
{
player->setInput(InputAction::LEFT);
}
else if (input_->checkInput(InputAction::START, INPUT_DO_NOT_ALLOW_REPEAT, Options::controllers[controllerIndex].type, Options::controllers[controllerIndex].index))
{
if (player->isShowingName())
{
player->setPlayingState(PlayerState::CONTINUE);
}
else
{
player->setInput(InputAction::START);
addScoreToScoreBoard(player);
player->setPlayingState(PlayerState::SHOWING_NAME);
}
}
}
// Inicializa las variables para el modo DEMO
void Game::initDemo(int player_id)