Options: renombrats els metodes

This commit is contained in:
2025-06-14 17:48:37 +02:00
parent c748070ba5
commit eee398802f
11 changed files with 84 additions and 84 deletions

View File

@@ -86,14 +86,14 @@ Director::~Director()
void Director::init() void Director::init()
{ {
// Configuración inicial de recursos // Configuración inicial de recursos
Asset::init(executable_path_); // Inicializa el sistema de gestión de archivos Asset::init(executable_path_); // Inicializa el sistema de gestión de archivos
setFileList(); // Crea el índice de archivos setFileList(); // Crea el índice de archivos
Options::loadOptionsFile(Asset::get()->get("config.txt")); // Carga el archivo de configuración Options::loadFromFile(Asset::get()->get("config.txt")); // Carga el archivo de configuración
loadParams(); // Carga los parámetros del programa loadParams(); // Carga los parámetros del programa
loadScoreFile(); // Carga el archivo de puntuaciones loadScoreFile(); // Carga el archivo de puntuaciones
// Inicialización de subsistemas principales // Inicialización de subsistemas principales
Lang::setLanguage(Options::game.language); // Carga el archivo de idioma Lang::setLanguage(Options::settings.language); // Carga el archivo de idioma
Screen::init(); // Inicializa la pantalla y el sistema de renderizado Screen::init(); // Inicializa la pantalla y el sistema de renderizado
Audio::init(); // Activa el sistema de audio Audio::init(); // Activa el sistema de audio
Resource::init(); // Inicializa el sistema de gestión de recursos Resource::init(); // Inicializa el sistema de gestión de recursos
@@ -108,7 +108,7 @@ void Director::init()
void Director::close() void Director::close()
{ {
// Guarda las opciones actuales en el archivo de configuración // Guarda las opciones actuales en el archivo de configuración
Options::saveOptionsFile(Asset::get()->get("config.txt")); Options::saveToFile(Asset::get()->get("config.txt"));
// Libera los singletons y recursos en orden inverso al de inicialización // Libera los singletons y recursos en orden inverso al de inicialización
Notifier::destroy(); // Libera el sistema de notificaciones Notifier::destroy(); // Libera el sistema de notificaciones
@@ -141,7 +141,7 @@ void Director::loadParams()
// Carga el fichero de puntuaciones // Carga el fichero de puntuaciones
void Director::loadScoreFile() void Director::loadScoreFile()
{ {
auto manager = std::make_unique<ManageHiScoreTable>(Options::game.hi_score_table); auto manager = std::make_unique<ManageHiScoreTable>(Options::settings.hi_score_table);
if (overrides.clear_hi_score_table) if (overrides.clear_hi_score_table)
{ {
manager->clear(); manager->clear();
@@ -617,9 +617,9 @@ void Director::runDemoGame()
// Reinicia objetos y vuelve a la sección inicial // Reinicia objetos y vuelve a la sección inicial
void Director::reset() void Director::reset()
{ {
Options::saveOptionsFile(Asset::get()->get("config.txt")); Options::saveToFile(Asset::get()->get("config.txt"));
Options::loadOptionsFile(Asset::get()->get("config.txt")); Options::loadFromFile(Asset::get()->get("config.txt"));
Lang::setLanguage(Options::game.language); Lang::setLanguage(Options::settings.language);
Audio::get()->stopMusic(); Audio::get()->stopMusic();
Audio::get()->stopAllSounds(); Audio::get()->stopAllSounds();
if (Section::options == Section::Options::RELOAD || true) if (Section::options == Section::Options::RELOAD || true)

View File

@@ -107,7 +107,7 @@ Game::~Game()
else else
{ {
// [Modo JUEGO] Guarda puntuaciones y transita a modo título // [Modo JUEGO] Guarda puntuaciones y transita a modo título
auto manager = std::make_unique<ManageHiScoreTable>(Options::game.hi_score_table); auto manager = std::make_unique<ManageHiScoreTable>(Options::settings.hi_score_table);
manager->saveToFile(Asset::get()->get("score.bin")); manager->saveToFile(Asset::get()->get("score.bin"));
Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO; Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO;
Audio::get()->stopMusic(); Audio::get()->stopMusic();
@@ -1267,10 +1267,10 @@ void Game::pause(bool value)
void Game::addScoreToScoreBoard(const std::shared_ptr<Player> &player) void Game::addScoreToScoreBoard(const std::shared_ptr<Player> &player)
{ {
const auto entry = HiScoreEntry(trim(player->getRecordName()), player->getScore(), player->get1CC()); const auto entry = HiScoreEntry(trim(player->getRecordName()), player->getScore(), player->get1CC());
auto manager = std::make_unique<ManageHiScoreTable>(Options::game.hi_score_table); auto manager = std::make_unique<ManageHiScoreTable>(Options::settings.hi_score_table);
Options::game.last_hi_score_entry.at(player->getId() - 1) = manager->add(entry); Options::settings.last_hi_score_entry.at(player->getId() - 1) = manager->add(entry);
manager->saveToFile(Asset::get()->get("score.bin")); manager->saveToFile(Asset::get()->get("score.bin"));
hi_score_.name = Options::game.hi_score_table.front().name; hi_score_.name = Options::settings.hi_score_table.front().name;
} }
// Saca del estado de GAME OVER al jugador si el otro está activo // Saca del estado de GAME OVER al jugador si el otro está activo
@@ -1443,7 +1443,7 @@ void Game::handleFireInput(const std::shared_ptr<Player> &player, BulletType bul
Audio::get()->playSound("bullet.wav"); Audio::get()->playSound("bullet.wav");
// Establece un tiempo de espera para el próximo disparo. // Establece un tiempo de espera para el próximo disparo.
const int cooldown = player->isPowerUp() ? 5 : Options::game.autofire ? 10 const int cooldown = player->isPowerUp() ? 5 : Options::settings.autofire ? 10
: 7; : 7;
player->setFireCooldown(cooldown); player->setFireCooldown(cooldown);
} }
@@ -1476,7 +1476,7 @@ void Game::handlePlayersInput()
void Game::handleNormalPlayerInput(const std::shared_ptr<Player> &player) void Game::handleNormalPlayerInput(const std::shared_ptr<Player> &player)
{ {
const auto &controller = Options::controllers.at(player->getController()); const auto &controller = Options::controllers.at(player->getController());
const bool autofire = player->isPowerUp() || Options::game.autofire; const bool autofire = player->isPowerUp() || Options::settings.autofire;
if (input_->checkInput(InputAction::LEFT, INPUT_ALLOW_REPEAT, controller.type, controller.index)) if (input_->checkInput(InputAction::LEFT, INPUT_ALLOW_REPEAT, controller.type, controller.index))
{ {

View File

@@ -135,11 +135,11 @@ private:
// --- Variables de estado --- // --- Variables de estado ---
HiScoreEntry hi_score_ = HiScoreEntry( HiScoreEntry hi_score_ = HiScoreEntry(
Options::game.hi_score_table[0].name, Options::settings.hi_score_table[0].name,
Options::game.hi_score_table[0].score); // Máxima puntuación y nombre de quien la ostenta Options::settings.hi_score_table[0].score); // Máxima puntuación y nombre de quien la ostenta
Demo demo_; // Variable con todas las variables relacionadas con el modo demo Demo demo_; // Variable con todas las variables relacionadas con el modo demo
Options::DifficultyCode difficulty_ = Options::game.difficulty; // Dificultad del juego Options::DifficultyCode difficulty_ = Options::settings.difficulty; // Dificultad del juego
Helper helper_; // Variable para gestionar las ayudas Helper helper_; // Variable para gestionar las ayudas
Uint64 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa Uint64 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
bool coffee_machine_enabled_ = false; // Indica si hay una máquina de café en el terreno de juego bool coffee_machine_enabled_ = false; // Indica si hay una máquina de café en el terreno de juego

View File

@@ -117,15 +117,15 @@ namespace GlobalInputs
const std::string CODE = "LANG"; const std::string CODE = "LANG";
if (Notifier::get()->checkCode(CODE)) if (Notifier::get()->checkCode(CODE))
{ {
Options::game.language = Lang::getNextLangCode(Options::game.language); Options::settings.language = Lang::getNextLangCode(Options::settings.language);
Lang::loadFromFile(getLangFile(static_cast<Lang::Code>(Options::game.language))); Lang::loadFromFile(getLangFile(static_cast<Lang::Code>(Options::settings.language)));
Section::name = Section::Name::RESET; Section::name = Section::Name::RESET;
Section::options = Section::Options::RELOAD; Section::options = Section::Options::RELOAD;
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 05") + getLangName(Options::game.language)}); Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 05") + getLangName(Options::settings.language)});
} }
else else
{ {
const auto NEXT = Lang::getNextLangCode(Options::game.language); const auto NEXT = Lang::getNextLangCode(Options::settings.language);
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 04") + getLangName(NEXT), std::string()}, -1, CODE); Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 04") + getLangName(NEXT), std::string()}, -1, CODE);
} }
} }
@@ -133,8 +133,8 @@ namespace GlobalInputs
// Cambia el modo de disparo // Cambia el modo de disparo
void toggleFireMode() void toggleFireMode()
{ {
Options::game.autofire = !Options::game.autofire; Options::settings.autofire = !Options::settings.autofire;
Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 08") + " " + boolToOnOff(Options::game.autofire)}); Notifier::get()->show({Lang::getText("[NOTIFICATIONS] 08") + " " + boolToOnOff(Options::settings.autofire)});
} }
// Salta una sección del juego // Salta una sección del juego

View File

@@ -51,7 +51,7 @@ HiScoreTable::HiScoreTable()
HiScoreTable::~HiScoreTable() HiScoreTable::~HiScoreTable()
{ {
SDL_DestroyTexture(backbuffer_); SDL_DestroyTexture(backbuffer_);
Options::game.clearLastHiScoreEntries(); Options::settings.clearLastHiScoreEntries();
} }
// Actualiza las variables // Actualiza las variables
@@ -232,15 +232,15 @@ void HiScoreTable::createSprites()
for (int i = 0; i < MAX_NAMES; ++i) for (int i = 0; i < MAX_NAMES; ++i)
{ {
const auto table_position = format(i + 1) + ". "; const auto table_position = format(i + 1) + ". ";
const auto score = format(Options::game.hi_score_table.at(i).score); const auto score = format(Options::settings.hi_score_table.at(i).score);
const auto num_dots = ENTRY_LENGHT - Options::game.hi_score_table.at(i).name.size() - score.size(); const auto num_dots = ENTRY_LENGHT - Options::settings.hi_score_table.at(i).name.size() - score.size();
const auto one_cc = Options::game.hi_score_table.at(i).one_credit_complete ? " }" : ""; const auto one_cc = Options::settings.hi_score_table.at(i).one_credit_complete ? " }" : "";
std::string dots; std::string dots;
for (int j = 0; j < (int)num_dots; ++j) for (int j = 0; j < (int)num_dots; ++j)
{ {
dots = dots + "."; dots = dots + ".";
} }
const auto line = table_position + Options::game.hi_score_table.at(i).name + dots + score + one_cc; const auto line = table_position + Options::settings.hi_score_table.at(i).name + dots + score + one_cc;
entry_names_.emplace_back(std::make_shared<PathSprite>(entry_text->writeDXToTexture(TEXT_SHADOW, line, 1, ORANGE_COLOR, 1, SHADOW_TEXT_COLOR))); entry_names_.emplace_back(std::make_shared<PathSprite>(entry_text->writeDXToTexture(TEXT_SHADOW, line, 1, ORANGE_COLOR, 1, SHADOW_TEXT_COLOR)));
const int default_pos_x = (backbuffer_width - entry_width) / 2; const int default_pos_x = (backbuffer_width - entry_width) / 2;
@@ -402,7 +402,7 @@ void HiScoreTable::iniEntryColors()
void HiScoreTable::glowEntryNames() void HiScoreTable::glowEntryNames()
{ {
const Color entry_color = getEntryColor(counter_ / 5); const Color entry_color = getEntryColor(counter_ / 5);
for (const auto &entry_index : Options::game.last_hi_score_entry) for (const auto &entry_index : Options::settings.last_hi_score_entry)
{ {
if (entry_index != -1) if (entry_index != -1)
{ {

View File

@@ -131,7 +131,7 @@ namespace Lang
// Establece el idioma // Establece el idioma
void setLanguage(Code lang) void setLanguage(Code lang)
{ {
Options::game.language = lang; Options::settings.language = lang;
loadFromFile(Asset::get()->get(getLanguage(lang).file_name)); loadFromFile(Asset::get()->get(getLanguage(lang).file_name));
updateLanguageNames(); updateLanguageNames();
} }

View File

@@ -12,7 +12,7 @@ namespace Options
{ {
// --- Variables globales --- // --- Variables globales ---
WindowOptions window; // Opciones de la ventana WindowOptions window; // Opciones de la ventana
GameOptions game; // Opciones del juego SettingsOptions settings; // Opciones del juego
VideoOptions video; // Opciones de vídeo VideoOptions video; // Opciones de vídeo
AudioOptions audio; // Opciones de audio AudioOptions audio; // Opciones de audio
std::vector<GamepadOptions> controllers; // Opciones de mando para cada jugador std::vector<GamepadOptions> controllers; // Opciones de mando para cada jugador
@@ -28,7 +28,7 @@ namespace Options
bool setOptions(const std::string &var, const std::string &value); bool setOptions(const std::string &var, const std::string &value);
// Inicializa las opciones del programa // Inicializa las opciones del programa
void initOptions() void init()
{ {
window.caption = "Coffee Crisis Arcade Edition"; window.caption = "Coffee Crisis Arcade Edition";
window.size = 2; window.size = 2;
@@ -49,11 +49,11 @@ namespace Options
audio.sound.volume = 50; audio.sound.volume = 50;
// Opciones de juego // Opciones de juego
game.difficulty = DifficultyCode::NORMAL; settings.difficulty = DifficultyCode::NORMAL;
game.language = Lang::Code::VALENCIAN; settings.language = Lang::Code::VALENCIAN;
game.autofire = true; settings.autofire = true;
game.shutdown_enabled = false; settings.shutdown_enabled = false;
game.clearLastHiScoreEntries(); settings.clearLastHiScoreEntries();
// Opciones de control // Opciones de control
controllers.clear(); controllers.clear();
@@ -63,16 +63,16 @@ namespace Options
setKeyboardToPlayer(1); setKeyboardToPlayer(1);
// Opciones pendientes // Opciones pendientes
pending_changes.new_language = game.language; pending_changes.new_language = settings.language;
pending_changes.new_difficulty = game.difficulty; pending_changes.new_difficulty = settings.difficulty;
pending_changes.has_pending_changes = false; pending_changes.has_pending_changes = false;
} }
// Carga el fichero de configuración // Carga el fichero de configuración
bool loadOptionsFile(std::string file_path) bool loadFromFile(std::string file_path)
{ {
// Inicializa las opciones del programa // Inicializa las opciones del programa
initOptions(); init();
// Indicador de éxito en la carga // Indicador de éxito en la carga
bool success = true; bool success = true;
@@ -107,22 +107,22 @@ namespace Options
else else
{ {
// Crea el fichero con los valores por defecto // Crea el fichero con los valores por defecto
saveOptionsFile(file_path); saveToFile(file_path);
} }
// Normaliza los valores // Normaliza los valores
if (game.language != Lang::Code::ENGLISH && if (settings.language != Lang::Code::ENGLISH &&
game.language != Lang::Code::VALENCIAN && settings.language != Lang::Code::VALENCIAN &&
game.language != Lang::Code::SPANISH) settings.language != Lang::Code::SPANISH)
{ {
game.language = Lang::Code::ENGLISH; settings.language = Lang::Code::ENGLISH;
} }
return success; return success;
} }
// Guarda el fichero de configuración // Guarda el fichero de configuración
bool saveOptionsFile(std::string file_path) bool saveToFile(std::string file_path)
{ {
std::ofstream file(file_path); std::ofstream file(file_path);
@@ -166,10 +166,10 @@ namespace Options
file << "## game.difficulty [" << static_cast<int>(DifficultyCode::EASY) << ": easy, " << static_cast<int>(DifficultyCode::NORMAL) << ": normal, " << static_cast<int>(DifficultyCode::HARD) << ": hard]\n"; file << "## game.difficulty [" << static_cast<int>(DifficultyCode::EASY) << ": easy, " << static_cast<int>(DifficultyCode::NORMAL) << ": normal, " << static_cast<int>(DifficultyCode::HARD) << ": hard]\n";
file << "\n"; file << "\n";
file << "game.language=" << static_cast<int>(game.language) << "\n"; file << "game.language=" << static_cast<int>(settings.language) << "\n";
file << "game.difficulty=" << static_cast<int>(game.difficulty) << "\n"; file << "game.difficulty=" << static_cast<int>(settings.difficulty) << "\n";
file << "game.autofire=" << boolToString(game.autofire) << "\n"; file << "game.autofire=" << boolToString(settings.autofire) << "\n";
file << "game.shutdown_enabled=" << boolToString(game.shutdown_enabled) << "\n"; file << "game.shutdown_enabled=" << boolToString(settings.shutdown_enabled) << "\n";
// Opciones de mandos // Opciones de mandos
file << "\n\n## CONTROLLERS\n"; file << "\n\n## CONTROLLERS\n";
@@ -258,21 +258,21 @@ namespace Options
// Opciones de juego // Opciones de juego
else if (var == "game.language") else if (var == "game.language")
{ {
game.language = static_cast<Lang::Code>(std::stoi(value)); settings.language = static_cast<Lang::Code>(std::stoi(value));
pending_changes.new_language = game.language; pending_changes.new_language = settings.language;
} }
else if (var == "game.difficulty") else if (var == "game.difficulty")
{ {
game.difficulty = static_cast<DifficultyCode>(std::stoi(value)); settings.difficulty = static_cast<DifficultyCode>(std::stoi(value));
pending_changes.new_difficulty = game.difficulty; pending_changes.new_difficulty = settings.difficulty;
} }
else if (var == "game.autofire") else if (var == "game.autofire")
{ {
game.autofire = stringToBool(value); settings.autofire = stringToBool(value);
} }
else if (var == "game.shutdown_enabled") else if (var == "game.shutdown_enabled")
{ {
game.shutdown_enabled = stringToBool(value); settings.shutdown_enabled = stringToBool(value);
} }
// Opciones de mandos // Opciones de mandos
@@ -370,13 +370,13 @@ namespace Options
} }
// Intercambia el teclado de jugador // Intercambia el teclado de jugador
void swapOptionsKeyboard() void swapKeyboard()
{ {
std::swap(controllers.at(0).type, controllers.at(1).type); std::swap(controllers.at(0).type, controllers.at(1).type);
} }
// Intercambia los jugadores asignados a los dos primeros mandos // Intercambia los jugadores asignados a los dos primeros mandos
void swapOptionsControllers() void swapControllers()
{ {
std::swap(controllers.at(0).player_id, controllers.at(1).player_id); std::swap(controllers.at(0).player_id, controllers.at(1).player_id);
std::swap(controllers.at(0).type, controllers.at(1).type); std::swap(controllers.at(0).type, controllers.at(1).type);
@@ -400,16 +400,16 @@ namespace Options
{ {
if (pending_changes.has_pending_changes) if (pending_changes.has_pending_changes)
{ {
game.language = pending_changes.new_language; settings.language = pending_changes.new_language;
game.difficulty = pending_changes.new_difficulty; settings.difficulty = pending_changes.new_difficulty;
pending_changes.has_pending_changes = false; pending_changes.has_pending_changes = false;
} }
} }
void checkPendingChanges() void checkPendingChanges()
{ {
if (game.language != pending_changes.new_language || if (settings.language != pending_changes.new_language ||
game.difficulty != pending_changes.new_difficulty) settings.difficulty != pending_changes.new_difficulty)
{ {
pending_changes.has_pending_changes = true; pending_changes.has_pending_changes = true;
} }

View File

@@ -74,8 +74,8 @@ namespace Options
int volume; // Volumen general del audio int volume; // Volumen general del audio
}; };
// --- Opciones del juego --- // --- Opciones de configuracion ---
struct GameOptions struct SettingsOptions
{ {
DifficultyCode difficulty; // Dificultad del juego DifficultyCode difficulty; // Dificultad del juego
Lang::Code language; // Idioma usado en el juego Lang::Code language; // Idioma usado en el juego
@@ -120,20 +120,20 @@ namespace Options
// --- Variables globales --- // --- Variables globales ---
extern WindowOptions window; // Opciones de la ventana extern WindowOptions window; // Opciones de la ventana
extern GameOptions game; // Opciones del juego extern SettingsOptions settings; // Opciones del juego
extern VideoOptions video; // Opciones de vídeo extern VideoOptions video; // Opciones de vídeo
extern AudioOptions audio; // Opciones de audio extern AudioOptions audio; // Opciones de audio
extern std::vector<GamepadOptions> controllers; // Opciones de mando para cada jugador extern std::vector<GamepadOptions> controllers; // Opciones de mando para cada jugador
extern PendingChanges pending_changes; // Opciones que se aplican al cerrar extern PendingChanges pending_changes; // Opciones que se aplican al cerrar
// --- Funciones de configuración --- // --- Funciones de configuración ---
void initOptions(); // Inicializa las opciones del programa void init(); // Inicializa las opciones del programa
bool loadOptionsFile(std::string file_path); // Carga el fichero de configuración bool loadFromFile(std::string file_path); // Carga el fichero de configuración
bool saveOptionsFile(std::string file_path); // Guarda el fichero de configuración bool saveToFile(std::string file_path); // Guarda el fichero de configuración
void setKeyboardToPlayer(int player_id); // Asigna el teclado al jugador void setKeyboardToPlayer(int player_id); // Asigna el teclado al jugador
void swapOptionsKeyboard(); // Intercambia el teclado de jugador void swapKeyboard(); // Intercambia el teclado de jugador
void swapOptionsControllers(); // Intercambia los jugadores asignados a los dos primeros mandos void swapControllers(); // Intercambia los jugadores asignados a los dos primeros mandos
int getPlayerWhoUsesKeyboard(); // Averigua quién está usando el teclado int getPlayerWhoUsesKeyboard(); // Averigua quién está usando el teclado
void applyPendingChanges(); // Aplica los cambios pendientes copiando los valores a sus variables void applyPendingChanges(); // Aplica los cambios pendientes copiando los valores a sus variables
void checkPendingChanges(); void checkPendingChanges();
} // namespace Options } // namespace Options

View File

@@ -108,7 +108,7 @@ public:
bool canFire() const { return cool_down_ <= 0; } bool canFire() const { return cool_down_ <= 0; }
bool hasExtraHit() const { return extra_hit_; } bool hasExtraHit() const { return extra_hit_; }
bool isCooling() const { return firing_state_ == PlayerState::COOLING_LEFT || firing_state_ == PlayerState::COOLING_UP || firing_state_ == PlayerState::COOLING_RIGHT; } bool isCooling() const { return firing_state_ == PlayerState::COOLING_LEFT || firing_state_ == PlayerState::COOLING_UP || firing_state_ == PlayerState::COOLING_RIGHT; }
bool IsEligibleForHighScore() const { return score_ > Options::game.hi_score_table.back().score; } bool IsEligibleForHighScore() const { return score_ > Options::settings.hi_score_table.back().score; }
bool isInvulnerable() const { return invulnerable_; } bool isInvulnerable() const { return invulnerable_; }
bool isPowerUp() const { return power_up_; } bool isPowerUp() const { return power_up_; }
Circle &getCollider() { return collider_; } Circle &getCollider() { return collider_; }

View File

@@ -365,7 +365,7 @@ void ServiceMenu::initializeOptions()
options_.emplace_back(Lang::getText("[SERVICE_MENU] SFX_VOLUME"), SettingsGroup::AUDIO, OptionBehavior::ADJUST, &Options::audio.sound.volume, ValueType::INT, 0, 100, 5); options_.emplace_back(Lang::getText("[SERVICE_MENU] SFX_VOLUME"), SettingsGroup::AUDIO, OptionBehavior::ADJUST, &Options::audio.sound.volume, ValueType::INT, 0, 100, 5);
// Settings // Settings
options_.emplace_back(Lang::getText("[SERVICE_MENU] AUTOFIRE"), SettingsGroup::SETTINGS, OptionBehavior::ADJUST, &Options::game.autofire, ValueType::BOOL); options_.emplace_back(Lang::getText("[SERVICE_MENU] AUTOFIRE"), SettingsGroup::SETTINGS, OptionBehavior::ADJUST, &Options::settings.autofire, ValueType::BOOL);
options_.emplace_back( options_.emplace_back(
Lang::getText("[SERVICE_MENU] LANGUAGE"), Lang::getText("[SERVICE_MENU] LANGUAGE"),
SettingsGroup::SETTINGS, SettingsGroup::SETTINGS,
@@ -384,12 +384,12 @@ void ServiceMenu::initializeOptions()
Lang::getText("[SERVICE_MENU] EASY"), Lang::getText("[SERVICE_MENU] EASY"),
Lang::getText("[SERVICE_MENU] NORMAL"), Lang::getText("[SERVICE_MENU] NORMAL"),
Lang::getText("[SERVICE_MENU] HARD")}); Lang::getText("[SERVICE_MENU] HARD")});
options_.emplace_back(Lang::getText("[SERVICE_MENU] ENABLE_SHUTDOWN"), SettingsGroup::SETTINGS, OptionBehavior::ADJUST, &Options::game.shutdown_enabled, ValueType::BOOL); options_.emplace_back(Lang::getText("[SERVICE_MENU] ENABLE_SHUTDOWN"), SettingsGroup::SETTINGS, OptionBehavior::ADJUST, &Options::settings.shutdown_enabled, ValueType::BOOL);
// System // System
options_.emplace_back(Lang::getText("[SERVICE_MENU] RESET"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE); options_.emplace_back(Lang::getText("[SERVICE_MENU] RESET"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
options_.emplace_back(Lang::getText("[SERVICE_MENU] QUIT"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE); options_.emplace_back(Lang::getText("[SERVICE_MENU] QUIT"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
if (Options::game.shutdown_enabled) if (Options::settings.shutdown_enabled)
options_.emplace_back(Lang::getText("[SERVICE_MENU] SHUTDOWN"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE); options_.emplace_back(Lang::getText("[SERVICE_MENU] SHUTDOWN"), SettingsGroup::SYSTEM, OptionBehavior::SELECT, nullptr, ValueType::NONE);
// Menu principal // Menu principal
@@ -526,7 +526,7 @@ void ServiceMenu::AdjustListValues()
auto option = getOptionEntryByCaption(Lang::getText("[SERVICE_MENU] LANGUAGE")); auto option = getOptionEntryByCaption(Lang::getText("[SERVICE_MENU] LANGUAGE"));
for (size_t i = 0; i < option->value_list.size(); ++i) for (size_t i = 0; i < option->value_list.size(); ++i)
{ {
if (Lang::getCodeFromName(option->value_list[i]) == Options::game.language) if (Lang::getCodeFromName(option->value_list[i]) == Options::settings.language)
{ {
option->list_index = i; option->list_index = i;
} }

View File

@@ -269,14 +269,14 @@ void Title::swapControllers()
return; return;
} }
Options::swapOptionsControllers(); Options::swapControllers();
showControllers(); showControllers();
} }
// Intercambia el teclado de jugador // Intercambia el teclado de jugador
void Title::swapKeyboard() void Title::swapKeyboard()
{ {
Options::swapOptionsKeyboard(); Options::swapKeyboard();
std::string text = Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(Options::getPlayerWhoUsesKeyboard()) + ": " + Lang::getText("[DEFINE_BUTTONS] KEYBOARD"); std::string text = Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(Options::getPlayerWhoUsesKeyboard()) + ": " + Lang::getText("[DEFINE_BUTTONS] KEYBOARD");
Notifier::get()->show({text}); Notifier::get()->show({text});
} }