diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp index 6ea8674e8ed..5b9b05f9083 100644 --- a/engines/saga/actor.cpp +++ b/engines/saga/actor.cpp @@ -1811,6 +1811,10 @@ void Actor::drawActors() { createDrawOrderList(); + // Update frameCount for sfWaitFrames in IHNM + // TODO: is this the correct place to do this? + _vm->_frameCount++; + for (drawOrderIterator = _drawOrderList.begin(); drawOrderIterator != _drawOrderList.end(); ++drawOrderIterator) { drawObject = drawOrderIterator.operator*(); diff --git a/engines/saga/script.h b/engines/saga/script.h index a8a0cd762be..b358a00966a 100644 --- a/engines/saga/script.h +++ b/engines/saga/script.h @@ -326,6 +326,11 @@ public: _sleepTime = sleepTime; } + void waitFrames(int frames) { + wait(kWaitTypeWaitFrames); + _frameWait = frames; + } + ScriptThread() { memset(this, 0xFE, sizeof(*this)); _stackBuf = NULL; diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index d759c9c2e7a..06ea9da77bb 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -1887,8 +1887,13 @@ void Script::sfResetMouseClicks(SCRIPTFUNC_PARAMS) { SF_stub("sfResetMouseClicks", thread, nArgs); } +// Param1: frames void Script::sfWaitFrames(SCRIPTFUNC_PARAMS) { - SF_stub("sfWaitFrames", thread, nArgs); + int16 frames; + frames = thread->pop(); + + if (!_skipSpeeches) + thread->waitFrames(_vm->_frameCount + frames); } void Script::sfScriptFade(SCRIPTFUNC_PARAMS) {