Renombradas las variables de opciones
Actualizado el fichero de configuración
This commit is contained in:
@@ -56,7 +56,7 @@ Director::Director(int argc, char *argv[])
|
||||
|
||||
// Crea los objetos
|
||||
lang = new Lang(asset);
|
||||
lang->setLang(options->language);
|
||||
lang->setLang(options->game.language);
|
||||
|
||||
input = new Input(asset->get("gamecontrollerdb.txt"));
|
||||
initInput();
|
||||
@@ -397,18 +397,18 @@ void Director::initOptions()
|
||||
options = new options_t;
|
||||
|
||||
// Pone unos valores por defecto para las opciones de control
|
||||
options->input.clear();
|
||||
options->game.input.clear();
|
||||
|
||||
input_t inp;
|
||||
inp.id = 0;
|
||||
inp.name = "KEYBOARD";
|
||||
inp.deviceType = INPUT_USE_KEYBOARD;
|
||||
options->input.push_back(inp);
|
||||
options->game.input.push_back(inp);
|
||||
|
||||
inp.id = 0;
|
||||
inp.name = "GAME CONTROLLER";
|
||||
inp.deviceType = INPUT_USE_GAMECONTROLLER;
|
||||
options->input.push_back(inp);
|
||||
options->game.input.push_back(inp);
|
||||
|
||||
// Opciones de video
|
||||
options->video.mode = 0;
|
||||
@@ -431,9 +431,9 @@ void Director::initOptions()
|
||||
options->audio.sound.volume = 64;
|
||||
|
||||
// Opciones varios
|
||||
options->playerSelected = 0;
|
||||
options->difficulty = DIFFICULTY_NORMAL;
|
||||
options->language = ba_BA;
|
||||
options->game.playerSelected = 0;
|
||||
options->game.difficulty = DIFFICULTY_NORMAL;
|
||||
options->game.language = ba_BA;
|
||||
options->console = false;
|
||||
}
|
||||
|
||||
@@ -569,9 +569,9 @@ bool Director::loadConfigFile()
|
||||
options->video.window.size = 3;
|
||||
}
|
||||
|
||||
if (options->language < 0 || options->language > MAX_LANGUAGES)
|
||||
if (options->game.language < 0 || options->game.language > MAX_LANGUAGES)
|
||||
{
|
||||
options->language = en_UK;
|
||||
options->game.language = en_UK;
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -602,55 +602,55 @@ bool Director::saveConfigFile()
|
||||
|
||||
// Opciones de video
|
||||
file << "## VIDEO\n";
|
||||
file << "## video mode can be: 0, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP\n";
|
||||
file << "## video.mode [0, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP]\n";
|
||||
file << "## video.filter [FILTER_NEAREST, FILTER_LINEAL]\n";
|
||||
file << "\n";
|
||||
|
||||
if (options->video.mode == 0)
|
||||
{
|
||||
file << "mode=0\n";
|
||||
file << "video.mode=0\n";
|
||||
}
|
||||
|
||||
else if (options->video.mode == SDL_WINDOW_FULLSCREEN)
|
||||
{
|
||||
file << "mode=SDL_WINDOW_FULLSCREEN\n";
|
||||
file << "video.mode=SDL_WINDOW_FULLSCREEN\n";
|
||||
}
|
||||
|
||||
else if (options->video.mode == SDL_WINDOW_FULLSCREEN_DESKTOP)
|
||||
{
|
||||
file << "mode=SDL_WINDOW_FULLSCREEN_DESKTOP\n";
|
||||
file << "video.mode=SDL_WINDOW_FULLSCREEN_DESKTOP\n";
|
||||
}
|
||||
|
||||
file << "window.size=" + std::to_string(options->video.window.size) + "\n";
|
||||
file << "video.window.size=" + std::to_string(options->video.window.size) + "\n";
|
||||
|
||||
file << "## filter can be: FILTER_NEAREST, FILTER_LINEAL\n";
|
||||
if (options->video.filter == FILTER_NEAREST)
|
||||
{
|
||||
file << "filter=FILTER_NEAREST\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
file << "filter=FILTER_LINEAL\n";
|
||||
}
|
||||
options->video.filter == FILTER_NEAREST ? file << "video.filter=FILTER_NEAREST\n" : file << "video.filter=FILTER_LINEAL\n";
|
||||
|
||||
file << "vSync=" + boolToString(options->video.vSync) + "\n";
|
||||
file << "integerScale=" + boolToString(options->video.integerScale) + "\n";
|
||||
file << "keepAspect=" + boolToString(options->video.keepAspect) + "\n";
|
||||
file << "border.enabled=" + boolToString(options->video.border.enabled) + "\n";
|
||||
file << "border.width=" + std::to_string(options->video.border.width) + "\n";
|
||||
file << "border.height=" + std::to_string(options->video.border.height) + "\n";
|
||||
file << "video.shaders=" + boolToString(options->video.shaders) + "\n";
|
||||
file << "video.vSync=" + boolToString(options->video.vSync) + "\n";
|
||||
file << "video.integerScale=" + boolToString(options->video.integerScale) + "\n";
|
||||
file << "video.keepAspect=" + boolToString(options->video.keepAspect) + "\n";
|
||||
file << "video.border.enabled=" + boolToString(options->video.border.enabled) + "\n";
|
||||
file << "video.border.width=" + std::to_string(options->video.border.width) + "\n";
|
||||
file << "video.border.height=" + std::to_string(options->video.border.height) + "\n";
|
||||
|
||||
// Opciones de audio
|
||||
file << "\n## AUDIO\n";
|
||||
file << "music.enabled=" + boolToString(options->audio.music.enabled) + "\n";
|
||||
file << "music.volume=" + std::to_string(options->audio.music.volume) + "\n";
|
||||
file << "sound.enabled=" + boolToString(options->audio.sound.enabled) + "\n";
|
||||
file << "sound.volume=" + std::to_string(options->audio.sound.volume) + "\n";
|
||||
file << "\n\n## AUDIO\n";
|
||||
file << "## volume [0 .. 128]\n";
|
||||
file << "\n";
|
||||
|
||||
file << "audio.music.enabled=" + boolToString(options->audio.music.enabled) + "\n";
|
||||
file << "audio.music.volume=" + std::to_string(options->audio.music.volume) + "\n";
|
||||
file << "audio.sound.enabled=" + boolToString(options->audio.sound.enabled) + "\n";
|
||||
file << "audio.sound.volume=" + std::to_string(options->audio.sound.volume) + "\n";
|
||||
|
||||
// Opciones del juego
|
||||
file << "\n## GAME\n";
|
||||
file << "language=" + std::to_string(options->language) + "\n";
|
||||
file << "difficulty=" + std::to_string(options->difficulty) + "\n";
|
||||
file << "input0=" + std::to_string(options->input[0].deviceType) + "\n";
|
||||
file << "input1=" + std::to_string(options->input[1].deviceType) + "\n";
|
||||
file << "\n\n## GAME\n";
|
||||
file << "\n";
|
||||
|
||||
file << "game.language=" + std::to_string(options->game.language) + "\n";
|
||||
file << "game.difficulty=" + std::to_string(options->game.difficulty) + "\n";
|
||||
file << "game.input0=" + std::to_string(options->game.input[0].deviceType) + "\n";
|
||||
file << "game.input1=" + std::to_string(options->game.input[1].deviceType) + "\n";
|
||||
|
||||
// Cierra el fichero
|
||||
file.close();
|
||||
@@ -760,7 +760,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
bool success = true;
|
||||
|
||||
// Opciones de video
|
||||
if (var == "mode")
|
||||
if (var == "video.mode")
|
||||
{
|
||||
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
|
||||
{
|
||||
@@ -776,7 +776,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
}
|
||||
}
|
||||
|
||||
else if (var == "window.size")
|
||||
else if (var == "video.window.size")
|
||||
{
|
||||
options->video.window.size = std::stoi(value);
|
||||
if ((options->video.window.size < 1) || (options->video.window.size > 4))
|
||||
@@ -785,7 +785,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
}
|
||||
}
|
||||
|
||||
else if (var == "filter")
|
||||
else if (var == "video.filter")
|
||||
{
|
||||
if (value == "FILTER_LINEAL")
|
||||
{
|
||||
@@ -797,81 +797,81 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
}
|
||||
}
|
||||
|
||||
else if (var == "vSync")
|
||||
{
|
||||
options->video.vSync = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "integerScale")
|
||||
{
|
||||
options->video.integerScale = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "keepAspect")
|
||||
{
|
||||
options->video.keepAspect = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "border.enabled")
|
||||
{
|
||||
options->video.border.enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "border.width")
|
||||
{
|
||||
options->video.border.width = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "border.height")
|
||||
{
|
||||
options->video.border.height = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "video.shaders")
|
||||
{
|
||||
options->video.shaders = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "video.vSync")
|
||||
{
|
||||
options->video.vSync = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "video.integerScale")
|
||||
{
|
||||
options->video.integerScale = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "video.keepAspect")
|
||||
{
|
||||
options->video.keepAspect = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "video.border.enabled")
|
||||
{
|
||||
options->video.border.enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "video.border.width")
|
||||
{
|
||||
options->video.border.width = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "video.border.height")
|
||||
{
|
||||
options->video.border.height = std::stoi(value);
|
||||
}
|
||||
|
||||
// Opciones de audio
|
||||
else if (var == "music.enabled")
|
||||
else if (var == "audio.music.enabled")
|
||||
{
|
||||
options->audio.music.enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "music.volume")
|
||||
else if (var == "audio.music.volume")
|
||||
{
|
||||
options->audio.music.volume = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "sound.enabled")
|
||||
else if (var == "audio.sound.enabled")
|
||||
{
|
||||
options->audio.sound.enabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "sound.volume")
|
||||
else if (var == "audio.sound.volume")
|
||||
{
|
||||
options->audio.sound.volume = std::stoi(value);
|
||||
}
|
||||
|
||||
// Opciones de juego
|
||||
else if (var == "language")
|
||||
else if (var == "game.language")
|
||||
{
|
||||
options->language = std::stoi(value);
|
||||
options->game.language = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "difficulty")
|
||||
else if (var == "game.difficulty")
|
||||
{
|
||||
options->difficulty = std::stoi(value);
|
||||
options->game.difficulty = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "input0")
|
||||
else if (var == "game.input0")
|
||||
{
|
||||
options->input[0].deviceType = std::stoi(value);
|
||||
options->game.input[0].deviceType = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "input1")
|
||||
else if (var == "game.input1")
|
||||
{
|
||||
options->input[1].deviceType = std::stoi(value);
|
||||
options->game.input[1].deviceType = std::stoi(value);
|
||||
}
|
||||
|
||||
// Lineas vacias o que empiezan por comentario
|
||||
|
||||
Reference in New Issue
Block a user