diff -ur ScummVM-cvs20030208/scummvm/scumm/smush/brenderer.h ScummVM-cvs20030208+hack/scummvm/scumm/smush/brenderer.h
old
|
new
|
|
36 | 36 | private: |
37 | 37 | Palette _pal; //!< The current palette |
38 | 38 | 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 |
42 | 43 | int32 _height; //!< The current frame's height |
43 | 44 | const char * _fname; //!< The filename of the animation being played |
44 | 45 | protected: |
… |
… |
|
54 | 55 | void setFrame(int32 f) { _frame = f; }; //!< allows to change the frame number |
55 | 56 | public: |
56 | 57 | int32 getFrame() const { return _frame; }; //!< accessor for current frame number |
| 58 | bool frameSkip() { return _frameSkip; }; |
| 59 | void setFrameSkip(bool skip) { _frameSkip = skip; }; |
57 | 60 | BaseRenderer(); |
58 | 61 | virtual ~BaseRenderer(); |
59 | 62 | |
… |
… |
|
76 | 79 | protected: |
77 | 80 | void save(int32 frame = -1) {}; |
78 | 81 | public: |
79 | | NullRenderer() {}; |
| 82 | NullRenderer() { setFrameSkip(false); }; |
80 | 83 | virtual ~NullRenderer() {}; |
81 | 84 | bool wait(int32 ms) { return true; }; |
82 | 85 | }; |
diff -ur ScummVM-cvs20030208/scummvm/scumm/smush/scumm_renderer.cpp ScummVM-cvs20030208+hack/scummvm/scumm/smush/scumm_renderer.cpp
old
|
new
|
|
243 | 243 | // Because waitForTimer() also is the function that checks for user |
244 | 244 | // input we always want to call it at least once between frames, or |
245 | 245 | // 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) { |
247 | 253 | _scumm->waitForTimer(1); |
248 | | } while(_pending_updates <= 0); |
| 254 | } |
249 | 255 | return true; |
250 | 256 | } |
251 | 257 | |
… |
… |
|
280 | 286 | int width = MIN(getWidth(), _scumm->_realWidth); |
281 | 287 | int height = MIN(getHeight(), _scumm->_realHeight); |
282 | 288 | |
283 | | |
284 | 289 | // In theory, this will always be true. In reality, there may be |
285 | 290 | // several pending updates because the computer wasn't fast enough to |
286 | 291 | // 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()) { |
288 | 303 | _scumm->_system->copy_rect((const byte *)data(), getWidth(), 0, 0, width, height); |
289 | 304 | _scumm->_system->update_screen(); |
290 | 305 | } else { |
… |
… |
|
298 | 313 | } |
299 | 314 | |
300 | 315 | bool ScummRenderer::update() { |
| 316 | // FIXME: Don't increase _pending_updates if the game is paused. |
301 | 317 | _pending_updates++; |
302 | 318 | return true; |
303 | 319 | } |