[Scummvm-cvs-logs] SF.net SVN: scummvm:[51964] scummvm/branches/gsoc2010-plugins/engines

toneman1138 at users.sourceforge.net toneman1138 at users.sourceforge.net
Wed Aug 11 03:11:17 CEST 2010


Revision: 51964
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51964&view=rev
Author:   toneman1138
Date:     2010-08-11 01:11:16 +0000 (Wed, 11 Aug 2010)

Log Message:
-----------
manually merged engines from trunk into branch

Modified Paths:
--------------
    scummvm/branches/gsoc2010-plugins/engines/drascula/animation.cpp
    scummvm/branches/gsoc2010-plugins/engines/drascula/drascula.cpp
    scummvm/branches/gsoc2010-plugins/engines/drascula/objects.cpp
    scummvm/branches/gsoc2010-plugins/engines/m4/compression.h
    scummvm/branches/gsoc2010-plugins/engines/m4/console.cpp
    scummvm/branches/gsoc2010-plugins/engines/m4/console.h
    scummvm/branches/gsoc2010-plugins/engines/m4/converse.cpp
    scummvm/branches/gsoc2010-plugins/engines/m4/dialogs.cpp
    scummvm/branches/gsoc2010-plugins/engines/m4/globals.h
    scummvm/branches/gsoc2010-plugins/engines/m4/gui.cpp
    scummvm/branches/gsoc2010-plugins/engines/m4/m4.cpp
    scummvm/branches/gsoc2010-plugins/engines/m4/m4.h
    scummvm/branches/gsoc2010-plugins/engines/m4/m4_views.cpp
    scummvm/branches/gsoc2010-plugins/engines/m4/mads_anim.cpp
    scummvm/branches/gsoc2010-plugins/engines/m4/mads_menus.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/debug.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/debug.h
    scummvm/branches/gsoc2010-plugins/engines/parallaction/dialogue.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/exec_br.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/graphics.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/input.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/objects.h
    scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction.h
    scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction_br.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/parser.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/parser_ns.cpp
    scummvm/branches/gsoc2010-plugins/engines/parallaction/sound_br.cpp
    scummvm/branches/gsoc2010-plugins/engines/saga/saga.cpp
    scummvm/branches/gsoc2010-plugins/engines/sci/engine/script.cpp
    scummvm/branches/gsoc2010-plugins/engines/sci/engine/script_patches.cpp
    scummvm/branches/gsoc2010-plugins/engines/sci/engine/workarounds.cpp
    scummvm/branches/gsoc2010-plugins/engines/sci/graphics/animate.cpp
    scummvm/branches/gsoc2010-plugins/engines/sci/graphics/animate.h
    scummvm/branches/gsoc2010-plugins/engines/sci/graphics/view.cpp
    scummvm/branches/gsoc2010-plugins/engines/scumm/charset.cpp
    scummvm/branches/gsoc2010-plugins/engines/scumm/debugger.cpp
    scummvm/branches/gsoc2010-plugins/engines/scumm/dialogs.cpp
    scummvm/branches/gsoc2010-plugins/engines/scumm/dialogs.h
    scummvm/branches/gsoc2010-plugins/engines/scumm/he/resource_he.cpp
    scummvm/branches/gsoc2010-plugins/engines/scumm/input.cpp
    scummvm/branches/gsoc2010-plugins/engines/scumm/scumm.cpp
    scummvm/branches/gsoc2010-plugins/engines/scumm/scumm.h
    scummvm/branches/gsoc2010-plugins/engines/sword1/animation.cpp
    scummvm/branches/gsoc2010-plugins/engines/sword1/animation.h
    scummvm/branches/gsoc2010-plugins/engines/sword2/animation.cpp
    scummvm/branches/gsoc2010-plugins/engines/sword2/animation.h
    scummvm/branches/gsoc2010-plugins/engines/tinsel/handle.cpp

Removed Paths:
-------------
    scummvm/branches/gsoc2010-plugins/engines/mohawk/video/
    scummvm/branches/gsoc2010-plugins/engines/sci/sound/iterator/

Modified: scummvm/branches/gsoc2010-plugins/engines/drascula/animation.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/drascula/animation.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/drascula/animation.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -1695,7 +1695,7 @@
 	// We set the room number to -1 for the same purpose.
 	// Also check animation_2_1(), where the same hack was used
 	// by the original
-	roomNumber = -1;
+	roomNumber = -2;
 	loadPic("nota2.alg", bgSurface, HALF_PAL);
 	black();
 	trackProtagonist = 1;

Modified: scummvm/branches/gsoc2010-plugins/engines/drascula/drascula.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/drascula/drascula.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/drascula/drascula.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -88,6 +88,7 @@
 	_textverbs = 0;
 	_textmisc = 0;
 	_textd1 = 0;
+	_talkSequences = 0;
 
 	_color = 0;
 	blinking = 0;

Modified: scummvm/branches/gsoc2010-plugins/engines/drascula/objects.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/drascula/objects.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/drascula/objects.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -92,7 +92,8 @@
 	updateRoom();
 	updateScreen();
 
-	if (cursorVisible)
+	// roomNumber -2 is end credits. Do not show cursor there
+	if (cursorVisible && roomNumber != -2)
 		showCursor();
 }
 

Modified: scummvm/branches/gsoc2010-plugins/engines/m4/compression.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/compression.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/compression.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -66,8 +66,8 @@
 
 class FabDecompressor {
 private:
-    int _bitsLeft;
-    uint32 _bitBuffer;
+	int _bitsLeft;
+	uint32 _bitBuffer;
 	const byte *_srcData, *_srcP;
 	int _srcSize;
 

Modified: scummvm/branches/gsoc2010-plugins/engines/m4/console.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/console.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/console.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -47,7 +47,6 @@
 	DCmd_Register("start_conv",		WRAP_METHOD(Console, cmdStartConversation));
 	DCmd_Register("textview",		WRAP_METHOD(Console, cmdShowTextview));
 	DCmd_Register("animview",		WRAP_METHOD(Console, cmdShowAnimview));
-	DCmd_Register("anim",			WRAP_METHOD(Console, cmdPlayAnimation));
 }
 
 Console::~Console() {
@@ -247,33 +246,6 @@
 	return false;
 }
 
-bool Console::cmdPlayAnimation(int argc, const char **argv) {
-	View *view = _vm->_viewManager->getView(VIEWID_SCENE);
-	if (view == NULL) {
-		DebugPrintf("The scene view isn't currently active\n");
-	} else if (argc != 2 && argc != 3) {
-		DebugPrintf("Usage: %s <anim resource (*.aa)> <fullscreen>\n", argv[0]);
-		DebugPrintf("If fullscreen is 1, the screen palette is replaced with the palette of the animation\n");
-	} else {
-		char resourceName[20];
-		strncpy(resourceName, argv[1], 15);
-		resourceName[15] = '\0';
-		if (!strchr(resourceName, '.'))
-			strcat(resourceName, ".AA");
-
-		_vm->_viewManager->moveToFront(view);
-		if (argc == 3 && atoi(argv[2]) == 1)
-			_vm->_animation->loadFullScreen(resourceName);
-		else
-			_vm->_animation->load(resourceName);
-		_vm->_animation->start();
-		view->restore(0, 0, view->width(), view->height());
-		return false;
-	}
-
-	return true;
-}
-
 /*--------------------------------------------------------------------------*/
 
 MadsConsole::MadsConsole(MadsEngine *vm): Console(vm) {
@@ -282,6 +254,7 @@
 	DCmd_Register("object",			WRAP_METHOD(MadsConsole, cmdObject));
 	DCmd_Register("message",		WRAP_METHOD(MadsConsole, cmdMessage));
 	DCmd_Register("scene_info",		WRAP_METHOD(MadsConsole, cmdSceneInfo));
+	DCmd_Register("anim",			WRAP_METHOD(MadsConsole, cmdPlayAnimation));
 }
 
 bool MadsConsole::cmdObject(int argc, const char **argv) {
@@ -386,6 +359,33 @@
 	return true;
 }
 
+bool MadsConsole::cmdPlayAnimation(int argc, const char **argv) {
+	View *view = _vm->_viewManager->getView(VIEWID_SCENE);
+	if (view == NULL) {
+		DebugPrintf("The scene view isn't currently active\n");
+	} else if (argc != 2 && argc != 3) {
+		DebugPrintf("Usage: %s <anim resource (*.aa)> <fullscreen>\n", argv[0]);
+		DebugPrintf("If fullscreen is 1, the screen palette is replaced with the palette of the animation\n");
+	} else {
+		char resourceName[20];
+		strncpy(resourceName, argv[1], 15);
+		resourceName[15] = '\0';
+		if (!strchr(resourceName, '.'))
+			strcat(resourceName, ".AA");
+
+		_vm->_viewManager->moveToFront(view);
+		if (argc == 3 && atoi(argv[2]) == 1)
+			_madsVm->_palette->deleteAllRanges();
+
+		_madsVm->scene()->_sceneAnimation->load(resourceName, 0);
+
+		view->restore(0, 0, view->width(), view->height());
+		return false;
+	}
+
+	return true;
+}
+
 /*--------------------------------------------------------------------------*/
 
 M4Console::M4Console(M4Engine *vm): Console(vm) {

Modified: scummvm/branches/gsoc2010-plugins/engines/m4/console.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/console.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/console.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -50,7 +50,6 @@
 	bool cmdStartConversation(int argc, const char **argv);
 	bool cmdShowTextview(int argc, const char **argv);
 	bool cmdShowAnimview(int argc, const char **argv);
-	bool cmdPlayAnimation(int argc, const char **argv);
 
 public:
 	Console(MadsM4Engine *vm);
@@ -64,6 +63,8 @@
 	bool cmdObject(int argc, const char **argv);
 	bool cmdMessage(int argc, const char **argv);
 	bool cmdSceneInfo(int argc, const char **argv);
+	bool cmdPlayAnimation(int argc, const char **argv);
+
 public:
 	MadsConsole(MadsEngine *vm);
 	virtual ~MadsConsole() {}

Modified: scummvm/branches/gsoc2010-plugins/engines/m4/converse.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/converse.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/converse.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -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/branches/gsoc2010-plugins/engines/m4/dialogs.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/dialogs.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/dialogs.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -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/branches/gsoc2010-plugins/engines/m4/globals.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/globals.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/globals.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -276,6 +276,7 @@
 	// DEPRECATED: ScummVM re-implementation keeps all the quotes loaded, so the methods below are stubs
 	void clearQuotes() {}
 	void loadQuoteRange(int startNum, int endNum) {}
+	void loadQuoteSet(...) {}
 	void loadQuote(int quoteNum) {}
 
 	void loadMadsMessagesInfo();

Modified: scummvm/branches/gsoc2010-plugins/engines/m4/gui.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/gui.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/gui.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -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/branches/gsoc2010-plugins/engines/m4/m4.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/m4.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/m4.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -145,7 +145,6 @@
 	delete _script;
 	delete _ws;
 	delete _random;
-	delete _animation;
 	delete _palette;
 	delete _globals;
 	delete _sound;
@@ -174,7 +173,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);
@@ -188,7 +187,6 @@
 	_sound = new Sound(this, _mixer, 255);
 	_script = new ScriptInterpreter(this);
 	_ws = new WoodScript(this);
-	_animation = new Animation(this);
 	//_callbacks = new Callbacks(this);
 	_random = new Common::RandomSource();
 	g_eventRec.registerRandomSource(*_random, "m4");
@@ -557,9 +555,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);
@@ -575,8 +573,6 @@
 	while (!_events->quitFlag) {
 		eventHandler();
 
-		_animation->updateAnim();
-
 		if (g_system->getMillis() >= nextFrame) {
 			nextFrame = g_system->getMillis() + GAME_FRAME_DELAY;
 			++_currentTimer;

Modified: scummvm/branches/gsoc2010-plugins/engines/m4/m4.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/m4.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/m4.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -192,7 +192,7 @@
 	Player *_player;
 	Mouse *_mouse;
 	Events *_events;
-	Font *_font;
+	FontManager *_font;
 	Actor *_actor;
 	Scene *_scene;
 	Dialogs *_dialogs;
@@ -203,7 +203,6 @@
 	Rails *_rails;
 	ScriptInterpreter *_script;
 	WoodScript *_ws;
-	Animation *_animation;
 	Common::RandomSource *_random;
 
 	Scene *scene() { return _scene; }

Modified: scummvm/branches/gsoc2010-plugins/engines/m4/m4_views.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/m4_views.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/m4_views.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -34,7 +34,7 @@
 GUIInventory::GUIInventory(View *owner, MadsM4Engine *vm, const Common::Rect &bounds, int horizCells,
 		   int vertCells, int cellWidth, int cellHeight, int tag): GUIRect(owner, bounds, tag) {
 
-    _vm = vm;
+	_vm = vm;
 	_cellCount.x = horizCells;
 	_cellCount.y = vertCells;
 	_cellSize.x = cellWidth;

Modified: scummvm/branches/gsoc2010-plugins/engines/m4/mads_anim.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/mads_anim.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/mads_anim.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -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/branches/gsoc2010-plugins/engines/m4/mads_menus.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/m4/mads_menus.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/m4/mads_menus.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -617,10 +617,10 @@
 	}
 	_totalTextEntries = 0;
 
-	// Set up a default sprite slot entry
+	// Set up a default sprite slot entry for a full screen refresh
 	_spriteSlots.startIndex = 1;
-	_spriteSlots[0].spriteId = -2;
-	_spriteSlots[0].timerIndex = -1;
+	_spriteSlots[0].spriteType = FULL_SCREEN_REFRESH;
+	_spriteSlots[0].seqIndex = -1;
 }
 
 void RexDialogView::initialiseGraphics() {
@@ -796,8 +796,8 @@
 
 void RexDialogView::setFrame(int frameNumber, int depth) {
 	int slotIndex = _spriteSlots.getIndex();
-	_spriteSlots[slotIndex].spriteId = 1;
-	_spriteSlots[slotIndex].timerIndex = 1;
+	_spriteSlots[slotIndex].spriteType = FOREGROUND_SPRITE;
+	_spriteSlots[slotIndex].seqIndex = 1;
 	_spriteSlots[slotIndex].spriteListIndex = 0; //_menuSpritesIndex;
 	_spriteSlots[slotIndex].frameNumber = frameNumber;
 
@@ -986,15 +986,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);
 	}
 }
 
@@ -1070,42 +1070,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/branches/gsoc2010-plugins/engines/parallaction/debug.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/debug.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/debug.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -42,6 +42,7 @@
 	DCmd_Register("zones",		WRAP_METHOD(Debugger, Cmd_Zones));
 	DCmd_Register("animations",	WRAP_METHOD(Debugger, Cmd_Animations));
 	DCmd_Register("globalflags",WRAP_METHOD(Debugger, Cmd_GlobalFlags));
+	DCmd_Register("toggleglobalflag",WRAP_METHOD(Debugger, Cmd_ToggleGlobalFlag));
 	DCmd_Register("localflags",	WRAP_METHOD(Debugger, Cmd_LocalFlags));
 	DCmd_Register("locations",	WRAP_METHOD(Debugger, Cmd_Locations));
 	DCmd_Register("gfxobjects",	WRAP_METHOD(Debugger, Cmd_GfxObjects));
@@ -117,6 +118,32 @@
 	return true;
 }
 
+bool Debugger::Cmd_ToggleGlobalFlag(int argc, const char **argv) {
+
+	int i;
+
+	switch (argc) {
+	case 2:
+		i = _vm->_globalFlagsNames->lookup(argv[1]);
+		if (i == Table::notFound) {
+			DebugPrintf("invalid flag '%s'\n", argv[1]);
+		} else {
+			i--;
+			if ((_globalFlags & (1 << i)) == 0)
+				_globalFlags |= (1 << i);
+			else
+				_globalFlags &= ~(1 << i);
+		}
+		break;
+
+	default:
+		DebugPrintf("toggleglobalflag <flag name>\n");
+
+	}
+
+	return true;
+}
+
 bool Debugger::Cmd_LocalFlags(int argc, const char **argv) {
 
 	uint32 flags = _vm->getLocationFlags();

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/debug.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/debug.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/debug.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -28,6 +28,7 @@
 	bool Cmd_Animations(int argc, const char **argv);
 	bool Cmd_LocalFlags(int argc, const char **argv);
 	bool Cmd_GlobalFlags(int argc, const char **argv);
+	bool Cmd_ToggleGlobalFlag(int argc, const char **argv);
 	bool Cmd_Locations(int argc, const char **argv);
 	bool Cmd_GfxObjects(int argc, const char **argv);
 	bool Cmd_Programs(int argc, const char** argv);

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/dialogue.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/dialogue.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -461,6 +461,10 @@
 
 
 void Parallaction::enterDialogueMode(ZonePtr z) {
+	if (!z->u._speakDialogue) {
+		return;
+	}
+
 	debugC(1, kDebugDialogue, "Parallaction::enterDialogueMode(%s)", z->u._filename.c_str());
 	_dialogueMan = createDialogueManager(z);
 	assert(_dialogueMan);

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/exec_br.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/exec_br.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -337,7 +337,7 @@
 		return;
 	}
 
-	if (ACTIONTYPE(ctxt._cmd->_zone) == kZoneSpeak) {
+	if (ACTIONTYPE(ctxt._cmd->_zone) == kZoneSpeak && ctxt._cmd->_zone->u._speakDialogue) {
 		_vm->enterDialogueMode(ctxt._cmd->_zone);
 	} else {
 		_vm->_activeZone = ctxt._cmd->_zone;

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/graphics.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/graphics.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -538,12 +538,12 @@
 
 		setupLabelSurface(*cnv, w, h);
 
-		font->setColor((_vm->getGameType() == GType_BRA) ? 0 : 7);
+		font->setColor((_gameType == GType_BRA) ? 0 : 7);
 		font->drawString((byte*)cnv->pixels + 1, cnv->w, text);
 		font->drawString((byte*)cnv->pixels + 1 + cnv->w * 2, cnv->w, text);
 		font->drawString((byte*)cnv->pixels + cnv->w, cnv->w, text);
 		font->drawString((byte*)cnv->pixels + 2 + cnv->w, cnv->w, text);
-		font->setColor((_vm->getGameType() == GType_BRA) ? 11 : 1);
+		font->setColor((_gameType == GType_BRA) ? 11 : 1);
 		font->drawString((byte*)cnv->pixels + 1 + cnv->w, cnv->w, text);
 	} else {
 		w = font->getStringWidth(text);
@@ -835,7 +835,7 @@
 		// The PC version of BRA needs the entries 20-31 of the palette to be constant, but
 		// the background resource files are screwed up. The right colors come from an unused
 		// bitmap (pointer.bmp). Nothing is known about the Amiga version so far.
-		if ((_vm->getGameType() == GType_BRA) && (_vm->getPlatform() == Common::kPlatformPC)) {
+		if ((_gameType == GType_BRA) && (_vm->getPlatform() == Common::kPlatformPC)) {
 			int r, g, b;
 			for (uint i = 16; i < 32; i++) {
 				_backupPal.getEntry(i, r, g, b);

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/input.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/input.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/input.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -203,13 +203,13 @@
 		return event;
 	}
 
-	if (_vm->getGameType() == GType_Nippon) {
+	if (_gameType == GType_Nippon) {
 		if (_hasKeyPressEvent && (_vm->getFeatures() & GF_DEMO) == 0) {
 			if (_keyPressed.keycode == Common::KEYCODE_l) event = kEvLoadGame;
 			if (_keyPressed.keycode == Common::KEYCODE_s) event = kEvSaveGame;
 		}
 	} else
-	if (_vm->getGameType() == GType_BRA) {
+	if (_gameType == GType_BRA) {
 		if (_hasKeyPressEvent && (_vm->getFeatures() & GF_DEMO) == 0) {
 			if (_keyPressed.keycode == Common::KEYCODE_F5) event = kEvIngameMenu;
 		}
@@ -325,8 +325,13 @@
 
 	if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || (ACTIONTYPE(z) == kZoneCommand))) {
 
-		if (z->_flags & kFlagsNoWalk) {
-			// character doesn't need to walk to take specified action
+		bool noWalk = z->_flags & kFlagsNoWalk;	// check the explicit no-walk flag
+		if (_gameType == GType_BRA) {
+			// action performed on object marked for self-use do not need walk in BRA
+			noWalk |= ((z->_flags & kFlagsYourself) != 0);
+		}
+
+		if (noWalk) {
 			takeAction(z);
 		} else {
 			// action delayed: if Zone defined a moveto position the character is programmed to move there,
@@ -351,7 +356,7 @@
 
 void Input::enterInventoryMode() {
 	Common::Point mousePos;
-	getCursorPos(mousePos);
+	getAbsoluteCursorPos(mousePos);
 	bool hitCharacter = _vm->hitZone(kZoneYou, mousePos.x, mousePos.y);
 
 	if (hitCharacter) {

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/objects.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/objects.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/objects.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -88,9 +88,9 @@
 	kFlagsNoWalk		= 0x800,			// Zone: character doesn't need to walk towards object to interact
 
 	// BRA specific
-	kFlagsYourself		= 0x1000,
+	kFlagsYourself		= 0x1000,			// BRA: marks zones used by the character on him/herself
 	kFlagsScaled		= 0x2000,
-	kFlagsSelfuse		= 0x4000,
+	kFlagsSelfuse		= 0x4000,			// BRA: marks zones to be preserved across location changes (see Parallaction::freeZones)
 	kFlagsIsAnimation	= 0x1000000,		// BRA: used in walk code (trap check), to tell is a Zone is an Animation
 	kFlagsAnimLinked	= 0x2000000
 };

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -102,7 +102,8 @@
 
 
 Common::Error Parallaction::init() {
-
+	
+	_gameType = getGameType();
 	_engineFlags = 0;
 	_objectsNames = NULL;
 	_globalFlagsNames = NULL;
@@ -408,7 +409,7 @@
 	uint16 layer = LAYER_FOREGROUND;
 	uint16 scale = 100;
 
-	switch (getGameType()) {
+	switch (_gameType) {
 	case GType_Nippon:
 		if ((anim->_flags & kFlagsNoMasked) == 0) {
 			// Layer in NS depends on where the animation is on the screen, for each animation.
@@ -523,7 +524,7 @@
 	}
 
 	// TODO: move this balloons stuff into DialogueManager and BalloonManager
-	if (getGameType() == GType_Nippon) {
+	if (_gameType == GType_Nippon) {
 		if (!data->_filename.empty()) {
 			if (data->_gfxobj == 0) {
 				data->_gfxobj = _disk->loadStatic(data->_filename.c_str());
@@ -540,7 +541,7 @@
 			_gfx->setItem(_char._talk, 190, 80);
 		}
 	} else
-	if (getGameType() == GType_BRA) {
+	if (_gameType == GType_BRA) {
 		_balloonMan->setSingleBalloon(data->_examineText.c_str(), 0, 0, 1, BalloonManager::kNormalColor);
 		_gfx->setItem(_char._talk, 10, 80);
 	}
@@ -651,13 +652,21 @@
 	return (slot != -1);
 }
 
-// FIXME: input coordinates must be offseted to handle scrolling!
 bool Parallaction::checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y) {
-	// not a special zone
-	if ((z->getX() != -2) && (z->getX() != -3)) {
-		return false;
+	// check if really a special zone
+	if (_gameType == GType_Nippon) {
+		// so-called special zones in NS have special x coordinates
+		if ((z->getX() != -2) && (z->getX() != -3)) {
+			return false;
+		}
 	}
-
+	if (_gameType == GType_BRA) {
+		// so far, special zones in BRA are only merge zones
+		if (ACTIONTYPE(z) != kZoneMerge) {
+			return false;
+		}
+	}
+	
 	// WORKAROUND: this huge condition is needed because we made TypeData a collection of structs
 	// instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine,
 	// but we need to check it separately here. The same workaround is applied in freeZones.
@@ -681,7 +690,33 @@
 	return false;
 }
 
-// FIXME: input coordinates must be offseted to handle scrolling!
+bool Parallaction::checkZoneType(ZonePtr z, uint32 type) {
+	if (_gameType == GType_Nippon) {
+		if ((type == 0) && (ITEMTYPE(z) == 0))
+			return true;		
+	}
+
+	if (_gameType == GType_BRA) {
+		if (type == 0) {
+			if (ITEMTYPE(z) == 0) {			
+				if (ACTIONTYPE(z) != kZonePath) {
+					return true;
+				}
+			} 
+			if (ACTIONTYPE(z) == kZoneDoor) {
+				return true;
+			}	
+		}
+	}
+
+	if (z->_type == type)
+		return true;
+	if (ITEMTYPE(z) == type)
+		return true;
+
+	return false;
+}
+
 bool Parallaction::checkZoneBox(ZonePtr z, uint32 type, uint x, uint y) {
 	if (z->_flags & kFlagsRemove)
 		return false;
@@ -689,29 +724,30 @@
 	debugC(5, kDebugExec, "checkZoneBox for %s (type = %x, x = %i, y = %i)", z->_name, type, x, y);
 
 	if (!z->hitRect(x, y)) {
-
 		// check for special zones (items defined in common.loc)
 		if (checkSpecialZoneBox(z, type, x, y))
 			return true;
 
-		if (z->getX() != -1)
+		// check if self-use zone (nothing to do with kFlagsSelfuse)
+		if (_gameType == GType_Nippon) {
+			if (z->getX() != -1) {	// no explicit self-use flag in NS
+				return false;
+			}
+		}
+		if (_gameType == GType_BRA) {
+			if (!(z->_flags & kFlagsYourself)) {
+				return false;
+			}
+		}
+		if (!_char._ani->hitFrameRect(x, y)) {
 			return false;
-		if (!_char._ani->hitFrameRect(x, y))
-			return false;
+		}
+		// we get here only if (x,y) hits the character and the zone is marked as self-use
 	}
 
-	// normal Zone
-	if ((type == 0) && (ITEMTYPE(z) == 0))
-		return true;
-	if (z->_type == type)
-		return true;
-	if (ITEMTYPE(z) == type)
-		return true;
-
-	return false;
+	return checkZoneType(z, type);
 }
 
-// FIXME: input coordinates must be offseted to handle scrolling!
 bool Parallaction::checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y) {
 	if (z->_flags & kFlagsRemove)
 		return false;
@@ -727,18 +763,14 @@
 		return false;
 	}
 
-	// NOTE: the implementation of the following lines is a different in the
-	// original... it is working so far, though
-	if ((type == 0) && (ITEMTYPE(z) == 0))
-		return true;
-	if (z->_type == type)
-		return true;
-	if (ITEMTYPE(z) == type)
-		return true;
-
-	return false;
+	return checkZoneType(z, type);
 }
 
+/* NOTE: hitZone needs to be passed absolute game coordinates to work.
+
+   When type is kZoneMerge, then x and y are the identifiers of the objects to merge,
+   and the above requirement does not apply.
+*/
 ZonePtr Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
 	uint16 _di = y;
 	uint16 _si = x;
@@ -752,14 +784,20 @@
 		}
 	}
 
-
 	int16 _a, _b, _c, _d;
 	bool _ef;
 	for (AnimationList::iterator ait = _location._animations.begin(); ait != _location._animations.end(); ++ait) {
 
 		AnimationPtr a = *ait;
 
-		_a = (a->_flags & kFlagsActive) ? 1 : 0;															   // _a: active Animation
+		_a = (a->_flags & kFlagsActive) ? 1 : 0;	// _a: active Animation
+		
+		if (!_a) {
+			if (_gameType == GType_BRA && ACTIONTYPE(a) != kZoneTrap) {
+				continue;
+			}
+		}
+
 		_ef = a->hitFrameRect(_si, _di);
 
 		_b = ((type != 0) || (a->_type == kZoneYou)) ? 0 : 1;										 // _b: (no type specified) AND (Animation is not the character)
@@ -951,7 +989,7 @@
 }
 
 void Parallaction::beep() {
-	if (getGameType() == GType_Nippon) {
+	if (_gameType == GType_Nippon) {
 		_soundMan->execute(SC_SETSFXCHANNEL, 3);
 		_soundMan->execute(SC_SETSFXVOLUME, 127);
 		_soundMan->execute(SC_SETSFXLOOPING, (int32)0);

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -280,6 +280,7 @@
 	int32			_screenWidth;
 	int32			_screenHeight;
 	int32			_screenSize;
+	int				_gameType;
 
 	// subsystems
 	Gfx				*_gfx;
@@ -360,6 +361,7 @@
 	uint32		getLocationFlags();
 	bool		checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y);
 	bool		checkZoneBox(ZonePtr z, uint32 type, uint x, uint y);
+	bool 		checkZoneType(ZonePtr z, uint32 type);
 	bool		checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y);
 	ZonePtr		hitZone(uint32 type, uint16 x, uint16 y);
 	void		runZone(ZonePtr z);

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction_br.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/parallaction_br.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -196,7 +196,7 @@
 	if (_activeZone) {
 		z = _activeZone;	// speak Zone or sound
 		_activeZone.reset();
-		if (ACTIONTYPE(z) == kZoneSpeak) {
+		if (ACTIONTYPE(z) == kZoneSpeak && z->u._speakDialogue) {
 			enterDialogueMode(z);
 		} else {
 			runZone(z);			// FIXME: BRA doesn't handle sound yet
@@ -206,7 +206,7 @@
 	if (_activeZone2) {
 		z = _activeZone2;	// speak Zone or sound
 		_activeZone2.reset();
-		if (ACTIONTYPE(z) == kZoneSpeak) {
+		if (ACTIONTYPE(z) == kZoneSpeak && z->u._speakDialogue) {
 			enterDialogueMode(z);
 		} else {
 			runZone(z);			// FIXME: BRA doesn't handle sound yet

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/parser.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/parser.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/parser.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -44,8 +44,10 @@
 /*
  * readLineIntern read a text line and prepares it for
  * parsing, by stripping the leading whitespace and
- * changing tabs to spaces. It will stop on a CR or LF,
- * and return an empty string (length = 0) when a line
+ * changing tabs to spaces. It will stop on a CR, LF, or
+ * SUB (0x1A), which may all occur at the end of a script
+ * line.
+ * Returns an empty string (length = 0) when a line
  * has no printable text in it.
  */
 char *Script::readLineIntern(char *buf, size_t bufSize) {
@@ -54,7 +56,8 @@
 		char c = _input->readSByte();
 		if (_input->eos())
 			break;
-		if (c == '\n' || c == '\r')
+		// break if EOL
+		if (c == '\n' || c == '\r' || c == (char)0x1A)
 			break;
 		if (c == '\t')
 			c = ' ';

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/parser_ns.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/parser_ns.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -286,6 +286,7 @@
 	debugC(5, kDebugParser, "parseAnimation(name: %s)", name);
 
 	if (_vm->_location.findAnimation(name)) {
+		_zoneProg++;
 		_script->skip("endanimation");
 		return;
 	}
@@ -1305,6 +1306,7 @@
 	debugC(5, kDebugParser, "parseZone(name: %s)", name);
 
 	if (_vm->_location.findZone(name)) {
+		_zoneProg++;
 		_script->skip("endzone");
 		return;
 	}

Modified: scummvm/branches/gsoc2010-plugins/engines/parallaction/sound_br.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/parallaction/sound_br.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/parallaction/sound_br.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -172,11 +172,11 @@
 
 	byte *pos = data;
 
-	uint32 signature = read4high(pos);
-	if (memcmp("tCSM", &signature, 4)) {
+	if (memcmp("MSCt", pos, 4)) {
 		warning("Expected header not found in music file.");
 		return false;
 	}
+	pos += 4;
 
 	_beats = read1(pos);
 	_ppqn = read2low(pos);

Modified: scummvm/branches/gsoc2010-plugins/engines/saga/saga.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/saga/saga.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/saga/saga.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -316,20 +316,6 @@
 
 	syncSoundSettings();
 
-
-#if 0
-	// FIXME: Disabled this code for now. We want to get rid of OSystem::kFeatureAutoComputeDirtyRects
-	// and this is the last place to make use of it. We need to find out whether doing
-	// so causes any regressions. If it does, we can reenable it, if not, we can remove
-	// this code in 0.13.0.
-
-	// FIXME: This is the ugly way of reducing redraw overhead. It works
-	//        well for 320x200 but it's unclear how well it will work for
-	//        640x480.
-	if (getGameId() == GID_ITE)
-		_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
-#endif
-
 	int msec = 0;
 
 	_previousTicks = _system->getMillis();

Modified: scummvm/branches/gsoc2010-plugins/engines/sci/engine/script.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sci/engine/script.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sci/engine/script.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -332,6 +332,8 @@
 	if (offset == 0) {
 		// Check if the game has a second export table (e.g. script 912 in Camelot)
 		// Fixes bug #3039785
+		if (g_sci->getGameId() == GID_ECOQUEST) // cheap fix in here for eco quest 1, [md5] plz look into this TODO FIXME
+			return offset;
 		const uint16 *secondExportTable = (const uint16 *)findBlock(SCI_OBJ_EXPORTS, 0);
 
 		if (secondExportTable) {

Modified: scummvm/branches/gsoc2010-plugins/engines/sci/engine/script_patches.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sci/engine/script_patches.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sci/engine/script_patches.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -51,8 +51,72 @@
 //  - if not EOS, an adjust offset and the actual bytes
 //  - rinse and repeat
 
+// stayAndHelp::changeState (0) is called when ego swims to the left or right
+//  boundaries of room 660. Normally a textbox is supposed to get on screen
+//  but the call is wrong, so not only do we get an error message the script
+//  is also hanging because the cue won't get sent out
+//  This also happens in sierra sci - ffs. bug #3038387
+const byte ecoquest1SignatureStayAndHelp[] = {
+	40,
+	0x3f, 0x01,        // link 01
+	0x87, 0x01,        // lap param[1]
+	0x65, 0x14,        // aTop state
+	0x36,              // push
+	0x3c,              // dup
+	0x35, 0x00,        // ldi 00
+	0x1a,              // eq?
+	0x31, 0x1c,        // bnt [next state]
+	0x76,              // push0
+	0x45, 0x01, 0x00,  // callb export1 from script 0 (switching control off)
+	0x38, 0x22, 0x01,  // pushi 0122
+	0x78,              // push1
+	0x76,              // push0
+	0x81, 0x00,        // lag global[0]
+	0x4a, 0x06,        // send 06 - ego::setMotion(0)
+	0x39, 0x6e,        // pushi 6e (selector init)
+	0x39, 0x04,        // pushi 04
+	0x76,              // push0
+	0x76,              // push0
+	0x39, 0x17,        // pushi 17
+	0x7c,              // pushSelf
+	0x51, 0x82,        // class EcoNarrator
+	0x4a, 0x0c,        // send 0c - EcoNarrator::init(0, 0, 23, self) (BADLY BROKEN!)
+	0x33,              // jmp [end]
+	0
+};
 
-// daySixBeignet::changeState is called when the cop goes out and sets cycles to 220.
+const uint16 ecoquest1PatchStayAndHelp[] = {
+	0x87, 0x01,        // lap param[1]
+	0x65, 0x14,        // aTop state
+	0x36,              // push
+	0x2f, 0x22,        // bt [next state] (this optimization saves 6 bytes)
+	0x39, 0x00,        // pushi 0 (wasting 1 byte here)
+	0x45, 0x01, 0x00,  // callb export1 from script 0 (switching control off)
+	0x38, 0x22, 0x01,  // pushi 0122
+	0x78,              // push1
+	0x76,              // push0
+	0x81, 0x00,        // lag global[0]
+	0x4a, 0x06,        // send 06 - ego::setMotion(0)
+	0x39, 0x6e,        // pushi 6e (selector init)
+	0x39, 0x06,        // pushi 06
+	0x39, 0x02,        // pushi 02 (additional 2 bytes)
+	0x76,              // push0
+	0x76,              // push0
+	0x39, 0x17,        // pushi 17
+	0x7c,              // pushSelf
+	0x38, 0x80, 0x02,  // pushi 280 (additional 3 bytes)
+	0x51, 0x82,        // class EcoNarrator
+	0x4a, 0x10,        // send 10 - EcoNarrator::init(2, 0, 0, 23, self, 640)
+	PATCH_END
+};
+
+//    script, description,                                   magic DWORD,                                 adjust
+const SciScriptSignature ecoquest1Signatures[] = {
+    {    660, "CD: bad messagebox and freeze",               PATCH_MAGICDWORD(0x38, 0x22, 0x01, 0x78),   -17, ecoquest1SignatureStayAndHelp, ecoquest1PatchStayAndHelp },
+    {      0, NULL,                                          0,                                            0, NULL,                          NULL }
+};
+
+// daySixBeignet::changeState (4) is called when the cop goes out and sets cycles to 220.
 //  this is not enough time to get to the door, so we patch that to 23 seconds
 const byte gk1SignatureDay6PoliceBeignet[] = {
 	4,
@@ -78,12 +142,14 @@
 	PATCH_END
 };
 
+// sargSleeping::changeState (8) is called when the cop falls asleep and sets cycles to 220.
+//  this is not enough time to get to the door, so we patch it to 42 seconds
 const byte gk1SignatureDay6PoliceSleep[] = {
 	4,
 	0x35, 0x08,        // ldi 08
 	0x1a,              // eq?
 	0x31,              // bnt [next state check]
-	+1, 5,             // [skip 1 byte, offset of bnt]
+	+1, 6,             // [skip 1 byte, offset of bnt]
 	0x34, 0xdc, 0x00,  // ldi 220
 	0x65, 0x1a,        // aTop cycles
 	0x32,              // jmp [end]
@@ -97,8 +163,27 @@
 	PATCH_END
 };
 
+// startOfDay5::changeState (20h) - when gabriel goes to the phone the script will hang
+const byte gk1SignatureDay5PhoneFreeze[] = {
+	5,
+	0x35, 0x03,        // ldi 03
+	0x65, 0x1a,        // aTop cycles
+	0x32,              // jmp [end]
+	+2, 3,             // [skip 2 bytes, offset of jmp]
+	0x3c,              // dup
+	0x35, 0x21,        // ldi 21
+	0
+};
+
+const uint16 gk1PatchDay5PhoneFreeze[] = {
+	0x35, 0x06,        // ldi 06
+	0x65, 0x20,        // aTop ticks
+	PATCH_END
+};
+
 //    script, description,                                   magic DWORD,                                 adjust
 const SciScriptSignature gk1Signatures[] = {
+    {    212, "day 5 phone freeze",                          PATCH_MAGICDWORD(0x35, 0x03, 0x65, 0x1a),     0, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze },
     {    230, "day 6 police beignet timer issue",            PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65),   -16, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet },
     {    230, "day 6 police sleep timer issue",              PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65),    -5, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep },
     {      0, NULL,                                          0,                                            0, NULL,                          NULL }
@@ -325,6 +410,8 @@
 
 void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uint32 scriptSize) {
 	const SciScriptSignature *signatureTable = NULL;
+	if (g_sci->getGameId() == GID_ECOQUEST)
+		signatureTable = ecoquest1Signatures;
 	if (g_sci->getGameId() == GID_GK1)
 		signatureTable = gk1Signatures;
 // hoyle4 now works due workaround inside GfxPorts
@@ -341,7 +428,7 @@
 				int32 foundOffset = findSignature(signatureTable, scriptData, scriptSize);
 				if (foundOffset != -1) {
 					// found, so apply the patch
-					warning("matched %s on script %d offset %d", signatureTable->description, scriptNr, foundOffset);
+					warning("matched and patched %s on script %d offset %d", signatureTable->description, scriptNr, foundOffset);
 					applyPatch(signatureTable->patch, scriptData, scriptSize, foundOffset);
 				}
 			}

Modified: scummvm/branches/gsoc2010-plugins/engines/sci/engine/workarounds.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sci/engine/workarounds.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sci/engine/workarounds.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -114,6 +114,7 @@
 	{ GID_JONES,         764,   255,  0,                   "", "export 0",       -1,   14, { WORKAROUND_FAKE,   0 } }, // jones/ega&vga only - called when the game starts
 	{ GID_KQ5,            -1,     0,  0,                   "", "export 29",      -1,    3, { WORKAROUND_FAKE,   0 } }, // called when playing harp for the harpies or when aborting dialog in toy shop, is used for kDoAudio - bug #3034700
 	{ GID_KQ5,            25,    25,  0,              "rm025", "doit",           -1,    0, { WORKAROUND_FAKE,   0 } }, // inside witch forest, when going to the room where the walking rock is
+    { GID_KQ5,            55,    55,  0,         "helpScript", "doit",           -1,    0, { WORKAROUND_FAKE,   0 } }, // when giving the tambourine to the monster in the labyrinth (only happens at one of the locations) - bug #3041262
 	{ GID_KQ6,            -1,    30,  0,               "rats", "changeState",    -1,   -1, { WORKAROUND_FAKE,   0 } }, // rats in the catacombs (temps 1 - 5) - bugs #3034597, #3035495, #3035824
 	{ GID_KQ6,           210,   210,  0,              "rm210", "scriptCheck",    -1,    0, { WORKAROUND_FAKE,   1 } }, // using inventory in that room - bug #3034565
 	{ GID_KQ6,           500,   500,  0,              "rm500", "init",           -1,    0, { WORKAROUND_FAKE,   0 } }, // going to island of the beast
@@ -124,8 +125,7 @@
 	{ GID_LAURABOW,       -1,   967,  0,             "myIcon", "cycle",          -1,    1, { WORKAROUND_FAKE,   0 } }, // having any portrait conversation coming up (initial bug #3034985)
 	{ GID_LAURABOW2,      -1,    24,  0,              "gcWin", "open",           -1,    5, { WORKAROUND_FAKE, 0xf } }, // is used as priority for game menu
 	{ GID_LAURABOW2,      -1,    21,  0,      "dropCluesCode", "doit",           -1,    1, { WORKAROUND_FAKE, 0x7fff } }, // when asking some questions (e.g. the reporter about the burglary, or the policeman about Ziggy). Must be big, as the game scripts perform lt on it and start deleting journal entries - bugs #3035068, #3036274
-	{ GID_LAURABOW2,      -1,    90,  0,               "aTut", "init",           -1,    6, { WORKAROUND_FAKE,   0 } }, // Random actors in museum (bug #3041257)
-	{ GID_LAURABOW2,      -1,    90,  0,             "aZiggy", "init",           -1,    6, { WORKAROUND_FAKE,   0 } }, // Random actors in museum (bug #3041257)
+	{ GID_LAURABOW2,      -1,    90,  1,        "MuseumActor", "init",           -1,    6, { WORKAROUND_FAKE,   0 } }, // Random actors in museum (bug #3041257)
 	{ GID_LAURABOW2,     240,   240,  0,     "sSteveAnimates", "changeState",    -1,    0, { WORKAROUND_FAKE,   0 } }, // Steve Dorian's idle animation at the docks - bug #3036291
 	{ GID_LONGBOW,        -1,   213,  0,              "clear", "handleEvent",    -1,    0, { WORKAROUND_FAKE,   0 } }, // When giving an answer using the druid hand sign code in any room
 	{ GID_LONGBOW,        -1,   213,  0,             "letter", "handleEvent",  0xa8,    1, { WORKAROUND_FAKE,   0 } }, // When using the druid hand sign code in any room - bug #3036601
@@ -155,6 +155,7 @@
 	{ GID_QFG3,          330,   330, -1,             "Teller", "doChild",        -1,   -1, { WORKAROUND_FAKE,   0 } }, // when talking to King Rajah about "Rajah" (bug #3036390, temp 1) or "Tarna" (temp 0), or when clicking on yourself and saying "Greet" (bug #3039774, temp 1)
 	{ GID_QFG3,          700,   700, -1,      "monsterIsDead", "changeState",    -1,    0, { WORKAROUND_FAKE,   0 } }, // in the jungle, after winning any fight, bug #3040624
 	{ GID_QFG3,          470,   470, -1,              "rm470", "notify",         -1,    0, { WORKAROUND_FAKE,   0 } }, // closing the character screen in the Simbani village in the room with the bridge, bug #3040565
+	{ GID_QFG3,          490,   490, -1,      "computersMove", "changeState",    -1,    0, { WORKAROUND_FAKE,   0 } }, // when finishing awari game, bug #3040579
 	{ GID_QFG4,           -1,    15, -1,     "charInitScreen", "dispatchEvent",  -1,    5, { WORKAROUND_FAKE,   0 } }, // floppy version, when viewing the character screen
 	{ GID_QFG4,           -1, 64917, -1,       "controlPlane", "setBitmap",      -1,    3, { WORKAROUND_FAKE,   0 } }, // floppy version, when entering the game menu
 	{ GID_QFG4,           -1, 64917, -1,              "Plane", "setBitmap",      -1,    3, { WORKAROUND_FAKE,   0 } }, // floppy version, happen sometimes in fights

Modified: scummvm/branches/gsoc2010-plugins/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sci/graphics/animate.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sci/graphics/animate.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -243,6 +243,8 @@
 			}
 		}
 
+		//warning("%s", _s->_segMan->getObjectName(curObject));
+
 		if (!view->isScaleable()) {
 			// Laura Bow 2 (especially floppy) depends on this, some views are not supposed to be scaleable
 			//  this "feature" was removed in later versions of SCI1.1
@@ -516,6 +518,19 @@
 	}
 }
 
+void GfxAnimate::preprocessAddToPicList() {
+	AnimateList::iterator it;
+	const AnimateList::iterator end = _list.end();
+
+	for (it = _list.begin(); it != end; ++it) {
+		if (it->priority == -1)
+			it->priority = _ports->kernelCoordinateToPriority(it->y);
+
+		// Do not allow priority to get changed by fill()
+		it->signal |= kSignalFixedPriority;
+	}
+}
+
 void GfxAnimate::addToPicDrawCels() {
 	reg_t curObject;
 	GfxView *view = NULL;
@@ -525,17 +540,11 @@
 	for (it = _list.begin(); it != end; ++it) {
 		curObject = it->object;
 
-		if (it->priority == -1)
-			it->priority = _ports->kernelCoordinateToPriority(it->y);
-
 		// Get the corresponding view
 		view = _cache->getView(it->viewId);
 
-		// Create rect according to coordinates and given cel
-		view->getCelRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->celRect);
-
 		// draw corresponding cel
-		_paint16->drawCel(it->viewId, it->loopNo, it->celNo, it->celRect, it->priority, it->paletteNo);
+		_paint16->drawCel(it->viewId, it->loopNo, it->celNo, it->celRect, it->priority, it->paletteNo, it->scaleX, it->scaleY);
 		if ((it->signal & kSignalIgnoreActor) == 0) {
 			it->celRect.top = CLIP<int16>(_ports->kernelPriorityToCoordinate(it->priority) - 1, it->celRect.top, it->celRect.bottom - 1);
 			_paint16->fillRect(it->celRect, GFX_SCREEN_MASK_CONTROL, 0, 0, 15);
@@ -679,6 +688,7 @@
 
 void GfxAnimate::kernelAddToPicList(reg_t listReference, int argc, reg_t *argv) {
 	List *list;
+	byte tempPicNotValid = 0;
 
 	_ports->setPort((Port *)_ports->_picWind);
 
@@ -687,6 +697,8 @@
 		error("kAddToPic called with non-list as parameter");
 
 	makeSortedList(list);
+	preprocessAddToPicList();
+	fill(tempPicNotValid);
 	addToPicDrawCels();
 
 	addToPicSetPicNotValid();

Modified: scummvm/branches/gsoc2010-plugins/engines/sci/graphics/animate.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sci/graphics/animate.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sci/graphics/animate.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -100,6 +100,7 @@
 	void updateScreen(byte oldPicNotValid);
 	void restoreAndDelete(int argc, reg_t *argv);
 	void reAnimate(Common::Rect rect);
+	void preprocessAddToPicList();
 	void addToPicDrawCels();
 	void addToPicDrawView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
 

Modified: scummvm/branches/gsoc2010-plugins/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sci/graphics/view.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sci/graphics/view.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -256,6 +256,8 @@
 				cel->scriptHeight = cel->height = READ_SCI11ENDIAN_UINT16(celData + 2);
 				cel->displaceX = READ_SCI11ENDIAN_UINT16(celData + 4);
 				cel->displaceY = READ_SCI11ENDIAN_UINT16(celData + 6);
+				if (cel->displaceY < 0)
+					cel->displaceY += 255; // sierra did this adjust in their sci1.1 getCelRect() - not sure about sci32
 
 				assert(cel->width && cel->height);
 

Modified: scummvm/branches/gsoc2010-plugins/engines/scumm/charset.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/scumm/charset.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/scumm/charset.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -844,7 +844,7 @@
 		offsX = offsY = 0;
 	} else {
 		uint32 charOffs = READ_LE_UINT32(_fontPtr + chr * 4 + 4);
-		assert(charOffs < 0x10000);
+		assert(charOffs < 0x14000);
 		if (!charOffs)
 			return;
 		charPtr = _fontPtr + charOffs;

Modified: scummvm/branches/gsoc2010-plugins/engines/scumm/debugger.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/scumm/debugger.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/scumm/debugger.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -868,7 +868,7 @@
 		detach();
 
 	} else {
-		DebugPrintf("Use 'passcode <SEGA CD Passcode>'\n");
+		DebugPrintf("Current Passcode is %d \nUse 'passcode <SEGA CD Passcode>'\n",_vm->_scummVars[411]);
 		return true;
 	}
 	return false;

Modified: scummvm/branches/gsoc2010-plugins/engines/scumm/dialogs.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/scumm/dialogs.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/scumm/dialogs.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -234,19 +234,6 @@
 
 #endif
 
-class ConfigDialog : public GUI::OptionsDialog {
-protected:
-#ifdef SMALL_SCREEN_DEVICE
-	GUI::Dialog		*_keysDialog;
-#endif
-
-public:
-	ConfigDialog();
-	~ConfigDialog();
-
-	virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
-};
-
 #pragma mark -
 
 ScummDialog::ScummDialog(int x, int y, int w, int h) : GUI::Dialog(x, y, w, h) {
@@ -259,223 +246,31 @@
 
 #pragma mark -
 
-enum {
-	kSaveCmd = 'SAVE',
-	kLoadCmd = 'LOAD',
-	kPlayCmd = 'PLAY',
-	kOptionsCmd = 'OPTN',
-	kHelpCmd = 'HELP',
-	kAboutCmd = 'ABOU',
-	kQuitCmd = 'QUIT',
-	kChooseCmd = 'CHOS'
-};
-
-ScummMenuDialog::ScummMenuDialog(ScummEngine *scumm)
-	: ScummDialog("ScummMain"), _vm(scumm) {
-
-	new GUI::ButtonWidget(this, "ScummMain.Resume", "Resume", kPlayCmd, 'P');
-
-	_loadButton = new GUI::ButtonWidget(this, "ScummMain.Load", "Load", kLoadCmd, 'L');
-	_saveButton = new GUI::ButtonWidget(this, "ScummMain.Save", "Save", kSaveCmd, 'S');
-
-	new GUI::ButtonWidget(this, "ScummMain.Options", "Options", kOptionsCmd, 'O');
 #ifndef DISABLE_HELP
-	new GUI::ButtonWidget(this, "ScummMain.Help", "Help", kHelpCmd, 'H');
-#endif
-	new GUI::ButtonWidget(this, "ScummMain.About", "About", kAboutCmd, 'A');
 
-	new GUI::ButtonWidget(this, "ScummMain.Quit", "Quit", kQuitCmd, 'Q');
-
-	//
-	// Create the sub dialog(s)
-	//
-	_aboutDialog = new GUI::AboutDialog();
-	_optionsDialog = new ConfigDialog();
-#ifndef DISABLE_HELP
+ScummMenuDialog::ScummMenuDialog(ScummEngine *scumm)
+	: MainMenuDialog(scumm) {
 	_helpDialog = new HelpDialog(scumm->_game);
-#endif
-	_saveDialog = new GUI::SaveLoadChooser("Save game:", "Save");
-	_saveDialog->setSaveMode(true);
-	_loadDialog = new GUI::SaveLoadChooser("Load game:", "Load");
-	_loadDialog->setSaveMode(false);
+	_helpButton->setEnabled(true);
 }
 
 ScummMenuDialog::~ScummMenuDialog() {
-	delete _aboutDialog;
-	delete _optionsDialog;
-#ifndef DISABLE_HELP
 	delete _helpDialog;
-#endif
-	delete _saveDialog;
-	delete _loadDialog;
 }
 
-int ScummMenuDialog::runModal() {
-	_loadButton->setEnabled(_vm->canLoadGameStateCurrently());
-	_saveButton->setEnabled(_vm->canSaveGameStateCurrently());
-	return ScummDialog::runModal();
-}
-
-void ScummMenuDialog::reflowLayout() {
-	_loadButton->setEnabled(_vm->canLoadGameStateCurrently());
-	_saveButton->setEnabled(_vm->canSaveGameStateCurrently());
-	Dialog::reflowLayout();
-}
-
 void ScummMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	switch (cmd) {
-	case kSaveCmd:
-		save();
-		break;
-	case kLoadCmd:
-		load();
-		break;
-	case kPlayCmd:
-		close();
-		break;
-	case kOptionsCmd:
-		_optionsDialog->runModal();
-		break;
-	case kAboutCmd:
-		_aboutDialog->runModal();
-		break;
-#ifndef DISABLE_HELP
 	case kHelpCmd:
 		_helpDialog->runModal();
 		break;
-#endif
-	case kQuitCmd:
-		_vm->quitGame();
-		close();
-		break;
 	default:
-		ScummDialog::handleCommand(sender, cmd, data);
+		MainMenuDialog::handleCommand(sender, cmd, data);
 	}
 }
 
-void ScummMenuDialog::save() {
-	Common::String gameId = ConfMan.get("gameid");
-
-	const EnginePlugin *plugin = 0;
-	EngineMan.findGame(gameId, &plugin);
-
-	int idx = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName());
-	if (idx >= 0) {
-		String result(_saveDialog->getResultString());
-		char buffer[20];
-		const char *str;
-		if (result.empty()) {
-			// If the user was lazy and entered no save name, come up with a default name.
-			sprintf(buffer, "Save %d", idx);
-			str = buffer;
-		} else
-			str = result.c_str();
-		_vm->requestSave(idx, str);
-		close();
-	}
-}
-
-void ScummMenuDialog::load() {
-	Common::String gameId = ConfMan.get("gameid");
-
-	const EnginePlugin *plugin = 0;
-	EngineMan.findGame(gameId, &plugin);
-
-	int idx = _loadDialog->runModal(plugin, ConfMan.getActiveDomainName());
-	if (idx >= 0) {
-		_vm->requestLoad(idx);
-		close();
-	}
-}
-
 #pragma mark -
 
 enum {
-	kKeysCmd = 'KEYS'
-};
-
-// FIXME: We use the empty string as domain name here. This tells the
-// ConfigManager to use the 'default' domain for all its actions. We do that
-// to get as close as possible to editing the 'active' settings.
-//
-// However, that requires bad & evil hacks in the ConfigManager code,
-// and even then still doesn't work quite correctly.
-// For example, if the transient domain contains 'false' for the 'fullscreen'
-// flag, but the user used a hotkey to switch to windowed mode, then the dialog
-// will display the wrong value anyway.
-//
-// Proposed solution consisting of multiple steps:
-// 1) Add special code to the open() code that reads out everything stored
-//    in the transient domain that is controlled by this dialog, and updates
-//    the dialog accordingly.
-// 2) Even more code is added to query the backend for current settings, like
-//    the fullscreen mode flag etc., and also updates the dialog accordingly.
-// 3) The domain being edited is set to the active game domain.
-// 4) If the dialog is closed with the "OK" button, then we remove everything
-//    stored in the transient domain (or at least everything corresponding to
-//    switches in this dialog.
-//    If OTOH the dialog is closed with "Cancel" we do no such thing.
-//
-// These changes will achieve two things at once: Allow us to get rid of using
-//  "" as value for the domain, and in fact provide a somewhat better user
-// experience at the same time.
-ConfigDialog::ConfigDialog()
-	: GUI::OptionsDialog("", "ScummConfig") {
-
-	//
-	// Sound controllers
-	//
-
-	addVolumeControls(this, "ScummConfig.");
-
-	//
-	// Some misc options
-	//
-
-	// SCUMM has a talkspeed range of 0-9
-	addSubtitleControls(this, "ScummConfig.", 9);
-
-	//
-	// Add the buttons
-	//
-
-	new GUI::ButtonWidget(this, "ScummConfig.Ok", "OK", GUI::kOKCmd, 'O');
-	new GUI::ButtonWidget(this, "ScummConfig.Cancel", "Cancel", GUI::kCloseCmd, 'C');
-#ifdef SMALL_SCREEN_DEVICE
-	new GUI::ButtonWidget(this, "ScummConfig.Keys", "Keys", kKeysCmd, 'K');
-	_keysDialog = NULL;
-#endif
-}
-
-ConfigDialog::~ConfigDialog() {
-#ifdef SMALL_SCREEN_DEVICE
-	delete _keysDialog;
-#endif
-}
-
-void ConfigDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
-	switch (cmd) {
-	case kKeysCmd:
-#ifdef SMALL_SCREEN_DEVICE
-		//
-		// Create the sub dialog(s)
-		//
-		_keysDialog = new GUI::KeysDialog();
-		_keysDialog->runModal();
-		delete _keysDialog;
-		_keysDialog = NULL;
-#endif
-		break;
-	default:
-		GUI::OptionsDialog::handleCommand (sender, cmd, data);
-	}
-}
-
-#ifndef DISABLE_HELP
-
-#pragma mark -
-
-enum {
 	kNextCmd = 'NEXT',
 	kPrevCmd = 'PREV'
 };

Modified: scummvm/branches/gsoc2010-plugins/engines/scumm/dialogs.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/scumm/dialogs.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/scumm/dialogs.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -27,9 +27,8 @@
 
 #include "common/str.h"
 #include "gui/dialog.h"
-#include "gui/options.h"
 #include "gui/widget.h"
-#include "gui/saveload.h"
+#include "engines/dialogs.h"
 
 #include "scumm/detection.h"
 
@@ -52,33 +51,18 @@
 	typedef Common::String String;
 };
 
-class ScummMenuDialog : public ScummDialog {
+#ifndef DISABLE_HELP
+class ScummMenuDialog : public MainMenuDialog {
 public:
 	ScummMenuDialog(ScummEngine *scumm);
 	~ScummMenuDialog();
 	virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
 
-	virtual void reflowLayout();
-
-	int runModal();
 protected:
-	ScummEngine		*_vm;
-
-	GUI::Dialog		*_aboutDialog;
-	GUI::Dialog		*_optionsDialog;
-#ifndef DISABLE_HELP
 	GUI::Dialog		*_helpDialog;
+};
 #endif
-	GUI::SaveLoadChooser	*_saveDialog;
-	GUI::SaveLoadChooser	*_loadDialog;
 
-	GUI::ButtonWidget *_loadButton;
-	GUI::ButtonWidget *_saveButton;
-
-	void save();
-	void load();
-};
-
 /**
  * A dialog which displays an arbitrary message to the user and returns
  * ther users reply as its result value. More specifically, it returns

Modified: scummvm/branches/gsoc2010-plugins/engines/scumm/he/resource_he.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/scumm/he/resource_he.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/scumm/he/resource_he.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -633,8 +633,10 @@
 		wr[c].children = fi->first_resource + (FROM_LE_32(dirent[c].offset_to_data) & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY);
 
 		/* fill in wr->id, wr->numeric_id */
-		if (!decode_pe_resource_id(fi, wr + c, FROM_LE_32(dirent[c].name)))
+		if (!decode_pe_resource_id(fi, wr + c, FROM_LE_32(dirent[c].name))) {
+			free(wr);
 			return NULL;
+		}
 	}
 
 	return wr;

Modified: scummvm/branches/gsoc2010-plugins/engines/scumm/input.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/scumm/input.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/scumm/input.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -508,7 +508,7 @@
 		if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
 			runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);
 
-		scummMenuDialog();		// Display GUI
+		openMainMenuDialog();		// Display global main menu
 
 		if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
 			runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0);

Modified: scummvm/branches/gsoc2010-plugins/engines/scumm/scumm.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/scumm/scumm.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/scumm/scumm.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -108,7 +108,7 @@
 	  _language(dr.language),
 	  _debugger(0),
 	  _currentScript(0xFF), // Let debug() work on init stage
-	  _messageDialog(0), _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) {
+	  _messageDialog(0), _pauseDialog(0), _versionDialog(0) {
 
 	if (_game.platform == Common::kPlatformNES) {
 		_gdi = new GdiNES(this);
@@ -140,7 +140,6 @@
 
 	_fileHandle = 0;
 
-
 	// Init all vars
 	_v0ObjectIndex = false;
 	_v0ObjectInInventory = false;
@@ -152,7 +151,6 @@
 	_sound = NULL;
 	memset(&vm, 0, sizeof(vm));
 	_pauseDialog = NULL;
-	_scummMenuDialog = NULL;
 	_versionDialog = NULL;
 	_fastMode = 0;
 	_actors = NULL;
@@ -552,6 +550,12 @@
 	for (int i = 0; i < ARRAYSIZE(debugChannels); ++i)
 		DebugMan.addDebugChannel(debugChannels[i].flag,  debugChannels[i].channel, debugChannels[i].desc);
 
+#ifndef DISABLE_HELP
+	// Create custom GMM dialog providing a help subdialog
+	assert(!_mainMenuDialog);
+	_mainMenuDialog = new ScummMenuDialog(this);
+#endif
+
 	g_eventRec.registerRandomSource(_rnd, "scumm");
 }
 
@@ -572,7 +576,6 @@
 	delete _charset;
 	delete _messageDialog;
 	delete _pauseDialog;
-	delete _scummMenuDialog;
 	delete _versionDialog;
 	delete _fileHandle;
 
@@ -2444,13 +2447,6 @@
 	runDialog(*_versionDialog);
 }
 
-void ScummEngine::scummMenuDialog() {
-	if (!_scummMenuDialog)
-		_scummMenuDialog = new ScummMenuDialog(this);
-	runDialog(*_scummMenuDialog);
-	syncSoundSettings();
-}
-
 void ScummEngine::confirmExitDialog() {
 	ConfirmDialog d(this, 6);
 

Modified: scummvm/branches/gsoc2010-plugins/engines/scumm/scumm.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/scumm/scumm.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/scumm/scumm.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -530,7 +530,6 @@
 	Dialog *_pauseDialog;
 	Dialog *_messageDialog;
 	Dialog *_versionDialog;
-	Dialog *_scummMenuDialog;
 
 	virtual int runDialog(Dialog &dialog);
 	void confirmExitDialog();
@@ -538,7 +537,6 @@
 	void pauseDialog();
 	void messageDialog(const char *message);
 	void versionDialog();
-	void scummMenuDialog();
 
 	char displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4);
 

Modified: scummvm/branches/gsoc2010-plugins/engines/sword1/animation.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sword1/animation.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sword1/animation.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -23,7 +23,6 @@
  *
  */
 
-
 #include "common/file.h"
 #include "sword1/sword1.h"
 #include "sword1/animation.h"
@@ -72,6 +71,9 @@
 	_bgSoundStream = NULL;
 	_decoderType = decoderType;
 	_decoder = decoder;
+
+	_white = 255;
+	_black = 0;
 }
 
 MoviePlayer::~MoviePlayer() {
@@ -254,9 +256,35 @@
 			if (frame)
 				_vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
 
-			if (_decoder->hasDirtyPalette())
+			if (_decoder->hasDirtyPalette()) {
 				_decoder->setSystemPalette();
 
+				uint32 maxWeight = 0;
+				uint32 minWeight = 0xFFFFFFFF;
+				uint32 weight;
+				byte r, g, b;
+				
+				byte *palette = _decoder->getPalette();
+
+				for (int i = 0; i < 256; i++) {
+					r = *palette++;
+					g = *palette++;
+					b = *palette++;
+
+					weight = 3 * r * r + 6 * g * g + 2 * b * b;
+
+					if (weight >= maxWeight) {
+						maxWeight = weight;
+						_white = i;
+					}
+
+					if (weight <= minWeight) {
+						minWeight = weight;
+						_black = i;
+					}
+				}
+			}
+
 			Graphics::Surface *screen = _vm->_system->lockScreen();
 			performPostProcessing((byte *)screen->pixels);
 			_vm->_system->unlockScreen();
@@ -267,17 +295,19 @@
 		while (_vm->_system->getEventManager()->pollEvent(event))
 			if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP)
 				return false;
+
+		_vm->_system->delayMillis(10);
 	}
 
 	return !_vm->shouldQuit();
 }
 
 byte MoviePlayer::findBlackPalIndex() {
-	return 0;
+	return _black;
 }
 
 byte MoviePlayer::findWhitePalIndex() {
-	return 0xff;
+	return _white;
 }
 
 DXADecoderWithSound::DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle)

Modified: scummvm/branches/gsoc2010-plugins/engines/sword1/animation.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sword1/animation.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sword1/animation.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -85,6 +85,7 @@
 	OSystem *_system;
 	Common::Array<MovieText *> _movieTexts;
 	int _textX, _textY, _textWidth, _textHeight;
+	byte _white, _black;
 	DecoderType _decoderType;
 
 	Graphics::VideoDecoder *_decoder;

Modified: scummvm/branches/gsoc2010-plugins/engines/sword2/animation.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sword2/animation.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sword2/animation.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -51,6 +51,9 @@
 	_bgSoundStream = NULL;
 	_decoderType = decoderType;
 	_decoder = decoder;
+
+	_white = 255;
+	_black = 0;
 }
 
 MoviePlayer:: ~MoviePlayer() {
@@ -280,9 +283,35 @@
 			if (frame)
 				_vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
 
-			if (_decoder->hasDirtyPalette())
+			if (_decoder->hasDirtyPalette()) {
 				_decoder->setSystemPalette();
 
+				uint32 maxWeight = 0;
+				uint32 minWeight = 0xFFFFFFFF;
+				uint32 weight;
+				byte r, g, b;
+				
+				byte *palette = _decoder->getPalette();
+
+				for (int i = 0; i < 256; i++) {
+					r = *palette++;
+					g = *palette++;
+					b = *palette++;
+
+					weight = 3 * r * r + 6 * g * g + 2 * b * b;
+
+					if (weight >= maxWeight) {
+						maxWeight = weight;
+						_white = i;
+					}
+
+					if (weight <= minWeight) {
+						minWeight = weight;
+						_black = i;
+					}
+				}
+			}
+
 			Graphics::Surface *screen = _vm->_system->lockScreen();
 			performPostProcessing((byte *)screen->pixels);
 			_vm->_system->unlockScreen();
@@ -293,17 +322,19 @@
 		while (_vm->_system->getEventManager()->pollEvent(event))
 			if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP)
 				return false;
+
+		_vm->_system->delayMillis(10);
 	}
 
 	return !_vm->shouldQuit();
 }
 
 byte MoviePlayer::findBlackPalIndex() {
-	return 0;
+	return _black;
 }
 
 byte MoviePlayer::findWhitePalIndex() {
-	return 0xff;
+	return _white;
 }
 
 DXADecoderWithSound::DXADecoderWithSound(Audio::Mixer *mixer, Audio::SoundHandle *bgSoundHandle)

Modified: scummvm/branches/gsoc2010-plugins/engines/sword2/animation.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/sword2/animation.h	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/sword2/animation.h	2010-08-11 01:11:16 UTC (rev 51964)
@@ -87,6 +87,7 @@
 	uint32 _currentMovieText;
 	byte *_textSurface;
 	int _textX, _textY;
+	byte _white, _black;
 	DecoderType _decoderType;
 
 	Graphics::VideoDecoder *_decoder;

Modified: scummvm/branches/gsoc2010-plugins/engines/tinsel/handle.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/engines/tinsel/handle.cpp	2010-08-11 00:54:34 UTC (rev 51963)
+++ scummvm/branches/gsoc2010-plugins/engines/tinsel/handle.cpp	2010-08-11 01:11:16 UTC (rev 51964)
@@ -284,7 +284,8 @@
 	}
 
 	// extract and zero terminate the filename
-	Common::strlcpy(szFilename, pH->szName, sizeof(pH->szName));
+	memcpy(szFilename, pH->szName, sizeof(pH->szName));
+	szFilename[sizeof(pH->szName)] = 0;
 
 	if (f.open(szFilename)) {
 		// read the data


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