Añadida opción para intercambiar los jugadores de los dos primeros mandos

This commit is contained in:
2024-09-11 13:59:40 +02:00
parent ecf34558f4
commit 3d41da0fdf
5 changed files with 55 additions and 38 deletions

View File

@@ -91,26 +91,16 @@ void Title::update()
fade->update();
if (fade->hasEnded())
{
switch (postFade)
if (postFade == -1)
{
case 1: // 1 PLAYER
section->name = SECTION_PROG_GAME;
section->options = SECTION_OPTIONS_GAME_PLAY_1P;
JA_StopMusic();
break;
case 2: // 2 PLAYER
section->name = SECTION_PROG_GAME;
section->options = SECTION_OPTIONS_GAME_PLAY_2P;
JA_StopMusic();
break;
case 3: // TIME OUT
section->name = SECTION_PROG_GAME_DEMO;
break;
default:
break;
}
else
{
section->name = SECTION_PROG_GAME;
section->options = postFade;
JA_StopMusic();
}
}
@@ -148,7 +138,7 @@ void Title::update()
if (counter == param->title.titleDuration)
{
fade->activate();
postFade = 3;
postFade = -1;
}
}
}
@@ -220,6 +210,28 @@ void Title::checkEvents()
reLoadTextures();
}
else if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0)
{
switch (eventHandler->key.keysym.sym)
{
case SDLK_1:
defineButtons->enable(0);
break;
case SDLK_2:
defineButtons->enable(1);
break;
case SDLK_3:
defineButtons->swapControllers();
screen->showNotification("Swap Controllers");
break;
default:
break;
}
}
// Comprueba en el primer mando el botón de salir del programa
// else if (eventHandler->type == SDL_CONTROLLERBUTTONDOWN)
//{
@@ -257,22 +269,10 @@ void Title::checkInput()
if (section->options == SECTION_OPTIONS_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
{
fade->activate();
postFade = 1;
postFade = options->controller[0].playerId;
}
}
// Comprueba si se ha pulsado la tecla 1 o 2 para definir los controladores
const Uint8 *keyStates = SDL_GetKeyboardState(nullptr);
if (keyStates[SDL_SCANCODE_1] != 0)
{
defineButtons->enable(0);
}
else if (keyStates[SDL_SCANCODE_2] != 0)
{
defineButtons->enable(1);
}
//////////////////////////////////////////////////
// MANDO //
@@ -306,7 +306,7 @@ void Title::checkInput()
if (section->options == SECTION_OPTIONS_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
{
fade->activate();
postFade = i + 1;
postFade = options->controller[i].playerId;
}
}
}