diff -ur ScummVM-cvs20030124/scummvm/scumm/smush/scumm_renderer.cpp ScummVM-cvs20030124+hack/scummvm/scumm/smush/scumm_renderer.cpp
|
old
|
new
|
|
| 199 | 199 | ScummRenderer::ScummRenderer(Scumm * scumm, uint32 speed) : |
| 200 | 200 | _scumm(scumm), |
| 201 | 201 | _smixer(0), |
| 202 | | _insaneSpeed(speed) { |
| | 202 | _insaneSpeed(speed), |
| | 203 | _pending_updates(0) { |
| 203 | 204 | } |
| 204 | 205 | |
| 205 | 206 | static ScummRenderer * s_renderer; |
| … |
… |
|
| 239 | 240 | } |
| 240 | 241 | |
| 241 | 242 | bool ScummRenderer::wait(int32 ms) { |
| 242 | | while(_wait) { |
| | 243 | // Because waitForTimer() also is the function that checks for user |
| | 244 | // input we always want to call it at least once between frames, or |
| | 245 | // the user may become unable to interrupt the movie. |
| | 246 | do { |
| 243 | 247 | _scumm->waitForTimer(1); |
| 244 | | } |
| | 248 | } while(_pending_updates <= 0); |
| 245 | 249 | return true; |
| 246 | 250 | } |
| 247 | 251 | |
| … |
… |
|
| 275 | 279 | void ScummRenderer::save(int32 frame) { |
| 276 | 280 | int width = MIN(getWidth(), _scumm->_realWidth); |
| 277 | 281 | int height = MIN(getHeight(), _scumm->_realHeight); |
| 278 | | |
| 279 | | _scumm->_system->copy_rect((const byte *)data(), getWidth(), 0, 0, width, height); |
| 280 | | _scumm->_system->update_screen(); |
| | 282 | |
| | 283 | // In theory, this will always be true. In reality, there may be |
| | 284 | // several pending updates because the computer wasn't fast enough to |
| | 285 | // process them all. In that case, skip the frame to catch up. |
| | 286 | if (--_pending_updates <= 0) { |
| | 287 | _scumm->_system->copy_rect((const byte *)data(), getWidth(), 0, 0, width, height); |
| | 288 | _scumm->_system->update_screen(); |
| | 289 | } else |
| | 290 | warning("ScummRenderer: Skipping frame %d to catch up", getFrame()); |
| 281 | 291 | _scumm->processKbd(); |
| 282 | | _wait = true; |
| 283 | 292 | } |
| 284 | 293 | |
| 285 | 294 | bool ScummRenderer::prematureClose() { |
| … |
… |
|
| 289 | 298 | } |
| 290 | 299 | |
| 291 | 300 | bool ScummRenderer::update() { |
| 292 | | _wait = false; |
| | 301 | _pending_updates++; |
| 293 | 302 | return true; |
| 294 | 303 | } |
| 295 | 304 | |
diff -ur ScummVM-cvs20030124/scummvm/scumm/smush/scumm_renderer.h ScummVM-cvs20030124+hack/scummvm/scumm/smush/scumm_renderer.h
|
old
|
new
|
|
| 45 | 45 | Scumm * _scumm; |
| 46 | 46 | ScummMixer * _smixer; |
| 47 | 47 | uint32 _insaneSpeed; |
| 48 | | volatile bool _wait; |
| | 48 | volatile int _pending_updates; |
| 49 | 49 | public: |
| 50 | 50 | ScummRenderer(Scumm * scumm, uint32 speed); |
| 51 | 51 | virtual ~ScummRenderer(); |