int KyraEngine_v2::o2_update(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_update(%p) (%d)", (const void *)script, stackPos(0)); for (int times = stackPos(0); times != 0; --times) { if (_chatText) updateWithText(); else update(); } return 0; }
void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) { uint32 start = _system->getMillis(); do { if (updateGame) { if (_chatText) updateWithText(); else update(); } else { updateInput(); } if (amount > 0) _system->delayMillis(amount > 10 ? 10 : amount); } while (!skipFlag() && _system->getMillis() < start + amount && !shouldQuit()); }
int KyraEngine_v2::o2_delay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); if (stackPos(1)) { uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength; while (_system->getMillis() < maxWaitTime) { int inputFlag = checkInput(0); removeInputTop(); if (inputFlag == 198 || inputFlag == 199) return 1; if (_chatText) updateWithText(); else update(); _system->delayMillis(10); } } else { delay(stackPos(0) * _tickLength, true); } return 0; }