From cd6aa62702461eb9a7907431f86fa3fd66435a18 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sun, 26 Sep 2010 18:23:53 +0000 Subject: [PATCH] SCI: adding separate status drawing code now also draws "IV" in KQ4 correctly. This wasn't the case before because we reused the regular drawing code, which would see the 0xA ("IV") as linebreak save for backport svn-id: r52913 --- engines/sci/graphics/menu.cpp | 2 +- engines/sci/graphics/text16.cpp | 26 ++++++++++++++++++++++++++ engines/sci/graphics/text16.h | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp index 630626c1283..06470bc5601 100644 --- a/engines/sci/graphics/menu.cpp +++ b/engines/sci/graphics/menu.cpp @@ -905,7 +905,7 @@ void GfxMenu::kernelDrawStatus(const char *text, int16 colorPen, int16 colorBack _paint16->fillRect(_ports->_menuBarRect, 1, colorBack); _ports->penColor(colorPen); _ports->moveTo(0, 1); - _text16->Draw_String(text); + _text16->Draw_Status(text); _paint16->bitsShow(_ports->_menuBarRect); _ports->setPort(oldPort); } diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index c2c2a3fc464..3fba3006c7a 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -491,6 +491,32 @@ void GfxText16::Draw_String(const char *text) { _ports->penColor(previousPenColor); } +// we need to have a separate status drawing code +// In KQ4 the IV char is actually 0xA, which would otherwise get considered as linebreak and not printed +void GfxText16::Draw_Status(const char *text) { + uint16 curChar, charWidth; + uint16 textLen = strlen(text); + Common::Rect rect; + + GetFont(); + if (!_font) + return; + + rect.top = _ports->_curPort->curTop; + rect.bottom = rect.top + _ports->_curPort->fontHeight; + while (textLen--) { + curChar = (*(const byte *)text++); + switch (curChar) { + case 0: + break; + default: + charWidth = _font->getCharWidth(curChar); + _font->draw(curChar, _ports->_curPort->top + _ports->_curPort->curTop, _ports->_curPort->left + _ports->_curPort->curLeft, _ports->_curPort->penClr, _ports->_curPort->greyedOutput); + _ports->_curPort->curLeft += charWidth; + } + } +} + // Sierra did this in their PC98 interpreter only, they identify a text as being // sjis and then switch to font 900 bool GfxText16::SwitchToFont900OnSjis(const char *text) { diff --git a/engines/sci/graphics/text16.h b/engines/sci/graphics/text16.h index d84468ced24..dc3ed2f62b2 100644 --- a/engines/sci/graphics/text16.h +++ b/engines/sci/graphics/text16.h @@ -64,6 +64,7 @@ public: void Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); void Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId); void Draw_String(const char *text); + void Draw_Status(const char *text); GfxFont *_font;