From 99307976d5afc6896fe00f9906a3355fd543a839 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 26 Apr 2008 22:30:55 +0000 Subject: Finished o3_delay implementation. svn-id: r31740 --- engines/kyra/script_v3.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/script_v3.cpp b/engines/kyra/script_v3.cpp index 288b6720f9..3db0d4c23c 100644 --- a/engines/kyra/script_v3.cpp +++ b/engines/kyra/script_v3.cpp @@ -384,13 +384,24 @@ int KyraEngine_v3::o3_setMalcolmsMood(ScriptState *script) { int KyraEngine_v3::o3_delay(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); - const uint32 delayTime = stackPos(0) * _tickLength; - const int delayFunc = stackPos(1); + if (stackPos(1)) { + uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength; + while (_system->getMillis() < maxWaitTime) { + int inputFlag = checkInput(0); + removeInputTop(); - if (delayFunc) - warning("STUB o3_delay func 1"); + if (inputFlag == 198 || inputFlag == 199) + return 1; - delay(delayTime, true); + if (_chatText) + updateWithText(); + else + update(); + _system->delayMillis(10); + } + } else { + delay(stackPos(0) * _tickLength, true); + } return 0; } -- cgit v1.2.3