Add FBEAR: Partial fix for the piano, patch #977249

svn-id: r13999
This commit is contained in:
Travis Howell 2004-06-22 10:39:46 +00:00
parent 5ce27765af
commit 7989a98952
5 changed files with 25 additions and 8 deletions

View File

@ -596,7 +596,7 @@ protected:
void o6_readFile();
void o6_rename();
void o6_writeFile();
void o6_setVolume();
void o6_soundOps();
void o6_seekFilePos();
void o6_localizeArray();
void o6_redimArray();

View File

@ -331,7 +331,7 @@ void ScummEngine_v6he::setupOpcodes() {
OPCODE(o6_deleteFile),
OPCODE(o6_rename),
/* E0 */
OPCODE(o6_setVolume),
OPCODE(o6_soundOps),
OPCODE(o6_unknownE1),
OPCODE(o6_localizeArray),
OPCODE(o6_pickVarRandom),
@ -402,6 +402,9 @@ void ScummEngine_v6he::o6_setState() {
void ScummEngine_v6he::o6_startSound() {
// Seems to range between 952 - 9000
// In Fatty Bear's Birthday Surprise the piano uses offsets 1 - 23 to
// indicate which note to play, but only when using the standard piano
// sound. See also o6_soundOps().
int offset = pop();
debug(2, "o6_startSound: offset %d", offset);
_sound->addSoundToQueue(pop());
@ -1136,17 +1139,18 @@ void ScummEngine_v6he::o6_writeFile() {
}
}
void ScummEngine_v6he::o6_setVolume() {
void ScummEngine_v6he::o6_soundOps() {
byte subOp = fetchScriptByte();
int soundVolumeMaster;
int volume = pop();
switch (subOp) {
case 0xde:
_mixer->setMusicVolume(volume);
break;
case 0xe0:
soundVolumeMaster = ConfMan.getInt("master_volume");
_mixer->setVolume(volume * soundVolumeMaster / 255);
// Fatty Bear's Birthday surprise uses this when playing the
// piano, but only when using one of the digitized instruments.
// See also o6_startSound().
_sound->setOverrideFreq(volume);
break;
}
}

View File

@ -331,7 +331,7 @@ void ScummEngine_v7he::setupOpcodes() {
OPCODE(o6_deleteFile),
OPCODE(o6_rename),
/* E0 */
OPCODE(o6_setVolume),
OPCODE(o6_soundOps),
OPCODE(o6_unknownE1),
OPCODE(o6_localizeArray),
OPCODE(o6_pickVarRandom),

View File

@ -68,6 +68,7 @@ Sound::Sound(ScummEngine *parent)
_mouthSyncMode(false),
_endOfMouthSync(false),
_curSoundPos(0),
_overrideFreq(0),
_currentCDSound(0),
_soundsPaused(false),
_sfxMode(0) {
@ -140,6 +141,10 @@ void Sound::processSoundQues() {
_soundQuePos = 0;
}
void Sound::setOverrideFreq(int freq) {
_overrideFreq = freq;
}
void Sound::playSound(int soundID) {
byte *ptr;
char *sound;
@ -182,7 +187,12 @@ void Sound::playSound(int soundID) {
size = READ_BE_UINT32(ptr+4) - 8;
// FIXME - what value here ?!? 11025 is just a guess based on strings in w32 bin, prev guess 8000
rate = 11025;
if (_overrideFreq) {
// Used by the piano in Fatty Bear's Birthday Surprise
rate = _overrideFreq;
_overrideFreq = 0;
} else
rate = 11025;
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);

View File

@ -70,6 +70,8 @@ protected:
uint16 _mouthSyncTimes[64];
uint _curSoundPos;
int _overrideFreq;
int _currentCDSound;
public:
PlayingSoundHandle _talkChannelHandle; // Handle of mixer channel actor is talking on
@ -82,6 +84,7 @@ public:
void addSoundToQueue(int sound);
void addSoundToQueue2(int sound);
void processSoundQues();
void setOverrideFreq(int freq);
void playSound(int sound);
void startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle *handle = NULL);
void stopTalkSound();