[Scummvm-cvs-logs] SF.net SVN: scummvm:[45863] scummvm/trunk/engines/sci/gui

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Thu Nov 12 17:20:20 CET 2009


Revision: 45863
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45863&view=rev
Author:   m_kiewitz
Date:     2009-11-12 16:20:19 +0000 (Thu, 12 Nov 2009)

Log Message:
-----------
SCI/newgui: support for disabled menu entries, changed textface (int) to greyedOutput (bool)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui_font.cpp
    scummvm/trunk/engines/sci/gui/gui_font.h
    scummvm/trunk/engines/sci/gui/gui_gfx.cpp
    scummvm/trunk/engines/sci/gui/gui_gfx.h
    scummvm/trunk/engines/sci/gui/gui_helpers.h
    scummvm/trunk/engines/sci/gui/gui_menu.cpp
    scummvm/trunk/engines/sci/gui/gui_text.cpp

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2009-11-12 15:24:11 UTC (rev 45862)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2009-11-12 16:20:19 UTC (rev 45863)
@@ -180,7 +180,7 @@
 #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 @@
 	// 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 @@
 			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 @@
 		_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);

Modified: scummvm/trunk/engines/sci/gui/gui_font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_font.cpp	2009-11-12 15:24:11 UTC (rev 45862)
+++ scummvm/trunk/engines/sci/gui/gui_font.cpp	2009-11-12 16:20:19 UTC (rev 45863)
@@ -78,7 +78,7 @@
 	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<int>(getCharWidth(chr), screen->_width - left);
 	int charHeight = MIN<int>(getCharHeight(chr), 200 - top);
 	byte b = 0, mask = 0xFF;
@@ -86,7 +86,7 @@
 
 	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

Modified: scummvm/trunk/engines/sci/gui/gui_font.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_font.h	2009-11-12 15:24:11 UTC (rev 45862)
+++ scummvm/trunk/engines/sci/gui/gui_font.h	2009-11-12 16:20:19 UTC (rev 45863)
@@ -40,7 +40,7 @@
 	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;

Modified: scummvm/trunk/engines/sci/gui/gui_gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-11-12 15:24:11 UTC (rev 45862)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-11-12 16:20:19 UTC (rev 45863)
@@ -123,7 +123,7 @@
 
 	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 @@
 	_curPort->penMode = mode;
 }
 
-void SciGuiGfx::TextFace(int16 textFace) {
-	_curPort->textFace = textFace;
+void SciGuiGfx::TextGreyedOutput(bool state) {
+	_curPort->greyedOutput = state;
 }
 
 int16 SciGuiGfx::GetPointSize() {

Modified: scummvm/trunk/engines/sci/gui/gui_gfx.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.h	2009-11-12 15:24:11 UTC (rev 45862)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.h	2009-11-12 16:20:19 UTC (rev 45863)
@@ -65,7 +65,7 @@
 	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);

Modified: scummvm/trunk/engines/sci/gui/gui_helpers.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_helpers.h	2009-11-12 15:24:11 UTC (rev 45862)
+++ scummvm/trunk/engines/sci/gui/gui_helpers.h	2009-11-12 16:20:19 UTC (rev 45863)
@@ -49,12 +49,13 @@
 	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) {
 	}
 };

Modified: scummvm/trunk/engines/sci/gui/gui_menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_menu.cpp	2009-11-12 15:24:11 UTC (rev 45862)
+++ scummvm/trunk/engines/sci/gui/gui_menu.cpp	2009-11-12 16:20:19 UTC (rev 45863)
@@ -509,6 +509,7 @@
 		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,7 +528,9 @@
 		}
 		listItemIterator++;
 	}
+	_gfx->TextGreyedOutput(false);
 
+
 	_menuRect.left -= 8;
 	_menuRect.left--; _menuRect.right++; _menuRect.bottom++;
 	_gfx->BitsShow(_menuRect);
@@ -579,8 +582,11 @@
 					_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;

Modified: scummvm/trunk/engines/sci/gui/gui_text.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_text.cpp	2009-11-12 15:24:11 UTC (rev 45862)
+++ scummvm/trunk/engines/sci/gui/gui_text.cpp	2009-11-12 16:20:19 UTC (rev 45863)
@@ -335,7 +335,7 @@
 				_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;
 		}
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list