From 90280b0f92339ef041d75e8f7bdd986c39b112d1 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 1 May 2020 18:23:52 -0700 Subject: [PATCH] Interpolate end picture reveal scroll This is so it looks smooth at framerates above 30. --- desktop_version/src/Game.cpp | 1 + desktop_version/src/Game.h | 1 + desktop_version/src/Input.cpp | 3 +++ desktop_version/src/Render.cpp | 2 ++ 4 files changed, 7 insertions(+) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index dc671027..ace73e9a 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -162,6 +162,7 @@ void Game::init(void) creditposx = 0; creditposy = 0; creditposdelay = 0; + oldcreditposx = 0; useteleporter = false; teleport_to_teleporter = 0; diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index cbbf0711..c94f71dc 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -232,6 +232,7 @@ public: enum Menu::MenuName menudest; int creditposx, creditposy, creditposdelay; + int oldcreditposx; //Sine Wave Ninja Minigame diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 0f670850..cc0becbf 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -2220,10 +2220,13 @@ void gamecompleteinput2() game.press_action = false; game.press_map = false; + //Do this here because input comes first + game.oldcreditposx = game.creditposx; if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip)) { game.creditposx++; + game.oldcreditposx++; if (game.creditposy >= 30) { if(graphics.fademode==0) diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index f9ebd606..faff6934 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1272,6 +1272,8 @@ void gamecompleterender2() } } + FillRect(graphics.backBuffer, graphics.lerp(game.oldcreditposx * 8, game.creditposx * 8) + 8, game.creditposy * 8, 8, 8, 0, 0, 0); + graphics.drawfade(); graphics.render();