afegida la opció de controlar el autofire
This commit is contained in:
@@ -148,6 +148,7 @@ struct op_game_t
|
||||
{
|
||||
Uint8 difficulty; // Dificultad del juego
|
||||
Uint8 language; // Idioma usado en el juego
|
||||
bool autofire; // Indica si se va a usar el disparo automático para el disparo normal
|
||||
std::vector<hiScoreEntry_t> hiScoreTable; // Tabla con las mejores puntuaciones
|
||||
};
|
||||
|
||||
@@ -194,7 +195,8 @@ struct param_t
|
||||
// GAME
|
||||
int gameWidth; // Ancho de la resolucion nativa del juego
|
||||
int gameHeight; // Alto de la resolucion nativa del juego
|
||||
int itemSize; // Tamañoi de los items del juego
|
||||
int itemSize; // Tamaño de los items del juego
|
||||
int autofire; // Indica si se va a usar el disparo automático para el disparo normal
|
||||
|
||||
// FADE
|
||||
int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el FADE_RANDOM_SQUARE
|
||||
|
||||
@@ -424,6 +424,8 @@ void Director::loadParams()
|
||||
|
||||
loadParam(param, asset->get("param.txt"));
|
||||
|
||||
// Modifica las opciones desde el fichero de parametros
|
||||
options->game.autofire = param->autofire;
|
||||
options->video.window.width = options->video.window.size * param->gameWidth;
|
||||
options->video.window.height = options->video.window.size * param->gameHeight;
|
||||
options->video.gameWidth = param->gameWidth;
|
||||
|
||||
@@ -2235,6 +2235,7 @@ void Game::checkInput()
|
||||
int i = 0;
|
||||
for (auto player : players)
|
||||
{
|
||||
const bool autofire = player->isPowerUp() || options->game.autofire;
|
||||
if (player->isAlive() && player->isEnabled())
|
||||
{
|
||||
// Input a la izquierda
|
||||
@@ -2265,7 +2266,7 @@ void Game::checkInput()
|
||||
}
|
||||
}
|
||||
// Comprueba el input de disparar al centro
|
||||
if (input->checkInput(input_fire_center, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||
if (input->checkInput(input_fire_center, autofire, options->controller[i].deviceType, options->controller[i].index))
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
@@ -2282,7 +2283,7 @@ void Game::checkInput()
|
||||
}
|
||||
|
||||
// Comprueba el input de disparar a la izquierda
|
||||
else if (input->checkInput(input_fire_left, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||
else if (input->checkInput(input_fire_left, autofire, options->controller[i].deviceType, options->controller[i].index))
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
@@ -2299,7 +2300,7 @@ void Game::checkInput()
|
||||
}
|
||||
|
||||
// Comprueba el input de disparar a la derecha
|
||||
else if (input->checkInput(input_fire_right, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||
else if (input->checkInput(input_fire_right, autofire, options->controller[i].deviceType, options->controller[i].index))
|
||||
{
|
||||
if (player->canFire())
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ void initParam(param_t *param)
|
||||
param->gameWidth = 320;
|
||||
param->gameHeight = 240;
|
||||
param->itemSize = 20;
|
||||
param->autofire = true;
|
||||
|
||||
// SCOREBOARD
|
||||
param->scoreboard = {0, 200, 320, 40};
|
||||
@@ -154,6 +155,11 @@ bool setOptions(param_t *param, std::string var, std::string value)
|
||||
param->itemSize = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "autofire")
|
||||
{
|
||||
param->autofire = stringToBool(value);
|
||||
}
|
||||
|
||||
// FADE
|
||||
else if (var == "numSquaresWidth")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user