Skip to content

Commit

Permalink
Add loop limits to engine.c
Browse files Browse the repository at this point in the history
This ensures we get frame refreshes sometimes, even in warp mode.
  • Loading branch information
katajakasa committed Jul 4, 2024
1 parent 9566959 commit 471e0c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ void engine_run(engine_init_flags *init_flags) {
static_wait += 20;
debugger_proceed = 0;
}
while(static_wait > 10) {
int limit_static = 100;
int limit_dynamic = 100;
while(static_wait > 10 && limit_static--) {
// Static tick for gamestate
game_state_static_tick(gs);

Expand All @@ -229,7 +231,7 @@ void engine_run(engine_init_flags *init_flags) {

static_wait -= 10;
}
while(dynamic_wait > game_state_ms_per_dyntick(gs)) {
while(dynamic_wait > game_state_ms_per_dyntick(gs) && limit_dynamic--) {
// Tick scene
game_state_dynamic_tick(gs);

Expand Down

0 comments on commit 471e0c9

Please sign in to comment.