diff --git a/source/game/defaults.hpp b/source/game/defaults.hpp index 68680cb..d78bd50 100644 --- a/source/game/defaults.hpp +++ b/source/game/defaults.hpp @@ -51,6 +51,10 @@ namespace Defaults::Settings { constexpr Lang::Code LANGUAGE = Lang::Code::BA_BA; } // namespace Defaults::Settings +namespace Defaults::Gameplay { + constexpr bool PAUSE_COUNTDOWN = true; +} // namespace Defaults::Gameplay + // TamaƱo de bloque constexpr int BLOCK = 8; constexpr int HALF_BLOCK = BLOCK / 2; diff --git a/source/game/game.cpp b/source/game/game.cpp index 00221ce..b024d22 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -2812,6 +2812,9 @@ void Game::updatePauseMenuUI() { switch (pause_menu_->getItemSelected()) { case 1: leaving_pause_menu_ = true; + if (!Options::gameplay.pause_countdown) { + pause_counter_ = 0; // salta el compte enrere de 3 segons + } break; case 2: @@ -2862,7 +2865,9 @@ void Game::renderPausedGame() { } if (leaving_pause_menu_) { - text_nokia_big2_->writeCentered(GAMECANVAS_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, std::to_string((pause_counter_ / 30) + 1)); + if (pause_counter_ > 0) { + text_nokia_big2_->writeCentered(GAMECANVAS_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, std::to_string((pause_counter_ / 30) + 1)); + } } else { pause_menu_->render(); } diff --git a/source/game/options.cpp b/source/game/options.cpp index 442ba07..6058f31 100644 --- a/source/game/options.cpp +++ b/source/game/options.cpp @@ -20,6 +20,7 @@ namespace Options { Audio audio; Loading loading; Settings settings; + Gameplay gameplay; std::vector inputs; std::vector postfx_presets; @@ -150,6 +151,12 @@ namespace Options { parseIntField(st, "player_selected", settings.player_selected); } + void loadGameplayFromYaml(const fkyaml::node &yaml) { + if (!yaml.contains("gameplay")) { return; } + const auto &gp = yaml["gameplay"]; + parseBoolField(gp, "pause_countdown", gameplay.pause_countdown); + } + void loadInputsFromYaml(const fkyaml::node &yaml) { if (!yaml.contains("input") || inputs.size() < 2) { return; } const auto &ins = yaml["input"]; @@ -177,6 +184,7 @@ namespace Options { video = Video{}; audio = Audio{}; loading = Loading{}; + gameplay = Gameplay{}; // Preserva config_file si ja s'ha establert abans. const std::string PREV_CONFIG_FILE = settings.config_file; @@ -236,6 +244,7 @@ namespace Options { loadAudioFromYaml(yaml); loadLoadingFromYaml(yaml); loadSettingsFromYaml(yaml); + loadGameplayFromYaml(yaml); loadInputsFromYaml(yaml); } catch (const fkyaml::exception &e) { @@ -312,6 +321,11 @@ namespace Options { file << " language: " << static_cast(settings.language) << "\n"; file << " player_selected: " << settings.player_selected << "\n\n"; + // GAMEPLAY + file << "# GAMEPLAY\n"; + file << "gameplay:\n"; + file << " pause_countdown: " << boolToString(gameplay.pause_countdown) << "\n\n"; + // INPUT file << "# INPUT DEVICES (device_type: " << static_cast(Input::Device::KEYBOARD) << "=KEYBOARD, " diff --git a/source/game/options.hpp b/source/game/options.hpp index 2f3abc8..bcf0c11 100644 --- a/source/game/options.hpp +++ b/source/game/options.hpp @@ -80,6 +80,10 @@ namespace Options { std::string config_file; }; + struct Gameplay { + bool pause_countdown = Defaults::Gameplay::PAUSE_COUNTDOWN; + }; + // Preset PostFX struct PostFXPreset { std::string name; @@ -122,6 +126,7 @@ namespace Options { extern Audio audio; extern Loading loading; extern Settings settings; + extern Gameplay gameplay; extern std::vector inputs; // [0]=KEYBOARD, [1]=GAMECONTROLLER per defecte // Presets de shaders (carregats de postfx.yaml / crtpi.yaml al config folder)