From 02fd1530b77f669a2a450be201a53359bb549765 Mon Sep 17 00:00:00 2001 From: driAn Date: Sat, 11 Oct 2008 21:00:12 +0000 Subject: [PATCH] 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 --- source/src/sound.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/src/sound.cpp b/source/src/sound.cpp index a52e936b..a00f0e7c 100644 --- a/source/src/sound.cpp +++ b/source/src/sound.cpp @@ -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; }