diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index d8f3225c..fbee997c 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -7146,3 +7146,16 @@ void Game::unlockAchievement(const char *name) { if (!map.custommode) NETWORK_unlockAchievement(name); #endif } + +void Game::mapmenuchange(const int newgamestate) +{ + gamestate = newgamestate; + graphics.resumegamemode = false; + + graphics.menuoffset = 240; + if (map.extrarow) + { + graphics.menuoffset -= 10; + } + graphics.oldmenuoffset = graphics.menuoffset; +} diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 581b5231..5db0a21d 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -218,6 +218,7 @@ public: int tapleft, tapright; //Menu interaction stuff + void mapmenuchange(const int newgamestate); bool mapheld; int menupage; int lastsaved; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 2eb8813e..217354ab 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -1846,18 +1846,7 @@ void gameinput() else if (game.companion == 0) { //Alright, normal teleporting - game.gamestate = TELEPORTERMODE; - graphics.menuoffset = 240; //actually this should count the roomname - graphics.oldmenuoffset = 240; - if (map.extrarow) - { - graphics.menuoffset -= 10; - graphics.oldmenuoffset -= 10; - } - - BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL); - - graphics.resumegamemode = false; + game.mapmenuchange(TELEPORTERMODE); game.useteleporter = true; game.initteleportermode(); @@ -2010,19 +1999,10 @@ void gameinput() //quitting the super gravitron game.mapheld = true; //Quit menu, same conditions as in game menu - game.gamestate = MAPMODE; + game.mapmenuchange(MAPMODE); game.gamesaved = false; game.gamesavefailed = false; - graphics.resumegamemode = false; game.menupage = 20; // The Map Page - BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL); - graphics.menuoffset = 240; //actually this should count the roomname - graphics.oldmenuoffset = 240; - if (map.extrarow) - { - graphics.menuoffset -= 10; - graphics.oldmenuoffset -= 10; - } } else if (game.intimetrial && graphics.fademode == 0) { @@ -2039,12 +2019,11 @@ void gameinput() else { //Normal map screen, do transition later - game.gamestate = MAPMODE; + game.mapmenuchange(MAPMODE); map.cursordelay = 0; map.cursorstate = 0; game.gamesaved = false; game.gamesavefailed = false; - graphics.resumegamemode = false; if (script.running) { game.menupage = 3; // Only allow saving @@ -2053,34 +2032,16 @@ void gameinput() { game.menupage = 0; // The Map Page } - BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL); - graphics.menuoffset = 240; //actually this should count the roomname - graphics.oldmenuoffset = 240; - if (map.extrarow) - { - graphics.menuoffset -= 10; - graphics.oldmenuoffset -= 10; - } } if ((key.isDown(27) || key.isDown(game.controllerButton_esc)) && (!map.custommode || map.custommodeforreal)) { game.mapheld = true; //Quit menu, same conditions as in game menu - game.gamestate = MAPMODE; + game.mapmenuchange(MAPMODE); game.gamesaved = false; game.gamesavefailed = false; - graphics.resumegamemode = false; game.menupage = 30; // Pause screen - - BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL); - graphics.menuoffset = 240; //actually this should count the roomname - graphics.oldmenuoffset = 240; - if (map.extrarow) - { - graphics.menuoffset -= 10; - graphics.oldmenuoffset -= 10; - } } if (game.deathseq == -1 && (key.isDown(SDLK_r) || key.isDown(game.controllerButton_restart)) && !game.nodeathmode)// && map.custommode) //Have fun glitchrunners! diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index a7f41fdc..f606cf00 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -1322,17 +1322,7 @@ void scriptclass::run() { if (words[1] == "teleporter") { - //TODO this draw the teleporter screen. This is a problem. :( - game.gamestate = TELEPORTERMODE; - graphics.menuoffset = 240; //actually this should count the roomname - graphics.oldmenuoffset = 240; - if (map.extrarow) - { - graphics.menuoffset -= 10; - graphics.oldmenuoffset -= 10; - } - - graphics.resumegamemode = false; + game.mapmenuchange(TELEPORTERMODE); game.useteleporter = false; //good heavens don't actually use it }