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
This commit is contained in:
Martin Kiewitz 2010-09-26 18:23:53 +00:00
parent 432b7b25d9
commit cd6aa62702
3 changed files with 28 additions and 1 deletions

View file

@ -905,7 +905,7 @@ void GfxMenu::kernelDrawStatus(const char *text, int16 colorPen, int16 colorBack
_paint16->fillRect(_ports->_menuBarRect, 1, colorBack); _paint16->fillRect(_ports->_menuBarRect, 1, colorBack);
_ports->penColor(colorPen); _ports->penColor(colorPen);
_ports->moveTo(0, 1); _ports->moveTo(0, 1);
_text16->Draw_String(text); _text16->Draw_Status(text);
_paint16->bitsShow(_ports->_menuBarRect); _paint16->bitsShow(_ports->_menuBarRect);
_ports->setPort(oldPort); _ports->setPort(oldPort);
} }

View file

@ -491,6 +491,32 @@ void GfxText16::Draw_String(const char *text) {
_ports->penColor(previousPenColor); _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 // Sierra did this in their PC98 interpreter only, they identify a text as being
// sjis and then switch to font 900 // sjis and then switch to font 900
bool GfxText16::SwitchToFont900OnSjis(const char *text) { bool GfxText16::SwitchToFont900OnSjis(const char *text) {

View file

@ -64,6 +64,7 @@ public:
void Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); 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 Box(const char *text, int16 bshow, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId);
void Draw_String(const char *text); void Draw_String(const char *text);
void Draw_Status(const char *text);
GfxFont *_font; GfxFont *_font;