From 6b2131ee844041e4b575cd88cd096b82d58873e3 Mon Sep 17 00:00:00 2001 From: Rasmus Anthin Date: Sun, 24 Nov 2024 22:20:41 +0100 Subject: [PATCH] GameEngine.h: * My previous "fix" that halted the frame_ctr, anim_ctr objects and sim_time_s caused at least one bug: The pause screen animation was paused. Now always updating frame_ctr and anim_ctr_data[0] (which is for internal animations such as the pause screen animation). --- GameEngine.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/GameEngine.h b/GameEngine.h index 4b98fc8..3e565a0 100644 --- a/GameEngine.h +++ b/GameEngine.h @@ -512,6 +512,10 @@ class GameEngine /// + frame_ctr++; + if (frame_ctr % anim_ctr_data[0].anim_count_per_frame_count == 0) + anim_ctr_data[0].anim_ctr++; + if (!show_title && !show_instructions && !show_quit_confirm && !show_input_hiscore && !show_hiscores && !paused) { if (trg_update_resumed.once()) @@ -520,10 +524,9 @@ class GameEngine trg_update_halted.reset(); } - frame_ctr++; - for (auto& ad : anim_ctr_data) - if (frame_ctr % ad.anim_count_per_frame_count == 0) - ad.anim_ctr++; + for (size_t ad_idx = 0; ad_idx < anim_ctr_data.size(); ++ad_idx) + if (frame_ctr % anim_ctr_data[ad_idx].anim_count_per_frame_count == 0) + anim_ctr_data[ad_idx].anim_ctr++; sim_time_s += sim_dt_s; }