config: opció gameplay.pause_countdown per saltar el compte enrere de pausa
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Options {
|
||||
Audio audio;
|
||||
Loading loading;
|
||||
Settings settings;
|
||||
Gameplay gameplay;
|
||||
std::vector<InputDevice> inputs;
|
||||
|
||||
std::vector<PostFXPreset> 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<int>(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<int>(Input::Device::KEYBOARD) << "=KEYBOARD, "
|
||||
|
||||
@@ -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<InputDevice> inputs; // [0]=KEYBOARD, [1]=GAMECONTROLLER per defecte
|
||||
|
||||
// Presets de shaders (carregats de postfx.yaml / crtpi.yaml al config folder)
|
||||
|
||||
Reference in New Issue
Block a user