From 2d9d0cffa531f16c23352b1841d412467e53e7da Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 18 Mar 2021 21:14:40 -0700 Subject: [PATCH] Fix 1-frame glitch when going to in-game options from edsettings The menu creation of Graphic Options or Game Options, as well as the map.nexttowercolour() call, all need to be deferred until the end of the frame. --- desktop_version/src/editor.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index c5b73bdf..490517c2 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -9,6 +9,7 @@ #include #include +#include "DeferCallbacks.h" #include "Entity.h" #include "Enums.h" #include "FileSystemUtils.h" @@ -3669,6 +3670,20 @@ void editorlogic(void) } } +static void creategraphicoptions(void) +{ + game.createmenu(Menu::graphicoptions); +} + +static void creategameoptions(void) +{ + game.createmenu(Menu::options); +} + +static void nextbgcolor(void) +{ + map.nexttowercolour(); +} static void editormenuactionpress(void) { @@ -3768,14 +3783,14 @@ static void editormenuactionpress(void) if (game.currentmenuoption == 6) { - game.createmenu(Menu::graphicoptions); + DEFER_CALLBACK(creategraphicoptions); } else { - game.createmenu(Menu::options); + DEFER_CALLBACK(creategameoptions); } - map.nexttowercolour(); + DEFER_CALLBACK(nextbgcolor); break; default: music.playef(11);