From b50ca5b9e6da1b282dfc3f6565a4ec30e4dc675d Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 29 Apr 2020 13:44:28 -0700 Subject: [PATCH] Don't redraw tower background in descending towers Looks like this was done as a quick fix instead of taking the time to figure out the math needed to actually draw the incoming textures, which is fair enough - it only makes one room, Panic Room, slightly laggier. While I was working on my over-30-FPS patch, though, I came across the fact that this background kept getting entirely redrawn every frame, and it seems like it would be easier to interpolate descending tower backgrounds if we scrolled what was already there instead. Here, we have to draw two rows of incoming textures, otherwise the scrolling surface will produce black lines. --- desktop_version/src/Graphics.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index c7d5584f..e11556d0 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -2244,8 +2244,6 @@ void Graphics::drawtowerbackground() if (map.bypos < 0) map.bypos += 120 * 8; - if (map.scrolldir == 1) map.tdrawback = true; - if (map.tdrawback) { //Draw the whole thing; needed for every colour cycle! @@ -2268,8 +2266,18 @@ void Graphics::drawtowerbackground() ScrollSurface(towerbuffer, 0, -map.bscroll); for (int i = 0; i < 40; i++) { - temp = map.tower.backat(i, 0, map.bypos); - drawtowertile3(i * 8, -(map.bypos % 8), temp, map.colstate); + if (map.scrolldir == 0) + { + temp = map.tower.backat(i, 0, map.bypos); + drawtowertile3(i * 8, -(map.bypos % 8), temp, map.colstate); + } + else + { + temp = map.tower.backat(i, 29, map.bypos); + drawtowertile3(i * 8, 29*8 - (map.bypos % 8) - map.bscroll, temp, map.colstate); + temp = map.tower.backat(i, 30, map.bypos); + drawtowertile3(i * 8, 30*8 - (map.bypos % 8) - map.bscroll, temp, map.colstate); + } } SDL_BlitSurface(towerbuffer,NULL, backBuffer,NULL);