From 118401f17e6157bb49a9ace85dfc1da8273332f8 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 29 Apr 2020 15:25:01 -0700 Subject: [PATCH] Move tower background update code to logic functions Otherwise it'll go really really quickly, which is not good. --- desktop_version/src/Graphics.cpp | 9 +++++---- desktop_version/src/Graphics.h | 1 + desktop_version/src/Logic.cpp | 19 ++++++++++++++++++- desktop_version/src/editor.cpp | 4 ++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 89dedd45..6b600202 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -2348,6 +2348,11 @@ void Graphics::drawtowerspikes() } void Graphics::drawtowerbackground() +{ + SDL_BlitSurface(towerbuffer,NULL, backBuffer,NULL); +} + +void Graphics::updatetowerbackground() { int temp; @@ -2366,8 +2371,6 @@ void Graphics::drawtowerbackground() } } - SDL_BlitSurface(towerbuffer,NULL, backBuffer,NULL); - map.tdrawback = false; } else @@ -2394,8 +2397,6 @@ void Graphics::drawtowerbackground() drawtowertile3(i * 8, 31*8 - (map.bypos % 8) - map.bscroll, temp, map.colstate); } } - - SDL_BlitSurface(towerbuffer,NULL, backBuffer,NULL); } } diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 0874a310..a3d44443 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -197,6 +197,7 @@ public: void menuoffrender(); void drawtowerbackground(); + void updatetowerbackground(); void setcol(int t); void drawfinalmap(); diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index f9086f6c..0f3a7298 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -12,6 +12,11 @@ void titlelogic() map.bypos -= 2; map.bscroll = -2; + if (!game.colourblindmode) + { + graphics.updatetowerbackground(); + } + if (game.menucountdown > 0) { game.menucountdown--; @@ -96,6 +101,11 @@ void gamecompletelogic() map.bscroll = +1; } + if (!game.colourblindmode) + { + graphics.updatetowerbackground(); + } + if (graphics.fademode == 1) { //Fix some graphical things @@ -1542,7 +1552,14 @@ void gamelogic() if (!game.colourblindmode) { - graphics.updatebackground(map.background); + if (map.towermode) + { + graphics.updatetowerbackground(); + } + else + { + graphics.updatebackground(map.background); + } } if (!game.blackout) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index d571b196..c079a032 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -3622,6 +3622,10 @@ void editorlogic() break; } } + else if (!game.colourblindmode) + { + graphics.updatetowerbackground(); + } if (graphics.fademode == 1) {