1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-30 15:39:54 +00:00

smooth_scrolling now configurable

This commit is contained in:
? 2019-02-25 18:39:36 +01:00 committed by Zeno Rogue
parent 29afe683c3
commit 6808c4e926
4 changed files with 13 additions and 7 deletions

View File

@ -362,6 +362,7 @@ void initConfig() {
addsaver(sightranges[gCubeTiling], "sight-cubes", 7); addsaver(sightranges[gCubeTiling], "sight-cubes", 7);
addsaver(sightranges[gCell120], "sight-120cell", 2 * M_PI); addsaver(sightranges[gCell120], "sight-120cell", 2 * M_PI);
addsaver(sightranges[gECell120], "sight-120cell-elliptic", M_PI); addsaver(sightranges[gECell120], "sight-120cell-elliptic", M_PI);
addsaver(smooth_scrolling, "smooth-scrolling", false);
addsaver(vid.consider_shader_projection, "shader-projection", true); addsaver(vid.consider_shader_projection, "shader-projection", true);

View File

@ -240,10 +240,10 @@ bool didsomething;
typedef SDL_Event eventtype; typedef SDL_Event eventtype;
bool smooth_movement = (DIM == 3); bool smooth_scrolling = false;
void handlePanning(int sym, int uni) { void handlePanning(int sym, int uni) {
if(rug::rugged || smooth_movement) return; if(rug::rugged || smooth_scrolling) return;
#if !ISPANDORA #if !ISPANDORA
if(sym == SDLK_END && DIM == 3) { if(sym == SDLK_END && DIM == 3) {
@ -581,7 +581,7 @@ void mainloopiter() {
SDL_Event ev; SDL_Event ev;
DEBB(DF_GRAPH, (debugfile,"polling for events\n")); DEBB(DF_GRAPH, (debugfile,"polling for events\n"));
if(smooth_movement) { if(smooth_scrolling && !shmup::on && !rug::rugged) {
static int lastticks; static int lastticks;
ld t = (ticks - lastticks) * shiftmul / 1000.; ld t = (ticks - lastticks) * shiftmul / 1000.;
lastticks = ticks; lastticks = ticks;
@ -591,13 +591,13 @@ void mainloopiter() {
if(keystate[SDLK_HOME] && DIM == 3 && DEFAULTNOR(SDLK_HOME)) if(keystate[SDLK_HOME] && DIM == 3 && DEFAULTNOR(SDLK_HOME))
View = cpush(2, t) * View, didsomething = true, playermoved = false; View = cpush(2, t) * View, didsomething = true, playermoved = false;
if(keystate[SDLK_RIGHT] && DEFAULTNOR(SDLK_RIGHT)) 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)) 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)) 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)) 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(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) {
if(conformal::on) if(conformal::on)
conformal::rotation+=t; conformal::rotation+=t;

View File

@ -1792,6 +1792,7 @@ bool needConfirmationEvenIfSaved();
#define DEFAULTCONTROL (multi::players == 1 && !shmup::on && !multi::alwaysuse && !(rug::rugged && rug::renderonce)) #define DEFAULTCONTROL (multi::players == 1 && !shmup::on && !multi::alwaysuse && !(rug::rugged && rug::renderonce))
#define DEFAULTNOR(sym) (DEFAULTCONTROL || multi::notremapped(sym)) #define DEFAULTNOR(sym) (DEFAULTCONTROL || multi::notremapped(sym))
extern bool smooth_scrolling;
extern bool timerghost; extern bool timerghost;
extern bool gen_wandering; extern bool gen_wandering;

View File

@ -379,6 +379,9 @@ struct shmup_configurer {
else dialog::addBreak(100); else dialog::addBreak(100);
if(playercfg > 3) if(playercfg > 3)
dialog::addItem(XLAT("configure player 4") + dsc(3), '4'); 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); else dialog::addBreak(100);
if(playercfg > 4) if(playercfg > 4)
@ -443,6 +446,7 @@ struct shmup_configurer {
#if CAP_SDLJOY #if CAP_SDLJOY
else if(uni == 'b') pushScreen(showJoyConfig); else if(uni == 'b') pushScreen(showJoyConfig);
#endif #endif
else if(uni == 'c') smooth_scrolling = !smooth_scrolling;
else if(uni == 'r') else if(uni == 'r')
for(int i=0; i<MAXPLAYER; i++) for(int i=0; i<MAXPLAYER; i++)
kills[i] = deaths[i] = treasures[i] = 0; kills[i] = deaths[i] = treasures[i] = 0;