aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/sound.cpp48
-rw-r--r--engines/fullpipe/sound.h6
2 files changed, 53 insertions, 1 deletions
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index 628d352e54..8280d64b6e 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -26,6 +26,7 @@
#include "fullpipe/scene.h"
#include "fullpipe/sound.h"
#include "fullpipe/ngiarchive.h"
+#include "fullpipe/messages.h"
#include "common/memstream.h"
#include "audio/audiostream.h"
#include "audio/decoders/vorbis.h"
@@ -80,6 +81,7 @@ Sound::Sound() {
_objectId = 0;
memset(_directSoundBuffers, 0, sizeof(_directSoundBuffers));
_description = 0;
+ _volume = 100;
}
Sound::~Sound() {
@@ -123,6 +125,24 @@ void Sound::setPanAndVolume(int vol, int pan) {
warning("STUB: Sound::setPanAndVolume");
}
+void Sound::play(int flag) {
+ warning("STUB: Sound::play()");
+}
+
+void Sound::freeSound() {
+ warning("STUB: Sound::freeSound()");
+}
+
+int Sound::getVolume() {
+ warning("STUB: Sound::getVolume()");
+
+ return _volume;
+}
+
+void Sound::stop() {
+ warning("STUB: Sound::stop()");
+}
+
void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) {
warning("STUB: FullpipeEngine::setSceneMusicParameters()");
#if 0
@@ -350,7 +370,33 @@ void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed
}
void global_messageHandler_handleSound(ExCommand *cmd) {
- debug(0, "STUB: global_messageHandler_handleSound()");
+ if (!g_fp->_soundEnabled)
+ return;
+
+ Sound *snd = 0;
+
+ for (int i = 0; i < g_fp->_currSoundListCount; i++)
+ snd = g_fp->_currSoundList1[i]->getSoundByIndex(i);
+
+ if (!snd)
+ return;
+
+ if (cmd->_field_14 & 1) {
+ if (!g_fp->_flgSoundList && (cmd->_field_14 & 4))
+ snd->freeSound();
+
+ snd->updateVolume();
+
+ if (snd->_objectId && g_fp->_currentScene->getStaticANIObject1ById(snd->_objectId, -1))
+ snd->setPanAndVolumeByStaticAni();
+ else
+ snd->setPanAndVolume(g_fp->_sfxVolume, 0);
+
+ if (snd->getVolume() > -3500)
+ snd->play(cmd->_keyCode);
+ } else if (cmd->_field_14 & 2) {
+ snd->stop();
+ }
}
void FullpipeEngine::stopSoundStream2() {
diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h
index e284e5efab..21d9d825a0 100644
--- a/engines/fullpipe/sound.h
+++ b/engines/fullpipe/sound.h
@@ -32,6 +32,7 @@ class Sound : public MemoryObject {
int _directSoundBuffers[7];
byte *_soundData;
Audio::SoundHandle _handle;
+ int _volume;
public:
int16 _objectId;
@@ -46,6 +47,11 @@ public:
int getId() const { return _id; }
Audio::SoundHandle getHandle() const { return _handle; }
+ void play(int flag);
+ void freeSound();
+ int getVolume();
+ void stop();
+
void setPanAndVolumeByStaticAni();
void setPanAndVolume(int vol, int pan);
};