Ticket #8168: cmi-smushtest3.diff

File cmi-smushtest3.diff, 3.1 KB (added by eriktorbjorn, 22 years ago)

Patch against a February 8 CVS snapshot

  • scummvm/scumm/smush/brenderer.h

    diff -ur ScummVM-cvs20030208/scummvm/scumm/smush/brenderer.h ScummVM-cvs20030208+hack/scummvm/scumm/smush/brenderer.h
    old new  
    3636private:
    3737        Palette _pal;           //!< The current palette
    3838        char * _data;           //!< The current frame buffer
    39         int32 _frame;                   //!< The current frame number
    40         int32 _nbframes;                //!< The number of frames in the animation
    41         int32 _width;                   //!< The current frame's width
     39        int32 _frame;           //!< The current frame number
     40        int32 _nbframes;        //!< The number of frames in the animation
     41        bool _frameSkip;        //!< The player is skipping frames to catch up
     42        int32 _width;           //!< The current frame's width
    4243        int32 _height;          //!< The current frame's height
    4344        const char * _fname;    //!< The filename of the animation being played
    4445protected:
     
    5455        void setFrame(int32 f) { _frame = f; }; //!< allows to change the frame number
    5556public:
    5657        int32 getFrame() const { return _frame; };      //!< accessor for current frame number
     58        bool frameSkip() { return _frameSkip; };
     59        void setFrameSkip(bool skip) { _frameSkip = skip; };
    5760        BaseRenderer();
    5861        virtual ~BaseRenderer();
    5962
     
    7679protected:
    7780        void save(int32 frame = -1) {};
    7881public:
    79         NullRenderer() {};
     82        NullRenderer() { setFrameSkip(false); };
    8083        virtual ~NullRenderer() {};
    8184        bool wait(int32 ms) { return true; };
    8285};
  • scummvm/scumm/smush/scumm_renderer.cpp

    diff -ur ScummVM-cvs20030208/scummvm/scumm/smush/scumm_renderer.cpp ScummVM-cvs20030208+hack/scummvm/scumm/smush/scumm_renderer.cpp
    old new  
    243243        // Because waitForTimer() also is the function that checks for user
    244244        // input we always want to call it at least once between frames, or
    245245        // the user may become unable to interrupt the movie.
    246         do {
     246
     247        if (_pending_updates > 0) {
     248                _scumm->waitForTimer(0);
     249                return true;
     250        }
     251
     252        while (_pending_updates <= 0) {
    247253                _scumm->waitForTimer(1);
    248         } while(_pending_updates <= 0);
     254        }
    249255        return true;
    250256}
    251257
     
    280286        int width = MIN(getWidth(), _scumm->_realWidth);
    281287        int height = MIN(getHeight(), _scumm->_realHeight);
    282288       
    283 
    284289        // In theory, this will always be true. In reality, there may be
    285290        // several pending updates because the computer wasn't fast enough to
    286291        // process them all. In that case, skip the frame to catch up.
    287         if (--_pending_updates <= 0) {
     292
     293        if (_pending_updates > 0)
     294                _pending_updates--;
     295
     296        if (!frameSkip() && _pending_updates >= 5) {
     297                setFrameSkip(true);
     298        } else if (frameSkip() && _pending_updates <= 2) {
     299                setFrameSkip(false);
     300        }
     301
     302        if (!frameSkip()) {
    288303                _scumm->_system->copy_rect((const byte *)data(), getWidth(), 0, 0, width, height);
    289304                _scumm->_system->update_screen();
    290305        } else {
     
    298313}
    299314
    300315bool ScummRenderer::update() {
     316        // FIXME: Don't increase _pending_updates if the game is paused.
    301317        _pending_updates++;
    302318        return true;
    303319}