aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2014-04-19 17:01:29 +0300
committerEugene Sandulenko2014-04-19 17:01:29 +0300
commite76a89048159ff20e59358706f43885a9786723c (patch)
treef2e9c74bc9dda41accb3641ac92ff3b29d02a532 /engines
parent559f51e29eba41b7a6ab63801bc2196ce9b6335a (diff)
downloadscummvm-rg350-e76a89048159ff20e59358706f43885a9786723c.tar.gz
scummvm-rg350-e76a89048159ff20e59358706f43885a9786723c.tar.bz2
scummvm-rg350-e76a89048159ff20e59358706f43885a9786723c.zip
FULLPIPE: Implement ModalMainMenu::updateSoundVolume()
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/modal.cpp70
-rw-r--r--engines/fullpipe/sound.cpp4
-rw-r--r--engines/fullpipe/sound.h5
3 files changed, 78 insertions, 1 deletions
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 5c73dcfe08..aed98c1130 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -1034,6 +1034,76 @@ void ModalMainMenu::updateVolume() {
}
void ModalMainMenu::updateSoundVolume(Sound *snd) {
+ if (!snd->_objectId)
+ return;
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(snd->_objectId, -1);
+ if (!ani)
+ return;
+
+ int a, b;
+
+ if (ani->_ox >= _screct.left) {
+ int par, pan;
+
+ if (ani->_ox <= _screct.right) {
+ int dx;
+
+ if (ani->_oy <= _screct.bottom) {
+ if (ani->_oy >= _screct.top) {
+ snd->setPanAndVolume(g_fp->_sfxVolume, 0);
+
+ return;
+ }
+ dx = _screct.top - ani->_oy;
+ } else {
+ dx = ani->_oy - _screct.bottom;
+ }
+
+ par = 0;
+
+ if (dx > 800) {
+ snd->setPanAndVolume(-3500, 0);
+ return;
+ }
+
+ pan = -3500;
+ a = g_fp->_sfxVolume - (-3500);
+ b = 800 - dx;
+ } else {
+ int dx = ani->_ox - _screct.right;
+
+ if (dx > 800) {
+ snd->setPanAndVolume(-3500, 0);
+ return;
+ }
+
+ pan = -3500;
+ par = dx * (-3500) / -800;
+ a = g_fp->_sfxVolume - (-3500);
+ b = 800 - dx;
+ }
+
+ int32 pp = b * a; //(0x51EB851F * b * a) >> 32) >> 8; // TODO FIXME
+
+ snd->setPanAndVolume(pan + (pp >> 31) + pp, par);
+
+ return;
+ }
+
+ int dx = _screct.left - ani->_ox;
+ if (dx <= 800) {
+ int32 s = 0x51EB851F * (800 - dx) * (g_fp->_sfxVolume - (-3500)); // TODO FIXME
+ int32 p = -3500 + (s >> 31) + (s >> 8);
+
+ if (p > g_fp->_sfxVolume)
+ p = g_fp->_sfxVolume;
+
+ snd->setPanAndVolume(p, dx * (-3500) / 800);
+ } else {
+ snd->setPanAndVolume(-3500, 0);
+ }
+
warning("STUB: ModalMainMenu::updateSoundVolume()");
}
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index 4270b13b38..aa91f25087 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -119,6 +119,10 @@ void Sound::setPanAndVolumeByStaticAni() {
debug(3, "STUB Sound::setPanAndVolumeByStaticAni()");
}
+void Sound::setPanAndVolume(int vol, int pan) {
+ warning("STUB: Sound::setPanAndVolume");
+}
+
void FullpipeEngine::setSceneMusicParameters(GameVar *var) {
warning("STUB: FullpipeEngine::setSceneMusicParameters()");
// TODO: Finish this (MINDELAY, MAXDELAY, LOCAL, SEQUENCE, STARTDELAY etc)
diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h
index 8ddfc753ce..e284e5efab 100644
--- a/engines/fullpipe/sound.h
+++ b/engines/fullpipe/sound.h
@@ -28,13 +28,15 @@ namespace Fullpipe {
class Sound : public MemoryObject {
int _id;
char *_description;
- int16 _objectId;
int _directSoundBuffer;
int _directSoundBuffers[7];
byte *_soundData;
Audio::SoundHandle _handle;
public:
+ int16 _objectId;
+
+public:
Sound();
virtual ~Sound();
@@ -45,6 +47,7 @@ public:
Audio::SoundHandle getHandle() const { return _handle; }
void setPanAndVolumeByStaticAni();
+ void setPanAndVolume(int vol, int pan);
};
class SoundList : public CObject {