Possible fix for bug #1767748 (Gobliiins is not fast as it can be on slow computers)

svn-id: r28456
This commit is contained in:
Sven Hesse 2007-08-05 01:42:38 +00:00
parent ca01e07a3c
commit d31d50ac3d
3 changed files with 9 additions and 5 deletions

View File

@ -911,7 +911,8 @@ void Game_v1::collisionsBlock(void) {
_shouldPushColls = 0;
_vm->_global->_inter_execPtr = savedIP;
deltaTime = timeVal -
(_vm->_util->getTimeKey() - timeKey);
((_vm->_util->getTimeKey() - timeKey)
- _vm->_video->_lastRetraceLength);
if (deltaTime < 2)
deltaTime = 2;

View File

@ -94,6 +94,7 @@ Video::Video(GobEngine *vm) : _vm(vm) {
_splitHeight1 = 200;
_splitHeight2 = 0;
_splitStart = 0;
_lastRetraceLength = 0;
_curSparse = 0;
_lastSparse = 0xFFFFFFFF;
@ -161,6 +162,8 @@ 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) {
@ -173,14 +176,13 @@ 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;
time = _vm->_util->getTimeKey();
retrace(mouse);
_vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time)));
_vm->_util->delay(MAX(1, 10 - (int) _lastRetraceLength));
}
void Video::sparseRetrace(int max) {

View File

@ -104,6 +104,7 @@ public:
int16 _splitHeight1;
int16 _splitHeight2;
int16 _splitStart;
uint32 _lastRetraceLength;
void freeDriver();
void initPrimary(int16 mode);