From 3c4ccfc2e4bb1a8810a5fd11f1820b3c412fb921 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 12 Mar 2021 23:20:18 +0000 Subject: [PATCH] CelOutputBuffer: Replace subregion with subregionY We can't do anything with X yet --- Source/engine.h | 7 +++++-- Source/minitext.cpp | 2 +- Source/scrollrt.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/engine.h b/Source/engine.h index 0b626d404..31bc1bd93 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -72,9 +72,12 @@ struct CelOutputBuffer { return x >= 0 && y >= 0 && begin + x + line_width * y < end; } - CelOutputBuffer subregion(int x0, int y0, int x1, int y1) const + /** + * @brief Returns a buffer that starts at y0 and ends at y1. + */ + CelOutputBuffer subregionY(int y0, int y1) const { - return CelOutputBuffer { at(x0, y0), std::min(at(x1, y1), end), line_width }; + return CelOutputBuffer { at(0, y0), std::min(at(0, y1), end), line_width }; } #endif }; diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 89b4f5f0e..79d38a959 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -146,7 +146,7 @@ void PrintQTextChr(int sx, int sy, Uint8 *pCelBuff, int nCel) { CelOutputBuffer buf = GlobalBackBuffer(); const int start_y = 49 + SCREEN_Y + UI_OFFSET_Y; - buf = buf.subregion(0, start_y, buf.line_width, 309 + SCREEN_Y + UI_OFFSET_Y); + buf = buf.subregionY(start_y, 309 + SCREEN_Y + UI_OFFSET_Y); CelDrawTo(buf, sx, sy - start_y, pCelBuff, nCel, 22); } diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 74595e996..b866327e8 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1218,7 +1218,7 @@ void DrawView(CelOutputBuffer out, int StartX, int StartY) { DrawGame(out, StartX, StartY); if (automapflag) { - DrawAutomap(out.subregion(0, 0, out.line_width, SCREEN_Y + gnViewportHeight)); + DrawAutomap(out.subregionY(0, SCREEN_Y + gnViewportHeight)); } DrawMonsterHealthBar();