Skip to content

Commit

Permalink
GameEngine.h:
Browse files Browse the repository at this point in the history
* 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).
  • Loading branch information
razterizer committed Nov 24, 2024
1 parent 69c40e2 commit 6b2131e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions GameEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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;
}
Expand Down

0 comments on commit 6b2131e

Please sign in to comment.