From 265fbce3dd086cb643b46b5f66790738d9f61bc3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 20:46:51 +0100 Subject: MADS: Implement getTimeout() --- engines/mads/nebular/nebular_scenes2.cpp | 12 ++++++------ engines/mads/sequence.cpp | 13 +++++++++++++ engines/mads/sequence.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'engines/mads') diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index bec3fe4ed5..f9da681947 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -542,8 +542,8 @@ void Scene202::step() { _scene->_hotspots.activate(199, false); int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); - warning("TODO: TimerList_getTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]);"); - warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[26]);"); + _scene->_sequences.getTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]); + _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[26]); _game._player._stepEnabled = true; _game._player._visible = true; _globals._v4 = false; @@ -742,7 +742,7 @@ void Scene202::preActions() { _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); } else if (_game._abortTimers == 1) { - warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[23]);"); + _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[23]); warning("CHECKME: _scene->_dynamicHotspots.remove(_globals._frameTime);"); _scene->_dynamicHotspots.remove(_globals._frameTime); _game._player._visible = true; @@ -836,7 +836,7 @@ void Scene202::actions() { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); - warning("TODO: TimerList_getTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]);"); + _scene->_sequences.getTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]); _globals._v4 = -1; _game._player._stepEnabled = true; int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); @@ -854,7 +854,7 @@ void Scene202::actions() { _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); - warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[25]);"); + _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[25]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 1); } else if (_game._abortTimers == 1) { _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); @@ -877,7 +877,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 3); } else if (_game._abortTimers == 3) { - warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[25]);"); + _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[25]); _game._player._stepEnabled = true; _game._player._visible = true; } else { diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index a03d0f839c..453d90b468 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -473,4 +473,17 @@ int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTic numTicks, 0, 0, true, 100, depth - 1, 1, ANIMTYPE_REVERSIBLE, 0, 0); } +void SequenceList::getTimeout(int spriteIdx, int arg2) { + int timeout; + if (spriteIdx >= 0) + timeout = _vm->_game->_scene._sequences._entries[spriteIdx]._timeout; + else + timeout = _vm->_game->_player._priorTimer + _vm->_game->_player._ticksAmount; + + if (arg2 >= 0) + _vm->_game->_scene._sequences._entries[arg2]._timeout = timeout; + else + _vm->_game->_player._priorTimer = timeout - _vm->_game->_player._ticksAmount; + +} } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index f1b963a3dc..69059a9ad6 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -118,6 +118,7 @@ public: int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex); int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks); + void getTimeout(int spriteIdx, int arg2); }; } // End of namespace MADS -- cgit v1.2.3