From d35e2ebb309964c11e92a69903baf7d9efb28330 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 25 May 2020 02:23:55 +0200 Subject: [PATCH] control:: sc_ticks exported so that visualizations can perfectly synchronize --- control.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/control.cpp b/control.cpp index e5a96eaf..7978944d 100644 --- a/control.cpp +++ b/control.cpp @@ -616,6 +616,8 @@ EX void resize_screen_to(int x, int y) { int lastframe; +EX int sc_ticks; + EX void mainloopiter() { DEBB(DF_GRAPH, ("main loop\n")); @@ -748,9 +750,9 @@ EX void mainloopiter() { #endif } - if(smooth_scrolling && !shmup::on) { + if(smooth_scrolling && !shmup::on && (cmode & sm::NORMAL)) { rug::using_rugview urv; - static int lastticks; + auto& lastticks = sc_ticks; ld t = (ticks - lastticks) * shiftmul / 1000.; lastticks = ticks; Uint8 *keystate = SDL_GetKeyState(NULL); @@ -764,6 +766,7 @@ EX void mainloopiter() { if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) full_rotate_view(t * 180 / M_PI, t); if(keystate[SDLK_PAGEDOWN] && DEFAULTNOR(SDLK_PAGEDOWN)) full_rotate_view(-t * 180 / M_PI, t); } + else sc_ticks = ticks; achievement_pump(); while(SDL_PollEvent(&ev)) handle_event(ev);