From 4c5b018f6c950431e5d8f63de27a79793ff3235e Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 22 Jun 2020 16:41:07 -0700 Subject: [PATCH] Fix delta rendering glitch when going to options from new Esc menu Well this is a bit annoying. I can call graphics.updatetowerbackground() just fine, but I have to get at the title color update routine inside titlelogic(), which is hard-baked in. So I have to pull that code outside of the function, export it in the header, and then call it when I transition to TITLEMODE. --- desktop_version/src/Input.cpp | 9 +++++++++ desktop_version/src/Logic.cpp | 23 ++++++++++++++--------- desktop_version/src/Logic.h | 2 ++ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index b7a44fce..ad70dd16 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -1,4 +1,5 @@ #include "Input.h" +#include "Logic.h" #include "Script.h" #include "MakeAndPlay.h" @@ -2094,6 +2095,10 @@ void mapmenuactionpress() game.gamestate = TITLEMODE; game.createmenu(Menu::graphicoptions); map.nexttowercolour(); + + // Fix delta rendering glitch + graphics.updatetowerbackground(); + titleupdatetextcol(); break; case 33: // Game options @@ -2101,6 +2106,10 @@ void mapmenuactionpress() game.gamestate = TITLEMODE; game.createmenu(Menu::options); map.nexttowercolour(); + + // Fix delta rendering glitch + graphics.updatetowerbackground(); + titleupdatetextcol(); break; } } diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 8771f178..71644d2a 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -3,6 +3,19 @@ #include "Network.h" #include "FileSystemUtils.h" +void titleupdatetextcol() +{ + graphics.col_tr = map.r - (help.glow / 4) - int(fRandom() * 4); + graphics.col_tg = map.g - (help.glow / 4) - int(fRandom() * 4); + graphics.col_tb = map.b - (help.glow / 4) - int(fRandom() * 4); + if (graphics.col_tr < 0) graphics.col_tr = 0; + if(graphics.col_tr>255) graphics.col_tr=255; + if (graphics.col_tg < 0) graphics.col_tg = 0; + if(graphics.col_tg>255) graphics.col_tg=255; + if (graphics.col_tb < 0) graphics.col_tb = 0; + if(graphics.col_tb>255) graphics.col_tb=255; +} + void titlelogic() { //Misc @@ -25,15 +38,7 @@ void titlelogic() } else { - graphics.col_tr = map.r - (help.glow / 4) - int(fRandom() * 4); - graphics.col_tg = map.g - (help.glow / 4) - int(fRandom() * 4); - graphics.col_tb = map.b - (help.glow / 4) - int(fRandom() * 4); - if (graphics.col_tr < 0) graphics.col_tr = 0; - if(graphics.col_tr>255) graphics.col_tr=255; - if (graphics.col_tg < 0) graphics.col_tg = 0; - if(graphics.col_tg>255) graphics.col_tg=255; - if (graphics.col_tb < 0) graphics.col_tb = 0; - if(graphics.col_tb>255) graphics.col_tb=255; + titleupdatetextcol(); graphics.updatetitlecolours(); } diff --git a/desktop_version/src/Logic.h b/desktop_version/src/Logic.h index ff947ece..2c90b3fb 100644 --- a/desktop_version/src/Logic.h +++ b/desktop_version/src/Logic.h @@ -8,6 +8,8 @@ #include "Music.h" #include "Map.h" +void titleupdatetextcol(); + void titlelogic(); void maplogic();