From 920bea0fd9a161eba08c4057871177010c79ac1f Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 2 Feb 2016 23:27:13 +0100 Subject: AGI: add drawCharacterOnDisplay() --- engines/agi/graphics.cpp | 17 ++++++++++------- engines/agi/graphics.h | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index a9b1a1c730..af1b9b1755 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -589,7 +589,13 @@ void GfxMgr::drawDisplayRectCGA(int16 x, int16 y, int16 width, int16 height, byt // row + column are text-coordinates void GfxMgr::drawCharacter(int16 row, int16 column, byte character, byte foreground, byte background, bool disabledLook) { - int16 startX, startY; + int16 x = column * FONT_DISPLAY_WIDTH; + int16 y = row * FONT_DISPLAY_HEIGHT; + + drawCharacterOnDisplay(x, y, character, foreground, background, disabledLook); +} + +void GfxMgr::drawCharacterOnDisplay(int16 x, int16 y, byte character, byte foreground, byte background, bool disabledLook) { int16 curX, curY; const byte *fontData; byte curByte = 0; @@ -597,9 +603,6 @@ void GfxMgr::drawCharacter(int16 row, int16 column, byte character, byte foregro byte curTransformXOR = 0; byte curTransformOR = 0; - startX = column * FONT_DISPLAY_HEIGHT; - startY = row * FONT_DISPLAY_WIDTH; - // get font data of specified character fontData = _vm->getFontData() + character * FONT_BYTES_PER_CHARACTER; @@ -627,15 +630,15 @@ void GfxMgr::drawCharacter(int16 row, int16 column, byte character, byte foregro curBit = 0x80; } if (curByte & curBit) { - putPixelOnDisplay(startX + curX, startY + curY, foreground); + putPixelOnDisplay(x + curX, y + curY, foreground); } else { - putPixelOnDisplay(startX + curX, startY + curY, background); + putPixelOnDisplay(x + curX, y + curY, background); } curBit = curBit >> 1; } } - copyDisplayRectToScreen(startX, startY, FONT_DISPLAY_WIDTH, FONT_DISPLAY_HEIGHT); + copyDisplayRectToScreen(x, y, FONT_DISPLAY_WIDTH, FONT_DISPLAY_HEIGHT); } #define SHAKE_VERTICAL_PIXELS 4 diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index 8d5260570c..3a8bb6043c 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -137,6 +137,7 @@ private: public: void drawCharacter(int16 row, int16 column, byte character, byte foreground, byte background, bool disabledLook); + void drawCharacterOnDisplay(int16 x, int16 y, byte character, byte foreground, byte background, bool disabledLook); void shakeScreen(int16 repeatCount); void updateScreen(); -- cgit v1.2.3