corregidos varios bugs
This commit is contained in:
@@ -339,14 +339,14 @@ void Screen::checkInput()
|
|||||||
const std::string size = std::to_string(options->video.window.size);
|
const std::string size = std::to_string(options->video.window.size);
|
||||||
showNotification("Window size x" + size);
|
showNotification("Window size x" + size);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
else if (input->checkInput(input_video_shaders, DO_NOT_ALLOW_REPEAT))
|
if (input->checkInput(input_video_shaders, DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
switchShaders();
|
switchShaders();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (input->checkInput(input_showinfo, DO_NOT_ALLOW_REPEAT))
|
else if (input->checkInput(input_showinfo, DO_NOT_ALLOW_REPEAT))
|
||||||
{
|
{
|
||||||
showInfo = !showInfo;
|
showInfo = !showInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,14 +125,17 @@ void DefineButtons::checkInput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Habilita el objeto
|
// Habilita el objeto
|
||||||
void DefineButtons::enable(int index)
|
bool DefineButtons::enable(int index)
|
||||||
{
|
{
|
||||||
if (input->getNumControllers() > 0)
|
if (index < input->getNumControllers())
|
||||||
{
|
{
|
||||||
enabled = true;
|
enabled = true;
|
||||||
indexController = index;
|
indexController = index;
|
||||||
indexButton = 0;
|
indexButton = 0;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si está habilitado
|
// Comprueba si está habilitado
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
void checkInput();
|
void checkInput();
|
||||||
|
|
||||||
// Habilita el objeto
|
// Habilita el objeto
|
||||||
void enable(int index);
|
bool enable(int index);
|
||||||
|
|
||||||
// Comprueba si está habilitado
|
// Comprueba si está habilitado
|
||||||
bool isEnabled();
|
bool isEnabled();
|
||||||
|
|||||||
@@ -902,7 +902,7 @@ void Director::runHiScoreTable()
|
|||||||
// Ejecuta el juego en modo demo
|
// Ejecuta el juego en modo demo
|
||||||
void Director::runDemoGame()
|
void Director::runDemoGame()
|
||||||
{
|
{
|
||||||
const int playerID = rand() % 2;
|
const int playerID = (rand() % 2) + 1;
|
||||||
demoGame = new Game(playerID, 0, screen, asset, lang, input, true, param, options, section, nullptr);
|
demoGame = new Game(playerID, 0, screen, asset, lang, input, true, param, options, section, nullptr);
|
||||||
demoGame->run();
|
demoGame->run();
|
||||||
delete demoGame;
|
delete demoGame;
|
||||||
|
|||||||
@@ -2098,7 +2098,7 @@ void Game::checkInput()
|
|||||||
if (player->canFire())
|
if (player->canFire())
|
||||||
{
|
{
|
||||||
player->setInput(input_fire_center);
|
player->setInput(input_fire_center);
|
||||||
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_UP, player->isPowerUp(), i);
|
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_UP, player->isPowerUp(), player->getId());
|
||||||
player->setFireCooldown(10);
|
player->setFireCooldown(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2108,7 +2108,7 @@ void Game::checkInput()
|
|||||||
if (player->canFire())
|
if (player->canFire())
|
||||||
{
|
{
|
||||||
player->setInput(input_fire_left);
|
player->setInput(input_fire_left);
|
||||||
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_LEFT, player->isPowerUp(), i);
|
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_LEFT, player->isPowerUp(), player->getId());
|
||||||
player->setFireCooldown(10);
|
player->setFireCooldown(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2118,7 +2118,7 @@ void Game::checkInput()
|
|||||||
if (player->canFire())
|
if (player->canFire())
|
||||||
{
|
{
|
||||||
player->setInput(input_fire_right);
|
player->setInput(input_fire_right);
|
||||||
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_RIGHT, player->isPowerUp(), i);
|
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_RIGHT, player->isPowerUp(), player->getId());
|
||||||
player->setFireCooldown(10);
|
player->setFireCooldown(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ void Title::update()
|
|||||||
if (postFade == -1)
|
if (postFade == -1)
|
||||||
{
|
{
|
||||||
section->name = SECTION_PROG_GAME_DEMO;
|
section->name = SECTION_PROG_GAME_DEMO;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -215,33 +214,25 @@ void Title::checkEvents()
|
|||||||
switch (eventHandler->key.keysym.sym)
|
switch (eventHandler->key.keysym.sym)
|
||||||
{
|
{
|
||||||
case SDLK_1:
|
case SDLK_1:
|
||||||
defineButtons->enable(0);
|
if (defineButtons->enable(0))
|
||||||
|
resetCounter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_2:
|
case SDLK_2:
|
||||||
defineButtons->enable(1);
|
if (defineButtons->enable(1))
|
||||||
|
resetCounter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_3:
|
case SDLK_3:
|
||||||
defineButtons->swapControllers();
|
defineButtons->swapControllers();
|
||||||
screen->showNotification("Swap Controllers");
|
screen->showNotification("Swap Controllers");
|
||||||
|
resetCounter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba en el primer mando el botón de salir del programa
|
|
||||||
// else if (eventHandler->type == SDL_CONTROLLERBUTTONDOWN)
|
|
||||||
//{
|
|
||||||
// if ((SDL_GameControllerButton)eventHandler->cbutton.which == 0)
|
|
||||||
// if ((SDL_GameControllerButton)eventHandler->cbutton.button == input->getControllerBinding(0, input_exit))
|
|
||||||
// {
|
|
||||||
// section->name = SECTION_PROG_QUIT;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +264,6 @@ void Title::checkInput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// MANDO //
|
// MANDO //
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
@@ -334,4 +324,10 @@ void Title::reLoadTextures()
|
|||||||
{
|
{
|
||||||
gameLogo->reLoad();
|
gameLogo->reLoad();
|
||||||
tiledbg->reLoad();
|
tiledbg->reLoad();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reinicia el contador interno
|
||||||
|
void Title::resetCounter()
|
||||||
|
{
|
||||||
|
counter = 0;
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ private:
|
|||||||
bool demo; // Indica si el modo demo estará activo
|
bool demo; // Indica si el modo demo estará activo
|
||||||
section_t nextSection; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo
|
section_t nextSection; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo
|
||||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||||
Uint8 postFade; // Opción a realizar cuando termina el fundido
|
int postFade; // Opción a realizar cuando termina el fundido
|
||||||
options_t *options; // Variable con todas las variables de las opciones del programa
|
options_t *options; // Variable con todas las variables de las opciones del programa
|
||||||
param_t *param; // Puntero con todos los parametros del programa
|
param_t *param; // Puntero con todos los parametros del programa
|
||||||
int numControllers; // Número de mandos conectados
|
int numControllers; // Número de mandos conectados
|
||||||
@@ -95,6 +95,9 @@ private:
|
|||||||
// Recarga las texturas
|
// Recarga las texturas
|
||||||
void reLoadTextures();
|
void reLoadTextures();
|
||||||
|
|
||||||
|
// Reinicia el contador interno
|
||||||
|
void resetCounter();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music);
|
Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music);
|
||||||
|
|||||||
Reference in New Issue
Block a user