diff options
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/driver_vga.cpp | 24 | ||||
-rw-r--r-- | engines/gob/game_v1.cpp | 17 | ||||
-rw-r--r-- | engines/gob/video.cpp | 8 | ||||
-rw-r--r-- | engines/gob/video.h | 1 |
4 files changed, 29 insertions, 21 deletions
diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp index 13e6aca4a8..8b7f5105a8 100644 --- a/engines/gob/driver_vga.cpp +++ b/engines/gob/driver_vga.cpp @@ -113,18 +113,26 @@ void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, byte *srcPos = source->getVidMem() + (top * source->getWidth()) + left; byte *destPos = dest->getVidMem() + (y * dest->getWidth()) + x; - while (height--) { - if (transp) { + if (transp) + { + while (height--) { for (int16 i = 0; i < width; ++i) { if (srcPos[i]) destPos[i] = srcPos[i]; - } - } else - for (int16 i = 0; i < width; ++i) - destPos[i] = srcPos[i]; + } - srcPos += source->getWidth(); - destPos += dest->getWidth(); + srcPos += source->getWidth(); + destPos += dest->getWidth(); + } + } + else + { + while (height--) { + memcpy(destPos, srcPos, width); + + srcPos += source->getWidth(); + destPos += dest->getWidth(); + } } } diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 9c18ec1151..d8ebcf1802 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -345,6 +345,7 @@ int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, int16 oldIndex; int16 oldId; uint32 timeKey; + bool firstIteration = true; if (deltaTime >= -1) { _lastCollKey = 0; @@ -357,6 +358,8 @@ int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, resIndex = 0; + timeKey = _vm->_util->getTimeKey(); + if ((_vm->_draw->_cursorIndex == -1) && (handleMouse != 0) && (_lastCollKey == 0)) { _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); @@ -374,7 +377,6 @@ int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, if (handleMouse != 0) _vm->_draw->animateCursor(-1); - timeKey = _vm->_util->getTimeKey(); while (1) { if (_vm->_inter->_terminate) { if (handleMouse) @@ -395,7 +397,7 @@ int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, // Additionally, I added a 'deltaTime == -1' check there, since // when this function is called with deltaTime == -1 in inputArea, // and the return value is then discarded. - if (deltaTime < 0) { + if (deltaTime < 0 && !firstIteration) { uint32 curtime = _vm->_util->getTimeKey(); if ((deltaTime == -1) || ((curtime + deltaTime) > timeKey)) { if (pResId != 0) @@ -538,7 +540,10 @@ int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, if (handleMouse != 0) _vm->_draw->animateCursor(-1); - _vm->_util->delay(10); + if (deltaTime < -10) + _vm->_util->delay(10); + + firstIteration = false; } } @@ -617,7 +622,7 @@ void Game_v1::collisionsBlock(void) { int16 var_26; int16 collStackPos; Collision *collPtr; - int16 timeKey; + uint32 timeKey; byte *savedIP; if (_shouldPushColls) @@ -910,9 +915,9 @@ void Game_v1::collisionsBlock(void) { _shouldPushColls = 0; _vm->_global->_inter_execPtr = savedIP; + deltaTime = timeVal - - ((_vm->_util->getTimeKey() - timeKey) - - _vm->_video->_lastRetraceLength); + (_vm->_util->getTimeKey() - timeKey); if (deltaTime < 2) deltaTime = 2; diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 0dc15a8657..ffedd6d1f6 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -94,7 +94,6 @@ Video::Video(GobEngine *vm) : _vm(vm) { _splitHeight1 = 200; _splitHeight2 = 0; _splitStart = 0; - _lastRetraceLength = 0; _curSparse = 0; _lastSparse = 0xFFFFFFFF; @@ -162,8 +161,6 @@ SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height, } void Video::retrace(bool mouse) { - uint32 time = _vm->_util->getTimeKey(); - if (mouse) CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0); if (_vm->_global->_primarySurfDesc) { @@ -176,13 +173,12 @@ void Video::retrace(bool mouse) { _vm->_height - _splitHeight2, _vm->_width, _splitHeight2); g_system->updateScreen(); } - - _lastRetraceLength = _vm->_util->getTimeKey() - time; } void Video::waitRetrace(bool mouse) { + uint32 time = _vm->_util->getTimeKey(); retrace(mouse); - _vm->_util->delay(MAX(1, 10 - (int) _lastRetraceLength)); + _vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time))); } void Video::sparseRetrace(int max) { diff --git a/engines/gob/video.h b/engines/gob/video.h index dc23bda81e..51d02bd219 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -104,7 +104,6 @@ public: int16 _splitHeight1; int16 _splitHeight2; int16 _splitStart; - uint32 _lastRetraceLength; void freeDriver(); void initPrimary(int16 mode); |