diff options
author | Max Horn | 2003-12-21 18:36:20 +0000 |
---|---|---|
committer | Max Horn | 2003-12-21 18:36:20 +0000 |
commit | 2be2cb6d3e843111a4c862e084510b5a811d699b (patch) | |
tree | 7d2e0ff9be24809ed353ae94af8a384cfd23998b | |
parent | 5b1783d15475d70c30dda81f517dc9762b0c0a33 (diff) | |
download | scummvm-rg350-2be2cb6d3e843111a4c862e084510b5a811d699b.tar.gz scummvm-rg350-2be2cb6d3e843111a4c862e084510b5a811d699b.tar.bz2 scummvm-rg350-2be2cb6d3e843111a4c862e084510b5a811d699b.zip |
The rewritten Timer class actually allows us to get rid of several evil hacks in the SMUSH code (which were previously needed to avoid various race conditions/crashes/hangups)
svn-id: r11833
-rw-r--r-- | scumm/scumm.h | 1 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 8 | ||||
-rw-r--r-- | scumm/smush/smush_player.cpp | 20 | ||||
-rw-r--r-- | scumm/smush/smush_player.h | 2 |
4 files changed, 2 insertions, 29 deletions
diff --git a/scumm/scumm.h b/scumm/scumm.h index ca6f3f8ae8..854de56181 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -338,7 +338,6 @@ public: int _smushFrameRate; bool _insaneState; bool _videoFinished; - bool _smushPlay; void pauseGame(); void restart(); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 46db749c42..2efb368831 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -315,7 +315,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _smushFrameRate = 0; _insaneState = false; _videoFinished = false; - _smushPlay = false; _quit = false; _pauseDialog = NULL; _optionsDialog = NULL; @@ -2543,19 +2542,12 @@ int ScummEngine::runDialog(Dialog &dialog) { bool old_soundsPaused = _sound->_soundsPaused; _sound->pauseSounds(true); - // Pause playing smush movie - bool oldSmushPlay = _smushPlay; - _smushPlay = false; - // Open & run the dialog int result = dialog.runModal(); // Restore old cursor updateCursor(); - // Resume playing smush movie, if any - _smushPlay = oldSmushPlay; - // Resume sound output _sound->pauseSounds(old_soundsPaused); diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 6db4b3457b..2dcaa75334 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -205,21 +205,11 @@ static StringResource *getStrings(const char *file, const char *directory, bool return sr; } -SmushPlayer *player; - void SmushPlayer::timerCallback(void *refCon) { - ScummEngine *scumm = (ScummEngine *)refCon; - if (!scumm->_smushPlay) - return; - - player->_smushProcessFrame = true; - player->parseNextFrame(); - player->_smushProcessFrame = false; + ((SmushPlayer *)refCon)->parseNextFrame(); } SmushPlayer::SmushPlayer(ScummEngine *scumm, int speed, bool subtitles) { - player = this; - _scumm = scumm; _version = -1; _nbframes = 0; @@ -243,7 +233,6 @@ SmushPlayer::SmushPlayer(ScummEngine *scumm, int speed, bool subtitles) { _IACTpos = 0; _soundFrequency = 22050; _speed = speed; - _smushProcessFrame = false; _insanity = false; } @@ -266,19 +255,14 @@ void SmushPlayer::init() { _scumm->setDirtyColors(0, 255); _smixer->_silentMixer = _scumm->_silentDigitalImuse; - _scumm->_smushPlay = true; _dst = _scumm->virtscr[0].screenPtr + _scumm->virtscr[0].xstart; - _scumm->_timer->installTimerProc(&timerCallback, _speed, _scumm); + g_timer->installTimerProc(&timerCallback, _speed, this); _alreadyInit = false; } void SmushPlayer::deinit() { _scumm->_timer->removeTimerProc(&timerCallback); - _scumm->_smushPlay = false; - // In case the timerCallback is active right now, we loop till it finishes. - // Note: even this still leaves a window for race conditions to occur. - while (_smushProcessFrame) {} for (int i = 0; i < 5; i++) { if (_sf[i]) { diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index 429affa4e0..7d1c5dbcac 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -69,8 +69,6 @@ private: bool _updateNeeded; bool _insanity; - volatile bool _smushProcessFrame; - public: SmushPlayer(ScummEngine *, int, bool); ~SmushPlayer(); |