From c655d72f5ae191211ca7a5f3a091c6530a67df46 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 16 Sep 2008 07:16:26 +0000 Subject: - Fixed centerText() to print text at the correct height - Removed some duplicate code svn-id: r34569 --- engines/drascula/graphics.cpp | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'engines/drascula/graphics.cpp') diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index a4005e329d..de35de5ab2 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -192,25 +192,7 @@ void DrasculaEngine::copyRect(int xorg, int yorg, int xdes, int ydes, int width, } void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) { - byte *ptr = VGA; - - ptr += xdes + ydes * 320; - buffer += xorg + yorg * 320; - - /* Unoptimized code - for (int x = 0; x < height; x++) { - memcpy(ptr + 320 * x, buffer + 320 * x, width); - } */ - - // A bit more optimized code, thanks to Fingolfin - // Uses 2 less registers and performs 2 less multiplications - int x = height; - while (x--) { - memcpy(ptr, buffer, width); - ptr += 320; - buffer += 320; - } - + copyBackground(xorg, yorg, xdes, ydes, width, height, buffer, VGA); _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); _system->updateScreen(); } @@ -316,7 +298,8 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { char *curWord; int curLine = 0; int x = 0; - int y = textY - (3 * CHAR_HEIGHT); // original starts printing 3 lines above textY + // original starts printing 4 lines above textY + int y = CLIP(textY - (4 * CHAR_HEIGHT), 0, 320); strcpy(msg, message); @@ -351,7 +334,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { } // Get next word - curWord = strtok (NULL, " "); + curWord = strtok(NULL, " "); if (curWord == NULL) { x = CLIP(textX - strlen(messageLine) * CHAR_WIDTH / 2, 60, 255); -- cgit v1.2.3