aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2003-12-20 16:54:46 +0000
committerGregory Montoir2003-12-20 16:54:46 +0000
commit33ca6ecfa5d97db0e63092268eca4e94c0851fa3 (patch)
tree8204d6ccfbc599ef7e4f7a6a48f660372653669d /queen
parent2c19e18fc85becb52fceab42c7bddf19a0913459 (diff)
downloadscummvm-rg350-33ca6ecfa5d97db0e63092268eca4e94c0851fa3.tar.gz
scummvm-rg350-33ca6ecfa5d97db0e63092268eca4e94c0851fa3.tar.bz2
scummvm-rg350-33ca6ecfa5d97db0e63092268eca4e94c0851fa3.zip
some code to play the 'room background sfx' (equivalent to sfxplay(NULLstr))
svn-id: r11786
Diffstat (limited to 'queen')
-rw-r--r--queen/cutaway.cpp2
-rw-r--r--queen/graphics.cpp20
-rw-r--r--queen/logic.cpp2
-rw-r--r--queen/logic.h1
-rw-r--r--queen/sound.cpp65
-rw-r--r--queen/sound.h12
-rw-r--r--queen/talk.cpp7
-rw-r--r--queen/xref.txt2
8 files changed, 51 insertions, 60 deletions
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp
index 2f968eff87..fc679a6882 100644
--- a/queen/cutaway.cpp
+++ b/queen/cutaway.cpp
@@ -1366,7 +1366,7 @@ void Cutaway::handleText(
char voiceFileName[MAX_STRING_SIZE];
findCdCut(_basename, index, voiceFileName);
strcat(voiceFileName, "1");
- _vm->sound()->sfxPlay(voiceFileName);
+ _vm->sound()->playSfx(voiceFileName);
}
int i;
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index 2cc14e3adc..3b49cdfe14 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -131,12 +131,6 @@ void BobSlot::animOneStep() {
frameNum = nextFrame;
}
anim.speed = anim.string.curPos->speed / 4;
-
- // play memory sfx and move on to next frame
- if(frameNum > 500) {
- frameNum -= 500;
- // XXX _sound->sfxplay(NULLstr);
- }
}
}
else {
@@ -469,6 +463,10 @@ void Graphics::bobSortAll() {
if (pbs->animating) {
pbs->animOneStep();
+ if (pbs->frameNum > 500) {
+ pbs->frameNum -= 500;
+ _vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
+ }
}
if (pbs->moving) {
int16 j;
@@ -765,8 +763,10 @@ void BamScene::updateCarAnimation() {
else {
++_index;
}
- // Play BKG SFX
- // XXX if(bamsfx==2 && SFXTOGGLE) sfxplay(NULLstr);
+
+ if (bdb->sfx == 2) {
+ _vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
+ }
}
}
@@ -808,10 +808,10 @@ void BamScene::updateFightAnimation() {
_screenShaked = true;
break;
case 2: // play background sfx
- // XXX if(SFXTOGGLE) sfxplay(NULLstr);
+ _vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
break;
case 3: // play background sfx and shake screen
- // XXX if(SFXTOGGLE) sfxplay(NULLstr);
+ _vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
OSystem::instance()->set_shake_pos(3);
_screenShaked = true;
break;
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 729fc7af5f..12352a08cf 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -2958,7 +2958,7 @@ void Logic::asmMakeLightningHitPlane() {
lightningBob->y = 0;
// 23/2/95 - Play lightning SFX
- // XXX sfxplay(NULLstr);
+ _vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
_vm->graphics()->bankUnpack(18, lightningBob->frameNum, 15);
_vm->graphics()->bankUnpack(4, planeBob ->frameNum, 15);
diff --git a/queen/logic.h b/queen/logic.h
index b392b3a0ae..5a1926ae22 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -107,6 +107,7 @@ public:
uint16 currentRoomData() const { return _roomData[_currentRoom]; }
ObjectDescription *objectDescription(uint16 objNum) const { return &_objectDescription[objNum]; }
uint16 objectDescriptionCount() const { return _numObjDesc; }
+ uint16 currentRoomSfx() const { return _sfxName[_currentRoom]; }
uint16 joeFacing() const { return _joe.facing; }
uint16 joeX() const { return _joe.x; }
diff --git a/queen/sound.cpp b/queen/sound.cpp
index 9c398d2ba6..ef4e9b65d2 100644
--- a/queen/sound.cpp
+++ b/queen/sound.cpp
@@ -135,6 +135,27 @@ void Sound::waitSfxFinished() {
_vm->input()->delay(10);
}
+void Sound::playSfx(uint16 sfx) {
+ if (sfx != 0) {
+ char name[13];
+ strcpy(name, _sfxName[sfx - 1]);
+ strcat(name, ".SB");
+ sfxPlay(name);
+ }
+}
+
+void Sound::playSfx(const char *base) {
+ char name[13];
+ strcpy(name, base);
+ // alter filename to add zeros and append ".SB"
+ for (int i = 0; i < 8; i++) {
+ if (name[i] == ' ')
+ name[i] = '0';
+ }
+ strcat(name, ".SB");
+ sfxPlay(name);
+}
+
void Sound::playSong(int16 songNum) {
if (songNum == STOP_MUSIC) {
_vm->music()->stopSong();
@@ -145,7 +166,7 @@ void Sound::playSong(int16 songNum) {
if (_tune[newTune - 1].sfx[0]) {
if (sfxOn())
- sfxPlay(_sfxName[_tune[newTune - 1].sfx[0] - 1]);
+ playSfx(_tune[newTune - 1].sfx[0]);
return;
}
@@ -174,57 +195,27 @@ void Sound::playSong(int16 songNum) {
int SBSound::playSound(byte *sound, uint32 size) {
- byte flags = 0 | SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
+ byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
return _mixer->playRaw(&_sfxHandle, sound, size, 11025, flags);
}
-void SBSound::sfxPlay(const char *base) {
- char name[13];
- strcpy(name, base);
- //alter filename to add zeros and append ".SB"
- for (int i = 0; i < 8; i++) {
- if (name[i] == ' ')
- name[i] = '0';
- }
- strcat(name, ".SB");
-
- waitSfxFinished();
-
+void SBSound::sfxPlay(const char *name) {
+ waitSfxFinished();
if (_vm->resource()->exists(name))
playSound(_vm->resource()->loadFileMalloc(name, SB_HEADER_SIZE), _vm->resource()->fileSize(name) - SB_HEADER_SIZE);
}
#ifdef USE_MAD
-void MP3Sound::sfxPlay(const char *base) {
- char name[13];
- strcpy(name, base);
- //alter filename to add zeros and append ".SB"
- for (int i = 0; i < 8; i++) {
- if (name[i] == ' ')
- name[i] = '0';
- }
- strcat(name, ".SB");
-
+void MP3Sound::sfxPlay(const char *name) {
waitSfxFinished();
-
if (_vm->resource()->exists(name))
_mixer->playMP3(&_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name));
}
#endif
#ifdef USE_VORBIS
-void OGGSound::sfxPlay(const char *base) {
- char name[13];
- strcpy(name, base);
- //alter filename to add zeros and append ".SB"
- for (int i = 0; i < 8; i++) {
- if (name[i] == ' ')
- name[i] = '0';
- }
- strcat(name, ".SB");
-
- waitSfxFinished();
-
+void OGGSound::sfxPlay(const char *name) {
+ waitSfxFinished();
if (_vm->resource()->exists(name)) {
OggVorbis_File *oggFile = new OggVorbis_File;
file_info *f = new file_info;
diff --git a/queen/sound.h b/queen/sound.h
index 14ae5796af..6b39f752e1 100644
--- a/queen/sound.h
+++ b/queen/sound.h
@@ -53,9 +53,11 @@ class Sound {
public:
Sound(SoundMixer *mixer, QueenEngine *vm);
virtual ~Sound();
- virtual void sfxPlay(const char *base) = 0;
+ virtual void sfxPlay(const char *name) = 0;
static Sound *giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression);
void waitSfxFinished();
+ void playSfx(uint16 sfx);
+ void playSfx(const char *base);
void playSong(int16 songNum);
bool sfxOn() { return _sfxToggle; }
@@ -94,13 +96,13 @@ protected:
class SilentSound : public Sound {
public:
SilentSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
- void sfxPlay(const char *base) { }
+ void sfxPlay(const char *name) { }
};
class SBSound : public Sound {
public:
SBSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
- void sfxPlay(const char *base);
+ void sfxPlay(const char *name);
protected:
int playSound(byte *sound, uint32 size);
};
@@ -109,7 +111,7 @@ protected:
class MP3Sound : public Sound {
public:
MP3Sound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
- void sfxPlay(const char *base);
+ void sfxPlay(const char *name);
};
#endif
@@ -117,7 +119,7 @@ public:
class OGGSound : public Sound {
public:
OGGSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
- void sfxPlay(const char *base);
+ void sfxPlay(const char *name);
};
#endif
} // End of namespace Queen
diff --git a/queen/talk.cpp b/queen/talk.cpp
index e7fdf023f6..e531c31e09 100644
--- a/queen/talk.cpp
+++ b/queen/talk.cpp
@@ -748,10 +748,7 @@ void Talk::stringAnimation(const SpeechParameters *parameters, int startFrame, i
if (frame > 500) {
frame -= 500;
- // XXX #ifdef __DOS__
- // XXX if(SFXTOGGLE)
- // XXX sfxplay(NULLstr);
- // XXX #endif
+ _vm->sound()->playSfx(_vm->logic()->currentRoomSfx());
}
if (torso) {
@@ -905,7 +902,7 @@ void Talk::speakSegment(
// debug(0, "Sentence segment '%*s' is said by person '%s' and voice file '%s' is played",
// length, segment, person->name, voiceFileName);
- _vm->sound()->sfxPlay(voiceFileName);
+ _vm->sound()->playSfx(voiceFileName);
//debug(0, "Playing voice file '%s'", voiceFileName);
int faceDirectionCommand = 0;
diff --git a/queen/xref.txt b/queen/xref.txt
index ed01e5b711..980912a509 100644
--- a/queen/xref.txt
+++ b/queen/xref.txt
@@ -333,7 +333,7 @@ SOUND
alter_current_volume()
playsong() Sound::playSong()
sfxbusy() Sound::waitSfxFinished()
-sfxplay() Sound::sfxPlay()
+sfxplay() Sound::playSfx()
-
song[] Sound::_song[]
tunelist[] Sound::_tune[]