aboutsummaryrefslogtreecommitdiff
path: root/scumm/smush
diff options
context:
space:
mode:
authorMax Horn2003-12-21 18:36:20 +0000
committerMax Horn2003-12-21 18:36:20 +0000
commit2be2cb6d3e843111a4c862e084510b5a811d699b (patch)
tree7d2e0ff9be24809ed353ae94af8a384cfd23998b /scumm/smush
parent5b1783d15475d70c30dda81f517dc9762b0c0a33 (diff)
downloadscummvm-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
Diffstat (limited to 'scumm/smush')
-rw-r--r--scumm/smush/smush_player.cpp20
-rw-r--r--scumm/smush/smush_player.h2
2 files changed, 2 insertions, 20 deletions
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();