also apply sound-entity volume for non-ambient sounds

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2962 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-10-11 21:00:12 +00:00
parent 68f4258cb2
commit 02fd1530b7
+4 -2
View File
@@ -1085,11 +1085,12 @@ struct location : sourceowner
}
case worldobjreference::WR_ENTITY:
{
entityreference &eref = *(entityreference *)ref;
const float vol = eref.ent->attr4<=0.0f ? 1.0f : eref.ent->attr4/255.0f;
if(ref->nodistance())
{
// own distance model for entities/mapsounds: linear & clamping
entityreference &eref = *(entityreference *)ref;
const float vol = eref.ent->attr4<=0.0f ? 1.0f : eref.ent->attr4/255.0f;
float dist = camera1->o.dist(pos);
if(dist <= eref.ent->attr3) src->gain(1.0f*vol);
else if(dist <= eref.ent->attr2) src->gain((1.0f - dist/(float)eref.ent->attr2)*vol);
@@ -1099,6 +1100,7 @@ struct location : sourceowner
{
// use openal distance model to make the sound appear from a certain direction (non-ambient)
src->position(pos);
src->gain(vol);
}
break;
}