aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/inter_v1.cpp3
-rw-r--r--engines/gob/inter_v2.cpp16
-rw-r--r--engines/gob/mult_v2.cpp4
-rw-r--r--engines/gob/util.cpp10
-rw-r--r--engines/gob/util.h1
-rw-r--r--engines/gob/video.h6
-rw-r--r--engines/gob/video_v1.cpp10
-rw-r--r--engines/gob/video_v2.cpp10
8 files changed, 39 insertions, 21 deletions
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 703a4d6d64..1e8084febb 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -1345,7 +1345,7 @@ bool Inter_v1::o1_keyFunc(char &cmdCount, int16 &counter, int16 &retFlag) {
now = _vm->_util->getTimeKey();
if (!_noBusyWait)
if ((now - lastCalled) <= 20)
- _vm->_util->longDelay(20);
+ _vm->_util->longDelay(1);
lastCalled = now;
_noBusyWait = false;
@@ -1413,6 +1413,7 @@ bool Inter_v1::o1_keyFunc(char &cmdCount, int16 &counter, int16 &retFlag) {
storeKey(key);
return false;
} else {
+ _vm->_util->longDelay(1);
key = _vm->_game->checkCollisions(0, 0, 0, 0);
storeKey(key);
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index 53fb283d01..cc84e9036a 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -1633,7 +1633,7 @@ bool Inter_v2::o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag) {
break;
case 50:
- if (_vm->_global->_videoMode != 0x0D) { // || (word_2D479 == 256) {
+ if ((_vm->_global->_videoMode != 0x0D) || (_vm->_global->_colorCount == 256)) {
_vm->_global->_inter_execPtr += 16;
return false;
}
@@ -1647,7 +1647,7 @@ bool Inter_v2::o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag) {
break;
case 52:
- if (_vm->_global->_videoMode != 0x0D) { // || (word_2D479 == 256) {
+ if ((_vm->_global->_videoMode != 0x0D) || (_vm->_global->_colorCount == 256)) {
_vm->_global->_inter_execPtr += 48;
return false;
}
@@ -2204,8 +2204,7 @@ void Inter_v2::o2_setScrollOffset(void) {
_vm->_draw->_word_2FC9E = offset;
_vm->_draw->_word_2FC9C = _vm->_parse->parseValExpr();
}
- _vm->_video->_scrollOffset = _vm->_draw->_word_2FC9E;
- _vm->_video->waitRetrace(_vm->_global->_videoMode);
+ _vm->_util->setScrollOffset(_vm->_draw->_word_2FC9E);
_noBusyWait = true;
/*
@@ -2238,12 +2237,11 @@ void Inter_v2::o2_scroll(void) {
curX = startX;
curY = startY;
- while ((curX != endX) || (curY != endY)) {
+ while (!_vm->_quitRequested && ((curX != endX) || (curY != endY))) {
curX = stepX > 0 ? MIN(curX + stepX, (int) endX) : MAX(curX + stepX, (int) endX);
curY = stepY > 0 ? MIN(curY + stepY, (int) endY) : MAX(curY + stepY, (int) endY);
_vm->_draw->_word_2FC9E = curX;
- _vm->_video->_scrollOffset = _vm->_draw->_word_2FC9E;
- _vm->_video->waitRetrace(_vm->_global->_videoMode);
+ _vm->_util->setScrollOffset(_vm->_draw->_word_2FC9E);
}
}
@@ -2389,13 +2387,13 @@ void Inter_v2::animPalette(void) {
col = _vm->_global->_pPaletteDesc->vgaPal[_animPalLowIndex[j]];
for (i = _animPalLowIndex[j]; i < _animPalHighIndex[j]; i++)
- _vm->_draw->_vgaPalette[i] = _vm->_global->_pPaletteDesc->vgaPal[i];
+ _vm->_draw->_vgaPalette[i] = _vm->_global->_pPaletteDesc->vgaPal[i + 1];
_vm->_global->_pPaletteDesc->vgaPal[_animPalHighIndex[j]] = col;
} else {
col = _vm->_global->_pPaletteDesc->vgaPal[_animPalHighIndex[j]];
for (i = _animPalHighIndex[j]; i > _animPalLowIndex[j]; i--)
- _vm->_draw->_vgaPalette[i] = _vm->_global->_pPaletteDesc->vgaPal[i];
+ _vm->_draw->_vgaPalette[i] = _vm->_draw->_vgaPalette[i - 1];
_vm->_global->_pPaletteDesc->vgaPal[_animPalLowIndex[j]] = col;
}
diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp
index 10720b23aa..0fc1ba9770 100644
--- a/engines/gob/mult_v2.cpp
+++ b/engines/gob/mult_v2.cpp
@@ -564,8 +564,8 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape,
_animDataAllocated = 0;
}
-/* if (_vm->_snd->_playingSound != 0)
- _vm->_snd->stopSound(10);*/
+ if (_vm->_snd->_playingSound != 0)
+ _vm->_snd->stopSound(10);
WRITE_VAR(57, (uint32)-1);
} else
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index f7c5fa9202..7698262e26 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -188,8 +188,8 @@ void Util::longDelay(uint16 msecs) {
do {
_vm->_video->waitRetrace(_vm->_global->_videoMode);
processInput();
- delay(25);
- } while (g_system->getMillis() < time);
+ delay(15);
+ } while (!_vm->_quitRequested && (g_system->getMillis() < time));
}
void Util::delay(uint16 msecs) {
@@ -494,4 +494,10 @@ void Util::forceMouseUp(void) {
_mouseButtons = 0;
}
+void Util::setScrollOffset(int16 scrollOffset) {
+ processInput();
+ _vm->_video->_scrollOffset = scrollOffset;
+ _vm->_video->waitRetrace(_vm->_global->_videoMode);
+}
+
} // End of namespace Gob
diff --git a/engines/gob/util.h b/engines/gob/util.h
index 701d295f52..8f4d6867c6 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -84,6 +84,7 @@ public:
static void prepareStr(char *str);
void waitMouseRelease(char drawMouse);
void forceMouseUp(void);
+ void setScrollOffset(int16 scrollOffset);
static const char trStr1[];
static const char trStr2[];
diff --git a/engines/gob/video.h b/engines/gob/video.h
index af41934d62..3f6b5152e8 100644
--- a/engines/gob/video.h
+++ b/engines/gob/video.h
@@ -120,7 +120,7 @@ public:
virtual void drawLetter(int16 item, int16 x, int16 y, FontDesc * fontDesc,
int16 color1, int16 color2, int16 transp, SurfaceDesc * dest) = 0;
virtual SurfaceDesc *initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags) = 0;
- virtual void waitRetrace(int16) = 0;
+ virtual void waitRetrace(int16, bool mouse = true) = 0;
virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
int16 x, int16 y, int16 transp, SurfaceDesc * destDesc) = 0;
@@ -136,7 +136,7 @@ public:
virtual void drawLetter(int16 item, int16 x, int16 y, FontDesc * fontDesc,
int16 color1, int16 color2, int16 transp, SurfaceDesc * dest);
virtual SurfaceDesc *initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags);
- virtual void waitRetrace(int16);
+ virtual void waitRetrace(int16, bool mouse = true);
virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
int16 x, int16 y, int16 transp, SurfaceDesc * destDesc);
@@ -149,7 +149,7 @@ public:
virtual void drawLetter(int16 item, int16 x, int16 y, FontDesc * fontDesc,
int16 color1, int16 color2, int16 transp, SurfaceDesc * dest);
virtual SurfaceDesc *initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags);
- virtual void waitRetrace(int16);
+ virtual void waitRetrace(int16, bool mouse = true);
virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
int16 x, int16 y, int16 transp, SurfaceDesc * destDesc);
diff --git a/engines/gob/video_v1.cpp b/engines/gob/video_v1.cpp
index 88ef8a6aa1..15e6f9045e 100644
--- a/engines/gob/video_v1.cpp
+++ b/engines/gob/video_v1.cpp
@@ -29,6 +29,7 @@
#include "gob/global.h"
#include "gob/video.h"
#include "gob/draw.h"
+#include "gob/util.h"
namespace Gob {
@@ -37,11 +38,16 @@ Video_v1::Video_v1(GobEngine *vm) : Video(vm) {
//XXX: Use this function to update the screen for now.
// This should be moved to a better location later on.
-void Video_v1::waitRetrace(int16) {
- CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
+void Video_v1::waitRetrace(int16, bool mouse) {
+ uint32 time;
+
+ if (mouse)
+ CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
if (_vm->_global->_pPrimarySurfDesc) {
+ time = _vm->_util->getTimeKey();
g_system->copyRectToScreen(_vm->_global->_pPrimarySurfDesc->vidPtr, 320, 0, 0, 320, 200);
g_system->updateScreen();
+ _vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time)));
}
}
diff --git a/engines/gob/video_v2.cpp b/engines/gob/video_v2.cpp
index ce5cfa938e..2f71412b69 100644
--- a/engines/gob/video_v2.cpp
+++ b/engines/gob/video_v2.cpp
@@ -29,6 +29,7 @@
#include "gob/global.h"
#include "gob/video.h"
#include "gob/draw.h"
+#include "gob/util.h"
namespace Gob {
@@ -37,12 +38,17 @@ Video_v2::Video_v2(GobEngine *vm) : Video_v1(vm) {
//XXX: Use this function to update the screen for now.
// This should be moved to a better location later on.
-void Video_v2::waitRetrace(int16) {
- CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
+void Video_v2::waitRetrace(int16, bool mouse) {
+ uint32 time;
+
+ if (mouse)
+ CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
if (_vm->_draw->_frontSurface) {
+ time = _vm->_util->getTimeKey();
g_system->copyRectToScreen(_vm->_draw->_frontSurface->vidPtr + _scrollOffset,
_surfWidth, 0, 0, 320, 200);
g_system->updateScreen();
+ _vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time)));
}
}