From f22756dd99311953195e767cd3dfc6acdecb0a87 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 19 Mar 2021 23:08:35 -0700 Subject: [PATCH] Ensure oldcutscenebars is updated when cutscenebarspos is To do this, I've added Graphics::setbars(), to make sure oldcutscenebarspos always gets assigned when cutscenebarspos is. This fixes potential deltaframe rendering issues if these two mismatch. --- desktop_version/src/Game.cpp | 3 +-- desktop_version/src/Graphics.cpp | 9 +++++++-- desktop_version/src/Graphics.h | 1 + desktop_version/src/Logic.cpp | 5 ++--- desktop_version/src/Script.cpp | 11 ++++------- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 4579bac5..ec286699 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -3219,8 +3219,7 @@ void Game::updatestate(void) map.final_colorframe = 0; map.finalstretch = false; - graphics.cutscenebarspos = 320; - graphics.oldcutscenebarspos = 320; + graphics.setbars(320); teleport_to_new_area = true; teleportscript = "gamecomplete"; diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 569539f1..dc2c2cb0 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -35,8 +35,7 @@ void Graphics::init(void) trinketcolset = false; showcutscenebars = false; - cutscenebarspos = 0; - oldcutscenebarspos = 0; + setbars(0); notextoutline = false; flipmode = false; @@ -1094,6 +1093,12 @@ void Graphics::cutscenebarstimer(void) } } +void Graphics::setbars(const int position) +{ + cutscenebarspos = position; + oldcutscenebarspos = position; +} + void Graphics::drawcrewman( int x, int y, int t, bool act, bool noshift /*=false*/ ) { if (!act) diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 2664ca58..b9b928ff 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -83,6 +83,7 @@ public: void cutscenebars(void); void cutscenebarstimer(void); + void setbars(const int position); void drawpartimage(int t, int xp, int yp, int wp, int hp); diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 03ce83ab..71c5ac33 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -71,8 +71,7 @@ void gamecompletelogic(void) { //Fix some graphical things graphics.showcutscenebars = false; - graphics.cutscenebarspos = 0; - graphics.oldcutscenebarspos = 0; + graphics.setbars(0); graphics.titlebg.scrolldir = 0; graphics.titlebg.bypos = 0; //Return to game @@ -104,7 +103,7 @@ void gamecompletelogic2(void) { //Fix some graphical things graphics.showcutscenebars = false; - graphics.cutscenebarspos = 0; + graphics.setbars(0); //Fix the save thingy game.deletequick(); int tmp=music.currentsong; diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index 8427cc53..879fd1dc 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -2641,8 +2641,7 @@ void scriptclass::startgamemode( int t ) game.start(); game.jumpheld = true; graphics.showcutscenebars = true; - graphics.cutscenebarspos = 320; - graphics.oldcutscenebarspos = 320; + graphics.setbars(320); //set flipmode if (graphics.setflipmode) graphics.flipmode = true; @@ -2908,8 +2907,7 @@ void scriptclass::startgamemode( int t ) game.start(); game.jumpheld = true; graphics.showcutscenebars = true; - graphics.cutscenebarspos = 320; - graphics.oldcutscenebarspos = 320; + graphics.setbars(320); //set flipmode if (graphics.setflipmode) graphics.flipmode = true; @@ -2937,8 +2935,7 @@ void scriptclass::startgamemode( int t ) game.start(); game.jumpheld = true; graphics.showcutscenebars = true; - graphics.cutscenebarspos = 320; - graphics.oldcutscenebarspos = 320; + graphics.setbars(320); //set flipmode if (graphics.setflipmode) graphics.flipmode = true; @@ -3644,7 +3641,7 @@ void scriptclass::hardreset(void) graphics.textbox.clear(); graphics.flipmode = false; //This will be reset if needs be elsewhere graphics.showcutscenebars = false; - graphics.cutscenebarspos = 0; + graphics.setbars(0); //mapclass map.warpx = false;