Variables renombrades en input.cpp

This commit is contained in:
2024-10-12 11:01:42 +02:00
parent 4ef759772a
commit 101e375fd3
16 changed files with 467 additions and 523 deletions

View File

@@ -1972,7 +1972,7 @@ void Game::checkInput()
for (int i = 0; i < input_->getNumControllers(); ++i)
{
// Comprueba si se va a pausar el juego
if (input_->checkModInput(input_service, input_pause, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
if (input_->checkModInput(InputType::SERVICE, InputType::PAUSE, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
pause(!paused_);
return;
@@ -1990,17 +1990,17 @@ void Game::checkInput()
// Comprueba direcciones
if (demo_.data_file[i][demo_.counter].left == 1)
{
player->setInput(input_left);
player->setInput(InputType::LEFT);
}
else if (demo_.data_file[i][demo_.counter].right == 1)
{
player->setInput(input_right);
player->setInput(InputType::RIGHT);
}
else if (demo_.data_file[i][demo_.counter].no_input == 1)
{
player->setInput(input_null);
player->setInput(InputType::NONE);
}
// Comprueba botones
@@ -2008,7 +2008,7 @@ void Game::checkInput()
{
if (player->canFire())
{
player->setInput(input_fire_center);
player->setInput(InputType::FIRE_CENTER);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BulletType::UP, player->isPowerUp(), player->getId());
player->setFireCooldown(10);
}
@@ -2018,7 +2018,7 @@ void Game::checkInput()
{
if (player->canFire())
{
player->setInput(input_fire_left);
player->setInput(InputType::FIRE_LEFT);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BulletType::LEFT, player->isPowerUp(), player->getId());
player->setFireCooldown(10);
}
@@ -2028,7 +2028,7 @@ void Game::checkInput()
{
if (player->canFire())
{
player->setInput(input_fire_right);
player->setInput(InputType::FIRE_RIGHT);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BulletType::RIGHT, player->isPowerUp(), player->getId());
player->setFireCooldown(10);
}
@@ -2064,9 +2064,9 @@ void Game::checkInput()
if (player->isPlaying())
{
// Input a la izquierda
if (input_->checkInput(input_left, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
if (input_->checkInput(InputType::LEFT, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_left);
player->setInput(InputType::LEFT);
#ifdef RECORDING
demo.keys.left = 1;
#endif
@@ -2074,9 +2074,9 @@ void Game::checkInput()
else
{
// Input a la derecha
if (input_->checkInput(input_right, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
if (input_->checkInput(InputType::RIGHT, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_right);
player->setInput(InputType::RIGHT);
#ifdef RECORDING
demo.keys.right = 1;
#endif
@@ -2084,18 +2084,18 @@ void Game::checkInput()
else
{
// Ninguno de los dos inputs anteriores
player->setInput(input_null);
player->setInput(InputType::NONE);
#ifdef RECORDING
demo.keys.no_input = 1;
#endif
}
}
// Comprueba el input de disparar al centro
if (input_->checkInput(input_fire_center, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
if (input_->checkInput(InputType::FIRE_CENTER, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
if (player->canFire())
{
player->setInput(input_fire_center);
player->setInput(InputType::FIRE_CENTER);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BulletType::UP, player->isPowerUp(), player->getId());
player->setFireCooldown(10);
@@ -2108,11 +2108,11 @@ void Game::checkInput()
}
// Comprueba el input de disparar a la izquierda
else if (input_->checkInput(input_fire_left, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
else if (input_->checkInput(InputType::FIRE_LEFT, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
if (player->canFire())
{
player->setInput(input_fire_left);
player->setInput(InputType::FIRE_LEFT);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BulletType::LEFT, player->isPowerUp(), player->getId());
player->setFireCooldown(10);
@@ -2125,11 +2125,11 @@ void Game::checkInput()
}
// Comprueba el input de disparar a la derecha
else if (input_->checkInput(input_fire_right, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
else if (input_->checkInput(InputType::FIRE_RIGHT, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
if (player->canFire())
{
player->setInput(input_fire_right);
player->setInput(InputType::FIRE_RIGHT);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BulletType::RIGHT, player->isPowerUp(), player->getId());
player->setFireCooldown(10);
@@ -2153,15 +2153,15 @@ void Game::checkInput()
else if (player->isContinue() || player->isWaiting())
{
// Si no está jugando, el botón de start le permite continuar jugando
if (input_->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
if (input_->checkInput(InputType::START, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setStatusPlaying(PlayerStatus::PLAYING);
}
// Si está continuando, los botones de fuego hacen decrementar el contador
const auto fire1 = input_->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire2 = input_->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire3 = input_->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire1 = input_->checkInput(InputType::FIRE_LEFT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire2 = input_->checkInput(InputType::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire3 = input_->checkInput(InputType::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
if (fire1 || fire2 || fire3)
{
player->decContinueCounter();
@@ -2169,41 +2169,41 @@ void Game::checkInput()
}
else if (player->isEnteringName())
{
const auto fire1 = input_->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire2 = input_->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire3 = input_->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire1 = input_->checkInput(InputType::FIRE_LEFT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire2 = input_->checkInput(InputType::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire3 = input_->checkInput(InputType::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
if (fire1 || fire2 || fire3)
{
if (player->getRecordNamePos() == 7)
{
player->setInput(input_start);
player->setInput(InputType::START);
addScoreToScoreBoard(player->getRecordName(), player->getScore());
player->setStatusPlaying(PlayerStatus::CONTINUE);
}
else
{
player->setInput(input_right);
player->setInput(InputType::RIGHT);
}
}
else if (input_->checkInput(input_up, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
else if (input_->checkInput(InputType::UP, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_up);
player->setInput(InputType::UP);
}
else if (input_->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
else if (input_->checkInput(InputType::DOWN, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_down);
player->setInput(InputType::DOWN);
}
else if (input_->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
else if (input_->checkInput(InputType::LEFT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_left);
player->setInput(InputType::LEFT);
}
else if (input_->checkInput(input_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
else if (input_->checkInput(InputType::RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_right);
player->setInput(InputType::RIGHT);
}
else if (input_->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
else if (input_->checkInput(InputType::START, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_start);
player->setInput(InputType::START);
addScoreToScoreBoard(player->getRecordName(), player->getScore());
player->setStatusPlaying(PlayerStatus::CONTINUE);
}