[Scummvm-cvs-logs] CVS: residual costume.cpp,1.26,1.27 engine.cpp,1.57,1.58 engine.h,1.20,1.21 scene.cpp,1.35,1.36
Pawel Kolodziejski
aquadran at users.sourceforge.net
Mon Jan 10 01:54:02 CET 2005
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7430
Modified Files:
costume.cpp engine.cpp engine.h scene.cpp
Log Message:
attached 3d sound position to sound costume component
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- costume.cpp 5 Jan 2005 18:28:50 -0000 1.26
+++ costume.cpp 10 Jan 2005 09:53:01 -0000 1.27
@@ -18,6 +18,7 @@
#include "stdafx.h"
#include "debug.h"
#include "costume.h"
+#include "actor.h"
#include "textsplit.h"
#include "engine.h"
#include "colormap.h"
@@ -504,10 +505,9 @@
// 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);
+ if (g_engine->currScene() && g_currentUpdatedActor) {
+ Vector3d pos = g_currentUpdatedActor->pos();
+ g_engine->currScene()->setSoundPosition(_soundName.c_str(), pos);
}
}
break;
Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- engine.cpp 10 Jan 2005 09:07:46 -0000 1.57
+++ engine.cpp 10 Jan 2005 09:53:02 -0000 1.58
@@ -36,6 +36,9 @@
extern Imuse *g_imuse;
int g_imuseState = -1;
+// hack for access current upated actor to allow access position of actor to sound costume component
+Actor *g_currentUpdatedActor = NULL;
+
Engine::Engine() :
_currScene(NULL), _selectedActor(NULL) {
for (int i = 0; i < SDLK_EXTRA_LAST; i++)
@@ -135,9 +138,11 @@
// Update actor costumes
for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
Actor *a = *i;
+ g_currentUpdatedActor = *i;
if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
a->update();
}
+ g_currentUpdatedActor = NULL;
if (_currScene != NULL) {
_currScene->drawBackground();
Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- engine.h 3 Jan 2005 16:27:56 -0000 1.20
+++ engine.h 10 Jan 2005 09:53:02 -0000 1.21
@@ -172,6 +172,8 @@
extern int g_imuseState;
+extern Actor *g_currentUpdatedActor;
+
void vimaInit(uint16 *destTable);
void decompressVima(const byte *src, int16 *dest, int destLen, uint16 *destTable);
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- scene.cpp 10 Jan 2005 09:07:46 -0000 1.35
+++ scene.cpp 10 Jan 2005 09:53:02 -0000 1.36
@@ -225,7 +225,7 @@
float distance = vector.magnitude();
float maxDistance = 8.0f;
int diffVolume = _maxVolume - _minVolume;
- int newVolume = (diffVolume * distance) / maxDistance;
+ int newVolume = diffVolume * (1.0 - (distance / maxDistance));
newVolume += _minVolume;
g_imuse->setVolume(soundName, newVolume);
More information about the Scummvm-git-logs
mailing list