aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2002-10-18 11:45:57 +0000
committerJames Brown2002-10-18 11:45:57 +0000
commit80ce915f3da1173eb86af153d79a12aac556f564 (patch)
tree4b23ee8da447cd1e5ff6a4cc3e82ddc2d0924897
parentd0565061a08d93b5fe545740bb37dbc83c12ddfe (diff)
downloadscummvm-rg350-80ce915f3da1173eb86af153d79a12aac556f564.tar.gz
scummvm-rg350-80ce915f3da1173eb86af153d79a12aac556f564.tar.bz2
scummvm-rg350-80ce915f3da1173eb86af153d79a12aac556f564.zip
Fix Wait:forActorDraw and the 'infinite mouth movement' problem in The Dig.
Code assumed that the actor always starts talking in the same room it finishes talking in - this doesn't apply for several cutscene sequences in The Dig. Also added the usual talkChannel fallback code in for The Dig. svn-id: r5186
-rw-r--r--scumm/actor.cpp2
-rw-r--r--scumm/script_v2.cpp16
-rw-r--r--scumm/sound.cpp16
-rw-r--r--scumm/sound.h4
4 files changed, 15 insertions, 23 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index 14c1ce7a8d..b36538d469 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -782,7 +782,7 @@ void Scumm::stopTalk()
act = _vars[VAR_TALK_ACTOR];
if (act && act < 0x80) {
Actor *a = derefActorSafe(act, "stopTalk");
- if (a->isInCurrentRoom() && _useTalkAnims) {
+ if ((a->isInCurrentRoom() || (_features & GF_AFTER_V7)) && _useTalkAnims) {
a->startAnimActor(a->talkFrame2);
_useTalkAnims = false;
}
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index a48fb529f8..b202f1527b 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -2382,16 +2382,6 @@ void Scumm::o6_wait()
Actor *a = derefActorSafe(actnum, "o6_wait:226");
int offs = (int16)fetchScriptWord();
- // FIXME: This wait command doesn't return at the
- // correct times, which causes several script freezes
- // in The Dig. Eg, planetarium lightbridge,
- // and taking the rod in the museum AFTER looking at
- // all the displays. This is testing actor 3 (Ego),
- // so I'm guessing it's something to do with the way
- // ego doesn't always stop his mouth moving.
- if (actnum == 3)
- return;
-
if (a && a->isInCurrentRoom() && a->needRedraw) {
_scriptPointer += offs;
o6_breakHere();
@@ -2558,8 +2548,9 @@ void Scumm::o6_talkActor()
pointer[j++] = _messagePtr[i];
}
pointer[j] = 0;
- _sound->playBundleSound(pointer);
+ _sound->_talkChannel = _sound->playBundleSound(pointer);
_messagePtr = (byte*)&transText;
+ printf("Said %s, talkchannel is %d\n", transText, _sound->_talkChannel);
setStringVars(0);
actorTalk();
} else {
@@ -2585,7 +2576,8 @@ void Scumm::o6_talkEgo()
pointer[j++] = _messagePtr[i];
}
pointer[j] = 0;
- _sound->playBundleSound(pointer);
+ _sound->_talkChannel = _sound->playBundleSound(pointer);
+ printf("Said %s, talkchannel is %d\n", transText, _sound->_talkChannel);
_messagePtr = (byte*)&transText;
setStringVars(0);
actorTalk();
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 7f4b303833..d5fd792e98 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -416,9 +416,9 @@ void Sound::processSfxQueues() {
act = _scumm->_vars[_scumm->VAR_TALK_ACTOR];
if (_talkChannel < 0)
finished = false;
- else if (_scumm->_mixer->_channels[_talkChannel] == NULL)
+ else if (_scumm->_mixer->_channels[_talkChannel] == NULL) {
finished = true;
- else
+ } else
finished = false;
@@ -1044,17 +1044,17 @@ void Sound::bundleMusicHandler(Scumm * scumm) {
}
}
-void Sound::playBundleSound(char *sound) {
+int Sound::playBundleSound(char *sound) {
byte * ptr;
if (_scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath()) == false) {
- return;
+ return -1;
}
ptr = (byte *)malloc(1000000);
if (_scumm->_bundle->decompressVoiceSampleByName(sound, ptr) == 0) {
delete ptr;
- return;
+ return -1;
}
int rate = 22050;
@@ -1064,7 +1064,7 @@ void Sound::playBundleSound(char *sound) {
if (tag != MKID_BE('iMUS')) {
warning("Decompression of bundle sound failed");
free(ptr);
- return;
+ return -1;
}
ptr += 12;
@@ -1094,12 +1094,12 @@ void Sound::playBundleSound(char *sound) {
if (size < 0) {
warning("Decompression sound failed (no size field)");
free(ptr);
- return;
+ return -1;
}
byte * final = (byte *)malloc(size);
memcpy(final, ptr, size);
- _scumm->_mixer->playRaw(NULL, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+ return _scumm->_mixer->playRaw(NULL, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
}
int Sound::playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned) {
diff --git a/scumm/sound.h b/scumm/sound.h
index 409e1b7c58..faa7c5e947 100644
--- a/scumm/sound.h
+++ b/scumm/sound.h
@@ -56,7 +56,6 @@ enum {
bool _musicBundleToBeChanged;
bool _musicBundleToBeRemoved;
- int _talkChannel; /* Mixer channel actor is talking on */
File *_sfxFile;
uint32 _talk_sound_a1, _talk_sound_a2, _talk_sound_b1, _talk_sound_b2;
byte _talk_sound_mode;
@@ -92,6 +91,7 @@ public:
#endif
+ int _talkChannel; /* Mixer channel actor is talking on */
int _cd_timer_value;
bool _soundsPaused;
int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx;
@@ -125,7 +125,7 @@ public:
void pauseBundleMusic(bool state);
void bundleMusicHandler(Scumm * scumm);
void stopBundleMusic();
- void playBundleSound(char *sound);
+ int playBundleSound(char *sound);
byte * readCreativeVocFile(byte * ptr, uint32 & size, uint32 & rate, uint32 & loops);
int playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned);
int playSfxSound_MP3(void *sound, uint32 size);