[Scummvm-cvs-logs] SF.net SVN: scummvm:[43291] scummvm/branches/gsoc2009-mods

nolange at users.sourceforge.net nolange at users.sourceforge.net
Wed Aug 12 00:35:57 CEST 2009


Revision: 43291
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43291&view=rev
Author:   nolange
Date:     2009-08-11 22:35:56 +0000 (Tue, 11 Aug 2009)

Log Message:
-----------
merged from trunk (Amiga LoK supposedly completeable!)
fixed a bug I introduced in one of the last cleanups

Modified Paths:
--------------
    scummvm/branches/gsoc2009-mods/NEWS
    scummvm/branches/gsoc2009-mods/backends/platform/gp2x/events.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-common.h
    scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-hw.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-mem.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-mem.h
    scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/gp2x/graphics.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/gp2x/module.mk
    scummvm/branches/gsoc2009-mods/backends/platform/sdl/graphics.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.h
    scummvm/branches/gsoc2009-mods/backends/platform/symbian/BuildPackageUpload_AllVersions.pl
    scummvm/branches/gsoc2009-mods/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
    scummvm/branches/gsoc2009-mods/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
    scummvm/branches/gsoc2009-mods/backends/platform/symbian/mmp/scummvm_base.mmp.in
    scummvm/branches/gsoc2009-mods/backends/platform/symbian/src/SymbianActions.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/wince/Makefile
    scummvm/branches/gsoc2009-mods/backends/platform/wince/README-WinCE.txt
    scummvm/branches/gsoc2009-mods/base/commandLine.cpp
    scummvm/branches/gsoc2009-mods/configure
    scummvm/branches/gsoc2009-mods/dists/engine-data/kyra.dat
    scummvm/branches/gsoc2009-mods/dists/msvc8/ScummVM_Global.vsprops
    scummvm/branches/gsoc2009-mods/dists/msvc9/ScummVM_Global.vsprops
    scummvm/branches/gsoc2009-mods/engines/agos/agos.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/agos.h
    scummvm/branches/gsoc2009-mods/engines/agos/animation.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/animation.h
    scummvm/branches/gsoc2009-mods/engines/agos/charset.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/cursor.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/debug.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/detection.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/detection_tables.h
    scummvm/branches/gsoc2009-mods/engines/agos/draw.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/event.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/gfx.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/icons.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/module.mk
    scummvm/branches/gsoc2009-mods/engines/agos/res.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/rooms.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/saveload.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/string.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/subroutine.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/verb.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/vga.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/vga_e2.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/vga_ff.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/vga_pn.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/vga_s1.cpp
    scummvm/branches/gsoc2009-mods/engines/agos/window.cpp
    scummvm/branches/gsoc2009-mods/engines/cruise/cruise.cpp
    scummvm/branches/gsoc2009-mods/engines/cruise/cruise.h
    scummvm/branches/gsoc2009-mods/engines/cruise/staticres.cpp
    scummvm/branches/gsoc2009-mods/engines/engines.mk
    scummvm/branches/gsoc2009-mods/engines/gob/draw_v2.cpp
    scummvm/branches/gsoc2009-mods/engines/gob/game.cpp
    scummvm/branches/gsoc2009-mods/engines/gob/game.h
    scummvm/branches/gsoc2009-mods/engines/gob/hotspots.cpp
    scummvm/branches/gsoc2009-mods/engines/gob/inter_v2.cpp
    scummvm/branches/gsoc2009-mods/engines/gob/inter_v4.cpp
    scummvm/branches/gsoc2009-mods/engines/gob/inter_v6.cpp
    scummvm/branches/gsoc2009-mods/engines/gob/mult_v2.cpp
    scummvm/branches/gsoc2009-mods/engines/gob/save/saveload_playtoons.cpp
    scummvm/branches/gsoc2009-mods/engines/gob/util.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/gui.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/gui_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/items_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/kyra_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/kyra_lok.h
    scummvm/branches/gsoc2009-mods/engines/kyra/lol.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/lol.h
    scummvm/branches/gsoc2009-mods/engines/kyra/saveload_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/scene_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/screen.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/screen.h
    scummvm/branches/gsoc2009-mods/engines/kyra/screen_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/screen_lok.h
    scummvm/branches/gsoc2009-mods/engines/kyra/script_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/seqplayer.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/sequences_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/sound_amiga.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/sprites_lol.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/staticres.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/text.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/text.h
    scummvm/branches/gsoc2009-mods/engines/kyra/text_lok.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/wsamovie.cpp
    scummvm/branches/gsoc2009-mods/engines/kyra/wsamovie.h
    scummvm/branches/gsoc2009-mods/engines/sci/console.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/detection.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/game.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/kernel.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/kernel.h
    scummvm/branches/gsoc2009-mods/engines/sci/engine/kevent.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/kgraphics.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/kmisc.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/kstring.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/message.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/scriptdebug.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/state.cpp
    scummvm/branches/gsoc2009-mods/engines/sci/engine/state.h
    scummvm/branches/gsoc2009-mods/engines/sci/engine/vm.cpp
    scummvm/branches/gsoc2009-mods/engines/scumm/detection_tables.h
    scummvm/branches/gsoc2009-mods/engines/scumm/file_nes.cpp
    scummvm/branches/gsoc2009-mods/engines/scumm/file_nes.h
    scummvm/branches/gsoc2009-mods/engines/scumm/gfx.cpp
    scummvm/branches/gsoc2009-mods/engines/scumm/scumm-md5.h
    scummvm/branches/gsoc2009-mods/engines/scumm/sound.cpp
    scummvm/branches/gsoc2009-mods/engines/tinsel/tinlib.cpp
    scummvm/branches/gsoc2009-mods/gui/ThemeEngine.cpp
    scummvm/branches/gsoc2009-mods/gui/ThemeEngine.h
    scummvm/branches/gsoc2009-mods/gui/ThemeParser.cpp
    scummvm/branches/gsoc2009-mods/gui/ThemeParser.h
    scummvm/branches/gsoc2009-mods/gui/saveload.cpp
    scummvm/branches/gsoc2009-mods/gui/themes/default.inc
    scummvm/branches/gsoc2009-mods/gui/themes/scummclassic/THEMERC
    scummvm/branches/gsoc2009-mods/gui/themes/scummclassic/classic_gfx.stx
    scummvm/branches/gsoc2009-mods/gui/themes/scummclassic.zip
    scummvm/branches/gsoc2009-mods/gui/themes/scummmodern/THEMERC
    scummvm/branches/gsoc2009-mods/gui/themes/scummmodern/scummmodern_gfx.stx
    scummvm/branches/gsoc2009-mods/gui/themes/scummmodern.zip
    scummvm/branches/gsoc2009-mods/sound/adpcm.cpp
    scummvm/branches/gsoc2009-mods/tools/create_kyradat/amiga.h
    scummvm/branches/gsoc2009-mods/tools/create_kyradat/create_kyradat.cpp
    scummvm/branches/gsoc2009-mods/tools/scumm-md5.txt

Property Changed:
----------------
    scummvm/branches/gsoc2009-mods/
    scummvm/branches/gsoc2009-mods/backends/platform/iphone/osys_main.cpp
    scummvm/branches/gsoc2009-mods/backends/platform/iphone/osys_main.h
    scummvm/branches/gsoc2009-mods/sound/iff_sound.cpp
    scummvm/branches/gsoc2009-mods/sound/iff_sound.h


Property changes on: scummvm/branches/gsoc2009-mods
___________________________________________________________________
Modified: svn:mergeinfo
   - /scummvm/trunk:41377-43133
   + /scummvm/trunk:41377-43289

Modified: scummvm/branches/gsoc2009-mods/NEWS
===================================================================
--- scummvm/branches/gsoc2009-mods/NEWS	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/NEWS	2009-08-11 22:35:56 UTC (rev 43291)
@@ -58,6 +58,11 @@
    - Added support for PC Speaker based music and sound effects.
    - Added support for 16 color dithering in Kyrandia PC-9801.
 
+ WinCE port:
+    - Speed optimized versions of low-res Smartphone and 2x scalers.
+    - New aspect correction scaler for VGA (or higher) devices.
+    - Dropped support for MPEG-2 and FLAC.
+
 0.13.1 (2009-04-27)
  AGOS:
     - Fixed crash after OmniTV video is played in The Feeble Files.

Modified: scummvm/branches/gsoc2009-mods/backends/platform/gp2x/events.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/gp2x/events.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/gp2x/events.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -93,7 +93,7 @@
 	if (!_overlayVisible) {
 		event.mouse.x /= _videoMode.scaleFactor;
 		event.mouse.y /= _videoMode.scaleFactor;
-		if (_videoMode.aspectRatio)
+		if (_videoMode.aspectRatioCorrection)
 			event.mouse.y = aspect2Real(event.mouse.y);
 	}
 }

Modified: scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-common.h
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-common.h	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-common.h	2009-08-11 22:35:56 UTC (rev 43291)
@@ -42,18 +42,7 @@
 }
 
 enum {
-	GFX_NORMAL = 0,
-	GFX_DOUBLESIZE = 1,
-	GFX_TRIPLESIZE = 2,
-	GFX_2XSAI = 3,
-	GFX_SUPER2XSAI = 4,
-	GFX_SUPEREAGLE = 5,
-	GFX_ADVMAME2X = 6,
-	GFX_ADVMAME3X = 7,
-	GFX_HQ2X = 8,
-	GFX_HQ3X = 9,
-	GFX_TV2X = 10,
-	GFX_DOTMATRIX = 11
+	GFX_NORMAL = 0
 };
 
 
@@ -248,7 +237,7 @@
 		bool setup;
 
 		bool fullscreen;
-		bool aspectRatio;
+		bool aspectRatioCorrection;
 
 		int mode;
 		int scaleFactor;
@@ -274,16 +263,11 @@
 	bool _modeChanged;
 	int _screenChangeCount;
 
-	/** True if aspect ratio correction is enabled. */
-	bool _adjustAspectRatio;
-
-	/** True if zoom on mouse is enabled. (only set by > 240 high games) */
+	/* True if zoom on mouse is enabled. (only set by > 240 high games) */
 	bool _adjustZoomOnMouse;
-	//_adjustZoomOnMouse = false;
 
 	enum {
 		NUM_DIRTY_RECT = 100,
-
 		MAX_MOUSE_W = 80,
 		MAX_MOUSE_H = 80,
 		MAX_SCALING = 3
@@ -332,7 +316,7 @@
 	// mouse
 	KbdMouse _km;
 	bool _mouseVisible;
-	bool _mouseDrawn;
+	bool _mouseNeedsRedraw;
 	byte *_mouseData;
 	SDL_Rect _mouseBackup;
 	MousePos _mouseCurState;
@@ -419,7 +403,7 @@
 	bool saveScreenshot(const char *filename);
 
 	int effectiveScreenHeight() const {
-		return (_videoMode.aspectRatio ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight)
+		return (_videoMode.aspectRatioCorrection ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight)
 			* _videoMode.scaleFactor;
 	}
 

Modified: scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-hw.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-hw.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-hw.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -56,7 +56,7 @@
 	VOLUME_UP				= 2,
 	VOLUME_CHANGE_RATE		= 8,
 	VOLUME_MIN				= 0,
-	VOLUME_INITIAL			= 70,
+	VOLUME_INITIAL			= 60,
 	VOLUME_MAX				= 100
 };
 

Modified: scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-mem.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-mem.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-mem.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <string.h>
 
-#include "gp2x-mem.h"
+#include "backends/platform/gp2x/gp2x-mem.h"
 
 void SetClock (unsigned c)
 {

Modified: scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-mem.h
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-mem.h	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x-mem.h	2009-08-11 22:35:56 UTC (rev 43291)
@@ -35,7 +35,6 @@
 extern "C" {
 #endif
 
-
 // Use Squidge's MMU patch rather then myown (his is neater).
 // The effect if not that great but cacheing the upper RAM is no bad thing (tm) ;).
 

Modified: scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/gp2x/gp2x.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -131,8 +131,6 @@
 
 	ConfMan.registerDefault("savepath", savePath);
 
-	_savefile = new DefaultSaveFileManager(savePath);
-
 	#ifdef DUMP_STDOUT
 		// The GP2X has a serial console but most users do not use this so we
 		// output all our STDOUT and STDERR to files for debug purposes.
@@ -186,9 +184,9 @@
 	ConfMan.registerDefault("aspect_ratio", true);
 
 	/* Up default volume values as we use a seperate system level volume anyway. */
-	ConfMan.registerDefault("music_volume", 220);
-	ConfMan.registerDefault("sfx_volume", 220);
-	ConfMan.registerDefault("speech_volume", 220);
+	ConfMan.registerDefault("music_volume", 192);
+	ConfMan.registerDefault("sfx_volume", 192);
+	ConfMan.registerDefault("speech_volume", 192);
 	ConfMan.registerDefault("autosave_period", 3 * 60);	// Trigger autosave every 3 minutes - On low batts 4 mins is about your warning time.
 
 	memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
@@ -199,7 +197,7 @@
 	_videoMode.mode = GFX_NORMAL;
 	_videoMode.scaleFactor = 1;
 	_scalerProc = Normal1x;
-	_videoMode.aspectRatio  = ConfMan.getBool("aspect_ratio");
+	_videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
 	_scalerType = 0;
 	_modeFlags = 0;
 	_adjustZoomOnMouse = false;
@@ -210,17 +208,13 @@
 		_joystick = SDL_JoystickOpen(joystick_num);
 	}
 
+	_savefile = new DefaultSaveFileManager();
 	// Create and hook up the mixer, if none exists yet (we check for this to
 	// allow subclasses to provide their own).
 	if (_mixer == 0) {
 		setupMixer();
 	}
 
-	// Setup the keymapper with backend's set of keys
-	// NOTE: must be done before creating TimerManager
-	// to avoid race conditions in creating EventManager
-	setupKeymapper();
-
 	// Create and hook up the timer manager, if none exists yet (we check for
 	// this to allow subclasses to provide their own).
 	if (_timer == 0) {
@@ -241,27 +235,6 @@
 	/* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */
 	GP2X_HW::mixerMoveVolume(0);
 
-	// Set Default hardware mixer volume to a plesent level.
-	// This is done to 'reset' volume level if set by other apps.
-
-	//if (SDL_GP2X_MouseType() == 0) {
-	//	// No mouse, F100 default state.
-	//	_gp2xInputType = 0;
-	//	displayMessageOnOSD("F100 GP2X Found");
-	//}
-
-	//if (SDL_GP2X_MouseType() == 1) {
-	//	// USB mouse found.
-	//	_gp2xInputType = 1;
-	//	displayMessageOnOSD("USB Mouse Found");
-	//}
-
-	//if (SDL_GP2X_MouseType() == 2) {
-	//	// F200 touch screen found. - F200 default state.
-	//	_gp2xInputType = 2;
-	//	displayMessageOnOSD("Touch Screen Found");
-	//}
-
 	OSystem::initBackend();
 
 	_inited = true;
@@ -275,7 +248,7 @@
 	_overlayscreen(0), _tmpscreen2(0),
 	_samplesPerSec(0),
 	_cdrom(0), _scalerProc(0), _modeChanged(false), _screenChangeCount(0), _dirtyChecksums(0),
-	_mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseSurface(0),
+	_mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0),
 	_mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
 	_joystick(0),
 	_currentShakePos(0), _newShakePos(0),
@@ -434,7 +407,7 @@
 	case kFeatureFullscreenMode:
 		return false;
 	case kFeatureAspectRatioCorrection:
-		return _videoMode.aspectRatio;
+		return _videoMode.aspectRatioCorrection;
 	case kFeatureAutoComputeDirtyRects:
 		return _modeFlags & DF_WANT_RECT_OPTIM;
 	default:
@@ -458,12 +431,12 @@
 	free(_cursorPalette);
 	free(_mouseData);
 
-	delete _savefile;
 	delete _timer;
 	SDL_ShowCursor(SDL_ENABLE);
 	SDL_Quit();
 
 	delete getEventManager();
+	delete _savefile;
 
 	#ifdef DUMP_STDOUT
 		printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
@@ -610,7 +583,7 @@
 		_samplesPerSec = SAMPLES_PER_SEC;
 
 	//Quick EVIL Hack - DJWillis
-	_samplesPerSec = 11025;
+//	_samplesPerSec = 11025;
 
 	// Determine the sample buffer size. We want it to store enough data for
 	// about 1/16th of a second. Note that it must be a power of two.

Modified: scummvm/branches/gsoc2009-mods/backends/platform/gp2x/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/gp2x/graphics.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/gp2x/graphics.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -37,7 +37,7 @@
 #include "graphics/surface.h"
 
 static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
-	{"GP2X Graphics Mode", "1x", GFX_NORMAL},
+	{"Fullscreen", "1x", GFX_NORMAL},
 	{0, 0, 0}
 };
 
@@ -50,14 +50,7 @@
 };
 
 static const int s_gfxModeSwitchTable[][4] = {
-		{ GFX_NORMAL, GFX_DOUBLESIZE, GFX_TRIPLESIZE, -1 },
-		{ GFX_NORMAL, GFX_ADVMAME2X, GFX_ADVMAME3X, -1 },
-		{ GFX_NORMAL, GFX_HQ2X, GFX_HQ3X, -1 },
-		{ GFX_NORMAL, GFX_2XSAI, -1, -1 },
-		{ GFX_NORMAL, GFX_SUPER2XSAI, -1, -1 },
-		{ GFX_NORMAL, GFX_SUPEREAGLE, -1, -1 },
-		{ GFX_NORMAL, GFX_TV2X, -1, -1 },
-		{ GFX_NORMAL, GFX_DOTMATRIX, -1, -1 }
+		{ GFX_NORMAL }
 	};
 
 static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY);
@@ -95,10 +88,10 @@
 			errors |= kTransactionFullscreenFailed;
 
 			_videoMode.fullscreen = _oldVideoMode.fullscreen;
-		} else if (_videoMode.aspectRatio != _oldVideoMode.aspectRatio) {
+		} else if (_videoMode.aspectRatioCorrection != _oldVideoMode.aspectRatioCorrection) {
 			errors |= kTransactionAspectRatioFailed;
 
-			_videoMode.aspectRatio = _oldVideoMode.aspectRatio;
+			_videoMode.aspectRatioCorrection = _oldVideoMode.aspectRatioCorrection;
 		} else if (_videoMode.mode != _oldVideoMode.mode) {
 			errors |= kTransactionModeSwitchFailed;
 
@@ -114,7 +107,7 @@
 		}
 
 		if (_videoMode.fullscreen == _oldVideoMode.fullscreen &&
-			_videoMode.aspectRatio == _oldVideoMode.aspectRatio &&
+			_videoMode.aspectRatioCorrection == _oldVideoMode.aspectRatioCorrection &&
 			_videoMode.mode == _oldVideoMode.mode &&
 			_videoMode.screenWidth == _oldVideoMode.screenWidth &&
 		   	_videoMode.screenHeight == _oldVideoMode.screenHeight) {
@@ -190,45 +183,6 @@
 	case GFX_NORMAL:
 		newScaleFactor = 1;
 		break;
-#ifndef DISABLE_SCALERS
-	case GFX_DOUBLESIZE:
-		newScaleFactor = 2;
-		break;
-	case GFX_TRIPLESIZE:
-		newScaleFactor = 3;
-		break;
-
-	case GFX_2XSAI:
-		newScaleFactor = 2;
-		break;
-	case GFX_SUPER2XSAI:
-		newScaleFactor = 2;
-		break;
-	case GFX_SUPEREAGLE:
-		newScaleFactor = 2;
-		break;
-	case GFX_ADVMAME2X:
-		newScaleFactor = 2;
-		break;
-	case GFX_ADVMAME3X:
-		newScaleFactor = 3;
-		break;
-#ifndef DISABLE_HQ_SCALERS
-	case GFX_HQ2X:
-		newScaleFactor = 2;
-		break;
-	case GFX_HQ3X:
-		newScaleFactor = 3;
-		break;
-#endif
-	case GFX_TV2X:
-		newScaleFactor = 2;
-		break;
-	case GFX_DOTMATRIX:
-		newScaleFactor = 2;
-		break;
-#endif // DISABLE_SCALERS
-
 	default:
 		warning("unknown gfx mode %d", mode);
 		return false;
@@ -246,7 +200,6 @@
 	return true;
 }
 
-
 void OSystem_GP2X::setGraphicsModeIntern() {
 	Common::StackLock lock(_graphicsMutex);
 	ScalerProc *newScalerProc = 0;
@@ -255,45 +208,7 @@
 	case GFX_NORMAL:
 		newScalerProc = Normal1x;
 		break;
-#ifndef DISABLE_SCALERS
-	case GFX_DOUBLESIZE:
-		newScalerProc = Normal2x;
-		break;
-	case GFX_TRIPLESIZE:
-		newScalerProc = Normal3x;
-		break;
 
-	case GFX_2XSAI:
-		newScalerProc = _2xSaI;
-		break;
-	case GFX_SUPER2XSAI:
-		newScalerProc = Super2xSaI;
-		break;
-	case GFX_SUPEREAGLE:
-		newScalerProc = SuperEagle;
-		break;
-	case GFX_ADVMAME2X:
-		newScalerProc = AdvMame2x;
-		break;
-	case GFX_ADVMAME3X:
-		newScalerProc = AdvMame3x;
-		break;
-#ifndef DISABLE_HQ_SCALERS
-	case GFX_HQ2X:
-		newScalerProc = HQ2x;
-		break;
-	case GFX_HQ3X:
-		newScalerProc = HQ3x;
-		break;
-#endif
-	case GFX_TV2X:
-		newScalerProc = TV2x;
-		break;
-	case GFX_DOTMATRIX:
-		newScalerProc = DotMatrix;
-		break;
-#endif // DISABLE_SCALERS
-
 	default:
 		error("Unknown gfx mode %d", _videoMode.mode);
 	}
@@ -353,18 +268,28 @@
 	_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
 
 	if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
-		_videoMode.aspectRatio = false;
+		_videoMode.aspectRatioCorrection = false;
 
-	if (_videoMode.aspectRatio)
+	if (_videoMode.aspectRatioCorrection)
 		_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
 
 	hwW = _videoMode.screenWidth * _videoMode.scaleFactor;
-	hwH = effectiveScreenHeight();
 
+	if (_videoMode.screenHeight == 200) {
+		hwH = 240;
+	} else if (_videoMode.screenHeight == 400) {
+		hwH = 480;
+	} else {
+		hwH = _videoMode.screenHeight;
+	}
+
+	printf ("Game Screen Height: %d\n", hwH);
+
 	//
-	// Create the surface that contains the 8 bit game data
+	// Create the surface that contains the game data
 	//
-	_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight, 8, 0, 0, 0, 0);
+
+	_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, hwH, 8, 0, 0, 0, 0);
 	if (_screen == NULL)
 		error("allocating _screen failed");
 
@@ -372,9 +297,7 @@
 	// Create the surface that contains the scaled graphics in 16 bit mode
 	//
 
-	_hwscreen = SDL_SetVideoMode(hwW, hwH, 16,
-		_videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
-	);
+	_hwscreen = SDL_SetVideoMode(hwW, hwH, 16, SDL_SWSURFACE | SDL_NOFRAME | SDL_FULLSCREEN);
 	if (_hwscreen == NULL) {
 		// DON'T use error(), as this tries to bring up the debug
 		// console, which WON'T WORK now that _hwscreen is hosed.
@@ -395,12 +318,6 @@
 	// Create the surface used for the graphics in 16 bit before scaling, and also the overlay
 	//
 
-	// Distinguish 555 and 565 mode
-	if (_hwscreen->format->Rmask == 0x7C00)
-		InitScalers(555);
-	else
-		InitScalers(565);
-
 	// Need some extra bytes around when using 2xSaI
 	_tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3,
 						16,
@@ -462,6 +379,12 @@
 	_km.delay_time = 25;
 	_km.last_time = 0;
 
+	// Distinguish 555 and 565 mode
+	if (_hwscreen->format->Rmask == 0x7C00)
+		InitScalers(555);
+	else
+		InitScalers(565);
+
 	return true;
 }
 
@@ -571,7 +494,7 @@
 	if (_currentShakePos != _newShakePos) {
 		SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
 
-		if (_videoMode.aspectRatio && !_overlayVisible)
+		if (_videoMode.aspectRatioCorrection && !_overlayVisible)
 			blackrect.h = real2Aspect(blackrect.h - 1) + 1;
 
 		SDL_FillRect(_hwscreen, &blackrect, 0);
@@ -627,6 +550,11 @@
 		scale1 = 1;
 	}
 
+	// Add the area covered by the mouse cursor to the list of dirty rects if
+	// we have to redraw the mouse.
+	if (_mouseNeedsRedraw)
+		undrawMouse();
+
 	// Force a full redraw if requested
 	if (_forceFull) {
 		_numDirtyRects = 1;
@@ -634,12 +562,10 @@
 		_dirtyRectList[0].y = 0;
 		_dirtyRectList[0].w = width;
 		_dirtyRectList[0].h = height;
-	} else
-		undrawMouse();
+	}
 
 	// Only draw anything if necessary
-	if (_numDirtyRects > 0) {
-
+	if (_numDirtyRects > 0 || _mouseNeedsRedraw) {
 		SDL_Rect *r;
 		SDL_Rect dst;
 		uint32 srcPitch, dstPitch;
@@ -647,7 +573,7 @@
 
 			for (r = _dirtyRectList; r != lastRect; ++r) {
 				dst = *r;
-				dst.x++;	// Shift rect by one since 2xSai needs to acces the data around
+				dst.x++;	// Shift rect by one since 2xSai needs to access the data around
 				dst.y++;	// any pixel to scale it, and we want to avoid mem access crashes.
 
 				if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
@@ -674,7 +600,7 @@
 					orig_dst_y = dst_y;
 					dst_y = dst_y * scale1;
 
-				if (_videoMode.aspectRatio && !_overlayVisible)
+				if (_videoMode.aspectRatioCorrection && !_overlayVisible)
 						dst_y = real2Aspect(dst_y);
 
 					assert(scalerProc != NULL);
@@ -687,10 +613,8 @@
 				r->w = r->w * scale1;
 				r->h = dst_h * scale1;
 
-#ifndef DISABLE_SCALERS
-			if (_videoMode.aspectRatio && orig_dst_y < height && !_overlayVisible)
+			if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible)
 					r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1);
-#endif
 			}
 			SDL_UnlockSurface(srcSurf);
 			SDL_UnlockSurface(_hwscreen);
@@ -710,14 +634,11 @@
 
 		// Finally, blit all our changes to the screen
 		SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
-	} else {
-		drawMouse();
-		if (_numDirtyRects)
-			SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
 	}
 
 	_numDirtyRects = 0;
 	_forceFull = false;
+	_mouseNeedsRedraw = false;
 }
 
 bool OSystem_GP2X::saveScreenshot(const char *filename) {
@@ -740,18 +661,14 @@
 }
 
 void OSystem_GP2X::setAspectRatioCorrection(bool enable) {
-	if ((_videoMode.screenHeight == 200 && _videoMode.aspectRatio != enable) ||
-		_transactionMode == kTransactionActive) {
+	Common::StackLock lock(_graphicsMutex);
 
-		Common::StackLock lock(_graphicsMutex);
+	if (_oldVideoMode.setup && _oldVideoMode.aspectRatioCorrection == enable)
+		return;
 
-		if (_oldVideoMode.setup && _oldVideoMode.aspectRatio == enable)
-			return;
-
-		if (_transactionMode == kTransactionActive) {
-			_videoMode.aspectRatio = enable;
-			_transactionDetails.needHotswap = true;
-		}
+	if (_transactionMode == kTransactionActive) {
+		_videoMode.aspectRatioCorrection = enable;
+		_transactionDetails.needHotswap = true;
 	}
 }
 
@@ -776,12 +693,12 @@
 
 	Common::StackLock lock(_graphicsMutex);	// Lock the mutex until this function ends
 
-//	assert(x >= 0 && x < _screenWidth);
-//	assert(y >= 0 && y < _screenHeight);
-//	assert(h > 0 && y + h <= _screenHeight);
-//	assert(w > 0 && x + w <= _screenWidth);
+	assert(x >= 0 && x < _videoMode.screenWidth);
+	assert(y >= 0 && y < _videoMode.screenHeight);
+	assert(h > 0 && y + h <= _videoMode.screenHeight);
+	assert(w > 0 && x + w <= _videoMode.screenWidth);
 
-	if (((long)src & 3) == 0 && pitch == _videoMode.screenWidth && x == 0 && y == 0 &&
+	if (IS_ALIGNED(src, 4) && pitch == _videoMode.screenWidth && x == 0 && y == 0 &&
 			w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) {
 		/* Special, optimized case for full screen updates.
 		 * It tries to determine what areas were actually changed,
@@ -923,7 +840,7 @@
 		h = height - y;
 	}
 
-	if (_videoMode.aspectRatio && !_overlayVisible && !realCoordinates) {
+	if (_videoMode.aspectRatioCorrection && !_overlayVisible && !realCoordinates) {
 		makeRectStretchable(x, y, w, h);
 	}
 
@@ -982,7 +899,7 @@
 
 void OSystem_GP2X::addDirtyRgnAuto(const byte *buf) {
 	assert(buf);
-	assert(((long)buf & 3) == 0);
+	assert(IS_ALIGNED(buf, 4));
 
 	/* generate a table of the checksums */
 	makeChecksums(buf);
@@ -1115,7 +1032,7 @@
 	// Since resolution could change, put mouse to adjusted position
 	// Fixes bug #1349059
 	x = _mouseCurState.x * _videoMode.scaleFactor;
-	if (_videoMode.aspectRatio)
+	if (_videoMode.aspectRatioCorrection)
 		y = real2Aspect(_mouseCurState.y) * _videoMode.scaleFactor;
 	else
 		y = _mouseCurState.y * _videoMode.scaleFactor;
@@ -1139,7 +1056,7 @@
 	// Fixes bug #1349059
 	x = _mouseCurState.x / _videoMode.scaleFactor;
 	y = _mouseCurState.y / _videoMode.scaleFactor;
-	if (_videoMode.aspectRatio)
+	if (_videoMode.aspectRatioCorrection)
 		y = aspect2Real(y);
 
 	warpMouse(x, y);
@@ -1172,7 +1089,7 @@
 	(byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight);
 
 #ifndef DISABLE_SCALERS
-	if (_videoMode.aspectRatio)
+	if (_videoMode.aspectRatioCorrection)
 		stretch200To240((uint8 *)_overlayscreen->pixels, _overlayscreen->pitch,
 						_videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0);
 #endif
@@ -1259,12 +1176,14 @@
 
 	bool last = _mouseVisible;
 	_mouseVisible = visible;
+	_mouseNeedsRedraw = true;
 
 	return last;
 }
 
 void OSystem_GP2X::setMousePos(int x, int y) {
 	if (x != _mouseCurState.x || y != _mouseCurState.y) {
+		_mouseNeedsRedraw = true;
 		_mouseCurState.x = x;
 		_mouseCurState.y = y;
 	}
@@ -1273,7 +1192,7 @@
 void OSystem_GP2X::warpMouse(int x, int y) {
 	int y1 = y;
 
-	if (_adjustAspectRatio && !_overlayVisible)
+	if (_videoMode.aspectRatioCorrection && !_overlayVisible)
 		y1 = real2Aspect(y);
 
 	if (_mouseCurState.x != x || _mouseCurState.y != y) {
@@ -1342,6 +1261,8 @@
 	if (!_mouseOrigSurface || !_mouseData)
 		return;
 
+	_mouseNeedsRedraw = true;
+
 	w = _mouseCurState.w;
 	h = _mouseCurState.h;
 
@@ -1422,7 +1343,7 @@
 
 	int rH1 = rH; // store original to pass to aspect-correction function later
 
-	if (_videoMode.aspectRatio && _cursorTargetScale == 1) {
+	if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1) {
 		rH = real2Aspect(rH - 1) + 1;
 		_mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY);
 	}
@@ -1453,20 +1374,17 @@
 
 	ScalerProc *scalerProc;
 
-	// If possible, use the same scaler for the cursor as for the rest of
-	// the game. This only works well with the non-blurring scalers so we
-	// actually only use the 1x, 1.5x, 2x and AdvMame scalers.
-
-	if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE))
-		scalerProc = _scalerProc;
-	else
+	if (_cursorTargetScale == 1 && _videoMode.screenWidth > 320) {
+		scalerProc = scalersMagn[_cursorTargetScale + 1][_videoMode.scaleFactor + 1];
+	} else {
 		scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1];
+	}
 
 	scalerProc((byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2,
 		_mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch,
 		_mouseCurState.w, _mouseCurState.h);
 
-	if (_videoMode.aspectRatio && _cursorTargetScale == 1)
+	if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1)
 		cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0);
 
 	SDL_UnlockSurface(_mouseSurface);
@@ -1506,9 +1424,8 @@
 
 	// When we switch bigger overlay off mouse jumps. Argh!
 	// This is intended to prevent undrawing offscreen mouse
-	if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight)) {
+	if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight))
 		return;
-	}
 
 	if (_mouseBackup.w != 0 && _mouseBackup.h != 0)
 		addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h);
@@ -1575,7 +1492,7 @@
 		dst.y += _currentShakePos;
 	}
 
-	if (_videoMode.aspectRatio && !_overlayVisible)
+	if (_videoMode.aspectRatioCorrection && !_overlayVisible)
 		dst.y = real2Aspect(dst.y);
 
 	dst.x = scale * dst.x - _mouseCurState.rHotX;
@@ -1584,7 +1501,6 @@
 	dst.h = _mouseCurState.rH;
 
 	// Hacking about with the zoom around mouse pointer stuff.
-
 	if (_adjustZoomOnMouse == true){
 
 		zoomdst.w = (tmpScreenWidth / 2);
@@ -1623,7 +1539,6 @@
 		SDL_GP2X_Display(&zoomdst);
 	};
 
-
 	// Note that SDL_BlitSurface() and addDirtyRect() will both perform any
 	// clipping necessary
 
@@ -1730,10 +1645,10 @@
 	// Ctrl-Alt-a toggles aspect ratio correction
 	if (key.keysym.sym == 'a') {
 		beginGFXTransaction();
-			setFeatureState(kFeatureAspectRatioCorrection, !_videoMode.aspectRatio);
+			setFeatureState(kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection);
 		endGFXTransaction();
 		char buffer[128];
-		if (_videoMode.aspectRatio)
+		if (_videoMode.aspectRatioCorrection)
 			sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d",
 				_videoMode.screenWidth, _videoMode.screenHeight,
 				_hwscreen->w, _hwscreen->h

Modified: scummvm/branches/gsoc2009-mods/backends/platform/gp2x/module.mk
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/gp2x/module.mk	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/gp2x/module.mk	2009-08-11 22:35:56 UTC (rev 43291)
@@ -6,8 +6,6 @@
 	events.o \
 	graphics.o \
 	gp2x.o \
-#	gp2x-options.o \
-#	overload_help.o \
 
 MODULE_DIRS += \
 	backends/platform/gp2x/


Property changes on: scummvm/branches/gsoc2009-mods/backends/platform/iphone/osys_main.cpp
___________________________________________________________________
Modified: svn:mergeinfo
   - /scummvm/trunk/backends/platform/iphone/osys_main.cpp:42569-43133
   + /scummvm/trunk/backends/platform/iphone/osys_main.cpp:42569-43289


Property changes on: scummvm/branches/gsoc2009-mods/backends/platform/iphone/osys_main.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /scummvm/trunk/backends/platform/iphone/osys_main.h:42569-43133
   + /scummvm/trunk/backends/platform/iphone/osys_main.h:42569-43289

Modified: scummvm/branches/gsoc2009-mods/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/sdl/graphics.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/sdl/graphics.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -358,12 +358,54 @@
 	_dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32));
 }
 
+
+static void fixupResolutionForAspectRatio(AspectRatio desiredAspectRatio, int &width, int &height) {
+	assert(&width != &height);
+
+	if (desiredAspectRatio.isAuto())
+		return;
+	
+	int kw = desiredAspectRatio.kw();
+	int kh = desiredAspectRatio.kh();
+
+	const int w = width;
+	const int h = height;
+
+	SDL_Rect const* const*availableModes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_SWSURFACE); //TODO : Maybe specify a pixel format
+	assert(availableModes);
+
+	const SDL_Rect *bestMode = NULL;
+	uint bestMetric = (uint)-1; // Metric is wasted space
+	while (const SDL_Rect *mode = *availableModes++) {
+		if (mode->w < w)
+			continue;
+		if (mode->h < h)
+			continue;
+		if (mode->h * kw != mode->w * kh)
+			continue;
+		//printf("%d %d\n", mode->w, mode->h);
+
+		uint metric = mode->w * mode->h - w * h;
+		if (metric > bestMetric)
+			continue;
+
+		bestMetric = metric;
+		bestMode = mode;
+	}
+
+	if (!bestMode) {
+		warning("Unable to enforce the desired aspect ratio!");
+		return;
+	}
+	//printf("%d %d\n", bestMode->w, bestMode->h);
+	width = bestMode->w;
+	height = bestMode->h;
+}
+
 bool OSystem_SDL::loadGFXMode() {
 	assert(_inited);
 	_forceFull = true;
 
-	int hwW, hwH;
-
 #if !defined(__MAEMO__) && !defined(GP2XWIZ)
 	_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
 	_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
@@ -374,11 +416,11 @@
 	if (_videoMode.aspectRatioCorrection)
 		_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
 
-	hwW = _videoMode.screenWidth * _videoMode.scaleFactor;
-	hwH = effectiveScreenHeight();
+	_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+	_videoMode.hardwareHeight = effectiveScreenHeight();
 #else
-	hwW = _videoMode.overlayWidth;
-	hwH = _videoMode.overlayHeight;
+	_videoMode.hardwareWidth = _videoMode.overlayWidth;
+	_videoMode.hardwareHeight = _videoMode.overlayHeight;
 #endif
 
 	//
@@ -392,7 +434,11 @@
 	// Create the surface that contains the scaled graphics in 16 bit mode
 	//
 
-	_hwscreen = SDL_SetVideoMode(hwW, hwH, 16,
+	if(_videoMode.fullscreen) {
+		fixupResolutionForAspectRatio(_videoMode.desiredAspectRatio, _videoMode.hardwareWidth, _videoMode.hardwareHeight);
+	}
+
+	_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
 		_videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
 	);
 	if (_hwscreen == NULL) {

Modified: scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -85,6 +85,31 @@
 	return interval;
 }
 
+AspectRatio::AspectRatio(int w, int h) {
+	// TODO : Validation and so on...
+	// Currently, we just ensure the program don't instantiate non-supported aspect ratios
+	_kw = w;
+	_kh = h;
+}
+
+static const size_t AR_COUNT = 4;
+static const char*       desiredAspectRatioAsStrings[AR_COUNT] = {            "auto",            "4/3",            "16/9",            "16/10" };
+static const AspectRatio desiredAspectRatios[AR_COUNT]         = { AspectRatio(0, 0), AspectRatio(4,3), AspectRatio(16,9), AspectRatio(16,10) };
+static AspectRatio getDesiredAspectRatio() {
+	//TODO : We could parse an arbitrary string, if we code enough proper validation
+	Common::String desiredAspectRatio = ConfMan.get("desired_screen_aspect_ratio");
+
+	for (size_t i = 0; i < AR_COUNT; i++) {
+		assert(desiredAspectRatioAsStrings[i] != NULL);
+
+		if (!scumm_stricmp(desiredAspectRatio.c_str(), desiredAspectRatioAsStrings[i])) {
+			return desiredAspectRatios[i];
+		}
+	}
+	// TODO : Report a warning
+	return AspectRatio(0, 0);
+}
+
 void OSystem_SDL::initBackend() {
 	assert(!_inited);
 
@@ -124,6 +149,7 @@
 	_videoMode.mode = GFX_DOUBLESIZE;
 	_videoMode.scaleFactor = 2;
 	_videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
+	_videoMode.desiredAspectRatio = getDesiredAspectRatio();
 	_scalerProc = Normal2x;
 #else // for small screen platforms
 	_videoMode.mode = GFX_NORMAL;

Modified: scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.h	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/sdl/sdl.h	2009-08-11 22:35:56 UTC (rev 43291)
@@ -70,7 +70,19 @@
 	GFX_DOTMATRIX = 11
 };
 
+class AspectRatio {
+	int _kw, _kh;
+public:
+	AspectRatio() { _kw = _kh = 0; }
+	AspectRatio(int w, int h);
+ 
+	bool isAuto() const { return (_kw | _kh) == 0; }
+	
+	int kw() const { return _kw; }
+	int kh() const { return _kh; }
+};
 
+
 class OSystem_SDL : public BaseBackend {
 public:
 	OSystem_SDL();
@@ -268,12 +280,14 @@
 
 		bool fullscreen;
 		bool aspectRatioCorrection;
+		AspectRatio desiredAspectRatio;
 
 		int mode;
 		int scaleFactor;
 
 		int screenWidth, screenHeight;
 		int overlayWidth, overlayHeight;
+		int hardwareWidth, hardwareHeight;
 	};
 	VideoState _videoMode, _oldVideoMode;
 

Modified: scummvm/branches/gsoc2009-mods/backends/platform/symbian/BuildPackageUpload_AllVersions.pl
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/symbian/BuildPackageUpload_AllVersions.pl	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/symbian/BuildPackageUpload_AllVersions.pl	2009-08-11 22:35:56 UTC (rev 43291)
@@ -59,6 +59,7 @@
 
 # these macros are always defined:
 $ExtraMacros =  "MACRO		NONSTANDARD_PORT\n";
+$ExtraMacros .=  "MACRO		ENABLE_VKEYBD\n";
 $ExtraMacros .= "MACRO		DISABLE_FANCY_THEMES\n";
 $ExtraMacros .= "MACRO		DISABLE_SCALERS\n";
 $ExtraMacros .= "MACRO		DISABLE_HQ_SCALERS\n";

Modified: scummvm/branches/gsoc2009-mods/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg	2009-08-11 22:35:56 UTC (rev 43291)
@@ -63,6 +63,8 @@
 "..\..\..\..\dists\engine-data\igor.tbl"-"c:\data\scummvm\igor.tbl"
 "..\..\..\..\dists\engine-data\lure.dat"-"c:\data\scummvm\lure.dat"
 "..\..\..\..\dists\engine-data\drascula.dat"-"c:\data\scummvm\drascula.dat"
+"..\..\..\..\dists\engine-data\m4.dat"-"c:\data\scummvm\m4.dat"
+"..\..\..\vkeybd\packs\vkeybd_default.zip"-"c:\data\scummvm\vkeybd_default.zip"
 
 ; Config/log files: 'empty' will automagically be removed on uninstall
 ""-"c:\data\scummvm\scummvm.ini",FILENULL

Modified: scummvm/branches/gsoc2009-mods/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg	2009-08-11 22:35:56 UTC (rev 43291)
@@ -60,7 +60,8 @@
 "..\..\..\..\dists\engine-data\igor.tbl"-"c:\shared\scummvm\igor.tbl"
 "..\..\..\..\dists\engine-data\lure.dat"-"c:\shared\scummvm\lure.dat"
 "..\..\..\..\dists\engine-data\drascula.dat"-"c:\shared\scummvm\drascula.dat"
-
+"..\..\..\..\dists\engine-data\m4.dat"-"c:\shared\scummvm\m4.dat"
+"..\..\..\vkeybd\packs\vkeybd_default.zip"-"c:\shared\scummvm\vkeybd_default.zip"
 ; Config/log files: 'empty' will automagically be removed on uninstall
 ""-"c:\shared\scummvm\scummvm.ini",FILENULL
 ""-"c:\shared\scummvm\scummvm.stdout.txt",FILENULL

Modified: scummvm/branches/gsoc2009-mods/backends/platform/symbian/mmp/scummvm_base.mmp.in
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/symbian/mmp/scummvm_base.mmp.in	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/symbian/mmp/scummvm_base.mmp.in	2009-08-11 22:35:56 UTC (rev 43291)
@@ -117,4 +117,9 @@
 SOURCE     backends\keymapper\keymap.cpp
 SOURCE     backends\keymapper\keymapper.cpp
 SOURCE     backends\keymapper\remap-dialog.cpp
-
+// Source files for virtual keyboard
+SOURCE     backends\vkeybd\image-map.cpp
+SOURCE     backends\vkeybd\polygon.cpp
+SOURCE     backends\vkeybd\virtual-keyboard-gui.cpp
+SOURCE     backends\vkeybd\virtual-keyboard-parser.cpp
+SOURCE     backends\vkeybd\virtual-keyboard.cpp

Modified: scummvm/branches/gsoc2009-mods/backends/platform/symbian/src/SymbianActions.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/symbian/src/SymbianActions.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/symbian/src/SymbianActions.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -163,7 +163,9 @@
 	bool is_drascula = (strncmp(gameid.c_str(), "drascula",8) == 0);
 	bool is_tucker = (gameid == "tucker");
 	bool is_groovie = (gameid == "groovie");
+	bool is_tinsel = (gameid == "tinsel");
 	bool is_cruise = (gameid == "cruise");
+	bool is_made = (gameid == "made");
 
 	Actions::initInstanceGame();
 
@@ -194,6 +196,8 @@
 			_key_action[ACTION_SAVE].setKey(Common::ASCII_ESCAPE, Common::KEYCODE_ESCAPE);
 		} else if (is_parallaction) {
 			_key_action[ACTION_SAVE].setKey('s', Common::KEYCODE_s);
+		} else if (is_tinsel) {
+			_key_action[ACTION_SAVE].setKey(Common::ASCII_F1, SDLK_F1);
 		} else {
 			_key_action[ACTION_SAVE].setKey(Common::ASCII_F5, Common::KEYCODE_F5); // F5 key
 		}
@@ -202,9 +206,9 @@
 	_action_enabled[ACTION_QUIT] = true;
 
 	// Skip text
-	if (!is_cine && !is_parallaction && !is_groovie)
+	if (!is_cine && !is_parallaction && !is_groovie && !is_cruise && !is_made)
 		_action_enabled[ACTION_SKIP_TEXT] = true;
-	if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob ||
+	if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_tinsel ||
 			is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula || is_tucker)
 		_key_action[ACTION_SKIP_TEXT].setKey(Common::KEYCODE_ESCAPE, Common::KEYCODE_ESCAPE); // Escape key
 	else {

Modified: scummvm/branches/gsoc2009-mods/backends/platform/wince/Makefile
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/wince/Makefile	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/wince/Makefile	2009-08-11 22:35:56 UTC (rev 43291)
@@ -50,10 +50,10 @@
 ## Pick which libraries you want to use here
 
 USE_MAD           = 1
-USE_MPEG2         = 1
+#USE_MPEG2         = 1
 #USE_TREMOR        = 1
 USE_TREMOLO       = 1
-USE_FLAC          = 1
+#USE_FLAC          = 1
 USE_ZLIB          = 1
 
 ########################################################################

Modified: scummvm/branches/gsoc2009-mods/backends/platform/wince/README-WinCE.txt
===================================================================
--- scummvm/branches/gsoc2009-mods/backends/platform/wince/README-WinCE.txt	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/backends/platform/wince/README-WinCE.txt	2009-08-11 22:35:56 UTC (rev 43291)
@@ -1,6 +1,6 @@
 ScummVM Windows CE FAQ
 Last updated: $Date$
-Release version: 0.13.0
+Release version: 1.0.0rc1
 ------------------------------------------------------------------------
 
 New in this version
@@ -20,6 +20,18 @@
 and this will fail on many devices (file under the not enough memory
 category).
 
+From this version on, we're dropping support for FLAC and MPEG-2. The first
+is a pain to maintain, while the second has been gradually phased out in
+scummvm. Be sure to update your add-on packs and/or recompress your sound.
+
+This is still a 2-binary distribution. Here's what engines are compiled in
+the two executables:
+scummvm1.exe:
+ - scumm, sword1, sword2, queen, sky, lure, agi, touche, tinsel, cruise
+scummvm2.exe:
+ - gob, cine, saga, kyra, agos, parallaction, drascula, groovie, tucker, made
+
+
 ------------------------------------------------------------------------
 
 This document is intended to give common answers to specific ScummVM

Modified: scummvm/branches/gsoc2009-mods/base/commandLine.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/base/commandLine.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/base/commandLine.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -157,6 +157,7 @@
 	ConfMan.registerDefault("aspect_ratio", false);
 	ConfMan.registerDefault("gfx_mode", "normal");
 	ConfMan.registerDefault("render_mode", "default");
+	ConfMan.registerDefault("desired_screen_aspect_ratio", "auto");
 
 	// Sound & Music
 	ConfMan.registerDefault("music_volume", 192);

Modified: scummvm/branches/gsoc2009-mods/configure
===================================================================
--- scummvm/branches/gsoc2009-mods/configure	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/configure	2009-08-11 22:35:56 UTC (rev 43291)
@@ -70,8 +70,9 @@
 add_engine scumm_7_8 "v7 & v8 games" yes
 add_engine he "HE71+ games" yes
 add_engine agi "AGI" yes
-add_engine agos "AGOS" yes "pn"
+add_engine agos "AGOS" yes "pn agos2"
 add_engine pn "Personal Nightmare" no
+add_engine agos2 "AGOS 2 games" yes
 add_engine cine "Cinematique evo 1" yes
 add_engine cruise "Cinematique evo 2" yes
 add_engine drascula "Drascula: The Vampire Strikes Back" yes

Modified: scummvm/branches/gsoc2009-mods/dists/engine-data/kyra.dat
===================================================================
(Binary files differ)

Modified: scummvm/branches/gsoc2009-mods/dists/msvc8/ScummVM_Global.vsprops
===================================================================
--- scummvm/branches/gsoc2009-mods/dists/msvc8/ScummVM_Global.vsprops	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/dists/msvc8/ScummVM_Global.vsprops	2009-08-11 22:35:56 UTC (rev 43291)
@@ -10,7 +10,7 @@
 		Name="VCCLCompilerTool"
 		DisableSpecificWarnings="4068;4100;4103;4121;4127;4189;4201;4221;4244;4250;4310;4351;4355;4510;4511;4512;4610;4701;4702;4706;4800;4996"
 		AdditionalIncludeDirectories="../..;../../engines"
-		PreprocessorDefinitions="USE_NASM;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LOL;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE"
+		PreprocessorDefinitions="USE_NASM;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_AGOS2;ENABLE_PN;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LOL;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE"
 		ExceptionHandling="0"
 		RuntimeTypeInfo="false"
 		WarningLevel="4"

Modified: scummvm/branches/gsoc2009-mods/dists/msvc9/ScummVM_Global.vsprops
===================================================================
--- scummvm/branches/gsoc2009-mods/dists/msvc9/ScummVM_Global.vsprops	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/dists/msvc9/ScummVM_Global.vsprops	2009-08-11 22:35:56 UTC (rev 43291)
@@ -9,7 +9,7 @@
 	<Tool
 		Name="VCCLCompilerTool"
 		AdditionalIncludeDirectories="../..;../../engines"
-		PreprocessorDefinitions="USE_NASM;USE_ZLIB;ENABLE_KYRA;ENABLE_LOL;ENABLE_SCUMM;ENABLE_SCUMM_7_8;ENABLE_HE"
+		PreprocessorDefinitions="USE_NASM;USE_ZLIB;ENABLE_AGOS2;ENABLE_PN;ENABLE_KYRA;ENABLE_LOL;ENABLE_SCUMM;ENABLE_SCUMM_7_8;ENABLE_HE"
 		ExceptionHandling="0"
 		RuntimeTypeInfo="false"
 		WarningLevel="4"

Modified: scummvm/branches/gsoc2009-mods/engines/agos/agos.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/agos.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/agos.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -59,6 +59,7 @@
 	"MUSIC",                               // speech_filename
 };
 
+#ifdef ENABLE_AGOS2
 AGOSEngine_PuzzlePack::AGOSEngine_PuzzlePack(OSystem *system)
 	: AGOSEngine_Feeble(system) {
 
@@ -72,6 +73,7 @@
 	_startSecondCount = 0;
 	_tSecondCount = 0;
 }
+#endif
 
 AGOSEngine_Simon2::AGOSEngine_Simon2(OSystem *system)
 	: AGOSEngine_Simon1(system) {
@@ -696,6 +698,7 @@
 	 3, 2, 14, 129,
 };
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_PuzzlePack::setupGame() {
 	gss = &puzzlepack_settings;
 	_numVideoOpcodes = 85;
@@ -712,6 +715,7 @@
 
 	AGOSEngine::setupGame();
 }
+#endif
 
 void AGOSEngine_Simon2::setupGame() {
 	gss = &simon2_settings;

Modified: scummvm/branches/gsoc2009-mods/engines/agos/agos.h
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/agos.h	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/agos.h	2009-08-11 22:35:56 UTC (rev 43291)
@@ -34,14 +34,13 @@
 #include "common/stack.h"
 #include "common/util.h"
 
+#ifdef ENABLE_AGOS2
 #include "agos/animation.h"
+#endif
 #include "agos/midi.h"
 #include "agos/sound.h"
 #include "agos/vga.h"
 
-// TODO: Replace with more portable code
-#include <setjmp.h>
-
 namespace AGOS {
 
 uint fileReadItemID(Common::SeekableReadStream *in);
@@ -892,6 +891,7 @@
 	void vc19_loop();
 	void vc20_setRepeat();
 	void vc21_endRepeat();
+	virtual void vc22_setPalette();
 	void vc23_setPriority();
 	void vc24_setSpriteXY();
 	void vc25_halt_sprite();
@@ -904,7 +904,7 @@
 	void vc33_setMouseOn();
 	void vc34_setMouseOff();
 	void vc35_clearWindow();
-	void vc36_setWindowImage();
+	virtual void vc36_setWindowImage();
 	void vc38_ifVarNotZero();
 	void vc39_setVar();
 	void vc40_scrollRight();
@@ -924,7 +924,6 @@
 
 	// Video Script Opcodes, Elvira 1
 	void vc17_waitEnd();
-	void vc22_setPaletteOld();
 	void vc32_saveScreen();
 	void vc37_pokePalette();
 
@@ -962,10 +961,9 @@
 	void vc45_setSpriteX();
 	void vc46_setSpriteY();
 	void vc47_addToVar();
-	void vc48_setPathFinder();
+	virtual void vc48_setPathFinder();
 	void vc59_ifSpeech();
 	void vc61_setMaskImage();
-	void vc22_setPaletteNew();
 
 	// Video Script Opcodes, Simon 2
 	void vc56_delayLong();
@@ -1366,9 +1364,6 @@
 	int _tagOfActiveDoline;	///< tag of the active doline "instance"
 	int _dolineReturnVal;
 
-	jmp_buf _loadfail;
-
-
 	byte *_dataBase, *_textBase;
 	uint32 _dataBaseSize, _textBaseSize;
 
@@ -1771,6 +1766,8 @@
 
 	virtual void executeOpcode(int opcode);
 
+	virtual void vc22_setPalette();
+
 	// Opcodes, Simon 1
 	void os1_animate();
 	void os1_pauseGame();
@@ -1875,6 +1872,7 @@
 	virtual char *genSaveName(int slot);
 };
 
+#ifdef ENABLE_AGOS2
 class AGOSEngine_Feeble : public AGOSEngine_Simon2 {
 public:
 	AGOSEngine_Feeble(OSystem *system);
@@ -1886,6 +1884,9 @@
 
 	virtual void executeOpcode(int opcode);
 
+	virtual void vc36_setWindowImage();
+	virtual void vc48_setPathFinder();
+
 	void off_chance();
 	void off_jumpOut();
 	void off_addTextBox();
@@ -2092,6 +2093,7 @@
 
 	virtual char *genSaveName(int slot);
 };
+#endif
 
 } // End of namespace AGOS
 

Modified: scummvm/branches/gsoc2009-mods/engines/agos/animation.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/animation.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/animation.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -27,6 +27,7 @@
 
 #include "common/endian.h"
 #include "common/events.h"
+#include "common/file.h"
 #include "common/system.h"
 
 #include "graphics/cursorman.h"

Modified: scummvm/branches/gsoc2009-mods/engines/agos/animation.h
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/animation.h	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/animation.h	2009-08-11 22:35:56 UTC (rev 43291)
@@ -26,9 +26,6 @@
 #ifndef AGOS_ANIMATION_H
 #define AGOS_ANIMATION_H
 
-#include "common/file.h"
-#include "common/stream.h"
-
 #include "graphics/video/dxa_decoder.h"
 #include "graphics/video/smk_decoder.h"
 #include "sound/mixer.h"

Modified: scummvm/branches/gsoc2009-mods/engines/agos/charset.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/charset.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/charset.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -34,6 +34,7 @@
 
 namespace AGOS {
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::doOutput(const byte *src, uint len) {
 	if (_textWindow == NULL)
 		return;
@@ -64,6 +65,7 @@
 		}
 	}
 }
+#endif
 
 void AGOSEngine::doOutput(const byte *src, uint len) {
 	uint idx;
@@ -573,6 +575,7 @@
 	}
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::windowNewLine(WindowBlock *window) {
 	if (_noOracleScroll == 0) {
 		if (window->height < window->textRow + 30) {
@@ -603,6 +606,7 @@
 	window->textColumnOffset = 0;
 	window->textLength = 0;
 }
+#endif
 
 void AGOSEngine::windowNewLine(WindowBlock *window) {
 	window->textColumn = 0;

Modified: scummvm/branches/gsoc2009-mods/engines/agos/cursor.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/cursor.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/cursor.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -348,6 +348,7 @@
 	0,0,10,7,10,6,10,5,10,4,10,3,10,4,10,5,10,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_PuzzlePack::handleMouseMoved() {
 	uint x;
 
@@ -379,6 +380,7 @@
 
 	drawMousePointer();
 }
+#endif
 
 void AGOSEngine_Simon1::handleMouseMoved() {
 	uint x;
@@ -638,6 +640,7 @@
 	_videoLockOut &= ~1;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_PuzzlePack::initMouse() {
 	if (getGameId() == GID_DIMP) {
 		AGOSEngine_Simon1::initMouse();
@@ -652,48 +655,12 @@
 	// TODO: Add larger cursor
 	AGOSEngine_Simon1::initMouse();
 }
-
-static const byte mouseCursorPalette[] = {
-	0x00, 0x00, 0x00, 0x00, // Black
-	0xFF, 0xFF, 0xFF, 0x00, // White
-};
-
 void AGOSEngine_Feeble::initMouse() {
 	_maxCursorWidth = 40;
 	_maxCursorHeight = 40;
 	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
 }
 
-void AGOSEngine_Simon1::initMouse() {
-	AGOSEngine::initMouse();
-
-	const uint16 *src = _common_mouseInfo;
-	for (int i = 0; i < 16; i++) {
-		for (int j = 0; j < 16; j++) {
-			if (src[0] & (1 << (15 - (j % 16)))) {
-				if (src[1] & (1 << (15 - (j % 16)))) {
-					_mouseData[16 * i + j] = 1;
-				} else {
-					_mouseData[16 * i + j] = 0;
-				}
-			}
-		}
-		src += 2;
-	}
-
-	CursorMan.replaceCursor(_mouseData, 16, 16, 0, 0, 0xFF);
-}
-
-void AGOSEngine::initMouse() {
-	_maxCursorWidth = 16;
-	_maxCursorHeight = 16;
-	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
-
-	memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
-
-	CursorMan.replaceCursorPalette(mouseCursorPalette, 0, ARRAYSIZE(mouseCursorPalette) / 4);
-}
-
 void AGOSEngine_PuzzlePack::loadMouseImage() {
 	loadZone(_variableArray[500]);
 	VgaPointersEntry *vpe = &_vgaBufferPointers[_variableArray[500]];
@@ -793,7 +760,43 @@
 		CursorMan.replaceCursor(_mouseData, _maxCursorWidth, _maxCursorHeight, hotspotX, hotspotY, 0);
 	}
 }
+#endif
 
+void AGOSEngine_Simon1::initMouse() {
+	AGOSEngine::initMouse();
+
+	const uint16 *src = _common_mouseInfo;
+	for (int i = 0; i < 16; i++) {
+		for (int j = 0; j < 16; j++) {
+			if (src[0] & (1 << (15 - (j % 16)))) {
+				if (src[1] & (1 << (15 - (j % 16)))) {
+					_mouseData[16 * i + j] = 1;
+				} else {
+					_mouseData[16 * i + j] = 0;
+				}
+			}
+		}
+		src += 2;
+	}
+
+	CursorMan.replaceCursor(_mouseData, 16, 16, 0, 0, 0xFF);
+}
+
+static const byte mouseCursorPalette[] = {
+	0x00, 0x00, 0x00, 0x00, // Black
+	0xFF, 0xFF, 0xFF, 0x00, // White
+};
+
+void AGOSEngine::initMouse() {
+	_maxCursorWidth = 16;
+	_maxCursorHeight = 16;
+	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+
+	memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
+
+	CursorMan.replaceCursorPalette(mouseCursorPalette, 0, ARRAYSIZE(mouseCursorPalette) / 4);
+}
+
 void AGOSEngine::drawMousePointer() {
 	if (getGameType() == GType_SIMON2) {
 		CursorMan.replaceCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7);

Modified: scummvm/branches/gsoc2009-mods/engines/agos/debug.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/debug.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/debug.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -26,6 +26,8 @@
 // AGOS debug functions
 
 
+#include "common/file.h"
+
 #include "agos/debug.h"
 #include "agos/agos.h"
 #include "agos/intern.h"
@@ -323,6 +325,7 @@
 	}
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::dumpVgaFile(const byte *vga) {
 	const byte *pp;
 	const byte *p;
@@ -352,6 +355,7 @@
 		p += sizeof(ImageHeader_Feeble);
 	}
 }
+#endif
 
 void AGOSEngine_Simon1::dumpVgaFile(const byte *vga) {
 	const byte *pp;

Modified: scummvm/branches/gsoc2009-mods/engines/agos/detection.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/detection.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/detection.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -66,17 +66,21 @@
 };
 
 static const PlainGameDescriptor simonGames[] = {
+#ifdef ENABLE_PN
 	{"pn", "Personal Nightmare"},
+#endif
 	{"elvira1", "Elvira - Mistress of the Dark"},
 	{"elvira2", "Elvira II - The Jaws of Cerberus"},
 	{"waxworks", "Waxworks"},
 	{"simon1", "Simon the Sorcerer 1"},
 	{"simon2", "Simon the Sorcerer 2"},
+#ifdef ENABLE_AGOS2
 	{"feeble", "The Feeble Files"},
 	{"dimp", "Demon in my Pocket"},
 	{"jumble", "Jumble"},
 	{"puzzle", "NoPatience"},
 	{"swampy", "Swampy Adventures"},
+#endif
 	{0, 0}
 };
 
@@ -158,6 +162,7 @@
 	case AGOS::GType_SIMON2:
 		*engine = new AGOS::AGOSEngine_Simon2(syst);
 		break;
+#ifdef ENABLE_AGOS2
 	case AGOS::GType_FF:
 		if (gd->features & GF_DEMO)
 			*engine = new AGOS::AGOSEngine_FeebleDemo(syst);
@@ -167,6 +172,7 @@
 	case AGOS::GType_PP:
 		*engine = new AGOS::AGOSEngine_PuzzlePack(syst);
 		break;
+#endif
 	default:
 		res = false;
 		error("AGOS engine: unknown gameType");

Modified: scummvm/branches/gsoc2009-mods/engines/agos/detection_tables.h
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/detection_tables.h	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/detection_tables.h	2009-08-11 22:35:56 UTC (rev 43291)
@@ -32,6 +32,7 @@
 using Common::GUIO_NOSUBTITLES;
 
 static const AGOSGameDescription gameDescriptions[] = {
+#ifdef ENABLE_PN
 	// Personal Nightmare 1.1 - English Amiga
 	{
 		{
@@ -123,6 +124,7 @@
 		GID_PN,
 		GF_OLD_BUNDLE | GF_CRUNCHED | GF_EGA | GF_PLANAR
 	},
+#endif
 
 	// Elvira 1 - English Amiga Floppy Demo
 	{
@@ -1600,7 +1602,7 @@
 			Common::RU_RUS,
 			Common::kPlatformPC,
 			ADGF_NO_FLAGS,
-			GUIO_NOSUBTITLES
+			GUIO_NONE
 		},
 
 		GType_SIMON1,
@@ -1625,7 +1627,7 @@
 			Common::FR_FRA,
 			Common::kPlatformPC,
 			ADGF_NO_FLAGS,
-			GUIO_NOSUBTITLES
+			GUIO_NONE
 		},
 
 		GType_SIMON1,
@@ -1675,7 +1677,7 @@
 			Common::HB_ISR,
 			Common::kPlatformPC,
 			ADGF_NO_FLAGS,
-			GUIO_NOSUBTITLES
+			GUIO_NONE
 		},
 
 		GType_SIMON1,
@@ -1700,7 +1702,7 @@
 			Common::IT_ITA,
 			Common::kPlatformPC,
 			ADGF_NO_FLAGS,
-			GUIO_NOSUBTITLES
+			GUIO_NONE
 		},
 
 		GType_SIMON1,
@@ -1726,7 +1728,7 @@
 			Common::IT_ITA,
 			Common::kPlatformWindows,
 			ADGF_NO_FLAGS,
-			GUIO_NOSUBTITLES
+			GUIO_NONE
 		},
 
 		GType_SIMON1,
@@ -1751,7 +1753,7 @@
 			Common::ES_ESP,
 			Common::kPlatformPC,
 			ADGF_NO_FLAGS,
-			GUIO_NOSUBTITLES
+			GUIO_NONE
 		},
 
 		GType_SIMON1,
@@ -2335,6 +2337,7 @@
 		GF_TALKIE
 	},
 
+#ifdef ENABLE_AGOS2
 	// The Feeble Files - English DOS Demo
 	{
 		{
@@ -2807,6 +2810,7 @@
 		GID_SWAMPY,
 		GF_OLD_BUNDLE | GF_TALKIE
 	},
+#endif
 	{ AD_TABLE_END_MARKER, 0, 0, 0 }
 };
 

Modified: scummvm/branches/gsoc2009-mods/engines/agos/draw.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/draw.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/draw.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -46,6 +46,7 @@
 	return (byte *)_scaleBuf->pixels;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::animateSpritesByY() {
 	VgaSprite *vsp;
 	VgaPointersEntry *vpe;
@@ -147,6 +148,7 @@
 
 	_displayScreen = true;
 }
+#endif
 
 void AGOSEngine::animateSprites() {
 	VgaSprite *vsp;

Modified: scummvm/branches/gsoc2009-mods/engines/agos/event.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/event.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/event.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -552,6 +552,7 @@
 	} while (cur < start + amount && !shouldQuit());
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_PuzzlePack::timerProc() {
 	_lastTickCount = _system->getMillis();
 
@@ -609,6 +610,7 @@
 
 	_videoLockOut &= ~2;
 }
+#endif
 
 #ifdef ENABLE_PN
 void AGOSEngine_PN::timerProc() {
@@ -677,6 +679,7 @@
 	_videoLockOut &= ~2;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_PuzzlePack::dimpIdle() {
 	int z, n;
 
@@ -758,5 +761,6 @@
 		}
 	}
 }
+#endif
 
 } // End of namespace AGOS

Modified: scummvm/branches/gsoc2009-mods/engines/agos/gfx.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/gfx.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/gfx.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -226,6 +226,7 @@
 	return (state->draw_width != 0 && state->draw_height != 0);
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY) {
 	Common::Rect srcRect, dstRect;
 	float factor, xscale;
@@ -461,6 +462,7 @@
 		} while (--state->draw_height);
 	}
 }
+#endif
 
 void AGOSEngine_Simon1::drawMaskedImage(VC10_state *state) {
 	if (getGameType() == GType_SIMON1 && (_windowNum == 3 || _windowNum == 4 || _windowNum >= 10)) {

Modified: scummvm/branches/gsoc2009-mods/engines/agos/icons.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/icons.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/icons.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -374,6 +374,7 @@
 	_videoLockOut &= ~0x8000;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::drawIconArray(uint num, Item *itemRef, int line, int classMask) {
 	Item *item_ptr_org = itemRef;
 	WindowBlock *window;
@@ -477,6 +478,7 @@
 	window->iconPtr->upArrow = _scrollUpHitArea;
 	window->iconPtr->downArrow = _scrollDownHitArea;
 }
+#endif
 
 void AGOSEngine::drawIconArray(uint num, Item *itemRef, int line, int classMask) {
 	Item *item_ptr_org = itemRef;
@@ -581,6 +583,7 @@
 	}
 }
 
+#ifdef ENABLE_AGOS2
 uint AGOSEngine_Feeble::setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *itemPtr) {
 	HitArea *ha = findEmptyHitArea();
 
@@ -596,6 +599,7 @@
 
 	return ha - _hitAreas;
 }
+#endif
 
 uint AGOSEngine_Simon2::setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *itemPtr) {
 	HitArea *ha = findEmptyHitArea();
@@ -683,6 +687,7 @@
 	return ha - _hitAreas;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::addArrows(WindowBlock *window, uint8 num) {
 	HitArea *ha;
 
@@ -712,6 +717,7 @@
 	ha->window = window;
 	ha->verb = 1;
 }
+#endif
 
 void AGOSEngine_Simon2::addArrows(WindowBlock *window, uint8 num) {
 	HitArea *ha;
@@ -860,16 +866,16 @@
 	x = 30;
 	y = 151;
 	if (num != 2) {
-		y = window->height * 4 + window->y - 19;
-		x = window->width + window->x;
+		y = window->y + window->height * 4 - 19;
+		x = window->x + window->width;
 	}
 	drawArrow(x, y, 16);
 
 	ha = findEmptyHitArea();
 	_scrollUpHitArea = ha - _hitAreas;
 
-	ha->x = 30 * 8;
-	ha->y = 151;
+	ha->x = x * 8;
+	ha->y = y;
 	ha->width = 16;
 	ha->height = 19;
 	ha->flags = kBFBoxInUse;
@@ -881,16 +887,16 @@
 	x = 30;
 	y = 170;
 	if (num != 2) {
-		y = window->height * 4;
-		x = window->width + window->x;
+		y = window->y + window->height * 4;
+		x = window->x + window->width;
 	}
 	drawArrow(x, y, -16);
 
 	ha = findEmptyHitArea();
 	_scrollDownHitArea = ha - _hitAreas;
 
-	ha->x = 30 * 8;
-	ha->y = 170;
+	ha->x = x * 8;
+	ha->y = y;
 	ha->width = 16;
 	ha->height = 19;
 	ha->flags = kBFBoxInUse;
@@ -956,7 +962,8 @@
 
 	for (h = 0; h < 19; h++) {
 		for (w = 0; w < 16; w++) {
-			dst[w] = src[w] + 16;
+			if (src[w]) 
+				dst[w] = src[w] + 16;
 		}
 
 		src += dir;
@@ -984,8 +991,8 @@
 
 void AGOSEngine::removeArrows(WindowBlock *window, uint num) {
 	if (num != 2) {
-		uint y = window->height * 4 + window->y - 19;
-		uint x = window->width + window->x;
+		uint y = window->y + window->height * 4 - 19;
+		uint x = (window->x + window->width) * 8;
 		restoreBlock(x, y, x + 16, y + 38);
 	} else {
 		colorBlock(window, 240, 151, 16, 38);

Modified: scummvm/branches/gsoc2009-mods/engines/agos/module.mk
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/module.mk	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/module.mk	2009-08-11 22:35:56 UTC (rev 43291)
@@ -2,7 +2,6 @@
 
 MODULE_OBJS := \
 	agos.o \
-	animation.o \
 	charset.o \
 	charset-fontdata.o \
 	contain.o \
@@ -12,7 +11,6 @@
 	detection.o \
 	draw.o \
 	event.o \
-	feeble.o \
 	gfx.o \
 	icons.o \
 	input.o \
@@ -20,8 +18,6 @@
 	menus.o \
 	midi.o \
 	midiparser_s1d.o \
-	oracle.o \
-	pn.o \
 	res.o \
 	res_ami.o \
 	res_snd.o \
@@ -30,26 +26,38 @@
 	script.o \
 	script_e1.o \
 	script_e2.o \
-	script_pn.o \
 	script_ww.o \
 	script_s1.o \
 	script_s2.o \
-	script_ff.o \
-	script_pp.o \
 	sound.o \
 	string.o \
 	subroutine.o \
 	verb.o \
 	vga.o \
 	vga_e2.o \
-	vga_pn.o \
 	vga_ww.o \
 	vga_s1.o \
 	vga_s2.o \
-	vga_ff.o \
 	window.o \
 	zones.o
 
+ifdef ENABLE_PN
+MODULE_OBJS += \
+	pn.o \
+	script_pn.o \
+	vga_pn.o
+endif
+
+ifdef ENABLE_AGOS2
+MODULE_OBJS += \
+	animation.o \
+	feeble.o \
+	oracle.o \
+	script_ff.o \
+	script_pp.o \
+	vga_ff.o
+endif
+
 # This module can be built as a plugin
 ifeq ($(ENABLE_AGOS), DYNAMIC_PLUGIN)
 PLUGIN := 1

Modified: scummvm/branches/gsoc2009-mods/engines/agos/res.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/res.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/res.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -39,26 +39,28 @@
 
 namespace AGOS {
 
+#ifdef ENABLE_AGOS2
 uint16 AGOSEngine_Feeble::to16Wrapper(uint value) {
 	return TO_LE_16(value);
 }
 
+uint16 AGOSEngine_Feeble::readUint16Wrapper(const void *src) {
+	return READ_LE_UINT16(src);
+}
+
+uint32 AGOSEngine_Feeble::readUint32Wrapper(const void *src) {
+	return READ_LE_UINT32(src);
+}
+#endif
+
 uint16 AGOSEngine::to16Wrapper(uint value) {
 	return TO_BE_16(value);
 }
 
-uint16 AGOSEngine_Feeble::readUint16Wrapper(const void *src) {
-	return READ_LE_UINT16(src);
-}
-
 uint16 AGOSEngine::readUint16Wrapper(const void *src) {
 	return READ_BE_UINT16(src);
 }
 
-uint32 AGOSEngine_Feeble::readUint32Wrapper(const void *src) {
-	return READ_LE_UINT32(src);
-}
-
 uint32 AGOSEngine::readUint32Wrapper(const void *src) {
 	return READ_BE_UINT32(src);
 }

Modified: scummvm/branches/gsoc2009-mods/engines/agos/rooms.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/rooms.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/rooms.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -25,6 +25,8 @@
 
 
 
+#include "common/file.h"
+
 #include "agos/agos.h"
 #include "agos/intern.h"
 

Modified: scummvm/branches/gsoc2009-mods/engines/agos/saveload.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/saveload.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/saveload.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -23,6 +23,7 @@
  *
  */
 
+#include "common/file.h"
 #include "common/savefile.h"
 #include "common/system.h"
 
@@ -72,6 +73,7 @@
 	return i;
 }
 
+#ifdef ENABLE_AGOS2
 char *AGOSEngine_PuzzlePack::genSaveName(int slot) {
 	static char buf[20];
 
@@ -88,6 +90,7 @@
 	sprintf(buf, "feeble.%.3d", slot);
 	return buf;
 }
+#endif
 
 char *AGOSEngine_Simon2::genSaveName(int slot) {
 	static char buf[20];
@@ -283,7 +286,7 @@
 	const char *message1;
 	int i = 0, numSaveGames;
 	char *name;
-	char buf[8];
+	char buf[10];
 
 	numSaveGames = countSaveGames();
 
@@ -312,7 +315,7 @@
 	for (; *message1; message1++)
 		windowPutChar(window, *message1);
 
-	memset(buf, 0, 8);
+	memset(buf, 0, 10);
 	name = buf;
 	_saveGameNameLen = 0;
 

Modified: scummvm/branches/gsoc2009-mods/engines/agos/string.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/string.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/string.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -25,6 +25,8 @@
 
 
 
+#include "common/file.h"
+
 #include "agos/agos.h"
 #include "agos/intern.h"
 
@@ -560,6 +562,7 @@
 	}
 }
 
+#ifdef ENABLE_AGOS2
 // The Feeble Files specific
 void AGOSEngine_Feeble::printScreenText(uint vgaSpriteId, uint color, const char *string, int16 x, int16 y, int16 width) {
 	char convertedString[320];
@@ -693,6 +696,7 @@
 
 	printInteractText(num, string);
 }
+#endif
 
 // Waxworks specific
 uint16 AGOSEngine_Waxworks::getBoxSize() {

Modified: scummvm/branches/gsoc2009-mods/engines/agos/subroutine.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/subroutine.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/subroutine.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -25,6 +25,8 @@
 
 
 
+#include "common/file.h"
+
 #include "agos/agos.h"
 #include "agos/intern.h"
 

Modified: scummvm/branches/gsoc2009-mods/engines/agos/verb.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/verb.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/verb.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -203,6 +203,7 @@
 	"", "", "", "komu ?"
 };
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::clearName() {
 	stopAnimateSimon2(2, 6);
 	_lastNameOn = NULL;
@@ -210,6 +211,7 @@
 	_mouseAnim = 1;
 	return;
 }
+#endif
 
 void AGOSEngine_Simon2::clearName() {
 	if (getBitFlag(79)) {
@@ -530,6 +532,7 @@
 	_needHitAreaRecalc++;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_PuzzlePack::resetVerbs() {
 	_verbHitArea = 300;
 }
@@ -559,6 +562,7 @@
 		setVerb(NULL);
 	}
 }
+#endif
 
 void AGOSEngine::resetVerbs() {
 	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
@@ -590,6 +594,7 @@
 	}
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::setVerb(HitArea *ha) {
 	int cursor = _mouseCursor;
 	if (_noRightClick)
@@ -616,6 +621,7 @@
 	_needHitAreaRecalc++;
 	_verbHitArea = cursor + 300;
 }
+#endif
 
 void AGOSEngine::setVerb(HitArea *ha) {
 	HitArea *tmp = _currentVerbBox;
@@ -654,9 +660,11 @@
 	_currentVerbBox = ha;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::hitarea_leave(HitArea *ha, bool state) {
 	invertBox(ha, state);
 }
+#endif
 
 void AGOSEngine::hitarea_leave(HitArea *ha, bool state) {
 	if (getGameType() == GType_SIMON2) {
@@ -917,6 +925,7 @@
 		_lastNameOn = ha;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::invertBox(HitArea *ha, bool state) {
 	if (getBitFlag(205) || getBitFlag(206)) {
 		if (state != 0) {
@@ -959,6 +968,7 @@
 		}
 	}
 }
+#endif
 
 void AGOSEngine::invertBox(HitArea *ha, byte a, byte b, byte c, byte d) {
 	byte *src, color;

Modified: scummvm/branches/gsoc2009-mods/engines/agos/vga.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/vga.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/vga.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -106,7 +106,7 @@
 	op[20] = &AGOSEngine::vc19_loop;
 	op[21] = &AGOSEngine::vc20_setRepeat;
 	op[22] = &AGOSEngine::vc21_endRepeat;
-	op[23] = &AGOSEngine::vc22_setPaletteOld;
+	op[23] = &AGOSEngine::vc22_setPalette;
 	op[24] = &AGOSEngine::vc23_setPriority;
 	op[25] = &AGOSEngine::vc24_setSpriteXY;
 	op[26] = &AGOSEngine::vc25_halt_sprite;
@@ -918,7 +918,7 @@
 	0x77, 0x55, 0x00,
 };
 
-void AGOSEngine::vc22_setPaletteOld() {
+void AGOSEngine::vc22_setPalette() {
 	byte *offs, *palptr, *src;
 	uint16 b, num;
 
@@ -1258,7 +1258,7 @@
 			dst += screen->pitch;
 		}
 		 _system->unlockScreen();
-	} else if (num == 4) {
+	} else {
 		const uint16 *vlut = &_videoWindows[num * 4];
 		uint16 xoffs = (vlut[0] - _videoWindows[16]) * 16;
 		uint16 yoffs = (vlut[1] - _videoWindows[17]);
@@ -1302,12 +1302,7 @@
 	_displayScreen = false;
 	uint16 vga_res = vcReadNextWord();
 	uint16 windowNum = vcReadNextWord();
-
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		fillBackGroundFromFront();
-	} else {
-		setWindowImage(windowNum, vga_res);
-	}
+	setWindowImage(windowNum, vga_res);
 }
 
 void AGOSEngine::vc37_pokePalette() {

Modified: scummvm/branches/gsoc2009-mods/engines/agos/vga_e2.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/vga_e2.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/vga_e2.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -40,7 +40,7 @@
 
 	op[17] = &AGOSEngine::vc17_waitEnd;
 	op[19] = &AGOSEngine::vc19_loop;
-	op[22] = &AGOSEngine::vc22_setPaletteOld;
+	op[22] = &AGOSEngine::vc22_setPalette;
 	op[28] = &AGOSEngine::vc28_playSFX;
 	op[32] = &AGOSEngine::vc32_saveScreen;
 	op[37] = &AGOSEngine::vc37_pokePalette;

Modified: scummvm/branches/gsoc2009-mods/engines/agos/vga_ff.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/vga_ff.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/vga_ff.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -68,6 +68,57 @@
 	}
 }
 
+void AGOSEngine_Feeble::vc36_setWindowImage() {
+	_displayScreen = false;
+	vcReadNextWord();
+	vcReadNextWord();
+	fillBackGroundFromFront();
+}
+
+void AGOSEngine_Feeble::vc48_setPathFinder() {
+	uint16 a = (uint16)_variableArrayPtr[12];
+	const uint16 *p = _pathFindArray[a - 1];
+
+	VgaSprite *vsp = findCurSprite();
+	int16 x, y, ydiff;
+	int16 x1, y1, x2, y2;
+	uint pos = 0;
+
+	x = vsp->x;
+	while (x >= (int16)readUint16Wrapper(p + 2)) {
+		p += 2;
+		pos++;
+	}
+
+	x1 = readUint16Wrapper(p);
+	y1 = readUint16Wrapper(p + 1);
+	x2 = readUint16Wrapper(p + 2);
+	y2 = readUint16Wrapper(p + 3);
+
+	if (x2 != 9999) {
+		ydiff = y2 - y1;
+		if (ydiff < 0) {
+			ydiff = -ydiff;
+			x = vsp->x & 7;
+			ydiff *= x;
+			ydiff /= 8;
+			ydiff = -ydiff;
+		} else {
+			x = vsp->x & 7;
+			ydiff *= x;
+			ydiff /= 8;
+		}
+		y1 += ydiff;
+	}
+
+	y = vsp->y;
+	vsp->y = y1;
+	checkScrollY(y1 - y, y1);
+
+	_variableArrayPtr[11] = x1;
+	_variableArrayPtr[13] = pos;
+}
+
 void AGOSEngine::vc75_setScale() {
 	_baseY = vcReadNextWord();
 	_scale = vcReadNextWord() / 1000000.0f;

Modified: scummvm/branches/gsoc2009-mods/engines/agos/vga_pn.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/vga_pn.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/vga_pn.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -57,7 +57,9 @@
 	op[20] = &AGOSEngine::vc19_loop;
 	op[21] = &AGOSEngine::vc20_setRepeat;
 	op[22] = &AGOSEngine::vc21_endRepeat;
-	op[23] = &AGOSEngine::vc22_setPaletteOld;
+	// FIXME: This has been "vc22_setPaletteOld" before, but that does not seem to exist.
+	// Please check whether "vc22_setPalette" is fine to be used here.
+	op[23] = &AGOSEngine::vc22_setPalette;
 	op[24] = &AGOSEngine::vc23_setPriority;
 	op[25] = &AGOSEngine::vc24_setSpriteXY;
 	op[26] = &AGOSEngine::vc25_halt_sprite;

Modified: scummvm/branches/gsoc2009-mods/engines/agos/vga_s1.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/vga_s1.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/vga_s1.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -36,7 +36,7 @@
 
 	op[11] = &AGOSEngine::vc11_clearPathFinder;
 	op[17] = &AGOSEngine::vc17_setPathfinderItem;
-	op[22] = &AGOSEngine::vc22_setPaletteNew;
+	op[22] = &AGOSEngine::vc22_setPalette;
 	op[32] = &AGOSEngine::vc32_copyVar;
 	op[37] = &AGOSEngine::vc37_addToSpriteY;
 	op[48] = &AGOSEngine::vc48_setPathFinder;
@@ -96,7 +96,7 @@
 	0xFF, 0xFF, 0x77,
 };
 
-void AGOSEngine::vc22_setPaletteNew() {
+void AGOSEngine_Simon1::vc22_setPalette() {
 	byte *offs, *palptr = 0, *src;
 	uint16 a = 0, b, num, palSize = 0;
 
@@ -186,73 +186,32 @@
 	uint16 a = (uint16)_variableArrayPtr[12];
 	const uint16 *p = _pathFindArray[a - 1];
 
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		VgaSprite *vsp = findCurSprite();
-		int16 x, y, ydiff;
-		int16 x1, y1, x2, y2;
-		uint pos = 0;
+	uint b = (uint16)_variableArray[13];
+	p += b * 2 + 1;
+	int c = _variableArray[14];
 
-		x = vsp->x;
-		while (x >= (int16)readUint16Wrapper(p + 2)) {
-			p += 2;
-			pos++;
-		}
+	int step;
+	int y1, y2;
+	int16 *vp;
 
-		x1 = readUint16Wrapper(p);
-		y1 = readUint16Wrapper(p + 1);
-		x2 = readUint16Wrapper(p + 2);
-		y2 = readUint16Wrapper(p + 3);
+	step = 2;
+	if (c < 0) {
+		c = -c;
+		step = -2;
+	}
 
-		if (x2 != 9999) {
-			ydiff = y2 - y1;
-			if (ydiff < 0) {
-				ydiff = -ydiff;
-				x = vsp->x & 7;
-				ydiff *= x;
-				ydiff /= 8;
-				ydiff = -ydiff;
-			} else {
-				x = vsp->x & 7;
-				ydiff *= x;
-				ydiff /= 8;
-			}
-			y1 += ydiff;
-		}
+	vp = &_variableArray[20];
 
-		y = vsp->y;
-		vsp->y = y1;
-		checkScrollY(y1 - y, y1);
+	do {
+		y2 = readUint16Wrapper(p);
+		p += step;
+		y1 = readUint16Wrapper(p) - y2;
 
-		_variableArrayPtr[11] = x1;
-		_variableArrayPtr[13] = pos;
-	} else {
-		uint b = (uint16)_variableArray[13];
-		p += b * 2 + 1;
-		int c = _variableArray[14];
+		vp[0] = y1 / 2;
+		vp[1] = y1 - (y1 / 2);
 
-		int step;
-		int y1, y2;
-		int16 *vp;
-
-		step = 2;
-		if (c < 0) {
-			c = -c;
-			step = -2;
-		}
-
-		vp = &_variableArray[20];
-
-		do {
-			y2 = readUint16Wrapper(p);
-			p += step;
-			y1 = readUint16Wrapper(p) - y2;
-
-			vp[0] = y1 / 2;
-			vp[1] = y1 - (y1 / 2);
-
-			vp += 2;
-		} while (--c);
-	}
+		vp += 2;
+	} while (--c);
 }
 
 void AGOSEngine::vc59_ifSpeech() {

Modified: scummvm/branches/gsoc2009-mods/engines/agos/window.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/agos/window.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/agos/window.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -122,6 +122,7 @@
 	window->scrollY = 0;
 }
 
+#ifdef ENABLE_AGOS2
 void AGOSEngine_Feeble::colorWindow(WindowBlock *window) {
 	byte *dst;
 	uint16 h, w;
@@ -140,6 +141,7 @@
 
 	_videoLockOut &= ~0x8000;
 }
+#endif
 
 void AGOSEngine::colorWindow(WindowBlock *window) {
 	uint16 y, h;

Modified: scummvm/branches/gsoc2009-mods/engines/cruise/cruise.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/cruise/cruise.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/cruise/cruise.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -124,18 +124,6 @@
 	// another bit of video init
 
 	readVolCnf();
-
-	// Setup mixer
-//	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
-//	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
-
-	int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
-	_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
-	_adlib = (midiDriver == MD_ADLIB);
-
-	_driver = MidiDriver::createMidi(midiDriver);
-	if (_mt32)
-		_driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
 }
 
 void CruiseEngine::deinitialise() {

Modified: scummvm/branches/gsoc2009-mods/engines/cruise/cruise.h
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/cruise/cruise.h	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/cruise/cruise.h	2009-08-11 22:35:56 UTC (rev 43291)
@@ -56,9 +56,7 @@
 private:
 	bool _preLoad;
 	Debugger *_debugger;
-	MidiDriver *_driver;
 	PCSound *_sound;
-	bool _mt32, _adlib;
 	Common::StringList _langStrings;
 	CursorType _savedCursor;
 	uint32 lastTick, lastTickDebug;
@@ -89,8 +87,6 @@
 	Common::Language getLanguage() const;
 	Common::Platform getPlatform() const;
 	PCSound &sound() { return *_sound; }
-	bool mt32() const { return _mt32; }
-	bool adlib() const { return _adlib; }
 	virtual GUI::Debugger *getDebugger() { return _debugger; }
 	virtual void pauseEngine(bool pause);
 	const char *langString(LangStringId langId) { return _langStrings[(int)langId].c_str(); }

Modified: scummvm/branches/gsoc2009-mods/engines/cruise/staticres.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/cruise/staticres.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/cruise/staticres.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -182,7 +182,7 @@
 	-1, -1, -1,
 	0x72, 0x80
 	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
 	0x7f, 0x79, 0x7b, 0x81, 0x82, 0x83,
 	-1, -1,
 	0x7d,
@@ -218,7 +218,7 @@
 	0x67,
 	-1,
 	0x68,
-	-1, -1, -1, -1
+	-1, -1, -1
 };
 
 //

Modified: scummvm/branches/gsoc2009-mods/engines/engines.mk
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/engines.mk	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/engines.mk	2009-08-11 22:35:56 UTC (rev 43291)
@@ -24,7 +24,11 @@
 ifdef ENABLE_PN
 DEFINES += -DENABLE_PN
 endif
+
+ifdef ENABLE_AGOS2
+DEFINES += -DENABLE_AGOS2
 endif
+endif
 
 ifdef ENABLE_CINE
 DEFINES += -DENABLE_CINE=$(ENABLE_CINE)

Modified: scummvm/branches/gsoc2009-mods/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/draw_v2.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/draw_v2.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -46,6 +46,8 @@
 }
 
 void Draw_v2::initScreen() {
+	_vm->_game->_preventScroll = false;
+
 	_scrollOffsetX = 0;
 	_scrollOffsetY = 0;
 

Modified: scummvm/branches/gsoc2009-mods/engines/gob/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/game.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/game.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -181,11 +181,13 @@
 
 	_handleMouse = 0;
 	_forceHandleMouse = 0;
-	_menuLevel = 0;
 	_noScroll = true;
 	_preventScroll = false;
-	_scrollHandleMouse = false;
 
+	_wantScroll  = false;
+	_wantScrollX = 0;
+	_wantScrollY = 0;
+
 	_tempStr[0] = 0;
 
 	_numEnvironments = 0;
@@ -360,9 +362,7 @@
 		_vm->_scenery->_pCaptureCounter = oldCaptureCounter;
 		_script->seek(_script->getFunctionOffset(skipPlay + 1));
 
-		_menuLevel++;
 		_vm->_inter->callSub(2);
-		_menuLevel--;
 
 		if (_vm->_inter->_terminate != 0)
 			_vm->_inter->_terminate = 2;
@@ -439,22 +439,27 @@
 	_vm->_sound->sampleFree(_vm->_sound->sampleGetBySlot(slot));
 }
 
-void Game::evaluateScroll(int16 x, int16 y) {
-	if (_preventScroll || !_scrollHandleMouse || (_menuLevel > 0))
+void Game::wantScroll(int16 x, int16 y) {
+	_wantScroll  = true;
+	_wantScrollX = x;
+	_wantScrollY = y;
+}
+
+void Game::evaluateScroll() {
+	if (_noScroll || _preventScroll || !_wantScroll)
 		return;
 
-	if (_noScroll ||
-	   ((_vm->_global->_videoMode != 0x14) && (_vm->_global->_videoMode != 0x18)))
+	if ((_vm->_global->_videoMode != 0x14) && (_vm->_global->_videoMode != 0x18))
 		return;
 
-	if ((x == 0) && (_vm->_draw->_scrollOffsetX > 0)) {
+	if ((_wantScrollX == 0) && (_vm->_draw->_scrollOffsetX > 0)) {
 		uint16 off;
 
 		off = MIN(_vm->_draw->_cursorWidth, _vm->_draw->_scrollOffsetX);
 		off = MAX(off / 2, 1);
 		_vm->_draw->_scrollOffsetX -= off;
 		_vm->_video->dirtyRectsAll();
-	} else if ((y == 0) && (_vm->_draw->_scrollOffsetY > 0)) {
+	} else if ((_wantScrollY == 0) && (_vm->_draw->_scrollOffsetY > 0)) {
 		uint16 off;
 
 		off = MIN(_vm->_draw->_cursorHeight, _vm->_draw->_scrollOffsetY);
@@ -463,9 +468,9 @@
 		_vm->_video->dirtyRectsAll();
 	}
 
-	int16 cursorRight = x + _vm->_draw->_cursorWidth;
-	int16 screenRight = _vm->_draw->_scrollOffsetX + _vm->_width;
-	int16 cursorBottom = y + _vm->_draw->_cursorHeight;
+	int16 cursorRight  = _wantScrollX + _vm->_draw->_cursorWidth;
+	int16 screenRight  = _vm->_draw->_scrollOffsetX + _vm->_width;
+	int16 cursorBottom = _wantScrollY + _vm->_draw->_cursorHeight;
 	int16 screenBottom = _vm->_draw->_scrollOffsetY + _vm->_height;
 
 	if ((cursorRight >= _vm->_width) &&
@@ -479,7 +484,7 @@
 		_vm->_draw->_scrollOffsetX += off;
 		_vm->_video->dirtyRectsAll();
 
-		_vm->_util->setMousePos(_vm->_width - _vm->_draw->_cursorWidth, y);
+		_vm->_util->setMousePos(_vm->_width - _vm->_draw->_cursorWidth, _wantScrollY);
 	} else if ((cursorBottom >= (_vm->_height - _vm->_video->_splitHeight2)) &&
 			(screenBottom < _vm->_video->_surfHeight)) {
 		uint16 off;
@@ -491,11 +496,13 @@
 		_vm->_draw->_scrollOffsetY += off;
 		_vm->_video->dirtyRectsAll();
 
-		_vm->_util->setMousePos(x, _vm->_height - _vm->_video->_splitHeight2 -
-				_vm->_draw->_cursorHeight);
+		_vm->_util->setMousePos(_wantScrollX,
+				_vm->_height - _vm->_video->_splitHeight2 - _vm->_draw->_cursorHeight);
 	}
 
 	_vm->_util->setScrollOffset();
+
+	_wantScroll = false;
 }
 
 int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY,

Modified: scummvm/branches/gsoc2009-mods/engines/gob/game.h
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/game.h	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/game.h	2009-08-11 22:35:56 UTC (rev 43291)
@@ -82,8 +82,11 @@
 
 	bool _noScroll;
 	bool _preventScroll;
-	bool _scrollHandleMouse;
 
+	bool  _wantScroll;
+	int16 _wantScrollX;
+	int16 _wantScrollY;
+
 	byte _handleMouse;
 	char _forceHandleMouse;
 
@@ -99,7 +102,8 @@
 
 	void freeSoundSlot(int16 slot);
 
-	void evaluateScroll(int16 x, int16 y);
+	void wantScroll(int16 x, int16 y);
+	void evaluateScroll();
 
 	int16 checkKeys(int16 *pMousex = 0, int16 *pMouseY = 0,
 			MouseButtons *pButtons = 0, char handleMouse = 0);
@@ -109,8 +113,6 @@
 	void switchTotSub(int16 index, int16 skipPlay);
 
 protected:
-	uint32 _menuLevel;
-
 	char _tempStr[256];
 
 	// Capture

Modified: scummvm/branches/gsoc2009-mods/engines/gob/hotspots.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/hotspots.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/hotspots.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -628,8 +628,6 @@
 }
 
 uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index) {
-	_vm->_game->_scrollHandleMouse = handleMouse != 0;
-
 	if (delay >= -1) {
 		_currentKey   = 0;
 		_currentId    = 0;
@@ -679,6 +677,9 @@
 			_vm->_video->waitRetrace();
 		}
 
+		if (handleMouse)
+			_vm->_game->evaluateScroll();
+
 		// Update keyboard and mouse state
 		key = _vm->_game->checkKeys(&_vm->_global->_inter_mouseX,
 				&_vm->_global->_inter_mouseY, &_vm->_game->_mouseButtons, handleMouse);

Modified: scummvm/branches/gsoc2009-mods/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/inter_v2.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/inter_v2.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -935,6 +935,8 @@
 	offsetY = _vm->_game->_script->readValExpr();
 
 	if (offsetX == -1) {
+		_vm->_game->_preventScroll = !_vm->_game->_preventScroll;
+
 		WRITE_VAR(2, _vm->_draw->_scrollOffsetX);
 		WRITE_VAR(3, _vm->_draw->_scrollOffsetY);
 	} else {
@@ -996,11 +998,8 @@
 		close = false;
 	}
 
-	if (startFrame >= 0) {
-		_vm->_game->_preventScroll = true;
+	if (startFrame >= 0)
 		_vm->_vidPlayer->primaryPlay(startFrame, lastFrame, breakKey, palCmd, palStart, palEnd, 0);
-		_vm->_game->_preventScroll = false;
-	}
 
 	if (close)
 		_vm->_vidPlayer->primaryClose();
@@ -1306,8 +1305,14 @@
 
 	char *file = _vm->_game->_script->getResultStr();
 
+	// WORKAROUND: In some games (at least all the Playtoons), some files are 
+	// read on CD (and only on CD). "@:\" is replaced by the CD drive letter.
+	// As the files are copied on the HDD, those characters are skipped. 
+	if (strncmp(file, "@:\\", 3) ==0 )
+		file += 3;
+
 	// WORKAROUND: For some reason, the variable indicating which TOT to load next
-	// is overwritten in the guard house card game in Woodruff
+	// is overwritten in the guard house card game in Woodruff.
 	if ((_vm->getGameType() == kGameTypeWoodruff) && !scumm_stricmp(file, "6.TOT"))
 		strcpy(file, "EMAP2011.TOT");
 

Modified: scummvm/branches/gsoc2009-mods/engines/gob/inter_v4.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/inter_v4.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/inter_v4.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -233,11 +233,8 @@
 		return;
 	}
 
-	if (startFrame >= 0) {
-		_vm->_game->_preventScroll = true;
+	if (startFrame >= 0)
 		_vm->_vidPlayer->primaryPlay(startFrame, lastFrame, breakKey, palCmd, palStart, palEnd, 0);
-		_vm->_game->_preventScroll = false;
-	}
 
 	if (close)
 		_vm->_vidPlayer->primaryClose();

Modified: scummvm/branches/gsoc2009-mods/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/inter_v6.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/inter_v6.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -164,12 +164,9 @@
 		return;
 	}
 
-	if (startFrame >= 0) {
-		_vm->_game->_preventScroll = true;
+	if (startFrame >= 0)
 		_vm->_vidPlayer->primaryPlay(startFrame, lastFrame, breakKey,
 				palCmd, palStart, palEnd, 0, -1, false, -1, true);
-		_vm->_game->_preventScroll = false;
-	}
 
 	if (close)
 		_vm->_vidPlayer->primaryClose();

Modified: scummvm/branches/gsoc2009-mods/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/mult_v2.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/mult_v2.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -1105,8 +1105,6 @@
 	int16 baseFrame, palFrame, lastFrame;
 	uint16 flags;
 
-	_vm->_game->_preventScroll = true;
-
 	if (_vm->_draw->_renderFlags & 0x100) {
 		x = VAR(55);
 		y = VAR(56);
@@ -1115,7 +1113,6 @@
 
 	if (key.imdFile == -1) {
 		_vm->_vidPlayer->primaryClose();
-		_vm->_game->_preventScroll = false;
 		return;
 	}
 
@@ -1131,15 +1128,12 @@
 	if ((palFrame != -1) && (lastFrame != -1))
 		if ((lastFrame - palFrame) < startFrame)
 			if (!(key.flags & 0x4000)) {
-				_vm->_game->_preventScroll = false;
 				_vm->_vidPlayer->primaryClose();
 				return;
 			}
 
-	if (!_vm->_vidPlayer->primaryOpen(imdFile, x, y, flags)) {
-		_vm->_game->_preventScroll = false;
+	if (!_vm->_vidPlayer->primaryOpen(imdFile, x, y, flags))
 		return;
-	}
 
 	if (palFrame == -1)
 		palFrame = 0;
@@ -1265,9 +1259,6 @@
 		}
 	}
 
-	if (!hasImds && (_vm->_draw->_showCursor == 3))
-		_vm->_game->_preventScroll = false;
-
 	doSoundAnim(stop, frame);
 	WRITE_VAR(22, frame);
 

Modified: scummvm/branches/gsoc2009-mods/engines/gob/save/saveload_playtoons.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/save/saveload_playtoons.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/save/saveload_playtoons.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -47,6 +47,8 @@
 	{  "titre.007", kSaveModeExists, 0, 0}, // Playtoons CK 2 empty title (???)
 	{  "titre.008", kSaveModeExists, 0, 0}, // Playtoons CK 3 empty title (???)
 	{  "mdo.def",  kSaveModeExists, 0, 0},
+	{  "dan.itk",  kSaveModeNone, 0, 0},
+	{  "did.inf",  kSaveModeSave, 0, 0},
 };
 
 SaveLoad::SaveMode SaveLoad_Playtoons::getSaveMode(const char *fileName) const {

Modified: scummvm/branches/gsoc2009-mods/engines/gob/util.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/gob/util.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/gob/util.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -141,7 +141,8 @@
 		y -= _vm->_video->_screenDeltaY;
 
 		_vm->_util->setMousePos(x, y);
-		_vm->_game->evaluateScroll(x, y);
+
+		_vm->_game->wantScroll(x, y);
 	}
 }
 

Modified: scummvm/branches/gsoc2009-mods/engines/kyra/gui.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/kyra/gui.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/kyra/gui.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -95,7 +95,8 @@
 	if (_vm->gameFlags().gameID == GI_LOL) {
 		printMenuText(getMenuTitle(menu), textX, textY, menu.textColor, 0, 9);
 	} else {
-		printMenuText(getMenuTitle(menu), textX - 1, textY + 1, defaultColor1(), defaultColor2(), 0);
+		if (_vm->gameFlags().platform != Common::kPlatformAmiga)
+			printMenuText(getMenuTitle(menu), textX - 1, textY + 1, defaultColor1(), defaultColor2(), 0);
 		printMenuText(getMenuTitle(menu), textX, textY, menu.textColor, 0, 0);
 	}
 
@@ -142,7 +143,9 @@
 				else
 					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8);
 			} else {
-				printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
+				if (_vm->gameFlags().platform != Common::kPlatformAmiga)
+					printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
+
 				if (i == menu.highlightedItem)
 					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0);
 				else
@@ -158,7 +161,8 @@
 				menu.item[i].labelY = menu.item[i].y + 3;
 				printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 10);
 			} else {
-				printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX - 1, menu.y + menu.item[i].labelY + 1, defaultColor1(), 0, 0);
+				if (_vm->gameFlags().platform != Common::kPlatformAmiga)
+					printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX - 1, menu.y + menu.item[i].labelY + 1, defaultColor1(), 0, 0);
 				printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 0);
 			}
 		}
@@ -253,7 +257,8 @@
 		textY++;
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8);
 	} else {
-		printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
+		if (_vm->gameFlags().platform != Common::kPlatformAmiga)
+			printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0);
 	}
 }
@@ -278,7 +283,8 @@
 		textY++;
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8);
 	} else {
-		printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
+		if (_vm->gameFlags().platform != Common::kPlatformAmiga)
+			printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
 		printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0);
 	}
 }
@@ -324,7 +330,10 @@
 		return 0;
 
 	_screen->hideMouse();
-	_screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 0xF8);
+	if (_vm->gameFlags().platform == Common::kPlatformAmiga)
+		_screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 17);
+	else
+		_screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 0xF8);
 	_screen->showMouse();
 
 	return 0;
@@ -335,7 +344,10 @@
 		return 0;
 
 	_screen->hideMouse();
-	_screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xF9, 0xFA);
+	if (_vm->gameFlags().platform == Common::kPlatformAmiga)
+		_screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 31, 18);
+	else
+		_screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xF9, 0xFA);
 	_screen->showMouse();
 
 	return 0;

Modified: scummvm/branches/gsoc2009-mods/engines/kyra/gui_lok.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/kyra/gui_lok.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/kyra/gui_lok.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -56,10 +56,10 @@
 			return 0;
 		} else {
 			_screen->hideMouse();
-			_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, 12);
+			_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12);
 			snd_playSoundEffect(0x35);
 			setMouseItem(inventoryItem);
-			updateSentenceCommand(_itemList[inventoryItem], _takenList[0], 179);
+			updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[0], 179);
 			_itemInHand = inventoryItem;
 			_screen->showMouse();
 			_currentCharacter->inventoryItems[itemOffset] = 0xFF;
@@ -68,10 +68,14 @@
 		if (inventoryItem != 0xFF) {
 			snd_playSoundEffect(0x35);
 			_screen->hideMouse();
-			_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, 12);
+			_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12);
 			_screen->drawShape(0, _shapes[216+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
 			setMouseItem(inventoryItem);
-			updateSentenceCommand(_itemList[inventoryItem], _takenList[1], 179);
+			// TODO: Proper support for both taken strings in Amiga version
+			if (_flags.platform == Common::kPlatformAmiga)
+				updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[0], 179);
+			else
+				updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[1], 179);
 			_screen->showMouse();
 			_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
 			_itemInHand = inventoryItem;
@@ -80,7 +84,7 @@
 			_screen->hideMouse();
 			_screen->drawShape(0, _shapes[216+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
 			_screen->setMouseCursor(1, 1, _shapes[0]);
-			updateSentenceCommand(_itemList[_itemInHand], _placedList[0], 179);
+			updateSentenceCommand(_itemList[getItemListIndex(_itemInHand)], _placedList[0], 179);
 			_screen->showMouse();
 			_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
 			_itemInHand = -1;
@@ -204,9 +208,29 @@
 	uint8 *screen = new uint8[Screen::SCREEN_W*Screen::SCREEN_H];
 	if (screen) {
 		_screen->queryPageFromDisk("SEENPAGE.TMP", 0, screen);
+		uint8 screenPal[768];
 
-		uint8 screenPal[768];
-		_screen->getRealPalette(2, screenPal);
+		if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
+			_screen->getRealPalette(0, &screenPal[ 0]);
+			_screen->getRealPalette(1, &screenPal[96]);
+
+			// Set the interface palette text color to white
+			screenPal[96 + 16 * 3 + 0] = 0xFF;
+			screenPal[96 + 16 * 3 + 1] = 0xFF;
+			screenPal[96 + 16 * 3 + 2] = 0xFF;
+
+			if (_screen->isInterfacePaletteEnabled()) {
+				for (int y = 0; y < 64; ++y) {
+					for (int x = 0; x < 320; ++x) {
+						screen[(y + 136) * Screen::SCREEN_W + x] += 32;
+					}
+				}
+			}
+
+		} else {
+			_screen->getRealPalette(2, screenPal);
+		}
+
 		::createThumbnail(&dst, screen, Screen::SCREEN_W, Screen::SCREEN_H, screenPal);
 	}
 	delete[] screen;
@@ -365,6 +389,13 @@
 		offsetOptions = 10;
 		offsetOn = 0;
 		walkspeedGarbageOffset = 0;
+	} else if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
+		// English Amiga version
+		offset = 23;
+		offsetOn = 23;
+		offsetOptions = 32;
+		walkspeedGarbageOffset = 2;
+		offsetMainMenu = 23;
 	}
 
 	assert(offset + 27 < _vm->_guiStringsSize);
@@ -448,8 +479,14 @@
 		_vm->snd_playSoundEffect(0x36);
 		return 0;
 	}
-	// XXX
-	_screen->setPaletteIndex(0xFE, 60, 60, 0);
+
+	if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
+		_screen->setPaletteIndex(0x10, 0x3F, 0x3F, 0x3F);
+		_screen->setInterfacePalette(_screen->getPalette(1), 0x3F, 0x3F, 0x3F);
+	} else {
+		_screen->setPaletteIndex(0xFE, 60, 60, 0);
+	}
+
 	for (int i = 0; i < 6; i++) {
 		_menuButtonData[i].data0Val1 = _menuButtonData[i].data1Val1 = _menuButtonData[i].data2Val1 = 4;
 		_menuButtonData[i].data0Callback = _redrawShadedButtonFunctor;
@@ -639,12 +676,12 @@
 }
 
 void GUI_LoK::redrawTextfield() {
-	_screen->fillRect(38, 91, 287, 102, 250);
+	_screen->fillRect(38, 91, 287, 102, _vm->gameFlags().platform == Common::kPlatformAmiga ? 18 : 250);
 	_text->printText(_savegameName, 38, 92, 253, 0, 0);
 
 	_screen->_charWidth = -2;
 	int width = _screen->getTextWidth(_savegameName);
-	_screen->fillRect(39 + width, 93, 45 + width, 100, 254);
+	_screen->fillRect(39 + width, 93, 45 + width, 100, _vm->gameFlags().platform == Common::kPlatformAmiga ? 31 : 254);
 	_screen->_charWidth = 0;
 
 	_screen->updateScreen();
@@ -923,6 +960,9 @@
 			menu.item[3].itemString = "ERROR";
 		}
 	} else {
+		if (_vm->gameFlags().platform == Common::kPlatformAmiga)
+			clickableOffset = 5;
+
 		menu.item[4].enabled = 0;
 		menu.item[4].labelString = 0;
 	}

Modified: scummvm/branches/gsoc2009-mods/engines/kyra/items_lok.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/kyra/items_lok.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/kyra/items_lok.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -414,7 +414,7 @@
 
 	if (unk1 == 0 && unk2 != 0) {
 		assert(_itemList && _droppedList);
-		updateSentenceCommand(_itemList[item], _droppedList[0], 179);
+		updateSentenceCommand(_itemList[getItemListIndex(item)], _droppedList[0], 179);
 	}
 
 	return 1;
@@ -434,7 +434,7 @@
 
 	setMouseItem(_itemInHand);
 	assert(_itemList && _takenList);
-	updateSentenceCommand(_itemList[_itemInHand], _takenList[1], 179);
+	updateSentenceCommand(_itemList[getItemListIndex(_itemInHand)], _takenList[1], 179);
 	_screen->showMouse();
 	clickEventHandler2();
 }
@@ -693,7 +693,7 @@
 
 	if (itemPos != -1) {
 		restoreItemRect1(x, y);
-		_screen->fillRect(_itemPosX[itemPos], _itemPosY[itemPos], _itemPosX[itemPos] + 15, _itemPosY[itemPos] + 15, 12, 0);
+		_screen->fillRect(_itemPosX[itemPos], _itemPosY[itemPos], _itemPosX[itemPos] + 15, _itemPosY[itemPos] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12, 0);
 		backUpItemRect1(x, y);
 	}
 
@@ -715,7 +715,7 @@
 	} else {
 		_characterList[0].inventoryItems[itemPos] = 0xFF;
 		_screen->hideMouse();
-		_screen->fillRect(_itemPosX[itemPos], _itemPosY[itemPos], _itemPosX[itemPos] + 15, _itemPosY[itemPos] + 15, 12, 0);
+		_screen->fillRect(_itemPosX[itemPos], _itemPosY[itemPos], _itemPosX[itemPos] + 15, _itemPosY[itemPos] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12, 0);
 		_screen->showMouse();
 	}
 	_screen->showMouse();
@@ -879,7 +879,7 @@
 	_screen->_curPage = page;
 	_screen->hideMouse();
 	for (int i = 0; i < 10; ++i) {
-		_screen->fillRect(_itemPosX[i], _itemPosY[i], _itemPosX[i] + 15, _itemPosY[i] + 15, 12, page);
+		_screen->fillRect(_itemPosX[i], _itemPosY[i], _itemPosX[i] + 15, _itemPosY[i] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12, page);
 		if (_currentCharacter->inventoryItems[i] != 0xFF) {
 			uint8 item = _currentCharacter->inventoryItems[i];
 			_screen->drawShape(page, _shapes[216+item], _itemPosX[i], _itemPosY[i], 0, 0);
@@ -910,5 +910,62 @@
 	_screen->copyBlockToPage(_screen->_curPage, xpos, ypos, 4<<3, 32, _itemBkgBackUp[1]);
 }
 
+int KyraEngine_LoK::getItemListIndex(uint16 item) {
+	if (_flags.platform != Common::kPlatformAmiga)
+		return item;
+
+	// "Unknown item" is at 81.
+	if (item == 0xFFFF || item == 0xFF)
+		return 81;
+	// The first item names are mapped directly
+	else if (item <= 28)
+		return item;
+	// There's only one string for "Fireberries"
+	else if (item >= 29 && item <= 33)
+		return 29;
+	// Correct offsets
+	else if (item >= 34 && item <= 59)
+		return item - 4;
+	// There's only one string for "Red Potion"
+	else if (item >= 60 && item <= 61)
+		return 56;
+	// There's only one string for "Blue Potion"
+	else if (item >= 62 && item <= 63)
+		return 57;
+	// There's only one string for "Yellow Potion"
+	else if (item >= 64 && item <= 65)
+		return 58;
+	// Correct offsets
+	else if (item >= 66 && item <= 69)
+		return item - 7;
+	// There's only one string for "Fresh Water"
+	else if (item >= 70 && item <= 71)
+		return 63;
+	// There's only one string for "Salt Water"
+	else if (item >= 72 && item <= 73)
+		return 64;
+	// There's only one string for "Mineral Water"
+	else if (item >= 74 && item <= 75)
+		return 65;
+	// There's only one string for "Magical Water"
+	else if (item >= 76 && item <= 77)
+		return 66;
+	// There's only one string for "Empty Flask"
+	else if (item >= 78 && item <= 79)
+		return 67;
+	// There's only one string for "Scroll"
+	else if (item >= 80 && item <= 89)
+		return 68;
+	// There's only one string for "Parchment scrap"
+	else if (item >= 90 && item <= 94)
+		return 69;
+	// Correct offsets
+	else if (item >= 95)
+		return item - 25;
+
+	// This should never happen, but still GCC warns about it.
+	return 81;
+}
+
 } // end of namespace Kyra
 

Modified: scummvm/branches/gsoc2009-mods/engines/kyra/kyra_lok.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/engines/kyra/kyra_lok.cpp	2009-08-11 21:53:06 UTC (rev 43290)
+++ scummvm/branches/gsoc2009-mods/engines/kyra/kyra_lok.cpp	2009-08-11 22:35:56 UTC (rev 43291)
@@ -368,6 +368,9 @@
 	loadMainScreen();
 	_screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
 
+	if (_flags.platform == Common::kPlatformAmiga)
+		_screen->loadPaletteTable("PALETTE.DAT", 6);
+
 	// XXX
 	_animator->initAnimStateList();
 	setCharactersInDefaultScene();
@@ -669,7 +672,7 @@
 			currentRoom->itemsTable[item] = 0xFF;
 			setMouseItem(item2);
 			assert(_itemList && _takenList);

@@ 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