Movido 'autofire' de param.txt a config.txt

This commit is contained in:
2024-09-02 11:40:50 +02:00
parent f57a307991
commit fa76520c6d
4 changed files with 9 additions and 11 deletions

View File

@@ -2,7 +2,6 @@
gameWidth 320 gameWidth 320
gameHeight 240 gameHeight 240
itemSize 20 itemSize 20
autofire true
## FADE ## FADE
numSquaresWidth 160 numSquaresWidth 160

View File

@@ -135,7 +135,7 @@ struct op_game_t
{ {
Uint8 difficulty; // Dificultad del juego Uint8 difficulty; // Dificultad del juego
Uint8 language; // Idioma usado en el juego Uint8 language; // Idioma usado en el juego
bool autofire; // Indica si se va a usar el disparo automático para el disparo normal bool autofire; // Indica si el jugador ha de pulsar repetidamente para disparar o basta con mantener pulsado
std::vector<hiScoreEntry_t> hiScoreTable; // Tabla con las mejores puntuaciones std::vector<hiScoreEntry_t> hiScoreTable; // Tabla con las mejores puntuaciones
}; };
@@ -183,7 +183,6 @@ struct param_t
int gameWidth; // Ancho de la resolucion nativa del juego int gameWidth; // Ancho de la resolucion nativa del juego
int gameHeight; // Alto de la resolucion nativa del juego int gameHeight; // Alto de la resolucion nativa del juego
int itemSize; // Tamaño 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 // FADE
int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el FADE_RANDOM_SQUARE int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el FADE_RANDOM_SQUARE

View File

@@ -152,7 +152,7 @@ void Director::initInput()
// Mando - Otros // Mando - Otros
input->bindGameControllerButton(i, input_accept, SDL_CONTROLLER_BUTTON_START); input->bindGameControllerButton(i, input_accept, SDL_CONTROLLER_BUTTON_START);
input->bindGameControllerButton(i, input_cancel, SDL_CONTROLLER_BUTTON_A); input->bindGameControllerButton(i, input_cancel, SDL_CONTROLLER_BUTTON_A);
//input->bindGameControllerButton(i, input_pause, SDL_CONTROLLER_BUTTON_B); // input->bindGameControllerButton(i, input_pause, SDL_CONTROLLER_BUTTON_B);
input->bindGameControllerButton(i, input_exit, SDL_CONTROLLER_BUTTON_BACK); input->bindGameControllerButton(i, input_exit, SDL_CONTROLLER_BUTTON_BACK);
} }
@@ -427,7 +427,6 @@ void Director::loadParams()
loadParam(param, asset->get("param.txt")); loadParam(param, asset->get("param.txt"));
// Modifica las opciones desde el fichero de parametros // 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.width = options->video.window.size * param->gameWidth;
options->video.window.height = options->video.window.size * param->gameHeight; options->video.window.height = options->video.window.size * param->gameHeight;
options->video.gameWidth = param->gameWidth; options->video.gameWidth = param->gameWidth;
@@ -473,6 +472,7 @@ void Director::initOptions()
// Opciones de juego // Opciones de juego
options->game.difficulty = DIFFICULTY_NORMAL; options->game.difficulty = DIFFICULTY_NORMAL;
options->game.language = ba_BA; options->game.language = ba_BA;
options->game.autofire = true;
// Opciones de control // Opciones de control
options->controller.clear(); options->controller.clear();
@@ -736,6 +736,7 @@ bool Director::saveConfigFile()
file << "game.language=" + std::to_string(options->game.language) + "\n"; file << "game.language=" + std::to_string(options->game.language) + "\n";
file << "game.difficulty=" + std::to_string(options->game.difficulty) + "\n"; file << "game.difficulty=" + std::to_string(options->game.difficulty) + "\n";
file << "game.autofire=" + boolToString(options->game.autofire) + "\n";
// Opciones de mandos // Opciones de mandos
file << "\n\n## CONTROLLERS\n"; file << "\n\n## CONTROLLERS\n";
@@ -1021,6 +1022,11 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
options->game.difficulty = std::stoi(value); options->game.difficulty = std::stoi(value);
} }
else if (var == "game.autofire")
{
options->game.autofire = stringToBool(value);
}
// Opciones de mandos // Opciones de mandos
else if (var == "controller1.name") else if (var == "controller1.name")
{ {

View File

@@ -12,7 +12,6 @@ void initParam(param_t *param)
param->gameWidth = 320; param->gameWidth = 320;
param->gameHeight = 240; param->gameHeight = 240;
param->itemSize = 20; param->itemSize = 20;
param->autofire = true;
// SCOREBOARD // SCOREBOARD
param->scoreboard = {0, 200, 320, 40}; param->scoreboard = {0, 200, 320, 40};
@@ -155,11 +154,6 @@ bool setOptions(param_t *param, std::string var, std::string value)
param->itemSize = std::stoi(value); param->itemSize = std::stoi(value);
} }
else if (var == "autofire")
{
param->autofire = stringToBool(value);
}
// FADE // FADE
else if (var == "numSquaresWidth") else if (var == "numSquaresWidth")
{ {