diff options
author | Strangerke | 2016-05-20 07:47:16 +0200 |
---|---|---|
committer | Strangerke | 2016-05-20 07:47:16 +0200 |
commit | f734291abb883278c51e35122e4342d6bef8abfd (patch) | |
tree | 115053f1f59edfc92c68db2a791a77cfc926300e /engines | |
parent | 20b3d1814a54c5f82e29e141ebf61f572767840c (diff) | |
download | scummvm-rg350-f734291abb883278c51e35122e4342d6bef8abfd.tar.gz scummvm-rg350-f734291abb883278c51e35122e4342d6bef8abfd.tar.bz2 scummvm-rg350-f734291abb883278c51e35122e4342d6bef8abfd.zip |
GNAP: Implement delayTicks functions, refactor them to share code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gnap/gnap.cpp | 29 | ||||
-rw-r--r-- | engines/gnap/gnap.h | 5 | ||||
-rw-r--r-- | engines/gnap/scenes/arcade.cpp | 8 | ||||
-rw-r--r-- | engines/gnap/scenes/group1.cpp | 2 |
4 files changed, 31 insertions, 13 deletions
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index d6ec44cfc5..5175d0702b 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -327,14 +327,31 @@ int GnapEngine::loadSavegame(int savegameNum) { return 1; } -void GnapEngine::delayTicks(int a1) { - // TODO - gameUpdateTick(); +void GnapEngine::delayTicks(int val, int idx = 0, bool updateCursor = false) { + int startTick = _timers[idx]; + + _timers[idx] = val; + + while (_timers[idx] && !_gameDone) { + gameUpdateTick(); + + if (updateCursor) + updateGrabCursorSprite(0, 0); + } + + startTick -= _timers[idx]; + if (startTick < 0) + startTick = 0; + + _timers[idx] = startTick; +} + +void GnapEngine::delayTicksA(int val, int idx) { + delayTicks(val, idx); } -void GnapEngine::delayTicksCursor(int a1) { - // TODO - gameUpdateTick(); +void GnapEngine::delayTicksCursor(int val) { + delayTicks(val, 0, true); } void GnapEngine::setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags, diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index e6507ccb31..0f45dc2e7f 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -325,8 +325,9 @@ public: void writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeader &header); static bool readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader &header); - void delayTicks(int a1); - void delayTicksCursor(int a1); + void delayTicks(int val, int idx, bool updateCursor); + void delayTicksA(int val, int idx); + void delayTicksCursor(int val); void setHotspot(int index, int16 x1, int16 y1, int16 x2, int16 y2, uint16 flags = 0, int16 walkX = -1, int16 walkY = -1); diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 84662507f3..eddb29d2ca 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -616,11 +616,11 @@ void Scene50::playWinAnim(int tongueNum, bool fightOver) { waitForAnim(6); waitForAnim(5); } - // TODO delayTicksA(1, 7); + _vm->delayTicksA(1, 7); } void Scene50::delayTicks() { - // TODO delayTicksA(3, 7); + _vm->delayTicksA(3, 7); } void Scene50::initRound() { @@ -941,7 +941,7 @@ void Scene50::run() { _vm->setGrabCursorSprite(-1); _vm->hideCursor(); - // TODO delayTicksA(1, 7); + _vm->delayTicksA(1, 7); playRoundAnim(_roundNum); @@ -1598,7 +1598,7 @@ int Scene51::incCashAmount(int sequenceId) { void Scene51::winMinigame() { updateCash(1995); _vm->playSound(0xDA, false); - // TODO delayTicksA(1, 5); + _vm->delayTicksA(1, 5); _vm->_newSceneNum = 48; _vm->invRemove(kItemBanana); } diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp index 7b1e1e3625..52767e1a23 100644 --- a/engines/gnap/scenes/group1.cpp +++ b/engines/gnap/scenes/group1.cpp @@ -2530,7 +2530,7 @@ void Scene17::run() { gameSys.insertSequence(0x107C1, plat._id, 0x241, plat._id, kSeqScale | kSeqSyncWait, 0, 75 * plat._pos.x - plat._gridX, 48 * plat._pos.y - plat._gridY); gameSys.insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); - // TODO delayTicksA(2, 9); + _vm->delayTicksA(2, 9); _vm->endSceneInit(); plat._sequenceId = 0x7C1; plat._sequenceDatNum = 1; |