[Scummvm-cvs-logs] SF.net SVN: scummvm:[49209] scummvm/trunk/engines/m4

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Tue May 25 12:46:56 CEST 2010


Revision: 49209
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49209&view=rev
Author:   dreammaster
Date:     2010-05-25 10:46:56 +0000 (Tue, 25 May 2010)

Log Message:
-----------
Changed the font system to allow for multiple fonts to be loaded simultaneously

Modified Paths:
--------------
    scummvm/trunk/engines/m4/converse.cpp
    scummvm/trunk/engines/m4/dialogs.cpp
    scummvm/trunk/engines/m4/font.cpp
    scummvm/trunk/engines/m4/font.h
    scummvm/trunk/engines/m4/gui.cpp
    scummvm/trunk/engines/m4/m4.cpp
    scummvm/trunk/engines/m4/m4.h
    scummvm/trunk/engines/m4/mads_anim.cpp
    scummvm/trunk/engines/m4/mads_menus.cpp
    scummvm/trunk/engines/m4/mads_scene.cpp
    scummvm/trunk/engines/m4/mads_views.cpp

Modified: scummvm/trunk/engines/m4/converse.cpp
===================================================================
--- scummvm/trunk/engines/m4/converse.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/converse.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -96,7 +96,7 @@
 	_vm->_font->setFont(FONT_CONVERSATION);
 
 	// TODO: Conversation styles and colors
-	_vm->_font->setColors(2, 1, 3);
+	_vm->_font->current()->setColours(2, 1, 3);
 
 	_currentNodeIndex = nodeIndex;
 
@@ -124,7 +124,7 @@
 			}
 
 			// Figure out the longest string to determine where option highlighting ends
-			int tempX = _vm->_font->getWidth(node->entries[i]->text, 0) +
+			int tempX = _vm->_font->current()->getWidth(node->entries[i]->text, 0) +
 				CONV_ENTRIES_X_OFFSET + 10;
 			_xEnd = MAX(_xEnd, tempX);
 		}
@@ -163,10 +163,10 @@
 			if (i > CONV_MAX_SHOWN_ENTRIES - 1)
 				break;
 
-			_vm->_font->setColor((_highlightedIndex == i) ? CONVERSATION_ENTRY_HIGHLIGHTED :
+			_vm->_font->current()->setColour((_highlightedIndex == i) ? CONVERSATION_ENTRY_HIGHLIGHTED :
 				CONVERSATION_ENTRY_NORMAL);
 
-			_vm->_font->writeString(this, _activeItems[i]->text, CONV_ENTRIES_X_OFFSET,
+			_vm->_font->current()->writeString(this, _activeItems[i]->text, CONV_ENTRIES_X_OFFSET,
 				CONV_ENTRIES_Y_OFFSET + CONV_ENTRIES_HEIGHT * i, 0, 0);
 		}
 	}

Modified: scummvm/trunk/engines/m4/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/m4/dialogs.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/dialogs.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -127,7 +127,7 @@
 		strcat(line, wordStr);
 
 		lineLen = strlen(line);
-		lineWidth = _vm->_font->getWidth(line, DIALOG_SPACING);
+		lineWidth = _vm->_font->current()->getWidth(line, DIALOG_SPACING);
 
 		if (((_lineX + lineLen) > _widthChars) || ((_widthX + lineWidth) > _dialogWidth)) {
 			incLine();
@@ -146,7 +146,7 @@
  */
 void Dialog::appendText(const char *line) {
 	_lineX += strlen(line);
-	_widthX += _vm->_font->getWidth(line, DIALOG_SPACING);
+	_widthX += _vm->_font->current()->getWidth(line, DIALOG_SPACING);
 
 	strcat(_lines[_lines.size() - 1].data, line);
 }
@@ -158,7 +158,7 @@
 	if ((_widthX > 0) || (_lineX > 0))
 		incLine();
 
-	int lineWidth = _vm->_font->getWidth(line, DIALOG_SPACING);
+	int lineWidth = _vm->_font->current()->getWidth(line, DIALOG_SPACING);
 	int lineLen = strlen(line);
 
 	if ((lineWidth > _dialogWidth) || (lineLen >= _widthChars))
@@ -383,7 +383,7 @@
 				if (id > 0) {
 					// Suffix provided - specifies the dialog width in number of chars
 					_widthChars = id * 2;
-					_dialogWidth = id * (_vm->_font->getMaxWidth() + DIALOG_SPACING) + 10;
+					_dialogWidth = id * (_vm->_font->current()->getMaxWidth() + DIALOG_SPACING) + 10;
 				}
 
 			} else if (matchCommand(cmdText, "UNDER")) {
@@ -416,7 +416,7 @@
 Dialog::Dialog(MadsM4Engine *vm, int widthChars): View(vm, Common::Rect(0, 0, 0, 0)) {
 	_vm->_font->setFont(FONT_INTERFACE_MADS);
 	_widthChars = widthChars * 2;
-	_dialogWidth = widthChars * (_vm->_font->getMaxWidth() + DIALOG_SPACING) + 10;
+	_dialogWidth = widthChars * (_vm->_font->current()->getMaxWidth() + DIALOG_SPACING) + 10;
 	_screenType = LAYER_DIALOG;
 	_lineX = 0;
 	_widthX = 0;
@@ -439,7 +439,7 @@
 
 	// Calculate bounds
 	int dlgWidth = _dialogWidth;
-	int dlgHeight = _lines.size() * (_vm->_font->getHeight() + 1) + 10;
+	int dlgHeight = _lines.size() * (_vm->_font->current()->getHeight() + 1) + 10;
 	int dialogX = (_vm->_screen->width() - dlgWidth) / 2;
 	int dialogY = (_vm->_screen->height() - dlgHeight) / 2;
 
@@ -480,26 +480,26 @@
 	}
 
 	// Handle drawing the text contents
-	_vm->_font->setColours(7, 7, 7);
+	_vm->_font->current()->setColours(7, 7, 7);
 	setColour(7);
 
-	for (uint lineCtr = 0, yp = 5; lineCtr < _lines.size(); ++lineCtr, yp += _vm->_font->getHeight() + 1) {
+	for (uint lineCtr = 0, yp = 5; lineCtr < _lines.size(); ++lineCtr, yp += _vm->_font->current()->getHeight() + 1) {
 
 		if (_lines[lineCtr].barLine) {
 			// Bar separation line
-			hLine(5, width() - 6, ((_vm->_font->getHeight() + 1) >> 1) + yp);
+			hLine(5, width() - 6, ((_vm->_font->current()->getHeight() + 1) >> 1) + yp);
 		} else {
 			// Standard line
 			Common::Point pt(_lines[lineCtr].xp + 5, yp);
 			if (_lines[lineCtr].xp & 0x40)
 				++pt.y;
 
-			_vm->_font->writeString(this, _lines[lineCtr].data, pt.x, pt.y, 0, DIALOG_SPACING);
+			_vm->_font->current()->writeString(this, _lines[lineCtr].data, pt.x, pt.y, 0, DIALOG_SPACING);
 
 			if (_lines[lineCtr].underline)
 				// Underline needed
-				hLine(pt.x, pt.x + _vm->_font->getWidth(_lines[lineCtr].data, DIALOG_SPACING),
-					pt.y + _vm->_font->getHeight());
+				hLine(pt.x, pt.x + _vm->_font->current()->getWidth(_lines[lineCtr].data, DIALOG_SPACING),
+					pt.y + _vm->_font->current()->getHeight());
 		}
 	}
 
@@ -528,7 +528,7 @@
 		dlg->incLine();
 		dlg->writeChars(*descEntries);
 
-		int lineWidth = vm->_font->getWidth(*descEntries, DIALOG_SPACING);
+		int lineWidth = vm->_font->current()->getWidth(*descEntries, DIALOG_SPACING);
 		dlg->_lines[dlg->_lines.size() - 1].xp = (dlg->_dialogWidth - 10 - lineWidth) / 2;
 		++descEntries;
 	}

Modified: scummvm/trunk/engines/m4/font.cpp
===================================================================
--- scummvm/trunk/engines/m4/font.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/font.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -29,28 +29,46 @@
 
 namespace M4 {
 
-Font::Font(MadsM4Engine *vm) : _vm(vm) {
+FontManager::~FontManager() {
+	for (uint i = 0; i < _entries.size(); ++i)
+		delete _entries[i];
+	_entries.clear();
+}
+
+Font *FontManager::getFont(const Common::String &filename) {
+	// Check if the font is already loaded
+	for (uint i = 0; i < _entries.size(); ++i)
+	{
+		if (_entries[i]->_filename.equals(filename))
+			return _entries[i];
+	}
+
+	Font *f = new Font(_vm, filename);
+	_entries.push_back(f);
+	return f;
+}
+
+void FontManager::setFont(const Common::String &filename) {
+	_currentFont = getFont(filename);
+}
+
+//--------------------------------------------------------------------------
+
+Font::Font(MadsM4Engine *vm, const Common::String &filename) : _vm(vm), _filename(filename) {
 	_sysFont = true;
-	_filename = NULL;
+
 	//TODO: System font
 	_fontColors[0] = _vm->_palette->BLACK;
 	_fontColors[1] = _vm->_palette->WHITE;
 	_fontColors[2] = _vm->_palette->BLACK;
 	_fontColors[3] = _vm->_palette->DARK_GRAY;
-}
 
-void Font::setFont(const char *filename) {
-	if ((_filename != NULL) && (strcmp(filename, _filename) == 0))
-		// Already using specified font, so don't bother reloading
-		return;
-
 	_sysFont = false;
-	_filename = filename;
 
 	if (_vm->isM4())
-		setFontM4(filename);
+		setFontM4(filename.c_str());
 	else
-		setFontMads(filename);
+		setFontMads(filename.c_str());
 }
 
 void Font::setFontM4(const char *filename) {
@@ -134,20 +152,21 @@
 	}
 }
 
-void Font::setColor(uint8 color) {
+void Font::setColour(uint8 colour) {
 	if (_sysFont)
-		_fontColors[1] = color;
+		_fontColors[1] = colour;
 	else
-		_fontColors[3] = color;
+		_fontColors[3] = colour;
 }
 
-void Font::setColors(uint8 alt1, uint8 alt2, uint8 foreground) {
+void Font::setColours(uint8 col1, uint8 col2, uint8 col3) {
 	if (_sysFont)
-		_fontColors[1] = foreground;
+		_fontColors[1] = col3;
 	else {
-		_fontColors[1] = alt1;
-		_fontColors[2] = alt2;
-		_fontColors[3] = foreground;
+		_fontColors[0] = 0xFF;
+		_fontColors[1] = col1;
+		_fontColors[2] = col2;
+		_fontColors[3] = col3;
 	}
 }
 

Modified: scummvm/trunk/engines/m4/font.h
===================================================================
--- scummvm/trunk/engines/m4/font.h	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/font.h	2010-05-25 10:46:56 UTC (rev 49209)
@@ -59,19 +59,11 @@
 
 class Font {
 public:
-	Font(MadsM4Engine *vm);
+	Font(MadsM4Engine *vm, const Common::String &filename);
 	~Font();
 
-	Font *getFont(const char *filename) {
-		// TODO: Proper separation of font instances
-		setFont(filename);
-		return this;
-	}
-	void setFont(const char *filename);
-	void setColor(uint8 color);
-	void setColors(uint8 alt1, uint8 alt2, uint8 foreground);
-	void setColour(uint8 colour) { setColor(colour); }
-	void setColours(uint8 alt1, uint8 alt2, uint8 foreground) { setColors(alt1, alt2, foreground); }
+	void setColour(uint8 colour);
+	void setColours(uint8 col1, uint8 col2, uint8 col3);
 
 	int32 getWidth(const char *text, int spaceWidth = -1);
 	int32 getHeight() const { return _maxHeight; }
@@ -80,7 +72,8 @@
 	int32 writeString(M4Surface *surface, const char *text, int x, int y, int width = 0, int spaceWidth = -1) {
 		return write(surface, text, x, y, width, spaceWidth, _fontColors);
 	}
-
+public:
+	const Common::String _filename;
 private:
 	void setFontM4(const char *filename);
 	void setFontMads(const char *filename);
@@ -91,10 +84,39 @@
 	uint16 *_charOffs;
 	uint8 *_charData;
 	bool _sysFont;
-	const char *_filename;
 	uint8 _fontColors[4];
 };
 
+class FontEntry {
+public:
+	Font *_font;
+
+	FontEntry() {
+		_font = NULL;
+	}
+	~FontEntry() {
+		delete _font;
+	}
+};
+
+class FontManager {
+private:
+	MadsM4Engine *_vm;
+	Common::Array<Font *> _entries;
+	Font *_currentFont;
+public:
+	FontManager(MadsM4Engine *vm): _vm(vm) { _currentFont = NULL; }
+	~FontManager();
+
+	Font *getFont(const Common::String &filename);
+	void setFont(const Common::String &filename);
+
+	Font *current() { 
+		assert(_currentFont);
+		return _currentFont;
+	}
+};
+
 } // End of namespace M4
 
 #endif

Modified: scummvm/trunk/engines/m4/gui.cpp
===================================================================
--- scummvm/trunk/engines/m4/gui.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/gui.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -290,26 +290,26 @@
 	case OBJTYPE_SL_TEXT:
 		switch (_objectState) {
 		case OS_MOUSEOVER:
-			_vm->_font->setColors(TEXT_COLOR_MOUSEOVER_SHADOW, TEXT_COLOR_MOUSEOVER_FOREGROUND,
+			_vm->_font->current()->setColours(TEXT_COLOR_MOUSEOVER_SHADOW, TEXT_COLOR_MOUSEOVER_FOREGROUND,
 				TEXT_COLOR_MOUSEOVER_HILIGHT);
 			sprite = sprites[SL_LINE_MOUSEOVER];
 			break;
 
 		case OS_PRESSED:
-			_vm->_font->setColors(TEXT_COLOR_PRESSED_SHADOW, TEXT_COLOR_PRESSED_FOREGROUND,
+			_vm->_font->current()->setColours(TEXT_COLOR_PRESSED_SHADOW, TEXT_COLOR_PRESSED_FOREGROUND,
 				TEXT_COLOR_PRESSED_HILIGHT);
 			sprite = sprites[SL_LINE_PRESSED];
 			break;
 
 		case OS_GREYED:
-			_vm->_font->setColors(TEXT_COLOR_GREYED_SHADOW, TEXT_COLOR_GREYED_FOREGROUND,
+			_vm->_font->current()->setColours(TEXT_COLOR_GREYED_SHADOW, TEXT_COLOR_GREYED_FOREGROUND,
 				TEXT_COLOR_GREYED_HILIGHT);
 			sprite = sprites[SL_LINE_NORMAL];
 			break;
 
 		default:
 		case OS_NORMAL:
-			_vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
+			_vm->_font->current()->setColours(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
 				TEXT_COLOR_NORMAL_HILIGHT);
 			sprite = sprites[SL_LINE_NORMAL];
 			break;
@@ -849,11 +849,11 @@
 		if (_displayValue != 0) {
 			char tempBuffer[5];
 			sprintf(tempBuffer, "%02d", _displayValue);
-			_vm->_font->writeString(_parent, tempBuffer, xp, _bounds.top + 1, 0, -1);
+			_vm->_font->current()->writeString(_parent, tempBuffer, xp, _bounds.top + 1, 0, -1);
 			xp = _bounds.left + 26;
 		}
 
-		_vm->_font->writeString(_parent, _displayText, xp, _bounds.top + 1, 0, -1);
+		_vm->_font->current()->writeString(_parent, _displayText, xp, _bounds.top + 1, 0, -1);
 	}
 }
 
@@ -955,18 +955,18 @@
 	// Draw the text
 
 	_vm->_font->setFont(FONT_MENU);
-	_vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
+	_vm->_font->current()->setColours(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
 		TEXT_COLOR_NORMAL_HILIGHT);
 	int xp = _bounds.left + 4;
 
 	if (_displayValue != 0) {
 		char tempBuffer[5];
 		sprintf(tempBuffer, "%02d", _displayValue);
-		_vm->_font->writeString(_parent, tempBuffer, xp, _bounds.top + 1, 0, -1);
+		_vm->_font->current()->writeString(_parent, tempBuffer, xp, _bounds.top + 1, 0, -1);
 		xp = _bounds.left + 26;
 	}
 
-	_vm->_font->writeString(_parent, _displayText, xp, _bounds.top + 1, 0, -1);
+	_vm->_font->current()->writeString(_parent, _displayText, xp, _bounds.top + 1, 0, -1);
 
 	if (focused) {
 		// Draw in the cursor
@@ -975,7 +975,7 @@
 			// Get the width of the string up to the cursor position
 			char tempCh = *_cursor;
 			*_cursor = '\0';
-			int stringWidth = _vm->_font->getWidth(_displayText);
+			int stringWidth = _vm->_font->current()->getWidth(_displayText);
 			*_cursor = tempCh;
 
 			parent()->setColor(TEXT_COLOR_MOUSEOVER_FOREGROUND);
@@ -1015,10 +1015,10 @@
 					tempP = &tempStr[tempLen];
 					_vm->_font->setFont(FONT_MENU);
 
-					tempLen = _vm->_font->getWidth(tempStr);
+					tempLen = _vm->_font->current()->getWidth(tempStr);
 					while ((tempP != &tempStr[0]) && (tempLen > x - _bounds.left - 26)) {
 						*--tempP = '\0';
-						tempLen = _vm->_font->getWidth(tempStr);
+						tempLen = _vm->_font->current()->getWidth(tempStr);
 					}
 
 					_cursor = &_displayText[tempP - &tempStr[0]];
@@ -1098,7 +1098,7 @@
 			parent()->_deleteSaveDesc = false;
 			_vm->_font->setFont(FONT_MENU);
 
-			tempLen = _vm->_font->getWidth(_displayText);
+			tempLen = _vm->_font->current()->getWidth(_displayText);
 			if ((strlen(_displayText) < MAX_SAVEGAME_NAME - 1) &&
 				(tempLen < _pixelWidth - 12) && (param >= 32) && (param <= 127)) {
 
@@ -1140,9 +1140,9 @@
 
 void GUITextField::onRefresh() {
 	_parent->fillRect(_bounds, _vm->_palette->BLACK);
-	_vm->_font->setColors(3, 3, 3);
+	_vm->_font->current()->setColours(3, 3, 3);
 	_vm->_font->setFont(FONT_INTERFACE);
-	_vm->_font->writeString(_parent, _text.c_str(), _bounds.left, _bounds.top, 0, 1);
+	_vm->_font->current()->writeString(_parent, _text.c_str(), _bounds.left, _bounds.top, 0, 1);
 }
 
 //--------------------------------------------------------------------------

Modified: scummvm/trunk/engines/m4/m4.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/m4.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -170,7 +170,7 @@
 	_events = new Events(this);
 	_kernel = new Kernel(this);
 	_player = new Player(this);
-	_font = new Font(this);
+	_font = new FontManager(this);
 	if (getGameType() == GType_Burger) {
 		_actor = new Actor(this);
 		_conversationView = new ConversationView(this);
@@ -554,9 +554,9 @@
 		_scene->show();
 
 		_font->setFont(FONT_MAIN_MADS);
-		_font->setColors(2, 1, 3);
-		_font->writeString(_scene->getBackgroundSurface(), "Testing the M4/MADS ScummVM engine", 5, 160, 310, 2);
-		_font->writeString(_scene->getBackgroundSurface(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 5, 180, 310, 2);
+		_font->current()->setColours(2, 1, 3);
+		_font->current()->writeString(_scene->getBackgroundSurface(), "Testing the M4/MADS ScummVM engine", 5, 160, 310, 2);
+		_font->current()->writeString(_scene->getBackgroundSurface(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 5, 180, 310, 2);
 
 		if (getGameType() == GType_DragonSphere) {
 			//_scene->showMADSV2TextBox("Test", 10, 10, NULL);

Modified: scummvm/trunk/engines/m4/m4.h
===================================================================
--- scummvm/trunk/engines/m4/m4.h	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/m4.h	2010-05-25 10:46:56 UTC (rev 49209)
@@ -189,7 +189,7 @@
 	Player *_player;
 	Mouse *_mouse;
 	Events *_events;
-	Font *_font;
+	FontManager *_font;
 	Actor *_actor;
 	Scene *_scene;
 	Dialogs *_dialogs;

Modified: scummvm/trunk/engines/m4/mads_anim.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_anim.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/mads_anim.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -37,7 +37,7 @@
 TextviewView::TextviewView(MadsM4Engine *vm):
 		View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())),
 		_bgSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT),
-		_textSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT + vm->_font->getHeight() +
+		_textSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT + vm->_font->current()->getHeight() +
 			TEXTVIEW_LINE_SPACING) {
 
 	_screenType = VIEWID_TEXTVIEW;
@@ -60,7 +60,7 @@
 	_vm->_palette->setPalette(&palData[0], 4, 3);
 	_vm->_palette->blockRange(4, 3);
 
-	_vm->_font->setColors(5, 6, 4);
+	_vm->_font->current()->setColours(5, 6, 4);
 
 	clear();
 	_bgSurface.clear();
@@ -222,7 +222,7 @@
 		}
 	} else {
 		// Handling a text row
-		if (++_lineY == (_vm->_font->getHeight() + TEXTVIEW_LINE_SPACING))
+		if (++_lineY == (_vm->_font->current()->getHeight() + TEXTVIEW_LINE_SPACING))
 			processLines();
 	}
 
@@ -404,7 +404,7 @@
 
 	if (!strcmp(_currentLine, "***")) {
 		// Special signifier for end of script
-		_scrollCount = _vm->_font->getHeight() * 13;
+		_scrollCount = _vm->_font->current()->getHeight() * 13;
 		_lineY = -1;
 		return;
 	}
@@ -416,7 +416,7 @@
 	char *centerP = strchr(_currentLine, '@');
 	if (centerP) {
 		*centerP = '\0';
-		xStart = (width() / 2) - _vm->_font->getWidth(_currentLine);
+		xStart = (width() / 2) - _vm->_font->current()->getWidth(_currentLine);
 
 		// Delete the @ character and shift back the remainder of the string
 		char *p = centerP + 1;
@@ -424,16 +424,16 @@
 		strcpy(centerP, p);
 
 	} else {
-		lineWidth = _vm->_font->getWidth(_currentLine);
+		lineWidth = _vm->_font->current()->getWidth(_currentLine);
 		xStart = (width() - lineWidth) / 2;
 	}
 
 	// Copy the text line onto the bottom of the textSurface surface, which will allow it
 	// to gradually scroll onto the screen
-	int yp = _textSurface.height() - _vm->_font->getHeight() - TEXTVIEW_LINE_SPACING;
+	int yp = _textSurface.height() - _vm->_font->current()->getHeight() - TEXTVIEW_LINE_SPACING;
 	_textSurface.fillRect(Common::Rect(0, yp, _textSurface.width(), _textSurface.height()),
 		_vm->_palette->BLACK);
-	_vm->_font->writeString(&_textSurface, _currentLine, xStart, yp);
+	_vm->_font->current()->writeString(&_textSurface, _currentLine, xStart, yp);
 }
 
 

Modified: scummvm/trunk/engines/m4/mads_menus.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_menus.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/mads_menus.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -985,15 +985,15 @@
 
 void RexGameMenuDialog::addLines() {
 	// Add the title
-	int top = MADS_Y_OFFSET - 2 - ((((_vm->_font->getHeight() + 2) * 6) >> 1) - 78);
+	int top = MADS_Y_OFFSET - 2 - ((((_vm->_font->current()->getHeight() + 2) * 6) >> 1) - 78);
 		
-	addQuote(_vm->_font, ALIGN_CENTER, 0, top, 10);
+	addQuote(_vm->_font->current(), ALIGN_CENTER, 0, top, 10);
 
 	// Loop for adding the option lines of the dialog
 	top += 6;
 	for (int idx = 0; idx < 5; ++idx) {
-		top += _vm->_font->getHeight() + 1;
-		addQuote(_vm->_font, ALIGN_CENTER, 0, top, 11 + idx);
+		top += _vm->_font->current()->getHeight() + 1;
+		addQuote(_vm->_font->current(), ALIGN_CENTER, 0, top, 11 + idx);
 	}
 }
 
@@ -1069,42 +1069,42 @@
 
 void RexOptionsDialog::addLines() {
 	// Add the title
-	int top = MADS_Y_OFFSET - 2 - ((((_vm->_font->getHeight() + 1) * 9 + 12) >> 1) - 78);
+	int top = MADS_Y_OFFSET - 2 - ((((_vm->_font->current()->getHeight() + 1) * 9 + 12) >> 1) - 78);
 
-	addQuote(_vm->_font, ALIGN_CENTER, 0, top, 16);
+	addQuote(_vm->_font->current(), ALIGN_CENTER, 0, top, 16);
 
 	// Music state line
-	top += _vm->_font->getHeight() + 1 + 6;
-	addQuote(_vm->_font, ALIGN_CHAR_CENTER, 0, top, 17, _tempConfig.musicFlag ? 24 : 25);
+	top += _vm->_font->current()->getHeight() + 1 + 6;
+	addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 17, _tempConfig.musicFlag ? 24 : 25);
 
 	// Sound state line
-	top += _vm->_font->getHeight() + 1;
-	addQuote(_vm->_font, ALIGN_CHAR_CENTER, 0, top, 18, _tempConfig.soundFlag ? 26 : 27);
+	top += _vm->_font->current()->getHeight() + 1;
+	addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 18, _tempConfig.soundFlag ? 26 : 27);
 
 	// Interface easy state line
-	top += _vm->_font->getHeight() + 1;
-	addQuote(_vm->_font, ALIGN_CHAR_CENTER, 0, top, 19, _tempConfig.easyMouse ? 29 : 28);
+	top += _vm->_font->current()->getHeight() + 1;
+	addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 19, _tempConfig.easyMouse ? 29 : 28);
 
 	// Inventory sppinng state line
-	top += _vm->_font->getHeight() + 1;
-	addQuote(_vm->_font, ALIGN_CHAR_CENTER, 0, top, 20, _tempConfig.invObjectsStill ? 31 : 30);
+	top += _vm->_font->current()->getHeight() + 1;
+	addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 20, _tempConfig.invObjectsStill ? 31 : 30);
 
 	// Text window state line
-	top += _vm->_font->getHeight() + 1;
-	addQuote(_vm->_font, ALIGN_CHAR_CENTER, 0, top, 21, _tempConfig.textWindowStill ? 33 : 32);
+	top += _vm->_font->current()->getHeight() + 1;
+	addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 21, _tempConfig.textWindowStill ? 33 : 32);
 
 	// Screen fade state line
-	top += _vm->_font->getHeight() + 1;
-	addQuote(_vm->_font, ALIGN_CHAR_CENTER, 0, top, 22, _tempConfig.screenFades + 34);
+	top += _vm->_font->current()->getHeight() + 1;
+	addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 22, _tempConfig.screenFades + 34);
 
 	// Storyline mode line
-	top += _vm->_font->getHeight() + 1;
-	addQuote(_vm->_font, ALIGN_CHAR_CENTER, 0, top, 23, (_tempConfig.storyMode == 1) ? 37 : 38);
+	top += _vm->_font->current()->getHeight() + 1;
+	addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 23, (_tempConfig.storyMode == 1) ? 37 : 38);
 
 	// Add Done and Cancel button texts
-	top += _vm->_font->getHeight() + 1 + 6;
-	addQuote(_vm->_font, ALIGN_CENTER, -54, top, 1, 0);
-	addQuote(_vm->_font, ALIGN_CENTER, 54, top, 2, 0);
+	top += _vm->_font->current()->getHeight() + 1 + 6;
+	addQuote(_vm->_font->current(), ALIGN_CENTER, -54, top, 1, 0);
+	addQuote(_vm->_font->current(), ALIGN_CENTER, 54, top, 2, 0);
 }
 
 bool RexOptionsDialog::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {

Modified: scummvm/trunk/engines/m4/mads_scene.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_scene.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/mads_scene.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -289,12 +289,12 @@
 	if (sStatusText[0]) {
 		// Text colors are inverted in Dragonsphere
 		if (_vm->getGameType() == GType_DragonSphere)
-			_vm->_font->setColors(_vm->_palette->BLACK, _vm->_palette->WHITE, _vm->_palette->BLACK);
+			_vm->_font->current()->setColours(_vm->_palette->BLACK, _vm->_palette->WHITE, _vm->_palette->BLACK);
 		else
-			_vm->_font->setColors(_vm->_palette->WHITE, _vm->_palette->BLACK, _vm->_palette->BLACK);
+			_vm->_font->current()->setColours(_vm->_palette->WHITE, _vm->_palette->BLACK, _vm->_palette->BLACK);
 
 		_vm->_font->setFont(FONT_MAIN_MADS);
-		_vm->_font->writeString(this, sStatusText, (width() - _vm->_font->getWidth(sStatusText)) / 2, 142, 0);
+		_vm->_font->current()->writeString(this, sStatusText, (width() - _vm->_font->current()->getWidth(sStatusText)) / 2, 142, 0);
 	}
 
 	//***DEBUG***

Modified: scummvm/trunk/engines/m4/mads_views.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_views.cpp	2010-05-25 03:46:28 UTC (rev 49208)
+++ scummvm/trunk/engines/m4/mads_views.cpp	2010-05-25 10:46:56 UTC (rev 49209)
@@ -291,8 +291,7 @@
 void MadsTextDisplay::draw(View *view) {
 	for (uint idx = 0; idx < _entries.size(); ++idx) {
 		if (_entries[idx].active && (_entries[idx].expire >= 0)) {
-			_entries[idx].font->setColours(_entries[idx].colour1, 
-				(_entries[idx].colour2 == 0) ? _entries[idx].colour1 : _entries[idx].colour2, 0xff);
+			_entries[idx].font->setColours(_entries[idx].colour1, _entries[idx].colour2, 0);
 			_entries[idx].font->writeString(view, _entries[idx].msg, 
 				_entries[idx].bounds.left, _entries[idx].bounds.top, _entries[idx].bounds.width(),
 				_entries[idx].spacing);
@@ -1204,13 +1203,13 @@
 void MadsInterfaceView::setFontMode(InterfaceFontMode newMode) {
 	switch (newMode) {
 	case ITEM_NORMAL:
-		_vm->_font->setColors(4, 4, 0xff);
+		_vm->_font->current()->setColours(4, 4, 0xff);
 		break;
 	case ITEM_HIGHLIGHTED:
-		_vm->_font->setColors(5, 5, 0xff);
+		_vm->_font->current()->setColours(5, 5, 0xff);
 		break;
 	case ITEM_SELECTED:
-		_vm->_font->setColors(6, 6, 0xff);
+		_vm->_font->current()->setColours(6, 6, 0xff);
 		break;
 	}
 }
@@ -1300,7 +1299,7 @@
 
 			// Display the verb
 			const Common::Rect r(_screenObjects[actionIndex]);
-			_vm->_font->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
+			_vm->_font->current()->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
 		}
 	}
 
@@ -1335,7 +1334,7 @@
 		else setFontMode(ITEM_NORMAL);
 
 		// Write out it's description
-		_vm->_font->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
+		_vm->_font->current()->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
 	}
 
 	// Handle the display of any currently selected object
@@ -1365,7 +1364,7 @@
 
 			// Set the highlighting and display the entry
 			setFontMode((i == yIndex) ? ITEM_HIGHLIGHTED : ITEM_NORMAL);
-			_vm->_font->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
+			_vm->_font->current()->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
 		}
 	}
 }


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