From 93d822038841abfc8c71605d6b08469c750da0b1 Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 2 May 2020 12:06:40 -0700 Subject: [PATCH] Fix off-by-one in interpolation of extending gravity line Currently it interpolates it based on the current state of game.swngame, but when game.swngame changes the interpolation doesn't know that it has JUST changed or anything. So add a kludge variable to fix this off-by-one. --- desktop_version/src/Graphics.cpp | 4 +++- desktop_version/src/Graphics.h | 2 ++ desktop_version/src/Logic.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index fb202459..e2e2e983 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -137,6 +137,8 @@ void Graphics::init() col_tr = 0; col_tg = 0; col_tb = 0; + + kludgeswnlinewidth = false; } int Graphics::font_idx(uint32_t ch) { @@ -1649,7 +1651,7 @@ void Graphics::drawentities() case 5: //Horizontal Line { int oldw = obj.entities[i].w; - if (game.swngame == 3 && obj.getlineat(84 - 32) == i) + if ((game.swngame == 3 || kludgeswnlinewidth) && obj.getlineat(84 - 32) == i) { oldw -= 24; } diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index dbab3450..71b5aa98 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -320,6 +320,8 @@ public: int col_tg; int col_tb; void updatetitlecolours(); + + bool kludgeswnlinewidth; }; extern Graphics graphics; diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index a876fe17..6dc7d7b8 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -442,6 +442,7 @@ void gamelogic() game.lifesequence(); } + graphics.kludgeswnlinewidth = false; if (game.deathseq != -1) { @@ -747,6 +748,7 @@ void gamelogic() { obj.entities[obj.getlineat(84 - 32)].w = 332; game.swngame = 2; + graphics.kludgeswnlinewidth = true; } } else if (game.swngame == 4) //create top line