From 2dd4f61b5e4ebbe3a4c33a8c8994b3fafdf75642 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 2 Sep 2007 22:47:53 +0000 Subject: Text in Mickey is shown correctly now. Also, removed an obsolete function declaration of PutPixel() svn-id: r28835 --- engines/agi/agi.h | 1 - engines/agi/font.h | 2 +- engines/agi/graphics.cpp | 4 ++-- engines/agi/graphics.h | 4 ++-- engines/agi/preagi_common.cpp | 21 ++------------------- 5 files changed, 7 insertions(+), 25 deletions(-) (limited to 'engines') diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 4de8d46d05..ac61dc8e77 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -1006,7 +1006,6 @@ public: void drawStr(int row, int col, int attr, const char *buffer); void drawStrMiddle(int row, int attr, const char *buffer); void clearTextArea(); - void drawChar(int x, int y, int attr, int code, const char *fontdata); }; } // End of namespace Agi diff --git a/engines/agi/font.h b/engines/agi/font.h index 7825dafaff..072888b718 100644 --- a/engines/agi/font.h +++ b/engines/agi/font.h @@ -294,7 +294,7 @@ static const uint8 curFont[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x7E, 0x00 }; -const uint8 mickey_fontdata[] = { +static const uint8 mickey_fontdata[] = { 0x00, 0x36, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00, 0x3F, 0x20, 0x2F, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index e07648a720..5aef39fe82 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -612,11 +612,11 @@ void GfxMgr::shakeEnd() { free(_shakeH); } -void GfxMgr::putTextCharacter(int l, int x, int y, unsigned int c, int fg, int bg, bool checkerboard) { +void GfxMgr::putTextCharacter(int l, int x, int y, unsigned int c, int fg, int bg, bool checkerboard, const uint8 *font) { int x1, y1, xx, yy, cc; const uint8 *p; - p = Agi::curFont + ((unsigned int)c * CHAR_LINES); + p = font + ((unsigned int)c * CHAR_LINES); for (y1 = 0; y1 < CHAR_LINES; y1++) { for (x1 = 0; x1 < CHAR_COLS; x1++) { xx = x + x1; diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index a5f9d47df0..781c88475b 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -27,6 +27,7 @@ #define AGI_GRAPHICS_H #include "common/stdafx.h" +#include "agi/font.h" namespace Agi { @@ -58,7 +59,7 @@ public: void gfxPutBlock(int x1, int y1, int x2, int y2); - void putTextCharacter(int, int, int, unsigned int, int, int, bool checkerboard = false); + void putTextCharacter(int, int, int, unsigned int, int, int, bool checkerboard = false, const uint8 *font = curFont); void shakeScreen(int); void shakeStart(); void shakeEnd(); @@ -88,7 +89,6 @@ public: int getAGIPalFileNum(); void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2); - void putPixel(int, int, int); void putBlock(int x1, int y1, int x2, int y2); void gfxSetPalette(); void setCursor(bool amigaStyleCursor = false); diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp index 199401b85c..20159dcb71 100644 --- a/engines/agi/preagi_common.cpp +++ b/engines/agi/preagi_common.cpp @@ -62,7 +62,7 @@ void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) { break; default: - drawChar(col * 8, row * 8, attr, code, (const char*)mickey_fontdata); + _gfx->putTextCharacter(1, col * 8 , row * 8, static_cast(code), attr & 0x0f, (attr & 0xf0) / 0x10, false, mickey_fontdata); if (++col == 320 / 8) { col = 0; @@ -78,25 +78,8 @@ void PreAgiEngine::drawStrMiddle(int row, int attr, const char *buffer) { } void PreAgiEngine::clearTextArea() { - // FIXME: this causes crashes, I imagine it's because we're not currently locking the screen in drawStr for (int row = IDI_MAX_ROW_PIC; row < 200 / 8; row++) { - //drawStr(row, 0, IDA_DEFAULT, " "); // 40 spaces - } -} - -void PreAgiEngine::drawChar(int x, int y, int attr, int code, const char *fontdata) { - int cx, cy; - uint8 color; - - for (cy = 0; cy < 8; cy++) { - for (cx = 0; cx < 8; cx++) { - if (fontdata[(code * 8) + cy] & (1 << (7 - cx))) - color = attr & 0x0f; // foreground color - else - color = (attr & 0xf0) / 0x10; // background color - - _gfx->putPixelsA(x + cx, y + cy, 1, &color); - } + drawStr(row, 0, IDA_DEFAULT, " "); // 40 spaces } } -- cgit v1.2.3