[Scummvm-cvs-logs] CVS: residual actor.cpp,1.39,1.40 costume.cpp,1.25,1.26 engine.cpp,1.54,1.55 lua.cpp,1.94,1.95 scene.cpp,1.31,1.32 scene.h,1.21,1.22
Pawel Kolodziejski
aquadran at users.sourceforge.net
Wed Jan 5 10:30:23 CET 2005
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18088
Modified Files:
actor.cpp costume.cpp engine.cpp lua.cpp scene.cpp scene.h
Log Message:
some more imuse changes
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/actor.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- actor.cpp 2 Jan 2005 13:57:16 -0000 1.39
+++ actor.cpp 5 Jan 2005 18:28:49 -0000 1.40
@@ -231,6 +231,10 @@
_lipSynch = g_resourceloader->loadLipSynch(soundLip.c_str());
_talkSoundName = soundName;
g_imuse->startVoice(_talkSoundName.c_str());
+ if (g_engine->currScene()) {
+ g_engine->currScene()->setSoundPosition(_talkSoundName.c_str(), pos());
+ }
+
_talkAnim = -1;
}
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- costume.cpp 2 Jan 2005 22:48:29 -0000 1.25
+++ costume.cpp 5 Jan 2005 18:28:50 -0000 1.26
@@ -370,6 +370,8 @@
case 2: // Hold at end
_currTime = animLength;
break;
+ default:
+ warning("Unknown repeat mode %d for keyframe %s\n", _repeatMode, _keyf->filename());
}
}
_keyf->animate(_hier, _currTime / 1000.0, _priority1, _priority2);
@@ -502,6 +504,11 @@
// g_imuse->stopSound(_soundName.c_str());
// } else {
g_imuse->startSfx(_soundName.c_str());
+ if (g_engine->currScene()) {
+ Vector3d pos;
+ // TODO: how to get position of actor using that costume component
+// g_engine->currScene()->setSoundPosition(_soundName.c_str(), pos);
+ }
}
break;
case 1: // "Stop"
Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- engine.cpp 3 Jan 2005 16:27:56 -0000 1.54
+++ engine.cpp 5 Jan 2005 18:28:50 -0000 1.55
@@ -346,5 +346,6 @@
warning("Could not find scene file %s\n", name);
delete _currScene;
_currScene = new Scene(name, b->data(), b->len());
+ _currScene->setSoundParameters(20, 127);
delete b;
}
Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- lua.cpp 3 Jan 2005 16:27:56 -0000 1.94
+++ lua.cpp 5 Jan 2005 18:28:50 -0000 1.95
@@ -705,7 +705,7 @@
char *str = lua_getstring(param2);
msg = parseMsgText(str, msgId);
} else if (lua_isnumber(param2)) {
- pan = 0;
+ pan = 64;
} else if (lua_istable(param2)) {
} else {
error("SayLine() unknown type of param");
@@ -1006,23 +1006,49 @@
}
static void SaveIMuse() {
- warning("SaveIMuse() is not yet supported");
+ error("SaveIMuse() is not yet supported");
}
static void RestoreIMuse() {
- warning("RestoreIMuse() is not yet supported");
+ error("RestoreIMuse() is not yet supported");
}
static void SetSoundPosition() {
- warning("SetSoundPosition() is not yet supported");
+ Vector3d pos;
+ int minVolume = 10;
+ int maxVolume = 127;
+
+ if (g_engine->currScene()) {
+ g_engine->currScene()->getSoundParameters(&minVolume, &maxVolume);
+ }
+
+ char *soundName = lua_getstring(lua_getresult(1));
+
+ if (isActor(lua_getparam(2))) {
+ Actor *act = check_actor(2);
+ if (act) {
+ pos = act->pos();
+ } else {
+ return;
+ }
+ minVolume = check_int(3);
+ maxVolume = check_int(4);
+ } else {
+ error("SetSoundPosition() Position sound params not supported.");
+ }
+
+ if (g_engine->currScene()) {
+ g_engine->currScene()->setSoundParameters(minVolume, maxVolume);
+ g_engine->currScene()->setSoundPosition(soundName, pos);
+ }
}
static void IsSoundPlaying() {
- error("IsSoundPlaying() is not supported");
+ // dummy
}
static void PlaySoundAt() {
- error("PlaySoundAt() is not supported");
+ // dummy
}
void setFrameTime(float frameTime) {
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- scene.cpp 1 Jan 2005 12:27:56 -0000 1.31
+++ scene.cpp 5 Jan 2005 18:28:50 -0000 1.32
@@ -26,6 +26,8 @@
#include "screen.h"
#include "driver_gl.h"
+#include "imuse/imuse.h"
+
#include <SDL.h>
#include <cmath>
@@ -54,6 +56,10 @@
_numLights = -1;
_lights = NULL;
_sectors = NULL;
+
+ _minVolume = 0;
+ _maxVolume = 0;
+
// Lights are optional
if (ts.eof())
return;
@@ -220,3 +226,28 @@
}
return NULL;
}
+
+void Scene::setSoundPosition(const char *soundName, Vector3d pos) {
+ Vector3d cameraPos = _currSetup->_pos;
+ Vector3d vector;
+ vector.set(fabs(cameraPos.x() - pos.x()), fabs(cameraPos.y() - pos.y()), fabs(cameraPos.z() - pos.z()));
+ float distance = vector.magnitude();
+ float maxDistance = 8.0f;
+ int diffVolume = _maxVolume - _minVolume;
+ int newVolume = (diffVolume * distance) / maxDistance;
+ newVolume += _minVolume;
+ g_imuse->setVolume(soundName, newVolume);
+
+ // TODO: pan
+ // roll, fov
+}
+
+void Scene::setSoundParameters(int minVolume, int maxVolume) {
+ _minVolume = minVolume;
+ _maxVolume = maxVolume;
+}
+
+void Scene::getSoundParameters(int *minVolume, int *maxVolume) {
+ *minVolume = _minVolume;
+ *maxVolume = _maxVolume;
+}
Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- scene.h 1 Jan 2005 12:27:56 -0000 1.21
+++ scene.h 5 Jan 2005 18:28:50 -0000 1.22
@@ -39,6 +39,9 @@
Scene(const char *name, const char *buf, int len);
~Scene();
+ int _minVolume;
+ int _maxVolume;
+
void drawBackground() const {
if (_currSetup->_bkgndZBm != NULL) // Some screens have no zbuffer mask (eg, Alley)
_currSetup->_bkgndZBm->draw();
@@ -54,6 +57,10 @@
_currSetup->setupCamera();
}
+ void setSoundPosition(const char *soundName, Vector3d pos);
+ void setSoundParameters(int minVolume, int maxVolume);
+ void getSoundParameters(int *minVolume, int *maxVolume);
+
const char *name() const { return _name.c_str(); }
void setSetup(int num);
More information about the Scummvm-git-logs
mailing list