From bafbad6b5bf45ebbbb426b064fa8490c0e55a7d1 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 13 Mar 2021 00:25:51 +0000 Subject: [PATCH] Migrate RedBack away from gpBuffer --- Source/control.cpp | 12 ++++++------ Source/control.h | 2 +- Source/gmenu.cpp | 2 +- Source/scrollrt.cpp | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index 032b95fe6..b735949e2 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1755,30 +1755,30 @@ void DrawDurIcon(CelOutputBuffer out) DrawDurIcon4Item(out, &p->InvBody[INVLOC_HAND_RIGHT], x, 0); } -void RedBack() +void RedBack(CelOutputBuffer out) { int idx; idx = light4flag ? 1536 : 4608; - assert(gpBuffer); + assert(out.begin != NULL); int w, h; BYTE *dst, *tbl; if (leveltype != DTYPE_HELL) { - dst = &gpBuffer[SCREENXY(0, 0)]; + dst = out.at(SCREEN_X, SCREEN_Y); tbl = &pLightTbl[idx]; - for (h = gnViewportHeight; h; h--, dst += BUFFER_WIDTH - gnScreenWidth) { + for (h = gnViewportHeight; h; h--, dst += out.line_width - gnScreenWidth) { for (w = gnScreenWidth; w; w--) { *dst = tbl[*dst]; dst++; } } } else { - dst = &gpBuffer[SCREENXY(0, 0)]; + dst = out.at(SCREEN_X, SCREEN_Y); tbl = &pLightTbl[idx]; - for (h = gnViewportHeight; h; h--, dst += BUFFER_WIDTH - gnScreenWidth) { + for (h = gnViewportHeight; h; h--, dst += out.line_width - gnScreenWidth) { for (w = gnScreenWidth; w; w--) { if (*dst >= 32) *dst = tbl[*dst]; diff --git a/Source/control.h b/Source/control.h index 4d8e8b773..65244de8f 100644 --- a/Source/control.h +++ b/Source/control.h @@ -119,7 +119,7 @@ void DrawLevelUpIcon(CelOutputBuffer out); void CheckChrBtns(); void ReleaseChrBtns(bool addAllStatPoints); void DrawDurIcon(CelOutputBuffer out); -void RedBack(); +void RedBack(CelOutputBuffer out); void DrawSpellBook(CelOutputBuffer out); void CheckSBook(); const char *get_pieces_str(int nGold); diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index dea6c714d..69a04c945 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -64,7 +64,7 @@ static void gmenu_print_text(CelOutputBuffer out, int x, int y, const char *pszS void gmenu_draw_pause(CelOutputBuffer out) { if (currlevel != 0) - RedBack(); + RedBack(out); if (!sgpCurrentMenu) { light_table_index = 0; gmenu_print_text(out, 316 + PANEL_LEFT, 336, "Pause"); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 5497a1629..940478716 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1254,7 +1254,7 @@ void DrawView(CelOutputBuffer out, int StartX, int StartY) DrawDiabloMsg(out); } if (deathflag) { - RedBack(); + RedBack(out); } else if (PauseMode != 0) { gmenu_draw_pause(out); }