From 2d2bda501e549169f4b6726e60d21b10dcfdf982 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sun, 10 Jun 2007 04:14:53 +0000 Subject: Fix timer code in Puzzle Pack, to match original speed. svn-id: r27275 --- engines/agos/agos.cpp | 10 ++++++++-- engines/agos/agos.h | 3 ++- engines/agos/event.cpp | 45 ++++++++++----------------------------------- engines/agos/gfx.cpp | 3 --- engines/agos/input.cpp | 8 ++++++++ engines/agos/script.cpp | 9 ++++++++- 6 files changed, 36 insertions(+), 42 deletions(-) (limited to 'engines/agos') diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 30df5af26e..b3a2c35fd5 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -136,6 +136,7 @@ AGOSEngine::AGOSEngine(OSystem *syst) _numVars = 0; _numVideoOpcodes = 0; _vgaBaseDelay = 0; + _vgaPeriod = 0; _strippedTxtMem = 0; _textMem = 0; @@ -354,8 +355,6 @@ AGOSEngine::AGOSEngine(OSystem *syst) _curSfxFile = 0; _syncCount = 0; - _timer5 = 0; - _timer4 = 0; _iconToggleCount = 0; _voiceCount = 0; @@ -709,6 +708,7 @@ void AGOSEngine_PuzzlePack::setupGame() { _tableMemSize = 200000; _frameCount = 1; _vgaBaseDelay = 5; + _vgaPeriod = (getGameId() == GID_DIMP) ? 35 : 30; _numBitArray1 = 128; _numItemStore = 10; _numTextBoxes = 40; @@ -729,6 +729,7 @@ void AGOSEngine_Feeble::setupGame() { _tableMemSize = 200000; _frameCount = 1; _vgaBaseDelay = 5; + _vgaPeriod = 50; _numBitArray1 = 16; _numBitArray2 = 16; _numBitArray3 = 16; @@ -759,6 +760,7 @@ void AGOSEngine_Simon2::setupGame() { _soundIndexBase = 1660 / 4; _frameCount = 1; _vgaBaseDelay = 1; + _vgaPeriod = 45; _numBitArray1 = 16; _numBitArray2 = 16; _numItemStore = 10; @@ -788,6 +790,7 @@ void AGOSEngine_Simon1::setupGame() { _soundIndexBase = 0; _frameCount = 1; _vgaBaseDelay = 1; + _vgaPeriod = 50; _numBitArray1 = 16; _numBitArray2 = 16; _numItemStore = 10; @@ -813,6 +816,7 @@ void AGOSEngine_Waxworks::setupGame() { _tableMemSize = 50000; _frameCount = 4; _vgaBaseDelay = 1; + _vgaPeriod = 50; _numBitArray1 = 16; _numBitArray2 = 15; _numItemStore = 50; @@ -836,6 +840,7 @@ void AGOSEngine_Elvira2::setupGame() { _tableMemSize = 100000; _frameCount = 4; _vgaBaseDelay = 1; + _vgaPeriod = 50; _numBitArray1 = 16; _numBitArray2 = 15; _numItemStore = 50; @@ -858,6 +863,7 @@ void AGOSEngine_Elvira1::setupGame() { _tableMemSize = 256000; _frameCount = 4; _vgaBaseDelay = 1; + _vgaPeriod = 50; _numVars = 512; _numMusic = 14; diff --git a/engines/agos/agos.h b/engines/agos/agos.h index f73161e437..1d1c0eb890 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -201,6 +201,7 @@ protected: uint _numBitArray1, _numBitArray2, _numBitArray3; uint _numItemStore, _numVars; uint _vgaBaseDelay; + uint _vgaPeriod; uint _musicIndexBase; uint _soundIndexBase; @@ -428,7 +429,7 @@ protected: byte *_curVgaFile2; byte *_curSfxFile; - uint16 _syncCount, _timer5, _timer4; + uint16 _syncCount; int16 _iconToggleCount, _voiceCount; uint32 _lastTickCount, _thisTickCount; diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index 697e90f7aa..c3831ec1db 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -424,28 +424,27 @@ void AGOSEngine::delay(uint amount) { uint32 start = _system->getMillis(); uint32 cur = start; - uint this_delay, vga_period; + uint this_delay, vgaPeriod; AudioCD.updateCD(); if (_debugger->isAttached()) _debugger->onFrame(); - if (_fastMode) - vga_period = 10; - else if (getGameType() == GType_SIMON2) - vga_period = 45; - else - vga_period = 50; + vgaPeriod = (_fastMode) ? 10 : _vgaPeriod; + if (getGameType() == GType_PP && getGameId() != GID_DIMP) { + if (vgaPeriod == 15 && _variableArray[999] == 0) + vgaPeriod = 30; + } _rnd.getRandomNumber(2); do { - while (!_inCallBack && cur >= _lastVgaTick + vga_period && !_pause) { - _lastVgaTick += vga_period; + while (!_inCallBack && cur >= _lastVgaTick + vgaPeriod && !_pause) { + _lastVgaTick += vgaPeriod; // don't get too many frames behind - if (cur >= _lastVgaTick + vga_period * 2) + if (cur >= _lastVgaTick + vgaPeriod * 2) _lastVgaTick = cur; _inCallBack = true; @@ -549,32 +548,10 @@ void AGOSEngine::delay(uint amount) { } void AGOSEngine::timer_callback() { - // FIXME: _timer5 is never set - if (_timer5) { - _syncFlag2 = true; - _timer5--; - } else { - if (getGameId() == GID_DIMP) { - _thisTickCount = _system->getMillis(); - if (_thisTickCount < _lastTickCount) - _lastTickCount = 0; - - if ((_thisTickCount - _lastTickCount) <= 35) - return; - - _lastTickCount = _thisTickCount; - - timer_proc1(); - dimp_idle(); - } else { - timer_proc1(); - } - } + timer_proc1(); } void AGOSEngine_Feeble::timer_proc1() { - _timer4++; - if (_lockWord & 0x80E9 || _lockWord & 2) return; @@ -626,8 +603,6 @@ void AGOSEngine_Feeble::timer_proc1() { } void AGOSEngine::timer_proc1() { - _timer4++; - if (_lockWord & 0x80E9 || _lockWord & 2) return; diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp index 241c1928ff..cbdff30818 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.cpp @@ -1388,9 +1388,6 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vga_res_id) { dst++; } } - - _syncFlag2 = 1; - _timer5 = 0; } _lockWord &= ~0x20; diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp index 274914b407..b4f8232057 100644 --- a/engines/agos/input.cpp +++ b/engines/agos/input.cpp @@ -542,6 +542,14 @@ bool AGOSEngine::processSpecialKeys() { if (getGameType() == GType_FF) setBitFlag(73, !getBitFlag(73)); break; + case 37: // F12 + if (getGameType() == GType_PP && getGameId() != GID_DIMP) { + if (!getBitFlag(110)) { + setBitFlag(107, !getBitFlag(107)); + _vgaPeriod = (getBitFlag(107) != 0) ? 15 : 30; + } + } + break; case 'p': pause(); break; diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp index ed82fd5316..4541f3d002 100644 --- a/engines/agos/script.cpp +++ b/engines/agos/script.cpp @@ -508,7 +508,14 @@ void AGOSEngine::o_picture() { return; } - _picture8600 = (vga_res == 8600); + if (getGameType() == GType_PP && getGameId() != GID_DIMP) { + if (vga_res == 8700 && getBitFlag(107)) { + _vgaPeriod = 30; + } + + _picture8600 = (vga_res == 8600); + } + setWindowImageEx(mode, vga_res); } -- cgit v1.2.3