[Scummvm-cvs-logs] SF.net SVN: scummvm: [28164] scummvm/branches/gsoc2007-mixer

dogmatixman at users.sourceforge.net dogmatixman at users.sourceforge.net
Sun Jul 22 16:43:54 CEST 2007


Revision: 28164
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28164&view=rev
Author:   dogmatixman
Date:     2007-07-22 07:43:53 -0700 (Sun, 22 Jul 2007)

Log Message:
-----------
Merging trunk changes into the branch (revisions 27823:28163)

Modified Paths:
--------------
    scummvm/branches/gsoc2007-mixer/COPYRIGHT
    scummvm/branches/gsoc2007-mixer/backends/events/default/default-events.cpp
    scummvm/branches/gsoc2007-mixer/backends/platform/PalmOS/Src/be_base.h
    scummvm/branches/gsoc2007-mixer/backends/platform/dc/dc.h
    scummvm/branches/gsoc2007-mixer/backends/platform/dc/display.cpp
    scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/makefile
    scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/source/wordcompletion.cpp
    scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/source/wordcompletion.h
    scummvm/branches/gsoc2007-mixer/backends/platform/gp2x/build/bundle.sh
    scummvm/branches/gsoc2007-mixer/backends/platform/gp2x/build/config.sh
    scummvm/branches/gsoc2007-mixer/backends/platform/wince/Makefile
    scummvm/branches/gsoc2007-mixer/base/main.cpp
    scummvm/branches/gsoc2007-mixer/base/plugins.cpp
    scummvm/branches/gsoc2007-mixer/common/scummsys.h
    scummvm/branches/gsoc2007-mixer/common/system.h
    scummvm/branches/gsoc2007-mixer/configure
    scummvm/branches/gsoc2007-mixer/dists/msvc71/lure.vcproj
    scummvm/branches/gsoc2007-mixer/dists/msvc71/scummvm.sln
    scummvm/branches/gsoc2007-mixer/dists/msvc71/scummvm.vcproj
    scummvm/branches/gsoc2007-mixer/dists/msvc8/scummvm.sln
    scummvm/branches/gsoc2007-mixer/dists/msvc8/scummvm.vcproj
    scummvm/branches/gsoc2007-mixer/engines/agi/agi.cpp
    scummvm/branches/gsoc2007-mixer/engines/agi/agi.h
    scummvm/branches/gsoc2007-mixer/engines/agi/detection.cpp
    scummvm/branches/gsoc2007-mixer/engines/agi/graphics.cpp
    scummvm/branches/gsoc2007-mixer/engines/agi/graphics.h
    scummvm/branches/gsoc2007-mixer/engines/agi/keyboard.cpp
    scummvm/branches/gsoc2007-mixer/engines/agi/menu.cpp
    scummvm/branches/gsoc2007-mixer/engines/agi/predictive.cpp
    scummvm/branches/gsoc2007-mixer/engines/agi/saveload.cpp
    scummvm/branches/gsoc2007-mixer/engines/agi/text.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/agos.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/agos.h
    scummvm/branches/gsoc2007-mixer/engines/agos/gfx.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/input.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/intern.h
    scummvm/branches/gsoc2007-mixer/engines/agos/saveload.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/script_e2.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/script_ww.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/sound.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/string.cpp
    scummvm/branches/gsoc2007-mixer/engines/agos/vga.h
    scummvm/branches/gsoc2007-mixer/engines/cine/various.cpp
    scummvm/branches/gsoc2007-mixer/engines/engine.cpp
    scummvm/branches/gsoc2007-mixer/engines/engines.mk
    scummvm/branches/gsoc2007-mixer/engines/gob/game.h
    scummvm/branches/gsoc2007-mixer/engines/gob/goblin.h
    scummvm/branches/gsoc2007-mixer/engines/gob/imd.h
    scummvm/branches/gsoc2007-mixer/engines/gob/map.h
    scummvm/branches/gsoc2007-mixer/engines/gob/mult.h
    scummvm/branches/gsoc2007-mixer/engines/gob/scenery.h
    scummvm/branches/gsoc2007-mixer/engines/gob/sound.cpp
    scummvm/branches/gsoc2007-mixer/engines/gob/sound.h
    scummvm/branches/gsoc2007-mixer/engines/gob/video.h
    scummvm/branches/gsoc2007-mixer/engines/kyra/detection.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/gui.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/kyra.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/resource.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/scene.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/screen.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/script.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/script.h
    scummvm/branches/gsoc2007-mixer/engines/kyra/script_v1.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/sequences_v1.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/sound.cpp
    scummvm/branches/gsoc2007-mixer/engines/kyra/sound.h
    scummvm/branches/gsoc2007-mixer/engines/kyra/staticres.cpp
    scummvm/branches/gsoc2007-mixer/engines/lure/res_struct.h
    scummvm/branches/gsoc2007-mixer/engines/parallaction/callables.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/defs.h
    scummvm/branches/gsoc2007-mixer/engines/parallaction/dialogue.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/disk.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/disk.h
    scummvm/branches/gsoc2007-mixer/engines/parallaction/graphics.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/graphics.h
    scummvm/branches/gsoc2007-mixer/engines/parallaction/inventory.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/inventory.h
    scummvm/branches/gsoc2007-mixer/engines/parallaction/location.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/menu.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/menu.h
    scummvm/branches/gsoc2007-mixer/engines/parallaction/parallaction.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/parallaction.h
    scummvm/branches/gsoc2007-mixer/engines/parallaction/parser.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/parser.h
    scummvm/branches/gsoc2007-mixer/engines/parallaction/saveload.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/zone.cpp
    scummvm/branches/gsoc2007-mixer/engines/parallaction/zone.h
    scummvm/branches/gsoc2007-mixer/engines/queen/sound.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/actor.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/actor.h
    scummvm/branches/gsoc2007-mixer/engines/saga/animation.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/detection.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/detection_tables.h
    scummvm/branches/gsoc2007-mixer/engines/saga/events.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/gfx.h
    scummvm/branches/gsoc2007-mixer/engines/saga/interface.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/music.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/music.h
    scummvm/branches/gsoc2007-mixer/engines/saga/render.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/render.h
    scummvm/branches/gsoc2007-mixer/engines/saga/rscfile.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/saga.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/saga.h
    scummvm/branches/gsoc2007-mixer/engines/saga/sagaresnames.h
    scummvm/branches/gsoc2007-mixer/engines/saga/script.h
    scummvm/branches/gsoc2007-mixer/engines/saga/sfuncs.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/sndres.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/sound.cpp
    scummvm/branches/gsoc2007-mixer/engines/saga/sprite.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/akos.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/base-costume.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/boxes.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/charset.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/detection.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/detection_tables.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/file.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/gfx.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/he/intern_he.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/he/resource_he.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/imuse/instrument.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/imuse_digi/dimuse.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/imuse_digi/dimuse.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/imuse_digi/dimuse_script.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/imuse_digi/dimuse_sndmgr.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/imuse_digi/dimuse_track.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/input.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/intern.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/module.mk
    scummvm/branches/gsoc2007-mixer/engines/scumm/object.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/player_v2.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/scumm-md5.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/scumm.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/scumm.h
    scummvm/branches/gsoc2007-mixer/engines/scumm/smush/smush_player.cpp
    scummvm/branches/gsoc2007-mixer/engines/scumm/sound.cpp
    scummvm/branches/gsoc2007-mixer/engines/sky/sound.cpp
    scummvm/branches/gsoc2007-mixer/engines/sky/struc.h
    scummvm/branches/gsoc2007-mixer/engines/sword1/mouse.h
    scummvm/branches/gsoc2007-mixer/engines/sword1/music.cpp
    scummvm/branches/gsoc2007-mixer/engines/sword1/object.h
    scummvm/branches/gsoc2007-mixer/engines/sword1/router.h
    scummvm/branches/gsoc2007-mixer/engines/sword1/sound.cpp
    scummvm/branches/gsoc2007-mixer/engines/sword1/sworddefs.h
    scummvm/branches/gsoc2007-mixer/engines/sword2/music.cpp
    scummvm/branches/gsoc2007-mixer/engines/touche/resource.cpp
    scummvm/branches/gsoc2007-mixer/graphics/dxa_player.cpp
    scummvm/branches/gsoc2007-mixer/graphics/dxa_player.h
    scummvm/branches/gsoc2007-mixer/gui/KeysDialog.cpp
    scummvm/branches/gsoc2007-mixer/gui/ListWidget.cpp
    scummvm/branches/gsoc2007-mixer/gui/ListWidget.h
    scummvm/branches/gsoc2007-mixer/gui/launcher.cpp
    scummvm/branches/gsoc2007-mixer/sound/flac.cpp
    scummvm/branches/gsoc2007-mixer/sound/flac.h
    scummvm/branches/gsoc2007-mixer/sound/mixer.cpp
    scummvm/branches/gsoc2007-mixer/sound/mods/module.h
    scummvm/branches/gsoc2007-mixer/sound/mods/paula.cpp
    scummvm/branches/gsoc2007-mixer/sound/mp3.cpp
    scummvm/branches/gsoc2007-mixer/sound/mp3.h
    scummvm/branches/gsoc2007-mixer/sound/voc.h
    scummvm/branches/gsoc2007-mixer/sound/vorbis.cpp
    scummvm/branches/gsoc2007-mixer/sound/vorbis.h
    scummvm/branches/gsoc2007-mixer/test/common/pack.h
    scummvm/branches/gsoc2007-mixer/tools/create_kyradat/create_kyradat.cpp
    scummvm/branches/gsoc2007-mixer/tools/create_kyradat/md5.cpp
    scummvm/branches/gsoc2007-mixer/tools/scumm-md5.txt

Added Paths:
-----------
    scummvm/branches/gsoc2007-mixer/dists/msvc71/drascula.vcproj
    scummvm/branches/gsoc2007-mixer/dists/msvc8/drascula.vcproj
    scummvm/branches/gsoc2007-mixer/engines/drascula/
    scummvm/branches/gsoc2007-mixer/engines/drascula/detection.cpp
    scummvm/branches/gsoc2007-mixer/engines/drascula/drascula.cpp
    scummvm/branches/gsoc2007-mixer/engines/drascula/drascula.h
    scummvm/branches/gsoc2007-mixer/engines/drascula/module.mk
    scummvm/branches/gsoc2007-mixer/engines/scumm/gfxARM.s
    scummvm/branches/gsoc2007-mixer/tools/agi-palex.py

Removed Paths:
-------------
    scummvm/branches/gsoc2007-mixer/engines/drascula/detection.cpp
    scummvm/branches/gsoc2007-mixer/engines/drascula/drascula.cpp
    scummvm/branches/gsoc2007-mixer/engines/drascula/drascula.h
    scummvm/branches/gsoc2007-mixer/engines/drascula/module.mk

Modified: scummvm/branches/gsoc2007-mixer/COPYRIGHT
===================================================================
--- scummvm/branches/gsoc2007-mixer/COPYRIGHT	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/COPYRIGHT	2007-07-22 14:43:53 UTC (rev 28164)
@@ -13,7 +13,7 @@
 Ralph Brorsen
 James Brown
 Stuart Caie
-Filippos Carapetis
+Filippos Karapetis
 Jamieson Christian
 Marcus Comstedt
 Paolo Costabel
@@ -83,7 +83,7 @@
 Elio Blanca "eblanca76"
 David Breakey "dbreakey"
 Robert Buchholz "prendi"
-Filippos Carapetis "thebluegr"
+Filippos Karapetis "thebluegr"
 Mathieu Carot "yokna"
 Stefano Ceccherini "jackburton"
 Travis S Coady "theealien"
@@ -108,6 +108,7 @@
 Matt Hargett "matt_hargett"
 Stefan Haubenthal "polluks"
 Alexander Holler "holler"
+Matthew Hoops "clone2727"
 Falk Hueffner "mellum"
 Casey Hutchinson "nnooiissee"
 Gregor Jasny "gjasny"

Modified: scummvm/branches/gsoc2007-mixer/backends/events/default/default-events.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/events/default/default-events.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/events/default/default-events.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -98,10 +98,12 @@
 
 		case Common::EVENT_QUIT:
 			if (ConfMan.getBool("confirm_exit")) {
-				g_engine->pauseEngine(true);
+				if (g_engine)
+					g_engine->pauseEngine(true);
 				GUI::MessageDialog alert("Do you really want to quit?", "Yes", "No");
 				result = _shouldQuit = (alert.runModal() == GUI::kMessageOK);
-				g_engine->pauseEngine(false);
+				if (g_engine)
+					g_engine->pauseEngine(false);
 			} else
 				_shouldQuit = true;
 			break;

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/PalmOS/Src/be_base.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/PalmOS/Src/be_base.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/PalmOS/Src/be_base.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -196,10 +196,6 @@
 	
 	virtual int16 getOverlayHeight();
 	virtual int16 getOverlayWidth();
-	virtual int screenToOverlayX(int x);
-	virtual int screenToOverlayY(int y);
-	virtual int overlayToScreenX(int x);
-	virtual int overlayToScreenY(int y);
 	
 	virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b);
 	virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b);

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/dc/dc.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/dc/dc.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/dc/dc.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -144,10 +144,6 @@
   // Overlay
   int16 getOverlayHeight();
   int16 getOverlayWidth();
-  int screenToOverlayX(int x);
-  int screenToOverlayY(int y);
-  int overlayToScreenX(int x);
-  int overlayToScreenY(int y);
   void showOverlay();
   void hideOverlay();
   void clearOverlay();

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/dc/display.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/dc/display.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/dc/display.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -645,23 +645,3 @@
   return OVL_W;
 }
 
-int OSystem_Dreamcast::screenToOverlayX(int x)
-{
-  return x - _overlay_x;
-}
-
-int OSystem_Dreamcast::screenToOverlayY(int y)
-{
-  return y - _overlay_y;
-}
-
-int OSystem_Dreamcast::overlayToScreenX(int x)
-{
-  return x + _overlay_x;
-}
-
-int OSystem_Dreamcast::overlayToScreenY(int y)
-{
-  return y + _overlay_y;
-}
-

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/makefile	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/makefile	2007-07-22 14:43:53 UTC (rev 28164)
@@ -41,7 +41,7 @@
 ARM = 1
 
 ifdef DS_BUILD_A
-	DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A
+	DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM
 	LOGO = logoa.bmp
 	DISABLE_HE = 1
 	#DISABLE_SCUMM = 1
@@ -60,6 +60,7 @@
 	DISABLE_TOUCHE = 1
 	DISABLE_PARALLACTION = 1
 	DISABLE_CRUISE = 1
+	USE_ARM_GFX_ASM = 1
 	BUILD=scummvm-A
 endif
 

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/source/wordcompletion.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/source/wordcompletion.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/source/wordcompletion.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -5,8 +5,85 @@
 #ifndef DISABLE_AGI
 
 namespace DS {
+// Default dictionary is about 64Kb, so 128Kb should be enough for future expansion
+#define WORD_BUFFER_SIZE (128 * 1024)
 
-void findWordCompletions(char* input) {
+// Default dictionary has ~8000 words
+#define MAX_WORD_COUNT 16000
+
+char wordBuffer[WORD_BUFFER_SIZE];
+int wordBufferPos = 0;
+
+char* wordBufferPtr[MAX_WORD_COUNT];
+int wordBufferPtrPos = 0;
+
+void addAutoCompleteLine(char* line) {
+
+	while (*line != 0)
+	{
+		char word[32];
+		int length;
+		
+		// Skip the T9-style numbers
+		while (*line != ' ')
+		{
+			line++;
+		}
+		line++;
+
+		do {
+			length = 0;
+
+			if (*line == ' ') line++;
+
+
+			// Copy the new word 
+			do {
+				word[length++] = *line++;
+			} while ((*line != '\0') && (*line != ' ') && (*line != '\n'));
+
+			word[length] = '\0';
+
+
+			// Store a pointer to the start of the word
+			wordBufferPtr[wordBufferPtrPos++] = &wordBuffer[wordBufferPos];
+	
+			// copy the new word into the buffer
+			strcpy(&wordBuffer[wordBufferPos], word);
+			wordBufferPos += strlen(word) + 1;
+		} while (*line == ' ');
+	}
+}
+
+int stringCompare(const void* a, const void* b) {
+	const char** as = (const char **) a;
+	const char** bs = (const char **) b;
+
+	return scumm_stricmp(*as, *bs);
+}
+
+void sortAutoCompleteWordList() {
+	// Sort the whole word list into alphabetical order
+	qsort((void *) wordBufferPtr, wordBufferPtrPos, 4, stringCompare);
+}
+
+// Sends the current available words to the virtual keyboard code for display
+bool findWordCompletions(char* input)
+{
+	char testWord[32];
+	int min = 0;
+	int max = wordBufferPtrPos - 1;
+	char* word;
+	int position;
+	char partialWord[32];
+
+	// Early out if dictionary not loaded
+	if (wordBufferPtrPos == 0)
+		return false;
+
+	OSystem_DS* system = (OSystem_DS *) g_system;
+	system->clearAutoComplete();
+
 	int start = 0;
 	for (int r = strlen(input) - 1; r>0; r--) {
 		if (input[r] == ' ') {
@@ -14,53 +91,90 @@
 			break;
 		}
 	}
+	strcpy(partialWord, &input[start]);
 
-	char word[32];
-	strcpy(word, &input[start]);
+	if (strlen(partialWord) == 0)
+	{
+		return false;
+	}
 
-	int fchr = word[0] - 'a';
-	int len = strlen(word);
+	do {
+		position = min + ((max - min) / 2);
 
-	OSystem_DS* system = (OSystem_DS *) g_system;
-	system->clearAutoComplete();
-	system->setCharactersEntered(strlen(word));
+		// Get the word from the dictonary line
+		word = wordBufferPtr[position];
 
-	if (strlen(word) == 0) {
-		return;
-	}		
+		
 
-	uint8 *wordList = Agi::AgiEngine::getWordsData();
-	uint8 *wordListEnd = Agi::AgiEngine::getWordsData() + Agi::AgiEngine::getWordsDataSize();
+		// Now check to see if the word is before or after the stub we're after
+		int result = scumm_stricmp((const char *) partialWord, (const char *) word);
+		
+		if (result == 0) {
+			// We've found the whole word.  Aren't we good.
+			break;
+		} else if (result > 0) {
+			// We're too early, so change the minimum position
+			min = position + 1;
+		} else if (result < 0) {
+			// We're too early, so change the maximum position
+			max = position - 1;
+		}
 
-	/* Get the offset to the first word beginning with the
-	 * right character
-	 */
-	wordList += READ_BE_UINT16(wordList + 2 * fchr);
+//		consolePrintf("Word: %s, (%d, %d) result: %d\n", word, min, max, result);
 
-	char currentWord[32];
+	} while (max - min > 0);
 
+	position = min;
+	word = wordBufferPtr[position];
+	//consolePrintf("Final word: %s\n", word);
+
 	
-	while (wordList < wordListEnd) {
-		int pos = *wordList++;		// Number of chars to keep from previous word
 
-		if (wordList == wordListEnd)
+	system->setCharactersEntered(strlen(partialWord));
+	
+
+	bool match = true;
+
+
+	for (int r = 0; r < strlen(partialWord); r++) {
+		if (word[r] != partialWord[r]) {
+			match = false;
 			break;
+		}
+	}
 
-		char c;
-		do {
-			c = *wordList++;
-			currentWord[pos++] =  (~c) & 0x7F;
-		} while ((c & 0x80) == 0);		// Top bit indicates end of word
-		currentWord[pos++] = '\0';
+	if (!match) {
+		position++;
+		if (position == wordBufferPtrPos) return false;
+		word = wordBufferPtr[position];
+//		consolePrintf("Final word: %s\n", word);
+	}
 
-		if (!strncmp(currentWord, word, strlen(word))) {
-			system->addAutoComplete(currentWord);
+
+	match = true;
+
+	do {
+
+		for (int r = 0; r < strlen(partialWord); r++) {
+			if (word[r] != partialWord[r]) {
+				match = false;
+				break;
+			}
 		}
+	
+		if (match) {
+			system->addAutoComplete(word);
+		}
 
-		wordList += 2;	// Skip the two byte word id.
+		position++;
+		if (position < wordBufferPtrPos) {
+			word = wordBufferPtr[position];
+		}
 
-	}
+	} while ((match) && (position < wordBufferPtrPos));
 
+	return true;
+
 }
 
 }

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/source/wordcompletion.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/source/wordcompletion.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/ds/arm9/source/wordcompletion.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -3,6 +3,8 @@
 
 namespace DS {
 
-extern void findWordCompletions(char* input);
+extern bool findWordCompletions(char* input);
+extern void addAutoCompleteLine(char* line);
+extern void sortAutoCompleteWordList();
 
 }
\ No newline at end of file

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/gp2x/build/bundle.sh
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/gp2x/build/bundle.sh	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/gp2x/build/bundle.sh	2007-07-22 14:43:53 UTC (rev 28164)
@@ -36,13 +36,14 @@
 echo Building ZIP bundle.
 if [ -f /usr/bin/zip ]
 	then
+		rm ./"gp2xkernel-open2x-`date '+%Y-%m-%d'`.zip"
 		cd "scummvm-gp2x-`date '+%Y-%m-%d'`"
-		zip "../scummvm-gp2x-`date '+%Y-%m-%d'`.zip" * -r -9
+		zip -r -9 "../scummvm-gp2x-`date '+%Y-%m-%d'`.zip" *
 		echo You should have a "scummvm-gp2x-`date '+%Y-%m-%d'`.zip" for the GP2X port ready to go.
-		echo All included files can also be found in ./"scummvm-gp2x-`date '+%Y-%m-%d'`"
+		cd ..
+		rm -R ./"scummvm-gp2x-`date '+%Y-%m-%d'`"
 	else  
 		echo - /usr/bin/zip not found, ZIP bundle not created.
 		echo All included files can also be found in ./"scummvm-gp2x-`date '+%Y-%m-%d'`"
 		echo - Please use you preferred archive tool to bundle these files.
 fi
-

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/gp2x/build/config.sh
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/gp2x/build/config.sh	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/gp2x/build/config.sh	2007-07-22 14:43:53 UTC (rev 28164)
@@ -17,6 +17,6 @@
 
 # Edit the configure line to suit.
 cd ../../../..
-./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-mpeg2 --disable-flac  --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6
+./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac  --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6
 
 echo Generating config for GP2X complete. Check for errors.

Modified: scummvm/branches/gsoc2007-mixer/backends/platform/wince/Makefile
===================================================================
--- scummvm/branches/gsoc2007-mixer/backends/platform/wince/Makefile	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/backends/platform/wince/Makefile	2007-07-22 14:43:53 UTC (rev 28164)
@@ -52,6 +52,7 @@
 #DISABLE_HQ_SCALERS = 1
 USE_ARM_SOUND_ASM = 1
 USE_ARM_SMUSH_ASM = 1
+USE_ARM_GFX_ASM   = 1
 
 
 ########################################################################
@@ -85,10 +86,6 @@
 DEFINES += -DWIN32 
 DEFINES += -D__stdcall= -Dcdecl= -D__cdecl__= -D__cdecl= -Wno-multichar
 
-ifdef WINCE_DEBUG_BUILD
-DEFINES += -DDEBUG -DUSE_WINDBG -g
-endif
-
 INCLUDES := -I$(srcdir) -I. -I$(srcdir)/engines -Imissing/gcc -Ilibs/include -Ilibs/include/sdl -ICEgui -ICEkeys -I$(wince_gcc_root)/include
 
 CFLAGS := -O3 -march=armv4 -mtune=xscale
@@ -98,6 +95,11 @@
 LDFLAGS := -Llibs/lib -L$(wince_gcc_root)/lib
 LIBS := -lSDL
 
+ifdef WINCE_DEBUG_BUILD
+DEFINES += -DDEBUG -DUSE_WINDBG -g
+LDFLAGS += -debug
+endif
+
 ifdef USE_ZLIB
 DEFINES += -DUSE_ZLIB
 LIBS += -lzlib
@@ -129,10 +131,14 @@
 LIBS += -lFLAC
 endif
 
-ifdef USE_ARM_SMUSH
-DEFINES += -DUSE_ARM_SMUSH
+ifdef USE_ARM_SMUSH_ASM
+DEFINES += -DUSE_ARM_SMUSH_ASM
 endif
 
+ifdef USE_ARM_GFX_ASM
+DEFINES += -DUSE_ARM_GFX_ASM
+endif
+
 LIBS += --entry WinMainCRTStartup
 
 ########################################################################

Modified: scummvm/branches/gsoc2007-mixer/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/base/main.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/base/main.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -203,6 +203,9 @@
 	// the command line arugments here
 	Common::enableSpecialDebugLevelList(edebuglevels);
 
+	// Inform backend that the engine is about to be run
+	system.engineInit();
+
 	int result;
 
 	// Init the engine (this might change the screen parameters)
@@ -216,6 +219,9 @@
 		// TODO: Set an error flag, notify user about the problem
 	}
 
+	// Inform backend that the engine finished
+	system.engineDone();
+
 	// We clear all debug levels again even though the engine should do it
 	Common::clearAllSpecialDebugLevels();
 

Modified: scummvm/branches/gsoc2007-mixer/base/plugins.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/base/plugins.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/base/plugins.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -131,6 +131,9 @@
 		#ifndef DISABLE_CRUISE
 		LINK_PLUGIN(CRUISE)
 		#endif
+		#ifndef DISABLE_DRASCULA
+		LINK_PLUGIN(DRASCULA)
+		#endif
 
 		return pl;
 	}

Modified: scummvm/branches/gsoc2007-mixer/common/scummsys.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/common/scummsys.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/common/scummsys.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -313,8 +313,10 @@
 //
 #if defined(__GNUC__)
 	#define NORETURN __attribute__((__noreturn__)) 
+	#define PACKED_STRUCT __attribute__((packed)) 
 	#define GCC_PRINTF(x,y) __attribute__((format(printf, x, y)))
 #else
+	#define PACKED_STRUCT
 	#define GCC_PRINTF(x,y)
 #endif
 

Modified: scummvm/branches/gsoc2007-mixer/common/system.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/common/system.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/common/system.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -73,6 +73,18 @@
 	 */
 	virtual void initBackend() { }
 
+	/**
+	 * Allows the backend to perform engine specific init.
+	 * Called just before the engine is run.
+	 */
+	virtual void engineInit() { }
+
+	/**
+	 * Allows the backend to perform engine specific de-init.
+	 * Called after the engine finishes.
+	 */
+	virtual void engineDone() { }
+
 	/** @name Feature flags */
 	//@{
 
@@ -587,11 +599,6 @@
 	 */
 	virtual int16 getOverlayWidth()   { return getWidth(); }
 
-	virtual int screenToOverlayX(int x) { return x; }
-	virtual int screenToOverlayY(int y) { return y; }
-	virtual int overlayToScreenX(int x) { return x; }
-	virtual int overlayToScreenY(int y) { return y; }
-
 	/**
 	* Convert the given RGB triplet into an OverlayColor. A OverlayColor can
 	 * be 8bit, 16bit or 32bit, depending on the target system. The default

Modified: scummvm/branches/gsoc2007-mixer/configure
===================================================================
--- scummvm/branches/gsoc2007-mixer/configure	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/configure	2007-07-22 14:43:53 UTC (rev 28164)
@@ -63,6 +63,7 @@
 _build_touche=yes
 _build_parallaction=yes
 _build_cruise=no
+_build_drascula=no
 _build_hq_scalers=yes
 _build_scalers=yes
 
@@ -353,6 +354,7 @@
   --disable-agos           don't build the AGOS engine
   --disable-cine           don't build the Cinematique engine evo 1
   --enable-cruise          build the Cruise for a Corpse engine
+  --enable-drascula        build the Drascula: The Vampire Strikes Back engine
   --disable-gob            don't build the Gobli*ns engine
   --disable-kyra           don't build the Legend of Kyrandia engine
   --enable-lure            build the Lure of the Temptress engine
@@ -438,6 +440,7 @@
       --disable-touche)         _build_touche=no ;;
       --disable-parallaction)   _build_parallaction=no ;;
       --enable-cruise)          _build_cruise=yes ;;
+      --enable-drascula)        _build_drascula=yes ;;
       --disable-hq-scalers)     _build_hq_scalers=no ;;
       --disable-scalers)        _build_scalers=no ;;
       --enable-alsa)            _alsa=yes       ;;
@@ -730,6 +733,7 @@
 add_to_config_mk_if_no $_build_touche       'DISABLE_TOUCHE = 1'
 add_to_config_mk_if_no $_build_parallaction 'DISABLE_PARALLACTION = 1'
 add_to_config_mk_if_no $_build_cruise       'DISABLE_CRUISE = 1'
+add_to_config_mk_if_no $_build_drascula     'DISABLE_DRASCULA = 1'
 add_to_config_mk_if_no $_build_hq_scalers   'DISABLE_HQ_SCALERS = 1'
 add_to_config_mk_if_no $_build_scalers      'DISABLE_SCALERS = 1'
 
@@ -1388,6 +1392,9 @@
 if test "$_build_cruise" = yes ; then
 	echo "    Cinematique evo 2"
 fi
+if test "$_build_drascula" = yes ; then
+	echo "    Drascula"
+fi
 
 echo
 

Copied: scummvm/branches/gsoc2007-mixer/dists/msvc71/drascula.vcproj (from rev 28163, scummvm/trunk/dists/msvc71/drascula.vcproj)
===================================================================
--- scummvm/branches/gsoc2007-mixer/dists/msvc71/drascula.vcproj	                        (rev 0)
+++ scummvm/branches/gsoc2007-mixer/dists/msvc71/drascula.vcproj	2007-07-22 14:43:53 UTC (rev 28164)
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="drascula"
+	ProjectGUID="{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="drascula_Debug"
+			IntermediateDirectory="drascula_Debug"
+			ConfigurationType="4"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/wd4201 /wd4512 /wd4511 /wd4100 /wd4121 /wd4310 /wd4706 /wd4127 /wd4189 /wd4702"
+				Optimization="0"
+				AdditionalIncludeDirectories="../..;../../engines"
+				PreprocessorDefinitions="WIN32;_DEBUG;USE_ZLIB;USE_MAD;USE_VORBIS"
+				MinimalRebuild="TRUE"
+				ExceptionHandling="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="TRUE"
+				EnableFunctionLevelLinking="TRUE"
+				ForceConformanceInForLoopScope="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				SuppressStartupBanner="FALSE"
+				DebugInformationFormat="4"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/drascula.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="drascula_Release"
+			IntermediateDirectory="drascula_Release"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="FALSE">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/wd4201 /wd4512 /wd4511 /wd4100 /wd4121 /wd4310 /wd4706 /wd4127 /wd4189 /wd4702"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				OmitFramePointers="TRUE"
+				AdditionalIncludeDirectories="../..;../../engines"
+				PreprocessorDefinitions="WIN32;NDEBUG;USE_ZLIB;USE_MAD;USE_VORBIS"
+				StringPooling="TRUE"
+				ExceptionHandling="TRUE"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="FALSE"
+				EnableFunctionLevelLinking="FALSE"
+				DisableLanguageExtensions="FALSE"
+				ForceConformanceInForLoopScope="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/drascula.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath="..\..\engines\drascula\detection.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\drascula\drascula.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\drascula\drascula.h">
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: scummvm/branches/gsoc2007-mixer/dists/msvc71/lure.vcproj
===================================================================
--- scummvm/branches/gsoc2007-mixer/dists/msvc71/lure.vcproj	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/dists/msvc71/lure.vcproj	2007-07-22 14:43:53 UTC (rev 28164)
@@ -116,18 +116,6 @@
 			RelativePath="..\..\engines\lure\animseq.h">
 		</File>
 		<File
-			RelativePath="..\..\engines\lure\debug-input.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\lure\debug-input.h">
-		</File>
-		<File
-			RelativePath="..\..\engines\lure\debug-methods.cpp">
-		</File>
-		<File
-			RelativePath="..\..\engines\lure\debug-methods.h">
-		</File>
-		<File
 			RelativePath="..\..\engines\lure\debugger.cpp">
 		</File>
 		<File
@@ -155,6 +143,12 @@
 			RelativePath="..\..\engines\lure\events.h">
 		</File>
 		<File
+			RelativePath="..\..\engines\lure\fights.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\lure\fights.h">
+		</File>
+		<File
 			RelativePath="..\..\engines\lure\game.cpp">
 		</File>
 		<File
@@ -230,6 +224,12 @@
 			RelativePath="..\..\engines\lure\scripts.h">
 		</File>
 		<File
+			RelativePath="..\..\engines\lure\sound.cpp">
+		</File>
+		<File
+			RelativePath="..\..\engines\lure\sound.h">
+		</File>
+		<File
 			RelativePath="..\..\engines\lure\strings.cpp">
 		</File>
 		<File

Modified: scummvm/branches/gsoc2007-mixer/dists/msvc71/scummvm.sln
===================================================================
--- scummvm/branches/gsoc2007-mixer/dists/msvc71/scummvm.sln	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/dists/msvc71/scummvm.sln	2007-07-22 14:43:53 UTC (rev 28164)
@@ -15,6 +15,7 @@
 		{0068957B-E2E1-4988-8C87-D541D84DAF20} = {0068957B-E2E1-4988-8C87-D541D84DAF20}
 		{9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC} = {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}
 		{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E} = {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3} = {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}
 		{15DF71E6-ECA9-45ED-8049-1CD7C987CCFE} = {15DF71E6-ECA9-45ED-8049-1CD7C987CCFE}
 	EndProjectSection
 EndProject
@@ -78,6 +79,10 @@
 	ProjectSection(ProjectDependencies) = postProject
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drascula", "drascula.vcproj", "{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfiguration) = preSolution
 		Debug = Debug
@@ -150,6 +155,10 @@
 		{CD9AEE36-CEBD-40CE-A6B3-B71523AB8DEC}.Debug.Build.0 = Debug|Win32
 		{CD9AEE36-CEBD-40CE-A6B3-B71523AB8DEC}.Release.ActiveCfg = Release|Win32
 		{CD9AEE36-CEBD-40CE-A6B3-B71523AB8DEC}.Release.Build.0 = Release|Win32
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Debug.ActiveCfg = Debug|Win32
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Debug.Build.0 = Debug|Win32
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Release.ActiveCfg = Release|Win32
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Release.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 	EndGlobalSection

Modified: scummvm/branches/gsoc2007-mixer/dists/msvc71/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2007-mixer/dists/msvc71/scummvm.vcproj	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/dists/msvc71/scummvm.vcproj	2007-07-22 14:43:53 UTC (rev 28164)
@@ -45,6 +45,7 @@
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/scummvm.pdb"
 				SubSystem="1"
+				EntryPointSymbol="WinMainCRTStartup"
 				TargetMachine="1"/>
 			<Tool
 				Name="VCMIDLTool"/>
@@ -106,6 +107,7 @@
 				SubSystem="1"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
+				EntryPointSymbol="WinMainCRTStartup"
 				TargetMachine="1"/>
 			<Tool
 				Name="VCMIDLTool"/>
@@ -209,6 +211,9 @@
 				RelativePath="..\..\common\file.h">
 			</File>
 			<File
+				RelativePath="..\..\common\frac.h">
+			</File>
+			<File
 				RelativePath="..\..\common\fs.cpp">
 			</File>
 			<File
@@ -230,6 +235,9 @@
 				RelativePath="..\..\common\iff_container.h">
 			</File>
 			<File
+				RelativePath="..\..\common\keyboard.h">
+			</File>
+			<File
 				RelativePath="..\..\common\list.h">
 			</File>
 			<File

Copied: scummvm/branches/gsoc2007-mixer/dists/msvc8/drascula.vcproj (from rev 28163, scummvm/trunk/dists/msvc8/drascula.vcproj)
===================================================================
--- scummvm/branches/gsoc2007-mixer/dists/msvc8/drascula.vcproj	                        (rev 0)
+++ scummvm/branches/gsoc2007-mixer/dists/msvc8/drascula.vcproj	2007-07-22 14:43:53 UTC (rev 28164)
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="drascula"
+	ProjectGUID="{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}"
+	RootNamespace="drascula"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="drascula_Debug"
+			IntermediateDirectory="drascula_Debug"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/wd4201 /wd4512 /wd4511 /wd4100 /wd4121 /wd4310 /wd4706 /wd4127 /wd4189 /wd4702 /wd4996"
+				Optimization="0"
+				AdditionalIncludeDirectories="../..;../../engines"
+				PreprocessorDefinitions="WIN32;_DEBUG;USE_ZLIB;USE_MAD;USE_VORBIS"
+				MinimalRebuild="true"
+				ExceptionHandling="1"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				BufferSecurityCheck="true"
+				EnableFunctionLevelLinking="true"
+				ForceConformanceInForLoopScope="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="false"
+				SuppressStartupBanner="false"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/drascula.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="drascula_Release"
+			IntermediateDirectory="drascula_Release"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/wd4201 /wd4512 /wd4511 /wd4100 /wd4121 /wd4310 /wd4706 /wd4127 /wd4189 /wd4702 /wd4996"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				OmitFramePointers="true"
+				AdditionalIncludeDirectories="../../;../../engines"
+				PreprocessorDefinitions="WIN32;NDEBUG;USE_ZLIB;USE_MAD;USE_VORBIS"
+				StringPooling="true"
+				ExceptionHandling="1"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="false"
+				ForceConformanceInForLoopScope="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				WarnAsError="true"
+				DebugInformationFormat="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/drascula.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath="..\..\engines\drascula\detection.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\drascula\drascula.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\..\engines\drascula\drascula.h"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: scummvm/branches/gsoc2007-mixer/dists/msvc8/scummvm.sln
===================================================================
--- scummvm/branches/gsoc2007-mixer/dists/msvc8/scummvm.sln	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/dists/msvc8/scummvm.sln	2007-07-22 14:43:53 UTC (rev 28164)
@@ -3,20 +3,21 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scummvm", "scummvm.vcproj", "{8434CB15-D08F-427D-9E6D-581AE5B28440}"
 	ProjectSection(ProjectDependencies) = postProject
 		{6CC3E421-779D-4E80-8100-520886A0F9FF} = {6CC3E421-779D-4E80-8100-520886A0F9FF}
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3} = {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}
+		{C8AAE83E-198B-4ECA-A877-166827953979} = {C8AAE83E-198B-4ECA-A877-166827953979}
+		{B6AFD548-63D2-40CD-A652-E87095AFCBAF} = {B6AFD548-63D2-40CD-A652-E87095AFCBAF}
+		{1CA4AC50-5426-433A-8B5E-FFE39568098E} = {1CA4AC50-5426-433A-8B5E-FFE39568098E}
+		{D4986356-D0BB-4981-924A-854157BDF11F} = {D4986356-D0BB-4981-924A-854157BDF11F}
+		{B5527758-2F51-4CCD-AAE1-B0E28654BD6A} = {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}
+		{6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7} = {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}
+		{F5F57066-CDF4-4F80-B9E7-7F4D21850D6E} = {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}
+		{E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA} = {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}
+		{976D947A-A45F-4437-991E-412F695C64C7} = {976D947A-A45F-4437-991E-412F695C64C7}
+		{9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC} = {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}
+		{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E} = {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}
+		{8863B00B-059A-471E-876D-A955ECEFD0D2} = {8863B00B-059A-471E-876D-A955ECEFD0D2}
+		{0068957B-E2E1-4988-8C87-D541D84DAF20} = {0068957B-E2E1-4988-8C87-D541D84DAF20}
 		{1A1CA028-61B5-4A6C-A918-F5D8721AB1AC} = {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}
-		{0068957B-E2E1-4988-8C87-D541D84DAF20} = {0068957B-E2E1-4988-8C87-D541D84DAF20}
-		{8863B00B-059A-471E-876D-A955ECEFD0D2} = {8863B00B-059A-471E-876D-A955ECEFD0D2}
-		{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E} = {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}
-		{9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC} = {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}
-		{976D947A-A45F-4437-991E-412F695C64C7} = {976D947A-A45F-4437-991E-412F695C64C7}
-		{E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA} = {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}
-		{F5F57066-CDF4-4F80-B9E7-7F4D21850D6E} = {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}
-		{6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7} = {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}
-		{B5527758-2F51-4CCD-AAE1-B0E28654BD6A} = {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}
-		{D4986356-D0BB-4981-924A-854157BDF11F} = {D4986356-D0BB-4981-924A-854157BDF11F}
-		{1CA4AC50-5426-433A-8B5E-FFE39568098E} = {1CA4AC50-5426-433A-8B5E-FFE39568098E}
-		{B6AFD548-63D2-40CD-A652-E87095AFCBAF} = {B6AFD548-63D2-40CD-A652-E87095AFCBAF}
-		{C8AAE83E-198B-4ECA-A877-166827953979} = {C8AAE83E-198B-4ECA-A877-166827953979}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sword2", "sword2.vcproj", "{6CC3E421-779D-4E80-8100-520886A0F9FF}"
@@ -49,6 +50,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cruise", "cruise.vcproj", "{8863B00B-059A-471E-876D-A955ECEFD0D2}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drascula", "drascula.vcproj", "{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -119,6 +122,10 @@
 		{8863B00B-059A-471E-876D-A955ECEFD0D2}.Debug|Win32.Build.0 = Debug|Win32
 		{8863B00B-059A-471E-876D-A955ECEFD0D2}.Release|Win32.ActiveCfg = Release|Win32
 		{8863B00B-059A-471E-876D-A955ECEFD0D2}.Release|Win32.Build.0 = Release|Win32
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Debug|Win32.Build.0 = Debug|Win32
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Release|Win32.ActiveCfg = Release|Win32
+		{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Modified: scummvm/branches/gsoc2007-mixer/dists/msvc8/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2007-mixer/dists/msvc8/scummvm.vcproj	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/dists/msvc8/scummvm.vcproj	2007-07-22 14:43:53 UTC (rev 28164)
@@ -68,7 +68,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib sdl.lib zlib.lib libmad.lib vorbisfile_static.lib vorbis_static.lib ogg_static.lib libmpeg2.lib sword1_debug/sword1.lib sword2_debug/sword2.lib lure_debug/lure.lib cine_debug/cine.lib cruise_debug/cruise.lib kyra_debug/kyra.lib gob_debug/gob.lib queen_debug/queen.lib saga_debug/saga.lib agi_debug/agi.lib scumm_debug/scumm.lib agos_debug/agos.lib sky_debug/sky.lib parallaction_debug/parallaction.lib"
+				AdditionalDependencies="winmm.lib sdl.lib zlib.lib libmad.lib vorbisfile_static.lib vorbis_static.lib ogg_static.lib libmpeg2.lib sword1_debug/sword1.lib sword2_debug/sword2.lib lure_debug/lure.lib cine_debug/cine.lib cruise_debug/cruise.lib kyra_debug/kyra.lib gob_debug/gob.lib queen_debug/queen.lib saga_debug/saga.lib agi_debug/agi.lib scumm_debug/scumm.lib agos_debug/agos.lib drascula_debug/drascula.lib sky_debug/sky.lib parallaction_debug/parallaction.lib"
 				OutputFile="$(OutDir)/scummvm.exe"
 				LinkIncremental="2"
 				IgnoreDefaultLibraryNames="libc.lib;libcmt.lib"
@@ -158,7 +158,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="winmm.lib sdl.lib zlib.lib libmad.lib vorbisfile_static.lib vorbis_static.lib ogg_static.lib libmpeg2.lib saga_release/saga.lib agi_release/agi.lib sword1_release/sword1.lib sword2_release/sword2.lib lure_release/lure.lib cine_release/cine.lib cruise_release/cruise.lib kyra_release/kyra.lib gob_release/gob.lib queen_release/queen.lib scumm_release/scumm.lib agos_release/agos.lib sky_release/sky.lib parallaction_release/parallaction.lib"
+				AdditionalDependencies="winmm.lib sdl.lib zlib.lib libmad.lib vorbisfile_static.lib vorbis_static.lib ogg_static.lib libmpeg2.lib saga_release/saga.lib agi_release/agi.lib sword1_release/sword1.lib sword2_release/sword2.lib lure_release/lure.lib cine_release/cine.lib cruise_release/cruise.lib kyra_release/kyra.lib gob_release/gob.lib queen_release/queen.lib scumm_release/scumm.lib agos_release/agos.lib sky_release/sky.lib drascula_release/drascula.lib parallaction_release/parallaction.lib"
 				OutputFile="$(OutDir)/scummvm.exe"
 				LinkIncremental="1"
 				SuppressStartupBanner="true"

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/agi.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/agi.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/agi.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -178,7 +178,7 @@
 			case Common::KEYCODE_MINUS:
 				key = '-';
 				break;
-			case Common::KEYCODE_9:
+			case Common::KEYCODE_TAB:
 				key = 0x0009;
 				break;
 			case Common::KEYCODE_F1:
@@ -448,6 +448,12 @@
 		loadGame(saveNameBuffer, false); // Do not check game id
 	}
 
+#ifdef __DS__
+	// Normally, the engine loads the predictive text dictionary when the predictive dialog
+	// is shown.  On the DS version, the word completion feature needs the dictionary too.
+	loadDict();
+#endif
+
 	return ec;
 }
 
@@ -535,6 +541,67 @@
 	{NULL, NULL, 0, 0, NULL}
 };
 
+AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, bool positive) const {
+	if (_amigaStyle) {
+		if (positive) {
+			if (pressed) { // Positive pressed Amiga-style button
+				if (_olderAgi) {
+					return AgiTextColor(amigaBlack, amigaOrange);
+				} else {
+					return AgiTextColor(amigaBlack, amigaPurple);
+				}
+			} else { // Positive unpressed Amiga-style button
+				return AgiTextColor(amigaWhite, amigaGreen);
+			}
+		} else { // _amigaStyle && !positive
+			if (pressed) { // Negative pressed Amiga-style button
+				return AgiTextColor(amigaBlack, amigaCyan);
+			} else { // Negative unpressed Amiga-style button
+				return AgiTextColor(amigaWhite, amigaRed);
+			}
+		}
+	} else { // PC-style button
+		if (hasFocus || pressed) { // A pressed or in focus PC-style button
+			return AgiTextColor(pcWhite, pcBlack);
+		} else { // An unpressed PC-style button without focus
+			return AgiTextColor(pcBlack, pcWhite);
+		}
+	}
+}
+
+AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, int baseFgColor, int baseBgColor) const {
+	return getColor(hasFocus, pressed, AgiTextColor(baseFgColor, baseBgColor));
+}
+
+AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, const AgiTextColor &baseColor) const {
+	if (hasFocus || pressed)
+		return baseColor.swap();
+	else
+		return baseColor;
+}
+
+int AgiButtonStyle::getTextOffset(bool hasFocus, bool pressed) const {
+	return (pressed && !_amigaStyle) ? 1 : 0;
+}
+
+bool AgiButtonStyle::getBorder(bool hasFocus, bool pressed) const {
+	return _amigaStyle && !_authenticAmiga && (hasFocus || pressed);
+}
+
+void AgiButtonStyle::setAmigaStyle(bool amigaStyle, bool olderAgi, bool authenticAmiga) {
+	_amigaStyle		= amigaStyle;
+	_olderAgi		= olderAgi;
+	_authenticAmiga	= authenticAmiga;
+}
+
+void AgiButtonStyle::setPcStyle(bool pcStyle) {
+	setAmigaStyle(!pcStyle);
+}
+
+AgiButtonStyle::AgiButtonStyle(Common::RenderMode renderMode) {
+	setAmigaStyle(renderMode == Common::kRenderAmiga);
+}
+
 AgiEngine::AgiEngine(OSystem *syst) : Engine(syst) {
 
 	// Setup mixer
@@ -635,6 +702,8 @@
 		}
 	}
 
+	_buttonStyle = AgiButtonStyle(_renderMode);
+	_defaultButtonStyle = AgiButtonStyle();
 	_console = new Console(this);
 	_gfx = new GfxMgr(this);
 	_sound = new SoundMgr(this, _mixer);
@@ -676,6 +745,13 @@
 }
 
 AgiEngine::~AgiEngine() {
+	// If the engine hasn't been initialized yet via AgiEngine::initialize(), don't attempt to free any resources,
+	// as they haven't been allocated. Fixes bug #1742432 - AGI: Engine crashes if no game is detected
+	if (_game.state == STATE_INIT) {
+		delete _rnd;	// delete _rnd, as it is allocated in the constructor, not in initialize()
+		return;
+	}
+
 	agiDeinit();
 	_sound->deinitSound();
 	delete _sound;

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/agi.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/agi.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/agi.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -81,6 +81,7 @@
 #define	MSG_BOX_COLOUR	0x0f	/* White */
 #define MSG_BOX_TEXT	0x00	/* Black */
 #define MSG_BOX_LINE	0x04	/* Red */
+#define BUTTON_BORDER	0x00	/* Black */
 #define STATUS_FG	0x00		/* Black */
 #define	STATUS_BG	0x0f		/* White */
 
@@ -110,7 +111,9 @@
 	GF_AGI256_2 =    (1 << 3),
 	GF_AGIPAL =      (1 << 4),
 	GF_MACGOLDRUSH = (1 << 5),
-	GF_FANMADE =     (1 << 6)
+	GF_FANMADE =     (1 << 6),
+	GF_MENUS =		 (1 << 7),
+	GF_ESCPAUSE =	 (1 << 8)
 };
 
 enum AgiGameID {
@@ -317,6 +320,118 @@
 	uint8 *buffer;		/* used for window background */
 };
 
+/** AGI text color (Background and foreground color). */
+struct AgiTextColor {
+	/** Creates an AGI text color. Uses black text on white background by default. */
+	AgiTextColor(int fgColor = 0x00, int bgColor = 0x0F) : fg(fgColor), bg(bgColor) {}
+
+	/** Get an AGI text color with swapped foreground and background color. */
+	AgiTextColor swap() const { return AgiTextColor(bg, fg); }
+
+	int fg; ///< Foreground color (Used for text).
+	int bg; ///< Background color (Used for text's background).
+};
+
+/**
+ * AGI button style (Amiga or PC).
+ *
+ * Supports positive and negative button types (Used with Amiga-style only):
+ * Positive buttons do what the dialog was opened for.
+ * Negative buttons cancel what the dialog was opened for.
+ * Restart-dialog example: Restart-button is positive, Cancel-button negative.
+ * Paused-dialog example: Continue-button is positive.
+ */
+struct AgiButtonStyle {
+// Public constants etc
+public:
+	static const int
+		// Amiga colors (Indexes into the Amiga-ish palette)
+		amigaBlack  = 0x00, ///< Accurate,                   is          #000000 (24-bit RGB)
+		amigaWhite  = 0x0F, ///< Practically accurate,       is close to #FFFFFF (24-bit RGB)
+		amigaGreen  = 0x02, ///< Quite accurate,             should be   #008A00 (24-bit RGB)
+		amigaOrange = 0x0C, ///< Inaccurate, too much blue,  should be   #FF7500 (24-bit RGB) 
+		amigaPurple = 0x0D, ///< Inaccurate, too much green, should be   #FF00FF (24-bit RGB)
+		amigaRed    = 0x04, ///< Quite accurate,             should be   #BD0000 (24-bit RGB)
+		amigaCyan   = 0x0B, ///< Inaccurate, too much red,   should be   #00FFDE (24-bit RGB)
+		// PC colors (Indexes into the EGA-palette)
+		pcBlack     = 0x00,
+		pcWhite     = 0x0F;
+
+// Public methods
+public:
+	/**
+	 * Get the color of the button with the given state and type using current style.
+	 *
+	 * @param hasFocus True if button has focus, false otherwise.
+	 * @param pressed True if button is being pressed, false otherwise.
+	 * @param positive True if button is positive, false if button is negative. Only matters for Amiga-style buttons.
+	 */
+	AgiTextColor getColor(bool hasFocus, bool pressed, bool positive = true) const;
+
+	/**
+	 * Get the color of a button with the given base color and state ignoring current style.
+	 * Swaps foreground and background color when the button has focus or is being pressed.
+	 *
+	 * @param hasFocus True if button has focus, false otherwise.
+	 * @param pressed True if button is being pressed, false otherwise.
+	 * @param baseFgColor Foreground color of the button when it has no focus and is not being pressed.
+	 * @param baseBgColor Background color of the button when it has no focus and is not being pressed.
+	 */
+	AgiTextColor getColor(bool hasFocus, bool pressed, int baseFgColor, int baseBgColor) const;
+
+	/**
+	 * Get the color of a button with the given base color and state ignoring current style.
+	 * Swaps foreground and background color when the button has focus or is being pressed.
+	 *
+	 * @param hasFocus True if button has focus, false otherwise.
+	 * @param pressed True if button is being pressed, false otherwise.
+	 * @param baseColor Color of the button when it has no focus and is not being pressed.
+	 */
+	AgiTextColor getColor(bool hasFocus, bool pressed, const AgiTextColor &baseColor) const;
+
+	/**
+	 * How many pixels to offset the shown text diagonally down and to the right.
+	 * Currently only used for pressed PC-style buttons.
+	 */
+	int getTextOffset(bool hasFocus, bool pressed) const;
+
+	/**
+	 * Show border around the button?
+	 * Currently border is only used for in focus or pressed Amiga-style buttons
+	 * when in inauthentic Amiga-style mode.
+	 */
+	bool getBorder(bool hasFocus, bool pressed) const;
+
+	/**
+	 * Set Amiga-button style.
+	 *
+	 * @param amigaStyle Set Amiga-button style if true, otherwise set PC-button style.
+	 * @param olderAgi If true then use older AGI style in Amiga-mode, otherwise use newer.
+	 * @param authenticAmiga If true then don't use a border around buttons in Amiga-mode, otherwise use.
+	 */
+	void setAmigaStyle(bool amigaStyle = true, bool olderAgi = false, bool authenticAmiga = false);
+
+	/**
+	 * Set PC-button style.
+	 * @param pcStyle Set PC-button style if true, otherwise set default Amiga-button style.
+	 */
+	void setPcStyle(bool pcStyle = true);
+
+// Public constructors
+public:
+	/**
+	 * Create a button style based on the given rendering mode.
+	 * @param renderMode If Common::kRenderAmiga then creates default Amiga-button style, otherwise PC-style.
+	 */
+	AgiButtonStyle(Common::RenderMode renderMode = Common::kRenderDefault);
+
+// Private member variables
+private:
+	bool _amigaStyle;     ///< Use Amiga-style buttons if true, otherwise use PC-style buttons.
+	bool _olderAgi;       ///< Use older AGI style in Amiga-style mode.
+	bool _authenticAmiga; ///< Don't use border around buttons in Amiga-style mode.
+};
+
 #define EGO_VIEW_TABLE	0
 #define	HORIZON		36
 #define _WIDTH		160
@@ -594,6 +709,8 @@
 	int _oldMode;
 
 	Menu* _menu;
+	AgiButtonStyle _buttonStyle;
+	AgiButtonStyle _defaultButtonStyle;
 
 	char _lastSentence[40];
 

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/detection.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/detection.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/detection.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -125,7 +125,7 @@
 
 
 	{
-		// Sarien Name == AGI Demo 1 (PC) 05/87 [AGI 2.425]
+		// AGI Demo 1 (PC) 05/87 [AGI 2.425]
 		{
 			"agidemo",
 			"Demo 1 1987-05-20",
@@ -142,7 +142,7 @@
 
 
 	{
-		// Sarien Name == AGI Demo 2 (IIgs) 1.0C (Censored)
+		// AGI Demo 2 (IIgs) 1.0C (Censored)
 		{
 			"agidemo",
 			"Demo 2 1987-11-24 1.0C",
@@ -159,7 +159,7 @@
 
 
 	{
-		// Sarien Name == AGI Demo 2 (PC 3.5") 11/87 [AGI 2.915]
+		// AGI Demo 2 (PC 3.5") 11/87 [AGI 2.915]
 		{
 			"agidemo",
 			"Demo 2 1987-11-24 3.5\"",
@@ -176,7 +176,7 @@
 
 
 	{
-		// Sarien Name == AGI Demo 2 (PC 5.25") 11/87 [v1] [AGI 2.915]
+		// AGI Demo 2 (PC 5.25") 11/87 [v1] [AGI 2.915]
 		{
 			"agidemo",
 			"Demo 2 1987-11-24 [version 1] 5.25\"",
@@ -193,7 +193,7 @@
 
 
 	{
-		// Sarien Name == AGI Demo 2 (PC 5.25") 01/88 [v2] [AGI 2.917]
+		// AGI Demo 2 (PC 5.25") 01/88 [v2] [AGI 2.917]
 		{
 			"agidemo",
 			"Demo 2 1988-01-25 [version 2] 5.25\"",
@@ -210,7 +210,7 @@
 
 
 	{
-		// Sarien Name == AGI Demo 3 (PC) 09/88 [AGI 3.002.102]
+		// AGI Demo 3 (PC) 09/88 [AGI 3.002.102]
 		{
 			"agidemo",
 			"Demo 3 1988-09-13",
@@ -227,7 +227,7 @@
 
 
 	{
-		// Sarien Name == Black Cauldron (Amiga) 2.00 6/14/87
+		// Black Cauldron (Amiga) 2.00 6/14/87
 		{
 			"bc",
 			"2.00 1987-06-14",
@@ -244,7 +244,8 @@
 
 
 	{
-		// Sarien Name == Black Cauldron (Apple IIgs) 1.0O 2/24/89 (CE)
+		// Black Cauldron (Apple IIgs) 1.0O 2/24/89 (CE)
+		// Menus not tested
 		{
 			"bc",
 			"1.0O 1989-02-24 (CE)",
@@ -261,7 +262,7 @@
 
 
 	{
-		// Sarien Name == Black Cauldron (PC) 2.00 6/14/87 [AGI 2.439]
+		// Black Cauldron (PC) 2.00 6/14/87 [AGI 2.439]
 		{
 			"bc",
 			"2.00 1987-06-14",
@@ -278,7 +279,7 @@
 
 
 	{
-		// Sarien Name == Black Cauldron (PC 5.25") 2.10 11/10/88 [AGI 3.002.098]
+		// Black Cauldron (PC 5.25") 2.10 11/10/88 [AGI 3.002.098]
 		{
 			"bc",
 			"2.10 1988-11-10 5.25\"",
@@ -297,7 +298,8 @@
 // These aren't supposed to work now as they require unsupported agi engine 2.01
 #if 0
 	{
-		// Sarien Name == Donald Duck's Playground (Amiga) 1.0C
+		// Donald Duck's Playground (Amiga) 1.0C
+		// Menus not tested
 		{
 			"ddp",
 			"1.0C 1987-04-27",
@@ -314,7 +316,8 @@
 
 
 	{
-		// Sarien Name == Donald Duck's Playground (ST) 1.0A 8/8/86
+		// Donald Duck's Playground (ST) 1.0A 8/8/86
+		// Menus not tested
 		{
 			"ddp",
 			"1.0A 1986-08-08",
@@ -332,6 +335,7 @@
 
 	{
 		// reported by Filippos (thebluegr) in bugreport #1654500
+		// Menus not tested
 		{
 			"ddp",
 			"1.0C 1986-06-09",   // verify date
@@ -348,7 +352,7 @@
 #endif
 
 	{
-		// Sarien Name == Gold Rush! (Amiga) 1.01 1/13/89 aka 2.05 3/9/89	# 2.316
+		// Gold Rush! (Amiga) 1.01 1/13/89 aka 2.05 3/9/89	# 2.316
 		{
 			"goldrush",
 			"1.01 1989-01-13 aka 2.05 1989-03-09",
@@ -365,7 +369,8 @@
 
 
 	{
-		// Sarien Name == Gold Rush! (Apple IIgs) 1.0M 2/28/89 (CE) aka 2.01 12/22/88
+		// Gold Rush! (Apple IIgs) 1.0M 2/28/89 (CE) aka 2.01 12/22/88
+		// Menus not tested
 		{
 			"goldrush",
 			"1.0M 1989-02-28 (CE) aka 2.01 1988-12-22",
@@ -382,7 +387,7 @@
 
 
 	{
-		// Sarien Name == Gold Rush! (ST) 1.01 1/13/89 aka 2.01 12/22/88
+		// Gold Rush! (ST) 1.01 1/13/89 aka 2.01 12/22/88
 		{
 			"goldrush",
 			"1.01 1989-01-13 aka 2.01 1988-12-22",
@@ -399,7 +404,7 @@
 
 
 	{
-		// Sarien Name == Gold Rush! (PC 5.25") 2.01 12/22/88 [AGI 3.002.149]
+		// Gold Rush! (PC 5.25") 2.01 12/22/88 [AGI 3.002.149]
 		{
 			"goldrush",
 			"2.01 1988-12-22 5.25\"",
@@ -416,7 +421,7 @@
 
 
 	{
-		// Sarien Name == Gold Rush! (PC 3.5") 2.01 12/22/88 [AGI 3.002.149]
+		// Gold Rush! (PC 3.5") 2.01 12/22/88 [AGI 3.002.149]
 		{
 			"goldrush",
 			"2.01 1988-12-22 3.5\"",
@@ -433,7 +438,7 @@
 
 
 	{
-		// Sarien Name == Gold Rush! (PC 5.25") 2.01 12/22/88 [AGI 3.002.149]
+		// Gold Rush! (PC 5.25") 2.01 12/22/88 [AGI 3.002.149]
 		{
 			"goldrush",
 			"2.01 1988-12-22",
@@ -454,7 +459,8 @@
 
 
 	{
-		// Sarien Name == King's Quest 1 (Amiga) 1.0U		# 2.082
+		// King's Quest 1 (Amiga) 1.0U		# 2.082
+		// The original game did not have menus, they are enabled under ScummVM
 		{
 			"kq1",
 			"1.0U 1986",
@@ -465,13 +471,14 @@
 		},
 		GID_KQ1,
 		GType_V2,
-		0,
+		GF_MENUS,
 		0x2440,
 	},
 
 
 	{
-		// Sarien Name == King's Quest 1 (ST) 1.0V
+		// King's Quest 1 (ST) 1.0V
+		// The original game did not have menus, they are enabled under ScummVM
 		{
 			"kq1",
 			"1.0V 1986",
@@ -482,13 +489,14 @@
 		},
 		GID_KQ1,
 		GType_V2,
-		0,
+		GF_MENUS,
 		0x2272,
 	},
 
 
 	{
-		// Sarien Name == King's Quest 1 (IIgs) 1.0S-88223
+		// King's Quest 1 (IIgs) 1.0S-88223
+		// Menus not tested
 		{
 			"kq1",
 			"1.0S 1988-02-23",
@@ -505,7 +513,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 1 (Mac) 2.0C
+		// King's Quest 1 (Mac) 2.0C
 		{
 			"kq1",
 			"2.0C 1987-03-26",
@@ -522,7 +530,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 1 (PC 5.25"/3.5") 2.0F [AGI 2.917]
+		// King's Quest 1 (PC 5.25"/3.5") 2.0F [AGI 2.917]
 		{
 			"kq1",
 			"2.0F 1987-05-05 5.25\"/3.5\"",
@@ -539,7 +547,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 2 (IIgs) 2.0A 6/16/88 (CE)
+		// King's Quest 2 (IIgs) 2.0A 6/16/88 (CE)
 		{
 			"kq2",
 			"2.0A 1988-06-16 (CE)",
@@ -556,7 +564,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 2 (Amiga) 2.0J (Broken)
+		// King's Quest 2 (Amiga) 2.0J (Broken)
 		{
 			"kq2",
 			"2.0J 1987-01-29 [OBJECT decrypted]",
@@ -573,7 +581,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 2 (Mac) 2.0R
+		// King's Quest 2 (Mac) 2.0R
 		{
 			"kq2",
 			"2.0R 1988-03-23",
@@ -607,7 +615,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 2 (PC 5.25"/3.5") 2.2 [AGI 2.426]
+		// King's Quest 2 (PC 5.25"/3.5") 2.2 [AGI 2.426]
 		{
 			"kq2",
 			"2.2 1987-05-07 5.25\"/3.5\"",
@@ -624,7 +632,8 @@
 
 
 	{
-		// Sarien Name == King's Quest 3 (Amiga) 1.01 11/8/86
+		// King's Quest 3 (Amiga) 1.01 11/8/86
+		// The original game did not have menus, they are enabled under ScummVM
 		{
 			"kq3",
 			"1.01 1986-11-08",
@@ -635,13 +644,14 @@
 		},
 		GID_KQ3,
 		GType_V2,
-		0,
+		GF_MENUS,
 		0x2440,
 	},
 
 
 	{
-		// Sarien Name == King's Quest 3 (ST) 1.02 11/18/86
+		// King's Quest 3 (ST) 1.02 11/18/86
+		// Does not have menus, crashes if menus are enforced. Therefore, ESC pauses the game
 		{
 			"kq3",
 			"1.02 1986-11-18",
@@ -652,13 +662,13 @@
 		},
 		GID_KQ3,
 		GType_V2,
-		0,
+		GF_ESCPAUSE,
 		0x2272,
 	},
 
 
 	{
-		// Sarien Name == King's Quest 3 (Mac) 2.14 3/15/88
+		// King's Quest 3 (Mac) 2.14 3/15/88
 		{
 			"kq3",
 			"2.14 1988-03-15",
@@ -675,7 +685,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 3 (IIgs) 2.0A 8/28/88 (CE)
+		// King's Quest 3 (IIgs) 2.0A 8/28/88 (CE)
 		{
 			"kq3",
 			"2.0A 1988-08-28 (CE)",
@@ -692,7 +702,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 3 (Amiga) 2.15 11/15/89	# 2.333
+		// King's Quest 3 (Amiga) 2.15 11/15/89	# 2.333
 		{
 			"kq3",
 			"2.15 1989-11-15",
@@ -709,7 +719,8 @@
 
 
 	{
-		// Sarien Name == King's Quest 3 (PC) 1.01 11/08/86 [AGI 2.272]
+		// King's Quest 3 (PC) 1.01 11/08/86 [AGI 2.272]
+		// Does not have menus, crashes if menus are enforced. Therefore, ESC pauses the game
 		{
 			"kq3",
 			"1.01 1986-11-08",
@@ -720,13 +731,13 @@
 		},
 		GID_KQ3,
 		GType_V2,
-		0,
+		GF_ESCPAUSE,
 		0x2272,
 	},
 
 
 	{
-		// Sarien Name == King's Quest 3 (PC 5.25") 2.00 5/25/87 [AGI 2.435]
+		// King's Quest 3 (PC 5.25") 2.00 5/25/87 [AGI 2.435]
 		{
 			"kq3",
 			"2.00 1987-05-25 5.25\"",
@@ -743,7 +754,8 @@
 
 
 	{
-		// Sarien Name == King's Quest 3 (Mac) 2.14 3/15/88
+		// King's Quest 3 (Mac) 2.14 3/15/88
+		// Menus not tested
 		{
 			"kq3",
 			"2.14 1988-03-15 5.25\"",
@@ -760,7 +772,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 3 (PC 3.5") 2.14 3/15/88 [AGI 2.936]
+		// King's Quest 3 (PC 3.5") 2.14 3/15/88 [AGI 2.936]
 		{
 			"kq3",
 			"2.14 1988-03-15 3.5\"",
@@ -777,7 +789,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 4 (PC 5.25") 2.3 9/27/88 [AGI 3.002.086]
+		// King's Quest 4 (PC 5.25") 2.3 9/27/88 [AGI 3.002.086]
 		{
 			"kq4",
 			"2.3 1988-09-27",
@@ -794,7 +806,8 @@
 
 
 	{
-		// Sarien Name == King's Quest 4 (IIgs) 1.0K 11/22/88 (CE)
+		// King's Quest 4 (IIgs) 1.0K 11/22/88 (CE)
+		// Menus not tested
 		{
 			"kq4",
 			"1.0K 1988-11-22",
@@ -811,7 +824,7 @@
 
 
 	{
-		// Sarien Name == King's Quest 4 (PC 3.5") 2.0 7/27/88 [AGI 3.002.086]
+		// King's Quest 4 (PC 3.5") 2.0 7/27/88 [AGI 3.002.086]
 		{
 			"kq4",
 			"2.0 1988-07-27 3.5\"",
@@ -828,7 +841,8 @@
 
 
 	{
-		// Sarien Name == King's Quest 4 (PC 3.5") 2.2 9/27/88 [AGI 3.002.086]
+		// King's Quest 4 (PC 3.5") 2.2 9/27/88 [AGI 3.002.086]
+		// Menus not tested
 		{
 			"kq4",
 			"2.2 1988-09-27 3.5\"",
@@ -845,7 +859,8 @@
 
 
 	{
-		// Sarien Name == King's Quest 4 demo (PC) [AGI 3.002.102]
+		// King's Quest 4 demo (PC) [AGI 3.002.102]
+		// Menus not tested
 		{
 			"kq4",
 			"Demo 1988-12-20",
@@ -862,7 +877,7 @@
 
 
 	{
-		// Sarien Name == Leisure Suit Larry 1 (PC 5.25"/3.5") 1.00 6/1/87 [AGI 2.440]
+		// Leisure Suit Larry 1 (PC 5.25"/3.5") 1.00 6/1/87 [AGI 2.440]
 		{
 			"lsl1",
 			"1.00 1987-06-01 5.25\"/3.5\"",
@@ -879,7 +894,7 @@
 
 
 	{
-		// Sarien Name == Leisure Suit Larry 1 (ST) 1.04 6/18/87
+		// Leisure Suit Larry 1 (ST) 1.04 6/18/87
 		{
 			"lsl1",
 			"1.04 1987-06-18",
@@ -896,7 +911,7 @@
 
 
 	{
-		// Sarien Name == Leisure Suit Larry 1 (Amiga) 1.05 6/26/87	# x.yyy
+		// Leisure Suit Larry 1 (Amiga) 1.05 6/26/87	# x.yyy
 		{
 			"lsl1",
 			"1.05 1987-06-26",
@@ -913,7 +928,7 @@
 
 
 	{
-		// Sarien Name == Leisure Suit Larry 1 (IIgs) 1.0E
+		// Leisure Suit Larry 1 (IIgs) 1.0E
 		{
 			"lsl1",
 			"1.0E 1987",
@@ -930,7 +945,7 @@
 
 
 	{
-		// Sarien Name == Leisure Suit Larry 1 (Mac) 1.05 6/26/87
+		// Leisure Suit Larry 1 (Mac) 1.05 6/26/87
 		{
 			"lsl1",
 			"1.05 1987-06-26",
@@ -947,7 +962,7 @@
 
 
 	{
-		// Sarien Name == Manhunter NY (ST) 1.03 10/20/88
+		// Manhunter NY (ST) 1.03 10/20/88
 		{
 			"mh1",
 			"1.03 1988-10-20",
@@ -964,7 +979,7 @@
 
 
 	{
-		// Sarien Name == Manhunter NY (IIgs) 2.0E 10/05/88 (CE)
+		// Manhunter NY (IIgs) 2.0E 10/05/88 (CE)
 		{
 			"mh1",
 			"2.0E 1988-10-05 (CE)",
@@ -981,7 +996,7 @@
 
 
 	{
-		// Sarien Name == Manhunter NY (Amiga) 1.06 3/18/89
+		// Manhunter NY (Amiga) 1.06 3/18/89
 		{
 			"mh1",
 			"1.06 1989-03-18",
@@ -999,7 +1014,7 @@
 
 	{
 		// reported by Filippos (thebluegr) in bugreport #1654500
-		// Sarien Name == Manhunter NY (PC 5.25") 1.22 8/31/88 [AGI 3.002.107]
+		// Manhunter NY (PC 5.25") 1.22 8/31/88 [AGI 3.002.107]
 		{
 			"mh1",
 			"1.22 1988-08-31",
@@ -1016,7 +1031,7 @@
 
 
 	{
-		// Sarien Name == Manhunter NY (PC 3.5") 1.22 8/31/88 [AGI 3.002.102]
+		// Manhunter NY (PC 3.5") 1.22 8/31/88 [AGI 3.002.102]
 		{
 			"mh1",
 			"1.22 1988-08-31",
@@ -1033,7 +1048,7 @@
 
 
 	{
-		// Sarien Name == Manhunter SF (ST) 1.0 7/29/89
+		// Manhunter SF (ST) 1.0 7/29/89
 		{
 			"mh2",
 			"1.0 1989-07-29",
@@ -1050,7 +1065,7 @@
 
 
 	{
-		// Sarien Name == Manhunter SF (Amiga) 3.06 8/17/89		# 2.333
+		// Manhunter SF (Amiga) 3.06 8/17/89		# 2.333
 		{
 			"mh2",
 			"3.06 1989-08-17",
@@ -1067,7 +1082,7 @@
 
 
 	{
-		// Sarien Name == Manhunter SF (PC 5.25") 3.03 8/17/89 [AGI 3.002.149]
+		// Manhunter SF (PC 5.25") 3.03 8/17/89 [AGI 3.002.149]
 		{
 			"mh2",
 			"3.03 1989-08-17 5.25\"",
@@ -1084,7 +1099,7 @@
 
 
 	{
-		// Sarien Name == Manhunter SF (PC 3.5") 3.02 7/26/89 [AGI 3.002.149]
+		// Manhunter SF (PC 3.5") 3.02 7/26/89 [AGI 3.002.149]
 		{
 			"mh2",
 			"3.02 1989-07-26 3.5\"",
@@ -1099,9 +1114,11 @@
 		0x3149,
 	},
 
-
+#if 0
 	{
-		// Sarien Name == Mixed-Up Mother Goose (Amiga) 1.1
+		// Mixed-Up Mother Goose (Amiga) 1.1
+		// Problematic: crashes
+		// Menus not tested
 		{
 			"mixedup",
 			"1.1 1986-12-10",
@@ -1115,10 +1132,10 @@
 		0,
 		0x3086,
 	},
+#endif
 
-
 	{
-		// Sarien Name == Mixed Up Mother Goose (IIgs)
+		// Mixed Up Mother Goose (IIgs)
 		{
 			"mixedup",
 			"1987",
@@ -1135,7 +1152,7 @@
 
 
 	{
-		// Sarien Name == Mixed-Up Mother Goose (PC) [AGI 2.915]
+		// Mixed-Up Mother Goose (PC) [AGI 2.915]
 		{
 			"mixedup",
 			"1987-11-10",
@@ -1153,7 +1170,8 @@
 
 #if 0
 	{
-		// Sarien Name == Mixed Up Mother Goose (PC) [AGI 2.915] (Broken)
+		// Mixed Up Mother Goose (PC) [AGI 2.915] (Broken)
+		// Menus not tested
 		{
 			"mixedup",
 			"[corrupt/OBJECT from disk 1]",
@@ -1171,7 +1189,7 @@
 
 
 	{
-		// Sarien Name == Police Quest 1 (PC) 2.0E 11/17/87 [AGI 2.915]
+		// Police Quest 1 (PC) 2.0E 11/17/87 [AGI 2.915]
 		{
 			"pq1",
 			"2.0E 1987-11-17",
@@ -1188,7 +1206,7 @@
 
 
 	{
-		// Sarien Name == Police Quest 1 (Mac) 2.0G 12/3/87
+		// Police Quest 1 (Mac) 2.0G 12/3/87
 		{
 			"pq1",
 			"2.0G 1987-12-03",
@@ -1205,7 +1223,7 @@
 
 
 	{
-		// Sarien Name == Police Quest 1 (IIgs) 2.0B-88421
+		// Police Quest 1 (IIgs) 2.0B-88421
 		{
 			"pq1",
 			"2.0B 1988-04-21",
@@ -1222,7 +1240,7 @@
 
 
 	{
-		// Sarien Name == Police Quest 1 (Amiga) 2.0B 2/22/89	# 2.310
+		// Police Quest 1 (Amiga) 2.0B 2/22/89	# 2.310
 		{
 			"pq1",
 			"2.0B 1989-02-22",
@@ -1239,7 +1257,7 @@
 
 
 	{
-		// Sarien Name == Police Quest 1 (IIgs) 2.0A-88318
+		// Police Quest 1 (IIgs) 2.0A-88318
 		{
 			"pq1",
 			"2.0A 1988-03-18",
@@ -1256,7 +1274,7 @@
 
 
 	{
-		// Sarien Name == Police Quest 1 (PC) 2.0A 10/23/87 [AGI 2.903/2.911]
+		// Police Quest 1 (PC) 2.0A 10/23/87 [AGI 2.903/2.911]
 		{
 			"pq1",
 			"2.0A 1987-10-23",
@@ -1273,7 +1291,7 @@
 
 
 	{
-		// Sarien Name == Police Quest 1 (Mac) 2.0G 12/3/87
+		// Police Quest 1 (Mac) 2.0G 12/3/87
 		{
 			"pq1",
 			"2.0G 1987-12-03 5.25\"/ST",
@@ -1307,7 +1325,8 @@
 
 
 	{
-		// Sarien Name == Space Quest 1 (ST) 1.1A
+		// Space Quest 1 (ST) 1.1A
+		// The original game did not have menus, they are enabled under ScummVM
 		{
 			"sq1",
 			"1.1A 1986-02-06",
@@ -1318,13 +1337,14 @@
 		},
 		GID_SQ1,
 		GType_V2,
-		0,
+		GF_MENUS,
 		0x2440,
 	},
 
 
 	{
-		// Sarien Name == Space Quest 1 (PC) 1.1A [AGI 2.272]
+		// Space Quest 1 (PC) 1.1A [AGI 2.272]
+		// The original game did not have menus, they are enabled under ScummVM
 		{
 			"sq1",
 			"1.1A 1986-11-13",
@@ -1335,13 +1355,14 @@
 		},
 		GID_SQ1,
 		GType_V2,
-		0,
+		GF_MENUS,
 		0x2272,
 	},
 
 
 	{
-		// Sarien Name == Space Quest 1 (Amiga) 1.2			# 2.082
+		// Space Quest 1 (Amiga) 1.2			# 2.082
+		// The original game did not have menus, they are enabled under ScummVM
 		{
 			"sq1",
 			"1.2 1986",
@@ -1352,13 +1373,13 @@
 		},
 		GID_SQ1,
 		GType_V2,
-		0,
+		GF_MENUS,
 		0x2440,
 	},
 
 
 	{
-		// Sarien Name == Space Quest 1 (Mac) 1.5D
+		// Space Quest 1 (Mac) 1.5D
 		{
 			"sq1",
 			"1.5D 1987-04-02",
@@ -1375,7 +1396,7 @@
 
 
 	{
-		// Sarien Name == Space Quest 1 (IIgs) 2.2
+		// Space Quest 1 (IIgs) 2.2
 		{
 			"sq1",
 			"2.2 1987",
@@ -1392,7 +1413,8 @@
 
 
 	{
-		// Sarien Name == Space Quest 1 (PC) 1.0X [AGI 2.089]
+		// Space Quest 1 (PC) 1.0X [AGI 2.089]
+		// Does not have menus, crashes if menus are enforced. Therefore, ESC pauses the game
 		{
 			"sq1",
 			"1.0X 1986-09-24",
@@ -1403,30 +1425,14 @@
 		},
 		GID_SQ1,
 		GType_V2,
-		0,
+		GF_ESCPAUSE,
 		0x2089,
 	},
 
 
-	{
-		// Sarien Name == Space Quest 1 (PC) 1.1A [AGI 2.272]
-		{
-			"sq1",
-			"1.1A 1986-11-13",
-			AD_ENTRY1("logdir", "8d8c20ab9f4b6e4817698637174a1cb6"),
-			Common::EN_ANY,
-			Common::kPlatformPC,
-			Common::ADGF_NO_FLAGS
-		},
-		GID_SQ1,
-		GType_V2,
-		0,
-		0x2272,
-	},
 
-
 	{
-		// Sarien Name == Space Quest 1 (PC 5.25"/3.5") 2.2 [AGI 2.426/2.917]
+		// Space Quest 1 (PC 5.25"/3.5") 2.2 [AGI 2.426/2.917]
 		{
 			"sq1",
 			"2.2 1987-05-07 5.25\"/3.5\"",
@@ -1444,7 +1450,7 @@
 
 
 	{
-		// Sarien Name == Space Quest 2 (PC 3.5") 2.0D [AGI 2.936]
+		// Space Quest 2 (PC 3.5") 2.0D [AGI 2.936]
 		{
 			"sq2",
 			"2.0D 1988-03-14 3.5\"",
@@ -1461,7 +1467,7 @@
 
 
 	{
-		// Sarien Name == Space Quest 2 (IIgs) 2.0A 7/25/88 (CE)
+		// Space Quest 2 (IIgs) 2.0A 7/25/88 (CE)
 		{
 			"sq2",
 			"2.0A 1988-07-25 (CE)",
@@ -1478,7 +1484,7 @@
 
 
 	{
-		// Sarien Name == Space Quest 2 (Amiga) 2.0F
+		// Space Quest 2 (Amiga) 2.0F
 		{
 			"sq2",
 			"2.0F 1986-12-09 [VOL.2->PICTURE.16 broken]",
@@ -1499,7 +1505,7 @@
 
 
 	{
-		// Sarien Name == Space Quest 2 (Mac) 2.0D
+		// Space Quest 2 (Mac) 2.0D
 		{
 			"sq2",
 			"2.0D 1988-04-04",
@@ -1517,7 +1523,7 @@
 
 	{
 		// reported by Filippos (thebluegr) in bugreport #1654500
-		// Sarien Name == Space Quest 2 (PC 5.25") 2.0A [AGI 2.912]
+		// Space Quest 2 (PC 5.25") 2.0A [AGI 2.912]
 		{
 			"sq2",
 			"2.0A 1987-11-06 5.25\"",
@@ -1534,7 +1540,7 @@
 
 
 	{
-		// Sarien Name == Space Quest 2 (PC 3.5") 2.0A [AGI 2.912]
+		// Space Quest 2 (PC 3.5") 2.0A [AGI 2.912]
 		{
 			"sq2",
 			"2.0A 1987-11-06 3.5\"",
@@ -1551,7 +1557,8 @@
 
 
 	{
-		// Sarien Name == Space Quest 2 (PC 5.25"/ST) 2.0C/A [AGI 2.915]
+		// Space Quest 2 (PC 5.25"/ST) 2.0C/A [AGI 2.915]
+		// Menus not tested
 		{
 			"sq2",
 			"2.0C/A 5.25\"/ST",
@@ -1568,7 +1575,7 @@
 
 
 	{
-		// Sarien Name == Space Quest 2 (PC 3.5") 2.0F [AGI 2.936]
+		// Space Quest 2 (PC 3.5") 2.0F [AGI 2.936]
 		{
 			"sq2",
 			"2.0F 1989-01-05 3.5\"",
@@ -1585,7 +1592,7 @@
 
 
 	{
-		// Sarien Name == Xmas Card 1986 (PC) [AGI 2.272]
+		// Xmas Card 1986 (PC) [AGI 2.272]
 		{
 			"xmascard",
 			"1986-11-13 [version 1]",
@@ -1675,7 +1682,7 @@
 	FANMADE("Good Man (demo v3.41)", "3facd8a8f856b7b6e0f6c3200274d88c"),
 
 	{
-		// Sarien Name == Groza
+		// Groza
 		{
 			"agi-fanmade",
 			"Groza (russian) [AGDS sample]",

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/graphics.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/graphics.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -68,6 +68,93 @@
 };
 
 /**
+ * First generation Amiga AGI palette.
+ * A 16-color, 12-bit RGB palette.
+ *
+ * Used by at least the following Amiga AGI versions:
+ * 2.082 (King's Quest I   v1.0U 1986)
+ * 2.082 (Space Quest I    v1.2  1986)
+ * 2.090 (King's Quest III v1.01 1986-11-08)
+ * 2.107 (King's Quest II  v2.0J 1987-01-29)
+ * x.yyy (Black Cauldron   v2.00 1987-06-14)
+ * x.yyy (Larry I          v1.05 1987-06-26)
+ */
+uint8 amigaAgiPaletteV1[16 * 3] = {
+	0x0, 0x0, 0x0,
+	0x0, 0x0, 0xF,
+	0x0, 0x8, 0x0,
+	0x0, 0xD, 0xB,
+	0xC, 0x0, 0x0,
+	0xB, 0x7, 0xD,
+	0x8, 0x5, 0x0,
+	0xB, 0xB, 0xB,
+	0x7, 0x7, 0x7,
+	0x0, 0xB, 0xF,
+	0x0, 0xE, 0x0,
+	0x0, 0xF, 0xD,
+	0xF, 0x9, 0x8,
+	0xF, 0x7, 0x0,
+	0xE, 0xE, 0x0,
+	0xF, 0xF, 0xF
+};
+
+/**
+ * Second generation Amiga AGI palette.
+ * A 16-color, 12-bit RGB palette.
+ *
+ * Used by at least the following Amiga AGI versions:
+ * 2.202 (Space Quest II v2.0F. Intro says 1988. ScummVM 0.10.0 detects as 1986-12-09)
+ */
+uint8 amigaAgiPaletteV2[16 * 3] = {
+	0x0, 0x0, 0x0,
+	0x0, 0x0, 0xF,
+	0x0, 0x8, 0x0,
+	0x0, 0xD, 0xB,
+	0xC, 0x0, 0x0,
+	0xB, 0x7, 0xD,
+	0x8, 0x5, 0x0,
+	0xB, 0xB, 0xB,
+	0x7, 0x7, 0x7,
+	0x0, 0xB, 0xF,
+	0x0, 0xE, 0x0,
+	0x0, 0xF, 0xD,
+	0xF, 0x9, 0x8,
+	0xD, 0x0, 0xF,
+	0xE, 0xE, 0x0,
+	0xF, 0xF, 0xF
+};
+
+/**
+ * Third generation Amiga AGI palette.
+ * A 16-color, 12-bit RGB palette.
+ *
+ * Used by at least the following Amiga AGI versions:
+ * 2.310 (Police Quest I   v2.0B 1989-02-22)
+ * 2.316 (Gold Rush!       v2.05 1989-03-09)
+ * x.yyy (Manhunter I      v1.06 1989-03-18)
+ * 2.333 (Manhunter II     v3.06 1989-08-17)
+ * 2.333 (King's Quest III v2.15 1989-11-15)
+ */
+uint8 amigaAgiPaletteV3[16 * 3] = {
+	0x0, 0x0, 0x0,
+	0x0, 0x0, 0xB,
+	0x0, 0xB, 0x0,
+	0x0, 0xB, 0xB,
+	0xB, 0x0, 0x0,
+	0xB, 0x0, 0xB,
+	0xC, 0x7, 0x0,
+	0xB, 0xB, 0xB,
+	0x7, 0x7, 0x7,
+	0x0, 0x0, 0xF,
+	0x0, 0xF, 0x0,
+	0x0, 0xF, 0xF,
+	0xF, 0x0, 0x0,
+	0xF, 0x0, 0xF,
+	0xF, 0xF, 0x0,
+	0xF, 0xF, 0xF
+};
+
+/**
  * 16 color amiga-ish palette.
  */
 uint8 newPalette[16 * 3] = {
@@ -554,13 +641,42 @@
 }
 
 /**
- * Draw button
+ * Draw a default style button.
+ * Swaps background and foreground color if button is in focus or being pressed.
  * @param x  x coordinate of the button
  * @param y  y coordinate of the button
  * @param a  set if the button has focus
  * @param p  set if the button is pressed
+ * @param fgcolor foreground color of the button when it is neither in focus nor being pressed
+ * @param bgcolor background color of the button when it is neither in focus nor being pressed
  */
-void GfxMgr::drawButton(int x, int y, const char *s, int a, int p, int fgcolor, int bgcolor) {
+void GfxMgr::drawDefaultStyleButton(int x, int y, const char *s, int a, int p, int fgcolor, int bgcolor) {
+	int textOffset     = _vm->_defaultButtonStyle.getTextOffset(a > 0, p > 0);
+	AgiTextColor color = _vm->_defaultButtonStyle.getColor     (a > 0, p > 0, fgcolor, bgcolor);
+	bool border        = _vm->_defaultButtonStyle.getBorder    (a > 0, p > 0);
+
+	rawDrawButton(x, y, s, color.fg, color.bg, border, textOffset);
+}
+
+/**
+ * Draw a button using the currently chosen style.
+ * Amiga-style is used for the Amiga-rendering mode, PC-style is used otherwise.
+ * @param x  x coordinate of the button
+ * @param y  y coordinate of the button
+ * @param hasFocus  set if the button has focus
+ * @param pressed  set if the button is pressed
+ * @param positive  set if button is positive, otherwise button is negative (Only matters with Amiga-style buttons)
+ * TODO: Make Amiga-style buttons a bit wider as they were in Amiga AGI games.
+ */
+void GfxMgr::drawCurrentStyleButton(int x, int y, const char *label, bool hasFocus, bool pressed, bool positive) {
+	int textOffset     = _vm->_buttonStyle.getTextOffset(hasFocus, pressed);
+	AgiTextColor color = _vm->_buttonStyle.getColor(hasFocus, pressed, positive);
+	bool border        = _vm->_buttonStyle.getBorder(hasFocus, pressed);
+	
+	rawDrawButton(x, y, label, color.fg, color.bg, border, textOffset);
+}
+
+void GfxMgr::rawDrawButton(int x, int y, const char *s, int fgcolor, int bgcolor, bool border, int textOffset) {
 	int len = strlen(s);
 	int x1, y1, x2, y2;
 
@@ -569,8 +685,12 @@
 	x2 = x + CHAR_COLS * len + 2;
 	y2 = y + CHAR_LINES + 2;
 
+	// Draw a filled rectangle that's larger than the button. Used for drawing
+	// a border around the button as the button itself is drawn after this.
+	drawRectangle(x1, y1, x2, y2, border ? BUTTON_BORDER : MSG_BOX_COLOUR);
+	
 	while (*s) {
-		putTextCharacter(0, x + (!!p), y + (!!p), *s++, a ? bgcolor : fgcolor, a ? fgcolor : bgcolor);
+		putTextCharacter(0, x + textOffset, y + textOffset, *s++, fgcolor, bgcolor);
 		x += CHAR_COLS;
 	}
 
@@ -623,39 +743,26 @@
 
 /**
  * Initialize the color palette
- * This function initializes the color palette using the specified 16-color
+ * This function initializes the color palette using the specified
  * RGB palette.
- * @param p  A pointer to the 16-color RGB palette.
+ * @param p           A pointer to the source RGB palette.
+ * @param colorCount  Count of colors in the source palette.
+ * @param fromBits    Bits per source color component.
+ * @param toBits      Bits per destination color component.
  */
-void GfxMgr::initPalette(uint8 *p) {
-	int i;
-
-	for (i = 0; i < 48; i++) {
-		_palette[i] = p[i];
+void GfxMgr::initPalette(uint8 *p, uint colorCount, uint fromBits, uint toBits) {
+	const uint srcMax  = (1 << fromBits) - 1;
+	const uint destMax = (1 << toBits) - 1;
+	for (uint col = 0; col < colorCount; col++) {
+		for (uint comp = 0; comp < 3; comp++) { // Convert RGB components
+			_palette[col * 4 + comp] = (p[col * 3 + comp] * destMax) / srcMax;
+		}
+		_palette[col * 4 + 3] = 0; // Set alpha to zero
 	}
 }
 
 void GfxMgr::gfxSetPalette() {
-	int i;
-	byte pal[256 * 4];
-
-	if (!(_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2))) {
-		for (i = 0; i < 16; i++) {
-			pal[i * 4 + 0] = _palette[i * 3 + 0] << 2;
-			pal[i * 4 + 1] = _palette[i * 3 + 1] << 2;
-			pal[i * 4 + 2] = _palette[i * 3 + 2] << 2;
-			pal[i * 4 + 3] = 0;
-		}
-		g_system->setPalette(pal, 0, 16);
-	} else {
-		for (i = 0; i < 256; i++) {
-			pal[i * 4 + 0] = vgaPalette[i * 3 + 0];
-			pal[i * 4 + 1] = vgaPalette[i * 3 + 1];
-			pal[i * 4 + 2] = vgaPalette[i * 3 + 2];
-			pal[i * 4 + 3] = 0;
-		}
-		g_system->setPalette(pal, 0, 256);
-	}
+	g_system->setPalette(_palette, 0, 256);
 }
 
 //Gets AGIPAL Data
@@ -713,25 +820,115 @@
 	g_system->copyRectToScreen(_screen + y1 * 320 + x1, 320, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
 }
 
-static const byte mouseCursorArrow[] = {
-	// This is the same arrow cursor that was later used in early SCI games
-	0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 0x70, 0x00,
-	0x78, 0x00, 0x7C, 0x00, 0x7E, 0x00, 0x7F, 0x00,
-	0x7F, 0x80, 0x7F, 0xC0, 0x7C, 0x00, 0x46, 0x00,
-	0x06, 0x00, 0x03, 0x00, 0x03, 0x00, 0x01, 0x80,
-	0xC0, 0x00, 0xA0, 0x00, 0x90, 0x00, 0x88, 0x00,
-	0x84, 0x00, 0x82, 0x00, 0x81, 0x00, 0x80, 0x80,
-	0x80, 0x40, 0x80, 0x20, 0x82, 0x00, 0xA9, 0x00,
-	0xC9, 0x00, 0x04, 0x80, 0x04, 0x80, 0x02, 0x40
+/**
+ * A black and white SCI-style arrow cursor (11x16).
+ * 0 = Transparent.
+ * 1 = Black (#000000 in 24-bit RGB).
+ * 2 = White (#FFFFFF in 24-bit RGB).
+ */
+static const byte sciMouseCursor[] = {
+	1,1,0,0,0,0,0,0,0,0,0,
+	1,2,1,0,0,0,0,0,0,0,0,
+	1,2,2,1,0,0,0,0,0,0,0,
+	1,2,2,2,1,0,0,0,0,0,0,
+	1,2,2,2,2,1,0,0,0,0,0,
+	1,2,2,2,2,2,1,0,0,0,0,
+	1,2,2,2,2,2,2,1,0,0,0,
+	1,2,2,2,2,2,2,2,1,0,0,
+	1,2,2,2,2,2,2,2,2,1,0,
+	1,2,2,2,2,2,2,2,2,2,1,
+	1,2,2,2,2,2,1,0,0,0,0,
+	1,2,1,0,1,2,2,1,0,0,0,
+	1,1,0,0,1,2,2,1,0,0,0,
+	0,0,0,0,0,1,2,2,1,0,0,
+	0,0,0,0,0,1,2,2,1,0,0,
+	0,0,0,0,0,0,1,2,2,1,0
 };
 
 /**
+ * RGBA-palette for the black and white SCI-style arrow cursor.
+ */
+static const byte sciMouseCursorPalette[] = {
+	0x00, 0x00, 0x00,	0x00, // Black
+	0xFF, 0xFF, 0xFF,	0x00  // White
+};
+
+/**
+ * An Amiga-style arrow cursor (8x11).
+ * 0 = Transparent.
+ * 1 = Black     (#000000 in 24-bit RGB).
+ * 2 = Red       (#DE2021 in 24-bit RGB).
+ * 3 = Light red (#FFCFAD in 24-bit RGB).
+ */
+static const byte amigaMouseCursor[] = {
+	2,3,1,0,0,0,0,0,
+	2,2,3,1,0,0,0,0,
+	2,2,2,3,1,0,0,0,
+	2,2,2,2,3,1,0,0,
+	2,2,2,2,2,3,1,0,
+	2,2,2,2,2,2,3,1,
+	2,0,2,2,3,1,0,0,
+	0,0,0,2,3,1,0,0,
+	0,0,0,2,2,3,1,0,
+	0,0,0,0,2,3,1,0,
+	0,0,0,0,2,2,3,1
+};
+
+/**
+ * RGBA-palette for the Amiga-style arrow cursor
+ * and the Amiga-style busy cursor.
+ */
+static const byte amigaMouseCursorPalette[] = {
+	0x00, 0x00, 0x00,	0x00, // Black
+	0xDE, 0x20, 0x21,	0x00, // Red
+	0xFF, 0xCF, 0xAD,	0x00  // Light red
+};
+
+/**
+ * An Amiga-style busy cursor showing an hourglass (13x16).
+ * 0 = Transparent.
+ * 1 = Black     (#000000 in 24-bit RGB).
+ * 2 = Red       (#DE2021 in 24-bit RGB).
+ * 3 = Light red (#FFCFAD in 24-bit RGB).
+ */
+static const byte busyAmigaMouseCursor[] = {
+	1,1,1,1,1,1,1,1,1,1,1,1,1,
+	1,2,2,2,2,2,2,2,2,2,2,2,1,
+	1,2,2,2,2,2,2,2,2,2,2,2,1,
+	0,1,3,3,3,3,3,3,3,3,3,1,0,
+	0,0,1,3,3,3,3,3,3,3,1,0,0,
+	0,0,0,1,3,3,3,3,3,1,0,0,0,
+	0,0,0,0,1,3,3,3,1,0,0,0,0,
+	0,0,0,0,0,1,3,1,0,0,0,0,0,
+	0,0,0,0,0,1,3,1,0,0,0,0,0,
+	0,0,0,0,1,2,3,2,1,0,0,0,0,
+	0,0,0,1,2,2,3,2,2,1,0,0,0,
+	0,0,1,2,2,2,3,2,2,2,1,0,0,
+	0,1,2,2,2,3,3,3,2,2,2,1,0,
+	1,3,3,3,3,3,3,3,3,3,3,3,1,
+	1,3,3,3,3,3,3,3,3,3,3,3,1,
+	1,1,1,1,1,1,1,1,1,1,1,1,1
+};
+
+void GfxMgr::setCursor(bool amigaStyleCursor) {
+	if (!amigaStyleCursor) {
+		CursorMan.replaceCursorPalette(sciMouseCursorPalette, 1, ARRAYSIZE(sciMouseCursorPalette) / 4);
+		CursorMan.replaceCursor(sciMouseCursor, 11, 16, 1, 1, 0);
+	} else { // amigaStyleCursor
+		CursorMan.replaceCursorPalette(amigaMouseCursorPalette, 1, ARRAYSIZE(amigaMouseCursorPalette) / 4);
+		CursorMan.replaceCursor(amigaMouseCursor, 8, 11, 1, 1, 0);
+	}
+}
+
+/**
  * Initialize graphics device.
  *
  * @see deinit_video()
  */
 int GfxMgr::initVideo() {
-	if (_vm->_renderMode == Common::kRenderEGA)
+	if (_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2))
+		initPalette(vgaPalette, 256, 8);
+	else if (_vm->_renderMode == Common::kRenderEGA)
 		initPalette(egaPalette);
 	else
 		initPalette(newPalette);
@@ -741,32 +938,8 @@
 
 	gfxSetPalette();
 
-	byte mouseCursor[16 * 16];
-	const byte *src = mouseCursorArrow;
-	for (int i = 0; i < 32; ++i) {
-		int offs = i * 8;
-		for (byte mask = 0x80; mask != 0; mask >>= 1) {
-			if (src[0] & mask) {
-				mouseCursor[offs] = 2;
-			} else if (src[32] & mask) {
-				mouseCursor[offs] = 0;
-			} else {
-				mouseCursor[offs] = 0xFF;
-			}
-			++offs;
-		}
-		++src;
-	}
+	setCursor(_vm->_renderMode == Common::kRenderAmiga);
 
-	const byte cursorPalette[] = {
-		0, 0, 0, 0,
-		0, 0, 0, 0,
-		255, 255, 255, 0
-	};
-
-	CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
-	CursorMan.replaceCursor(mouseCursor, 16, 16, 1, 1);
-
 	return errOK;
 }
 

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/graphics.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/graphics.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/graphics.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -41,7 +41,7 @@
 private:
 	AgiEngine *_vm;
 
-	uint8 _palette[16 * 3];
+	uint8 _palette[256 * 4];
 	uint8 *_agiScreen;
 	unsigned char *_screen;
 
@@ -50,6 +50,9 @@
 	uint8 _agipalPalette[16 * 3];
 	int _agipalFileNum;
 
+private:
+	void rawDrawButton(int x, int y, const char *s, int fgcolor, int bgcolor, bool border, int textOffset);
+
 public:
 	GfxMgr(AgiEngine *vm);
 
@@ -74,12 +77,13 @@
 	void clearScreen(int);
 	void clearConsoleScreen(int);
 	void drawBox(int, int, int, int, int, int, int);
-	void drawButton(int, int, const char *, int, int, int fgcolor = 0, int bgcolor = 0);
+	void drawDefaultStyleButton(int, int, const char *, int, int, int fgcolor = 0, int bgcolor = 0);
+	void drawCurrentStyleButton(int x, int y, const char *label, bool hasFocus, bool pressed = false, bool positive = true);
 	int testButton(int, int, const char *);
 	void drawRectangle(int, int, int, int, int);
 	void saveBlock(int, int, int, int, uint8 *);
 	void restoreBlock(int, int, int, int, uint8 *);
-	void initPalette(uint8 *);
+	void initPalette(uint8 *p, uint colorCount = 16, uint fromBits = 6, uint toBits = 8);
 	void setAGIPal(int);
 	int getAGIPalFileNum();
 	void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2);
@@ -87,6 +91,7 @@
 	void putPixel(int, int, int);
 	void putBlock(int x1, int y1, int x2, int y2);
 	void gfxSetPalette();
+	void setCursor(bool amigaStyleCursor = false);
 
 	int keypress();
 	int getKey();

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/keyboard.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/keyboard.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/keyboard.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -29,6 +29,9 @@
 #include "agi/graphics.h"
 #include "agi/keyboard.h"
 #include "agi/menu.h"
+#ifdef __DS__
+#include "wordcompletion.h"
+#endif
 
 namespace Agi {
 
@@ -104,8 +107,10 @@
 	VtEntry *v = &_game.viewTable[0];
 	int i;
 
-	/* AGI 3.149 games and The Black Cauldron need KEY_ESCAPE to use menus */
-	if (key == 0 || (key == KEY_ESCAPE && agiGetRelease() != 0x3149 && getGameID() != GID_BC) )
+	// AGI 3.149 games and The Black Cauldron need KEY_ESCAPE to use menus
+	// Games with the GF_ESCPAUSE flag need KEY_ESCAPE to pause the game
+	if (key == 0 || 
+		(key == KEY_ESCAPE && agiGetRelease() != 0x3149 && getGameID() != GID_BC && !(getFeatures() & GF_ESCPAUSE)) )
 		return false;
 
 	if ((getGameID() == GID_MH1 || getGameID() == GID_MH2) && (key == KEY_ENTER) &&
@@ -124,7 +129,7 @@
 	}
 
 	if (key == BUTTON_LEFT) {
-		if (getflag(fMenusWork) && g_mouse.y <= CHAR_LINES) {
+		if ((getflag(fMenusWork) || (getFeatures() & GF_MENUS)) && g_mouse.y <= CHAR_LINES) {
 			newInputMode(INPUT_MENU);
 			return true;
 		}
@@ -308,6 +313,9 @@
 		debugC(3, kDebugLevelInput, "clear lines");
 		clearLines(l, l + 1, bg);
 		flushLines(l, l + 1);
+#ifdef __DS__
+		DS::findWordCompletions((char *) _game.inputBuffer);
+#endif
 
 		break;
 	case KEY_ESCAPE:
@@ -324,6 +332,10 @@
 		_game.inputBuffer[--_game.cursorPos] = 0;
 		/* Print cursor */
 		_gfx->printCharacter(_game.cursorPos + 1, l, _game.cursorChar, fg, bg);
+
+#ifdef __DS__
+		DS::findWordCompletions((char *) _game.inputBuffer);
+#endif
 		break;
 	default:
 		/* Ignore invalid keystrokes */
@@ -337,6 +349,10 @@
 		_game.inputBuffer[_game.cursorPos++] = key;
 		_game.inputBuffer[_game.cursorPos] = 0;
 
+#ifdef __DS__
+		DS::findWordCompletions((char *) _game.inputBuffer);
+#endif
+
 		/* echo */
 		_gfx->printCharacter(_game.cursorPos, l, _game.inputBuffer[_game.cursorPos - 1], fg, bg);
 

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/menu.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/menu.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/menu.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -267,7 +267,7 @@
 	static int menuActive = false;
 	static int buttonUsed = 0;
 
-	if (!_vm->getflag(fMenusWork))
+	if (!_vm->getflag(fMenusWork) && !(_vm->getFeatures() & GF_MENUS))
 		return false;
 
 	if (!menuActive) {
@@ -351,6 +351,12 @@
 						debugC(6, kDebugLevelMenu | kDebugLevelInput, "event %d registered", d->event);
 						_vm->_game.evKeyp[d->event].occured = true;
 						_vm->_game.evKeyp[d->event].data = d->event;
+						// In LSL1, event 0x20 is set when changing the game speed to normal via the menu
+						// Do not set the event data to 0x20, as this event is then incorrectly triggered
+						// when the spacebar is pressed, which has a keycode equal to 0x20 as well
+						// Fixes bug #1751390 - "LSL: after changing game speed, space key turn unfunctional"
+						if (d->event == 0x20)
+							_vm->_game.evKeyp[d->event].data = d->event + 1;
 						goto exit_menu;
 					}
 				}

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/predictive.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/predictive.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/predictive.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -30,6 +30,10 @@
 #include "common/func.h"
 #include "common/config-manager.h"
 
+#ifdef __DS__
+#include "wordcompletion.h"
+#endif
+
 namespace Agi {
 
 #define kModePre 0
@@ -200,9 +204,9 @@
 					color2 = 7;
 				}
 				if (i == 14) {
-					_gfx->drawButton(bx[i], by[i], modes[mode], i == active, 0, color1, color2);
+					_gfx->drawDefaultStyleButton(bx[i], by[i], modes[mode], i == active, 0, color1, color2);
 				} else {
-					_gfx->drawButton(bx[i], by[i], buttons[i], i == active, 0, color1, color2);
+					_gfx->drawDefaultStyleButton(bx[i], by[i], buttons[i], i == active, 0, color1, color2);
 				}
 			}
 
@@ -521,6 +525,10 @@
 	while ((ptr = strchr(ptr, '\n'))) {
 		*ptr = 0;
 		ptr++;
+#ifdef __DS__
+		// Pass the line on to the DS word list
+		DS::addAutoCompleteLine(_predictiveDictLine[i - 1]);
+#endif
 		_predictiveDictLine[i++] = ptr;
 	}
 	if (_predictiveDictLine[lines - 1][0] == 0)
@@ -529,6 +537,11 @@
 	_predictiveDictLineCount = lines;
 	debug("Loaded %d lines", _predictiveDictLineCount);
 
+#ifdef __DS__
+	// Sort the DS word completion list, to allow for a binary chop later (in the ds backend)
+	DS::sortAutoCompleteWordList();
+#endif
+
 	uint32 time3 = _system->getMillis();
 	printf("Time to parse pred.dic: %d, total: %d\n", time3-time2, time3-time1);
 }

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/saveload.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/saveload.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/saveload.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -516,44 +516,51 @@
 	buttonY = (vm + 17) * CHAR_LINES;
 	
 	for (i = 0; i < 2; i++)
-		_gfx->drawButton(buttonX[i], buttonY, buttonText[i], 0, 0, MSG_BOX_TEXT, MSG_BOX_COLOUR);
+		_gfx->drawCurrentStyleButton(buttonX[i], buttonY, buttonText[i], false, false, i == 0);
 
 	AllowSyntheticEvents on(this);
+	int oldFirstSlot = _firstSlot + 1;
+	int oldActive = active + 1;
 
 	for (;;) {
-		char dstr[64];
-		for (i = 0; i < NUM_VISIBLE_SLOTS; i++) {
-			sprintf(dstr, "[%2d. %-28.28s]", i + _firstSlot, desc[i]);
-			printText(dstr, 0, hm + 1, vm + 4 + i,
-					(40 - 2 * hm) - 1, i == active ? MSG_BOX_COLOUR : MSG_BOX_TEXT,
-					i == active ? MSG_BOX_TEXT : MSG_BOX_COLOUR);
-		}
+		int sbPos;
 
-		char upArrow[] = "^";
-		char downArrow[] = "v";
-		char scrollBar[] = " ";
+		if (oldFirstSlot != _firstSlot || oldActive != active) {
+			char dstr[64];
+			for (i = 0; i < NUM_VISIBLE_SLOTS; i++) {
+				sprintf(dstr, "[%2d. %-28.28s]", i + _firstSlot, desc[i]);
+				printText(dstr, 0, hm + 1, vm + 4 + i,
+						(40 - 2 * hm) - 1, i == active ? MSG_BOX_COLOUR : MSG_BOX_TEXT,
+						i == active ? MSG_BOX_TEXT : MSG_BOX_COLOUR);
+			}
 
-		int sbPos;
+			char upArrow[] = "^";
+			char downArrow[] = "v";
+			char scrollBar[] = " ";
 
-		// Use the extreme scrollbar positions only if the extreme
-		// slots are in sight.
+			// Use the extreme scrollbar positions only if the
+			// extreme slots are in sight.
 
-		if (_firstSlot == 0)
-			sbPos = 1;
-		else if (_firstSlot == NUM_SLOTS - NUM_VISIBLE_SLOTS)
-			sbPos = NUM_VISIBLE_SLOTS - 2;
-		else {
-			sbPos = 2 + (_firstSlot * (NUM_VISIBLE_SLOTS - 4)) / (NUM_SLOTS - NUM_VISIBLE_SLOTS - 1);
-			if (sbPos >= NUM_VISIBLE_SLOTS - 3)
-				sbPos = NUM_VISIBLE_SLOTS - 3;
-		}
+			if (_firstSlot == 0)
+				sbPos = 1;
+			else if (_firstSlot == NUM_SLOTS - NUM_VISIBLE_SLOTS)
+				sbPos = NUM_VISIBLE_SLOTS - 2;
+			else {
+				sbPos = 2 + (_firstSlot * (NUM_VISIBLE_SLOTS - 4)) / (NUM_SLOTS - NUM_VISIBLE_SLOTS - 1);
+				if (sbPos >= NUM_VISIBLE_SLOTS - 3)
+					sbPos = NUM_VISIBLE_SLOTS - 3;
+			}
 
-		for (i = 1; i < NUM_VISIBLE_SLOTS - 1; i++)
-			printText(scrollBar, 35, hm + 1, vm + 4 + i, 1, MSG_BOX_COLOUR, 7, true);
+			for (i = 1; i < NUM_VISIBLE_SLOTS - 1; i++)
+				printText(scrollBar, 35, hm + 1, vm + 4 + i, 1, MSG_BOX_COLOUR, 7, true);
 
-		printText(upArrow, 35, hm + 1, vm + 4, 1, 8, 7);
-		printText(downArrow, 35, hm + 1, vm + 4 + NUM_VISIBLE_SLOTS - 1, 1, 8, 7);
-		printText(scrollBar, 35, hm + 1, vm + 4 + sbPos, 1, MSG_BOX_COLOUR, MSG_BOX_TEXT);
+			printText(upArrow, 35, hm + 1, vm + 4, 1, 8, 7);
+			printText(downArrow, 35, hm + 1, vm + 4 + NUM_VISIBLE_SLOTS - 1, 1, 8, 7);
+			printText(scrollBar, 35, hm + 1, vm + 4 + sbPos, 1, MSG_BOX_COLOUR, MSG_BOX_TEXT);
+
+			oldActive = active;
+			oldFirstSlot = _firstSlot;
+		}
 		
 		_gfx->pollTimer();	/* msdos driver -> does nothing */
 		key = doPollKeyboard();

Modified: scummvm/branches/gsoc2007-mixer/engines/agi/text.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agi/text.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agi/text.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -364,7 +364,7 @@
 	debugC(4, kDebugLevelText, "waiting...");
 	for (;;) {
 		for (i = 0; b[i]; i++)
-			_gfx->drawButton(bx[i], by[i], b[i], i == active, 0, MSG_BOX_TEXT, MSG_BOX_COLOUR);
+			_gfx->drawCurrentStyleButton(bx[i], by[i], b[i], i == active, false, i == 0);
 
 		_gfx->pollTimer();	/* msdos driver -> does nothing */
 		key = doPollKeyboard();

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/agos.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/agos.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/agos.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -744,10 +744,12 @@
 	_tableIndexBase = 1580 / 4;
 	_textIndexBase = 1500 / 4;
 	_numVideoOpcodes = 75;
-#ifndef PALMOS_68K
+#if defined(__DS__)
+	_vgaMemSize = 1300000;
+#elif defined(PALMOS_68K)
+	_vgaMemSize = gVars->memory[kMemSimon2Games];
+#else
 	_vgaMemSize = 2000000;
-#else
-	_vgaMemSize = gVars->memory[kMemSimon2Games];
 #endif
 	_itemMemSize = 20000;
 	_tableMemSize = 100000;

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/agos.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/agos.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/agos.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -1319,6 +1319,7 @@
 	void oe2_pObj();
 	void oe2_isCalled();
 	void oe2_loadGame();
+	void oe2_menu();
 	void oe2_drawItem();
 	void oe2_doTable();
 	void oe2_pauseGame();
@@ -1412,7 +1413,6 @@
 	void oww_setLongText();
 	void oww_printLongText();
 	void oww_whereTo();
-	void oww_menu();
 	void oww_textMenu();
 	void oww_pauseGame();
 	void oww_boxMessage();

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/gfx.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/gfx.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/gfx.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -666,6 +666,9 @@
 	} else if (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) {
 		// The DOS Floppy demo was based off Waxworks engine
 		if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) {
+			state->surf2_addr = getBackGround();
+			state->surf2_pitch = _screenWidth;
+
 			state->surf_addr = _window4BackScn;
 			state->surf_pitch = _videoWindows[18] * 16;
 

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/input.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/input.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/input.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -567,12 +567,14 @@
 				_speech ^= 1;
 		}
 	case Common::KEYCODE_PLUS:
+	case Common::KEYCODE_KP_PLUS:
 		if (_midiEnabled) {
 			_midi.setVolume(_midi.getVolume() + 16);
 		}
 		_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 16);
 		break;
 	case Common::KEYCODE_MINUS:
+	case Common::KEYCODE_KP_MINUS:
 		if (_midiEnabled) {
 			_midi.setVolume(_midi.getVolume() - 16);
 		}

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/intern.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/intern.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/intern.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -32,8 +32,8 @@
 	kRoomType = 1,
 	kObjectType = 2,
 	kPlayerType = 3,
-	kGenExitType = 4,   // Elvira 1 specifc
-	kSuperRoomType = 4, // Elvira 2 specic
+	kGenExitType = 4,   // Elvira 1 specific
+	kSuperRoomType = 4, // Elvira 2 specific
 
 	kContainerType = 7,
 	kChainType = 8,

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/saveload.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/saveload.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/saveload.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -1283,9 +1283,12 @@
 	Common::OutSaveFile *f;
 	uint item_index, num_item, i, j;
 	TimeEvent *te;
-	uint32 curTime = 0;
 	uint32 gsc = _gameStoppedClock;
 
+	uint32 curTime = 0;
+	if (getGameType() != GType_SIMON1 && getGameType() != GType_SIMON2)
+		curTime = time(NULL);
+
 	_lockWord |= 0x100;
 
 	f = _saveFileMan->openForSaving(genSaveName(slot));
@@ -1299,7 +1302,6 @@
 		// No caption
 	} else if (getGameType() == GType_FF) {
 		f->write(caption, 100);
-		curTime = time(NULL);
 	} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
 		f->write(caption, 18);
 	} else {
@@ -1308,8 +1310,8 @@
 
 	f->writeUint32BE(_itemArrayInited - 1);
 	f->writeUint32BE(0xFFFFFFFF);
+	f->writeUint32BE(curTime);
 	f->writeUint32BE(0);
-	f->writeUint32BE(0);
 
 	i = 0;
 	for (te = _firstTimeStruct; te; te = te->next)

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/script_e2.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/script_e2.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/script_e2.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -165,8 +165,8 @@
 		OPCODE(o_cls),
 		/* 104 */
 		OPCODE(o_closeWindow),
+		OPCODE(oe2_menu),
 		OPCODE(o_invalid),
-		OPCODE(o_invalid),
 		OPCODE(o_addBox),
 		/* 108 */
 		OPCODE(o_delBox),
@@ -333,6 +333,11 @@
 	}
 }
 
+void AGOSEngine_Elvira2::oe2_menu() {
+	// 105: set agos menu
+	_agosMenu = getVarOrByte();
+}
+
 void AGOSEngine_Elvira2::oe2_drawItem() {
 	// 113: draw item
 	Item *i = getNextItemPtr();
@@ -647,6 +652,16 @@
 	// 179: item unk1 unk2 is
 	Item *item = getNextItemPtr();
 	int16 a = getNextWord(), b = getNextWord();
+
+	if (getGameType() == GType_ELVIRA2) {
+		// WORKAROUND: A NULL item can occur when interacting with Wine Bottles
+		if (item == NULL) {
+			warning("Please report where exactly this occurs in Elvira 2");
+			setScriptCondition(false);
+			return;
+		}
+	}
+
 	setScriptCondition(item->adjective == a && item->noun == b);
 }
 

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/script_ww.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/script_ww.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/script_ww.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -167,7 +167,7 @@
 		OPCODE(o_cls),
 		/* 104 */
 		OPCODE(o_closeWindow),
-		OPCODE(oww_menu),
+		OPCODE(oe2_menu),
 		OPCODE(oww_textMenu),
 		OPCODE(o_addBox),
 		/* 108 */
@@ -355,11 +355,6 @@
 		_objectItem = derefItem(getExitOf(i, d));
 }
 
-void AGOSEngine_Waxworks::oww_menu() {
-	// 105: set agos menu
-	_agosMenu = getVarOrByte();
-}
-
 void AGOSEngine_Waxworks::oww_textMenu() {
 	// 106: set text menu
 	byte slot = getVarOrByte();

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/sound.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/sound.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/sound.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -292,7 +292,9 @@
 
 	uint32 size = _offsets[sound + i] - _offsets[sound];
 
-	return Audio::makeMP3Stream(_file, size);
+	Common::MemoryReadStream *tmp = _file->readStream(size);
+	assert(tmp);
+	return Audio::makeMP3Stream(tmp, true);
 }
 
 void MP3Sound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
@@ -321,7 +323,9 @@
 
 	uint32 size = _offsets[sound + i] - _offsets[sound];
 
-	return Audio::makeVorbisStream(_file, size);
+	Common::MemoryReadStream *tmp = _file->readStream(size);
+	assert(tmp);
+	return Audio::makeVorbisStream(tmp, true);
 }
 
 void VorbisSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
@@ -350,7 +354,9 @@
 
 	uint32 size = _offsets[sound + i] - _offsets[sound];
 
-	return Audio::makeFlacStream(_file, size);
+	Common::MemoryReadStream *tmp = _file->readStream(size);
+	assert(tmp);
+	return Audio::makeFlacStream(tmp, true);
 }
 
 void FlacSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/string.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/string.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/string.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -370,10 +370,12 @@
 	if (y < 2)
 		y = 2;
 
-	if (getGameType() == GType_SIMON1)
-		animate(windowNum, 2, 199 + vgaSpriteId, x, y, 12);
-	else
+	if (getGameType() == GType_SIMON1) {
+		uint16 id = 199 + vgaSpriteId;
+		animate(windowNum, id / 100, id, x, y, 12);
+	} else {
 		animate(windowNum, 2, vgaSpriteId, x, y, 12);
+	}
 }
 
 // The Feeble Files specific

Modified: scummvm/branches/gsoc2007-mixer/engines/agos/vga.h
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/agos/vga.h	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/agos/vga.h	2007-07-22 14:43:53 UTC (rev 28164)
@@ -40,20 +40,20 @@
 	uint16 x_4;
 	uint16 animationTable;
 	uint16 x_5;
-};
+} PACKED_STRUCT;
 
 struct ImageHeader_Feeble {
 	uint16 id;
 	uint16 x_1;
 	uint16 scriptOffs;
 	uint16 x_2;
-};
+} PACKED_STRUCT;
 
 struct AnimationHeader_Feeble {
 	uint16 scriptOffs;
 	uint16 x_2;
 	uint16 id;
-};
+} PACKED_STRUCT;
 
 // Simon 1/2
 struct ImageHeader_Simon {
@@ -61,13 +61,13 @@
 	uint16 color;
 	uint16 x_2;
 	uint16 scriptOffs;
-};
+} PACKED_STRUCT;
 
 struct AnimationHeader_Simon {
 	uint16 id;
 	uint16 x_2;
 	uint16 scriptOffs;
-};
+} PACKED_STRUCT;
 
 
 // Elvira 1/2 and Waxworks
@@ -76,14 +76,14 @@
 	uint16 color;
 	uint16 x_2;
 	uint16 scriptOffs;
-};
+} PACKED_STRUCT;
 
 struct AnimationHeader_WW {
 	uint16 id;
 	uint16 x_1;
 	uint16 x_2;
 	uint16 scriptOffs;
-};
+} PACKED_STRUCT;
 
 // Common
 struct VgaFileHeader2_Common {
@@ -96,7 +96,7 @@
 	uint16 x_4;
 	uint16 animationTable;
 	uint16 x_5;
-};
+} PACKED_STRUCT;
 
 #include "common/pack-end.h"	// END STRUCT PACKING
 

Modified: scummvm/branches/gsoc2007-mixer/engines/cine/various.cpp
===================================================================
--- scummvm/branches/gsoc2007-mixer/engines/cine/various.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/cine/various.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -2458,6 +2458,7 @@
 
 void drawOverlays(void) {
 	overlayHeadElement *currentOverlay;
+	overlayHeadElement *nextOverlay;
 
 	backupOverlayPage();
 
@@ -2468,6 +2469,8 @@
 	currentOverlay = currentOverlay->next;
 
 	while (currentOverlay) {
+		nextOverlay = currentOverlay->next;
+
 		switch (currentOverlay->type) {
 		case 0:	// sprite
 			{
@@ -2630,7 +2633,7 @@
 			}
 		}
 
-		currentOverlay = currentOverlay->next;
+		currentOverlay = nextOverlay;
 	}
 }
 

Copied: scummvm/branches/gsoc2007-mixer/engines/drascula (from rev 28163, scummvm/trunk/engines/drascula)


Property changes on: scummvm/branches/gsoc2007-mixer/engines/drascula
___________________________________________________________________
Name: svn:ignore
   + .deps
*.o
lib*.a


Deleted: scummvm/branches/gsoc2007-mixer/engines/drascula/detection.cpp
===================================================================
--- scummvm/trunk/engines/drascula/detection.cpp	2007-07-22 11:54:35 UTC (rev 28163)
+++ scummvm/branches/gsoc2007-mixer/engines/drascula/detection.cpp	2007-07-22 14:43:53 UTC (rev 28164)
@@ -1,183 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-
-#include "base/plugins.h"
-
-#include "common/advancedDetector.h"
-#include "common/file.h"
-
-#include "drascula/drascula.h"
-
-
-namespace Drascula {
-
-struct DrasculaGameDescription {
-	Common::ADGameDescription desc;
-
-	int gameID;
-	int gameType;
-	uint32 features;
-	uint16 version;
-};
-
-uint32 DrasculaEngine::getGameID() const {
-	return _gameDescription->gameID;
-}
-
-uint32 DrasculaEngine::getFeatures() const {
-	return _gameDescription->features;
-}
-
-Common::Platform DrasculaEngine::getPlatform() const {
-	return _gameDescription->desc.platform;
-}
-
-uint16 DrasculaEngine::getVersion() const {
-	return _gameDescription->version;
-}
-
-}
-
-static const PlainGameDescriptor drasculaGames[] = {
-	{"drascula", "Drascula game"},
-
-	{0, 0}
-};
-
-
-namespace Drascula {
-
-static const DrasculaGameDescription gameDescriptions[] = {
-
-	{
-		// Drascula English version
-		{
-			"drascula",
-			"English",
-			AD_ENTRY1("14.ald", "09b2735953edcd43af115c65ae00b10e"),
-			Common::EN_ANY,
-			Common::kPlatformPC,
-			Common::ADGF_NO_FLAGS
-		},
-		0,
-		0,
-		0,
-		0,
-	},
-
-	{
-		// Drascula Spanish version
-		{
-			"drascula",
-			"Spanish",
-			AD_ENTRY1("14.ald", "0746ed1a5cc8d9728f790c29813f4b43"),
-			Common::ES_ESP,
-			Common::kPlatformPC,
-			Common::ADGF_NO_FLAGS
-		},
-		0,
-		0,
-		0,
-		0,
-	},
-
-	{ AD_TABLE_END_MARKER, 0, 0, 0, 0 }
-};
-
-/**
- * The fallback game descriptor used by the Drascula engine's fallbackDetector.
- * Contents of this struct are to be overwritten by the fallbackDetector. 
- */
-static DrasculaGameDescription g_fallbackDesc = {
-	{
-		"", // Not used by the fallback descriptor, it uses the EncapsulatedADGameDesc's gameid
-		"", // Not used by the fallback descriptor, it uses the EncapsulatedADGameDesc's extra
-		AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor
-		Common::UNK_LANG,
-		Common::kPlatformPC,
-		Common::ADGF_NO_FLAGS
-	},
-	0,
-	0,
-	0,
-	0,
-};
-
-Common::EncapsulatedADGameDesc fallbackDetector(const FSList *fslist) {
-	// Set the default values for the fallback descriptor's ADGameDescription part.
-	g_fallbackDesc.desc.language = Common::UNK_LANG;
-	g_fallbackDesc.desc.platform = Common::kPlatformPC;
-	g_fallbackDesc.desc.flags = Common::ADGF_NO_FLAGS;
-
-	// Set default values for the fallback descriptor's DrasculaGameDescription part.
-	g_fallbackDesc.gameID = 0;
-	g_fallbackDesc.features = 0;
-	g_fallbackDesc.version = 0;
-
-	Common::EncapsulatedADGameDesc result;
-
-	return result;
-}
-
-} // End of namespace Drascula
-
-static const Common::ADParams detectionParams = {
-	// Pointer to ADGameDescription or its superset structure
-	(const byte *)Drascula::gameDescriptions,
-	// Size of that superset structure
-	sizeof(Drascula::DrasculaGameDescription),
-	// Number of bytes to compute MD5 sum for
-	5000,
-	// List of all engine targets
-	drasculaGames,
-	// Structure for autoupgrading obsolete targets
-	0,

@@ Diff output truncated at 100000 characters. @@

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