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;
|
constexpr Lang::Code LANGUAGE = Lang::Code::BA_BA;
|
||||||
} // namespace Defaults::Settings
|
} // namespace Defaults::Settings
|
||||||
|
|
||||||
|
namespace Defaults::Gameplay {
|
||||||
|
constexpr bool PAUSE_COUNTDOWN = true;
|
||||||
|
} // namespace Defaults::Gameplay
|
||||||
|
|
||||||
// Tamaño de bloque
|
// Tamaño de bloque
|
||||||
constexpr int BLOCK = 8;
|
constexpr int BLOCK = 8;
|
||||||
constexpr int HALF_BLOCK = BLOCK / 2;
|
constexpr int HALF_BLOCK = BLOCK / 2;
|
||||||
|
|||||||
@@ -2812,6 +2812,9 @@ void Game::updatePauseMenuUI() {
|
|||||||
switch (pause_menu_->getItemSelected()) {
|
switch (pause_menu_->getItemSelected()) {
|
||||||
case 1:
|
case 1:
|
||||||
leaving_pause_menu_ = true;
|
leaving_pause_menu_ = true;
|
||||||
|
if (!Options::gameplay.pause_countdown) {
|
||||||
|
pause_counter_ = 0; // salta el compte enrere de 3 segons
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
@@ -2862,7 +2865,9 @@ void Game::renderPausedGame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (leaving_pause_menu_) {
|
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 {
|
} else {
|
||||||
pause_menu_->render();
|
pause_menu_->render();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace Options {
|
|||||||
Audio audio;
|
Audio audio;
|
||||||
Loading loading;
|
Loading loading;
|
||||||
Settings settings;
|
Settings settings;
|
||||||
|
Gameplay gameplay;
|
||||||
std::vector<InputDevice> inputs;
|
std::vector<InputDevice> inputs;
|
||||||
|
|
||||||
std::vector<PostFXPreset> postfx_presets;
|
std::vector<PostFXPreset> postfx_presets;
|
||||||
@@ -150,6 +151,12 @@ namespace Options {
|
|||||||
parseIntField(st, "player_selected", settings.player_selected);
|
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) {
|
void loadInputsFromYaml(const fkyaml::node &yaml) {
|
||||||
if (!yaml.contains("input") || inputs.size() < 2) { return; }
|
if (!yaml.contains("input") || inputs.size() < 2) { return; }
|
||||||
const auto &ins = yaml["input"];
|
const auto &ins = yaml["input"];
|
||||||
@@ -177,6 +184,7 @@ namespace Options {
|
|||||||
video = Video{};
|
video = Video{};
|
||||||
audio = Audio{};
|
audio = Audio{};
|
||||||
loading = Loading{};
|
loading = Loading{};
|
||||||
|
gameplay = Gameplay{};
|
||||||
|
|
||||||
// Preserva config_file si ja s'ha establert abans.
|
// Preserva config_file si ja s'ha establert abans.
|
||||||
const std::string PREV_CONFIG_FILE = settings.config_file;
|
const std::string PREV_CONFIG_FILE = settings.config_file;
|
||||||
@@ -236,6 +244,7 @@ namespace Options {
|
|||||||
loadAudioFromYaml(yaml);
|
loadAudioFromYaml(yaml);
|
||||||
loadLoadingFromYaml(yaml);
|
loadLoadingFromYaml(yaml);
|
||||||
loadSettingsFromYaml(yaml);
|
loadSettingsFromYaml(yaml);
|
||||||
|
loadGameplayFromYaml(yaml);
|
||||||
loadInputsFromYaml(yaml);
|
loadInputsFromYaml(yaml);
|
||||||
|
|
||||||
} catch (const fkyaml::exception &e) {
|
} catch (const fkyaml::exception &e) {
|
||||||
@@ -312,6 +321,11 @@ namespace Options {
|
|||||||
file << " language: " << static_cast<int>(settings.language) << "\n";
|
file << " language: " << static_cast<int>(settings.language) << "\n";
|
||||||
file << " player_selected: " << settings.player_selected << "\n\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
|
// INPUT
|
||||||
file << "# INPUT DEVICES (device_type: "
|
file << "# INPUT DEVICES (device_type: "
|
||||||
<< static_cast<int>(Input::Device::KEYBOARD) << "=KEYBOARD, "
|
<< static_cast<int>(Input::Device::KEYBOARD) << "=KEYBOARD, "
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ namespace Options {
|
|||||||
std::string config_file;
|
std::string config_file;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Gameplay {
|
||||||
|
bool pause_countdown = Defaults::Gameplay::PAUSE_COUNTDOWN;
|
||||||
|
};
|
||||||
|
|
||||||
// Preset PostFX
|
// Preset PostFX
|
||||||
struct PostFXPreset {
|
struct PostFXPreset {
|
||||||
std::string name;
|
std::string name;
|
||||||
@@ -122,6 +126,7 @@ namespace Options {
|
|||||||
extern Audio audio;
|
extern Audio audio;
|
||||||
extern Loading loading;
|
extern Loading loading;
|
||||||
extern Settings settings;
|
extern Settings settings;
|
||||||
|
extern Gameplay gameplay;
|
||||||
extern std::vector<InputDevice> inputs; // [0]=KEYBOARD, [1]=GAMECONTROLLER per defecte
|
extern std::vector<InputDevice> inputs; // [0]=KEYBOARD, [1]=GAMECONTROLLER per defecte
|
||||||
|
|
||||||
// Presets de shaders (carregats de postfx.yaml / crtpi.yaml al config folder)
|
// Presets de shaders (carregats de postfx.yaml / crtpi.yaml al config folder)
|
||||||
|
|||||||
Reference in New Issue
Block a user