From 6808c4e9263e025a86c941cc70ade6d4eb007c2f Mon Sep 17 00:00:00 2001 From: ? Date: Mon, 25 Feb 2019 18:39:36 +0100 Subject: [PATCH] smooth_scrolling now configurable --- config.cpp | 1 + control.cpp | 14 +++++++------- hyper.h | 1 + shmup.cpp | 4 ++++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/config.cpp b/config.cpp index fafa7e86..469bc454 100644 --- a/config.cpp +++ b/config.cpp @@ -362,6 +362,7 @@ void initConfig() { addsaver(sightranges[gCubeTiling], "sight-cubes", 7); addsaver(sightranges[gCell120], "sight-120cell", 2 * M_PI); addsaver(sightranges[gECell120], "sight-120cell-elliptic", M_PI); + addsaver(smooth_scrolling, "smooth-scrolling", false); addsaver(vid.consider_shader_projection, "shader-projection", true); diff --git a/control.cpp b/control.cpp index 2a14065f..b62cbbca 100644 --- a/control.cpp +++ b/control.cpp @@ -240,10 +240,10 @@ bool didsomething; typedef SDL_Event eventtype; -bool smooth_movement = (DIM == 3); +bool smooth_scrolling = false; void handlePanning(int sym, int uni) { - if(rug::rugged || smooth_movement) return; + if(rug::rugged || smooth_scrolling) return; #if !ISPANDORA if(sym == SDLK_END && DIM == 3) { @@ -581,7 +581,7 @@ void mainloopiter() { SDL_Event ev; DEBB(DF_GRAPH, (debugfile,"polling for events\n")); - if(smooth_movement) { + if(smooth_scrolling && !shmup::on && !rug::rugged) { static int lastticks; ld t = (ticks - lastticks) * shiftmul / 1000.; lastticks = ticks; @@ -591,13 +591,13 @@ void mainloopiter() { if(keystate[SDLK_HOME] && DIM == 3 && DEFAULTNOR(SDLK_HOME)) View = cpush(2, t) * View, didsomething = true, playermoved = false; if(keystate[SDLK_RIGHT] && DEFAULTNOR(SDLK_RIGHT)) - View = cspin(0, 2, -t) * View, didsomething = true; + View = (DIM == 2 ? xpush(-t) : cspin(0, 2, -t)) * View, didsomething = true, playermoved = playermoved && DIM == 3; if(keystate[SDLK_LEFT] && DEFAULTNOR(SDLK_LEFT)) - View = cspin(0, 2, t) * View, didsomething = true; + View = (DIM == 2 ? xpush(t) : cspin(0, 2, t)) * View, didsomething = true, playermoved = playermoved && DIM == 3; if(keystate[SDLK_UP] && DEFAULTNOR(SDLK_UP)) - View = cspin(1, 2, t) * View, didsomething = true; + View = (DIM == 2 ? ypush(t) : cspin(1, 2, t)) * View, didsomething = true, playermoved = playermoved && DIM == 3; if(keystate[SDLK_DOWN] && DEFAULTNOR(SDLK_DOWN)) - View = cspin(1, 2, -t) * View, didsomething = true; + View = (DIM == 2 ? ypush(-t) : cspin(1, 2, -t)) * View, didsomething = true, playermoved = playermoved && DIM == 3; if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) { if(conformal::on) conformal::rotation+=t; diff --git a/hyper.h b/hyper.h index 048bde63..18aac776 100644 --- a/hyper.h +++ b/hyper.h @@ -1792,6 +1792,7 @@ bool needConfirmationEvenIfSaved(); #define DEFAULTCONTROL (multi::players == 1 && !shmup::on && !multi::alwaysuse && !(rug::rugged && rug::renderonce)) #define DEFAULTNOR(sym) (DEFAULTCONTROL || multi::notremapped(sym)) +extern bool smooth_scrolling; extern bool timerghost; extern bool gen_wandering; diff --git a/shmup.cpp b/shmup.cpp index 6f646864..38a16505 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -379,6 +379,9 @@ struct shmup_configurer { else dialog::addBreak(100); if(playercfg > 3) dialog::addItem(XLAT("configure player 4") + dsc(3), '4'); + else if(!shmup::on && !multi::alwaysuse) { + dialog::addBoolItem(XLAT("smooth scrolling"), smooth_scrolling, 'c'); + } else dialog::addBreak(100); if(playercfg > 4) @@ -443,6 +446,7 @@ struct shmup_configurer { #if CAP_SDLJOY else if(uni == 'b') pushScreen(showJoyConfig); #endif + else if(uni == 'c') smooth_scrolling = !smooth_scrolling; else if(uni == 'r') for(int i=0; i