[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.320.2.8,1.320.2.9 sound.h,1.62.2.1,1.62.2.2 string.cpp,1.193.2.7,1.193.2.8
Travis Howell
kirben at users.sourceforge.net
Thu Aug 12 19:44:00 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28669/scumm
Modified Files:
Tag: branch-0-6-0
sound.cpp sound.h string.cpp
Log Message:
Back port DOTT/Sam & Max sound fixes.
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.320.2.8
retrieving revision 1.320.2.9
diff -u -d -r1.320.2.8 -r1.320.2.9
--- sound.cpp 18 Jul 2004 13:49:32 -0000 1.320.2.8
+++ sound.cpp 13 Aug 2004 02:43:04 -0000 1.320.2.9
@@ -437,7 +437,7 @@
const int act = _vm->getTalkingActor();
if ((_sfxMode & 2) && act != 0) {
Actor *a;
- bool b, finished;
+ bool finished;
if (_vm->_imuseDigital) {
finished = !isSoundRunning(kTalkSoundID);
@@ -445,18 +445,20 @@
finished = !_talkChannelHandle.isActive();
}
- if ((uint) act < 0x80 && ((_vm->_version == 8) || (_vm->_version <= 7 && !_vm->_string[0].no_talk_anim)) && (finished || !_endOfMouthSync)) {
+ if ((uint) act < 0x80 && ((_vm->_version == 8) || (_vm->_version <= 7 && !_vm->_string[0].no_talk_anim))) {
a = _vm->derefActor(act, "processSfxQueues");
if (a->isInCurrentRoom()) {
- b = finished || isMouthSyncOff(_curSoundPos);
- if (_mouthSyncMode != b) {
- _mouthSyncMode = b;
- if (_talk_sound_frame != -1) {
- a->runActorTalkScript(_talk_sound_frame);
- _talk_sound_frame = -1;
- } else
- a->runActorTalkScript(b ? a->talkStopFrame : a->talkStartFrame);
+ if (isMouthSyncOff(_curSoundPos) && !_mouthSyncMode) {
+ if (!_endOfMouthSync)
+ a->runActorTalkScript(a->talkStopFrame);
+ _mouthSyncMode = 0;
+ } else if (isMouthSyncOff(_curSoundPos) == 0 && !_mouthSyncMode) {
+ a->runActorTalkScript(a->talkStartFrame);
+ _mouthSyncMode = 1;
}
+
+ if (_vm->_version <= 6 && finished)
+ a->runActorTalkScript(a->talkStopFrame);
}
}
@@ -552,15 +554,9 @@
// Some games frequently assume that starting one sound effect will
// automatically stop any other that may be playing at that time. So
// that is what we do here, but we make an exception for speech.
- //
- // Do any other games than these need this hack?
- //
- // HACK: Checking for script 99 in Sam & Max is to keep Conroy's song
- // from being interrupted.
- if (mode == 1 && (_vm->_gameId == GID_TENTACLE
- || (_vm->_gameId == GID_SAMNMAX && !_vm->isScriptRunning(99)))) {
- id = 777777;
+ if (mode == 1 && (_vm->_gameId == GID_TENTACLE || _vm->_gameId == GID_SAMNMAX)) {
+ id = 777777 + _talk_sound_channel;
_vm->_mixer->stopID(id);
}
@@ -795,16 +791,16 @@
}
}
-void Sound::talkSound(uint32 a, uint32 b, int mode, int frame) {
+void Sound::talkSound(uint32 a, uint32 b, int mode, int channel) {
if (mode == 1) {
_talk_sound_a1 = a;
_talk_sound_b1 = b;
+ _talk_sound_channel = channel;
} else {
_talk_sound_a2 = a;
_talk_sound_b2 = b;
}
- _talk_sound_frame = frame;
_talk_sound_mode |= mode;
}
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.62.2.1
retrieving revision 1.62.2.2
diff -u -d -r1.62.2.1 -r1.62.2.2
--- sound.h 15 Jul 2004 05:43:55 -0000 1.62.2.1
+++ sound.h 13 Aug 2004 02:43:05 -0000 1.62.2.2
@@ -43,7 +43,7 @@
File *_sfxFile;
uint32 _talk_sound_a1, _talk_sound_a2, _talk_sound_b1, _talk_sound_b2;
- byte _talk_sound_mode;
+ byte _talk_sound_mode, _talk_sound_channel;
int _talk_sound_frame;
bool _mouthSyncMode;
bool _endOfMouthSync;
@@ -81,7 +81,7 @@
void stopSound(int a);
void stopAllSounds();
void soundKludge(int *list, int num);
- void talkSound(uint32 a, uint32 b, int mode, int frame);
+ void talkSound(uint32 a, uint32 b, int mode, int channel = 0);
void setupSound();
void pauseSounds(bool pause);
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.193.2.7
retrieving revision 1.193.2.8
diff -u -d -r1.193.2.7 -r1.193.2.8
--- string.cpp 19 Jul 2004 10:01:36 -0000 1.193.2.7
+++ string.cpp 13 Aug 2004 02:43:05 -0000 1.193.2.8
@@ -58,16 +58,18 @@
if (buffer[0] == 0xFF && buffer[1] == 10) {
uint32 a, b;
+ int channel = 0;
a = buffer[2] | (buffer[3] << 8) | (buffer[6] << 16) | (buffer[7] << 24);
b = buffer[10] | (buffer[11] << 8) | (buffer[14] << 16) | (buffer[15] << 24);
// Sam and Max uses a caching system, printing empty messages
// and setting VAR_V6_SOUNDMODE beforehand. See patch 609791.
- // FIXME: There are other VAR_V6_SOUNDMODE states, as
- // mentioned in the patch. FIXME after iMUSE is done.
- if (_gameId != GID_SAMNMAX || (VAR(VAR_V6_SOUNDMODE) != 2))
- _sound->talkSound(a, b, 1, -1);
+ if (_gameId == GID_SAMNMAX)
+ channel = VAR(VAR_V6_SOUNDMODE);
+
+ if (channel != 2)
+ _sound->talkSound(a, b, 1, channel);
}
}
@@ -92,8 +94,6 @@
int frme = -1;
Actor *a;
byte *buffer;
- bool has_talk_sound = false;
- bool has_anim = false;
if (!_haveMsg)
return;
@@ -168,7 +168,7 @@
}
if (a && !_string[0].no_talk_anim) {
- has_anim = true;
+ a->runActorTalkScript(a->talkStartFrame);
_useTalkAnims = true;
}
@@ -247,14 +247,15 @@
case 9:
frme = *buffer++;
frme |= *buffer++ << 8;
- has_anim = true;
+ a->startAnimActor(frme);
break;
case 10:
talk_sound_a = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24);
talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24);
- has_talk_sound = true;
buffer += 14;
+ _sound->talkSound(talk_sound_a, talk_sound_b, 2);
+
// Set flag that speech variant exist of this msg.
// TODO: This does not work for the speech system in V7+ games
// since they encode the voice information differently, and it
@@ -320,16 +321,6 @@
}
} while (c != 2 && c != 3);
- // Even if talkSound() is called, we may still have to call
- // startAnimActor() since actorTalk() may already have caused the
- // wrong animation frame to be drawn, and the talkSound() won't be
- // processed until after the next screen update. Bleah.
-
- if (has_talk_sound)
- _sound->talkSound(talk_sound_a, talk_sound_b, 2, frme);
- if (a && has_anim)
- a->runActorTalkScript(frme != -1 ? frme : a->talkStartFrame);
-
_charsetBufPos = buffer - _charsetBuffer;
// TODO Verify this is correct spot
More information about the Scummvm-git-logs
mailing list