Li he demanat a la IA que revente Game::checkInput() que aixo si que era un monstruo amb sombreret i pajarita
This commit is contained in:
476
source/game.cpp
476
source/game.cpp
@@ -573,7 +573,7 @@ bool Game::loadDemoFile(const std::string &file_path, DemoKeys (*data_file)[TOTA
|
||||
// El fichero existe
|
||||
else
|
||||
{
|
||||
// Mensaje de proceder a la carga de los datos
|
||||
// Mensaje de proceder a la carga de los datos
|
||||
std::cout << "Reading file: " << file_name.c_str() << std::endl;
|
||||
|
||||
// Lee todos los datos del fichero y los deja en el destino
|
||||
@@ -1793,259 +1793,6 @@ void Game::updateMenace()
|
||||
}
|
||||
}
|
||||
|
||||
// Gestiona la entrada durante el juego
|
||||
void Game::checkInput()
|
||||
{
|
||||
// Comprueba si se pulsa el botón de pausa
|
||||
for (int i = 0; i < input_->getNumControllers(); ++i)
|
||||
{
|
||||
// Comprueba si se va a pausar el juego
|
||||
if (input_->checkModInput(InputType::SERVICE, InputType::PAUSE, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
pause(!paused_);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Modo Demo activo
|
||||
if (demo_.enabled)
|
||||
{
|
||||
auto i = 0;
|
||||
for (auto &player : players_)
|
||||
{
|
||||
if (player->isPlaying())
|
||||
{
|
||||
// Comprueba direcciones
|
||||
if (demo_.data_file[i][demo_.counter].left == 1)
|
||||
{
|
||||
player->setInput(InputType::LEFT);
|
||||
}
|
||||
|
||||
else if (demo_.data_file[i][demo_.counter].right == 1)
|
||||
{
|
||||
player->setInput(InputType::RIGHT);
|
||||
}
|
||||
|
||||
else if (demo_.data_file[i][demo_.counter].no_input == 1)
|
||||
{
|
||||
player->setInput(InputType::NONE);
|
||||
}
|
||||
|
||||
// Comprueba botones
|
||||
if (demo_.data_file[i][demo_.counter].fire == 1)
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
else if (demo_.data_file[i][demo_.counter].fire_left == 1)
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
else if (demo_.data_file[i][demo_.counter].fire_right == 1)
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Si se pulsa cualquier tecla, se sale del modo demo
|
||||
if (input_->checkAnyButtonPressed())
|
||||
{
|
||||
section::name = section::Name::TITLE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
// Modo Demo no activo
|
||||
else
|
||||
{
|
||||
#ifdef RECORDING
|
||||
// Resetea el teclado
|
||||
demo.keys.left = 0;
|
||||
demo.keys.right = 0;
|
||||
demo.keys.no_input = 0;
|
||||
demo.keys.fire = 0;
|
||||
demo.keys.fire_left = 0;
|
||||
demo.keys.fire_right = 0;
|
||||
#endif
|
||||
for (auto &player : players_)
|
||||
{
|
||||
const auto controllerIndex = player->getController();
|
||||
const auto autofire = player->isPowerUp() || options.game.autofire;
|
||||
if (player->isPlaying())
|
||||
{
|
||||
// Input a la izquierda
|
||||
if (input_->checkInput(InputType::LEFT, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::LEFT);
|
||||
#ifdef RECORDING
|
||||
demo.keys.left = 1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// Input a la derecha
|
||||
if (input_->checkInput(InputType::RIGHT, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::RIGHT);
|
||||
#ifdef RECORDING
|
||||
demo.keys.right = 1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ninguno de los dos inputs anteriores
|
||||
player->setInput(InputType::NONE);
|
||||
#ifdef RECORDING
|
||||
demo.keys.no_input = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Comprueba el input de disparar al centro
|
||||
if (input_->checkInput(InputType::FIRE_CENTER, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
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);
|
||||
|
||||
// Reproduce el sonido de disparo
|
||||
JA_PlaySound(bullet_sound_);
|
||||
#ifdef RECORDING
|
||||
demo.keys.fire = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba el input de disparar a la izquierda
|
||||
else if (input_->checkInput(InputType::FIRE_LEFT, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
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);
|
||||
|
||||
// Reproduce el sonido de disparo
|
||||
JA_PlaySound(bullet_sound_);
|
||||
#ifdef RECORDING
|
||||
demo.keys.fire_left = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba el input de disparar a la derecha
|
||||
else if (input_->checkInput(InputType::FIRE_RIGHT, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
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);
|
||||
|
||||
// Reproduce el sonido de disparo
|
||||
JA_PlaySound(bullet_sound_);
|
||||
#ifdef RECORDING
|
||||
demo.keys.fire_right = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef RECORDING
|
||||
if (demo.recording)
|
||||
{
|
||||
if (demo.counter < TOTAL_DEMO_DATA)
|
||||
{
|
||||
demo.dataFile[0][demo.counter] = demo.keys;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (player->isContinue() || player->isWaiting())
|
||||
{
|
||||
// Si no está jugando, el botón de start le permite continuar jugando
|
||||
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(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();
|
||||
}
|
||||
}
|
||||
else if (player->isEnteringName())
|
||||
{
|
||||
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(InputType::START);
|
||||
addScoreToScoreBoard(player->getRecordName(), player->getScore());
|
||||
player->setStatusPlaying(PlayerStatus::CONTINUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->setInput(InputType::RIGHT);
|
||||
}
|
||||
}
|
||||
else if (input_->checkInput(InputType::UP, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::UP);
|
||||
}
|
||||
else if (input_->checkInput(InputType::DOWN, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::DOWN);
|
||||
}
|
||||
else if (input_->checkInput(InputType::LEFT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::LEFT);
|
||||
}
|
||||
else if (input_->checkInput(InputType::RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::RIGHT);
|
||||
}
|
||||
else if (input_->checkInput(InputType::START, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::START);
|
||||
addScoreToScoreBoard(player->getRecordName(), player->getScore());
|
||||
player->setStatusPlaying(PlayerStatus::CONTINUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba el input para el resto de objetos
|
||||
screen_->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Pinta diferentes mensajes en la pantalla
|
||||
void Game::renderMessages()
|
||||
{
|
||||
@@ -2566,3 +2313,224 @@ int Game::getController(int player_id)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Gestiona la entrada durante el juego
|
||||
void Game::checkInput()
|
||||
{
|
||||
checkPauseInput(); // Verifica si se debe pausar el juego.
|
||||
|
||||
if (demo_.enabled)
|
||||
{
|
||||
handleDemoMode(); // Controla el comportamiento de los jugadores en modo demo.
|
||||
}
|
||||
else
|
||||
{
|
||||
handlePlayersInput(); // Gestiona el input normal de los jugadores.
|
||||
}
|
||||
|
||||
screen_->checkInput(); // Verifica el input en la pantalla del juego.
|
||||
globalInputs::check(); // Verifica los inputs globales.
|
||||
}
|
||||
|
||||
// Verifica si alguno de los controladores ha solicitado una pausa y actualiza el estado de pausa del juego.
|
||||
void Game::checkPauseInput()
|
||||
{
|
||||
for (int i = 0; i < input_->getNumControllers(); ++i)
|
||||
{
|
||||
if (input_->checkModInput(InputType::SERVICE, InputType::PAUSE, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
pause(!paused_); // Alterna entre pausado y no pausado.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gestiona las entradas de los jugadores en el modo demo, incluyendo movimientos y disparos automáticos.
|
||||
void Game::handleDemoMode()
|
||||
{
|
||||
int i = 0;
|
||||
for (auto &player : players_)
|
||||
{
|
||||
if (player->isPlaying())
|
||||
{
|
||||
handleDemoPlayerInput(player, i); // Maneja el input específico del jugador en modo demo.
|
||||
}
|
||||
if (input_->checkAnyButtonPressed())
|
||||
{
|
||||
section::name = section::Name::TITLE; // Salir del modo demo y regresar al menú principal.
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Procesa las entradas para un jugador específico durante el modo demo.
|
||||
// Incluye movimientos (izquierda, derecha, sin movimiento) y disparos automáticos.
|
||||
void Game::handleDemoPlayerInput(const std::shared_ptr<Player> &player, int index)
|
||||
{
|
||||
const auto &demoData = demo_.data_file[index][demo_.counter];
|
||||
|
||||
if (demoData.left == 1)
|
||||
player->setInput(InputType::LEFT);
|
||||
else if (demoData.right == 1)
|
||||
player->setInput(InputType::RIGHT);
|
||||
else if (demoData.no_input == 1)
|
||||
player->setInput(InputType::NONE);
|
||||
|
||||
if (demoData.fire == 1)
|
||||
handleFireInput(player, BulletType::UP);
|
||||
else if (demoData.fire_left == 1)
|
||||
handleFireInput(player, BulletType::LEFT);
|
||||
else if (demoData.fire_right == 1)
|
||||
handleFireInput(player, BulletType::RIGHT);
|
||||
}
|
||||
|
||||
// Maneja el disparo de un jugador, incluyendo la creación de balas y la gestión del tiempo de espera entre disparos.
|
||||
void Game::handleFireInput(const std::shared_ptr<Player> &player, BulletType bulletType)
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
player->setInput(bulletType == BulletType::UP ? InputType::FIRE_CENTER : bulletType == BulletType::LEFT ? InputType::FIRE_LEFT
|
||||
: InputType::FIRE_RIGHT);
|
||||
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), bulletType, player->isPowerUp(), player->getId());
|
||||
player->setFireCooldown(10); // Establece un tiempo de espera para el próximo disparo.
|
||||
}
|
||||
}
|
||||
|
||||
// Gestiona las entradas de todos los jugadores en el modo normal (fuera del modo demo).
|
||||
void Game::handlePlayersInput()
|
||||
{
|
||||
for (auto &player : players_)
|
||||
{
|
||||
if (player->isPlaying())
|
||||
{
|
||||
handleNormalPlayerInput(player); // Maneja el input de los jugadores en modo normal.
|
||||
}
|
||||
else if (player->isContinue() || player->isWaiting())
|
||||
{
|
||||
handlePlayerContinue(player); // Gestiona la continuación del jugador.
|
||||
}
|
||||
else if (player->isEnteringName())
|
||||
{
|
||||
handleNameInput(player); // Gestiona la introducción del nombre del jugador.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Maneja las entradas de movimiento y disparo para un jugador en modo normal.
|
||||
void Game::handleNormalPlayerInput(const std::shared_ptr<Player> &player)
|
||||
{
|
||||
const auto controllerIndex = player->getController();
|
||||
const bool autofire = player->isPowerUp() || options.game.autofire;
|
||||
|
||||
if (input_->checkInput(InputType::LEFT, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::LEFT);
|
||||
#ifdef RECORDING
|
||||
demo.keys.left = 1;
|
||||
#endif
|
||||
}
|
||||
else if (input_->checkInput(InputType::RIGHT, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::RIGHT);
|
||||
#ifdef RECORDING
|
||||
demo.keys.right = 1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
player->setInput(InputType::NONE);
|
||||
#ifdef RECORDING
|
||||
demo.keys.no_input = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
handleFireInputs(player, autofire, controllerIndex); // Verifica y maneja todas las posibles entradas de disparo.
|
||||
}
|
||||
|
||||
// Procesa las entradas de disparo del jugador, permitiendo disparos automáticos si está habilitado.
|
||||
void Game::handleFireInputs(const std::shared_ptr<Player> &player, bool autofire, int controllerIndex)
|
||||
{
|
||||
if (input_->checkInput(InputType::FIRE_CENTER, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
handleFireInput(player, BulletType::UP);
|
||||
#ifdef RECORDING
|
||||
demo.keys.fire = 1;
|
||||
#endif
|
||||
}
|
||||
else if (input_->checkInput(InputType::FIRE_LEFT, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
handleFireInput(player, BulletType::LEFT);
|
||||
#ifdef RECORDING
|
||||
demo.keys.fire_left = 1;
|
||||
#endif
|
||||
}
|
||||
else if (input_->checkInput(InputType::FIRE_RIGHT, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
handleFireInput(player, BulletType::RIGHT);
|
||||
#ifdef RECORDING
|
||||
demo.keys.fire_right = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Maneja la continuación del jugador cuando no está jugando, permitiendo que continúe si se pulsa el botón de inicio.
|
||||
void Game::handlePlayerContinue(const std::shared_ptr<Player> &player)
|
||||
{
|
||||
const auto controllerIndex = player->getController();
|
||||
if (input_->checkInput(InputType::START, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setStatusPlaying(PlayerStatus::PLAYING);
|
||||
}
|
||||
|
||||
// Disminuye el contador de continuación si se presiona cualquier botón de disparo.
|
||||
if (input_->checkInput(InputType::FIRE_LEFT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index) ||
|
||||
input_->checkInput(InputType::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index) ||
|
||||
input_->checkInput(InputType::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->decContinueCounter();
|
||||
}
|
||||
}
|
||||
|
||||
// Procesa las entradas para la introducción del nombre del jugador.
|
||||
void Game::handleNameInput(const std::shared_ptr<Player> &player)
|
||||
{
|
||||
const auto controllerIndex = player->getController();
|
||||
if (input_->checkInput(InputType::FIRE_LEFT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index) ||
|
||||
input_->checkInput(InputType::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index) ||
|
||||
input_->checkInput(InputType::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
if (player->getRecordNamePos() == 7)
|
||||
{
|
||||
player->setInput(InputType::START);
|
||||
addScoreToScoreBoard(player->getRecordName(), player->getScore());
|
||||
player->setStatusPlaying(PlayerStatus::CONTINUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->setInput(InputType::RIGHT);
|
||||
}
|
||||
}
|
||||
else if (input_->checkInput(InputType::UP, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::UP);
|
||||
}
|
||||
else if (input_->checkInput(InputType::DOWN, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::DOWN);
|
||||
}
|
||||
else if (input_->checkInput(InputType::LEFT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::LEFT);
|
||||
}
|
||||
else if (input_->checkInput(InputType::RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::RIGHT);
|
||||
}
|
||||
else if (input_->checkInput(InputType::START, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
|
||||
{
|
||||
player->setInput(InputType::START);
|
||||
addScoreToScoreBoard(player->getRecordName(), player->getScore());
|
||||
player->setStatusPlaying(PlayerStatus::CONTINUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,9 +369,6 @@ private:
|
||||
// Actualiza el fondo
|
||||
void updateBackground();
|
||||
|
||||
// Gestiona la entrada durante el juego
|
||||
void checkInput();
|
||||
|
||||
// Pinta diferentes mensajes en la pantalla
|
||||
void renderMessages();
|
||||
|
||||
@@ -441,6 +438,37 @@ private:
|
||||
// Obtiene un controlador a partir del "id" del jugador
|
||||
int getController(int playerId);
|
||||
|
||||
// Gestiona la entrada durante el juego
|
||||
void checkInput();
|
||||
|
||||
// Verifica si alguno de los controladores ha solicitado una pausa y actualiza el estado de pausa del juego.
|
||||
void checkPauseInput();
|
||||
|
||||
// Gestiona las entradas de los jugadores en el modo demo, incluyendo movimientos y disparos automáticos.
|
||||
void handleDemoMode();
|
||||
|
||||
// Procesa las entradas para un jugador específico durante el modo demo.
|
||||
// Incluye movimientos (izquierda, derecha, sin movimiento) y disparos automáticos.
|
||||
void handleDemoPlayerInput(const std::shared_ptr<Player> &player, int index);
|
||||
|
||||
// Maneja el disparo de un jugador, incluyendo la creación de balas y la gestión del tiempo de espera entre disparos.
|
||||
void handleFireInput(const std::shared_ptr<Player> &player, BulletType bulletType);
|
||||
|
||||
// Gestiona las entradas de todos los jugadores en el modo normal (fuera del modo demo).
|
||||
void handlePlayersInput();
|
||||
|
||||
// Maneja las entradas de movimiento y disparo para un jugador en modo normal.
|
||||
void handleNormalPlayerInput(const std::shared_ptr<Player> &player);
|
||||
|
||||
// Procesa las entradas de disparo del jugador, permitiendo disparos automáticos si está habilitado.
|
||||
void handleFireInputs(const std::shared_ptr<Player> &player, bool autofire, int controllerIndex);
|
||||
|
||||
// Maneja la continuación del jugador cuando no está jugando, permitiendo que continúe si se pulsa el botón de inicio.
|
||||
void handlePlayerContinue(const std::shared_ptr<Player> &player);
|
||||
|
||||
// Procesa las entradas para la introducción del nombre del jugador.
|
||||
void handleNameInput(const std::shared_ptr<Player> &player);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Game(int playerID, int current_stage, bool demo, JA_Music_t *music);
|
||||
|
||||
Reference in New Issue
Block a user