feat(game): skip de countdown amb JUMP/ATTACK quan numero <= 7
This commit is contained in:
1 parent
a717411edd
commit
486a440668
7 files changed
+123
-20
No files matched your search
@@ -51,6 +51,7 @@ namespace GameOverFsm {
|
||||
if (n.contains("countdown_sound_key")) {
|
||||
cfg.countdown_sound_key = n["countdown_sound_key"].get_value<std::string>();
|
||||
}
|
||||
cfg.skip_below_or_equal = readChildInt(n, "skip_below_or_equal", cfg.skip_below_or_equal);
|
||||
}
|
||||
|
||||
Log::info("GameOverFsm", "timings carregats des de {} (continue hold {}ms, fade {}ms)", yaml_path, cfg.continue_text_hold_ms, cfg.fade_out_ms);
|
||||
@@ -118,6 +119,20 @@ namespace GameOverFsm {
|
||||
t.elapsed_ms = 0;
|
||||
}
|
||||
|
||||
void skipToNextCountdown(State current, Transition& t, const Config& cfg) {
|
||||
if (current != State::CONTINUE_PROMPT) { return; }
|
||||
if (t.phase != 1) { return; }
|
||||
const int START = std::max(0, cfg.continue_count_start);
|
||||
const int STEP_COUNT = START + 1;
|
||||
const int STEP_MS = std::max(1, cfg.continue_text_hold_ms / STEP_COUNT);
|
||||
const int CONSUMED = t.elapsed_ms / STEP_MS;
|
||||
const int CURRENT = std::clamp(START - CONSUMED, 0, START);
|
||||
// No saltem si ja som al 0: el següent "número" és la transició
|
||||
// a GAME_OVER, que `advance` ja gestiona quan el hold s'esgota.
|
||||
if (CURRENT <= 0) { return; }
|
||||
t.elapsed_ms = (CONSUMED + 1) * STEP_MS;
|
||||
}
|
||||
|
||||
auto countdownSecondsRemaining(State current, const Transition& t, const Config& cfg) -> int {
|
||||
if (current != State::CONTINUE_PROMPT) { return 0; }
|
||||
if (t.phase != 1) { return 0; }
|
||||
|
||||
Reference in new issue
Block a user