aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2005-05-07 01:52:17 +0000
committerTravis Howell2005-05-07 01:52:17 +0000
commit8ce20af13714644cb2f15de481bb8ac0df870868 (patch)
tree0d3cd841e0162910f1ae70fd7aa925a89157ffc1
parentd08c307870a18d8f422f4321c54a0ac0e8721736 (diff)
downloadscummvm-rg350-8ce20af13714644cb2f15de481bb8ac0df870868.tar.gz
scummvm-rg350-8ce20af13714644cb2f15de481bb8ac0df870868.tar.bz2
scummvm-rg350-8ce20af13714644cb2f15de481bb8ac0df870868.zip
Add eriktorbjorn's patch for:
#1018588 - FT: Xlib async errors in INSANE sequences svn-id: r17937
-rw-r--r--scumm/insane/insane.cpp2
-rw-r--r--scumm/smush/smush_player.cpp63
-rw-r--r--scumm/smush/smush_player.h6
3 files changed, 53 insertions, 18 deletions
diff --git a/scumm/insane/insane.cpp b/scumm/insane/insane.cpp
index 041cfd0181..6daff38fda 100644
--- a/scumm/insane/insane.cpp
+++ b/scumm/insane/insane.cpp
@@ -619,7 +619,7 @@ void Insane::startVideo(const char *filename, int num, int argC, int frameRate,
}
void Insane::smush_warpMouse(int x, int y, int buttons) {
- _vm->_system->warpMouse(x, y);
+ _player->warpMouse(x, y, buttons);
}
void Insane::putActors(void) {
diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp
index eed89dedd0..de24c74693 100644
--- a/scumm/smush/smush_player.cpp
+++ b/scumm/smush/smush_player.cpp
@@ -696,7 +696,7 @@ void SmushPlayer::handleDeltaPalette(Chunk &b) {
_deltaPal[i] = b.getWord();
}
readPalette(_pal, b);
- setPalette(_pal);
+ setDirtyColors(0, 255);
} else if (b.getSize() == 6) {
b.getWord();
@@ -706,7 +706,7 @@ void SmushPlayer::handleDeltaPalette(Chunk &b) {
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 @@ void SmushPlayer::handleNewPalette(Chunk &b) {
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 @@ void SmushPlayer::handleAnimHeader(Chunk &b) {
_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::parseNextFrame() {
}
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 @@ void SmushPlayer::updateScreen() {
#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 @@ void SmushPlayer::play(const char *filename, int32 offset, int32 startFrame) {
tryCmpFile(filename);
_updateNeeded = false;
+ _warpNeeded = false;
+ _palDirtyMin = 256;
+ _palDirtyMax = -1;
// Hide mouse
bool oldMouseState = _vm->_system->showMouse(false);
@@ -1230,13 +1236,36 @@ void SmushPlayer::play(const char *filename, int32 offset, int32 startFrame) {
}
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
diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h
index 78ba109e42..395058d158 100644
--- a/scumm/smush/smush_player.h
+++ b/scumm/smush/smush_player.h
@@ -73,6 +73,10 @@ private:
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 @@ public:
~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 @@ protected:
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);