diff options
-rw-r--r-- | engines/sci/graphics/menu.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/text16.cpp | 26 | ||||
-rw-r--r-- | engines/sci/graphics/text16.h | 1 |
3 files changed, 28 insertions, 1 deletions
diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp index 630626c128..06470bc560 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 c2c2a3fc46..3fba3006c7 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 d84468ced2..dc3ed2f62b 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; |