diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 472c732a..652b2469 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -171,7 +171,6 @@ void Game::init(void) colourblindmode = false; noflashingmode = false; slowdown = 30; - gameframerate=34; // 0..5 controllerSensitivity = 2; @@ -4610,25 +4609,6 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, ScreenSettings* s if (pKey == "slowdown") { slowdown = help.Int(pText); - switch(slowdown) - { - case 30: - gameframerate=34; - break; - case 24: - gameframerate=41; - break; - case 18: - gameframerate=55; - break; - case 12: - gameframerate=83; - break; - default: - gameframerate=34; - break; - } - } if (pKey == "advanced_smoothing") diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 9d67a060..360ddac3 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -275,7 +275,6 @@ public: bool colourblindmode; bool noflashingmode; int slowdown; - Uint32 gameframerate; bool nodeathmode; int gameoverdelay; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 0c2d6ee6..914ff7e3 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -488,7 +488,6 @@ void menuactionpress() { case 0: //back - game.gameframerate=34; game.slowdown = 30; game.savestats(); music.playef(11); @@ -497,7 +496,6 @@ void menuactionpress() map.nexttowercolour(); break; case 1: - game.gameframerate=41; game.slowdown = 24; game.savestats(); music.playef(11); @@ -506,7 +504,6 @@ void menuactionpress() map.nexttowercolour(); break; case 2: - game.gameframerate=55; game.slowdown = 18; game.savestats(); music.playef(11); @@ -515,7 +512,6 @@ void menuactionpress() map.nexttowercolour(); break; case 3: - game.gameframerate=83; game.slowdown = 12; game.savestats(); music.playef(11); @@ -630,7 +626,7 @@ void menuactionpress() else { music.playef(2); - game.gameframerate = 34; + game.slowdown = 30; } break; case 5: diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index da7a6bcc..9d0e2c9e 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -25,6 +25,25 @@ int inline FLIP(int ypos) return ypos; } +static inline void drawslowdowntext() +{ + switch (game.slowdown) + { + case 30: + graphics.Print( -1, 105, "Game speed is normal.", tr/2, tg/2, tb/2, true); + break; + case 24: + graphics.Print( -1, 105, "Game speed is at 80%", tr, tg, tb, true); + break; + case 18: + graphics.Print( -1, 105, "Game speed is at 60%", tr, tg, tb, true); + break; + case 12: + graphics.Print( -1, 105, "Game speed is at 40%", tr, tg, tb, true); + break; + } +} + void menurender() { int temp = 50; @@ -369,21 +388,7 @@ void menurender() case Menu::setslowdown: graphics.bigprint( -1, 40, "Game Speed", tr, tg, tb, true); graphics.Print( -1, 75, "Select a new game speed below.", tr, tg, tb, true); - switch (game.gameframerate) - { - case 34: - graphics.Print( -1, 105, "Game speed is normal.", tr/2, tg/2, tb/2, true); - break; - case 41: - graphics.Print( -1, 105, "Game speed is at 80%", tr, tg, tb, true); - break; - case 55: - graphics.Print( -1, 105, "Game speed is at 60%", tr, tg, tb, true); - break; - case 83: - graphics.Print( -1, 105, "Game speed is at 40%", tr, tg, tb, true); - break; - } + drawslowdowntext(); break; case Menu::newgamewarning: graphics.Print( -1, 100, "Are you sure? This will", tr, tg, tb, true); @@ -556,23 +561,7 @@ void menurender() graphics.bigprint( -1, 40, "Game Speed", tr, tg, tb, true); graphics.Print( -1, 75, "May be useful for disabled gamers", tr, tg, tb, true); graphics.Print( -1, 85, "using one switch devices.", tr, tg, tb, true); - if (game.gameframerate==34) - { - graphics.Print( -1, 105, "Game speed is normal.", tr/2, tg/2, tb/2, true); - } - else if (game.gameframerate==41) - { - graphics.Print( -1, 105, "Game speed is at 80%", tr, tg, tb, true); - } - else if (game.gameframerate==55) - { - graphics.Print( -1, 105, "Game speed is at 60%", tr, tg, tb, true); - } - else if (game.gameframerate==83) - { - graphics.Print( -1, 105, "Game speed is at 40%", tr, tg, tb, true); - } - break; + drawslowdowntext(); } break; case Menu::playint1: @@ -588,7 +577,7 @@ void menurender() graphics.Print( -1, 65, "Replay any level in the game in", tr, tg, tb, true); graphics.Print( -1, 75, "a competitive time trial mode.", tr, tg, tb, true); - if (game.gameframerate > 34 || map.invincibility) + if (game.slowdown < 30 || map.invincibility) { graphics.Print( -1, 105, "Time Trials are not available", tr, tg, tb, true); graphics.Print( -1, 115, "with slowdown or invincibility.", tr, tg, tb, true); @@ -609,7 +598,7 @@ void menurender() graphics.Print( -1, 65, "Play the entire game", tr, tg, tb, true); graphics.Print( -1, 75, "without dying once.", tr, tg, tb, true); - if (game.gameframerate > 34 || map.invincibility) + if (game.slowdown < 30 || map.invincibility) { graphics.Print( -1, 105, "No Death Mode is not available", tr, tg, tb, true); graphics.Print( -1, 115, "with slowdown or invincibility.", tr, tg, tb, true); diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index 3b559d90..1e802152 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -55,6 +55,23 @@ volatile Uint32 accumulator = 0; volatile Uint32 f_time = 0; volatile Uint32 f_timePrev = 0; +static inline Uint32 get_framerate(const int slowdown) +{ + switch (slowdown) + { + case 30: + return 34; + case 24: + return 41; + case 18: + return 55; + case 12: + return 83; + } + + return 34; +} + void inline deltaloop(); void inline fixedloop(); @@ -278,14 +295,6 @@ int main(int argc, char *argv[]) game.gamestate = TITLEMODE; if (game.slowdown == 0) game.slowdown = 30; - switch(game.slowdown){ - case 30: game.gameframerate=34; break; - case 24: game.gameframerate=41; break; - case 18: game.gameframerate=55; break; - case 12: game.gameframerate=83; break; - default: game.gameframerate=34; break; - } - //Check to see if you've already unlocked some achievements here from before the update if (game.swnbestrank > 0){ if(game.swnbestrank >= 1) game.unlockAchievement("vvvvvvsupgrav5"); @@ -413,7 +422,7 @@ void inline deltaloop() } else if (game.gamestate == GAMEMODE) { - timesteplimit = game.gameframerate; + timesteplimit = get_framerate(game.slowdown); } else {