[Scummvm-cvs-logs] SF.net SVN: scummvm:[42462] scummvm/branches/gsoc2009-16bit

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Tue Jul 14 01:36:23 CEST 2009


Revision: 42462
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42462&view=rev
Author:   Kirben
Date:     2009-07-13 23:36:22 +0000 (Mon, 13 Jul 2009)

Log Message:
-----------
Merged revisions 42433-42434,42436,42439-42441,42443-42446,42455-42456,42458-42459 via svnmerge from 
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk

........
  r42433 | sunmax | 2009-07-13 10:55:30 +1000 (Mon, 13 Jul 2009) | 5 lines
  
  Reverted my previous change (fprintf vs fputs),
  and properly implemented fputs for stderr case
  on PS2 ;-)
........
  r42434 | Kirben | 2009-07-13 17:55:11 +1000 (Mon, 13 Jul 2009) | 1 line
  
  Fix bug #2820472 - MAZE: Keyboard input fault.
........
  r42436 | wjpalenstijn | 2009-07-14 00:46:14 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Add one more type of IQ-points filename (for bug #2820803)
........
  r42439 | buddha_ | 2009-07-14 02:52:09 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Fix for bug #2669415 (FW: half walking speed in a screen).
........
  r42440 | buddha_ | 2009-07-14 03:09:40 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Fix compilation under Windows (The fabs-calls were causing error C2668 about 'ambiguous call to overloaded function').
........
  r42441 | sev | 2009-07-14 03:28:49 +1000 (Tue, 14 Jul 2009) | 2 lines
  
  Add Drascula engine to the credits
........
  r42443 | lordhoto | 2009-07-14 03:48:13 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Got rid of Screen_LoL::_paletteConvTable.
........
  r42444 | lordhoto | 2009-07-14 04:31:42 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Support transparent guioptions update on game launch for AdvancedMetaEngine.
........
  r42445 | lordhoto | 2009-07-14 04:32:03 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Add transparent GUI options update for SCUMM too.
........
  r42446 | lordhoto | 2009-07-14 04:47:32 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Refactor GUI options update into a function in Common: updateGameGUIOptions.
........
  r42455 | fingolfin | 2009-07-14 08:08:56 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Unify PS2 and non-PS2 alloc code in Common::Array code (if this causes regressions somewhere, we better find a fix that also works on PS2)
........
  r42456 | cyx | 2009-07-14 08:11:54 +1000 (Tue, 14 Jul 2009) | 1 line
  
  tucker: fixed issues with dirty rects handling (tracker item #2597763)
........
  r42458 | cyx | 2009-07-14 08:19:10 +1000 (Tue, 14 Jul 2009) | 1 line
  
  tucker: added workaround for original game glitch (tracker item #2597763)
........
  r42459 | fingolfin | 2009-07-14 08:19:33 +1000 (Tue, 14 Jul 2009) | 1 line
  
  Completed name of the creator of our logo
........

Modified Paths:
--------------
    scummvm/branches/gsoc2009-16bit/AUTHORS
    scummvm/branches/gsoc2009-16bit/backends/platform/ps2/fileio.cpp
    scummvm/branches/gsoc2009-16bit/common/array.h
    scummvm/branches/gsoc2009-16bit/common/util.cpp
    scummvm/branches/gsoc2009-16bit/common/util.h
    scummvm/branches/gsoc2009-16bit/engines/advancedDetector.cpp
    scummvm/branches/gsoc2009-16bit/engines/cine/script_fw.cpp
    scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.cpp
    scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.h
    scummvm/branches/gsoc2009-16bit/engines/kyra/staticres.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/detection.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/he/intern_he.h
    scummvm/branches/gsoc2009-16bit/engines/scumm/input.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/script_v5.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.h
    scummvm/branches/gsoc2009-16bit/engines/sword1/sound.cpp
    scummvm/branches/gsoc2009-16bit/engines/tucker/locations.cpp
    scummvm/branches/gsoc2009-16bit/engines/tucker/resource.cpp
    scummvm/branches/gsoc2009-16bit/engines/tucker/sequences.cpp
    scummvm/branches/gsoc2009-16bit/engines/tucker/tucker.cpp
    scummvm/branches/gsoc2009-16bit/engines/tucker/tucker.h
    scummvm/branches/gsoc2009-16bit/gui/credits.h
    scummvm/branches/gsoc2009-16bit/tools/credits.pl

Property Changed:
----------------
    scummvm/branches/gsoc2009-16bit/


Property changes on: scummvm/branches/gsoc2009-16bit
___________________________________________________________________
Modified: svnmerge-integrated
   - /scummvm/trunk:1-42430 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/branches/gsoc2008-gui:1-31703
   + /scummvm/trunk:1-42461 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/branches/gsoc2008-gui:1-31703

Modified: scummvm/branches/gsoc2009-16bit/AUTHORS
===================================================================
--- scummvm/branches/gsoc2009-16bit/AUTHORS	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/AUTHORS	2009-07-13 23:36:22 UTC (rev 42462)
@@ -57,8 +57,12 @@
 
     Cinematique evo 2:
        Vincent Hamm          - original CruisE engine author
-       Paul Gilbert
+       Paul Gilbert         
 
+    Drascula:
+       Filippos Karapetis   
+       Pawel Kolodziejski   
+
     FOTAQ:
        Gregory Montoir      
        Joost Peters         
@@ -324,7 +328,7 @@
      Dobo Balazs           - Website design
      Yaroslav Fedevych     - HTML/CSS for the website
      David Jensen          - SVG logo conversion
-     Jean Marc             - ScummVM logo
+     Jean Marc Gimenez     - ScummVM logo
      Raina                 - ScummVM forum buttons
 
   Code contributions

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/ps2/fileio.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/ps2/fileio.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/ps2/fileio.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -507,6 +507,13 @@
 
 int ps2_fputs(const char *s, FILE *stream) {
 	int len = strlen(s);
+
+	if (stream == stderr || stream == stdout) {
+		printf("%s", s);
+		sioprintf("%s", s);
+		return len;
+	}
+
 	if (ps2_fwrite(s, 1, len, stream) == (size_t)len)
 		return len;
 	else

Modified: scummvm/branches/gsoc2009-16bit/common/array.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/common/array.h	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/common/array.h	2009-07-13 23:36:22 UTC (rev 42462)
@@ -222,13 +222,7 @@
 
 		T *old_storage = _storage;
 		_capacity = newCapacity;
-		// PS2 gcc 3.2.2 can't do "new T[newCapacity]()" but only
-		// "new T[newCapacity]" -> quick fix until we update tools.
-		#ifndef __PLAYSTATION2__
-		_storage = new T[newCapacity]();
-		#else
 		_storage = new T[newCapacity];
-		#endif
 		assert(_storage);
 
 		if (old_storage) {
@@ -279,13 +273,7 @@
 				// If there is not enough space, allocate more and
 				// copy old elements over.
 				uint newCapacity = roundUpCapacity(_size + n);
-				// PS2 gcc 3.2.2 can't do "new T[newCapacity]()" but only
-				// "new T[newCapacity]" -> quick fix until we update tools.
-				#ifndef __PLAYSTATION2__
-				newStorage = new T[newCapacity]();
-				#else
 				newStorage = new T[newCapacity];
-				#endif
 				assert(newStorage);
 				copy(_storage, _storage + idx, newStorage);
 				pos = newStorage + idx;

Modified: scummvm/branches/gsoc2009-16bit/common/util.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/common/util.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/common/util.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -24,6 +24,7 @@
 
 #include "common/util.h"
 #include "common/system.h"
+#include "common/config-manager.h"
 #include "gui/debugger.h"
 #include "engines/engine.h"
 
@@ -420,6 +421,14 @@
 	return res;
 }
 
+void updateGameGUIOptions(const uint32 options) {
+	if ((options && !ConfMan.hasKey("guioptions")) ||
+	    (ConfMan.hasKey("guioptions") && options != parseGameGUIOptions(ConfMan.get("guioptions")))) {
+		ConfMan.set("guioptions", getGameGUIOptionsDescription(options));
+		ConfMan.flushToDisk();
+	}
+}
+
 }	// End of namespace Common
 
 
@@ -477,11 +486,7 @@
 
 
 	// Print the error message to stderr
-#ifndef __PLAYSTATION2__
 	fputs(buf_output, stderr);
-#else
-	fprintf(stderr, "%s", buf_output);
-#endif
 
 	// Unless this error -originated- within the debugger itself, we
 	// now invoke the debugger, if available / supported.

Modified: scummvm/branches/gsoc2009-16bit/common/util.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/common/util.h	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/common/util.h	2009-07-13 23:36:22 UTC (rev 42462)
@@ -284,6 +284,13 @@
 uint32 parseGameGUIOptions(const String &str);
 String getGameGUIOptionsDescription(uint32 options);
 
+/**
+ * Updates the GUI options of the current config manager
+ * domain, when they differ to the ones passed as
+ * parameter.
+ */
+void updateGameGUIOptions(const uint32 options);
+
 }	// End of namespace Common
 
 

Modified: scummvm/branches/gsoc2009-16bit/engines/advancedDetector.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/advancedDetector.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/advancedDetector.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -291,15 +291,18 @@
 		}
 	}
 
-	if (agdDesc == 0) {
+	if (agdDesc == 0)
 		return Common::kNoGameDataFoundError;
-	}
 
+	// If the GUI options were updated, we catch this here and update them in the users config
+	// file transparently.
+	Common::updateGameGUIOptions(agdDesc->guioptions | params.guioptions);
+
 	debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str());
-	if (!createInstance(syst, engine, agdDesc)) {
+	if (!createInstance(syst, engine, agdDesc))
 		return Common::kNoGameDataFoundError;
-	}
-	return Common::kNoError;
+	else
+		return Common::kNoError;
 }
 
 struct SizeMD5 {

Modified: scummvm/branches/gsoc2009-16bit/engines/cine/script_fw.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/cine/script_fw.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/cine/script_fw.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -1443,6 +1443,38 @@
 int FWScript::o1_break() {
 	debugC(5, kCineDebugScript, "Line: %d: break", _line);
 
+	// WORKAROUND for bug #2669415 ("FW: half walking speed in a screen").
+	// The problem was that in Amiga/Atari ST versions of Future Wars the
+	// walking speed has halved in a forest scene where a monk's robe hangs
+	// on a tree branch (Up and to the left from the medieval castle's front).
+	//
+	// Initialization script for the scene is PART02.PRC's 26th script (011_INIT)
+	// and the background used in the scene is L11.PI1. The difference between
+	// the PC version and the Amiga/Atari ST version of the script is that the
+	// PC version calls scripts 37 and 36 for handling movement of the character
+	// when Amiga/Atari ST version calls scripts 22 and 21 for the same purpose
+	// (Scripts 37 and 22 handle vertical movement, 36 and 21 the horizontal).
+	//
+	// The called scripts only differ functionally so that all BREAK opcodes have been
+	// doubled in the Amiga/Atari ST versions (i.e. one BREAK has become two BREAKs)
+	// and in script 21 after LABEL_25 there's an extra opcode that isn't in script 36:
+	// SET globalvars[251], 0.
+	//
+	// As a BREAK opcode stops the execution of a script it causes a pause and
+	// with the BREAKs doubled the pause is twice as long in the Amiga/Atari ST versions.
+	// Thus the longer pause is eliminated by running only one BREAK when several
+	// are designated (i.e. ignoring a BREAK if there's another BREAK after it).
+	//
+	// TODO: Check whether the speed is halved in any other scenes in Amiga/Atari ST versions under ScummVM
+	// TODO: Check whether the speed is halved when running the original executable under an emulator
+	if (g_cine->getGameType() == Cine::GType_FW &&
+		(g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) &&
+		_pos < _script._size && _script.getByte(_pos) == (0x4F + 1) && // Is the next opcode a BREAK too?
+		scumm_stricmp(currentPrcName, "PART02.PRC") == 0 &&
+		scumm_stricmp(renderer->getBgName(), "L11.PI1") == 0) {
+		return 0;
+	}
+
 	return 1;
 }
 

Modified: scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -912,7 +912,7 @@
 void Screen_LoL::convertPC98Gfx(uint8 *data, int w, int h, int pitch) {
 	while (h--) {
 		for (int i = 0; i < w; ++i) {
-			*data = _paletteConvTable[*data];
+			*data = (*data >> 4) & (*data & 0x0F);
 			++data;
 		}
 
@@ -927,7 +927,7 @@
 	while (h--) {
 		for (int i = 0; i < w; ++i) {
 			if (*data != _cursorColorKey)
-				*data = _paletteConvTable[*data];
+				*data = (*data >> 4) & (*data & 0x0F);
 			++data;
 		}
 

Modified: scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.h	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/kyra/screen_lol.h	2009-07-13 23:36:22 UTC (rev 42462)
@@ -109,7 +109,6 @@
 
 	uint8 *_levelOverlays[8];
 
-	static const uint8 _paletteConvTable[256];
 	void mergeOverlay(int x, int y, int w, int h);
 	void postProcessCursor(uint8 *data, int width, int height, int pitch);
 };

Modified: scummvm/branches/gsoc2009-16bit/engines/kyra/staticres.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/kyra/staticres.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/kyra/staticres.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -3159,42 +3159,6 @@
 
 const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable256C);
 
-// 256 -> 16 color conversion table
-const uint8 Screen_LoL::_paletteConvTable[256] = {
-	0x0, 0x1, 0x0, 0x3, 0x0, 0x5, 0x0, 0x7,
-	0x0, 0x9, 0x0, 0xB, 0x0, 0xD, 0x0, 0xF,
-	0x1, 0x1, 0x1, 0x3, 0x1, 0x5, 0x1, 0x7,
-	0x1, 0x9, 0x1, 0xB, 0x1, 0xD, 0x1, 0xF,
-	0x2, 0x1, 0x2, 0x3, 0x2, 0x5, 0x2, 0x7,
-	0x2, 0x9, 0x2, 0xB, 0x2, 0xD, 0x2, 0xF,
-	0x3, 0x1, 0x3, 0x3, 0x3, 0x5, 0x3, 0x7,
-	0x3, 0x9, 0x3, 0xB, 0x3, 0xD, 0x3, 0xF,
-	0x4, 0x1, 0x4, 0x3, 0x4, 0x5, 0x4, 0x7,
-	0x4, 0x9, 0x4, 0xB, 0x4, 0xD, 0x4, 0xF,
-	0x5, 0x1, 0x5, 0x3, 0x5, 0x5, 0x5, 0x7,
-	0x5, 0x9, 0x5, 0xB, 0x5, 0xD, 0x5, 0xF,
-	0x6, 0x1, 0x6, 0x3, 0x6, 0x5, 0x6, 0x7,
-	0x6, 0x9, 0x6, 0xB, 0x6, 0xD, 0x6, 0xF,
-	0x7, 0x1, 0x7, 0x3, 0x7, 0x5, 0x7, 0x7,
-	0x7, 0x9, 0x7, 0xB, 0x7, 0xD, 0x7, 0xF,
-	0x8, 0x1, 0x8, 0x3, 0x8, 0x5, 0x8, 0x7,
-	0x8, 0x9, 0x8, 0xB, 0x8, 0xD, 0x8, 0xF,
-	0x9, 0x1, 0x9, 0x3, 0x9, 0x5, 0x9, 0x7,
-	0x9, 0x9, 0x9, 0xB, 0x9, 0xD, 0x9, 0xF,
-	0xA, 0x1, 0xA, 0x3, 0xA, 0x5, 0xA, 0x7,
-	0xA, 0x9, 0xA, 0xB, 0xA, 0xD, 0xA, 0xF,
-	0xB, 0x1, 0xB, 0x3, 0xB, 0x5, 0xB, 0x7,
-	0xB, 0x9, 0xB, 0xB, 0xB, 0xD, 0xB, 0xF,
-	0xC, 0x1, 0xC, 0x3, 0xC, 0x5, 0xC, 0x7,
-	0xC, 0x9, 0xC, 0xB, 0xC, 0xD, 0xC, 0xF,
-	0xD, 0x1, 0xD, 0x3, 0xD, 0x5, 0xD, 0x7,
-	0xD, 0x9, 0xD, 0xB, 0xD, 0xD, 0xD, 0xF,
-	0xE, 0x1, 0xE, 0x3, 0xE, 0x5, 0xE, 0x7,
-	0xE, 0x9, 0xE, 0xB, 0xE, 0xD, 0xE, 0xF,
-	0xF, 0x1, 0xF, 0x3, 0xF, 0x5, 0xF, 0x7,
-	0xF, 0x9, 0xF, 0xB, 0xF, 0xD, 0xF, 0xF
-};
-
 const char * const LoLEngine::_languageExt[] = {
 	"ENG",
 	"FRE",

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/detection.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/detection.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/detection.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -882,6 +882,10 @@
 	if (res.game.platform == Common::kPlatformFMTowns && res.game.version == 3)
 		res.game.midi = MDT_TOWNS;
 
+	// If the GUI options were updated, we catch this here and update them in the users config
+	// file transparently.
+	Common::updateGameGUIOptions(res.game.guioptions);
+
 	// Finally, we have massaged the GameDescriptor to our satisfaction, and can
 	// instantiate the appropriate game engine. Hooray!
 	switch (res.game.version) {

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/he/intern_he.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/he/intern_he.h	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/he/intern_he.h	2009-07-13 23:36:22 UTC (rev 42462)
@@ -359,6 +359,8 @@
 	virtual void setupScummVars();
 	virtual void resetScummVars();
 
+	virtual void parseEvent(Common::Event event);
+
 	virtual void initCharset(int charset);
 
 	virtual void clearDrawQueues();
@@ -386,6 +388,7 @@
 	byte VAR_PLATFORM;
 	byte VAR_PLATFORM_VERSION;
 	byte VAR_CURRENT_CHARSET;
+	byte VAR_KEY_STATE;
 	byte VAR_COLOR_DEPTH;
 };
 

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/input.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/input.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/input.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -55,148 +55,176 @@
 	msClicked = 2
 };
 
-void ScummEngine::parseEvents() {
-	Common::Event event;
+#ifdef ENABLE_HE
+void ScummEngine_v80he::parseEvent(Common::Event event) {
+	ScummEngine::parseEvent(event);
 
-	while (_eventMan->pollEvent(event)) {
+	// Keyboard is controlled via variable
+	switch (event.type) {
+	case Common::EVENT_KEYDOWN:
+		if (event.kbd.keycode == Common::KEYCODE_LEFT)
+			VAR(VAR_KEY_STATE) |= 1;
 
-		switch (event.type) {
-		case Common::EVENT_KEYDOWN:
-			if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9'
-				&& (event.kbd.flags == Common::KBD_ALT ||
-					event.kbd.flags == Common::KBD_CTRL)) {
-				_saveLoadSlot = event.kbd.keycode - '0';
+		if (event.kbd.keycode == Common::KEYCODE_RIGHT)
+			VAR(VAR_KEY_STATE) |= 2;
 
-				//  don't overwrite autosave (slot 0)
-				if (_saveLoadSlot == 0)
-					_saveLoadSlot = 10;
+		if (event.kbd.keycode == Common::KEYCODE_UP)
+			VAR(VAR_KEY_STATE) |= 4;
 
-				sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
-				_saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2;
-				_saveTemporaryState = false;
-			} else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') {
-				_fastMode ^= 1;
-			} else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'g') {
-				_fastMode ^= 2;
-			} else if ((event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') ||
-					event.kbd.ascii == '~' || event.kbd.ascii == '#') {
-				_debugger->attach();
-			} else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 's') {
-				_res->resourceStats();
-			} else {
-				// Normal key press, pass on to the game.
-				_keyPressed = event.kbd;
-			}
+		if (event.kbd.keycode == Common::KEYCODE_DOWN)
+			VAR(VAR_KEY_STATE) |= 8;
 
-			if (_game.heversion >= 80) {
-				// FIXME: Move this code & VAR_KEY_STATE to class ScummEngine_v80he
+		if (event.kbd.keycode == Common::KEYCODE_LSHIFT || event.kbd.keycode == Common::KEYCODE_RSHIFT)
+			VAR(VAR_KEY_STATE) |= 16;
 
-				// Keyboard is controlled via variable
-				int keyState = 0;
+		if (event.kbd.keycode == Common::KEYCODE_LCTRL || event.kbd.keycode == Common::KEYCODE_RCTRL)
+			VAR(VAR_KEY_STATE) |= 32;
+		break;
 
-				if (event.kbd.keycode == Common::KEYCODE_LEFT) // Left
-					keyState = 1;
+	case Common::EVENT_KEYUP:
+		if (event.kbd.keycode == Common::KEYCODE_LEFT)
+			VAR(VAR_KEY_STATE) &= ~1;
 
-				if (event.kbd.keycode == Common::KEYCODE_RIGHT) // Right
-					keyState |= 2;
+		if (event.kbd.keycode == Common::KEYCODE_RIGHT)
+			VAR(VAR_KEY_STATE) &= ~2;
 
-				if (event.kbd.keycode == Common::KEYCODE_UP) // Up
-					keyState |= 4;
+		if (event.kbd.keycode == Common::KEYCODE_UP)
+			VAR(VAR_KEY_STATE) &= ~4;
 
-				if (event.kbd.keycode == Common::KEYCODE_DOWN) // Down
-					keyState |= 8;
+		if (event.kbd.keycode == Common::KEYCODE_DOWN)
+			VAR(VAR_KEY_STATE) &= ~8;
 
-				if (event.kbd.flags == Common::KBD_SHIFT)
-					keyState |= 16;
+		if (event.kbd.keycode == Common::KEYCODE_LSHIFT || event.kbd.keycode == Common::KEYCODE_RSHIFT)
+			VAR(VAR_KEY_STATE) &= ~16;
 
-				if (event.kbd.flags == Common::KBD_CTRL)
-					keyState |= 32;
+		if (event.kbd.keycode == Common::KEYCODE_LCTRL || event.kbd.keycode == Common::KEYCODE_RCTRL)
+			VAR(VAR_KEY_STATE) &= ~32;
+		break;
 
-				VAR(VAR_KEY_STATE) = keyState;
-			}
+	default:
+		break;
+	}
+}
+#endif
 
-			// FIXME: We are using ASCII values to index the _keyDownMap here,
-			// yet later one code which checks _keyDownMap will use KEYCODEs
-			// to do so. That is, we are mixing ascii and keycode values here,
-			// which is bad. We probably should be only using keycodes, but at
-			// least INSANE checks for "Shift-V" by looking for the 'V' key
-			// being pressed. It would be easy to solve that by also storing
-			// the modifier flags. However, since getKeyState() is also called
-			// by scripts, we have to be careful with semantic changes.
-			if (_keyPressed.ascii >= 512)
-				debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed.ascii);
-			else
-				_keyDownMap[_keyPressed.ascii] = true;
-			break;
+void ScummEngine::parseEvent(Common::Event event) {
+	switch (event.type) {
+	case Common::EVENT_KEYDOWN:
+		if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9'
+			&& (event.kbd.flags == Common::KBD_ALT ||
+				event.kbd.flags == Common::KBD_CTRL)) {
+			_saveLoadSlot = event.kbd.keycode - '0';
 
-		case Common::EVENT_KEYUP:
-			if (event.kbd.ascii >= 512) {
-				debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii);
-			} else {
-				_keyDownMap[event.kbd.ascii] = false;
+			//  don't overwrite autosave (slot 0)
+			if (_saveLoadSlot == 0)
+				_saveLoadSlot = 10;
 
-				// Due to some weird bug with capslock key pressed
-				// generated keydown event is for lower letter but
-				// keyup is for upper letter
-				// On most (all?) keyboards it is safe to assume that
-				// both upper and lower letters are unpressed on keyup event
-				//
-				// Fixes bug #1709430: "FT: CAPSLOCK + V enables cheating for all fights"
-				//
-				// Fingolfin remarks: This wouldn't be a problem if we used keycodes.
-				_keyDownMap[toupper(event.kbd.ascii)] = false;
-			}
-			break;
+			sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
+			_saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2;
+			_saveTemporaryState = false;
+		} else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') {
+			_fastMode ^= 1;
+		} else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'g') {
+			_fastMode ^= 2;
+		} else if ((event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') ||
+				event.kbd.ascii == '~' || event.kbd.ascii == '#') {
+			_debugger->attach();
+		} else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 's') {
+			_res->resourceStats();
+		} else {
+			// Normal key press, pass on to the game.
+			_keyPressed = event.kbd;
+		}
 
+		// FIXME: We are using ASCII values to index the _keyDownMap here,
+		// yet later one code which checks _keyDownMap will use KEYCODEs
+		// to do so. That is, we are mixing ascii and keycode values here,
+		// which is bad. We probably should be only using keycodes, but at
+		// least INSANE checks for "Shift-V" by looking for the 'V' key
+		// being pressed. It would be easy to solve that by also storing
+		// the modifier flags. However, since getKeyState() is also called
+		// by scripts, we have to be careful with semantic changes.
+		if (_keyPressed.ascii >= 512)
+			debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed.ascii);
+		else
+			_keyDownMap[_keyPressed.ascii] = true;
+		break;
 
-		// We update the mouse position whenever the mouse moves or a click occurs.
-		// The latter is done to accomodate systems with a touchpad / pen controller.
-		case Common::EVENT_LBUTTONDOWN:
-		case Common::EVENT_RBUTTONDOWN:
-		case Common::EVENT_MOUSEMOVE:
-			if (event.type == Common::EVENT_LBUTTONDOWN)
-				_leftBtnPressed |= msClicked|msDown;
-			else if (event.type == Common::EVENT_RBUTTONDOWN)
-				_rightBtnPressed |= msClicked|msDown;
-			_mouse.x = event.mouse.x;
-			_mouse.y = event.mouse.y;
+	case Common::EVENT_KEYUP:
+		if (event.kbd.ascii >= 512) {
+			debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii);
+		} else {
+			_keyDownMap[event.kbd.ascii] = false;
 
-			if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
-				_mouse.x -= (Common::kHercW - _screenWidth * 2) / 2;
-				_mouse.x >>= 1;
-				_mouse.y = _mouse.y * 4 / 7;
-			} else if (_useCJKMode && _textSurfaceMultiplier == 2) {
-				_mouse.x >>= 1;
-				_mouse.y >>= 1;
-			}
-			break;
-		case Common::EVENT_LBUTTONUP:
-			_leftBtnPressed &= ~msDown;
-			break;
+			// Due to some weird bug with capslock key pressed
+			// generated keydown event is for lower letter but
+			// keyup is for upper letter
+			// On most (all?) keyboards it is safe to assume that
+			// both upper and lower letters are unpressed on keyup event
+			//
+			// Fixes bug #1709430: "FT: CAPSLOCK + V enables cheating for all fights"
+			//
+			// Fingolfin remarks: This wouldn't be a problem if we used keycodes.
+			_keyDownMap[toupper(event.kbd.ascii)] = false;
+		}
+		break;
 
-		case Common::EVENT_RBUTTONUP:
-			_rightBtnPressed &= ~msDown;
-			break;
 
-		// The following two cases enable dialog choices to be scrolled
-		// through in the SegaCD version of MI. Values are taken from script-14.
-		// See bug report #1193185 for details.
-		case Common::EVENT_WHEELDOWN:
-			if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD)
-				_keyPressed = Common::KeyState(Common::KEYCODE_7, 55);	// '7'
-			break;
+	// We update the mouse position whenever the mouse moves or a click occurs.
+	// The latter is done to accomodate systems with a touchpad / pen controller.
+	case Common::EVENT_LBUTTONDOWN:
+	case Common::EVENT_RBUTTONDOWN:
+	case Common::EVENT_MOUSEMOVE:
+		if (event.type == Common::EVENT_LBUTTONDOWN)
+			_leftBtnPressed |= msClicked|msDown;
+		else if (event.type == Common::EVENT_RBUTTONDOWN)
+			_rightBtnPressed |= msClicked|msDown;
+		_mouse.x = event.mouse.x;
+		_mouse.y = event.mouse.y;
 
-		case Common::EVENT_WHEELUP:
-			if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD)
-				_keyPressed = Common::KeyState(Common::KEYCODE_6, 54);	// '6'
-			break;
+		if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
+			_mouse.x -= (Common::kHercW - _screenWidth * 2) / 2;
+			_mouse.x >>= 1;
+			_mouse.y = _mouse.y * 4 / 7;
+		} else if (_useCJKMode && _textSurfaceMultiplier == 2) {
+			_mouse.x >>= 1;
+			_mouse.y >>= 1;
+		}
+		break;
+	case Common::EVENT_LBUTTONUP:
+		_leftBtnPressed &= ~msDown;
+		break;
 
-		default:
-			break;
-		}
+	case Common::EVENT_RBUTTONUP:
+		_rightBtnPressed &= ~msDown;
+		break;
+
+	// The following two cases enable dialog choices to be scrolled
+	// through in the SegaCD version of MI. Values are taken from script-14.
+	// See bug report #1193185 for details.
+	case Common::EVENT_WHEELDOWN:
+		if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD)
+			_keyPressed = Common::KeyState(Common::KEYCODE_7, 55);	// '7'
+		break;
+
+	case Common::EVENT_WHEELUP:
+		if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD)
+			_keyPressed = Common::KeyState(Common::KEYCODE_6, 54);	// '6'
+		break;
+
+	default:
+		break;
 	}
 }
 
+void ScummEngine::parseEvents() {
+	Common::Event event;
+
+	while (_eventMan->pollEvent(event)) {
+		parseEvent(event);
+	}
+}
+
 #ifdef ENABLE_HE
 void ScummEngine_v90he::clearClickedStatus() {
 	ScummEngine::clearClickedStatus();

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/script_v5.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/script_v5.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/script_v5.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -1750,7 +1750,7 @@
 			while ((chr = fetchScriptByte()))
 				filename += chr;
 
-			if (filename.hasPrefix("iq-") || filename.hasPrefix("IQ-") || filename.hasSuffix("-iq")) {
+			if (filename.hasPrefix("iq-") || filename.hasPrefix("IQ-") || filename.hasSuffix("-iq") || filename.hasSuffix("-IQ")) {
 				filename = _targetName + ".iq";
 			} else {
 				error("SO_SAVE_STRING: Unsupported filename %s", filename.c_str());

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -445,7 +445,6 @@
 	VAR_SCRIPT_CYCLE = 0xFF;
 
 	VAR_NUM_GLOBAL_OBJS = 0xFF;
-	VAR_KEY_STATE = 0xFF;
 
 	// Use g_scumm from error() ONLY
 	g_scumm = this;
@@ -789,6 +788,7 @@
 	VAR_PLATFORM = 0xFF;
 	VAR_PLATFORM_VERSION = 0xFF;
 	VAR_CURRENT_CHARSET = 0xFF;
+	VAR_KEY_STATE = 0xFF;
 	VAR_COLOR_DEPTH = 0xFF;
 }
 

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.h	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.h	2009-07-13 23:36:22 UTC (rev 42462)
@@ -28,6 +28,7 @@
 
 #include "engines/engine.h"
 #include "common/endian.h"
+#include "common/events.h"
 #include "common/file.h"
 #include "common/savefile.h"
 #include "common/keyboard.h"
@@ -498,6 +499,8 @@
 public:
 	void parseEvents();	// Used by IMuseDigital::startSound
 protected:
+	virtual void parseEvent(Common::Event event);
+
 	void waitForTimer(int msec_delay);
 	virtual void processInput();
 	virtual void processKeyboard(Common::KeyState lastKeyHit);
@@ -1379,8 +1382,6 @@
 	byte VAR_SCRIPT_CYCLE;			// Used in runScript()/runObjectScript()
 	byte VAR_NUM_SCRIPT_CYCLES;		// Used in runAllScripts()
 
-	byte VAR_KEY_STATE;			// Used in parseEvents()
-
 	// Exists both in V7 and in V72HE:
 	byte VAR_NUM_GLOBAL_OBJS;
 };

Modified: scummvm/branches/gsoc2009-16bit/engines/sword1/sound.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/sword1/sound.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/sword1/sound.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -127,9 +127,9 @@
 				size /= 2;
 			int16 prev_be_value = (int16)SWAP_BYTES_16(*((uint16*)(data)));
 			for (uint32 i = 1 ; i < size ; ++i) {
-				le_diff_sum += fabs(data[i] - data[i-1]);
+				le_diff_sum += fabs((double)(data[i] - data[i-1]));
 				int16 be_value = (int16)SWAP_BYTES_16(*((uint16*)(data + i)));
-				be_diff_sum += fabs(be_value - prev_be_value);
+				be_diff_sum += fabs((double)(be_value - prev_be_value));
 				prev_be_value = be_value;
 			}
 			delete [] data;

Modified: scummvm/branches/gsoc2009-16bit/engines/tucker/locations.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/tucker/locations.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/tucker/locations.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -195,8 +195,8 @@
 				for (int j = 0; j < 2; ++j) {
 					const int offset = (_updateLocationYPosTable2[i] + j) * 640 + _updateLocationXPosTable2[i];
 					_locationBackgroundGfxBuf[offset] = 142 + j * 2;
-					addDirtyRect(offset % 640, offset / 640, 1, 1);
 				}
+				addDirtyRect(_updateLocationXPosTable2[i], _updateLocationYPosTable2[i], 1, 2);
 				_updateLocationYPosTable2[i] += 2;
 				if (_updateLocationYPosTable2[i] > _updateLocationYMaxTable[i]) {
 					_updateLocationYPosTable2[i] = 0;
@@ -540,13 +540,14 @@
 		x2 = 15 - _flagsTable[27];
 	}
 	for (int i = 0; i < x1; ++i) {
-		execData3PreUpdate_locationNum6Helper2(13125 + i * 8, _data3GfxBuf + _dataTable[238].sourceOffset);
-		execData3PreUpdate_locationNum6Helper2(13245 - i * 8, _data3GfxBuf + _dataTable[238].sourceOffset);
+		execData3PreUpdate_locationNum6Helper2(20 * 640 + 325 + i * 8, _data3GfxBuf + _dataTable[238].sourceOffset);
+		execData3PreUpdate_locationNum6Helper2(20 * 640 + 445 - i * 8, _data3GfxBuf + _dataTable[238].sourceOffset);
 	}
 	for (int i = 0; i < x2; ++i) {
-		execData3PreUpdate_locationNum6Helper3(13125 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238].sourceOffset);
-		execData3PreUpdate_locationNum6Helper3(13249 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238].sourceOffset);
+		execData3PreUpdate_locationNum6Helper3(20 * 640 + 325 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238].sourceOffset);
+		execData3PreUpdate_locationNum6Helper3(20 * 640 + 449 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238].sourceOffset);
 	}
+	addDirtyRect(0, 20, 640, 51);
 }
 
 void TuckerEngine::execData3PreUpdate_locationNum6Helper2(int dstOffset, const uint8 *src) {
@@ -562,7 +563,6 @@
 			}
 		}
 	}
-	addDirtyRect(dstOffset % 640, dstOffset / 640, 8, 51);
 }
 
 void TuckerEngine::execData3PreUpdate_locationNum6Helper3(int dstOffset, const uint8 *src) {
@@ -575,7 +575,6 @@
 			}
 		}
 	}
-	addDirtyRect(dstOffset % 640, dstOffset / 640, 4, 51);
 }
 
 void TuckerEngine::execData3PostUpdate_locationNum6() {
@@ -661,7 +660,7 @@
 				_locationBackgroundGfxBuf[offset + 640 * j + i] = colorsTable[(j - 1) * 3  + i + 1];
 			}
 		}
-		addDirtyRect(_updateLocationXPosTable2[0] - 1, _updateLocationYPosTable2[0], 3, 4);
+		addDirtyRect(_updateLocationXPosTable2[0] - 1, _updateLocationYPosTable2[0] + 1, 3, 4);
 		_updateLocationYPosTable2[0] += 2;
 		if (_updateLocationYPosTable2[0] > 120) {
 			_updateLocationYPosTable2[0] = 0;
@@ -1013,9 +1012,10 @@
 		if (num > 0) {
 			const int w = _dataTable[num].xSize;
 			const int h = _dataTable[num].ySize;
-			const int dstOffset = (_updateLocationYPosTable2[i] / 16 - h / 2) * 640 + (_updateLocationXPosTable2[i] - w / 2);
-			Graphics::decodeRLE_248(_locationBackgroundGfxBuf + dstOffset, _data3GfxBuf + _dataTable[num].sourceOffset, w, h, 0, 0, false);
-			addDirtyRect(dstOffset % 640, dstOffset / 640, w, h);
+			const int x = _updateLocationXPosTable2[i] - w / 2;
+			const int y = _updateLocationYPosTable2[i] / 16 - h / 2;
+			Graphics::decodeRLE_248(_locationBackgroundGfxBuf + y * 640 + x, _data3GfxBuf + _dataTable[num].sourceOffset, w, h, 0, 0, false);
+			addDirtyRect(x, y, w, h);
 		}
 	}
 }
@@ -3033,17 +3033,17 @@
 	_panelState = 1;
 	setCursorType(2);
 	int pos = getPositionForLine(22, _infoBarBuf);
-	int offset = (_flagsTable[143] == 0) ? 57688 : 46168;
+	int offset = (_flagsTable[143] == 0) ? 90 * 640 + 88 : 72 * 640 + 88;
 	drawStringAlt(offset, color, &_infoBarBuf[pos]);
-	Graphics::drawStringChar(_locationBackgroundGfxBuf + offset + 5760, 62, 640, color, _charsetGfxBuf);
+	Graphics::drawStringChar(_locationBackgroundGfxBuf + offset + 9 * 640, 62, 640, color, _charsetGfxBuf);
 	if (_flagsTable[143] != 0) {
 		pos = getPositionForLine(_flagsTable[143] * 2 + 23, _infoBarBuf);
-		drawStringAlt(offset + 11520, color, &_infoBarBuf[pos]);
+		drawStringAlt(offset + 18 * 640, color, &_infoBarBuf[pos]);
 		pos = getPositionForLine(_flagsTable[143] * 2 + 24, _infoBarBuf);
-		drawStringAlt(offset + 17280, color, &_infoBarBuf[pos]);
+		drawStringAlt(offset + 27 * 640, color, &_infoBarBuf[pos]);
 	}
 	execData3PreUpdate_locationNum70Helper();
-	drawStringAlt(offset + 5768, color, _updateLocation70String, _updateLocation70StringLen);
+	drawStringAlt(offset + 9 * 640 + 8, color, _updateLocation70String, _updateLocation70StringLen);
 }
 
 void TuckerEngine::execData3PreUpdate_locationNum70Helper() {

Modified: scummvm/branches/gsoc2009-16bit/engines/tucker/resource.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/tucker/resource.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/tucker/resource.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -467,7 +467,7 @@
 		copyLocBitmap(filename, 0, false);
 		Graphics::copyRect(_quadBackgroundGfxBuf + 134400, 320, _locationBackgroundGfxBuf + 320, 640, 320, 140);
 	}
-	_fullRedrawCounter = 2;
+	_fullRedraw = true;
 }
 
 void TuckerEngine::loadObj() {

Modified: scummvm/branches/gsoc2009-16bit/engines/tucker/sequences.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/tucker/sequences.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/tucker/sequences.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -102,7 +102,7 @@
 				counter2 = 0;
 			}
 		}
-		_fullRedrawCounter = 2;
+		_fullRedraw = true;
 		++counter3;
 		if (counter3 == 2) {
 			counter3 = 0;
@@ -172,7 +172,7 @@
 	stopSounds();
 	loadImage("congrat.pcx", _loadTempBuf, 1);
 	Graphics::copyRect(_locationBackgroundGfxBuf, 640, _loadTempBuf, 320, 320, 200);
-	_fullRedrawCounter = 2;
+	_fullRedraw = true;
 	redrawScreen(0);
 	while (!_quitGame && _timerCounter2 < 450) {
 		while (_fadePaletteCounter < 14) {
@@ -242,7 +242,7 @@
 			++_fadePaletteCounter;
 		}
 		Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf, 320, 320, 200);
-		_fullRedrawCounter = 2;
+		_fullRedraw = true;
 		updateSprites();
 		drawSprite(0);
 		redrawScreen(0);
@@ -259,7 +259,7 @@
 			--_fadePaletteCounter;
 		}
 		Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf, 320, 320, 200);
-		_fullRedrawCounter = 2;
+		_fullRedraw = true;
 		updateSprites();
 		drawSprite(0);
 		redrawScreen(0);
@@ -294,7 +294,7 @@
 			++_fadePaletteCounter;
 		}
 		Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200);
-		_fullRedrawCounter = 2;
+		_fullRedraw = true;
 		redrawScreen(0);
 		waitForTimer(3);
 		++i;
@@ -305,11 +305,12 @@
 			--_fadePaletteCounter;
 		}
 		Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200);
-		_fullRedrawCounter = 2;
+		_fullRedraw = true;
 		redrawScreen(0);
 		waitForTimer(3);
 	} while (_fadePaletteCounter > 0);
 	memcpy(_currentPalette, backupPalette, 256 * 3);
+	_fullRedraw = true;
 }
 
 void TuckerEngine::handleMapSequence() {
@@ -337,7 +338,7 @@
 		waitForTimer(2);
 		updateMouseState();
 		Graphics::copyRect(_locationBackgroundGfxBuf + _scrollOffset, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200);
-		_fullRedrawCounter = 2;
+		_fullRedraw = true;
 		if (_flagsTable[7] > 0 && _mousePosX > 30 && _mousePosX < 86 && _mousePosY > 36 && _mousePosY < 86) {
 			textNum = 13;
 			_nextLocationNum = (_partNum == 1) ? 3 : 65;
@@ -459,7 +460,7 @@
 		waitForTimer(2);
 		updateMouseState();
 		Graphics::copyRect(_locationBackgroundGfxBuf + _scrollOffset, 640, _quadBackgroundGfxBuf, 320, 320, 200);
-		_fullRedrawCounter = 2;
+		_fullRedraw = true;
 		if (_fadePaletteCounter < 14) {
 			fadeOutPalette();
 			++_fadePaletteCounter;

Modified: scummvm/branches/gsoc2009-16bit/engines/tucker/tucker.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/tucker/tucker.cpp	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/tucker/tucker.cpp	2009-07-13 23:36:22 UTC (rev 42462)
@@ -305,7 +305,7 @@
 	_currentGfxBackground = 0;
 	_fadePaletteCounter = 0;
 	memset(_currentPalette, 0, sizeof(_currentPalette));
-	_fullRedrawCounter = 0;
+	_fullRedraw = false;
 	_dirtyRectsPrevCount = _dirtyRectsCount = 0;
 
 	_updateLocationFadePaletteCounter = 0;
@@ -469,7 +469,7 @@
 					_mainSpritesBaseOffset = 1;
 				}
 			}
-			_fullRedrawCounter = 2;
+			_fullRedraw = true;
 		} else {
 			_currentGfxBackground = _quadBackgroundGfxBuf;
 		}
@@ -1460,7 +1460,7 @@
 		}
 	}
 	if (scrollPrevOffset != _scrollOffset) {
-		_fullRedrawCounter = 2;
+		_fullRedraw = true;
 	}
 }
 
@@ -1733,34 +1733,40 @@
 		} else if (_xPosCurrent > 320 && _xPosCurrent < 640) {
 			srcX += 320;
 		}
-		int offset = _backgroundSprOffset + srcY * 640 + srcX;
-		Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _backgroundSpriteDataPtr + frameOffset + 12, srcW, srcH, 0, _locationHeightTable[_locationNum], false);
-		addDirtyRect(offset % 640, offset / 640, srcW, srcH);
+		srcX += _backgroundSprOffset;
+		Graphics::decodeRLE_248(_locationBackgroundGfxBuf + srcY * 640 + srcX, _backgroundSpriteDataPtr + frameOffset + 12, srcW, srcH, 0, _locationHeightTable[_locationNum], false);
+		addDirtyRect(srcX, srcY, srcW, srcH);
 	}
 }
 
 void TuckerEngine::drawCurrentSprite() {
+	// Workaround original game glitch: skip first bud frame drawing when entering location (tracker item #2597763)
+	if ((_locationNum == 17 || _locationNum == 18) && _currentSpriteAnimationFrame == 16) {
+		return;
+	}
 	SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame];
-	int offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset) * 640 + _xPosCurrent;
+	int yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset;
+	int xPos = _xPosCurrent;
 	if (_mirroredDrawing == 0) {
-		offset += chr->xOffset - 14;
+		xPos += chr->xOffset - 14;
 	} else {
-		offset -= chr->xSize + chr->xOffset - 14;
+		xPos -= chr->xSize + chr->xOffset - 14;
 	}
-	Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize,
+	Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize,
 		chr->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0);
-	addDirtyRect(offset % 640, offset / 640, chr->xSize, chr->ySize);
+	addDirtyRect(xPos, yPos, chr->xSize, chr->ySize);
 	if (_currentSpriteAnimationLength > 1) {
 		SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2];
-		offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset) * 640 + _xPosCurrent;
+		yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset;
+		xPos = _xPosCurrent;
 		if (_mirroredDrawing == 0) {
-			offset += chr2->xOffset - 14;
+			xPos += chr2->xOffset - 14;
 		} else {
-			offset -= chr2->xSize + chr2->xOffset - 14;
+			xPos -= chr2->xSize + chr2->xOffset - 14;
 		}
-		Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize,
+		Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize,
 			chr2->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0);
-		addDirtyRect(offset % 640, offset / 640, chr2->xSize, chr2->ySize);
+		addDirtyRect(xPos, yPos, chr2->xSize, chr2->ySize);
 	}
 }
 
@@ -1891,13 +1897,13 @@
 		int srcH = READ_LE_UINT16(p + frameOffset + 2);
 		int srcX = READ_LE_UINT16(p + frameOffset + 8);
 		int srcY = READ_LE_UINT16(p + frameOffset + 10);
-		int dstOffset = s->gfxBackgroundOffset + srcX;
-		if (dstOffset < 600 && (_scrollOffset + 320 < dstOffset || _scrollOffset - srcW > dstOffset)) {
+		int xPos = s->gfxBackgroundOffset + srcX;
+		if (xPos < 600 && (_scrollOffset + 320 < xPos || _scrollOffset - srcW > xPos)) {
 			return;
 		}
 		s->xSource = srcX;
 		s->gfxBackgroundOffset += s->backgroundOffset;
-		uint8 *dstPtr = _locationBackgroundGfxBuf + srcY * 640 + dstOffset;
+		uint8 *dstPtr = _locationBackgroundGfxBuf + srcY * 640 + xPos;
 		const uint8 *srcPtr = p + frameOffset + 12;
 		switch (s->colorType) {
 		case 0:
@@ -1910,7 +1916,7 @@
 			Graphics::decodeRLE_248(dstPtr, srcPtr, srcW, srcH, 0, s->yMaxBackground, s->flipX != 0);
 			break;
 		}
-		addDirtyRect(dstOffset % 640, dstOffset / 640 + srcY, srcW, srcH);
+		addDirtyRect(xPos, srcY, srcW, srcH);
 	}
 }
 
@@ -2826,7 +2832,7 @@
 		Graphics::drawStringChar(_locationBackgroundGfxBuf + offset, numStr[i], 640, 102, _charsetGfxBuf);
 		offset += 8;
 	}
-	addDirtyRect(x, y, Graphics::_charset.charW * 3, Graphics::_charset.charH);
+	addDirtyRect(_scrollOffset + x, y, Graphics::_charset.charW * 3, Graphics::_charset.charH);
 }
 
 void TuckerEngine::drawStringAlt(int offset, int color, const uint8 *str, int strLen) {
@@ -3740,20 +3746,20 @@
 		y = count * 10;
 	}
 	for (int i = 0; i < count; ++i) {
-		int dstOffset = xStart - lines[i].w / 2;
-		if (dstOffset < _scrollOffset) {
-			dstOffset = _scrollOffset;
-		} else if (dstOffset > _scrollOffset + 320 - lines[i].w) {
-			dstOffset = _scrollOffset + 320 - lines[i].w;
+		int yPos, xPos = xStart - lines[i].w / 2;
+		if (xPos < _scrollOffset) {
+			xPos = _scrollOffset;
+		} else if (xPos > _scrollOffset + 320 - lines[i].w) {
+			xPos = _scrollOffset + 320 - lines[i].w;
 		}
 		if (_conversationOptionsCount != 0) {
-			dstOffset = xStart + _scrollOffset;
-			dstOffset += (i * 10 + y) * 640;
+			xPos = xStart + _scrollOffset;
+			yPos = i * 10 + y;
 			_panelItemWidth = count;
 		} else {
-			dstOffset += (y - (count - i) * 10) * 640;
+			yPos = y - (count - i) * 10;
 		}
-		drawSpeechTextLine(dataPtr, lines[i].offset, lines[i].count, dstOffset, color);
+		drawSpeechTextLine(dataPtr, lines[i].offset, lines[i].count, xPos, yPos, color);
 	}
 }
 
@@ -3780,23 +3786,24 @@
 	return ret;
 }
 
-void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int dstOffset, uint8 color) {
-	int startOffset = dstOffset;
+void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color) {
+	int xStart = x;
 	int i = 0;
 	for (; i < count && dataPtr[pos] != '\n'; ++i) {
-		Graphics::drawStringChar(_locationBackgroundGfxBuf + dstOffset, dataPtr[pos], 640, color, _charsetGfxBuf);
-		dstOffset += _charWidthTable[dataPtr[pos]];
+		Graphics::drawStringChar(_locationBackgroundGfxBuf + y * 640 + x, dataPtr[pos], 640, color, _charsetGfxBuf);
+		x += _charWidthTable[dataPtr[pos]];
 		++pos;
 	}
-	addDirtyRect(startOffset % 640, startOffset / 640, Graphics::_charset.charW * i, Graphics::_charset.charH);
+	addDirtyRect(xStart, y, Graphics::_charset.charW * i, Graphics::_charset.charH);
 }
 
 void TuckerEngine::redrawScreen(int offset) {
-	debug(9, "redrawScreen() _fullRedrawCounter %d offset %d _dirtyRectsCount %d", _fullRedrawCounter, offset, _dirtyRectsCount);
+	debug(9, "redrawScreen() _fullRedraw %d offset %d _dirtyRectsCount %d", _fullRedraw, offset, _dirtyRectsCount);
 	assert(offset <= kScreenWidth);
-	if (_fullRedrawCounter > 0) {
-		--_fullRedrawCounter;
+	if (_fullRedraw) {
+		_fullRedraw = false;
 		_system->copyRectToScreen(_locationBackgroundGfxBuf + offset, kScreenPitch, 0, 0, kScreenWidth, kScreenHeight);
+		_dirtyRectsPrevCount = _dirtyRectsCount = 0;
 	} else {
 		const int xClip = offset % kScreenPitch;
 		const int yClip = offset / kScreenPitch;
@@ -3806,13 +3813,11 @@
 		}
 		for (int i = 0; i < _dirtyRectsCount; ++i) {
 			redrawScreenRect(clipRect, _dirtyRectsTable[0][i]);
+			_dirtyRectsTable[1][i] = _dirtyRectsTable[0][i];
 		}
 		_dirtyRectsPrevCount = _dirtyRectsCount;
-		for (int i = 0; i < _dirtyRectsCount; ++i) {
-			_dirtyRectsTable[1][i] = _dirtyRectsTable[0][i];
-		}
+		_dirtyRectsCount = 0;
 	}
-	_dirtyRectsCount = 0;
 	_system->updateScreen();
 }
 
@@ -3827,17 +3832,33 @@
 		if (w <= 0 || h <= 0) {
 			return;
 		}
+#if 0
+		static const uint8 outlineColor = 0;
+		memset(_locationBackgroundGfxBuf + r.top           * 640 + r.left, outlineColor, w);
+		memset(_locationBackgroundGfxBuf + (r.top + h - 1) * 640 + r.left, outlineColor, w);
+		for (int y = r.top; y < r.top + h; ++y) {
+			_locationBackgroundGfxBuf[y * 640 + r.left] = outlineColor;
+			_locationBackgroundGfxBuf[y * 640 + r.left + w - 1] = outlineColor;
+		}
+#endif
 		_system->copyRectToScreen(src, 640, r.left, r.top, w, h);
 	}
 }
 
 void TuckerEngine::addDirtyRect(int x, int y, int w, int h) {
-	if (_dirtyRectsCount >= kMaxDirtyRects) {
-		_fullRedrawCounter = 2;
-		_dirtyRectsCount = 0;
-	} else {
-		_dirtyRectsTable[0][_dirtyRectsCount] = Common::Rect(x, y, x + w, y + h);
-		++_dirtyRectsCount;
+	if (!_fullRedraw) {
+		Common::Rect r(x, y, x + w, y + h);
+		for (int i = 0; i < _dirtyRectsCount; ++i) {
+			if (_dirtyRectsTable[0][i].contains(r)) {
+				return;
+			}
+		}
+		if (_dirtyRectsCount < kMaxDirtyRects) {
+			_dirtyRectsTable[0][_dirtyRectsCount] = r;
+			++_dirtyRectsCount;
+		} else {
+			_fullRedraw = true;
+		}
 	}
 }
 

Modified: scummvm/branches/gsoc2009-16bit/engines/tucker/tucker.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/tucker/tucker.h	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/engines/tucker/tucker.h	2009-07-13 23:36:22 UTC (rev 42462)
@@ -342,7 +342,7 @@
 	void playSpeechForAction(int i);
 	void drawSpeechText(int xStart, int y, const uint8 *dataPtr, int num, int color);
 	int splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth);
-	void drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int dstOffset, uint8 color);
+	void drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color);
 	void redrawScreen(int offset);
 	void redrawScreenRect(const Common::Rect &clip, const Common::Rect &dirty);
 	void addDirtyRect(int x, int y, int w, int h);
@@ -801,7 +801,7 @@
 	uint8 *_currentGfxBackground;
 	int _fadePaletteCounter;
 	uint8 _currentPalette[768];
-	int _fullRedrawCounter;
+	bool _fullRedraw;
 	int _dirtyRectsPrevCount, _dirtyRectsCount;
 	Common::Rect _dirtyRectsTable[2][kMaxDirtyRects];
 

Modified: scummvm/branches/gsoc2009-16bit/gui/credits.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/gui/credits.h	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/gui/credits.h	2009-07-13 23:36:22 UTC (rev 42462)
@@ -63,6 +63,10 @@
 "C2""original CruisE engine author",
 "C0""Paul Gilbert",
 "",
+"C1""Drascula",
+"C0""Filippos Karapetis",
+"C0""Pawel Kolodziejski",
+"",
 "C1""FOTAQ",
 "C0""Gregory Montoir",
 "C0""Joost Peters",
@@ -377,7 +381,7 @@
 "C2""HTML/CSS for the website",
 "C0""David Jensen",
 "C2""SVG logo conversion",
-"C0""Jean Marc",
+"C0""Jean Marc Gimenez",
 "C2""ScummVM logo",
 "C0""Raina",
 "C2""ScummVM forum buttons",

Modified: scummvm/branches/gsoc2009-16bit/tools/credits.pl
===================================================================
--- scummvm/branches/gsoc2009-16bit/tools/credits.pl	2009-07-13 22:49:34 UTC (rev 42461)
+++ scummvm/branches/gsoc2009-16bit/tools/credits.pl	2009-07-13 23:36:22 UTC (rev 42462)
@@ -527,6 +527,11 @@
 		  add_person("Paul Gilbert", "dreammaster", "");
 	  end_section();
 
+	  begin_section("Drascula");
+		  add_person("Filippos Karapetis", "[md5]", "");
+		  add_person("Paweł Kołodziejski", "aquadran", "");
+	  end_section();
+
 	  begin_section("FOTAQ");	# Flight of the Amazon Queen
 		  add_person("Gregory Montoir", "cyx", "");
 		  add_person("Joost Peters", "joostp", "");
@@ -832,7 +837,7 @@
 		  add_person("Dobó Balázs", "draven", "Website design");
 		  add_person("Yaroslav Fedevych", "jafd", "HTML/CSS for the website");
 		  add_person("David Jensen", "Tyst", "SVG logo conversion");
-		  add_person("Jean Marc", "", "ScummVM logo");
+		  add_person("Jean Marc Gimenez", "", "ScummVM logo");
 		  add_person("", "Raina", "ScummVM forum buttons");
 	  end_persons();
 	end_section();


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