diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 7fb3a4af..1476a4cb 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -7381,3 +7381,30 @@ void Game::returntolab() music.play(11); } + +#if !defined(NO_CUSTOM_LEVELS) +void Game::returntoeditor() +{ + game.gamestate = EDITORMODE; + + graphics.textboxremove(); + game.hascontrol = true; + game.advancetext = false; + game.completestop = false; + game.state = 0; + graphics.showcutscenebars = false; + graphics.fademode = 0; + + graphics.backgrounddrawn=false; + music.fadeout(); + //If warpdir() is used during playtesting, we need to set it back after! + for (int j = 0; j < ed.maxheight; j++) + { + for (int i = 0; i < ed.maxwidth; i++) + { + ed.level[i+(j*ed.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*ed.maxwidth)]; + } + } + map.scrolldir = 0; +} +#endif diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 0dd62d0f..3ca81ba4 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -385,6 +385,10 @@ public: int fadetomenudelay; bool fadetolab; int fadetolabdelay; + +#if !defined(NO_CUSTOM_LEVELS) + void returntoeditor(); +#endif }; extern Game game; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index da0af4a3..8f01fd74 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -1537,27 +1537,7 @@ void gameinput() game.activeactivity = -1; } }else{ - game.gamestate = EDITORMODE; - - graphics.textboxremove(); - game.hascontrol = true; - game.advancetext = false; - game.completestop = false; - game.state = 0; - graphics.showcutscenebars = false; - graphics.fademode = 0; - - graphics.backgrounddrawn=false; - music.fadeout(); - //If warpdir() is used during playtesting, we need to set it back after! - for (int j = 0; j < ed.maxheight; j++) - { - for (int i = 0; i < ed.maxwidth; i++) - { - ed.level[i+(j*ed.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*ed.maxwidth)]; - } - } - map.scrolldir = 0; + game.returntoeditor(); } } }