Ja es pot "enner llour neim". Falta decidir quin de tots els dissenys m'agrada mes

This commit is contained in:
2024-09-29 22:25:31 +02:00
parent edc45b6cec
commit 2d5859b1c4
9 changed files with 327 additions and 99 deletions

View File

@@ -16,6 +16,7 @@
#include "enemy_formations.h" // for stage_t, EnemyFormations, enemyIni...
#include "explosions.h" // for Explosions
#include "fade.h" // for Fade, FADE_RANDOM_SQUARE, FADE_VEN...
#include "global_inputs.h" // for checkGlobalInputs
#include "input.h" // for inputs_e, Input, INPUT_DO_NOT_ALLO...
#include "item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK
#include "jail_audio.h" // for JA_PlaySound, JA_DeleteSound, JA_L...
@@ -2054,48 +2055,9 @@ void Game::updateMenace()
// Gestiona la entrada durante el juego
void Game::checkInput()
{
// Comprueba si se sale con el teclado
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
quit(section::OPTIONS_QUIT_NORMAL);
return;
}
// Comprueba si se va a resetear el juego
if (input->checkInput(input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
section::name = section::NAME_INIT;
screen->showNotification("Reset");
return;
}
// Comprueba si se pulsa el botón de pausa
for (int i = 0; i < input->getNumControllers(); ++i)
{
// Comprueba si se sale con el mando
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
quit(section::OPTIONS_QUIT_SHUTDOWN);
return;
}
// Comprueba si se va a resetear el juego
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
section::name = section::NAME_LOGO;
screen->showNotification("Reset");
return;
}
// Comprueba si se va a activar o desactivar el audio
if (input->checkModInput(input_service, input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
options.audio.sound.enabled = options.audio.music.enabled = !options.audio.music.enabled;
JA_EnableMusic(options.audio.music.enabled);
JA_EnableSound(options.audio.sound.enabled);
screen->showNotification("Audio " + boolToOnOff(options.audio.music.enabled));
return;
}
// Comprueba si se va a pausar el juego
if (input->checkModInput(input_service, input_pause, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
@@ -2275,10 +2237,10 @@ void Game::checkInput()
}
#endif
}
else
else if (player->isContinue())
{
// Si no está jugando, el botón de start le permite continuar jugando
if (input->checkInput(input_start, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
{
// Si no ha entrado ya en el estado de game over, entonces se puede continuar
if (gameOverCounter == GAME_OVER_COUNTER)
@@ -2288,19 +2250,60 @@ void Game::checkInput()
}
// Si está continuando, los botones de fuego hacen decrementar el contador
const bool fire1 = input->checkInput(input_fire_left, false, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const bool fire2 = input->checkInput(input_fire_center, false, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const bool fire3 = input->checkInput(input_fire_right, false, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const bool fire1 = input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const bool fire2 = input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const bool fire3 = input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
if (fire1 || fire2 || fire3)
{
player->decContinueCounter();
}
}
else if (player->isEnteringName())
{
const bool fire1 = input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const bool fire2 = input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const bool fire3 = input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
if (fire1 || fire2 || fire3)
{
player->setInput(input_right);
if (player->getRecordNamePos() == 7)
{
player->setInput(input_start);
addScoreToScoreBoard(player->getRecordName(), player->getScore());
player->setStatusPlaying(PLAYER_STATUS_CONTINUE);
}
}
else if (input->checkInput(input_up, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
{
player->setInput(input_up);
}
else if (input->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
{
player->setInput(input_down);
}
else if (input->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
{
player->setInput(input_left);
}
else if (input->checkInput(input_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
{
player->setInput(input_right);
}
else if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
{
player->setInput(input_start);
addScoreToScoreBoard(player->getRecordName(), player->getScore());
player->setStatusPlaying(PLAYER_STATUS_CONTINUE);
}
}
}
}
// Comprueba el input para el resto de objetos
screen->checkInput();
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
checkGlobalInputs();
}
// Pinta diferentes mensajes en la pantalla
@@ -2789,7 +2792,7 @@ void Game::pause(bool value)
// Añade una puntuación a la tabla de records
void Game::addScoreToScoreBoard(std::string name, int score)
{
const hiScoreEntry_t entry = {name, score};
const hiScoreEntry_t entry = {trim(name), score};
ManageHiScoreTable *manager = new ManageHiScoreTable(&options.game.hiScoreTable);
manager->add(entry);
delete manager;
@@ -2822,6 +2825,8 @@ void Game::checkPlayersStatusPlaying()
case PLAYER_STATUS_ENTERING_NAME:
scoreboard->setMode(player->getScoreBoardPanel(), SCOREBOARD_MODE_ENTER_NAME);
scoreboard->setRecordName(player->getScoreBoardPanel(), player->getRecordName());
scoreboard->setSelectorPos(player->getScoreBoardPanel(), player->getRecordNamePos());
break;
case PLAYER_STATUS_DYING: