NScumm.Sky.Intro.EscDelay C# (CSharp) Method

EscDelay() private method

private EscDelay ( int msecs ) : bool
msecs int
return bool
        private bool EscDelay(int msecs)
        {
            var im = _system.InputManager;

            if (_relDelay == 0) // first call, init with system time
                _relDelay = Environment.TickCount;

            _relDelay += msecs; // now wait until Environment.TickCount >= _relDelay

            int nDelay;
            do
            {
                if (im.GetState().IsKeyDown(KeyCode.Escape))
                    return false;

                nDelay = _relDelay - Environment.TickCount;
                if (nDelay < 0)
                    nDelay = 0;
                else if (nDelay > 20)
                    nDelay = 20;

                ServiceLocator.Platform.Sleep(nDelay);

                _skyScreen.ProcessSequence();
                _system.GraphicsManager.UpdateScreen();
            } while (nDelay == 20);

            return true;
        }