Skip to content

Commit

Permalink
Merge pull request #642 from omf2097/make-it-warp-scotty
Browse files Browse the repository at this point in the history
More warp!
  • Loading branch information
katajakasa authored Oct 8, 2024
2 parents 859dc4c + ca54405 commit e57d241
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
30 changes: 17 additions & 13 deletions src/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,24 @@ void engine_run(engine_init_flags *init_flags) {
debugger_proceed = 0;
}

// Tick static features. This is a fixed with-rate tick, and is meant for running things
// that are not dependent on game speed (such as menus).
if(static_wait > STATIC_TICKS) {
game_state_static_tick(gs, false);
console_tick();
static_wait -= STATIC_TICKS;
}
// In warp mode, allow more ticks to happen per vsync period.
int tick_limit = gs->warp_speed ? 10 : 1;
while(tick_limit--) {
// Tick static features. This is a fixed with-rate tick, and is meant for running things
// that are not dependent on game speed (such as menus).
if(static_wait > STATIC_TICKS) {
game_state_static_tick(gs, false);
console_tick();
static_wait -= STATIC_TICKS;
}

// Tick dynamic features. This is a dynamically changing tick, and it depends on things such as
// hit-pause, hit slowdown and game-speed slider. It is meant for ticking everything that has to do
// with the actual gameplay stuff.
if(dynamic_wait > game_state_ms_per_dyntick(gs)) {
game_state_dynamic_tick(gs, false);
dynamic_wait -= game_state_ms_per_dyntick(gs);
// Tick dynamic features. This is a dynamically changing tick, and it depends on things such as
// hit-pause, hit slowdown and game-speed slider. It is meant for ticking everything that has to do
// with the actual gameplay stuff.
if(dynamic_wait > game_state_ms_per_dyntick(gs)) {
game_state_dynamic_tick(gs, false);
dynamic_wait -= game_state_ms_per_dyntick(gs);
}
}

// Do the actual video rendering jobs
Expand Down
3 changes: 0 additions & 3 deletions src/video/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ void video_render_finish(void) {
// Flip buffers. If vsync is off, we should sleep here
// so hat our main loop doesn't eat up all cpu :)
SDL_GL_SwapWindow(g_video_state.window);
if(!g_video_state.vsync) {
SDL_Delay(1);
}
}

void video_close(void) {
Expand Down

0 comments on commit e57d241

Please sign in to comment.