From b85c254c5f06dd4cbcc2f2d17cc28f0dc59bc579 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Thu, 12 Nov 2009 16:20:19 +0000 Subject: SCI/newgui: support for disabled menu entries, changed textface (int) to greyedOutput (bool) svn-id: r45863 --- engines/sci/gui/gui.cpp | 12 ++++++------ engines/sci/gui/gui_font.cpp | 4 ++-- engines/sci/gui/gui_font.h | 2 +- engines/sci/gui/gui_gfx.cpp | 6 +++--- engines/sci/gui/gui_gfx.h | 2 +- engines/sci/gui/gui_helpers.h | 5 +++-- engines/sci/gui/gui_menu.cpp | 10 ++++++++-- engines/sci/gui/gui_text.cpp | 2 +- 8 files changed, 25 insertions(+), 18 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index f84a0f973a..aa621496e9 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -180,7 +180,7 @@ void SciGui::disposeWindow(uint16 windowPtr, bool reanimate) { #define SCI_DISPLAY_SETALIGNMENT 101 #define SCI_DISPLAY_SETPENCOLOR 102 #define SCI_DISPLAY_SETBACKGROUNDCOLOR 103 -#define SCI_DISPLAY_SETTEXTFACE 104 +#define SCI_DISPLAY_SETGREYEDOUTPUT 104 #define SCI_DISPLAY_SETFONT 105 #define SCI_DISPLAY_WIDTH 106 #define SCI_DISPLAY_SAVEUNDER 107 @@ -200,7 +200,7 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { // setting defaults _gfx->PenMode(0); _gfx->PenColor(0); - _gfx->TextFace(0); + _gfx->TextGreyedOutput(false); // processing codes in argv while (argc > 0) { displayArg = argv[0].toUint16(); @@ -222,8 +222,8 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { bgcolor = argv[0].toUint16(); argc--; argv++; break; - case SCI_DISPLAY_SETTEXTFACE: - _gfx->TextFace(argv[0].toUint16()); + case SCI_DISPLAY_SETGREYEDOUTPUT: + _gfx->TextGreyedOutput(argv[0].isNull() ? false : true); argc--; argv++; break; case SCI_DISPLAY_SETFONT: @@ -365,9 +365,9 @@ void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, i _gfx->EraseRect(rect); _gfx->FrameRect(rect); rect.grow(-2); - _gfx->TextFace(style & 1 ? 0 : 1); + _gfx->TextGreyedOutput(style & 1 ? false : true); _text->Box(text, 0, rect, SCI_TEXT_ALIGNMENT_CENTER, fontId); - _gfx->TextFace(0); + _gfx->TextGreyedOutput(false); rect.grow(1); if (style & 8) // selected _gfx->FrameRect(rect); diff --git a/engines/sci/gui/gui_font.cpp b/engines/sci/gui/gui_font.cpp index 1ae82d491b..c4061a5de5 100644 --- a/engines/sci/gui/gui_font.cpp +++ b/engines/sci/gui/gui_font.cpp @@ -78,7 +78,7 @@ byte *SciGuiFont::getCharData(byte chr) { return chr < _numChars ? _resourceData + _chars[chr].offset + 2 : 0; } -void SciGuiFont::draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, byte textface) { +void SciGuiFont::draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput) { int charWidth = MIN(getCharWidth(chr), screen->_width - left); int charHeight = MIN(getCharHeight(chr), 200 - top); byte b = 0, mask = 0xFF; @@ -86,7 +86,7 @@ void SciGuiFont::draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, by byte *pIn = getCharData(chr); for (int i = 0; i < charHeight; i++, y++) { - if (textface & 1) // "grayed" output + if (greyedOutput) mask = top++ % 2 ? 0xAA : 0x55; for (int done = 0; done < charWidth; done++) { if ((done & 7) == 0) // fetching next data byte diff --git a/engines/sci/gui/gui_font.h b/engines/sci/gui/gui_font.h index a6982779c1..a3b8aa9da5 100644 --- a/engines/sci/gui/gui_font.h +++ b/engines/sci/gui/gui_font.h @@ -40,7 +40,7 @@ public: byte getCharWidth(byte chr); byte getCharHeight(byte chr); byte *getCharData(byte chr); - void draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, byte textface); + void draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput); private: ResourceManager *_resMan; diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index ee144a5bf0..963ff75e03 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -123,7 +123,7 @@ void SciGuiGfx::OpenPort(GuiPort *port) { port->top = 0; port->left = 0; - port->textFace = 0; + port->greyedOutput = false; port->penClr = 0; port->backClr = 255; port->penMode = 0; @@ -142,8 +142,8 @@ void SciGuiGfx::PenMode(int16 mode) { _curPort->penMode = mode; } -void SciGuiGfx::TextFace(int16 textFace) { - _curPort->textFace = textFace; +void SciGuiGfx::TextGreyedOutput(bool state) { + _curPort->greyedOutput = state; } int16 SciGuiGfx::GetPointSize() { diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index 587e6bff40..0cbed35f45 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -65,7 +65,7 @@ public: void PenColor(int16 color); void BackColor(int16 color); void PenMode(int16 mode); - void TextFace(int16 textFace); + void TextGreyedOutput(bool state); int16 GetPointSize(); void ClearScreen(byte color = 255); diff --git a/engines/sci/gui/gui_helpers.h b/engines/sci/gui/gui_helpers.h index 605acbd444..554282e312 100644 --- a/engines/sci/gui/gui_helpers.h +++ b/engines/sci/gui/gui_helpers.h @@ -49,12 +49,13 @@ struct GuiPort { int16 curTop, curLeft; int16 fontHeight; GuiResourceId fontId; - int16 textFace, penClr, backClr; + bool greyedOutput; + int16 penClr, backClr; int16 penMode; GuiPort(uint16 theId) : id(theId), top(0), left(0), curTop(0), curLeft(0), - fontHeight(0), fontId(0), textFace(0), + fontHeight(0), fontId(0), greyedOutput(false), penClr(0), backClr(0xFF), penMode(0) { } }; diff --git a/engines/sci/gui/gui_menu.cpp b/engines/sci/gui/gui_menu.cpp index 21845ffbfb..0ce5b35768 100644 --- a/engines/sci/gui/gui_menu.cpp +++ b/engines/sci/gui/gui_menu.cpp @@ -509,6 +509,7 @@ void SciGuiMenu::drawMenu(uint16 oldMenuId, uint16 newMenuId) { listItemEntry = *listItemIterator; if (listItemEntry->menuId == newMenuId) { if (!listItemEntry->separatorLine) { + _gfx->TextGreyedOutput(listItemEntry->enabled ? false : true); _gfx->MoveTo(_menuRect.left, topPos); _text->Draw_String(listItemEntry->text.c_str()); _gfx->MoveTo(_menuRect.right - listItemEntry->textRightAlignedWidth - 5, topPos); @@ -527,6 +528,8 @@ void SciGuiMenu::drawMenu(uint16 oldMenuId, uint16 newMenuId) { } listItemIterator++; } + _gfx->TextGreyedOutput(false); + _menuRect.left -= 8; _menuRect.left--; _menuRect.right++; _menuRect.bottom++; @@ -579,8 +582,11 @@ GuiMenuItemEntry *SciGuiMenu::interactiveWithKeyboard() { _curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id; return NULL; case SCI_K_ENTER: - _curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id; - return curItemEntry; + if (curItemEntry->enabled) { + _curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id; + return curItemEntry; + } + break; case SCI_K_LEFT: newMenuId--; newItemId = 1; break; diff --git a/engines/sci/gui/gui_text.cpp b/engines/sci/gui/gui_text.cpp index 329bf5a2ce..bfbf9f29d4 100644 --- a/engines/sci/gui/gui_text.cpp +++ b/engines/sci/gui/gui_text.cpp @@ -335,7 +335,7 @@ void SciGuiText::Draw(const char *text, int16 from, int16 len, GuiResourceId org _gfx->EraseRect(rect); } // CharStd - _font->draw(_screen, curChar, _gfx->_curPort->top + _gfx->_curPort->curTop, _gfx->_curPort->left + _gfx->_curPort->curLeft, _gfx->_curPort->penClr, _gfx->_curPort->textFace); + _font->draw(_screen, curChar, _gfx->_curPort->top + _gfx->_curPort->curTop, _gfx->_curPort->left + _gfx->_curPort->curLeft, _gfx->_curPort->penClr, _gfx->_curPort->greyedOutput); _gfx->_curPort->curLeft += charWidth; } } -- cgit v1.2.3