Index: scumm/insane/insane.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/insane/insane.cpp,v
retrieving revision 1.57
diff -u -r1.57 insane.cpp
--- scumm/insane/insane.cpp	20 Apr 2005 18:21:13 -0000	1.57
+++ scumm/insane/insane.cpp	7 May 2005 01:22:12 -0000
@@ -619,7 +619,7 @@
 }
 
 void Insane::smush_warpMouse(int x, int y, int buttons) {
-	_vm->_system->warpMouse(x, y);
+	_player->warpMouse(x, y, buttons);
 }
 
 void Insane::putActors(void) {
Index: scumm/smush/smush_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.157
diff -u -r1.157 smush_player.cpp
--- scumm/smush/smush_player.cpp	20 Apr 2005 19:59:18 -0000	1.157
+++ scumm/smush/smush_player.cpp	7 May 2005 01:22:12 -0000
@@ -696,7 +696,7 @@
 			_deltaPal[i] = b.getWord();
 		}
 		readPalette(_pal, b);
-		setPalette(_pal);
+		setDirtyColors(0, 255);
 	} else if (b.getSize() == 6) {
 
 		b.getWord();
@@ -706,7 +706,7 @@
 		for (int i = 0; i < 0x300; i++) {
 			_pal[i] = delta_color(_pal[i], _deltaPal[i]);
 		}
-		setPalette(_pal);
+		setDirtyColors(0, 255);
 	} else {
 		error("SmushPlayer::handleDeltaPalette() Wrong size for DeltaPalette");
 	}
@@ -717,7 +717,7 @@
 	debugC(DEBUG_SMUSH, "SmushPlayer::handleNewPalette()");
 
 	readPalette(_pal, b);
-	setPalette(_pal);
+	setDirtyColors(0, 255);
 }
 
 void smush_decode_codec1(byte *dst, byte *src, int left, int top, int height, int width, int dstWidth);
@@ -970,7 +970,7 @@
 	_nbframes = b.getWord();
 	b.getWord();
 	readPalette(_pal, b);
-	setPalette(_pal);
+	setDirtyColors(0, 255);
 }
 
 void SmushPlayer::setupAnim(const char *file) {
@@ -1055,25 +1055,29 @@
 }
 
 void SmushPlayer::setPalette(const byte *palette) {
-	byte palette_colors[1024];
-	byte *p = palette_colors;
-
-	for (int i = 0; i != 256; ++i) {
-		*p++ = _pal[i * 3 + 0] = *palette++; // red
-		*p++ = _pal[i * 3 + 1] = *palette++; // green
-		*p++ = _pal[i * 3 + 2] = *palette++; // blue
-		*p++ = 0;
-	}
-
-	_vm->_system->setPalette(palette_colors, 0, 256);
+	memcpy(_pal, palette, 0x300);
+	setDirtyColors(0, 255);
 }
 
 void SmushPlayer::setPaletteValue(int n, byte r, byte g, byte b) {
 	_pal[n * 3 + 0] = r;
 	_pal[n * 3 + 1] = g;
 	_pal[n * 3 + 2] = b;
+	setDirtyColors(n, n);
+}
+
+void SmushPlayer::setDirtyColors(int min, int max) {
+	if (_palDirtyMin > min)
+		_palDirtyMin = min;
+	if (_palDirtyMax < max)
+		_palDirtyMax = max;
+}
 
-	_vm->_system->setPalette(_pal, n, 1);
+void SmushPlayer::warpMouse(int x, int y, int buttons) {
+	_warpNeeded = true;
+	_warpX = x;
+	_warpY = y;
+	_warpButtons = buttons;
 }
 
 void SmushPlayer::updateScreen() {
@@ -1129,7 +1133,6 @@
 #endif
 
 	uint32 end_time, start_time = _vm->_system->getMillis();
-	_vm->_system->copyRectToScreen(_dst, _width, 0, 0, _width, _height);
 	_updateNeeded = true;
 	end_time = _vm->_system->getMillis();
 	debugC(DEBUG_SMUSH, "Smush stats: updateScreen( %03d )", end_time - start_time);
@@ -1215,6 +1218,9 @@
 	tryCmpFile(filename);
 
 	_updateNeeded = false;
+	_warpNeeded = false;
+	_palDirtyMin = 256;
+	_palDirtyMax = -1;
 	
 	// Hide mouse
 	bool oldMouseState = _vm->_system->showMouse(false);
@@ -1230,13 +1236,36 @@
 	}
 
 	for (;;) {
+		if (_warpNeeded) {
+			_vm->_system->warpMouse(_warpX, _warpY);
+			_warpNeeded = false;
+		}
 		_vm->parseEvents();
 		_vm->processKbd(true);
+		if (_palDirtyMax >= _palDirtyMin) {
+			byte palette_colors[1024];
+			byte *p = palette_colors;
+
+			for (int i = _palDirtyMin; i <= _palDirtyMax; i++) {
+				byte *data = _pal + i * 3;
+
+				*p++ = data[0];
+				*p++ = data[1];
+				*p++ = data[2];
+				*p++ = 0;
+			}
+
+			_vm->_system->setPalette(palette_colors, _palDirtyMin, _palDirtyMax - _palDirtyMin + 1);
+
+			_palDirtyMax = -1;
+			_palDirtyMin = 256;
+		}
 		if (_updateNeeded) {
 			
 			uint32 end_time, start_time;
 			
 			start_time = _vm->_system->getMillis();
+			_vm->_system->copyRectToScreen(_dst, _width, 0, 0, _width, _height);
 			_vm->_system->updateScreen();
 			_updateNeeded = false;
 #ifdef _WIN32_WCE
Index: scumm/smush/smush_player.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.h,v
retrieving revision 1.45
diff -u -r1.45 smush_player.h
--- scumm/smush/smush_player.h	3 Apr 2005 06:27:44 -0000	1.45
+++ scumm/smush/smush_player.h	7 May 2005 01:22:12 -0000
@@ -73,6 +73,10 @@
 
 	byte *_dst;
 	bool _updateNeeded;
+	bool _warpNeeded;
+	int _palDirtyMin, _palDirtyMax;
+	int _warpX, _warpY;
+	int _warpButtons;
 	bool _insanity;
 	bool _middleAudio;
 #ifdef _WIN32_WCE
@@ -88,6 +92,7 @@
 	~SmushPlayer();
 
 	void play(const char *filename, int32 offset = 0, int32 startFrame = 0);
+	void warpMouse(int x, int y, int buttons);
 
 protected:
 	SmushFont *_sf[5];
@@ -98,6 +103,7 @@
 	void insanity(bool);
 	void setPalette(const byte *palette);
 	void setPaletteValue(int n, byte r, byte g, byte b);
+	void setDirtyColors(int min, int max);
 	void seekSan(const char *file, int32 pos, int32 contFrame);
 	const char *getString(int id);
 
