[Scummvm-cvs-logs] scummvm master -> e76a89048159ff20e59358706f43885a9786723c

sev- sev at scummvm.org
Sat Apr 19 16:02:03 CEST 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e76a890481 FULLPIPE: Implement ModalMainMenu::updateSoundVolume()


Commit: e76a89048159ff20e59358706f43885a9786723c
    https://github.com/scummvm/scummvm/commit/e76a89048159ff20e59358706f43885a9786723c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-04-19T17:01:29+03:00

Commit Message:
FULLPIPE: Implement ModalMainMenu::updateSoundVolume()

Changed paths:
    engines/fullpipe/modal.cpp
    engines/fullpipe/sound.cpp
    engines/fullpipe/sound.h



diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 5c73dcf..aed98c1 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 4270b13..aa91f25 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 8ddfc75..e284e5e 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 {






More information about the Scummvm-git-logs mailing list