From a0af2a8ebe73bed3585f62eb1630dc80abc3685f Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 13 Mar 2021 00:54:52 +0000 Subject: [PATCH] Migrate gmenu_clear_buffer away from gpBuffer --- Source/error.cpp | 2 +- Source/gmenu.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/error.cpp b/Source/error.cpp index 99dfcad6d..9fcf43284 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -124,7 +124,7 @@ void DrawDiabloMsg(CelOutputBuffer out) sy += 12; } - assert(gpBuffer); + assert(out.begin); DrawHalfTransparentRectTo(out, PANEL_X + 104, DIALOG_Y - 8, 432, 54); diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 69a04c945..c7bd54a9a 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -156,14 +156,12 @@ void gmenu_set_items(TMenuItem *pItem, void (*gmFunc)(TMenuItem *)) gmenu_up_down(TRUE); } -static void gmenu_clear_buffer(int x, int y, int width, int height) +static void gmenu_clear_buffer(CelOutputBuffer out, int x, int y, int width, int height) { - BYTE *i; - - i = gpBuffer + BUFFER_WIDTH * y + x; + BYTE *i = out.at(x, y); while (height--) { memset(i, 205, width); - i -= BUFFER_WIDTH; + i -= out.line_width; } } @@ -196,7 +194,7 @@ static void gmenu_draw_menu_item(CelOutputBuffer out, TMenuItem *pItem, int y) if (nSteps < 2) nSteps = 2; pos = step * 256 / nSteps; - gmenu_clear_buffer(x + 2 + PANEL_LEFT, y - 12, pos + 13, 28); + gmenu_clear_buffer(out, x + 2 + PANEL_LEFT, y - 12, pos + 13, 28); CelDrawTo(out, x + 2 + pos + PANEL_LEFT, y - 12, option_cel, 1, 27); } x = gnScreenWidth / 2 - w / 2 + SCREEN_X;