Browse Source

CelOutputBuffer: Replace subregion with subregionY

We can't do anything with X yet
pull/1170/head
Gleb Mazovetskiy 5 years ago committed by Anders Jenbo
parent
commit
3c4ccfc2e4
  1. 7
      Source/engine.h
  2. 2
      Source/minitext.cpp
  3. 2
      Source/scrollrt.cpp

7
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
};

2
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);
}

2
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();

Loading…
Cancel
Save