Reasignados los controles para ordenador, mando y consola

This commit is contained in:
2023-02-12 18:50:40 +01:00
parent ca99857b5b
commit cbb5d54250
8 changed files with 154 additions and 140 deletions

View File

@@ -3018,33 +3018,34 @@ void Game::checkGameInput()
const int index = 0;
if (demo.dataFile[demo.counter].left == 1)
{
players[index]->setInput(INPUT_LEFT);
players[index]->setInput(input_left);
}
if (demo.dataFile[demo.counter].right == 1)
{
players[index]->setInput(INPUT_RIGHT);
players[index]->setInput(input_right);
}
if (demo.dataFile[demo.counter].noInput == 1)
{
players[index]->setInput(INPUT_NULL);
players[index]->setInput(input_null);
}
if (demo.dataFile[demo.counter].fire == 1)
{
if (players[index]->canFire())
{
players[index]->setInput(INPUT_BUTTON_2);
players[index]->setInput(input_fire_center);
createBullet(players[index]->getPosX() + (players[index]->getWidth() / 2) - 4, players[index]->getPosY() + (players[index]->getHeight() / 2), BULLET_UP, players[index]->isPowerUp(), index);
players[index]->setFireCooldown(10);
}
}
if (demo.dataFile[demo.counter].fireLeft == 1)
{
if (players[index]->canFire())
{
players[index]->setInput(INPUT_BUTTON_1);
players[index]->setInput(input_fire_left);
createBullet(players[index]->getPosX() + (players[index]->getWidth() / 2) - 4, players[index]->getPosY() + (players[index]->getHeight() / 2), BULLET_UP, players[index]->isPowerUp(), index);
players[index]->setFireCooldown(10);
}
@@ -3054,14 +3055,14 @@ void Game::checkGameInput()
{
if (players[index]->canFire())
{
players[index]->setInput(INPUT_BUTTON_3);
players[index]->setInput(input_fire_right);
createBullet(players[index]->getPosX() + (players[index]->getWidth() / 2) - 4, players[index]->getPosY() + (players[index]->getHeight() / 2), BULLET_UP, players[index]->isPowerUp(), index);
players[index]->setFireCooldown(10);
}
}
// Comprueba el input de pausa
if (input->checkInput(INPUT_BUTTON_PAUSE, REPEAT_FALSE))
if (input->checkInput(input_pause, REPEAT_FALSE))
{
section.name = PROG_SECTION_TITLE;
}
@@ -3085,32 +3086,32 @@ void Game::checkGameInput()
if (player->isAlive())
{
// Input a la izquierda
if (input->checkInput(INPUT_LEFT, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
if (input->checkInput(input_left, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
{
player->setInput(INPUT_LEFT);
player->setInput(input_left);
demo.keys.left = 1;
}
else
{
// Input a la derecha
if (input->checkInput(INPUT_RIGHT, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
if (input->checkInput(input_right, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
{
player->setInput(INPUT_RIGHT);
player->setInput(input_right);
demo.keys.right = 1;
}
else
{
// Ninguno de los dos inputs anteriores
player->setInput(INPUT_NULL);
player->setInput(input_null);
demo.keys.noInput = 1;
}
}
// Comprueba el input de disparar al centro
if (input->checkInput(INPUT_BUTTON_2, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
if (input->checkInput(input_fire_center, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
{
if (player->canFire())
{
player->setInput(INPUT_BUTTON_2);
player->setInput(input_fire_center);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_UP, player->isPowerUp(), i);
player->setFireCooldown(10);
@@ -3122,11 +3123,11 @@ void Game::checkGameInput()
}
// Comprueba el input de disparar a la izquierda
if (input->checkInput(INPUT_BUTTON_1, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
if (input->checkInput(input_fire_left, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
{
if (player->canFire())
{
player->setInput(INPUT_BUTTON_1);
player->setInput(input_fire_left);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_LEFT, player->isPowerUp(), i);
player->setFireCooldown(10);
@@ -3138,11 +3139,11 @@ void Game::checkGameInput()
}
// Comprueba el input de disparar a la derecha
if (input->checkInput(INPUT_BUTTON_3, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
if (input->checkInput(input_fire_right, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id))
{
if (player->canFire())
{
player->setInput(INPUT_BUTTON_3);
player->setInput(input_fire_right);
createBullet(player->getPosX() + (player->getWidth() / 2) - 4, player->getPosY() + (player->getHeight() / 2), BULLET_RIGHT, player->isPowerUp(), i);
player->setFireCooldown(10);
@@ -3154,7 +3155,7 @@ void Game::checkGameInput()
}
// Comprueba el input de pausa
if (input->checkInput(INPUT_CANCEL, REPEAT_FALSE, options->input[i].deviceType, options->input[i].id))
if (input->checkInput(input_cancel, REPEAT_FALSE, options->input[i].deviceType, options->input[i].id))
{
section.subsection = GAME_SECTION_PAUSE;
}