From 2c8d338e4757d5233d6330133630fa0f4c25cd1b Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 18 Mar 2021 19:52:30 -0700 Subject: [PATCH] Add graphic options and game options to editor settings This is a small quality-of-life tweak that makes it so if you're in the middle of editing a level, you don't have to save the level, exit to the menu, change whatever setting you wanted, re-enter the editor, and type in the level name, just to change one setting. This is the same as adding Graphic Options and Game Options to the in-game pause menu, except for the editor, too. To do this, I'm reusing Game::returntopausemenu() (because all of its callers are the same callers for returning to editor settings) and renamed it to returntoingame(), then added a variable named ingame_editormode to Game. When we're in the options menus but still in the editor, BOTH ingame_titlemode and ingame_editormode will be true. --- desktop_version/src/Game.cpp | 29 +++++++++++++++++++++++------ desktop_version/src/Game.h | 5 ++++- desktop_version/src/Input.cpp | 6 +++--- desktop_version/src/editor.cpp | 19 +++++++++++++++++++ 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 96ced9e1..1c20cd1e 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -373,6 +373,9 @@ void Game::init(void) glitchrunnermode = false; ingame_titlemode = false; +#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR) + ingame_editormode = false; +#endif kludge_ingametemp = Menu::mainmenu; disablepause = false; @@ -6394,6 +6397,8 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) option("editor ghosts"); option("load level"); option("save level"); + option("graphic options"); + option("game options"); option("quit to main menu"); menuyoff = -20; @@ -7076,16 +7081,28 @@ void Game::returntoeditor(void) } #endif -void Game::returntopausemenu(void) +void Game::returntoingame(void) { ingame_titlemode = false; - returntomenu(kludge_ingametemp); - gamestate = MAPMODE; mapheld = true; - graphics.flipmode = graphics.setflipmode; - if (!map.custommode && !graphics.flipmode) +#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR) + if (ingame_editormode) { - obj.flags[73] = true; + ingame_editormode = false; + returntomenu(Menu::ed_settings); + gamestate = EDITORMODE; + ed.settingskey = true; + } + else +#endif + { + returntomenu(kludge_ingametemp); + gamestate = MAPMODE; + graphics.flipmode = graphics.setflipmode; + if (!map.custommode && !graphics.flipmode) + { + obj.flags[73] = true; + } } } diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index d74386a5..ddde2186 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -442,8 +442,11 @@ public: bool glitchrunnermode; // Have fun speedrunners! <3 Misa bool ingame_titlemode; +#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR) + bool ingame_editormode; +#endif - void returntopausemenu(void); + void returntoingame(void); void unlockAchievement(const char *name); bool disablepause; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index a07d0b16..42b64a67 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -455,7 +455,7 @@ static void menuactionpress(void) music.playef(11); if (game.ingame_titlemode) { - game.returntopausemenu(); + game.returntoingame(); } else { @@ -766,7 +766,7 @@ static void menuactionpress(void) music.playef(11); if (game.ingame_titlemode) { - game.returntopausemenu(); + game.returntoingame(); } else { @@ -1634,7 +1634,7 @@ void titleinput(void) && (game.currentmenuname == Menu::options || game.currentmenuname == Menu::graphicoptions)) { - game.returntopausemenu(); + game.returntoingame(); } else { diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 5125e6ac..87c93db5 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -3769,6 +3769,25 @@ static void editormenuactionpress() graphics.backgrounddrawn=false; break; case 6: + case 7: + /* Graphic options and game options */ + music.playef(11); + game.gamestate = TITLEMODE; + game.ingame_titlemode = true; + game.ingame_editormode = true; + + if (game.currentmenuoption == 6) + { + game.createmenu(Menu::graphicoptions); + } + else + { + game.createmenu(Menu::options); + } + + map.nexttowercolour(); + break; + default: music.playef(11); game.createmenu(Menu::ed_quit); map.nexttowercolour();